diff options
-rw-r--r-- | erts/configure.in | 16 | ||||
-rw-r--r-- | lib/wx/c_src/Makefile.in | 7 | ||||
-rwxr-xr-x | lib/wx/configure.in | 78 |
3 files changed, 97 insertions, 4 deletions
diff --git a/erts/configure.in b/erts/configure.in index fafa1c7e92..4f0c6efc3e 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -490,7 +490,19 @@ CFLAG_RUNTIME_LIBRARY_PATH="-Wl,-R" case $host_os in darwin*) CFLAG_RUNTIME_LIBRARY_PATH= - CFLAGS="$CFLAGS -no-cpp-precomp" + 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="$CFLAGS -no-cpp-precomp" + fi ;; win32) CFLAG_RUNTIME_LIBRARY_PATH= @@ -1000,7 +1012,7 @@ case $ERTS_BUILD_SMP_EMU in ], gcc_smp=okgcc, gcc_smp=oldornogcc) - ERTS_BUILD_SMP_EMU=yes +Ω ERTS_BUILD_SMP_EMU=yes case "$enable_threads-$gcc_smp-$found_threads-$host_os" in no-*) diff --git a/lib/wx/c_src/Makefile.in b/lib/wx/c_src/Makefile.in index 69418f62ef..ae5a149d14 100644 --- a/lib/wx/c_src/Makefile.in +++ b/lib/wx/c_src/Makefile.in @@ -31,6 +31,8 @@ override TYPE=opt endif SO_EXT = @SO_EXT@ +OBJC_CC=@OBJC_CC@ +OBJC_CFLAGS=@OBJC_CFLAGS@ GENERAL = wxe_driver wxe_ps_init wxe_impl wxePrintout wxe_return wxe_gl GENERAL_H = wxe_driver.h wxe_impl.h wxe_return.h @@ -116,6 +118,7 @@ endif GL_LIBS = @GL_LIBS@ CC_O = $(CC) -c $(CFLAGS) $(WX_CFLAGS) $(COMMON_CFLAGS) +OBJC_CC_O = $(OBJC_CC) -c $(CFLAGS) $(OBJC_CFLAGS) $(WX_CFLAGS) $(COMMON_CFLAGS) CPP_O = $(CPP) -c $(CXX_FLAGS) $(WX_CXX_FLAGS) $(COMMON_CFLAGS) # Targets @@ -152,6 +155,10 @@ $(SYS_TYPE)/%.o: %.c mkdir -p $(SYS_TYPE) $(CC_O) $< -o $@ +$(SYS_TYPE)/wxe_ps_init.o: wxe_ps_init.c + mkdir -p $(SYS_TYPE) + $(OBJC_CC_O) $< -o $@ + $(SYS_TYPE)/%.o: gen/%.cpp mkdir -p $(SYS_TYPE) $(CPP_O) $< -o $@ 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) |