Call AC_CHECK_SIZEOF() or AC_CHECK_TYPES() macros at earlier stage where LIBS variabl...
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Thu, 24 Sep 2020 04:44:55 +0000 (13:44 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Fri, 2 Oct 2020 01:27:27 +0000 (10:27 +0900)
These macros compile and run some programs. On some platforms(with some linker options like
--no-as-needed in Lnux Gnu linker) the programs try to link libraries specified by LIBS variable at run time.
There are some cases that the programs fail due to missing library which is actually not needed and AC_CHECK_SIZEOF() returns 0.

configure.ac

index a01919081251ee98320dace00c050339fb981217..51ffa1ae5c3c0590838f7d81a0d0fb1f81787bb1 100644 (file)
@@ -14,6 +14,17 @@ AC_PROG_CC
 
 AM_CONDITIONAL([GCC], [test -n "$GCC"])
 
+# All AC_CHECK_SIZEOF() or AC_CHECK_TYPES() calls were move from 4.
+# unixODBC wants the following to get sane behavior for ODBCINT64
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long int)  # for unixODBC
+AC_CHECK_SIZEOF(void *)
+AC_CHECK_TYPES([long long])
+AC_CHECK_TYPES([signed char])
+AC_CHECK_TYPES([ssize_t])
+AC_TYPE_SIZE_T
+
+# Check if "-Wall" is valid
 if test -n "$GCC" && test "$ac_test_CFLAGS" != set; then
 
    AC_MSG_CHECKING(-Wall is a valid compile option)
@@ -231,17 +242,7 @@ AC_CHECK_HEADER(libpq-fe.h,,[AC_MSG_ERROR([libpq header not found])])
 AC_HEADER_TIME
 
 
-# 4. Types
-
-# unixODBC wants the following to get sane behavior for ODBCINT64
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(long int)  # for unixODBC
-AC_CHECK_SIZEOF(void *)
-AC_CHECK_TYPES(long long)
-AC_CHECK_TYPES(signed char)
-
-AC_CHECK_TYPES(ssize_t)
-AC_TYPE_SIZE_T
+# 4. Types(all members were moved to 0.)
 
 # 5. Structures