]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* m4/libtool.m4 (_LT_PROG_CXX, _LT_PROG_F77): New macros to work
authorPeter O'Gorman <peter@pogma.com>
Wed, 6 Oct 2004 13:48:56 +0000 (13:48 +0000)
committerPeter O'Gorman <peter@pogma.com>
Wed, 6 Oct 2004 13:48:56 +0000 (13:48 +0000)
around the deficiencies in AC_PROG_CXX and AC_PROG_F77.
* configure.ac: Cleaned up, having moved the checks for compilers
which do not exist to libtool.m4.

ChangeLog
configure.ac
m4/libtool.m4

index 7504b2595ab1fbcb518cf88654da409c5c92d84b..ebd4aec9a10a994d15b5f4e9d406b12cb88dbdff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-10-06  Peter O'Gorman  <peter@pogma.com>
+
+       * m4/libtool.m4 (_LT_PROG_CXX, _LT_PROG_F77): New macros to work
+       around the deficiencies in AC_PROG_CXX and AC_PROG_F77.
+       * configure.ac: Cleaned up, having moved the checks for compilers
+       which do not exist to libtool.m4.
+
 2004-10-05  Peter O'Gorman  <peter@pogma.com>
 
        * config/ltmain.m4sh [darwin]: Make the -dylib_file flag work on
index 61cc1de4ef1f548983f5020eb5bfe3e1986c475a..9790cc7a11e0a5c33e74e230286ae264c809b828 100644 (file)
@@ -159,20 +159,6 @@ AC_SUBST([DIST_MAKEFILE_LIST])
 AC_PROG_CC
 AC_PROG_CPP
 
-# The Autoconf tests for C++ and Fortran 77 sometimes call AC_MSG_ERROR
-# and we don't want that to be an error whilst creating the libtool script.
-# As these are AC_REQUIREd inside libtool.m4 we can simply call them here
-# and catch the errors now.
-pushdef([AC_MSG_ERROR], [caught_CXX_error=yes])
-AC_PROG_CXX
-AC_PROG_CXXCPP
-popdef([AC_MSG_ERROR])
-
-pushdef([AC_MSG_ERROR], [caught_F77_error=yes])
-AC_PROG_F77
-popdef([AC_MSG_ERROR])
-
-
 ## ----------------------- ##
 ## Libtool initialisation. ##
 ## ----------------------- ##
@@ -189,12 +175,8 @@ LT_LANG(Windows Resource)
 ## --------------------------- ##
 ## Work out which tests to run ##
 ## --------------------------- ##
-AM_CONDITIONAL(HAVE_CXX,
-[test "X$caught_CXX_error" != "Xyes" &&
- test -n "[$]_LT_TAGVAR(compiler, CXX)"])
-AM_CONDITIONAL(HAVE_F77,
-[test "X$caught_F77_error" != "Xyes" &&
- test -n "[$]_LT_TAGVAR(compiler, F77)"])
+AM_CONDITIONAL(HAVE_CXX,[test -n "[$]_LT_TAGVAR(compiler, CXX)"])
+AM_CONDITIONAL(HAVE_F77,[test -n "[$]_LT_TAGVAR(compiler, F77)"])
 AM_CONDITIONAL(HAVE_GCJ, [test -n "[$]_LT_TAGVAR(compiler, GCJ)"])
 AM_CONDITIONAL(HAVE_RC, [test -n "[$]_LT_TAGVAR(compiler, RC)"])
 
index 42bb682e5ce1208a944d51aceb8eafb984f8bbb4..e158528a7df3f640f0265b02bae23d6b43ff75dd 100644 (file)
@@ -4462,6 +4462,24 @@ AC_LANG_POP
 CC="$lt_save_CC"
 ])# _LT_LANG_C_CONFIG
 
+# _LT_PROG_CXX
+# ------------
+# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
+# compiler, we have our own version here.
+m4_defun([_LT_PROG_CXX],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
+AC_PROG_CXX
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || 
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else  
+  _lt_caught_CXX_error=yes 
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_CXX
+
 
 # _LT_LANG_CXX_CONFIG([TAG])
 # --------------------------
@@ -4469,8 +4487,7 @@ CC="$lt_save_CC"
 # defined.  These variables are subsequently used by _LT_CONFIG to write
 # the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_CXX_CONFIG],
-[AC_REQUIRE([AC_PROG_CXX])dnl
-AC_REQUIRE([AC_PROG_CXXCPP])dnl
+[AC_REQUIRE([_LT_PROG_CXX])dnl
 AC_REQUIRE([LT_SYS_DLOPEN_SELF])dnl
 m4_require([_LT_DECL_EGREP])dnl
 
@@ -4506,7 +4523,7 @@ _LT_TAGVAR(objext, $1)=$objext
 # the CXX compiler isn't working.  Some variables (like enable_shared)
 # are currently assumed to apply to all compilers on this platform,
 # and will be corrupted by setting them based on a non-working compiler.
-if test "$caught_CXX_error" != yes; then
+if test "$_lt_caught_CXX_error" != yes; then
   # Code to be used in simple compile tests
   lt_simple_compile_test_code="int some_variable = 0;\n"
 
@@ -5386,7 +5403,7 @@ if test "$caught_CXX_error" != yes; then
 
     _LT_CONFIG($1)
   fi # test -n "$compiler"
-fi # test "$caught_CXX_error" != yes
+fi # test "$_lt_caught_CXX_error" != yes
 
 AC_LANG_POP
 CC=$lt_save_CC
@@ -5553,13 +5570,28 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1],
     a shared library])
 ])# _LT_SYS_HIDDEN_LIBDEPS
 
+# _LT_PROG_F77
+# ------------
+# Since AC_PROG_F77 is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_F77],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_F77_error=yes])
+AC_PROG_F77
+if test -z "$F77"; then
+  _lt_caught_F77_error=yes 
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_F77
+
+
 # _LT_LANG_F77_CONFIG([TAG])
 # --------------------------
 # Ensure that the configuration variables for a Fortran 77 compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_F77_CONFIG],
-[AC_REQUIRE([AC_PROG_F77])dnl
+[AC_REQUIRE([_LT_PROG_F77])dnl
 AC_LANG_PUSH(Fortran 77)
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
@@ -5593,7 +5625,7 @@ _LT_TAGVAR(objext, $1)=$objext
 # the F77 compiler isn't working.  Some variables (like enable_shared)
 # are currently assumed to apply to all compilers on this platform,
 # and will be corrupted by setting them based on a non-working compiler.
-if test "$caught_F77_error" != yes; then
+if test "$_lt_caught_F77_error" != yes; then
   # Code to be used in simple compile tests
   lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
 
@@ -5657,7 +5689,7 @@ if test "$caught_F77_error" != yes; then
 
     _LT_CONFIG($1)
   fi # test -n "$compiler"
-fi # test "$caught_F77_error" != yes
+fi # test "$_lt_caught_F77_error" != yes
 
 AC_LANG_POP
 CC="$lt_save_CC"