Commit | Line | Data |
---|---|---|
7858d8dc C |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | AC_PREREQ(2.3)dnl | |
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 |
c98f0ae5 | 15 | |
7858d8dc C |
16 | AC_CANONICAL_SYSTEM |
17 | AC_ARG_PROGRAM | |
c98f0ae5 | 18 | |
5d32c952 | 19 | case "${target}" in |
7858d8dc | 20 | alpha-*-*) MY_TARGET=alpha ;; |
379062d1 | 21 | changequote(,)dnl |
7858d8dc | 22 | i[345]86-*-*) MY_TARGET=i386 ;; |
379062d1 | 23 | changequote([,])dnl |
7858d8dc C |
24 | sparc-*-*) MY_TARGET=sparc ;; |
25 | tahoe-*-*) MY_TARGET=tahoe ;; | |
26 | vax-*-*) MY_TARGET=vax ;; | |
af0786b4 | 27 | ns32k-*-*) MY_TARGET=ns532;; |
7858d8dc | 28 | *-*-*) MY_TARGET=dummy ;; |
a11d7ba3 SEF |
29 | esac |
30 | ||
7858d8dc | 31 | AC_SUBST(MY_TARGET) |
ba8e3a2e ILT |
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 | |
56f9773f ILT |
51 | *-*-hpux*) |
52 | HLDFLAGS='-Wl,+s,+b,$(libdir)' | |
53 | ;; | |
ba8e3a2e ILT |
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 | : | |
7925f4d4 ILT |
79 | elif grep 'do not mix' conftest.t >/dev/null 2>&1; then |
80 | : | |
ba8e3a2e ILT |
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 | ||
7858d8dc | 91 | AC_OUTPUT(Makefile) |