diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-06-28 19:34:35 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-06-28 19:34:35 +0000 |
commit | c0fa736323f0ae48fc0a6f1ef6bba11999f8b90a (patch) | |
tree | f64b7006be0a4b0221b38079f0bd7fa586e16d13 /configure.ac | |
parent | b5187b496b8c29f5d32973eee9c03cd41dbc513d (diff) |
Do the "is $CXX actually a C++ compiler" test as early as possible, so
that it doesn't fail due to the C++ compiler not supporting -W options
that the C compiler does.
(We should fix that, too, by having separate checks for whether the C
and C++ compilers support particular options.)
svn path=/trunk/; revision=50215
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac index 67b6123636..ba71908686 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,42 @@ dnl Work around libtool bug (fixed in the version 1.5a?) AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], ) AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL +if test ! -z "$CXX"; then + # + # OK, we found something AC_LANG_CXX thinks is a C++ compiler, + # but is it one? + # + # Some UN*Xes have, by default, a case-insensitive file + # system, and AC_PROG_CXX looks for, among other things, + # "CC" as a C++ compiler, and, if you have a case-insensitive + # file system and a C compiler named "cc" (both true, by + # default, on OS X), AC_PROG_CXX may end up thinking it's + # the C++ compiler. + # + # So we check by feeding the purported C++ compiler a + # program using C++ features (iostream). + # + # We do this after AC_PROG_LIBTOOL; if we did so before, and + # cleared CXX if what we had isn't a C++ compiler, that'd + # get undone by AC_PROG_LIBTOOL for some reason. + # + AC_MSG_CHECKING(whether $CXX is a C++ compiler) + AC_LANG_PUSH([C++]) + AC_LINK_IFELSE([AC_LANG_PROGRAM( + [ +#include <iostream> + ], + [ + std::cout << "Hello World! "; + return 0; + ])], + [AC_MSG_RESULT(yes)], + [ + AC_MSG_RESULT(no) + CXX="" + ]) + AC_LANG_POP([C++]) +fi AC_PATH_PROG(PERL, perl) # Check for Python. @@ -1070,32 +1106,9 @@ if test "x$enable_wireshark" = "xyes"; then # # Make sure we have a C++ compiler. # - # Some UN*Xes have, by default, a case-insensitive file - # system, and AC_PROG_CXX looks for, among other things, - # "CC" as a C++ compiler, and, if you have a case-insensitive - # file system and a C compiler named "cc" (both true, by - # default, on OS X), AC_PROG_CXX may end up thinking it's - # the C++ compiler. - # - # So we check by feeding the purported C++ compiler a - # program using C++ features (iostream). - # - AC_MSG_CHECKING(whether we have a working C++ compiler) - AC_LANG_PUSH([C++]) - AC_LINK_IFELSE([AC_LANG_PROGRAM( - [ -#include <iostream> - ], - [ - std::cout << "Hello World! "; - return 0; - ])], - [AC_MSG_RESULT(yes)], - [ - AC_MSG_RESULT(no) - AC_MSG_ERROR(Need a working C++ compiler to build Wireshark with Qt) - ]) - AC_LANG_POP([C++]) + if test -z "$CXX"; then + AC_MSG_ERROR(Need a working C++ compiler to build Wireshark with Qt) + fi AM_PATH_QT($QT_MIN_VERSION, [ |