]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Modernize AC_EXEEXT and AC_OBJEXT.
authorAkim Demaille <akim@epita.fr>
Tue, 23 May 2000 14:50:43 +0000 (14:50 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 23 May 2000 14:50:43 +0000 (14:50 +0000)
Now work with other languages than C and C++.

* acspecific.m4 (AC_EXEEXT, AC_OBJEXT): Use
AC_COMPILE_IFELSE/AC_LINK_IFELSE and AC_LANG_PROGRAM instead of
ad hoc code.
Use `$ac_ext' instead of listing `.c', `.C' etc.
Use AC_CACHE_CHECK.
* doc/autoconf.texi (System Services): Adjust.

ChangeLog
acspecific.m4
doc/autoconf.texi
lib/autoconf/specific.m4

index c8af754c0b12419524b9c74b725a2d844f5f157e..d1c8e487f10512656e0ca879ebac9c1a6b691bc5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2000-05-23  Akim Demaille  <akim@epita.fr>
+
+       Modernize AC_EXEEXT and AC_OBJEXT.
+       Now work with other languages than C and C++.
+
+       * acspecific.m4 (AC_EXEEXT, AC_OBJEXT): Use
+       AC_COMPILE_IFELSE/AC_LINK_IFELSE and AC_LANG_PROGRAM instead of
+       ad hoc code.
+       Use `$ac_ext' instead of listing `.c', `.C' etc.
+       Use AC_CACHE_CHECK.
+       * doc/autoconf.texi (System Services): Adjust.
+
 2000-05-23  Akim Demaille  <akim@epita.fr>
 
        Simplify the interface: users shouldn't need to explicitly check
index 91d84f56402cdb1d4147275367f248d0d412c260..c65357b30d0a2d82c84a5f883fe6499fec508421 100644 (file)
@@ -2554,30 +2554,22 @@ AC_DEFUN([AC_EXEEXT],
 [_AC_CYGWIN
 _AC_MINGW32
 _AC_EMXOS2
-AC_MSG_CHECKING([for executable suffix])
-AC_CACHE_VAL(ac_cv_exeext,
+AC_CACHE_CHECK([for executable suffix], ac_cv_exeext,
 [if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = yes; then
   ac_cv_exeext=.exe
 else
-  rm -f conftest*
-  echo 'int main () { return 0; }' >conftest.$ac_ext
-  ac_cv_exeext=
-  if AC_TRY_EVAL(ac_link); then
-    for ac_file in conftest.*; do
-      case $ac_file in
-      *.c | *.C | *.o | *.obj | *.xcoff) ;;
-      *) ac_cv_exeext=`echo $ac_file | sed -e s/conftest//` ;;
-      esac
-    done
-  else
-    AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.])
-  fi
-  rm -f conftest*
-  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+  AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+  [for ac_file in conftest.*; do
+     case $ac_file in
+       *.$ac_ext | *.o | *.obj | *.xcoff) ;;
+       *) ac_cv_exeext=`echo $ac_file | sed -e s/conftest//` ;;
+     esac
+   done],
+  [AC_MSG_ERROR([cannot compile and link])])
+  test -n "$ac_cv_exeext" && ac_cv_exeext=no
 fi])
-EXEEXT=""
-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
-AC_MSG_RESULT(${ac_cv_exeext})
+EXEEXT=
+test "$ac_cv_exeext" != no && EXEEXT=$ac_cv_exeext
 dnl Setting ac_exeext will implicitly change the ac_link command.
 ac_exeext=$EXEEXT
 AC_SUBST(EXEEXT)dnl
@@ -2590,26 +2582,18 @@ AC_SUBST(EXEEXT)dnl
 # .obj.  If this is called, some other behaviour will change,
 # determined by ac_objext.
 AC_DEFUN([AC_OBJEXT],
-[AC_MSG_CHECKING([for object suffix])
-AC_CACHE_VAL(ac_cv_objext,
-[rm -f conftest*
-echo 'int i = 1;' >conftest.$ac_ext
-if AC_TRY_EVAL(ac_compile); then
-  for ac_file in conftest.*; do
+[AC_CACHE_CHECK([for object suffix], ac_cv_objext,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+   [for ac_file in conftest.*; do
     case $ac_file in
-    *.c) ;;
-    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+      *.$ac_ext) ;;
+      *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
     esac
-  done
-else
-  AC_MSG_ERROR([installation or configuration problem; compiler does not work])
-fi
-rm -f conftest*])
-AC_MSG_RESULT($ac_cv_objext)
-OBJEXT=$ac_cv_objext
+  done],
+   [AC_MSG_ERROR([cannot compile])])])
+AC_SUBST(OBJEXT, $ac_cv_objext)dnl
 ac_objext=$ac_cv_objext
