aboutsummaryrefslogtreecommitdiff
path: root/gprof/configure.in
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-02-07 19:08:04 +0000
committerIan Lance Taylor <ian@airs.com>1996-02-07 19:08:04 +0000
commitba8e3a2e3f730181c07e38145fcd8f6145b81efb (patch)
treecc7ea90c59a876f13d71f4cc73d383fd15a49196 /gprof/configure.in
parent2e5983457a7e68ef9089acf42d80be836ba15c01 (diff)
downloadgdb-ba8e3a2e3f730181c07e38145fcd8f6145b81efb.zip
gdb-ba8e3a2e3f730181c07e38145fcd8f6145b81efb.tar.gz
gdb-ba8e3a2e3f730181c07e38145fcd8f6145b81efb.tar.bz2
* configure.in: Don't set CC. Look for --enable-shared. Set
BFDLIB and HLDFLAGS and substitute them. * configure: Rebuild. * Makefile.in (LIBS): Use @BFDLIB@. (HLDFLAGS): New variable. (gprof): Use $(HLDFLAGS).
Diffstat (limited to 'gprof/configure.in')
-rw-r--r--gprof/configure.in63
1 files changed, 62 insertions, 1 deletions
diff --git a/gprof/configure.in b/gprof/configure.in
index 7849a85..393589d 100644
--- a/gprof/configure.in
+++ b/gprof/configure.in
@@ -2,7 +2,14 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.3)dnl
AC_INIT(gprof.c)
-CC=${CC-cc}
+AC_ARG_ENABLE(shared,
+[ --enable-shared build shared BFD library],
+[case "${enableval}" in
+ yes) shared=true ;;
+ no) shared=false ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for BFD shared option]) ;;
+esac])dnl
+
AC_PROG_CC
AC_CANONICAL_SYSTEM
@@ -21,4 +28,58 @@ ns32k-*-*) MY_TARGET=ns532;;
esac
AC_SUBST(MY_TARGET)
+
+BFDLIB='-L../bfd -lbfd'
+
+# We need to handle some special cases if BFD was built shared.
+if test "${shared}" = "true"; then
+ case "${host}" in
+ *-*-sunos*)
+ # On SunOS, we must link against the name we are going to install,
+ # not -lbfd, since SunOS does not support SONAME.
+ BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
+ ;;
+ esac
+fi
+AC_SUBST(BFDLIB)
+
+HLDFLAGS=
+# If we have shared libraries, try to set rpath reasonably.
+if test "${shared}" = "true"; then
+ case "${host}" in
+ *-*-irix5*)
+ HLDFLAGS='-Wl,-rpath,$(libdir)'
+ ;;
+ *-*-linux*aout*)
+ ;;
+ *-*-linux*)
+ HLDFLAGS='-Wl,-rpath,$(libdir)'
+ ;;
+ *-*-sysv4* | *-*-solaris*)
+ HLDFLAGS='-R $(libdir)'
+ ;;
+ esac
+fi
+
+# On SunOS, if the linker supports the -rpath option, use it to
+# prevent ../bfd and ../opcodes from being included in the run time
+# search path.
+case "${host}" in
+ *-*-sunos*)
+ echo 'main () { }' > conftest.c
+ ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
+ if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
+ :
+ elif grep 'No such file' conftest.t >/dev/null 2>&1; then
+ :
+ elif test "${shared}" = "true"; then
+ HLDFLAGS='-Wl,-rpath=$(libdir)'
+ else
+ HLDFLAGS='-Wl,-rpath='
+ fi
+ rm -f conftest.t conftest.c conftest
+ ;;
+esac
+AC_SUBST(HLDFLAGS)
+
AC_OUTPUT(Makefile)