diff options
Diffstat (limited to 'lib/wx/configure.in')
-rwxr-xr-x | lib/wx/configure.in | 78 |
1 files changed, 76 insertions, 2 deletions
diff --git a/lib/wx/configure.in b/lib/wx/configure.in index f7128db23a..78c3f0d3d2 100755 --- a/lib/wx/configure.in +++ b/lib/wx/configure.in @@ -138,10 +138,65 @@ esac PTHR_CFLAGS="-D_THREAD_SAFE -D_REENTRANT" +OBJC_CC=$CC +OBJC_CFLAGS="" + dnl NOTE: CPPFLAGS will be included in CFLAGS at the end case $host_os in darwin*) - C_ONLY_FLAGS="-ObjC" + AC_MSG_CHECKING([if compiler accepts -ObjC]) + saved_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -ObjC" + AC_TRY_COMPILE([],[;], accept_objc_flag=true, accept_objc_flag=false) + if test "X$accept_objc_flag" = "Xtrue"; then + AC_MSG_RESULT([yes]) + C_ONLY_FLAGS="-ObjC" + else + dnl We are probebly trying to build with a non-Apple gcc, + dnl which is good as long as we do not try to build Cocoa + dnl code. We need an Apple compiler for just that (Objective C) + AC_MSG_RESULT([no]) + AC_MSG_CHECKING([for a Cocoa compliant Objective C compiler]) + SEARCHFOR="" + save_IFS=$IFS + IFS=: + set $PATH + IFS=$save_IFS + while test X"$1" != X""; do + dnl Add all possible paths to a real apple gcc + SEARCHFOR="$1/gcc-apple-4.2 $SEARCHFOR" + shift + done + dnl Add LLVM compilers, they will work in this case + SEARCHFOR="/usr/bin/clang /usr/bin/gcc $SEARCHFOR" + APPLE_CC="" + dnl SEARCHFOR is reversed, so we want to find the last existing + dnl executable in the list + for x in $SEARCHFOR; do + if test -x $x; then + APPLE_CC=$x + fi + done + if test X$APPLE_CC = X; then + AC_MSG_RESULT([no]) + dnl Complete failure, we cannot build Cocoa code + if test X"$WX_BUILDING_INSIDE_ERLSRC" != X"true" ; then + AC_MSG_ERROR([Can not find compiler to compile Cocoa applications]) + else + echo "Can not find compiler to compile Cocoa applications" > ./CONF_INFO + WXERL_CAN_BUILD_DRIVER=false + AC_MSG_WARN([Can not find compiler to compile Cocoa applications]) + fi + WXERL_CAN_BUILD_DRIVER=false + else + dnl We think we found an Apple compiler and will add + dnl Apple specific options + AC_MSG_RESULT($APPLE_CC) + OBJC_CC=$APPLE_CC + OBJC_CFLAGS="-ObjC" + fi + fi + CFLAGS=$saved_CFLAGS CPPFLAGS="$CPPFLAGS -D_MACOSX $PTHR_CFLAGS" ;; mingw32) @@ -159,10 +214,29 @@ case $host_os in ;; esac +AC_SUBST(OBJC_CC) +AC_SUBST(OBJC_CFLAGS) + case $host_os in darwin*) - CFLAGS="-no-cpp-precomp $CFLAGS" + AC_TRY_COMPILE([],[ + #if __GNUC__ >= 4 + ; + #else + #error old or no gcc + #endif + ], + gcc_need_no_cpp_precomp=no, + gcc_need_no_cpp_precomp=yes) + + if test x$gcc_need_no_cpp_precomp = xyes; then + CFLAGS="-no-cpp-precomp $CFLAGS" + fi LDFLAGS="-bundle -flat_namespace -undefined warning -fPIC $LDFLAGS" + # Check sizof_void_p as future will hold 64bit MacOS wx + if test $ac_cv_sizeof_void_p = 4; then + LDFLAGS="-m32 $LDFLAGS" + fi GL_LIBS="-framework OpenGL" ;; win32) |