Wireshark-bugs: [Wireshark-bugs] [Bug 9912] New: configure.ac misuses autoconf cache vars (missi
Date: Fri, 21 Mar 2014 01:23:36 +0000
| Bug ID | 9912 |
|---|---|
| Summary | configure.ac misuses autoconf cache vars (missing AC_CACHE_CHECK) |
| Classification | Unclassified |
| Product | Wireshark |
| Version | Git |
| Hardware | All |
| OS | All |
| Status | UNCONFIRMED |
| Severity | Normal |
| Priority | Low |
| Component | Wireshark |
| Assignee | bugzilla-admin@wireshark.org |
| Reporter | vapier@gentoo.org |
Build Information:
--
the configure.ac file is full of code like:
AC_MSG_CHECKING(whether GLib supports loadable modules)
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS"
AC_TRY_RUN([
...
], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
[echo $ac_n "cross compiling; assumed OK... $ac_c"
ac_cv_glib_supports_modules=yes])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
if test "$ac_cv_glib_supports_modules" = yes ; then
AC_MSG_RESULT(yes)
have_plugins=yes
else
AC_MSG_RESULT(no)
have_plugins=no
fi
unfortunately, this is fundamentally wrong. it should be using AC_CACHE_CHECK
everywhere to see if the var has already been set, and if so, just use that
value. the current code makes it impossible for people to override the
configure tests in ways that make sense for their platform when the configure
test can't find the right answer (like cross-compiling).
the simple fix (using the above example):
-AC_MSG_CHECKING(whether GLib supports loadable modules)
+AC_CACHE_CHECK([whether GLib supports loadable modules],
[ac_cv_glib_supports_modules],
+[
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS"
AC_TRY_RUN([
...
], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
[echo $ac_n "cross compiling; assumed OK... $ac_c"
ac_cv_glib_supports_modules=yes])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
+])
if test "$ac_cv_glib_supports_modules" = yes ; then
AC_MSG_RESULT(yes)
have_plugins=yes
else
AC_MSG_RESULT(no)
have_plugins=no
fi
in the same vein, the script sometimes uses ac_cv_xxx when it makes no sense:
AC_ARG_ENABLE(usr-local,
AC_HELP_STRING( [--enable-usr-local],
[...]),
ac_cv_enable_usr_local=$enableval,ac_cv_enable_usr_local=yes)
AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
if test "x$ac_cv_enable_usr_local" = "xyes" ; then
that is not a cacheable test, nor do you even need to create your own variable
for it as autoconf already takes care of that. trivial fix:
AC_ARG_ENABLE(usr-local,
AC_HELP_STRING( [--enable-usr-local],
- [...]),
+ [...]))
- ac_cv_enable_usr_local=$enableval,ac_cv_enable_usr_local=yes)
AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
-if test "x$ac_cv_enable_usr_local" = "xyes" ; then
+if test "x$enable_usr_local" = "xyes" ; then
You are receiving this mail because:
- You are watching all bug changes.
- Prev by Date: [Wireshark-bugs] [Bug 9911] New: Buildbot crash output: fuzz-2014-03-20-8706.pcap
- Next by Date: [Wireshark-bugs] [Bug 9913] New: Buildbot crash output: fuzz-2014-03-20-505.pcap
- Previous by thread: [Wireshark-bugs] [Bug 9911] Buildbot crash output: fuzz-2014-03-20-8706.pcap
- Next by thread: [Wireshark-bugs] [Bug 9913] New: Buildbot crash output: fuzz-2014-03-20-505.pcap
- Index(es):