Support for building as a shared library, based on patches from

Alan Modra <alan@spri.levels.unisa.edu.au>:
	* configure.in: Add AC_ARG_ENABLE for shared and commonbfdlib.
	New substitutions: ALLLIBS, PICFLAG, SHLIB, SHLIB_CC,
	SHLIB_CFLAGS, COMMON_SHLIB, PICLIST, SHLINK.
	* configure: Rebuild.
	* configure.host: If --enable-shared, adjust shared library stuff
	based on the host.  If the host is SunOS, and the linker supports
	-rpath, set HLDFLAGS to use it.
	* Makefile.in (ALLLIBS): New variable.
	(PICFLAG, SHLIB, SHLIB_CC, SHLIB_CFLAGS): New variables.
	(COMMON_SHLIB, SHLINK): New variables.
	(.c.o): If PICFLAG is set, compile twice, once PIC, once normal.
	(STAGESTUFF): Remove variable.
	(all): Depend upon $(ALLLIBS) and @PICLIST@ rather than
	$(TARGETLIB).
	(stamp-ofiles): New target, like old ofiles target, but build
	using a temporary file and move-if-change, and touch stamp-ofiles
	when done.
	(ofiles): Just depend upon stamp-ofiles.
	(stamp-piclist, piclist): New targets.
	($(SHLIB), $(SHLINK)): New targets.
	(targets.o, archures.o): Build twice if PICFLAG is set.
	(do_mostlyclean): Remove pic/*.o.
	(do_clean): Remove stamp-ofiles, $(SHLIB), $(SHLINK), piclist, and
	stamp-piclist.
	(do_distclean): Remove pic and stamp-picdir.
	(install): Install shared libraries.
	($(OFILES)): Depend upon stamp-picdir.
	(stamp-picdir): New target.
This commit is contained in:
Ian Lance Taylor 1996-02-05 21:14:14 +00:00
parent fc71ad23dd
commit 44f795f7fe
5 changed files with 341 additions and 65 deletions

View File

@ -1,5 +1,36 @@
Mon Feb 5 10:38:27 1996 Ian Lance Taylor <ian@cygnus.com>
Support for building as a shared library, based on patches from
Alan Modra <alan@spri.levels.unisa.edu.au>:
* configure.in: Add AC_ARG_ENABLE for shared and commonbfdlib.
New substitutions: ALLLIBS, PICFLAG, SHLIB, SHLIB_CC,
SHLIB_CFLAGS, COMMON_SHLIB, PICLIST, SHLINK.
* configure: Rebuild.
* configure.host: If --enable-shared, adjust shared library stuff
based on the host. If the host is SunOS, and the linker supports
-rpath, set HLDFLAGS to use it.
* Makefile.in (ALLLIBS): New variable.
(PICFLAG, SHLIB, SHLIB_CC, SHLIB_CFLAGS): New variables.
(COMMON_SHLIB, SHLINK): New variables.
(.c.o): If PICFLAG is set, compile twice, once PIC, once normal.
(STAGESTUFF): Remove variable.
(all): Depend upon $(ALLLIBS) and @PICLIST@ rather than
$(TARGETLIB).
(stamp-ofiles): New target, like old ofiles target, but build
using a temporary file and move-if-change, and touch stamp-ofiles
when done.
(ofiles): Just depend upon stamp-ofiles.
(stamp-piclist, piclist): New targets.
($(SHLIB), $(SHLINK)): New targets.
(targets.o, archures.o): Build twice if PICFLAG is set.
(do_mostlyclean): Remove pic/*.o.
(do_clean): Remove stamp-ofiles, $(SHLIB), $(SHLINK), piclist, and
stamp-piclist.
(do_distclean): Remove pic and stamp-picdir.
(install): Install shared libraries.
($(OFILES)): Depend upon stamp-picdir.
(stamp-picdir): New target.
* libcoff-in.h: Add comment reminding people that libcoff.h is a
generated file.
* libcoff.h: Rebuild.

View File

@ -57,6 +57,15 @@ CFLAGS = @CFLAGS@
MAKEINFO = makeinfo
RANLIB = @RANLIB@
ALLLIBS = @ALLLIBS@
PICFLAG = @PICFLAG@
SHLIB = @SHLIB@
SHLIB_CC = @SHLIB_CC@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
COMMON_SHLIB = @COMMON_SHLIB@
SHLINK = @SHLINK@
CC_FOR_BUILD = @CC_FOR_BUILD@
INCDIR = $(srcdir)/../include
@ -392,6 +401,9 @@ FLAGS_TO_PASS = \
ALL_CFLAGS=@HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) $(CFLAGS)
.c.o:
if [ -n "$(PICFLAG)" ]; then \
$(CC) -c $(PICFLAG) $(ALL_CFLAGS) $< -o pic/$@; \
else true; fi
$(CC) -c $(ALL_CFLAGS) $<
bfd_libs_here =
@ -415,9 +427,7 @@ HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h \
libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h libnlm.h \
liboasys.h nlm-target.h nlmcode.h som.h genlink.h netbsd.h
STAGESTUFF = $(TARGETLIB) $(OFILES)
all: Makefile $(TARGETLIB)
all: Makefile $(ALLLIBS) @PICLIST@
@$(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS)
.NOEXPORT:
@ -448,8 +458,8 @@ diststuff: info
# COREFILE Core file routines for a native configuration
OFILES = $(BFD_LIBS) $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@
ofiles : Makefile
rm -f ofiles
stamp-ofiles: Makefile
rm -f tofiles
f=""; \
for i in $(OFILES) ; do \
case " $$f " in \
@ -457,7 +467,11 @@ ofiles : Makefile
*) f="$$f $$i" ;; \
esac ; \
done ; \
echo $$f > ofiles
echo $$f > tofiles
$(srcdir)/../move-if-change tofiles ofiles
touch stamp-ofiles
ofiles: stamp-ofiles ; @true
$(TARGETLIB): $(OFILES) ofiles
rm -f $(TARGETLIB)
@ -465,14 +479,40 @@ $(TARGETLIB): $(OFILES) ofiles
$(AR) $(AR_FLAGS) $(TARGETLIB) `cat ofiles`
$(RANLIB) $(TARGETLIB)
stamp-piclist: ofiles
rm -f tpiclist
if [ -n "$(PICFLAG)" ]; then \
sed -e 's,\([^ ][^ ]*\),pic/\1,g' ofiles > tpiclist; \
else \
cp ofiles tpiclist; \
fi
$(srcdir)/../move-if-change tpiclist piclist
touch stamp-piclist
piclist: stamp-piclist ; @true
$(SHLIB): stamp-picdir $(OFILES) piclist
rm -f $(SHLIB)
$(SHLIB_CC) $(SHLIB_CFLAGS) -o $(SHLIB) `cat piclist`
$(SHLINK): $(SHLIB)
rm -f $(SHLINK)
ln -sf $(SHLIB) $(SHLINK)
# When compiling archures.c and targets.c, supply the default target
# info from configure.
targets.o: targets.c Makefile
$(CC) -c $(ALL_CFLAGS) $(TDEFAULTS) $<
if [ -n "$(PICFLAG)" ]; then \
$(CC) -c $(PICFLAG) $(TDEFAULTS) $(ALL_CFLAGS) $(srcdir)/targets.c -o pic/targets.o; \
else true; fi
$(CC) -c $(TDEFAULTS) $(ALL_CFLAGS) $(srcdir)/targets.c
archures.o: archures.c Makefile
$(CC) -c $(ALL_CFLAGS) $(TDEFAULTS) $<
if [ -n "$(PICFLAG)" ]; then \
$(CC) -c $(PICFLAG) $(TDEFAULTS) $(ALL_CFLAGS) $(srcdir)/archures.c -o pic/archures.o; \
else true; fi
$(CC) -c $(TDEFAULTS) $(ALL_CFLAGS) $(srcdir)/archures.c
elf32-target.h : elfxx-target.h
rm -f elf32-target.h
@ -499,13 +539,15 @@ TAGS: force
etags $(INCDIR)/*.h $(srcdir)/*.h $(srcdir)/*.c
do_mostlyclean:
rm -f *.o *~ core *.E *.p *.ip aout-params.h gen-aout config.log
rm -f *.o *~ core *.E *.p *.ip aout-params.h gen-aout config.log \
pic/*.o
do_clean: do_mostlyclean
rm -f libbfd.a TAGS bfd.h stmp-bfd.h ofiles \
elf32-target.h elf64-target.h
rm -f libbfd.a TAGS bfd.h stmp-bfd.h ofiles stamp-ofiles \
elf32-target.h elf64-target.h $(SHLIB) $(SHLINK) \
piclist stamp-piclist
do_distclean: do_clean
rm -f Makefile config.status config.cache config.h stamp-h
rm -rf pic stamp-picdir
do_maintainer_clean: do_distclean
rm -f $(srcdir)/bfd-in2.h $(srcdir)/libbfd.h $(srcdir)/libcoff.h
@ -581,9 +623,19 @@ roll:
#
force:
install:
$(INSTALL_DATA) libbfd.a $(libdir)/libbfd.a
$(RANLIB) $(libdir)/libbfd.a
install: $(ALLLIBS)
for f in $(ALLLIBS); do \
rm -f $(libdir)/$$f; \
if [ "$$f" = "$(SHLINK)" ]; then \
ln -sf $(SHLIB) $(libdir)/$$f; \
elif [ "$$f" = "$(SHLIB)" ]; then \
$(INSTALL_PROGRAM) $$f $(libdir)/$$f; \
else \
$(INSTALL_DATA) $$f $(libdir)/$$f; \
$(RANLIB) $(libdir)/$$f; \
chmod a-x $(libdir)/$$f; \
fi; \
done
# Install BFD include file, and others that it needs. Install them
# both in GCC's include directory, and in the system include dir
# if configured as $(oldincludedir) -- which it usually isnt.
@ -682,15 +734,15 @@ headers:
# The rules for the generated header files are here so that people can
# type `make bfd-in2.h' if they remove it. They are not run by default.
bfd-in2.h:
(cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS))
(cd $(docdir); $(MAKE) bfd.h $(FLAGS_TO_PASS))
cp $(docdir)/bfd.h bfd-in2.h-new
$(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
libbfd.h:
(cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS))
(cd $(docdir); $(MAKE) libbfd.h $(FLAGS_TO_PASS))
cp $(docdir)/libbfd.h libbfd.h-new
$(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
libcoff.h:
(cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS))
(cd $(docdir); $(MAKE) libcoff.h $(FLAGS_TO_PASS))
cp $(docdir)/libcoff.h libcoff.h-new
$(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
@ -709,6 +761,14 @@ elf32-arc.o: elf32-arc.c elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/arc.h elf32-target.h
end-sanitize-arc:
$(OFILES): stamp-picdir
stamp-picdir:
if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
mkdir pic; \
else true; fi
touch stamp-picdir
# What appears below is generated by a hacked mkdep using gcc -MM.
# DO NOT DELETE THIS LINE -- mkdep uses it.

96
bfd/configure vendored
View File

@ -15,6 +15,10 @@ ac_help="$ac_help
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)"
ac_help="$ac_help
--enable-targets alternative target configurations"
ac_help="$ac_help
--enable-shared build shared BFD library"
ac_help="$ac_help
--enable-commonbfdlib build shared BFD/opcodes/libiberty library"
ac_help="$ac_help
--with-mmap try using mmap for BFD input files if available"
@ -543,6 +547,24 @@ if test "${enable_targets+set}" = set; then
*) enable_targets=$enableval ;;
esac
fi
# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
case "${enableval}" in
yes) shared=true ;;
no) shared=false ;;
*) { echo "configure: error: bad value ${enableval} for BFD shared option" 1>&2; exit 1; } ;;
esac
fi
# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given.
if test "${enable_commonbfdlib+set}" = set; then
enableval="$enable_commonbfdlib"
case "${enableval}" in
yes) commonbfdlib=true ;;
no) commonbfdlib=false ;;
*) { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;;
esac
fi
# Check whether --with-mmap or --without-mmap was given.
if test "${with_mmap+set}" = set; then
withval="$with_mmap"
@ -690,6 +712,21 @@ target64=false
# host stuff:
ALLLIBS='$(TARGETLIB)'
PICFLAG=
SHLIB=
SHLINK=
if test "${shared}" = "true"; then
PICFLAG=-fpic
if test "${commonbfdlib}" = "true"; then
ALLLIBS='$(TARGETLIB)'
else
ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)'
SHLIB=libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/VERSION`
SHLINK=libbfd.so
fi
fi
# Permit host specific settings.
. ${srcdir}/configure.host
@ -886,6 +923,31 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
if test "${shared}" = "true"; then
if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then
echo "configure: warning: BFD --enable-shared only supported when using gcc" 1>&2
shared=false
PICFLAG=
SHLIB=
fi
fi
if test "${commonbfdlib}" = "true"; then
COMMON_SHLIB=yes
PICLIST=piclist
else
COMMON_SHLIB=
PICLIST=
fi
HOST_64BIT_LONG=0
if test "x${HOST_64BIT_TYPE}" = "xlong"; then
HOST_64BIT_LONG=1
@ -901,7 +963,7 @@ else
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
#line 905 "configure"
#line 967 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
@ -943,7 +1005,7 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 947 "configure"
#line 1009 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
@ -957,7 +1019,7 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 961 "configure"
#line 1023 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
@ -990,7 +1052,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 994 "configure"
#line 1056 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
@ -1026,7 +1088,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1030 "configure"
#line 1092 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
@ -1061,7 +1123,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1065 "configure"
#line 1127 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1108,7 +1170,7 @@ done
case "${host}" in
i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-win32)
i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32)
cat >> confdefs.h <<\EOF
#define USE_BINARY_FOPEN 1
EOF
@ -1120,7 +1182,7 @@ if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1124 "configure"
#line 1186 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -1160,7 +1222,7 @@ if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1164 "configure"
#line 1226 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -1460,7 +1522,7 @@ EOF
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1464 "configure"
#line 1526 "configure"
#include "confdefs.h"
#include <sys/procfs.h>
int main() { return 0; }
@ -1747,7 +1809,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1751 "configure"
#line 1813 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1799,7 +1861,7 @@ else
ac_cv_func_mmap=no
else
cat > conftest.$ac_ext <<EOF
#line 1803 "configure"
#line 1865 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test. */
@ -1893,7 +1955,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1897 "configure"
#line 1959 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -2083,6 +2145,14 @@ s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@ALLLIBS@%$ALLLIBS%g
s%@PICFLAG@%$PICFLAG%g
s%@SHLIB@%$SHLIB%g
s%@SHLIB_CC@%$SHLIB_CC%g
s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g
s%@COMMON_SHLIB@%$COMMON_SHLIB%g
s%@PICLIST@%$PICLIST%g
s%@SHLINK@%$SHLINK%g
s%@HOST_64BIT_LONG@%$HOST_64BIT_LONG%g
s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
s%@CPP@%$CPP%g

