* configure.in: Permit --enable-shared to specify a list of
[external/binutils.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 if test "${shared}" = "true"; then
37   case "${host}" in
38   *-*-sunos*)
39   # On SunOS, we must link against the name we are going to install,
40   # not -lbfd, since SunOS does not support SONAME.
41   BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
42   ;;
43   esac
44 fi
45 AC_SUBST(BFDLIB)
46
47 HLDFLAGS=
48 # If we have shared libraries, try to set rpath reasonably.
49 if test "${shared}" = "true"; then
50   case "${host}" in
51   *-*-hpux*)
52     HLDFLAGS='-Wl,+s,+b,$(libdir)'
53     ;;
54   *-*-irix5*)
55     HLDFLAGS='-Wl,-rpath,$(libdir)'
56     ;;
57   *-*-linux*aout*)
58     ;;
59   *-*-linux*)
60     HLDFLAGS='-Wl,-rpath,$(libdir)'
61     ;;
62   *-*-sysv4* | *-*-solaris*)
63     HLDFLAGS='-R $(libdir)'
64     ;;
65   esac
66 fi
67
68 # On SunOS, if the linker supports the -rpath option, use it to
69 # prevent ../bfd and ../opcodes from being included in the run time
70 # search path.
71 case "${host}" in
72   *-*-sunos*)
73     echo 'main () { }' > conftest.c
74     ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
75     if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
76       :
77     elif grep 'No such file' conftest.t >/dev/null 2>&1; then
78       :
79     elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
80       :
81     elif test "${shared}" = "true"; then
82       HLDFLAGS='-Wl,-rpath=$(libdir)'
83     else
84       HLDFLAGS='-Wl,-rpath='
85     fi
86     rm -f conftest.t conftest.c conftest
87     ;;
88 esac
89 AC_SUBST(HLDFLAGS)
90
91 AC_OUTPUT(Makefile)