From 50bea03197327850050e0c05321f3c6345699a2a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 20 Jul 2001 01:25:14 +0000 Subject: [PATCH] 2001-07-19 Tom Tromey Alexandre Duret-Lutz Fix for ccnoco.test, subobj8.test: * m4/Makefile.am (m4data_DATA): Added auxdir.m4. * tests/Makefile.am (XFAIL_TESTS): Removed ccnoco.test, subobj8.test. * m4/minuso.m4 (AM_PROG_CC_C_O): Use absolute path to compile. Use AM_AUX_DIR_EXPAND. * lib/compile: Handle case where `-o' argument is the name of an executable, not an object file. * m4/auxdir.m4: New file, from... * m4/missing.m4: ... here. Moved AM_AUX_DIR_EXPAND. * automake.in (handle_single_transform_list, lang_c_rewrite): Require compile using `require_config_file'. --- ChangeLog | 16 ++++++++++++++++ automake.in | 5 ++--- lib/compile | 10 ++++++++++ m4/Makefile.am | 4 ++-- m4/Makefile.in | 4 ++-- m4/auxdir.m4 | 23 +++++++++++++++++++++++ m4/minuso.m4 | 7 ++++++- m4/missing.m4 | 24 ------------------------ tests/Makefile.am | 2 +- tests/Makefile.in | 2 +- 10 files changed, 63 insertions(+), 34 deletions(-) create mode 100644 m4/auxdir.m4 diff --git a/ChangeLog b/ChangeLog index a42667d..1bf0482 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,20 @@ 2001-07-19 Tom Tromey + Alexandre Duret-Lutz + + Fix for ccnoco.test, subobj8.test: + * m4/Makefile.am (m4data_DATA): Added auxdir.m4. + * tests/Makefile.am (XFAIL_TESTS): Removed ccnoco.test, + subobj8.test. + * m4/minuso.m4 (AM_PROG_CC_C_O): Use absolute path to compile. + Use AM_AUX_DIR_EXPAND. + * lib/compile: Handle case where `-o' argument is the name of an + executable, not an object file. + * m4/auxdir.m4: New file, from... + * m4/missing.m4: ... here. Moved AM_AUX_DIR_EXPAND. + * automake.in (handle_single_transform_list, lang_c_rewrite): + Require compile using `require_config_file'. + +2001-07-19 Tom Tromey * automake.texi (Program and Library Variables): Added X example for _LDADD. diff --git a/automake.in b/automake.in index a15ceb3..f5b4443 100755 --- a/automake.in +++ b/automake.in @@ -1869,7 +1869,7 @@ sub handle_single_transform_list ($$$@) } $object = $dname . '-' . $object; - &require_file ($FOREIGN, 'compile') + &require_config_file ($FOREIGN, 'compile') if $lang->name eq 'c'; &prog_error ("$lang->name flags defined without compiler") @@ -4917,8 +4917,7 @@ sub lang_c_rewrite &am_error ("C objects in subdir but `AM_PROG_CC_C_O' not in `$configure_ac'"); } - &require_file ($FOREIGN, 'compile') - if $relative_dir eq '.'; + &require_config_file ($FOREIGN, 'compile'); } $de_ansi_files{$base} = 1; diff --git a/lib/compile b/lib/compile index 7370ae5..9bb997a 100755 --- a/lib/compile +++ b/lib/compile @@ -37,8 +37,18 @@ args= while test $# -gt 0; do case "$1" in -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we do something ugly here. ofile=$2 shift + case "$ofile" in + *.o | *.obj) + ;; + *) + args="$args -o $ofile" + ofile= + ;; + esac ;; *.c) cfile=$1 diff --git a/m4/Makefile.am b/m4/Makefile.am index 3825b3e..5bc5d9f 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,8 +1,8 @@ ## Process this file with automake to create Makefile.in m4datadir = $(datadir)/aclocal -m4data_DATA = ccstdc.m4 cond.m4 depend.m4 depout.m4 dmalloc.m4 \ -error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 make.m4 \ +m4data_DATA = auxdir.m4 ccstdc.m4 cond.m4 depend.m4 depout.m4 \ +dmalloc.m4 error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 make.m4 \ maintainer.m4 minuso.m4 missing.m4 multi.m4 obstack.m4 protos.m4 \ ptrdiff.m4 python.m4 regex.m4 sanity.m4 strip.m4 strtod.m4 termios.m4 \ winsz.m4 diff --git a/m4/Makefile.in b/m4/Makefile.in index f1501fb..42d3c0b 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -67,8 +67,8 @@ _am_quote = @_am_quote@ install_sh = @install_sh@ m4datadir = $(datadir)/aclocal -m4data_DATA = ccstdc.m4 cond.m4 depend.m4 depout.m4 dmalloc.m4 \ -error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 make.m4 \ +m4data_DATA = auxdir.m4 ccstdc.m4 cond.m4 depend.m4 depout.m4 \ +dmalloc.m4 error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 make.m4 \ maintainer.m4 minuso.m4 missing.m4 multi.m4 obstack.m4 protos.m4 \ ptrdiff.m4 python.m4 regex.m4 sanity.m4 strip.m4 strtod.m4 termios.m4 \ winsz.m4 diff --git a/m4/auxdir.m4 b/m4/auxdir.m4 new file mode 100644 index 0000000..a99f76e --- /dev/null +++ b/m4/auxdir.m4 @@ -0,0 +1,23 @@ +# AM_AUX_DIR_EXPAND + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to ${srcdir}/foo. In other projects, it is set to `.'. +# Of course, Automake must honor this variable whenever it calls a tool +# from the auxiliary directory. The problem is that $srcdir (and therefore +# $ac_aux_dir as well) can be either an absolute path or a path relative to +# $top_srcdir, depending on how configure is run. This is pretty annoying, +# since it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a relative +# path needs to be adjusted first. +# - calling $top_srcdir/$ac_aux_dir/missing would succeed if $ac_aux_dir was +# relative, but fail if it was absolute. +# - conversly, calling $ac_aux_dir/missing would fail if $ac_aux_dir was +# relative, and succeed on absolute paths. +# +# Consequently, we define and use $am_aux_dir, the "always absolute" +# version of $ac_aux_dir. + +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` +]) diff --git a/m4/minuso.m4 b/m4/minuso.m4 index e1ffa3c..23a1703 100644 --- a/m4/minuso.m4 +++ b/m4/minuso.m4 @@ -5,12 +5,17 @@ # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then # Losing compiler, so override with the script. - CC="\$(top_srcdir)/compile $CC" + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" fi ]) diff --git a/m4/missing.m4 b/m4/missing.m4 index a8dab46..1b15774 100644 --- a/m4/missing.m4 +++ b/m4/missing.m4 @@ -47,27 +47,3 @@ else AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) fi ]) - -# AM_AUX_DIR_EXPAND - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to ${srcdir}/foo. In other projects, it is set to `.'. -# Of course, Automake must honor this variable whenever it calls a tool -# from the auxiliary directory. The problem is that $srcdir (and therefore -# $ac_aux_dir as well) can be either an absolute path or a path relative to -# $top_srcdir, depending on how configure is run. This is pretty annoying, -# since it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a relative -# path needs to be adjusted first. -# - calling $top_srcdir/$ac_aux_dir/missing would succeed if $ac_aux_dir was -# relative, but fail if it was absolute. -# - conversly, calling $ac_aux_dir/missing would fail if $ac_aux_dir was -# relative, and succeed on absolute paths. -# -# Consequently, we define and use $am_aux_dir, the "always absolute" -# version of $ac_aux_dir. - -AC_DEFUN([AM_AUX_DIR_EXPAND], [ -# expand $ac_aux_dir to an absolute path -am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` -]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 98865c0..3c9d262 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in -XFAIL_TESTS = subdir5.test subobj8.test ccnoco.test +XFAIL_TESTS = subdir5.test TESTS = \ acinclude.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 3d4d9cd..d249389 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -66,7 +66,7 @@ _am_include = @_am_include@ _am_quote = @_am_quote@ install_sh = @install_sh@ -XFAIL_TESTS = subdir5.test subobj8.test ccnoco.test +XFAIL_TESTS = subdir5.test TESTS = \ acinclude.test \ -- 2.7.4