From: Akim Demaille Date: Wed, 13 Dec 2000 12:36:54 +0000 (+0000) Subject: EXEEXT and OBJEXT don't need to know $CYGWIN etc. X-Git-Tag: autoconf-2.50~323 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61231f53996466ff686dfa34f2a04c9e07c78b0d;p=thirdparty%2Fautoconf.git EXEEXT and OBJEXT don't need to know $CYGWIN etc. * acspecific.m4 (AC_EXEEXT, AC_OBJEXT, _AC_EXEEXT, _AC_OBJEXT): Move as... * aclang.m4 (AC_EXEEXT, AC_OBJEXT, _AC_COMPILER_EXEEXT) (_AC_COMPILER_OBJEXT): these. (_AC_COMPILER_EXEEXT): Use _AC_LINK_IFELSE. Don't depend upon $CYGWIN and the like. (_AC_COMPILER_OBJEXT): Model after _AC_COMPILER_EXEEXT. Skip more extensions. Use _AC_COMPILE_IFELSE. --- diff --git a/ChangeLog b/ChangeLog index f4f24ab9a..1d5bd5594 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2000-12-13 Akim Demaille + + EXEEXT and OBJEXT don't need to know $CYGWIN etc. + + * acspecific.m4 (AC_EXEEXT, AC_OBJEXT, _AC_EXEEXT, _AC_OBJEXT): + Move as... + * aclang.m4 (AC_EXEEXT, AC_OBJEXT, _AC_COMPILER_EXEEXT) + (_AC_COMPILER_OBJEXT): these. + (_AC_COMPILER_EXEEXT): Use _AC_LINK_IFELSE. + Don't depend upon $CYGWIN and the like. + (_AC_COMPILER_OBJEXT): Model after _AC_COMPILER_EXEEXT. + Skip more extensions. + Use _AC_COMPILE_IFELSE. + 2000-12-12 Pavel Roskin * Makefile.am: Don't use suffix rules for perl and shell diff --git a/aclang.m4 b/aclang.m4 index ed4e8ef9f..7033ae767 100644 --- a/aclang.m4 +++ b/aclang.m4 @@ -613,11 +613,11 @@ AC_DEFUN_ONCE([AC_NO_EXECUTABLES], [m4_divert_push([KILL]) AC_BEFORE([$0], [_AC_LANG_COMPILER_WORKS]) -AC_BEFORE([$0], [_AC_EXEEXT]) +AC_BEFORE([$0], [_AC_COMPILER_EXEEXT]) m4_define([_AC_LANG_COMPILER_WORKS], [cross_compiling=maybe]) -m4_define([_AC_EXEEXT], [EXEEXT=]) +m4_define([_AC_COMPILER_EXEEXT], [EXEEXT=]) m4_define([AC_LINK_IFELSE], [AC_FATAL([All the tests involving linking were disabled by $0])]) @@ -626,6 +626,86 @@ m4_divert_pop()dnl ])# # AC_NO_EXECUTABLES + +# ----------------------------- # +# Computing EXEEXT and OBJEXT. # +# ----------------------------- # + + +# Files to ignore +# --------------- +# Ignore .d files produced by CFLAGS=-MD. +# +# On UWIN (which uses a cc wrapper for MSVC), the compiler also generates +# a .pdb file +# +# When the w32 free Borland C++ command line compiler links a program +# (conftest.exe), it also produces a file named `conftest.tds' in +# addition to `conftest.obj' + + +# We must not AU define them, because autoupdate would them remove +# them, which is right, but Automake 1.4 would remove the support for +# $(EXEEXT) etc. +# FIXME: Remove this once Automake fixed. +AC_DEFUN([AC_EXEEXT], []) +AC_DEFUN([AC_OBJEXT], []) + + +# _AC_COMPILER_EXEEXT +# ------------------- +# Check for the extension used for executables. It compiles a test +# executable. If this is called, the executable extensions will be +# automatically used by link commands run by the configure script. +# +# This macro is called by AC_LANG_COMPILER, the latter being required +# by the AC_LINK_IFELSE macros, so use _AC_LINK_IFELSE. +m4_define([_AC_COMPILER_EXEEXT], +[AC_CACHE_CHECK([for executable suffix], ac_cv_exeext, +[_AC_LINK_IFELSE([AC_LANG_PROGRAM()], +[# If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `ls conftest.exe conftest conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'` + break;; + esac +done], + [AC_MSG_ERROR([cannot compute EXEEXT: cannot compile and link])]) +rm -f conftest$ac_cv_exeext]) +AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl +ac_exeext=$EXEEXT +])# _AC_COMPILER_EXEEXT + + +# _AC_COMPILER_OBJEXT +# ------------------- +# Check the object extension used by the compiler: typically `.o' or +# `.obj'. If this is called, some other behaviour will change, +# determined by ac_objext. +# +# This macro is called by AC_LANG_COMPILER, the latter being required +# by the AC_COMPILE_IFELSE macros, so use _AC_COMPILE_IFELSE. +m4_define([_AC_COMPILER_OBJEXT], +[AC_CACHE_CHECK([for object suffix], ac_cv_objext, +[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], +[for ac_file in `ls conftest.o conftest.obj conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done], + [AC_MSG_ERROR([cannot compute OBJEXT: cannot compile])]) +rm -f conftest.$ac_cv_objext]) +AC_SUBST([OBJEXT], [$ac_cv_objext])dnl +ac_objext=$OBJEXT +])# _AC_COMPILER_OBJEXT + + # -------------------- # # 3b. The C compiler. # # -------------------- # @@ -752,8 +832,8 @@ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) _AC_LANG_COMPILER_WORKS _AC_LANG_COMPILER_GNU GCC=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_CC_G AC_LANG_POP ])# AC_PROG_CC @@ -945,8 +1025,8 @@ AC_CHECK_TOOLS(CXX, _AC_LANG_COMPILER_WORKS _AC_LANG_COMPILER_GNU GXX=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_CXX_G AC_LANG_POP ])# AC_PROG_CXX @@ -1044,8 +1124,8 @@ ac_ext=F _AC_LANG_COMPILER_GNU ac_ext=$ac_save_ext G77=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_F77_G AC_LANG_POP ])# AC_PROG_F77 diff --git a/acspecific.m4 b/acspecific.m4 index 5b98d0086..55ce13a76 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -1189,91 +1189,6 @@ AU_DEFUN([AC_EMXOS2], []) AU_DEFUN([AC_MINGW32], []) -# We must not AU define them, because autoupdate would them remove -# them, which is right, but Automake 1.4 would remove the support for -# $(EXEEXT) etc. -# FIXME: Remove this once Automake fixed. -AC_DEFUN([AC_EXEEXT], []) -AC_DEFUN([AC_OBJEXT], []) - - -# _AC_EXEEXT -# ---------- -# Check for the extension used for executables. This knows that we -# add .exe for Cygwin or mingw32. Otherwise, it compiles a test -# executable. If this is called, the executable extensions will be -# automatically used by link commands run by the configure script. -# -# Ignore .d files produced by CFLAGS=-MD. -# -# On UWIN (which uses a cc wrapper for MSVC), the compiler also generates -# a .pdb file -# -# This macro is called by AC_LANG_COMPILER, the latter being required -# by the AC_COMPILE_IFELSE macros, so use AC_TRY_EVAL. -m4_define([_AC_EXEEXT], -[AC_CACHE_CHECK([for executable suffix], ac_cv_exeext, -[case "$CYGWIN $MINGW32 $EMXOS2" in - *yes*) ac_cv_exeext=.exe ;; - *) - AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) - if AC_TRY_EVAL(ac_link); then - # If both `conftest.exe' and `conftest' are `present' (well, observable) - # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will - # work properly (i.e., refer to `conftest.exe'), while it won't with - # `rm'. - for ac_file in `ls conftest.exe conftest conftest.* 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; - *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'` - break;; - esac - done - rm -f conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - else - AC_MSG_ERROR([cannot compile and link]) - fi - ;; -esac]) -AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl -ac_exeext=$EXEEXT -])# _AC_EXEEXT - - -# _AC_OBJEXT -# ---------- -# Check the object extension used by the compiler: typically .o or -# .obj. If this is called, some other behaviour will change, -# determined by ac_objext. -# -# When the w32 free Borland C++ command line compiler links a program -# (conftest.exe), it also produces a file named `conftest.tds' in -# addition to `conftest.obj' -# -# Ignore .d files produced by CFLAGS=-MD. -# -# This macro is called by AC_LANG_COMPILER, the latter being required -# by the AC_COMPILE_IFELSE macros, so use AC_TRY_EVAL. -m4_define([_AC_OBJEXT], -[AC_CACHE_CHECK([for object suffix], ac_cv_objext, -[AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) -if AC_TRY_EVAL(ac_compile); then - for ac_file in `ls conftest.o conftest.obj conftest.* 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.tds | *.d ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac - done - rm -f conftest.$ac_objext conftest.$ac_ext -else - AC_MSG_ERROR([cannot compile]) -fi]) -AC_SUBST(OBJEXT, $ac_cv_objext)dnl -ac_objext=$ac_cv_objext -])# _AC_OBJEXT - - ## -------------------------- ## ## Checks for UNIX variants. ## diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 14bfb2cf6..8b138410a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -4056,16 +4056,17 @@ All the tests for compilers (@code{AC_PROG_CC}, @code{AC_PROG_CXX}, the output of the compiler, typically to the empty string if Unix and @samp{.exe} if Win32 or OS/2. -@ovindex CYGWIN -@ovindex EMXOS2 -@ovindex MINGW32 -They also set the shell variable @code{CYGWIN} to @samp{yes} if run in -the Cygwin environment, @code{EMXOS2} to @samp{yes} if in the EMX -environment on OS/2, and @code{MINGW32} to @samp{yes} with the MingW32 -compiler. +@c FIXME: +@c @ovindex CYGWIN +@c @ovindex EMXOS2 +@c @ovindex MINGW32 +@c They also set the shell variable @code{CYGWIN} to @samp{yes} if run in +@c the Cygwin environment, @code{EMXOS2} to @samp{yes} if in the EMX +@c environment on OS/2, and @code{MINGW32} to @samp{yes} with the MingW32 +@c compiler. @ovindex OBJEXT -Finally, they define the output variable @code{OBJEXT} based on the +They also define the output variable @code{OBJEXT} based on the output of the compiler, after .c files have been excluded, typically to @samp{o} if Unix, @samp{obj} if Win32. diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index ed4e8ef9f..7033ae767 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -613,11 +613,11 @@ AC_DEFUN_ONCE([AC_NO_EXECUTABLES], [m4_divert_push([KILL]) AC_BEFORE([$0], [_AC_LANG_COMPILER_WORKS]) -AC_BEFORE([$0], [_AC_EXEEXT]) +AC_BEFORE([$0], [_AC_COMPILER_EXEEXT]) m4_define([_AC_LANG_COMPILER_WORKS], [cross_compiling=maybe]) -m4_define([_AC_EXEEXT], [EXEEXT=]) +m4_define([_AC_COMPILER_EXEEXT], [EXEEXT=]) m4_define([AC_LINK_IFELSE], [AC_FATAL([All the tests involving linking were disabled by $0])]) @@ -626,6 +626,86 @@ m4_divert_pop()dnl ])# # AC_NO_EXECUTABLES + +# ----------------------------- # +# Computing EXEEXT and OBJEXT. # +# ----------------------------- # + + +# Files to ignore +# --------------- +# Ignore .d files produced by CFLAGS=-MD. +# +# On UWIN (which uses a cc wrapper for MSVC), the compiler also generates +# a .pdb file +# +# When the w32 free Borland C++ command line compiler links a program +# (conftest.exe), it also produces a file named `conftest.tds' in +# addition to `conftest.obj' + + +# We must not AU define them, because autoupdate would them remove +# them, which is right, but Automake 1.4 would remove the support for +# $(EXEEXT) etc. +# FIXME: Remove this once Automake fixed. +AC_DEFUN([AC_EXEEXT], []) +AC_DEFUN([AC_OBJEXT], []) + + +# _AC_COMPILER_EXEEXT +# ------------------- +# Check for the extension used for executables. It compiles a test +# executable. If this is called, the executable extensions will be +# automatically used by link commands run by the configure script. +# +# This macro is called by AC_LANG_COMPILER, the latter being required +# by the AC_LINK_IFELSE macros, so use _AC_LINK_IFELSE. +m4_define([_AC_COMPILER_EXEEXT], +[AC_CACHE_CHECK([for executable suffix], ac_cv_exeext, +[_AC_LINK_IFELSE([AC_LANG_PROGRAM()], +[# If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `ls conftest.exe conftest conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'` + break;; + esac +done], + [AC_MSG_ERROR([cannot compute EXEEXT: cannot compile and link])]) +rm -f conftest$ac_cv_exeext]) +AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl +ac_exeext=$EXEEXT +])# _AC_COMPILER_EXEEXT + + +# _AC_COMPILER_OBJEXT +# ------------------- +# Check the object extension used by the compiler: typically `.o' or +# `.obj'. If this is called, some other behaviour will change, +# determined by ac_objext. +# +# This macro is called by AC_LANG_COMPILER, the latter being required +# by the AC_COMPILE_IFELSE macros, so use _AC_COMPILE_IFELSE. +m4_define([_AC_COMPILER_OBJEXT], +[AC_CACHE_CHECK([for object suffix], ac_cv_objext, +[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], +[for ac_file in `ls conftest.o conftest.obj conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done], + [AC_MSG_ERROR([cannot compute OBJEXT: cannot compile])]) +rm -f conftest.$ac_cv_objext]) +AC_SUBST([OBJEXT], [$ac_cv_objext])dnl +ac_objext=$OBJEXT +])# _AC_COMPILER_OBJEXT + + # -------------------- # # 3b. The C compiler. # # -------------------- # @@ -752,8 +832,8 @@ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) _AC_LANG_COMPILER_WORKS _AC_LANG_COMPILER_GNU GCC=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_CC_G AC_LANG_POP ])# AC_PROG_CC @@ -945,8 +1025,8 @@ AC_CHECK_TOOLS(CXX, _AC_LANG_COMPILER_WORKS _AC_LANG_COMPILER_GNU GXX=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_CXX_G AC_LANG_POP ])# AC_PROG_CXX @@ -1044,8 +1124,8 @@ ac_ext=F _AC_LANG_COMPILER_GNU ac_ext=$ac_save_ext G77=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_F77_G AC_LANG_POP ])# AC_PROG_F77 diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index ed4e8ef9f..7033ae767 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -613,11 +613,11 @@ AC_DEFUN_ONCE([AC_NO_EXECUTABLES], [m4_divert_push([KILL]) AC_BEFORE([$0], [_AC_LANG_COMPILER_WORKS]) -AC_BEFORE([$0], [_AC_EXEEXT]) +AC_BEFORE([$0], [_AC_COMPILER_EXEEXT]) m4_define([_AC_LANG_COMPILER_WORKS], [cross_compiling=maybe]) -m4_define([_AC_EXEEXT], [EXEEXT=]) +m4_define([_AC_COMPILER_EXEEXT], [EXEEXT=]) m4_define([AC_LINK_IFELSE], [AC_FATAL([All the tests involving linking were disabled by $0])]) @@ -626,6 +626,86 @@ m4_divert_pop()dnl ])# # AC_NO_EXECUTABLES + +# ----------------------------- # +# Computing EXEEXT and OBJEXT. # +# ----------------------------- # + + +# Files to ignore +# --------------- +# Ignore .d files produced by CFLAGS=-MD. +# +# On UWIN (which uses a cc wrapper for MSVC), the compiler also generates +# a .pdb file +# +# When the w32 free Borland C++ command line compiler links a program +# (conftest.exe), it also produces a file named `conftest.tds' in +# addition to `conftest.obj' + + +# We must not AU define them, because autoupdate would them remove +# them, which is right, but Automake 1.4 would remove the support for +# $(EXEEXT) etc. +# FIXME: Remove this once Automake fixed. +AC_DEFUN([AC_EXEEXT], []) +AC_DEFUN([AC_OBJEXT], []) + + +# _AC_COMPILER_EXEEXT +# ------------------- +# Check for the extension used for executables. It compiles a test +# executable. If this is called, the executable extensions will be +# automatically used by link commands run by the configure script. +# +# This macro is called by AC_LANG_COMPILER, the latter being required +# by the AC_LINK_IFELSE macros, so use _AC_LINK_IFELSE. +m4_define([_AC_COMPILER_EXEEXT], +[AC_CACHE_CHECK([for executable suffix], ac_cv_exeext, +[_AC_LINK_IFELSE([AC_LANG_PROGRAM()], +[# If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `ls conftest.exe conftest conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'` + break;; + esac +done], + [AC_MSG_ERROR([cannot compute EXEEXT: cannot compile and link])]) +rm -f conftest$ac_cv_exeext]) +AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl +ac_exeext=$EXEEXT +])# _AC_COMPILER_EXEEXT + + +# _AC_COMPILER_OBJEXT +# ------------------- +# Check the object extension used by the compiler: typically `.o' or +# `.obj'. If this is called, some other behaviour will change, +# determined by ac_objext. +# +# This macro is called by AC_LANG_COMPILER, the latter being required +# by the AC_COMPILE_IFELSE macros, so use _AC_COMPILE_IFELSE. +m4_define([_AC_COMPILER_OBJEXT], +[AC_CACHE_CHECK([for object suffix], ac_cv_objext, +[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], +[for ac_file in `ls conftest.o conftest.obj conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done], + [AC_MSG_ERROR([cannot compute OBJEXT: cannot compile])]) +rm -f conftest.$ac_cv_objext]) +AC_SUBST([OBJEXT], [$ac_cv_objext])dnl +ac_objext=$OBJEXT +])# _AC_COMPILER_OBJEXT + + # -------------------- # # 3b. The C compiler. # # -------------------- # @@ -752,8 +832,8 @@ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) _AC_LANG_COMPILER_WORKS _AC_LANG_COMPILER_GNU GCC=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_CC_G AC_LANG_POP ])# AC_PROG_CC @@ -945,8 +1025,8 @@ AC_CHECK_TOOLS(CXX, _AC_LANG_COMPILER_WORKS _AC_LANG_COMPILER_GNU GXX=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_CXX_G AC_LANG_POP ])# AC_PROG_CXX @@ -1044,8 +1124,8 @@ ac_ext=F _AC_LANG_COMPILER_GNU ac_ext=$ac_save_ext G77=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_F77_G AC_LANG_POP ])# AC_PROG_F77 diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4 index ed4e8ef9f..7033ae767 100644 --- a/lib/autoconf/lang.m4 +++ b/lib/autoconf/lang.m4 @@ -613,11 +613,11 @@ AC_DEFUN_ONCE([AC_NO_EXECUTABLES], [m4_divert_push([KILL]) AC_BEFORE([$0], [_AC_LANG_COMPILER_WORKS]) -AC_BEFORE([$0], [_AC_EXEEXT]) +AC_BEFORE([$0], [_AC_COMPILER_EXEEXT]) m4_define([_AC_LANG_COMPILER_WORKS], [cross_compiling=maybe]) -m4_define([_AC_EXEEXT], [EXEEXT=]) +m4_define([_AC_COMPILER_EXEEXT], [EXEEXT=]) m4_define([AC_LINK_IFELSE], [AC_FATAL([All the tests involving linking were disabled by $0])]) @@ -626,6 +626,86 @@ m4_divert_pop()dnl ])# # AC_NO_EXECUTABLES + +# ----------------------------- # +# Computing EXEEXT and OBJEXT. # +# ----------------------------- # + + +# Files to ignore +# --------------- +# Ignore .d files produced by CFLAGS=-MD. +# +# On UWIN (which uses a cc wrapper for MSVC), the compiler also generates +# a .pdb file +# +# When the w32 free Borland C++ command line compiler links a program +# (conftest.exe), it also produces a file named `conftest.tds' in +# addition to `conftest.obj' + + +# We must not AU define them, because autoupdate would them remove +# them, which is right, but Automake 1.4 would remove the support for +# $(EXEEXT) etc. +# FIXME: Remove this once Automake fixed. +AC_DEFUN([AC_EXEEXT], []) +AC_DEFUN([AC_OBJEXT], []) + + +# _AC_COMPILER_EXEEXT +# ------------------- +# Check for the extension used for executables. It compiles a test +# executable. If this is called, the executable extensions will be +# automatically used by link commands run by the configure script. +# +# This macro is called by AC_LANG_COMPILER, the latter being required +# by the AC_LINK_IFELSE macros, so use _AC_LINK_IFELSE. +m4_define([_AC_COMPILER_EXEEXT], +[AC_CACHE_CHECK([for executable suffix], ac_cv_exeext, +[_AC_LINK_IFELSE([AC_LANG_PROGRAM()], +[# If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `ls conftest.exe conftest conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'` + break;; + esac +done], + [AC_MSG_ERROR([cannot compute EXEEXT: cannot compile and link])]) +rm -f conftest$ac_cv_exeext]) +AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl +ac_exeext=$EXEEXT +])# _AC_COMPILER_EXEEXT + + +# _AC_COMPILER_OBJEXT +# ------------------- +# Check the object extension used by the compiler: typically `.o' or +# `.obj'. If this is called, some other behaviour will change, +# determined by ac_objext. +# +# This macro is called by AC_LANG_COMPILER, the latter being required +# by the AC_COMPILE_IFELSE macros, so use _AC_COMPILE_IFELSE. +m4_define([_AC_COMPILER_OBJEXT], +[AC_CACHE_CHECK([for object suffix], ac_cv_objext, +[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], +[for ac_file in `ls conftest.o conftest.obj conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done], + [AC_MSG_ERROR([cannot compute OBJEXT: cannot compile])]) +rm -f conftest.$ac_cv_objext]) +AC_SUBST([OBJEXT], [$ac_cv_objext])dnl +ac_objext=$OBJEXT +])# _AC_COMPILER_OBJEXT + + # -------------------- # # 3b. The C compiler. # # -------------------- # @@ -752,8 +832,8 @@ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) _AC_LANG_COMPILER_WORKS _AC_LANG_COMPILER_GNU GCC=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_CC_G AC_LANG_POP ])# AC_PROG_CC @@ -945,8 +1025,8 @@ AC_CHECK_TOOLS(CXX, _AC_LANG_COMPILER_WORKS _AC_LANG_COMPILER_GNU GXX=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_CXX_G AC_LANG_POP ])# AC_PROG_CXX @@ -1044,8 +1124,8 @@ ac_ext=F _AC_LANG_COMPILER_GNU ac_ext=$ac_save_ext G77=`test $ac_compiler_gnu = yes && echo yes` -AC_EXPAND_ONCE([_AC_OBJEXT]) -AC_EXPAND_ONCE([_AC_EXEEXT]) +AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl +AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl _AC_PROG_F77_G AC_LANG_POP ])# AC_PROG_F77 diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 5b98d0086..55ce13a76 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -1189,91 +1189,6 @@ AU_DEFUN([AC_EMXOS2], []) AU_DEFUN([AC_MINGW32], []) -# We must not AU define them, because autoupdate would them remove -# them, which is right, but Automake 1.4 would remove the support for -# $(EXEEXT) etc. -# FIXME: Remove this once Automake fixed. -AC_DEFUN([AC_EXEEXT], []) -AC_DEFUN([AC_OBJEXT], []) - - -# _AC_EXEEXT -# ---------- -# Check for the extension used for executables. This knows that we -# add .exe for Cygwin or mingw32. Otherwise, it compiles a test -# executable. If this is called, the executable extensions will be -# automatically used by link commands run by the configure script. -# -# Ignore .d files produced by CFLAGS=-MD. -# -# On UWIN (which uses a cc wrapper for MSVC), the compiler also generates -# a .pdb file -# -# This macro is called by AC_LANG_COMPILER, the latter being required -# by the AC_COMPILE_IFELSE macros, so use AC_TRY_EVAL. -m4_define([_AC_EXEEXT], -[AC_CACHE_CHECK([for executable suffix], ac_cv_exeext, -[case "$CYGWIN $MINGW32 $EMXOS2" in - *yes*) ac_cv_exeext=.exe ;; - *) - AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) - if AC_TRY_EVAL(ac_link); then - # If both `conftest.exe' and `conftest' are `present' (well, observable) - # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will - # work properly (i.e., refer to `conftest.exe'), while it won't with - # `rm'. - for ac_file in `ls conftest.exe conftest conftest.* 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; - *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'` - break;; - esac - done - rm -f conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - else - AC_MSG_ERROR([cannot compile and link]) - fi - ;; -esac]) -AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl -ac_exeext=$EXEEXT -])# _AC_EXEEXT - - -# _AC_OBJEXT -# ---------- -# Check the object extension used by the compiler: typically .o or -# .obj. If this is called, some other behaviour will change, -# determined by ac_objext. -# -# When the w32 free Borland C++ command line compiler links a program -# (conftest.exe), it also produces a file named `conftest.tds' in -# addition to `conftest.obj' -# -# Ignore .d files produced by CFLAGS=-MD. -# -# This macro is called by AC_LANG_COMPILER, the latter being required -# by the AC_COMPILE_IFELSE macros, so use AC_TRY_EVAL. -m4_define([_AC_OBJEXT], -[AC_CACHE_CHECK([for object suffix], ac_cv_objext, -[AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) -if AC_TRY_EVAL(ac_compile); then - for ac_file in `ls conftest.o conftest.obj conftest.* 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.tds | *.d ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac - done - rm -f conftest.$ac_objext conftest.$ac_ext -else - AC_MSG_ERROR([cannot compile]) -fi]) -AC_SUBST(OBJEXT, $ac_cv_objext)dnl -ac_objext=$ac_cv_objext -])# _AC_OBJEXT - - ## -------------------------- ## ## Checks for UNIX variants. ##