瀏覽代碼

Gah, I hate gcc. AC_TRY_COMPILE() produces code of the form
'int main() { ... }'. When -Werror -Wstrict-prototypes is given to gcc, it
thinks the above code snippet is an error, and aborts. This was making
DPKG_C_GCC_TRY_WARNS disable some -W options. So, I no longer use
AC_TRY_COMPILE.

Adam Heath 24 年之前
父節點
當前提交
c9491d1b1c
共有 2 個文件被更改,包括 14 次插入10 次删除
  1. 8 0
      ChangeLog
  2. 6 10
      automake/dpkg.m4

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+Sun May 19 05:57:24 CDT 2002 Adam Heath <doogie@debian.org>
+
+  * automake/dpkg.m4.  Gah, I hate gcc.  AC_TRY_COMPILE() produces code
+    of the form 'int main() { ... }'.  When -Werror -Wstrict-prototypes is
+    given to gcc, it thinks the above code snippet is an error, and aborts.
+    This was making DPKG_C_GCC_TRY_WARNS disable some -W options.  So, I
+    no longer use AC_TRY_COMPILE.
+
 Sun May 19 04:56:51 CDT 2002 Adam Heath <doogie@debian.org>
 
   * debian/rules:  Oops.  The command to run is aclocal, not aclocal.m4.

+ 6 - 10
automake/dpkg.m4

@@ -19,20 +19,16 @@ AC_DEFUN(DPKG_C_GCC_TRY_WARNS,[
  if test "${GCC-no}" = yes
  then
   AC_CACHE_VAL($2,[
-   oldcflags="${CFLAGS-}"
-   CFLAGS="${CFLAGS-} ${CWARNS} $1 -Werror"
-   AC_TRY_COMPILE([
-#include <string.h>
-#include <stdio.h>
-],[
-    strcmp("a","b"); fprintf(stdout,"test ok\n");
-], [$2=yes], [$2=no])
-   CFLAGS="${oldcflags}"])
+    if $CC $1 -c /dev/null 2>/dev/null; then
+      $2=yes
+    else
+      $2=
+    fi
+  ])
   if test "x$$2" = xyes; then
    CWARNS="${CWARNS} $1"
    AC_MSG_RESULT(ok)
   else
-   $2=''
    AC_MSG_RESULT(no)
   fi
  else