From f515fb2f93d81fb401d86f9db2bf3c96cd659737 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 4 Sep 1995 21:13:51 +0000 Subject: * configure.host: Incorporate host Makefile fragments by setting shell variables. * configure.in: Call AC_PROG_CC. Substitute CFLAGS, HDEFINES and AR. Call AC_PROG_INSTALL. Substitute CC_FOR_BUILD, choosing a value based on whether the code is being compiled by a cross compiler. Don't substitute host_makefile_frag or frags. * aclocal.m4: New file to define local AC_PROG_CC. * configure: Rebuild. * Makefile.in (INSTALL): Set to @INSTALL@. (INSTALL_PROGRAM): Set to @INSTALL_PROGRAM@. (INSTALL_DATA): Set to @INSTALL_DATA@. (AR): Set to @AR@. (CC): Define as @CC@. (CFLAGS): Set to @CFLAGS@. (CC_FOR_BUILD): Set to @CC_FOR_BUILD@. (@host_makefile_frag@): Remove. (ALL_CFLAGS): Change $(HDEFINES) to @HDEFINES@. Move $(CFLAGS) after other options. (config.status): Remove dependency upon @frags@. * config/*.mh, config/README: Remove. --- bfd/.Sanitize | 2 +- bfd/ChangeLog | 21 ++++++++ bfd/aclocal.m4 | 45 +++++++++++++++++ bfd/configure | 145 +++++++++++++++++++++++++++++++++++++++++++++++++------ bfd/configure.in | 30 +++++++----- 5 files changed, 215 insertions(+), 28 deletions(-) create mode 100644 bfd/aclocal.m4 (limited to 'bfd') diff --git a/bfd/.Sanitize b/bfd/.Sanitize index 98b3221..0d6f5d1 100644 --- a/bfd/.Sanitize +++ b/bfd/.Sanitize @@ -47,6 +47,7 @@ Makefile.in PORTING TODO VERSION +aclocal.m4 aix386-core.c aout-adobe.c aout-arm.c @@ -93,7 +94,6 @@ coffcode.h coffgen.c cofflink.c coffswap.h -config config.bfd configure configure.bat diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 77b9bb5..b3612c4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,26 @@ Mon Sep 4 14:02:43 1995 Ian Lance Taylor + * configure.host: Incorporate host Makefile fragments by setting + shell variables. + * configure.in: Call AC_PROG_CC. Substitute CFLAGS, HDEFINES and + AR. Call AC_PROG_INSTALL. Substitute CC_FOR_BUILD, choosing a + value based on whether the code is being compiled by a cross + compiler. Don't substitute host_makefile_frag or frags. + * aclocal.m4: New file to define local AC_PROG_CC. + * configure: Rebuild. + * Makefile.in (INSTALL): Set to @INSTALL@. + (INSTALL_PROGRAM): Set to @INSTALL_PROGRAM@. + (INSTALL_DATA): Set to @INSTALL_DATA@. + (AR): Set to @AR@. + (CC): Define as @CC@. + (CFLAGS): Set to @CFLAGS@. + (CC_FOR_BUILD): Set to @CC_FOR_BUILD@. + (@host_makefile_frag@): Remove. + (ALL_CFLAGS): Change $(HDEFINES) to @HDEFINES@. Move $(CFLAGS) + after other options. + (config.status): Remove dependency upon @frags@. + * config/*.mh, config/README: Remove. + * config.bfd: Rewrite to incorporate the contents of the Makefile fragments by setting shell variables, rather than merely returning the name of a Makefile fragment. diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4 new file mode 100644 index 0000000..dabc963 --- /dev/null +++ b/bfd/aclocal.m4 @@ -0,0 +1,45 @@ +dnl +dnl This ugly hack is needed because the Cygnus configure script won't +dnl tell us what CC is going to be, and "cc" isn't always right. (The +dnl top-level Makefile will always override anything we choose here, so +dnl the usual gcc/cc selection is useless.) +dnl +dnl It knows where it is in the tree; don't try using it elsewhere. +dnl +undefine([AC_PROG_CC])dnl +AC_DEFUN(AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +dnl +dnl The ugly bit... +dnl +AC_MSG_CHECKING([for CC]) +dnl Don't bother with cache. +test -z "$CC" && CC=`egrep '^CC *=' ../Makefile | tail -1 | sed 's/^CC *= *//'` +test -z "$CC" && CC=cc +AC_MSG_RESULT(setting CC to $CC) +AC_SUBST(CC) +dnl +dnl Find out if we are using GNU C, under whatever name. +dnl The semicolon is to pacify NeXT's syntax-checking cpp. +cat > conftest.c <&AC_FD_CC | egrep yes >/dev/null 2>&1; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo 'void f(){}' > conftest.c + if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +rm -f conftest* +])dnl +dnl diff --git a/bfd/configure b/bfd/configure index 1817e6e..ca119e0 100755 --- a/bfd/configure +++ b/bfd/configure @@ -556,8 +556,41 @@ target64=false # host stuff: +HDEFINES= + +# Permit host specific settings. . ${srcdir}/configure.host +echo $ac_n "checking for CC""... $ac_c" 1>&6 +test -z "$CC" && CC=`egrep '^CC *=' ../Makefile | tail -1 | sed 's/^CC *= *//'` +test -z "$CC" && CC=cc +echo "$ac_t""setting CC to $CC" 1>&6 + +cat > conftest.c <&5 | egrep yes >/dev/null 2>&1; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo 'void f(){}' > conftest.c + if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +rm -f conftest* + + + +AR=${AR-ar} + # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 @@ -586,29 +619,102 @@ else echo "$ac_t""no" 1>&6 fi +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_ifs" + # As a last resort, use the slow shell script. + test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh" +fi + INSTALL="$ac_cv_path_install" +fi +echo "$ac_t""$INSTALL" 1>&6 -# Set up to make a link between the host's include file and "sysdep.h". -files=hosts/${my_host}.h +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -if test ! -f ${srcdir}/${files} ; then - files=../bfd/hosts/std-host.h - echo "configure: warning: BFD has no specific support for host ${host} -- using std-host" 1>&2 -fi +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +# Put a plausible default for CC_FOR_BUILD in Makefile. +# If we cannot run a trivial program, we must be cross compiling. +echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_cross=yes +else +cat > conftest.$ac_ext </dev/null; then + ac_cv_c_cross=no +else + ac_cv_c_cross=yes +fi +fi +rm -fr conftest* +fi +cross_compiling=$ac_cv_c_cross +echo "$ac_t""$ac_cv_c_cross" 1>&6 -if test -f ${srcdir}/config/${my_host}.mh ; then - host_makefile_frag=$srcdir/config/${my_host}.mh +if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' else - host_makefile_frag=/dev/null + CC_FOR_BUILD=gcc fi -frags= -if test $host_makefile_frag != /dev/null ; then - frags="$host_makefile_frag" + +# Set up to make a link between the host's include file and "sysdep.h". +files=hosts/${my_host}.h + +if test ! -f ${srcdir}/${files} ; then + files=../bfd/hosts/std-host.h + echo "configure: warning: BFD has no specific support for host ${host} -- using std-host" 1>&2 fi + # If we are configured native, pick a core file support file. COREFILE= COREFLAG= @@ -1015,6 +1121,7 @@ do done ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile doc/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 @@ -1047,10 +1154,13 @@ s%@build_alias@%$build_alias%g s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g +s%@CC@%$CC%g +s%@HDEFINES@%$HDEFINES%g +s%@AR@%$AR%g s%@RANLIB@%$RANLIB%g -/@host_makefile_frag@/r $host_makefile_frag -s%@host_makefile_frag@%%g -s%@frags@%$frags%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g s%@COREFILE@%$COREFILE%g s%@COREFLAG@%$COREFLAG%g s%@TDEFINES@%$TDEFINES%g @@ -1099,6 +1209,10 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then top_srcdir="$ac_dots$ac_given_srcdir" ;; esac + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." @@ -1111,6 +1225,7 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g " -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file fi; done rm -f conftest.subs diff --git a/bfd/configure.in b/bfd/configure.in index 42af6b9..a5a3566 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -29,9 +29,27 @@ target64=false # host stuff: +HDEFINES= + +# Permit host specific settings. . ${srcdir}/configure.host +AC_PROG_CC +AC_SUBST(CFLAGS) +AC_SUBST(HDEFINES) +AR=${AR-ar} +AC_SUBST(AR) AC_PROG_RANLIB +AC_PROG_INSTALL + +# Put a plausible default for CC_FOR_BUILD in Makefile. +AC_C_CROSS +if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' +else + CC_FOR_BUILD=gcc +fi +AC_SUBST(CC_FOR_BUILD) # Set up to make a link between the host's include file and "sysdep.h". files=hosts/${my_host}.h @@ -43,18 +61,6 @@ fi AC_LINK_FILES($files, sysdep.h) -if test -f ${srcdir}/config/${my_host}.mh ; then - host_makefile_frag=$srcdir/config/${my_host}.mh -else - host_makefile_frag=/dev/null -fi -AC_SUBST_FILE(host_makefile_frag) -frags= -if test $host_makefile_frag != /dev/null ; then - frags="$host_makefile_frag" -fi -AC_SUBST(frags) - # If we are configured native, pick a core file support file. COREFILE= COREFLAG= -- cgit v1.1