X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/126be6b469200df524f7c84d3719265a0ac68f41..a81c3c2383f9096ef5e96b708a0f1c1ffe7cc6a8:/configure.in diff --git a/configure.in b/configure.in index edafe448f3..17cb392540 100644 --- a/configure.in +++ b/configure.in @@ -1170,6 +1170,11 @@ dnl defines CC with the compiler to use dnl defines GCC with yes if using gcc dnl defines GCC empty if not using gcc dnl defines CFLAGS +dnl +dnl this magic incantation is needed to prevent AC_PROG_CC from setting the +dnl default CFLAGS (something like "-g -O2") - we don't need this as add +dnl -g and -O flags ourselves below +CFLAGS=${CFLAGS:=} AC_PROG_CC dnl is -traditional needed for correct compilations @@ -1184,6 +1189,9 @@ dnl defines CXX with the compiler to use dnl defines GXX with yes if using gxx dnl defines GXX empty if not using gxx dnl defines CXXFLAGS +dnl +dnl see CFLAGS line above +CXXFLAGS=${CXXFLAGS:=} AC_PROG_CXX AC_LANG_RESTORE @@ -3181,7 +3189,7 @@ if test "$TOOLKIT" != "MSW"; then dnl simply linking with libpthread should make the test below work but dnl it's far from certain that the threaded programs compiled without dnl any special switches actually work, so try it after all the others - THREAD_OPTS="$THREAD_OPTS -lpthread none" + THREAD_OPTS="$THREAD_OPTS pthread none" dnl now test for all possibilities THREADS_OK=no @@ -3205,7 +3213,7 @@ if test "$TOOLKIT" != "MSW"; then save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$THREADS_LINK $LIBS" - CFLAGS="$CFLAGS $THREADS_CFLAGS" + CFLAGS="$THREADS_CFLAGS $CFLAGS" AC_TRY_LINK([#include ], [pthread_create(0,0,0,0);], @@ -3227,6 +3235,10 @@ if test "$TOOLKIT" != "MSW"; then wxUSE_THREADS=no AC_MSG_WARN([No thread support on this system... disabled]) else + dnl yes, these special compiler flags should be used with the + dnl linker as well + LIBS="$THREADS_LINK $THREADS_CFLAGS $LIBS" + AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host}" in @@ -3239,14 +3251,11 @@ if test "$TOOLKIT" != "MSW"; then esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then - THREADS_CFLAGS="$flag $THREADS_CFLAGS" - fi - - if test "x$THREADS_LINK" != "x"; then - LIBS="$THREADS_LINK $LIBS" + THREADS_CFLAGS="$THREADS_CFLAGS $flag" fi if test "x$THREADS_CFLAGS" != "x"; then + dnl don't add these options to CPPFLAGS as cpp might not know them CFLAGS="$CFLAGS $THREADS_CFLAGS" CXXFLAGS="$CXXFLAGS $THREADS_CFLAGS" fi @@ -3382,9 +3391,6 @@ fi if test "$wxUSE_THREADS" = "yes"; then AC_DEFINE(wxUSE_THREADS) - dnl we must define _REENTRANT or something along these lines for MT code - TOOLCHAIN_DEFS="$TOOLCHAIN_DEFS $THREADS_CFLAGS" - SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread" else dnl on some systems, _REENTRANT should be defined if we want to use any _r() @@ -3470,9 +3476,6 @@ if test "$GCC" = "yes" ; then fi fi - -CXXFLAGS=`echo "${CXXFLAGS}" | sed "s/\-O.//g" ` -CFLAGS=`echo "${CFLAGS}" | sed "s/\-O.//g" ` if test "$wxUSE_OPTIMISE" = "no" ; then OPTIMISE= else @@ -4784,10 +4787,12 @@ fi EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE $INCLUDES" +dnl remove the extra white space from the cc/c++/ld options CFLAGS=`echo $CFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \\+/ /g'` CXXFLAGS=`echo $CXXFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \+/ /g'` +LIBS=`echo $LIBS | sed 's/ \+/ /g'` -LDFLAGS="$LDFLAGS$PROFILE" +LDFLAGS="$LDFLAGS $PROFILE" dnl for convenience, sort the samples in alphabetical order dnl