From 1d1af5eaf07ade785a3236a52ae0ce87eb6c9798 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Mon, 14 Mar 2005 04:47:28 +0000 Subject: [PATCH] Make wxCocoa compile on Tiger. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32810 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- acinclude.m4 | 12 +++++ aclocal.m4 | 12 +++++ configure | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 29 ++++++++++++ setup.h.in | 3 ++ 5 files changed, 186 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 3adc66c377..28ce34da20 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -78,6 +78,18 @@ XLCXX=`test $wx_compiler_xlc = yes && echo yes` AC_LANG_POP(C++) ]) +dnl =========================================================================== +dnl Objective-C(++) related macros +dnl =========================================================================== +m4_define([AC_WX_LANG_OBJECTIVEC], +[AC_LANG(C) +ac_ext=m +]) + +m4_define([AC_WX_LANG_OBJECTIVECPLUSPLUS], +[AC_LANG(C++) +ac_ext=mm +]) dnl =========================================================================== dnl macros to find the a file in the list of include/lib paths diff --git a/aclocal.m4 b/aclocal.m4 index 0440201c4c..e536a75bac 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -91,6 +91,18 @@ XLCXX=`test $wx_compiler_xlc = yes && echo yes` AC_LANG_POP(C++) ]) +dnl =========================================================================== +dnl Objective-C(++) related macros +dnl =========================================================================== +m4_define([AC_WX_LANG_OBJECTIVEC], +[AC_LANG(C) +ac_ext=m +]) + +m4_define([AC_WX_LANG_OBJECTIVECPLUSPLUS], +[AC_LANG(C++) +ac_ext=mm +]) dnl =========================================================================== dnl macros to find the a file in the list of include/lib paths diff --git a/configure b/configure index 8eb5cdc313..211ad6bf2a 100755 --- a/configure +++ b/configure @@ -29360,6 +29360,136 @@ WX_LIBRARY_BASENAME_GUI="wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_u +if test "$wxUSE_COCOA" = 1; then + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=m + + echo "$as_me:$LINENO: checking if AppKit/NSEvent.h conflicts with CoreFoundation" >&5 +echo $ECHO_N "checking if AppKit/NSEvent.h conflicts with CoreFoundation... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + echo "$as_me:$LINENO: checking if defining __Point__ will fix it" >&5 +echo $ECHO_N "checking if defining __Point__ will fix it... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define __Point__ 1 +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<\_ACEOF +#define __Point__ 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: no +See \`config.log' for more details." >&5 +echo "$as_me: error: no +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi + if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1; then WX_RESOURCES_MACOSX_ASCII="libwx_${TOOLCHAIN_NAME}.${wx_release_number}.r" WX_RESOURCES_MACOSX_DATA="libwx_${TOOLCHAIN_NAME}.${wx_release_number}.rsrc" diff --git a/configure.in b/configure.in index b558b707ab..d959323263 100644 --- a/configure.in +++ b/configure.in @@ -3520,6 +3520,35 @@ WX_LIBRARY_BASENAME_GUI="wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_u +if test "$wxUSE_COCOA" = 1; then + AC_LANG_SAVE + AC_WX_LANG_OBJECTIVEC +dnl Recent AppKit/NSEvent.h include parts of IOKit which eventually +dnl gets IOKit/graphics/IOGraphicsTypes.h included which typedefs +dnl Point but only if MacTypes.h was not included first. Of course, +dnl if MacTypes.h is included later then you're screwed when it +dnl tries to typedef Point. Defining __Point__ will cause IOGraphicsTypes.h +dnl to not typedef Point and thus fix the problem. + AC_MSG_CHECKING([if AppKit/NSEvent.h conflicts with CoreFoundation]) + AC_TRY_COMPILE([#include +#include + ],[], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([yes]) + AC_MSG_CHECKING([if defining __Point__ will fix it]) + AC_TRY_COMPILE([#define __Point__ 1 +#include +#include + ],[], + [AC_MSG_RESULT([yes]) + AC_DEFINE(__Point__) + ], + [AC_MSG_FAILURE([no])] + )] + ) + AC_LANG_RESTORE +fi + if test "$wxUSE_MAC" = 1 -o "$wxUSE_COCOA" = 1; then dnl base name of the resource file for wxMac must be the same dnl as library installation base name (-install_name) diff --git a/setup.h.in b/setup.h.in index 377dc3c141..f6be1dddf3 100644 --- a/setup.h.in +++ b/setup.h.in @@ -110,6 +110,9 @@ #undef __POWERPC__ #undef TARGET_CARBON +/* Hack to make IOGraphicsTypes.h not define Point conflicting with MacTypes */ +#undef __Point__ + /* MS-DOS with DJGPP */ #undef __DOS__ -- 2.45.2