summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2016-08-28 17:13:20 +0200
committerGuillem Jover <guillem@hadrons.org>2017-06-05 05:52:07 +0200
commit368af99f554ca1c7211faf9eedfffcf45e5e76bb (patch)
tree5d078d4907911b09a53b509d0714d055f373996c /configure.ac
parent337e62027503aa6e09ca7adbe94cd7077f3241c3 (diff)
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.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac5
1 files changed, 2 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 5a432d4..5cbc2fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,9 +131,8 @@ AC_LINK_IFELSE(
AC_MSG_CHECKING([for __progname])
AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[]],
- [[extern char *__progname;
- const char *p = __progname;]])],
+ [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])],
[AC_MSG_RESULT([no])])