From 7c2f4f31df0eec816d6bb17aa6df2e7f3c6da03e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 02/23] Fix LDFLAGS test for C++ The test looks to link to particular function, so we need to make that function have C linkage. --- config/c-compiler.m4 | 9 ++++++++- configure | 27 ++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 7d901e1f1a..21fb4645c4 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -353,7 +353,14 @@ AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT], AC_CACHE_CHECK([whether $CC supports $1], [Ac_cachevar], [pgac_save_LDFLAGS=$LDFLAGS LDFLAGS="$pgac_save_LDFLAGS $1" -AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () = $2;],[])], +AC_RUN_IFELSE([AC_LANG_PROGRAM([#ifdef __cplusplus +extern "C" { +#endif +extern void $2 (); +#ifdef __cplusplus +} +#endif +void (*fptr) () = $2;],[])], [Ac_cachevar=yes], [Ac_cachevar=no], [Ac_cachevar="assuming no"]) diff --git a/configure b/configure index b5cdebb510..b1ad1ce838 100755 --- a/configure +++ b/configure @@ -16025,7 +16025,14 @@ if test "$cross_compiling" = yes; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void $link_test_func (); void (*fptr) () = $link_test_func; +#ifdef __cplusplus +extern "C" { +#endif +extern void $link_test_func (); +#ifdef __cplusplus +} +#endif +void (*fptr) () = $link_test_func; int main () { @@ -16064,7 +16071,14 @@ if test "$cross_compiling" = yes; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void $link_test_func (); void (*fptr) () = $link_test_func; +#ifdef __cplusplus +extern "C" { +#endif +extern void $link_test_func (); +#ifdef __cplusplus +} +#endif +void (*fptr) () = $link_test_func; int main () { @@ -16103,7 +16117,14 @@ if test "$cross_compiling" = yes; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void $link_test_func (); void (*fptr) () = $link_test_func; +#ifdef __cplusplus +extern "C" { +#endif +extern void $link_test_func (); +#ifdef __cplusplus +} +#endif +void (*fptr) () = $link_test_func; int main () { -- 2.12.0