dnl Process this file with autoconf to produce a configure script.
dnl
-AC_PREREQ(2.0)
+AC_PREREQ(2.5)
AC_INIT(ar.c)
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 shared_bfd=true shared_opcodes=true ;;
+ no) shared=false ;;
+ *bfd*opcodes*) shared=true shared_bfd=true shared_opcodes=true ;;
+ *opcodes*bfd*) shared=true shared_bfd=true shared_opcodes=true ;;
+ *bfd*) shared=true shared_bfd=true ;;
+ *opcodes*) shared=true shared_opcodes=true ;;
+ *) shared=false ;;
+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_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADER(config.h:config.in)
AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`)
AC_CANONICAL_SYSTEM
# host-specific stuff:
HDEFINES=
-LDFLAGS=
+HLDFLAGS=
+HLDENV=
+RPATH_ENVVAR=LD_LIBRARY_PATH
+
+AC_PROG_CC
. ${srcdir}/../bfd/configure.host
-AC_PROG_CC
-AC_SUBST(CFLAGS)
AC_SUBST(HDEFINES)
-AC_SUBST(LDFLAGS)
+AC_SUBST(HLDFLAGS)
+AC_SUBST(HLDENV)
+AC_SUBST(RPATH_ENVVAR)
AR=${AR-ar}
AC_SUBST(AR)
AC_PROG_RANLIB
AC_PROG_INSTALL
+# For most hosts we can use a simple definition to pick up the BFD and
+# opcodes libraries. However, if we are building shared libraries, we
+# need to handle some hosts specially.
+BFDLIB='-L../bfd -lbfd'
+OPCODES='-L../opcodes -lopcodes'
+
+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.
+ if test "${shared_bfd}" = "true"; then
+ BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
+ fi
+ if test "${shared_opcodes}" = "true"; then
+ OPCODES='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`'
+ fi
+ ;;
+alpha*-*-osf*)
+ # On Alpha OSF/1, the native linker searches all the -L
+ # directories for any LIB.so files, and only then searches for any
+ # LIB.a files. That means that if there is an installed
+ # libbfd.so, but this build is not done with --enable-shared, the
+ # link will wind up being against the install libbfd.so rather
+ # than the newly built libbfd. To avoid this, we must explicitly
+ # link against libbfd.a when --enable-shared is not used.
+ if test "${shared_bfd}" != "true"; then
+ BFDLIB='../bfd/libbfd.a'
+ fi
+ if test "${shared_opcodes}" != "true"; then
+ OPCODES='../opcodes/libopcodes.a'
+ fi
+ ;;
+esac
+
+if test "${commonbfdlib}" = "true"; then
+ # when a shared libbfd is built with --enable-commonbfdlib,
+ # all of libopcodes is available in libbfd.so
+ OPCODES=
+fi
+
+AC_SUBST(BFDLIB)
+AC_SUBST(OPCODES)
+
+BFD_CC_FOR_BUILD
+
AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
+AC_HEADER_SYS_WAIT
+AC_FUNC_ALLOCA
AC_CHECK_FUNCS(sbrk utimes)
+dnl Temporary workaround for bug in autoconf 2.12. When the bug is
+dnl fixed, we can just call AC_FUNC_VFORK in all cases.
+if test "x$cross_compiling" = "xno"; then
+ AC_FUNC_VFORK
+else
+ AC_CHECK_FUNC(vfork, , AC_DEFINE(vfork, fork))
+fi
AC_MSG_CHECKING(for time_t in time.h)
AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
AC_DEFINE(HAVE_GOOD_UTIME_H)
fi
-AC_MSG_CHECKING([whether fprintf must be declared])
-AC_CACHE_VAL(bu_cv_decl_needed_fprintf,
-[AC_TRY_COMPILE([#include <stdio.h>],
-[int (*pfn) = (int (*)) fprintf],
-bu_cv_decl_needed_fprintf=no, bu_cv_decl_needed_fprintf=yes)])
-AC_MSG_RESULT($bu_cv_decl_needed_fprintf)
-if test $bu_cv_decl_needed_fprintf = yes; then
- AC_DEFINE(NEED_DECLARATION_FPRINTF)
-fi
+BFD_NEED_DECLARATION(fprintf)
+BFD_NEED_DECLARATION(strstr)
+BFD_NEED_DECLARATION(sbrk)
+BFD_NEED_DECLARATION(getenv)
-dnl FIXME: We should check this in some central place somehow
-case "${host}" in
-i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-win32)
- AC_DEFINE(USE_BINARY_FOPEN) ;;
-esac
+BFD_BINARY_FOPEN
# target-specific stuff:
# Canonicalize the secondary target names.
-target_makefile_fragment=/dev/null
if test -n "$enable_targets"; then
for targ in `echo $enable_targets | sed 's/,/ /g'`
do
canon_targets="$canon_targets $targ"
fi
done
-else
- # If our target is rs6000 _and nothing else_ then we build only nm!
- case $target in
- rs6000-*-lynx*) target_makefile_fragment=${srcdir}/config/rslynx ;;
- esac
fi
-AC_SUBST_FILE(target_makefile_fragment)
all_targets=false
BUILD_NLMCONV=
else
case $targ in
changequote(,)dnl
- i[345]86*-*-netware*)
+ i[3456]86*-*-netware*)
changequote([,])dnl
BUILD_NLMCONV='$(NLMCONV_PROG)'
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
;;
changequote(,)dnl
- i[3-6]86-*pe* | i[3-6]86-*-win32)
+ i[3-6]86-*pe* | i[3-6]86-*-cygwin32)
changequote([,])dnl
BUILD_DLLTOOL='$(DLLTOOL_PROG)'
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
;;
+ powerpc*-*-*pe* | powerpc*-*-cygwin32)
+ BUILD_DLLTOOL='$(DLLTOOL_PROG)'
+ DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
+ ;;
esac
fi
done
AC_SUBST(UNDERSCORE)
AC_OUTPUT(Makefile,
-[case x$CONFIG_HEADERS in xconfig.h) echo > stamp-h ;; esac])
+[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])