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 ;; | |
10 | *) AC_MSG_ERROR([bad value ${enableval} for BFD shared option]) ;; | |
11 | esac])dnl | |
12 | ||
7858d8dc | 13 | AC_PROG_CC |
c98f0ae5 | 14 | |
7858d8dc C |
15 | AC_CANONICAL_SYSTEM |
16 | AC_ARG_PROGRAM | |
c98f0ae5 | 17 | |
5d32c952 | 18 | case "${target}" in |
7858d8dc | 19 | alpha-*-*) MY_TARGET=alpha ;; |
379062d1 | 20 | changequote(,)dnl |
7858d8dc | 21 | i[345]86-*-*) MY_TARGET=i386 ;; |
379062d1 | 22 | changequote([,])dnl |
7858d8dc C |
23 | sparc-*-*) MY_TARGET=sparc ;; |
24 | tahoe-*-*) MY_TARGET=tahoe ;; | |
25 | vax-*-*) MY_TARGET=vax ;; | |
af0786b4 | 26 | ns32k-*-*) MY_TARGET=ns532;; |
7858d8dc | 27 | *-*-*) MY_TARGET=dummy ;; |
a11d7ba3 SEF |
28 | esac |
29 | ||
7858d8dc | 30 | AC_SUBST(MY_TARGET) |
ba8e3a2e ILT |
31 | |
32 | BFDLIB='-L../bfd -lbfd' | |
33 | ||
34 | # We need to handle some special cases if BFD was built shared. | |
35 | if test "${shared}" = "true"; then | |
36 | case "${host}" in | |
37 | *-*-sunos*) | |
38 | # On SunOS, we must link against the name we are going to install, | |
39 | # not -lbfd, since SunOS does not support SONAME. | |
40 | BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`' | |
41 | ;; | |
42 | esac | |
43 | fi | |
44 | AC_SUBST(BFDLIB) | |
45 | ||
46 | HLDFLAGS= | |
47 | # If we have shared libraries, try to set rpath reasonably. | |
48 | if test "${shared}" = "true"; then | |
49 | case "${host}" in | |
56f9773f ILT |
50 | *-*-hpux*) |
51 | HLDFLAGS='-Wl,+s,+b,$(libdir)' | |
52 | ;; | |
ba8e3a2e ILT |
53 | *-*-irix5*) |
54 | HLDFLAGS='-Wl,-rpath,$(libdir)' | |
55 | ;; | |
56 | *-*-linux*aout*) | |
57 | ;; | |
58 | *-*-linux*) | |
59 | HLDFLAGS='-Wl,-rpath,$(libdir)' | |
60 | ;; | |
61 | *-*-sysv4* | *-*-solaris*) | |
62 | HLDFLAGS='-R $(libdir)' | |
63 | ;; | |
64 | esac | |
65 | fi | |
66 | ||
67 | # On SunOS, if the linker supports the -rpath option, use it to | |
68 | # prevent ../bfd and ../opcodes from being included in the run time | |
69 | # search path. | |
70 | case "${host}" in | |
71 | *-*-sunos*) | |
72 | echo 'main () { }' > conftest.c | |
73 | ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t | |
74 | if grep 'unrecognized' conftest.t >/dev/null 2>&1; then | |
75 | : | |
76 | elif grep 'No such file' conftest.t >/dev/null 2>&1; then | |
77 | : | |
7925f4d4 ILT |
78 | elif grep 'do not mix' conftest.t >/dev/null 2>&1; then |
79 | : | |
ba8e3a2e ILT |
80 | elif test "${shared}" = "true"; then |
81 | HLDFLAGS='-Wl,-rpath=$(libdir)' | |
82 | else | |
83 | HLDFLAGS='-Wl,-rpath=' | |
84 | fi | |
85 | rm -f conftest.t conftest.c conftest | |
86 | ;; | |
87 | esac | |
88 | AC_SUBST(HLDFLAGS) | |
89 | ||
7858d8dc | 90 | AC_OUTPUT(Makefile) |