Fixed wint_t typedef detection (did not work with gcc-2.96)
authorSergey Vlasov <vsu@users.sourceforge.net>
Wed, 25 Apr 2001 16:15:40 +0000 (16:15 +0000)
committerSergey Vlasov <vsu@users.sourceforge.net>
Wed, 25 Apr 2001 16:15:40 +0000 (16:15 +0000)
ChangeLog.claws
ac/sv-check-type.m4 [new file with mode: 0644]
configure.in

index 92a66d5..ce7b604 100644 (file)
@@ -1,3 +1,9 @@
+2001-04-25
+
+       * ac/sv-check-type.m4: new autoconf macro.
+       * configure.in: fixed wint_t typedef detection (did not work
+         with gcc-2.96).
+
 2001-04-25
 
        * acconfig.h: added USE_GTKGDK_XIM definition for autoheader.
diff --git a/ac/sv-check-type.m4 b/ac/sv-check-type.m4
new file mode 100644 (file)
index 0000000..5caed61
--- /dev/null
@@ -0,0 +1,27 @@
+dnl sv_CHECK_TYPE(TYPE, DEFAULT [, INCLUDES])
+dnl
+dnl Like AC_CHECK_TYPE, but in addition to `sys/types.h', `stdlib.h' and
+dnl `stddef.h' checks files included by INCLUDES, which should be a
+dnl series of #include statements.  If TYPE is not defined, define it
+dnl to DEFAULT.
+dnl
+AC_DEFUN(sv_CHECK_TYPE,
+[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_MSG_CHECKING(for $1)
+AC_CACHE_VAL(sv_cv_type_$1,
+[AC_TRY_COMPILE([
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+$3
+], [
+#undef $1
+int a = sizeof($1);
+], sv_cv_type_$1=yes, sv_cv_type_$1=no)])dnl
+AC_MSG_RESULT($sv_cv_type_$1)
+if test $sv_cv_type_$1 = no; then
+  AC_DEFINE($1, $2)
+fi
+])
index d94615b..7e81637 100644 (file)
@@ -173,7 +173,8 @@ dnl Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h sys/param.h)
+AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h sys/param.h \
+                wchar.h wctype.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -181,11 +182,15 @@ AC_TYPE_OFF_T
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_STRUCT_TM
-AC_CHECK_TYPE(wint_t, unsigned int)
+sv_CHECK_TYPE(wint_t, unsigned int,
+[
+#if (HAVE_WCHAR_H && HAVE_WCTYPE_H)
+#include <wchar.h>
+#endif
+])
 
 dnl Checks for library functions.
 AC_FUNC_ALLOCA
-AC_CHECK_HEADERS(wchar.h wctype.h)
 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr \
               wcsstr wcswcs iswalnum iswspace towlower \
               wcslen wcscpy wcsncpy \