ソースを参照

build: Fix the __progname check to avoid the optimizer discarding the symbol

Because we were assigning to another unused variable, when building the
check with optimizations enabled, which is the default when using gcc as
the compiler, the variable was being discarded. Instead pass it to
printf() so that it cannot do so.
Guillem Jover 10 年 前
コミット
758ecf7fe1
共有2 個のファイルを変更した3 個の追加3 個の削除を含む
  1. 1 0
      debian/changelog
  2. 2 3
      m4/dpkg-funcs.m4

+ 1 - 0
debian/changelog

@@ -4,6 +4,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
   * Build system:
     - Add support for profiling perl modules.
     - Clean up compiler and linker automatic flag usage in configure.
+    - Fix the __progname check to avoid the optimizer discarding the symbol.
 
   [ Updated manpages translations ]
   * German (Helge Kreutzmann).

+ 2 - 3
m4/dpkg-funcs.m4

@@ -111,9 +111,8 @@ AC_DEFUN([DPKG_CHECK_PROGNAME],
                  [AC_MSG_RESULT([no])])
 
   AC_MSG_CHECKING([for __progname])
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
-                 [[extern char *__progname;
-                   const char *p = __progname;]])],
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *__progname;]],
+                 [[printf("%s", __progname);]])],
                  [AC_DEFINE([HAVE___PROGNAME], [1],
                             [Define to 1 if you have __progname])
                   AC_MSG_RESULT([yes])],