mirror of
https://github.com/postgres/postgres.git
synced 2025-05-23 00:02:38 -04:00
Twiddle C++ configuration checks so that we #include <string> (if
it exists) before testing 'using namespace std'. This is necessary on some C++ setups where the compiler won't take a 'using' until you've included a header that mentions namespace std. (Pretty braindead if you ask me, but...)
This commit is contained in:
parent
ac6637485b
commit
1c8244ec67
865
src/configure
vendored
865
src/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -490,6 +490,7 @@ AC_SUBST(USE_ODBC)
|
|||||||
AC_SUBST(MULTIBYTE)
|
AC_SUBST(MULTIBYTE)
|
||||||
|
|
||||||
dnl Check for C++ support (allow override if needed)
|
dnl Check for C++ support (allow override if needed)
|
||||||
|
dnl XXX: probably should default to HAVECXX='false'
|
||||||
HAVECXX='true'
|
HAVECXX='true'
|
||||||
AC_ARG_WITH(CXX,
|
AC_ARG_WITH(CXX,
|
||||||
[ --with-CXX=compiler use specific C++ compiler
|
[ --with-CXX=compiler use specific C++ compiler
|
||||||
@ -497,29 +498,25 @@ AC_ARG_WITH(CXX,
|
|||||||
[
|
[
|
||||||
case "$withval" in
|
case "$withval" in
|
||||||
"" | y | ye | yes)
|
"" | y | ye | yes)
|
||||||
AC_MSG_ERROR([*** You must supply an argument to the --with-CC option.])
|
HAVECXX='true'
|
||||||
|
# allow configure to choose C++ compiler
|
||||||
;;
|
;;
|
||||||
n | no)
|
n | no)
|
||||||
HAVECXX='false'
|
HAVECXX='false'
|
||||||
;;
|
;;
|
||||||
esac
|
*)
|
||||||
|
HAVECXX='true'
|
||||||
CXX="$withval"
|
CXX="$withval"
|
||||||
],
|
;;
|
||||||
[ AC_PROG_CXX])
|
esac
|
||||||
|
])
|
||||||
AC_SUBST(HAVECXX)
|
AC_SUBST(HAVECXX)
|
||||||
|
|
||||||
if test "$HAVECXX" = 'true' ; then
|
if test "$HAVECXX" = 'true' ; then
|
||||||
|
dnl Even if CXX value was given to us, need to run AC_PROG_CXX ...
|
||||||
|
AC_PROG_CXX
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CPLUSPLUS
|
||||||
|
|
||||||
dnl check whether "using namespace std" works on this C++ compiler
|
|
||||||
AC_MSG_CHECKING([for namespace std in C++])
|
|
||||||
AC_TRY_COMPILE([#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
using namespace std;
|
|
||||||
], [],
|
|
||||||
[AC_DEFINE(HAVE_NAMESPACE_STD) AC_MSG_RESULT(yes)],
|
|
||||||
[AC_MSG_RESULT(no)])
|
|
||||||
|
|
||||||
dnl check whether "#include <string>" works on this C++ compiler
|
dnl check whether "#include <string>" works on this C++ compiler
|
||||||
AC_MSG_CHECKING([for include <string> in C++])
|
AC_MSG_CHECKING([for include <string> in C++])
|
||||||
AC_TRY_COMPILE([#include <stdio.h>
|
AC_TRY_COMPILE([#include <stdio.h>
|
||||||
@ -547,7 +544,23 @@ system's C++ header files.
|
|||||||
HAVECXX='false'
|
HAVECXX='false'
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$HAVECXX" = 'true' ; then
|
||||||
|
dnl check whether "using namespace std" works on this C++ compiler.
|
||||||
|
dnl NOTE: on at least some compilers, it will not work until you've
|
||||||
|
dnl included a header that mentions namespace std. Thus, include
|
||||||
|
dnl the usual suspects before trying it.
|
||||||
|
AC_MSG_CHECKING([for namespace std in C++])
|
||||||
|
AC_TRY_COMPILE([#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#ifdef HAVE_CXX_STRING_HEADER
|
||||||
|
#include <string>
|
||||||
|
#endif
|
||||||
|
using namespace std;
|
||||||
|
], [],
|
||||||
|
[AC_DEFINE(HAVE_NAMESPACE_STD) AC_MSG_RESULT(yes)],
|
||||||
|
[AC_MSG_RESULT(no)])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl make sure we revert to C compiler, not C++, for subsequent tests
|
dnl make sure we revert to C compiler, not C++, for subsequent tests
|
||||||
|
Loading…
x
Reference in New Issue
Block a user