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