View File

@ -15,6 +15,12 @@
# HDEFINES host specific compiler options
# host64 set to true if this is a 64 bit host
# HOST_64BIT_TYPE host 64 bit type
# SHLIB_CC compiler to use when building shared library
# SHLIB_CFLAGS flags to use when building shared library
# PICFLAG may be set to flag to use to compile PIC
# SHLINK may be set to the name to link the shared library to
# ALLLIBS may be set to libraries to build
# HLDFLAGS LDFLAGS specific to the host
HDEFINES=
host64=false
@ -53,6 +59,7 @@ i[345]86-*-win32) test -z "$CC" && CC="i386-win32-gcc -O2"
RANLIB=${RANLIB-i386-win32-ranlib}
;;
mips-dec-netbsd*) ;;
mips-dec-*) HDEFINES="-G 4" ;;
mips-sgi-irix3*) HDEFINES="-G 4"
test -z "$LDFLAGS" && LDFLAGS=-lmalloc
@ -83,3 +90,70 @@ powerpc-*-aix4*) HDEFINES=-DHOST_AIX ;;
powerpc-*-aix*) HDEFINES=-DHOST_AIX ;;
esac
# If we are configuring with --enable-shared, adjust the shared
# library support based on the host. This support must work for both
# the BFD and the opcodes libraries.
SHLIB_CC='$(CC)'
SHLIB_CFLAGS='-shared'
if [ "${shared}" = "true" ]; then
case "${host}" in
hppa*-*-*) picfrag=../config/mh-papic ;;
i[3456]86-*-*) picfrag=../config/mh-x86pic ;;
*-*-*) picfrag=../config/mh-${host_cpu}pic ;;
esac
if [ -f "${picfrag}" ]; then
pic=`sed -n -e 's/^PICFLAG[ ]*=[ ]*\(.*\)$/\1/p' ${picfrag}`
if [ -n "${pic}" ]; then
PICFLAG=${pic}
fi
fi
base_shlib=`echo ${SHLIB} | sed -e 's,^.*/\([^/]*\)$,\1,'`
case "${host}" in
*-dec-osf*)
# -fpic is not needed on the Alpha.
PICFLAG=
;;
*-*-hpux*)
# HP/UX uses .sl for shared libraries.
SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'`
;;
*-*-irix5*)
# -fpic is not needed on Irix 5.
PICFLAG=
SHLIB_CFLAGS="-shared -Wl,-soname,${base_shlib}"
;;
*-*-linux*aout*)
;;
*-*-linux*)
SHLIB_CFLAGS="-shared -Wl,-soname,${base_shlib}"
;;
*-*-sysv4* | *-*-solaris*)
SHLIB_CFLAGS="-shared -h ${base_shlib}"
;;
*-*-sunos*)
ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)//'`
;;
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.
HLDFLAGS=
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
:
else
HLDFLAGS='-Wl,-rpath='
fi
rm -f conftest.t conftest.c conftest
;;
esac

