Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a1ed44

Browse files
committed
Add configure checks to see if 'using namespace std' and
'#include <string>' work in the local C++ compiler.
1 parenta1916da commit0a1ed44

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

‎src/Makefile.global.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.67 2000/03/08 01:58:15 momjian Exp $
10+
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.68 2000/03/30 05:29:20 tgl Exp $
1111
#
1212
# NOTES
1313
# Essentially all Postgres make files include this file and use the
@@ -105,7 +105,7 @@ ODBCINST= $(POSTGRESDIR)
105105
# (that is, prepend '#', don't set it to "0" or "no").
106106

107107
# Compile libpq++
108-
@HAVECXX@
108+
HAVE_Cplusplus=@HAVECXX@
109109

110110
# Comment out ENFORCE_ALIGNMENT if you do NOT want unaligned access to
111111
# multi-byte types to generate a bus error.

‎src/configure.in

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ AC_SUBST(USE_ODBC)
488488
AC_SUBST(MULTIBYTE)
489489

490490
dnl Check for C++ support (allow override if needed)
491-
HAVECXX='HAVE_Cplusplus=true'
491+
HAVECXX='true'
492492
AC_ARG_WITH(CXX,
493493
[ --with-CXX=compiler use specific C++ compiler
494494
--without-CXX prevent building C++ code ],
@@ -498,14 +498,37 @@ AC_ARG_WITH(CXX,
498498
AC_MSG_ERROR([*** You must supply an argument to the --with-CC option.])
499499
;;
500500
n | no)
501-
HAVECXX='HAVE_Cplusplus=false'
501+
HAVECXX='false'
502502
;;
503503
esac
504504
CXX="$withval"
505505
],
506506
[ AC_PROG_CXX])
507507
AC_SUBST(HAVECXX)
508508

509+
if test "$HAVECXX" = 'true' ; then
510+
AC_LANG_CPLUSPLUS
511+
512+
dnl check whether "using namespace std" works on this C++ compiler
513+
AC_MSG_CHECKING([for namespace std in C++])
514+
AC_TRY_COMPILE([#include <stdio.h>
515+
#include <stdlib.h>
516+
using namespace std;
517+
], [],
518+
[AC_DEFINE(HAVE_NAMESPACE_STD) AC_MSG_RESULT(yes)],
519+
[AC_MSG_RESULT(no)])
520+
521+
dnl check whether "#include <string>" works on this C++ compiler
522+
AC_MSG_CHECKING([for include <string> in C++])
523+
AC_TRY_COMPILE([#include <stdio.h>
524+
#include <stdlib.h>
525+
#include <string>
526+
], [],
527+
[AC_DEFINE(HAVE_CXX_STRING_HEADER) AC_MSG_RESULT(yes)],
528+
[AC_MSG_RESULT(no)])
529+
530+
fi
531+
509532
dnl make sure we revert to C compiler, not C++, for subsequent tests
510533
AC_LANG_C
511534

‎src/include/config.h.in

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in config.h afterwards. Of course, if you edit config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: config.h.in,v 1.110 2000/03/17 05:29:06 tgl Exp $
11+
* $Id: config.h.in,v 1.111 2000/03/30 05:29:21 tgl Exp $
1212
*/
1313

1414
#ifndefCONFIG_H
@@ -529,6 +529,13 @@ extern void srandom(unsigned int seed);
529529
/* Define if POSIX signal interface is available */
530530
#undef USE_POSIX_SIGNALS
531531

532+
/* Define if C++ compiler accepts "using namespace std" */
533+
#undef HAVE_NAMESPACE_STD
534+
535+
/* Define if C++ compiler accepts "#include <string>" */
536+
#undef HAVE_CXX_STRING_HEADER
537+
538+
532539
/*
533540
* Pull in OS-specific declarations (using link created by configure)
534541
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp