--- linuxsampler/trunk/configure.ac 2019/08/23 11:44:00 3561 +++ linuxsampler/trunk/configure.ac 2021/01/05 20:42:32 3845 @@ -3,7 +3,7 @@ m4_define(linuxsampler_release_major, 2) m4_define(linuxsampler_release_minor, 1) -m4_define(linuxsampler_release_build, 1.svn4) +m4_define(linuxsampler_release_build, 1.svn68) AC_INIT([linuxsampler],[linuxsampler_release_major.linuxsampler_release_minor.linuxsampler_release_build]) @@ -64,11 +64,11 @@ AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes) -# make sure C++11 is supported by compiler -# (add CXXFLAGS if required [e.g. -std=c++11]) +# make sure C++14 is supported by compiler +# (add CXXFLAGS if required [e.g. -std=c++14]) m4_ifdef([m4_include(m4/ax_cxx_compile_stdcxx.m4)],, [sinclude([m4/ax_cxx_compile_stdcxx.m4])]) -AX_CXX_COMPILE_STDCXX(11, [], mandatory) +AX_CXX_COMPILE_STDCXX(14, [], mandatory) AC_MSG_CHECKING([whether x86 architecture]) def_arch_x86=0 @@ -195,6 +195,102 @@ fi +# check whether C++ compiler supports "designated initializers" +echo -n "Checking whether C++ compiler supports designated initializers (partly)... " +AC_LANG_PUSH([C++]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #include + struct Foo { + int a; + float b; + bool c; + char d; + }; + static void bar(Foo o) { + } + int main() { + bar({ + .a = 2, + .b = 4.3f, + .c = true, + .d = 'z' + }); + return 0; + } + ]])], + [cxx_designated_init_partly="yes"], + [cxx_designated_init_partly="no"] +) +AC_LANG_POP([C++]) +if test $cxx_designated_init_partly = "yes"; then + echo "yes" +else + echo "NO" + echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' + echo '! !' + echo '! ERROR: Selected C++ compiler does not support designated !' + echo '! initializers at all, not even partly! !' + echo '! !' + echo '! Please either update your C++ compiler or select a !' + echo '! different compiler (e.g. GCC >= 8 or clang >= 5). If you !' + echo '! have several C++ compilers installed on your machine, you !' + echo '! can easily select a different compiler by environment !' + echo '! variable, e.g. to compile with clang instead: !' + echo '! !' + echo '! CXX=clang++ CC=clang ./configure && make !' + echo '! !' + echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' + exit -1 +fi +echo -n "Checking whether C++ compiler fully supports designated initializers... " +AC_LANG_PUSH([C++]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #include + struct Foo { + int a; + float b; + bool c; + char d; + }; + static void bar(Foo o) { + } + int main() { + bar({ + .d = 'z', + .a = 2 + }); + return 0; + } + ]])], + [cxx_designated_init_fully="yes"], + [cxx_designated_init_fully="no"] +) +AC_LANG_POP([C++]) +if test $cxx_designated_init_fully = "yes"; then + echo "yes" +else + echo 'NO' + echo '***************************************************************' + echo '* *' + echo '* WARNING: Selected C++ compiler does not fully support *' + echo '* designated initializers (only partly)! *' + echo '* *' + echo '* You will be able to compile LinuxSampler, but you will not *' + echo '* be able to compile the test cases. Consider updating your *' + echo '* C++ compiler or switching to a different compiler. Chances *' + echo '* are that LinuxSampler will soon no longer support your *' + echo '* compiler. *' + echo '* *' + echo '* If you have several C++ compilers installed on your machine,*' + echo '* you can easily select a different compiler by environment *' + echo '* variable, e.g. to compile with clang instead: *' + echo '* *' + echo '* CXX=clang++ CC=clang ./configure && make *' + echo '* *' + echo '***************************************************************' +fi + + # In case Bison is available, determine the exact version, since we need to # use different custom parser code for Bison 2.x vs. Bison 3.x generated # parser yacc tables. @@ -764,16 +860,12 @@ AC_DEFINE_UNQUOTED(CONFIG_RT_EXCEPTIONS, 1, [Define to 1 to allow exceptions in the realtime context.]) fi -config_pthread_testcancel="$mac" -AC_ARG_ENABLE(pthread-testcancel, - [ --enable-pthread-testcancel - Enable pthread_testcancel() calls and avoid - asynchronous cancel of pthreads (default=yes - for Mac targets, no otherwise).], - [config_pthread_testcancel="$enableval"], - []) +AC_CHECK_FUNC(pthread_testcancel, + [config_pthread_testcancel="yes"], + [config_pthread_testcancel="no"] +) if test "$config_pthread_testcancel" = "yes"; then - AC_DEFINE_UNQUOTED(CONFIG_PTHREAD_TESTCANCEL, 1, [Define to 1 to enable pthread_testcancel() calls.]) + AC_DEFINE_UNQUOTED(CONFIG_PTHREAD_TESTCANCEL, 1, [Define to 1 if pthread_testcancel() is available.]) fi AC_ARG_ENABLE(preload-samples,