View File

@ -18,6 +18,27 @@ AC_ARG_ENABLE(targets,
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac])dnl
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_ARG_ENABLE(commonbfdlib,
[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
[case "${enableval}" in
yes) commonbfdlib=true ;;
no) commonbfdlib=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
esac])dnl
AC_ARG_WITH(mmap,
[ --with-mmap try using mmap for BFD input files if available],
[case "${withval}" in
yes) want_mmap=true ;;
no) want_mmap=false ;;
*) AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;;
esac],[want_mmap=false])dnl
AC_CONFIG_HEADER(config.h:config.in)
@ -33,6 +54,23 @@ target64=false
# host stuff:
ALLLIBS='$(TARGETLIB)'
PICFLAG=
SHLIB=
SHLINK=
if test "${shared}" = "true"; then
PICFLAG=-fpic
if test "${commonbfdlib}" = "true"; then
ALLLIBS='$(TARGETLIB)'
else
ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)'
changequote(,)dnl
SHLIB=libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/VERSION`
changequote([,])dnl
SHLINK=libbfd.so
fi
fi
# Permit host specific settings.
. ${srcdir}/configure.host
@ -43,6 +81,31 @@ AC_CHECK_PROG(AR, ar, ar, :)
AC_PROG_RANLIB
AC_PROG_INSTALL
if test "${shared}" = "true"; then
if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then
AC_MSG_WARN([BFD --enable-shared only supported when using gcc])
shared=false
PICFLAG=
SHLIB=
fi
fi
AC_SUBST(ALLLIBS)
AC_SUBST(PICFLAG)
AC_SUBST(SHLIB)
AC_SUBST(SHLIB_CC)
AC_SUBST(SHLIB_CFLAGS)
if test "${commonbfdlib}" = "true"; then
COMMON_SHLIB=yes
PICLIST=piclist
else
COMMON_SHLIB=
PICLIST=
fi
AC_SUBST(COMMON_SHLIB)
AC_SUBST(PICLIST)
AC_SUBST(SHLINK)
HOST_64BIT_LONG=0
if test "x${HOST_64BIT_TYPE}" = "xlong"; then
HOST_64BIT_LONG=1
@ -57,39 +120,8 @@ AC_CHECK_FUNCS(fcntl getpagesize)
BFD_BINARY_FOPEN
AC_MSG_CHECKING([whether malloc must be declared])
AC_CACHE_VAL(bfd_cv_decl_needed_malloc,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],
[char *(*pfn) = (char *(*)) malloc],
bfd_cv_decl_needed_malloc=no, bfd_cv_decl_needed_malloc=yes)])
AC_MSG_RESULT($bfd_cv_decl_needed_malloc)
if test $bfd_cv_decl_needed_malloc = yes; then
AC_DEFINE(NEED_DECLARATION_MALLOC)
fi
AC_MSG_CHECKING([whether free must be declared])
AC_CACHE_VAL(bfd_cv_decl_needed_free,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],
[int (*pfn) = (int (*)) free],
bfd_cv_decl_needed_free=no, bfd_cv_decl_needed_free=yes)])
AC_MSG_RESULT($bfd_cv_decl_needed_free)
if test $bfd_cv_decl_needed_free = yes; then
AC_DEFINE(NEED_DECLARATION_FREE)
fi
BFD_NEED_DECLARATION(malloc)
BFD_NEED_DECLARATION(free)
# If we are configured native, pick a core file support file.
COREFILE=
@ -215,6 +247,10 @@ changequote([,])dnl
COREFILE=trad-core.o
AC_DEFINE(TRAD_HEADER,"hosts/m68knbsd.h")
;;
m68*-apple-aux*)
COREFILE=trad-core.o
AC_DEFINE(TRAD_HEADER,"hosts/m68kaux.h")
;;
m88*-*-sysv4*) ;;
m88*-motorola-sysv*) COREFILE=ptrace-core.o ;;
m88*-*-mach3*)
@ -411,8 +447,9 @@ do
hp300hpux_vec) tb="$tb hp300hpux.o aout32.o stab-syms.o" ;;
i386aout_vec) tb="$tb i386aout.o aout32.o stab-syms.o" ;;
i386bsd_vec) tb="$tb i386bsd.o aout32.o stab-syms.o" ;;
i386dynix_vec) tb="$tb i386dynix.o aout32.o stab-syms.o" ;;
i386coff_vec) tb="$tb coff-i386.o cofflink.o" ;;
i386dynix_vec) tb="$tb i386dynix.o aout32.o stab-syms.o" ;;
i386freebsd_vec) tb="$tb i386freebsd.o aout32.o stab-syms.o" ;;
i386msdos_vec) tb="$tb i386msdos.o" ;;
i386pe_vec) tb="$tb pe-i386.o cofflink.o " ;;
i386pei_vec) tb="$tb pei-i386.o cofflink.o" ;;
@ -432,6 +469,7 @@ do
m68klynx_coff_vec) tb="$tb cf-m68klynx.o coff-m68k.o cofflink.o lynx-core.o stab-syms.o" ;;
m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o stab-syms.o" ;;
m68k4knetbsd_vec) tb="$tb m68k4knetbsd.o aout32.o stab-syms.o" ;;
m68kaux_coff_vec) tb="$tb coff-aux.o coff-m68k.o cofflink.o" ;;
m88kbcs_vec) tb="$tb coff-m88k.o" ;;
newsos3_vec) tb="$tb newsos3.o aout32.o stab-syms.o" ;;
nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;;
@ -535,6 +573,9 @@ AC_SUBST(tdefaults)
dnl AC_CHECK_HEADERS(sys/mman.h)
AC_FUNC_MMAP
AC_CHECK_FUNCS(madvise mprotect)
case ${want_mmap}+${ac_cv_func_mmap} in
true+yes ) AC_DEFINE(USE_MMAP) ;;
esac
rm -f doc/config.status
AC_OUTPUT(Makefile doc/Makefile,