| Submitter | Ian Taylor |
|---|---|
| Date | Oct. 5, 2010, 2:18 p.m. |
| Message ID | <mcr7hhwena0.fsf@google.com> |
| Download | mbox | patch |
| Permalink | /patch/66833/ |
| State | New |
| Headers | show |
Comments
Ian Lance Taylor <iant@google.com> writes: > Index: configure.ac > =================================================================== > --- configure.ac (revision 164990) > +++ configure.ac (working copy) > @@ -56,15 +56,22 @@ fi > AC_HEADER_TIME > ACX_HEADER_STRING > > +# Running AC_CHECK_HEADERS in a conditional means that we will only > +# test for supporting programs in a conditional. Test for them here, > +# so that the tests are run either way. > +AC_PROG_EGREP > + > # AC_CHECK_HEADERS is repeated to work around apparent autoconf 2.59 bug. If > # AC_CHECK_HEADERS comes after the if clause, the last AC_LANG call gets used, > # no matter which branch is taken. > if test "$ENABLE_BUILD_WITH_CXX" = "no"; then > AC_LANG(C) > + AC_HEADER_STDC > AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \ > stdlib.h strings.h string.h sys/file.h unistd.h) > else > AC_LANG(C++) > + AC_HEADER_STDC > AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \ > stdlib.h strings.h string.h sys/stat.h sys/file.h unistd.h) > fi You cannot put AC_LANG in a shell conditional like this in the first place. As it stands now all subsequent autoconf macros are using the C++ language variants (try exchanging the two AC_LANG calls and compare the generated configure script). I think the only reliable way to implement that is to put all tests in a macro, and expand it twice in the two arms of the AS_IF macro with [test "$ENABLE_BUILD_WITH_CXX" = "no"] as the condition. Andreas.
Patch
Index: configure.ac =================================================================== --- configure.ac (revision 164990) +++ configure.ac (working copy) @@ -56,15 +56,22 @@ fi AC_HEADER_TIME ACX_HEADER_STRING +# Running AC_CHECK_HEADERS in a conditional means that we will only +# test for supporting programs in a conditional. Test for them here, +# so that the tests are run either way. +AC_PROG_EGREP + # AC_CHECK_HEADERS is repeated to work around apparent autoconf 2.59 bug. If # AC_CHECK_HEADERS comes after the if clause, the last AC_LANG call gets used, # no matter which branch is taken. if test "$ENABLE_BUILD_WITH_CXX" = "no"; then AC_LANG(C) + AC_HEADER_STDC AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \ stdlib.h strings.h string.h sys/file.h unistd.h) else AC_LANG(C++) + AC_HEADER_STDC AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \ stdlib.h strings.h string.h sys/stat.h sys/file.h unistd.h) fi @@ -93,7 +100,6 @@ AC_CHECK_DECLS(m4_split(m4_normalize(lib # Checks for library functions. AC_FUNC_ALLOCA -AC_HEADER_STDC AM_LANGINFO_CODESET ZW_GNU_GETTEXT_SISTER_DIR