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