浏览代码

configure: fix odbc configuration for Windows (#1883)

Following update to autoconf 2.69 and its changed AC_CHECK_HEADER workings,
configuring with ODBC for Windows fails if not "windows.h" is included.

See:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/autoconf.html#Present-But-Cannot-Be-Compiled
nilason 3 年之前
父节点
当前提交
7388b3f2f0
共有 3 个文件被更改,包括 31 次插入12 次删除
  1. 16 11
      configure
  2. 12 1
      configure.ac
  3. 3 0
      include/config.h.in

+ 16 - 11
configure

@@ -12265,28 +12265,33 @@ if test -n "$with_odbc_includes" ; then
 fi
 
 
+ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default"
+if test "x$ac_cv_header_windows_h" = xyes; then :
+
+$as_echo "#define HAVE_WINDOWS_H 1" >>confdefs.h
+
+fi
+
+
 
 ac_save_cppflags="$CPPFLAGS"
 CPPFLAGS="$ODBCINC $CPPFLAGS"
-for ac_header in sql.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default"
-if test "x$ac_cv_header_sql_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SQL_H 1
-_ACEOF
+ac_fn_c_check_header_compile "$LINENO" "sql.h" "ac_cv_header_sql_h" "#if defined(HAVE_WINDOWS_H)
+# include <windows.h>
+#endif
 
-else
+"
+if test "x$ac_cv_header_sql_h" = xyes; then :
 
-    as_fn_error $? "*** Unable to locate ODBC includes." "$LINENO" 5
+$as_echo "#define HAVE_SQL_H 1" >>confdefs.h
 
+else
+  as_fn_error $? "*** Unable to locate <sql.h>." "$LINENO" 5
 fi
 
-done
 
 CPPFLAGS=$ac_save_cppflags
 
-
 # With ODBC library directory
 
 

+ 12 - 1
configure.ac

@@ -1438,7 +1438,18 @@ if test -n "$USE_ODBC"; then
 
 LOC_CHECK_INC_PATH(odbc,ODBC,ODBCINC)
 
-LOC_CHECK_INCLUDES(sql.h,ODBC,$ODBCINC)
+AC_CHECK_HEADER([windows.h],
+    AC_DEFINE(HAVE_WINDOWS_H, 1, [Define to 1 if you have the <windows.h> header file.]))
+
+ac_save_cppflags="$CPPFLAGS"
+CPPFLAGS="$ODBCINC $CPPFLAGS"
+AC_CHECK_HEADER([sql.h],
+AC_DEFINE(HAVE_SQL_H, 1, [Define to 1 if you have the <sql.h> header file.]),
+AC_MSG_ERROR([*** Unable to locate <sql.h>.]),[#if defined(HAVE_WINDOWS_H)
+# include <windows.h>
+#endif
+])
+CPPFLAGS=$ac_save_cppflags
 
 # With ODBC library directory
 

+ 3 - 0
include/config.h.in

@@ -275,6 +275,9 @@
 /* Define to 1 if you have the <values.h> header file. */
 #undef HAVE_VALUES_H
 
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
 /* Define to 1 if you have the <zlib.h> header file. */
 #undef HAVE_ZLIB_H