Mercurial > hg > tony
comparison configure @ 400:4b9b7ff3f19c cxx11-types
c++11 flag in qmake project
author | Chris Cannam |
---|---|
date | Wed, 11 Mar 2015 12:20:06 +0000 |
parents | ffd1a89a68fa |
children | a0eedd10dee3 |
comparison
equal
deleted
inserted
replaced
399:ffd1a89a68fa | 400:4b9b7ff3f19c |
---|---|
679 PKG_CONFIG_PATH | 679 PKG_CONFIG_PATH |
680 PKG_CONFIG | 680 PKG_CONFIG |
681 EGREP | 681 EGREP |
682 GREP | 682 GREP |
683 CXXCPP | 683 CXXCPP |
684 HAVE_CXX11 | |
684 MKDIR_P | 685 MKDIR_P |
685 INSTALL_DATA | 686 INSTALL_DATA |
686 INSTALL_SCRIPT | 687 INSTALL_SCRIPT |
687 INSTALL_PROGRAM | 688 INSTALL_PROGRAM |
688 ac_ct_CXX | 689 ac_ct_CXX |
3467 fi | 3468 fi |
3468 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 | 3469 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 |
3469 $as_echo "$MKDIR_P" >&6; } | 3470 $as_echo "$MKDIR_P" >&6; } |
3470 | 3471 |
3471 | 3472 |
3473 # We are daringly making use of C++11 now | |
3474 | |
3475 ax_cxx_compile_cxx11_required=true | |
3476 ac_ext=cpp | |
3477 ac_cpp='$CXXCPP $CPPFLAGS' | |
3478 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' | |
3479 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | |
3480 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu | |
3481 ac_success=no | |
3482 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 | |
3483 $as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; } | |
3484 if ${ax_cv_cxx_compile_cxx11+:} false; then : | |
3485 $as_echo_n "(cached) " >&6 | |
3486 else | |
3487 cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3488 /* end confdefs.h. */ | |
3489 | |
3490 template <typename T> | |
3491 struct check | |
3492 { | |
3493 static_assert(sizeof(int) <= sizeof(T), "not big enough"); | |
3494 }; | |
3495 | |
3496 struct Base { | |
3497 virtual void f() {} | |
3498 }; | |
3499 struct Child : public Base { | |
3500 virtual void f() override {} | |
3501 }; | |
3502 | |
3503 typedef check<check<bool>> right_angle_brackets; | |
3504 | |
3505 int a; | |
3506 decltype(a) b; | |
3507 | |
3508 typedef check<int> check_type; | |
3509 check_type c; | |
3510 check_type&& cr = static_cast<check_type&&>(c); | |
3511 | |
3512 auto d = a; | |
3513 auto l = [](){}; | |
3514 | |
3515 _ACEOF | |
3516 if ac_fn_cxx_try_compile "$LINENO"; then : | |
3517 ax_cv_cxx_compile_cxx11=yes | |
3518 else | |
3519 ax_cv_cxx_compile_cxx11=no | |
3520 fi | |
3521 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
3522 fi | |
3523 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 | |
3524 $as_echo "$ax_cv_cxx_compile_cxx11" >&6; } | |
3525 if test x$ax_cv_cxx_compile_cxx11 = xyes; then | |
3526 ac_success=yes | |
3527 fi | |
3528 | |
3529 | |
3530 | |
3531 if test x$ac_success = xno; then | |
3532 for switch in -std=c++11 -std=c++0x; do | |
3533 cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` | |
3534 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 | |
3535 $as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } | |
3536 if eval \${$cachevar+:} false; then : | |
3537 $as_echo_n "(cached) " >&6 | |
3538 else | |
3539 ac_save_CXXFLAGS="$CXXFLAGS" | |
3540 CXXFLAGS="$CXXFLAGS $switch" | |
3541 cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3542 /* end confdefs.h. */ | |
3543 | |
3544 template <typename T> | |
3545 struct check | |
3546 { | |
3547 static_assert(sizeof(int) <= sizeof(T), "not big enough"); | |
3548 }; | |
3549 | |
3550 struct Base { | |
3551 virtual void f() {} | |
3552 }; | |
3553 struct Child : public Base { | |
3554 virtual void f() override {} | |
3555 }; | |
3556 | |
3557 typedef check<check<bool>> right_angle_brackets; | |
3558 | |
3559 int a; | |
3560 decltype(a) b; | |
3561 | |
3562 typedef check<int> check_type; | |
3563 check_type c; | |
3564 check_type&& cr = static_cast<check_type&&>(c); | |
3565 | |
3566 auto d = a; | |
3567 auto l = [](){}; | |
3568 | |
3569 _ACEOF | |
3570 if ac_fn_cxx_try_compile "$LINENO"; then : | |
3571 eval $cachevar=yes | |
3572 else | |
3573 eval $cachevar=no | |
3574 fi | |
3575 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
3576 CXXFLAGS="$ac_save_CXXFLAGS" | |
3577 fi | |
3578 eval ac_res=\$$cachevar | |
3579 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | |
3580 $as_echo "$ac_res" >&6; } | |
3581 if eval test x\$$cachevar = xyes; then | |
3582 CXXFLAGS="$CXXFLAGS $switch" | |
3583 ac_success=yes | |
3584 break | |
3585 fi | |
3586 done | |
3587 fi | |
3588 ac_ext=cpp | |
3589 ac_cpp='$CXXCPP $CPPFLAGS' | |
3590 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' | |
3591 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | |
3592 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu | |
3593 | |
3594 if test x$ax_cxx_compile_cxx11_required = xtrue; then | |
3595 if test x$ac_success = xno; then | |
3596 as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 | |
3597 fi | |
3598 else | |
3599 if test x$ac_success = xno; then | |
3600 HAVE_CXX11=0 | |
3601 { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 | |
3602 $as_echo "$as_me: No compiler with C++11 support was found" >&6;} | |
3603 else | |
3604 HAVE_CXX11=1 | |
3605 | |
3606 $as_echo "#define HAVE_CXX11 1" >>confdefs.h | |
3607 | |
3608 fi | |
3609 | |
3610 | |
3611 fi | |
3612 | |
3472 | 3613 |
3473 ac_ext=cpp | 3614 ac_ext=cpp |
3474 ac_cpp='$CXXCPP $CPPFLAGS' | 3615 ac_cpp='$CXXCPP $CPPFLAGS' |
3475 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' | 3616 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' |
3476 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | 3617 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' |
4220 CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS" | 4361 CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS" |
4221 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS" | 4362 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS" |
4222 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" | 4363 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" |
4223 | 4364 |
4224 if test "x$GCC" = "xyes"; then | 4365 if test "x$GCC" = "xyes"; then |
4225 CXXFLAGS_ANY="-std=c++11 -Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" | 4366 CXXFLAGS_ANY="-Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" |
4226 CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g" | 4367 CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g" |
4227 CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O2" | 4368 CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O2" |
4228 CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" | 4369 CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" |
4229 fi | 4370 fi |
4230 | 4371 |