-AC_SUBST(OBJEXT)])
-
+])
 
 
 
index 3212c260e4bbaaec7aa9bec1ecf4693c91142a98..502ecdc61921d97137495b842f52520f3195c3e6 100644 (file)
@@ -4047,9 +4047,10 @@ The following macros check for operating system services or capabilities.
 @maindex EMXOS2
 @maindex MINGW32
 Defines substitute variable @code{EXEEXT} based on the output of the
-compiler, after @samp{.c}, @samp{.C}, @samp{.o}, @samp{.obj} and
-@samp{.xcoff} files have been excluded.  Typically set to empty string
-if Unix and @samp{.exe} if Win32 or OS/2.
+compiler, after @samp{.$ac_ext} (i.e. source files of the current
+language), @samp{.o}, @samp{.obj} and @samp{.xcoff} files have been
+excluded.  Typically set to empty string if Unix and @samp{.exe} if
+Win32 or OS/2.
 
 This macro sets the shell variable @code{CYGWIN} to @samp{yes} if run in
 the Cygwin environment, @code{EMXOS2} to @samp{yes} if in the EMX
index 91d84f56402cdb1d4147275367f248d0d412c260..c65357b30d0a2d82c84a5f883fe6499fec508421 100644 (file)
@@ -2554,30 +2554,22 @@ AC_DEFUN([AC_EXEEXT],
 [_AC_CYGWIN
 _AC_MINGW32
 _AC_EMXOS2
-AC_MSG_CHECKING([for executable suffix])
-AC_CACHE_VAL(ac_cv_exeext,
+AC_CACHE_CHECK([for executable suffix], ac_cv_exeext,
 [if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = yes; then
   ac_cv_exeext=.exe
 else
-  rm -f conftest*
-  echo 'int main () { return 0; }' >conftest.$ac_ext
-  ac_cv_exeext=
-  if AC_TRY_EVAL(ac_link); then
-    for ac_file in conftest.*; do
-      case $ac_file in
-      *.c | *.C | *.o | *.obj | *.xcoff) ;;
-      *) ac_cv_exeext=`echo $ac_file | sed -e s/conftest//` ;;
-      esac
-    done
-  else
-    AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.])
-  fi
-  rm -f conftest*
-  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+  AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+  [for ac_file in conftest.*; do
+     case $ac_file in
+       *.$ac_ext | *.o | *.obj | *.xcoff) ;;
+       *) ac_cv_exeext=`echo $ac_file | sed -e s/conftest//` ;;
+     esac
+   done],
+  [AC_MSG_ERROR([cannot compile and link])])
+  test -n "$ac_cv_exeext" && ac_cv_exeext=no
 fi])
-EXEEXT=""
-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
-AC_MSG_RESULT(${ac_cv_exeext})
+EXEEXT=
+test "$ac_cv_exeext" != no && EXEEXT=$ac_cv_exeext
 dnl Setting ac_exeext will implicitly change the ac_link command.
 ac_exeext=$EXEEXT
 AC_SUBST(EXEEXT)dnl
@@ -2590,26 +2582,18 @@ AC_SUBST(EXEEXT)dnl
 # .obj.  If this is called, some other behaviour will change,
 # determined by ac_objext.
 AC_DEFUN([AC_OBJEXT],
-[AC_MSG_CHECKING([for object suffix])
-AC_CACHE_VAL(ac_cv_objext,
-[rm -f conftest*
-echo 'int i = 1;' >conftest.$ac_ext
-if AC_TRY_EVAL(ac_compile); then
-  for ac_file in conftest.*; do
+[AC_CACHE_CHECK([for object suffix], ac_cv_objext,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+   [for ac_file in conftest.*; do
     case $ac_file in
-    *.c) ;;
-    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+      *.$ac_ext) ;;
+      *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
     esac
-  done
-else
-  AC_MSG_ERROR([installation or configuration problem; compiler does not work])
-fi
-rm -f conftest*])
-AC_MSG_RESULT($ac_cv_objext)
-OBJEXT=$ac_cv_objext
+  done],
+   [AC_MSG_ERROR([cannot compile])])])
+AC_SUBST(OBJEXT, $ac_cv_objext)dnl
 ac_objext=$ac_cv_objext
-AC_SUBST(OBJEXT)])
-
+])