Ensure that the compiler 'knows' the 'long' type in CURL_CONFIGURE_LONG
authorYang Tse <yangsita@gmail.com>
Wed, 13 Aug 2008 18:57:48 +0000 (18:57 +0000)
committerYang Tse <yangsita@gmail.com>
Wed, 13 Aug 2008 18:57:48 +0000 (18:57 +0000)
acinclude.m4

index 3f100a8..b2e4995 100644 (file)
@@ -3613,6 +3613,30 @@ _EOF
 ])
 
 
+dnl CURL_INCLUDES_INTTYPES
+dnl -------------------------------------------------
+dnl Set up variable with list of headers that must be
+dnl included when inttypes.h is to be included.
+
+AC_DEFUN([CURL_INCLUDES_INTTYPES], [
+curl_includes_inttypes="\
+/* includes start */
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+/* includes end */"
+  AC_CHECK_HEADERS(
+    sys/types.h stdint.h inttypes.h,
+    [], [], [$curl_includes_inttypes])
+])
+
+
 dnl CURL_CONFIGURE_LONG
 dnl -------------------------------------------------
 dnl Find out the size of long as reported by sizeof() and define
@@ -3622,6 +3646,7 @@ dnl The size of long is a build time characteristic and as such
 dnl must be recorded in curlbuild.h
 
 AC_DEFUN([CURL_CONFIGURE_LONG], [
+  AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
   if test ! -z "$ac_cv_sizeof_long"; then
     AC_MSG_WARN([Use CURL-CONFIGURE-LONG to check the size of long first])
   fi
@@ -3631,6 +3656,7 @@ AC_DEFUN([CURL_CONFIGURE_LONG], [
     if test "$curl_sizeof_long" = "unknown"; then
       AC_COMPILE_IFELSE([
         AC_LANG_PROGRAM([[
+          $curl_includes_inttypes
           typedef char dummy_arr[sizeof(long) == $tmp_size ? 1 : -1];
         ]],[[
           dummy_arr[1] = (long)1;
@@ -3650,30 +3676,6 @@ AC_DEFUN([CURL_CONFIGURE_LONG], [
 ])
 
 
-dnl CURL_INCLUDES_INTTYPES
-dnl -------------------------------------------------
-dnl Set up variable with list of headers that must be
-dnl included when inttypes.h is to be included.
-
-AC_DEFUN([CURL_INCLUDES_INTTYPES], [
-curl_includes_inttypes="\
-/* includes start */
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-/* includes end */"
-  AC_CHECK_HEADERS(
-    sys/types.h stdint.h inttypes.h,
-    [], [], [$curl_includes_inttypes])
-])
-
-
 dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE)
 dnl -------------------------------------------------
 dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T