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