2004-03-24 Scott James Remnant <scott@netsplit.com>
+ * configure.ac: Catch errors during calls to AC_PROG_CXX,
+ AC_PROG_CXXCPP and AC_PROG_F77 before LT_INIT. Only set the
+ HAVE_CXX and HAVE_F77 conditions to true if an error didn't
+ occur (AC_PROG_CXX leaves CXX="g++" even if it didn't find one).
+ Set HAVE_GCJ and HAVE_RC to true correctly as well.
+ * m4/libtool.m4 (LT_PROG_GCJ): If AC_PROG_GCJ or AM_PROG_GCJ are
+ defined, expand to the definition of those instead of our own.
+ Define GCJ to '' instead of 'no' if not found.
+ (LT_PROG_RC) Define RC to '' instead of 'no' if not found.
+ (_LT_LANG_GCJ_CONFIG): Require LT_PROG_GCJ to be expanded first.
+ (_LT_LANG_RC_CONFIG): Require LT_PROG_RC to be expanded first.
+
* libltdl/ltdl.c (sys_dl_open): Don't load libraries with global
symbol resolution.
* NEWS: Updated.
AC_PROG_NM
AC_PROG_LN_S
-pushdef([AC_MSG_ERROR], [CXX=no])
+# Other languages get automatically inferred by the all-lang option passed
+# to LT_INIT below, however the Autoconf tests for C++ and Fortran 77
+# sometimes call AC_MSG_ERROR and we don't want that to be an error while
+# creating the libtool script, as these macros are AC_REQUIREd we can simply
+# call them here and catch the errors.
+pushdef([AC_MSG_ERROR], [caught_CXX_error=yes])
AC_PROG_CXX
+AC_PROG_CXXCPP
popdef([AC_MSG_ERROR])
-AM_CONDITIONAL(HAVE_CXX, [test "x$CXX" != xno])
-pushdef([AC_MSG_ERROR], [F77=no])
+pushdef([AC_MSG_ERROR], [caught_F77_error=yes])
AC_PROG_F77
popdef([AC_MSG_ERROR])
-if test -z "$F77"; then
- F77="no"
-fi
-AM_CONDITIONAL(HAVE_F77, [test "x$F77" != xno])
-
-LT_AC_PROG_GCJ
-AM_CONDITIONAL(HAVE_GCJ, [test "x$GCJ" != xno])
-
-LT_AC_PROG_RC
-AM_CONDITIONAL(HAVE_RC, [test "x$RC" != xno])
-
## ----------------------- ##
AC_LIB_LTDL
+## --------------------------- ##
+## Work out which tests to run ##
+## --------------------------- ##
+AM_CONDITIONAL(HAVE_CXX,
+[test "X$caught_CXX_error" != "Xyes" &&
+ test -n "[$]_LT_AC_TAGVAR(compiler, CXX)"])
+AM_CONDITIONAL(HAVE_F77,
+[test "X$caught_F77_error" != "Xyes" &&
+ test -n "[$]_LT_AC_TAGVAR(compiler, F77)"])
+AM_CONDITIONAL(HAVE_GCJ, [test -n "[$]_LT_AC_TAGVAR(compiler, GCJ)"])
+AM_CONDITIONAL(HAVE_RC, [test -n "[$]_LT_AC_TAGVAR(compiler, RC)"])
+
## -------- ##
## Outputs. ##
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_define([_LT_LANG_GCJ_CONFIG],
-[AC_LANG_SAVE
+[AC_REQUIRE([LT_PROG_GCJ])
+AC_LANG_SAVE
# Source file extension for Java test sources.
ac_ext=java
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_define([_LT_LANG_RC_CONFIG],
-[AC_LANG_SAVE
+[AC_REQUIRE([LT_PROG_RC])
+AC_LANG_SAVE
# Source file extension for RC test sources.
ac_ext=rc
AC_DEFUN([LT_PROG_GCJ],
-[AC_CHECK_TOOL(GCJ, gcj, no)
- test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
- AC_SUBST(GCJFLAGS)
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+ [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+ [AC_CHECK_TOOL(GCJ, gcj,)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)])])dnl
])
AU_DEFUN([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
AC_DEFUN([LT_PROG_RC],
-[AC_CHECK_TOOL(RC, windres, no)
+[AC_CHECK_TOOL(RC, windres,)
])
AU_DEFUN([LT_AC_PROG_RC], [LT_PROG_RC])