Reveal guile-tools's inner simplicity...
[bpt/guile.git] / configure.ac
index fe77773..146b77b 100644 (file)
@@ -65,6 +65,9 @@ AC_PROG_AWK
 
 dnl Gnulib.
 gl_INIT
+dnl FIXME: remove me and the acinclude.m4 code when clock-gettime is
+dnl LGPL-compatible and can be imported normally.
+gl_CLOCK_TIME
 
 AC_PROG_CC_C89
 
@@ -874,6 +877,11 @@ if test "x$LTLIBUNISTRING" = "x"; then
   AC_MSG_ERROR([GNU libunistring is required, please install it.])
 fi
 
+GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT
+if test "x$ac_cv_libunistring_with_iconv_support" != "xyes"; then
+  AC_MSG_ERROR([No iconv support.  Please recompile libunistring with iconv enabled.])
+fi
+
 dnl Libffi is needed to compile Guile's foreign function interface, but its
 dnl interface isn't exposed in Guile's API.
 PKG_CHECK_MODULES(LIBFFI, libffi)
@@ -1186,6 +1194,70 @@ AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,
 GUILE_STRUCT_UTIMBUF
 
 
+#--------------------------------------------------------------------
+#
+# What values do the iconv error handlers have?
+#
+# The only place that we need iconv in our public interfaces is for
+# the error handlers, which are just ints.  So we weaken our
+# dependency by looking up those values at configure-time.
+#--------------------------------------------------------------------
+SCM_I_GSC_ICONVEH_ERROR=0
+SCM_I_GSC_ICONVEH_QUESTION_MARK=1
+SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE=2
+AC_MSG_CHECKING([for iconveh_error])
+AC_RUN_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+#include <uniconv.h>
+int
+main (int argc, char *argv[])
+{
+  if (argc > 1)
+    printf ("%d\n", (int)iconveh_error);
+  return 0;
+}])],
+              [SCM_I_GSC_ICONVEH_ERROR=`./conftest$EXEEXT pretty-please`
+                AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_ERROR])],
+              [AC_MSG_FAILURE([failed to get iconveh_error])],
+              [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_ERROR for cross-compilation])])
+
+AC_MSG_CHECKING([for iconveh_question_mark])
+AC_RUN_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+#include <uniconv.h>
+int
+main (int argc, char *argv[])
+{
+  if (argc > 1)
+    printf ("%d\n", (int)iconveh_question_mark);
+  return 0;
+}])],
+              [SCM_I_GSC_ICONVEH_QUESTION_MARK=`./conftest$EXEEXT pretty-please`
+                AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_QUESTION_MARK])],
+              [AC_MSG_FAILURE([failed to get iconveh_question_mark])],
+              [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_QUESTION_MARK for cross-compilation])])
+
+AC_MSG_CHECKING([for iconveh_escape_sequence])
+AC_RUN_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+#include <uniconv.h>
+int
+main (int argc, char *argv[])
+{
+  if (argc > 1)
+    printf ("%d\n", (int)iconveh_escape_sequence);
+  return 0;
+}])],
+              [SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE=`./conftest$EXEEXT pretty-please`
+                AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE])],
+              [AC_MSG_FAILURE([failed to get iconveh_escape_sequence])],
+              [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE for cross-compilation])])
+
+AC_SUBST([SCM_I_GSC_ICONVEH_ERROR])
+AC_SUBST([SCM_I_GSC_ICONVEH_QUESTION_MARK])
+AC_SUBST([SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE])
+
+
 #--------------------------------------------------------------------
 #
 # Which way does the stack grow?
@@ -1238,7 +1310,7 @@ save_LIBS="$LIBS"
 LIBS="$BDW_GC_LIBS $LIBS"
 CFLAGS="$BDW_GC_CFLAGS $CFLAGS"
 
-AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask])
+AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback])
 
 # Though the `GC_do_blocking ()' symbol is present in GC 7.1, it is not
 # declared, and has a different type (returning void instead of
@@ -1514,8 +1586,10 @@ case "$GCC" in
     ## less than exasperating.
     ## -Wpointer-arith was here too, but something changed in gcc/glibc
     ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
+    ## -Wundef was removed because Gnulib prevented it (see
+    ## <http://thread.gmane.org/gmane.lisp.guile.bugs/5329>.)
     POTENTIAL_GCC_CFLAGS="-Wall -Wmissing-prototypes \
-      -Wdeclaration-after-statement -Wundef \
+      -Wdeclaration-after-statement \
       -Wswitch-enum"
     # Do this here so we don't screw up any of the tests above that might
     # not be "warning free"