* configure.in: On alpha*-*-osf*, link against libbfd.a if not
[deliverable/binutils-gdb.git] / gprof / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.3)dnl
3 AC_INIT(gprof.c)
4
5 AC_ARG_ENABLE(shared,
6 [ --enable-shared build shared BFD library],
7 [case "${enableval}" in
8 yes) shared=true ;;
9 no) shared=false ;;
10 *bfd*) shared=true ;;
11 *) shared=false ;;
12 esac])dnl
13
14 AC_PROG_CC
15
16 AC_CANONICAL_SYSTEM
17 AC_ARG_PROGRAM
18
19 case "${target}" in
20 alpha-*-*) MY_TARGET=alpha ;;
21 changequote(,)dnl
22 i[345]86-*-*) MY_TARGET=i386 ;;
23 changequote([,])dnl
24 sparc-*-*) MY_TARGET=sparc ;;
25 tahoe-*-*) MY_TARGET=tahoe ;;
26 vax-*-*) MY_TARGET=vax ;;
27 ns32k-*-*) MY_TARGET=ns532;;
28 *-*-*) MY_TARGET=dummy ;;
29 esac
30
31 AC_SUBST(MY_TARGET)
32
33 BFDLIB='-L../bfd -lbfd'
34
35 # We need to handle some special cases if BFD was built shared.
36 case "${host}" in
37 *-*-sunos*)
38 # On SunOS, we must link against the name we are going to install,
39 # not -lbfd, since SunOS does not support SONAME.
40 if test "${shared}" = "true"; then
41 BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
42 fi
43 ;;
44 alpha*-*-osf*)
45 # On Alpha OSF/1, the native linker searches all the -L
46 # directories for any LIB.so files, and only then searches for any
47 # LIB.a files. That means that if there is an installed
48 # libbfd.so, but this build is not done with --enable-shared, the
49 # link will wind up being against the install libbfd.so rather
50 # than the newly built libbfd. To avoid this, we must explicitly
51 # link against libbfd.a when --enable-shared is not used.
52 if test "${shared}" != "true"; then
53 BFDLIB='../bfd/libbfd.a'
54 fi
55 ;;
56 esac
57 AC_SUBST(BFDLIB)
58
59 HLDFLAGS=
60 # If we have shared libraries, try to set rpath reasonably.
61 if test "${shared}" = "true"; then
62 case "${host}" in
63 *-*-hpux*)
64 HLDFLAGS='-Wl,+s,+b,$(libdir)'
65 ;;
66 *-*-irix5*)
67 HLDFLAGS='-Wl,-rpath,$(libdir)'
68 ;;
69 *-*-linux*aout*)
70 ;;
71 *-*-linux*)
72 HLDFLAGS='-Wl,-rpath,$(libdir)'
73 ;;
74 *-*-sysv4* | *-*-solaris*)
75 HLDFLAGS='-R $(libdir)'
76 ;;
77 esac
78 fi
79
80 # On SunOS, if the linker supports the -rpath option, use it to
81 # prevent ../bfd and ../opcodes from being included in the run time
82 # search path.
83 case "${host}" in
84 *-*-sunos*)
85 echo 'main () { }' > conftest.c
86 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
87 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
88 :
89 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
90 :
91 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
92 :
93 elif test "${shared}" = "true"; then
94 HLDFLAGS='-Wl,-rpath=$(libdir)'
95 else
96 HLDFLAGS='-Wl,-rpath='
97 fi
98 rm -f conftest.t conftest.c conftest
99 ;;
100 esac
101 AC_SUBST(HLDFLAGS)
102
103 AC_OUTPUT(Makefile)
This page took 0.034586 seconds and 5 git commands to generate.