Build the C code with additional GCC warnings.
[bpt/guile.git] / configure.ac
index f10df10..66ac35c 100644 (file)
@@ -64,6 +64,7 @@ AC_PROG_INSTALL
 AC_PROG_CC
 gl_EARLY
 AC_PROG_CPP
+AC_PROG_SED
 AC_PROG_AWK
 
 dnl Gnulib.
@@ -86,6 +87,9 @@ AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
 
 AM_PATH_LISPDIR
 
+AC_DEFINE_UNQUOTED([HOST_TYPE], ["$host"],
+  [Define to the host's GNU triplet.])
+
 #--------------------------------------------------------------------
 #
 # User options (after above tests that may set default CFLAGS etc.)
@@ -826,6 +830,11 @@ AC_LIB_HAVE_LINKFLAGS(gmp,
   AC_MSG_ERROR([GNU MP 4.1 or greater not found, see README]))
 
 dnl GNU libunistring is checked for by Gnulib's `libunistring' module.
+if test "x$LTLIBUNISTRING" != "x"; then
+  LIBS="$LTLIBUNISTRING $LIBS"
+else
+  AC_MSG_ERROR([GNU libunistring is required, please install it.])
+fi
 
 dnl i18n tests
 #AC_CHECK_HEADERS([libintl.h])
@@ -890,8 +899,7 @@ AC_CHECK_FUNCS(sethostent   gethostent   endhostent   dnl
                setprotoent  getprotoent  endprotoent  dnl
                setservent   getservent   endservent   dnl
                getnetbyaddr getnetbyname dnl
-              inet_lnaof inet_makeaddr inet_netof hstrerror dnl
-              inet_pton inet_ntop)
+              inet_lnaof inet_makeaddr inet_netof hstrerror)
 
 # struct sockaddr field sin_len is only present on BSD systems.
 # On 4.4BSD apparently a #define SIN_LEN exists, but on other BSD systems
@@ -1185,6 +1193,13 @@ AC_CHECK_DECL([GC_do_blocking],
   [],
   [#include <gc/gc.h>])
 
+# `GC_fn_type' is not available in GC 7.1 and earlier.
+AC_CHECK_TYPE([GC_fn_type],
+  [AC_DEFINE([HAVE_GC_FN_TYPE], [1],
+    [Define this if the `GC_fn_type' type is available.])],
+  [],
+  [#include <gc/gc.h>])
+
 
 AC_CHECK_SIZEOF(float)
 if test "$ac_cv_sizeof_float" -le "$ac_cv_sizeof_long"; then
@@ -1372,6 +1387,8 @@ AC_DEFINE(PTHREAD_ATTR_GETSTACK_WORKS, [1], [Define when pthread_att_get_stack w
 CFLAGS="$old_CFLAGS"
 AC_MSG_RESULT($works)
 
+GUILE_THREAD_LOCAL_STORAGE
+
 fi # with_threads=pthreads
 
 
@@ -1419,6 +1436,7 @@ AC_ARG_VAR(GUILE_FOR_BUILD,[guile for build system])
 AC_SUBST(GUILE_FOR_BUILD)
                        
 ## If we're using GCC, ask for aggressive warnings.
+GCC_CFLAGS=""
 case "$GCC" in
   yes )
     ## We had -Wstrict-prototypes in here for a bit, but Guile does too
@@ -1426,14 +1444,21 @@ 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).
-    GCC_CFLAGS="-Wall -Wmissing-prototypes"
+    POTENTIAL_GCC_CFLAGS="-Wall -Wmissing-prototypes \
+      -Wdeclaration-after-statement -Wundef \
+      -Wswitch-enum"
     # Do this here so we don't screw up any of the tests above that might
     # not be "warning free"
     if test "${GUILE_ERROR_ON_WARNING}" = yes
     then
-       GCC_CFLAGS="${GCC_CFLAGS} -Werror"
+       POTENTIAL_GCC_CFLAGS="${POTENTIAL_GCC_CFLAGS} -Werror"
        enable_compile_warnings=no
     fi
+
+    for flag in $POTENTIAL_GCC_CFLAGS
+    do
+       gl_WARN_ADD([$flag], [GCC_CFLAGS])
+    done
     ;;
 esac