]> granicus.if.org Git - p11-kit/commitdiff
do not assume dead code existence in autoconf checks
authorAlon Bar-Lev <alon.barlev@gmail.com>
Sat, 27 Jul 2013 20:22:00 +0000 (20:22 +0000)
committerStef Walter <stef@thewalter.net>
Mon, 29 Jul 2013 08:41:59 +0000 (10:41 +0200)
when compiler optimize source, it removes dead code so a linkage error
in these cases are not visisble.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
https://bugs.freedesktop.org/show_bug.cgi?id=67413

configure.ac

index 64f39c61f2291a7c85ff1457a3e025ad721c7ee7..e57272be478a4cc62897378c28f1742adcdbe42f 100644 (file)
@@ -100,9 +100,9 @@ if test "$os_unix" = "yes"; then
                        AC_MSG_RESULT([yes])],
                       [AC_MSG_RESULT([no])])
        AC_CHECK_DECLS([__progname])
-       AC_LINK_IFELSE([AC_LANG_SOURCE([extern char *__progname; void main() { }])],
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *__progname;]], [[__progname=(char*)0;]])],
                [AC_DEFINE(HAVE___PROGNAME, [1], [Whether __progname available])])
-       AC_LINK_IFELSE([AC_LANG_SOURCE([extern int __libc_enable_secure; void main() { }])],
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int __libc_enable_secure;]], [[__libc_enable_secure = 0;]])],
                [AC_DEFINE(HAVE___LIBC_ENABLE_SECURE, [1], [Whether __libc_enable_secure available])])
 fi