From: Stefan Neis Date: Sat, 11 Nov 2006 17:19:59 +0000 (+0000) Subject: Need to check for getsockopt argument in C++ mode. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e43101ee40b01bee35dd92c6bb61274675ee5ce8 Need to check for getsockopt argument in C++ mode. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43312 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/configure b/configure index e1486e6ffb..2bef6d2a7d 100755 --- a/configure +++ b/configure @@ -44674,10 +44674,11 @@ else sed 's/^/| /' conftest.$ac_ext >&5 - CFLAGS_OLD="$CFLAGS" - if test "$GCC" = yes ; then - CFLAGS="-Werror $CFLAGS" - fi + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -44709,7 +44710,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -44756,7 +44757,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -44780,8 +44781,12 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - CFLAGS="$CFLAGS_OLD" fi diff --git a/configure.in b/configure.in index cea9dafdb0..c54e99f61a 100644 --- a/configure.in +++ b/configure.in @@ -6256,17 +6256,12 @@ if test "$wxUSE_SOCKETS" = "yes" ; then ], wx_cv_type_getsockopt5=socklen_t, [ - dnl the compiler will compile the version with size_t - dnl even if the real type of the last parameter is int - dnl but it should give at least a warning about - dnl converting between incompatible pointer types, so - dnl try to use it to get the correct behaviour at - dnl least with gcc (otherwise we'd always use size_t) - CFLAGS_OLD="$CFLAGS" - if test "$GCC" = yes ; then - CFLAGS="-Werror $CFLAGS" - fi - + dnl Note that the rules for compatibility of pointers + dnl are somewhat different between C and C++, so code + dnl that fails in C++ may not even give a warning about + dnl converting between incompatible pointer types in C. + dnl So this test needs to be done in C++ mode. + AC_LANG_PUSH(C++) AC_TRY_COMPILE( [ #include @@ -6290,8 +6285,7 @@ if test "$wxUSE_SOCKETS" = "yes" ; then wx_cv_type_getsockopt5=unknown ) ) - - CFLAGS="$CFLAGS_OLD" + AC_LANG_POP() ] ) ])