Require C++11 in configure

This commit is contained in:
Vadim Zeitlin 2022-10-07 02:41:30 +02:00
parent 327d65be92
commit 7aea15dda5
2 changed files with 42 additions and 891 deletions

639
configure vendored
View file

@ -2103,7 +2103,7 @@ Optional Features:
--enable-debug_cntxt obsolete, don't use: use wxDebugContext
--enable-mem_tracing obsolete, don't use: create code with memory tracing
--disable-shared create static library instead of shared
--enable-cxx11 use C++11 compiler if available
--enable-cxx11 obsolete option doing nothing
--enable-stl use standard C++ classes for everything
--enable-std_containers use standard C++ container classes
--enable-std_containers_compat use standard C++ container classes when it can be done compatible
@ -3084,60 +3084,6 @@ rm -f conftest.val
} # ac_fn_c_compute_int
# ac_fn_cxx_check_type LINENO TYPE VAR INCLUDES
# ---------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
# variable VAR accordingly.
ac_fn_cxx_check_type ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof ($2))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof (($2)))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
else
eval "$3=yes"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_cxx_check_type
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
@ -5743,7 +5689,7 @@ fi
# Check whether --enable-cxx11 was given.
if test "${enable_cxx11+set}" = set; then :
enableval=$enable_cxx11; wxWITH_CXX=11 wxWITH_CXX_IS_OPTIONAL=1
enableval=$enable_cxx11;
fi
@ -15589,14 +15535,9 @@ if test "$CXX" = "g++" -a "$GXX" != "yes"; then
as_fn_error $? "C++ compiler is needed to build wxWidgets" "$LINENO" 5
fi
if test "$wxUSE_MAC" = 1 -a -z "$wxWITH_CXX"; then
wxWITH_CXX=11
fi
if test -n "$wxWITH_CXX"; then
case "$wxWITH_CXX" in
11)
ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=false
case "${wxWITH_CXX-11}" in
11)
ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=true
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -16587,18 +16528,10 @@ $as_echo "#define HAVE_CXX11 1" >>confdefs.h
fi
if test -n "$wxWITH_CXX_IS_OPTIONAL"; then
if test "$HAVE_CXX11" != 1; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C++11 support was requested but is not available
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
;;
;;
14)
ax_cxx_compile_alternatives="14 1y" ax_cxx_compile_cxx14_required=true
14)
ax_cxx_compile_alternatives="14 1y" ax_cxx_compile_cxx14_required=true
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -17949,13 +17882,10 @@ $as_echo "#define HAVE_CXX14 1" >>confdefs.h
fi
;;
HAVE_CXX11=1
;;
17)
ax_cxx_compile_alternatives="17 1z" ax_cxx_compile_cxx17_required=true
17)
ax_cxx_compile_alternatives="17 1z" ax_cxx_compile_cxx17_required=true
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -20440,11 +20370,10 @@ $as_echo "#define HAVE_CXX17 1" >>confdefs.h
fi
HAVE_CXX11=1
;;
;;
20)
ax_cxx_compile_alternatives="20" ax_cxx_compile_cxx20_required=true
20)
ax_cxx_compile_alternatives="20" ax_cxx_compile_cxx20_required=true
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -23007,17 +22936,13 @@ $as_echo "#define HAVE_CXX20 1" >>confdefs.h
fi
HAVE_CXX11=1
;;
;;
*)
as_fn_error $? "Invalid --with-cxx=$wxWITH_CXX option value, only 11, 14, 17 or 20 supported" "$LINENO" 5
esac
*)
as_fn_error $? "Invalid --with-cxx=$wxWITH_CXX option value, only 11, 14, 17 or 20 supported" "$LINENO" 5
esac
if test "$HAVE_CXX11" = "1" ; then
OBJCXXFLAGS="$OBJCXXFLAGS $switch"
fi
fi
OBJCXXFLAGS="$OBJCXXFLAGS $switch"
case "$wxWITH_DPI_MANIFEST" in
none)
@ -24808,8 +24733,6 @@ if test "x$COMPAQCXX" = "xyes"; then
CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit"
fi
if test "$HAVE_CXX11" = "1" ; then
$as_echo "#define HAVE_STD_WSTRING 1" >>confdefs.h
$as_echo "#define HAVE_STD_STRING_COMPARE 1" >>confdefs.h
@ -24821,390 +24744,6 @@ $as_echo "#define HAVE_STD_UNORDERED_SET 1" >>confdefs.h
$as_echo "#define HAVE_TYPE_TRAITS 1" >>confdefs.h
else
ac_ext=cpp
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
if test "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes"; then
if test "$wxUSE_UNICODE" = "yes"; then
std_string="std::wstring"
char_type="wchar_t"
else
std_string="std::string"
char_type="char"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $std_string in <string>" >&5
$as_echo_n "checking for $std_string in <string>... " >&6; }
if ${wx_cv_class_stdstring+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string>
int
main ()
{
$std_string foo;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
wx_cv_class_stdstring=yes
else
wx_cv_class_stdstring=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_class_stdstring" >&5
$as_echo "$wx_cv_class_stdstring" >&6; }
if test "$wx_cv_class_stdstring" = yes; then
if test "$wxUSE_UNICODE" = "yes"; then
$as_echo "#define HAVE_STD_WSTRING 1" >>confdefs.h
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if std::basic_string<$char_type> works" >&5
$as_echo_n "checking if std::basic_string<$char_type> works... " >&6; }
if ${wx_cv_class_stdbasicstring+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef HAVE_WCHAR_H
# ifdef __CYGWIN__
# include <stddef.h>
# endif
# include <wchar.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <stdio.h>
#include <string>
int
main ()
{
std::basic_string<$char_type> foo;
const $char_type* dummy = foo.c_str();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
wx_cv_class_stdbasicstring=yes
else
wx_cv_class_stdbasicstring=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_class_stdbasicstring" >&5
$as_echo "$wx_cv_class_stdbasicstring" >&6; }
if test "$wx_cv_class_stdbasicstring" != yes; then
if test "$wxUSE_STL" = "yes"; then
as_fn_error $? "Can't use --enable-stl without $std_string or std::basic_string<$char_type>" "$LINENO" 5
elif test "$wxUSE_STD_STRING" = "yes"; then
as_fn_error $? "Can't use --enable-std_string without $std_string or std::basic_string<$char_type>" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No $std_string or std::basic_string<$char_type>, switching to --disable-std_string" >&5
$as_echo "$as_me: WARNING: No $std_string or std::basic_string<$char_type>, switching to --disable-std_string" >&2;}
wxUSE_STD_STRING=no
fi
fi
fi
fi
if test "$wxUSE_STD_IOSTREAM" = "yes"; then
ac_fn_cxx_check_type "$LINENO" "std::istream" "ac_cv_type_std__istream" "#include <iostream>
"
if test "x$ac_cv_type_std__istream" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STD__ISTREAM 1
_ACEOF
else
wxUSE_STD_IOSTREAM=no
fi
ac_fn_cxx_check_type "$LINENO" "std::ostream" "ac_cv_type_std__ostream" "#include <iostream>
"
if test "x$ac_cv_type_std__ostream" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STD__OSTREAM 1
_ACEOF
else
wxUSE_STD_IOSTREAM=no
fi
if test "$wxUSE_STD_IOSTREAM" != "yes"; then
if test "$wxUSE_STD_IOSTREAM" = "yes"; then
as_fn_error $? "Can't use --enable-std_iostreams without std::istream and std::ostream" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No std::iostreams, switching to --disable-std_iostreams" >&5
$as_echo "$as_me: WARNING: No std::iostreams, switching to --disable-std_iostreams" >&2;}
fi
fi
fi
if test "$wxUSE_STL" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compliant std::string::compare" >&5
$as_echo_n "checking for compliant std::string::compare... " >&6; }
if ${wx_cv_func_stdstring_compare+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string>
int
main ()
{
std::string foo, bar;
foo.compare(bar);
foo.compare(1, 1, bar);
foo.compare(1, 1, bar, 1, 1);
foo.compare("");
foo.compare(1, 1, "");
foo.compare(1, 1, "", 2);
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
wx_cv_func_stdstring_compare=yes
else
wx_cv_func_stdstring_compare=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_func_stdstring_compare" >&5
$as_echo "$wx_cv_func_stdstring_compare" >&6; }
if test "$wx_cv_func_stdstring_compare" = yes; then
$as_echo "#define HAVE_STD_STRING_COMPARE 1" >>confdefs.h
fi
if test "$wx_cv_class_gnuhashmapset" = yes; then
$as_echo "#define HAVE_EXT_HASH_MAP 1" >>confdefs.h
$as_echo "#define HAVE_GNU_CXX_HASH_MAP 1" >>confdefs.h
fi
ac_fn_cxx_check_header_compile "$LINENO" "unordered_map" "ac_cv_header_unordered_map" "
"
if test "x$ac_cv_header_unordered_map" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for unordered_map and unordered_set in std" >&5
$as_echo_n "checking for unordered_map and unordered_set in std... " >&6; }
if ${wx_cv_class_stdunorderedmapset+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unordered_map>
#include <unordered_set>
int
main ()
{
std::unordered_map<double*, char*> test1;
std::unordered_set<char*> test2;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
wx_cv_class_stdunorderedmapset=yes
else
wx_cv_class_stdunorderedmapset=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_class_stdunorderedmapset" >&5
$as_echo "$wx_cv_class_stdunorderedmapset" >&6; }
fi
if test "$wx_cv_class_stdunorderedmapset" = yes; then
$as_echo "#define HAVE_STD_UNORDERED_MAP 1" >>confdefs.h
$as_echo "#define HAVE_STD_UNORDERED_SET 1" >>confdefs.h
else
ac_fn_cxx_check_header_compile "$LINENO" "tr1/unordered_map" "ac_cv_header_tr1_unordered_map" "
"
if test "x$ac_cv_header_tr1_unordered_map" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for unordered_map and unordered_set in std::tr1" >&5
$as_echo_n "checking for unordered_map and unordered_set in std::tr1... " >&6; }
if ${wx_cv_class_tr1unorderedmapset+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <tr1/unordered_map>
#include <tr1/unordered_set>
int
main ()
{
std::tr1::unordered_map<double*, char*> test1;
std::tr1::unordered_set<char*> test2;
#if defined(__GNUC__) && (__GNUC__==4) && (__GNUC_MINOR__<2)
#error can't use unordered_{map,set} with gcc-4.[01]: http://gcc.gnu.org/PR24389
#endif
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
wx_cv_class_tr1unorderedmapset=yes
else
wx_cv_class_tr1unorderedmapset=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_class_tr1unorderedmapset" >&5
$as_echo "$wx_cv_class_tr1unorderedmapset" >&6; }
fi
if test "$wx_cv_class_tr1unorderedmapset" = yes; then
$as_echo "#define HAVE_TR1_UNORDERED_MAP 1" >>confdefs.h
$as_echo "#define HAVE_TR1_UNORDERED_SET 1" >>confdefs.h
else
ac_fn_cxx_check_header_compile "$LINENO" "hash_map" "ac_cv_header_hash_map" "
"
if test "x$ac_cv_header_hash_map" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::hash_map and hash_set" >&5
$as_echo_n "checking for std::hash_map and hash_set... " >&6; }
if ${wx_cv_class_stdhashmapset+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <hash_map>
#include <hash_set>
int
main ()
{
std::hash_map<double*, char*, std::hash<double*>, std::equal_to<double*> > test1;
std::hash_set<char*, std::hash<char*>, std::equal_to<char*> > test2;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
wx_cv_class_stdhashmapset=yes
else
wx_cv_class_stdhashmapset=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_class_stdhashmapset" >&5
$as_echo "$wx_cv_class_stdhashmapset" >&6; }
fi
if test "$wx_cv_class_stdhashmapset" = yes; then
$as_echo "#define HAVE_HASH_MAP 1" >>confdefs.h
$as_echo "#define HAVE_STD_HASH_MAP 1" >>confdefs.h
fi
ac_fn_cxx_check_header_compile "$LINENO" "ext/hash_map" "ac_cv_header_ext_hash_map" "
"
if test "x$ac_cv_header_ext_hash_map" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU hash_map and hash_set" >&5
$as_echo_n "checking for GNU hash_map and hash_set... " >&6; }
if ${wx_cv_class_gnuhashmapset+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ext/hash_map>
#include <ext/hash_set>
int
main ()
{
__gnu_cxx::hash_map<double*, char*, __gnu_cxx::hash<double*>, std::equal_to<double*> > test1;
__gnu_cxx::hash_set<char*, __gnu_cxx::hash<char*>, std::equal_to<char*> > test2;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
wx_cv_class_gnuhashmapset=yes
else
wx_cv_class_gnuhashmapset=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_class_gnuhashmapset" >&5
$as_echo "$wx_cv_class_gnuhashmapset" >&6; }
fi
fi
fi
fi
for ac_header in type_traits tr1/type_traits
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
break
fi
done
fi
if test -n "$GCC"; then
@ -25229,7 +24768,7 @@ main ()
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
if ac_fn_c_try_link "$LINENO"; then :
wx_cv_cc_gcc_atomic_builtins=yes
else
wx_cv_cc_gcc_atomic_builtins=no
@ -25248,13 +24787,6 @@ $as_echo "$wx_cv_cc_gcc_atomic_builtins" >&6; }
fi
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
SEARCH_INCLUDE="\
/usr/local/include \
@ -25588,137 +25120,6 @@ $as_echo "no" >&6; }
fi
fi
if test "$HAVE_CXX11" != "1" ; then
ac_ext=cpp
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
if test "wxUSE_UNICODE" = "yes"; then
for wx_func in wcstoull
do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $wx_func" >&5
$as_echo_n "checking for $wx_func... " >&6; }
if eval \${wx_cv_func_$wx_func+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
#ifndef $wx_func
&$wx_func;
#endif
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
eval wx_cv_func_$wx_func=yes
else
eval wx_cv_func_$wx_func=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$wx_cv_func_$wx_func
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \$wx_cv_func_$wx_func = yes
then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$wx_func" | $as_tr_cpp` 1
_ACEOF
else
:
fi
done
else
for wx_func in strtoull
do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $wx_func" >&5
$as_echo_n "checking for $wx_func... " >&6; }
if eval \${wx_cv_func_$wx_func+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
#ifndef $wx_func
&$wx_func;
#endif
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
eval wx_cv_func_$wx_func=yes
else
eval wx_cv_func_$wx_func=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$wx_cv_func_$wx_func
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \$wx_cv_func_$wx_func = yes
then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$wx_func" | $as_tr_cpp` 1
_ACEOF
else
:
fi
done
fi
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
fi
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then

View file

@ -666,7 +666,7 @@ dnl global compile options
dnl ---------------------------------------------------------------------------
WX_ARG_DISABLE(shared, [ --disable-shared create static library instead of shared], wxUSE_SHARED)
AC_ARG_ENABLE(cxx11, [ --enable-cxx11 use C++11 compiler if available], [wxWITH_CXX=11 wxWITH_CXX_IS_OPTIONAL=1])
AC_ARG_ENABLE(cxx11, [ --enable-cxx11 obsolete option doing nothing])
AC_ARG_WITH(cxx, [ --with-cxx=11|14|17|20 use the given C++ dialect], [wxWITH_CXX="$withval"])
WX_ARG_ENABLE(stl, [ --enable-stl use standard C++ classes for everything], wxUSE_STL)
if test "$wxUSE_STL" = "yes"; then
@ -1120,60 +1120,32 @@ if test "$CXX" = "g++" -a "$GXX" != "yes"; then
AC_MSG_ERROR([C++ compiler is needed to build wxWidgets])
fi
dnl Always use C++11 under macOS, there are no supported compilers not
dnl supporting it there, but don't prevent a latest version of C++ from being
dnl used.
if test "$wxUSE_MAC" = 1 -a -z "$wxWITH_CXX"; then
wxWITH_CXX=11
fi
dnl AX_CXX_COMPILE_STDCXX requires its VERSION argument to be specified at
dnl autoconf, not run, time.
case "${wxWITH_CXX-11}" in
11)
AX_CXX_COMPILE_STDCXX(11)
;;
if test -n "$wxWITH_CXX"; then
dnl AX_CXX_COMPILE_STDCXX requires its VERSION argument to be specified at
dnl autoconf, not run, time.
case "$wxWITH_CXX" in
11)
AX_CXX_COMPILE_STDCXX(11,,optional)
if test -n "$wxWITH_CXX_IS_OPTIONAL"; then
if test "$HAVE_CXX11" != 1; then
AC_MSG_FAILURE([C++11 support was requested but is not available])
fi
fi
;;
14)
AX_CXX_COMPILE_STDCXX(14)
;;
14)
dnl This check can't be optional because we have only --with-cxx=14
dnl and not --enable-cxx14 option.
AX_CXX_COMPILE_STDCXX(14)
17)
AX_CXX_COMPILE_STDCXX(17)
;;
dnl Notice that because it's not optional, the macro doesn't define
dnl HAVE_CXX14. We don't use it anyhow so far, so it doesn't
dnl matter, but we could need to do it ourselves here in the future.
20)
AX_CXX_COMPILE_STDCXX(20)
;;
dnl If we have C++14, we necessarily have C++11 too.
HAVE_CXX11=1
;;
*)
AC_MSG_ERROR([Invalid --with-cxx=$wxWITH_CXX option value, only 11, 14, 17 or 20 supported])
esac
17)
dnl This is similar to 14 above.
AX_CXX_COMPILE_STDCXX(17)
HAVE_CXX11=1
;;
20)
AX_CXX_COMPILE_STDCXX(20)
HAVE_CXX11=1
;;
*)
AC_MSG_ERROR([Invalid --with-cxx=$wxWITH_CXX option value, only 11, 14, 17 or 20 supported])
esac
if test "$HAVE_CXX11" = "1" ; then
dnl The standard macro above doesn't set Objective-C++ flags, but we do
dnl need them too.
OBJCXXFLAGS="$OBJCXXFLAGS $switch"
fi
fi
dnl The standard macro above doesn't set Objective-C++ flags, but we do
dnl need them too.
OBJCXXFLAGS="$OBJCXXFLAGS $switch"
case "$wxWITH_DPI_MANIFEST" in
none)
@ -1917,220 +1889,15 @@ if test "x$COMPAQCXX" = "xyes"; then
CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit"
fi
dnl The checks below are for ancient compilers and are unnecessary when using
dnl C++11, but we still need to define the symbols that would have been defined
dnl by them if we did run them.
if test "$HAVE_CXX11" = "1" ; then
AC_DEFINE(HAVE_STD_WSTRING)
AC_DEFINE(HAVE_STD_STRING_COMPARE)
AC_DEFINE(HAVE_STD_UNORDERED_MAP)
AC_DEFINE(HAVE_STD_UNORDERED_SET)
AC_DEFINE(HAVE_TYPE_TRAITS)
else dnl Not using C++11, so we do need to run the checks.
dnl the next few tests are all for C++ features and so need to be done using
dnl C++ compiler
AC_LANG_PUSH(C++)
dnl check for std::string or std::wstring
if test "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes"; then
if test "$wxUSE_UNICODE" = "yes"; then
std_string="std::wstring"
char_type="wchar_t"
else
std_string="std::string"
char_type="char"
fi
dnl check if <string> declares std::[w]string
AC_CACHE_CHECK([for $std_string in <string>],
wx_cv_class_stdstring,
[
AC_TRY_COMPILE([#include <string>],
[$std_string foo;],
wx_cv_class_stdstring=yes,
wx_cv_class_stdstring=no
)
]
)
if test "$wx_cv_class_stdstring" = yes; then
if test "$wxUSE_UNICODE" = "yes"; then
AC_DEFINE(HAVE_STD_WSTRING)
fi
dnl we don't need HAVE_STD_STRING, we just suppose it's available if
dnl wxUSE_STD_STRING==yes
else
AC_CACHE_CHECK([if std::basic_string<$char_type> works],
wx_cv_class_stdbasicstring,
[
AC_TRY_COMPILE([
#ifdef HAVE_WCHAR_H
# ifdef __CYGWIN__
# include <stddef.h>
# endif
# include <wchar.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <stdio.h>
#include <string>
],
[std::basic_string<$char_type> foo;
const $char_type* dummy = foo.c_str();],
wx_cv_class_stdbasicstring=yes,
wx_cv_class_stdbasicstring=no
)
]
)
if test "$wx_cv_class_stdbasicstring" != yes; then
if test "$wxUSE_STL" = "yes"; then
AC_MSG_ERROR([Can't use --enable-stl without $std_string or std::basic_string<$char_type>])
elif test "$wxUSE_STD_STRING" = "yes"; then
AC_MSG_ERROR([Can't use --enable-std_string without $std_string or std::basic_string<$char_type>])
else
AC_MSG_WARN([No $std_string or std::basic_string<$char_type>, switching to --disable-std_string])
wxUSE_STD_STRING=no
fi
fi
fi
fi
if test "$wxUSE_STD_IOSTREAM" = "yes"; then
AC_CHECK_TYPES([std::istream, std::ostream],,
[wxUSE_STD_IOSTREAM=no],
[#include <iostream>])
if test "$wxUSE_STD_IOSTREAM" != "yes"; then
if test "$wxUSE_STD_IOSTREAM" = "yes"; then
AC_MSG_ERROR([Can't use --enable-std_iostreams without std::istream and std::ostream])
else
AC_MSG_WARN([No std::iostreams, switching to --disable-std_iostreams])
fi
fi
fi
if test "$wxUSE_STL" = "yes"; then
dnl check for compliant std::string::compare
AC_CACHE_CHECK([for compliant std::string::compare],
wx_cv_func_stdstring_compare,
[AC_TRY_COMPILE([#include <string>],
[std::string foo, bar;
foo.compare(bar);
foo.compare(1, 1, bar);
foo.compare(1, 1, bar, 1, 1);
foo.compare("");
foo.compare(1, 1, "");
foo.compare(1, 1, "", 2);],
wx_cv_func_stdstring_compare=yes,
wx_cv_func_stdstring_compare=no
)]
)
if test "$wx_cv_func_stdstring_compare" = yes; then
AC_DEFINE(HAVE_STD_STRING_COMPARE)
fi
if test "$wx_cv_class_gnuhashmapset" = yes; then
AC_DEFINE(HAVE_EXT_HASH_MAP)
AC_DEFINE(HAVE_GNU_CXX_HASH_MAP)
fi
AC_CHECK_HEADER([unordered_map],
[AC_CACHE_CHECK([for unordered_map and unordered_set in std],
wx_cv_class_stdunorderedmapset,
[AC_TRY_COMPILE([#include <unordered_map>
#include <unordered_set>],
[std::unordered_map<double*, char*> test1;
std::unordered_set<char*> test2;],
wx_cv_class_stdunorderedmapset=yes,
wx_cv_class_stdunorderedmapset=no)
]
)],
[],
[ ]
)
if test "$wx_cv_class_stdunorderedmapset" = yes; then
AC_DEFINE(HAVE_STD_UNORDERED_MAP)
AC_DEFINE(HAVE_STD_UNORDERED_SET)
else
AC_CHECK_HEADER([tr1/unordered_map],
[AC_CACHE_CHECK([for unordered_map and unordered_set in std::tr1],
wx_cv_class_tr1unorderedmapset,
[AC_TRY_COMPILE([#include <tr1/unordered_map>
#include <tr1/unordered_set>],
[std::tr1::unordered_map<double*, char*> test1;
std::tr1::unordered_set<char*> test2;
#if defined(__GNUC__) && (__GNUC__==4) && (__GNUC_MINOR__<2)
#error can't use unordered_{map,set} with gcc-4.[01]: http://gcc.gnu.org/PR24389
#endif],
wx_cv_class_tr1unorderedmapset=yes,
wx_cv_class_tr1unorderedmapset=no)
]
)],
[],
[ ]
)
if test "$wx_cv_class_tr1unorderedmapset" = yes; then
AC_DEFINE(HAVE_TR1_UNORDERED_MAP)
AC_DEFINE(HAVE_TR1_UNORDERED_SET)
else
dnl check for hash_map and hash_set headers
AC_CHECK_HEADER([hash_map],
[AC_CACHE_CHECK([for std::hash_map and hash_set],
wx_cv_class_stdhashmapset,
[AC_TRY_COMPILE([#include <hash_map>
#include <hash_set>],
[std::hash_map<double*, char*, std::hash<double*>, std::equal_to<double*> > test1;
std::hash_set<char*, std::hash<char*>, std::equal_to<char*> > test2;],
wx_cv_class_stdhashmapset=yes,
wx_cv_class_stdhashmapset=no)
]
)],
[],
[ ]
)
if test "$wx_cv_class_stdhashmapset" = yes; then
AC_DEFINE(HAVE_HASH_MAP)
AC_DEFINE(HAVE_STD_HASH_MAP)
fi
AC_CHECK_HEADER([ext/hash_map],
[AC_CACHE_CHECK([for GNU hash_map and hash_set],
wx_cv_class_gnuhashmapset,
[AC_TRY_COMPILE([#include <ext/hash_map>
#include <ext/hash_set>],
[__gnu_cxx::hash_map<double*, char*, __gnu_cxx::hash<double*>, std::equal_to<double*> > test1;
__gnu_cxx::hash_set<char*, __gnu_cxx::hash<char*>, std::equal_to<char*> > test2;],
wx_cv_class_gnuhashmapset=yes,
wx_cv_class_gnuhashmapset=no)
]
)],
[],
[ ]
)
fi
fi
fi
AC_CHECK_HEADERS([type_traits tr1/type_traits], break, [], [AC_INCLUDES_DEFAULT()])
fi dnl End of pre-C++11 only checks section
dnl check for atomic operations builtins for wx/atomic.h:
WX_ATOMIC_BUILTINS
dnl pop C++
AC_LANG_POP()
dnl ---------------------------------------------------------------------------
dnl Define search path for includes and libraries: all headers and libs will be
dnl looked for in all directories of this path
@ -2362,23 +2129,6 @@ else
fi
fi
if test "$HAVE_CXX11" != "1" ; then
dnl check for C99 string to long long conversion functions, assume that if we
dnl have the unsigned variants, then we have the signed ones as well
dnl
dnl at least under SGI these functions are only available in C99 code and not
dnl in C++ so do these tests using C++ compiler
AC_LANG_PUSH(C++)
if test "wxUSE_UNICODE" = "yes"; then
WX_CHECK_FUNCS(wcstoull)
else
WX_CHECK_FUNCS(strtoull)
fi
AC_LANG_POP()
fi dnl End of pre-C++11 only checks section
dnl Find pkg-config outside of any conditional. Done before any PKG_* call.
PKG_PROG_PKG_CONFIG