|
From: Martin R. <ru...@us...> - 2004-08-02 06:39:28
|
Update of /cvsroot/foo/foo/libfoo/m4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10086 Modified Files: Makefile.am Added Files: objc-runtime.m4 Log Message: added m4 macro for ObjC runtime lib detection Index: Makefile.am =================================================================== RCS file: /cvsroot/foo/foo/libfoo/m4/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.am 2 Aug 2004 02:20:33 -0000 1.3 --- Makefile.am 2 Aug 2004 06:39:20 -0000 1.4 *************** *** 8,10 **** --- 8,11 ---- EXTRA_DIST = \ objc.m4 \ + objc-runtime.m4 \ $(NULL) --- NEW FILE: objc-runtime.m4 --- #------------------------------------------------------------------------ # OD_OBJC_RUNTIME -- # # Determine the default, working Objective C runtime # # Arguments: # None. # # Requires: # none # # Depends: # AC_PROG_OBJC from objc.m4 # # Results: # # Adds a --with-objc-runtime switch to configure. # Result is cached. # # Defines one of the following preprocessor macros: # NeXT_RUNTIME GNU_RUNTIME #------------------------------------------------------------------------ AC_DEFUN([OD_OBJC_RUNTIME],[ AC_REQUIRE([AC_PROG_OBJC]) AC_ARG_WITH(objc-runtime, [ --with-objc-runtime Specify either "GNU" or "NeXT"], [with_objc_runtime=${withval}]) if test x"${with_objc_runtime}" != x; then case "${with_objc_runtime}" in GNU) ;; NeXT) ;; *) AC_MSG_ERROR([${with_objc_runtime} is not a valid argument to --with-objc-runtime. Please specify either "GNU" or "NeXT"]) ;; esac fi AC_LANG_PUSH([Objective C]) # Check for common header, objc/objc.h AC_CHECK_HEADERS([objc/objc.h], ,[AC_MSG_ERROR([Can't locate Objective C runtime headers])]) # Add -lobjc. The following tests will ensure that the library exists and functions with the detected Objective C compiler # If the tests fail, AC_MSG_FAILURE is called, and $LIBS does not need to be restored LIBS="${LIBS} -lobjc" if test x"${with_objc_runtime}" == x || test x"${with_objc_runtime}" == x"NeXT"; then AC_MSG_CHECKING([for NeXT Objective C runtime]) AC_CACHE_VAL(ac_cv_objc_runtime_next, [ # The following uses quadrigraphs # '@<:@' = '[' # '@:>@' = ']' AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #include <objc/objc.h> #include <objc/objc-api.h> ], [ id class = objc_lookUpClass("Object"); id obj = @<:@class alloc@:>@; puts(@<:@obj name@:>@); ]) ], [ ac_cv_objc_runtime_next="yes" ], [ ac_cv_objc_runtime_next="no" ] ) ]) AC_MSG_RESULT(${ac_cv_objc_runtime_next}) else ac_cv_objc_runtime_next="no" fi if test x"${with_objc_runtime}" == x || test x"${with_objc_runtime}" == x"GNU"; then AC_MSG_CHECKING([for GNU Objective C runtime]) AC_CACHE_VAL(ac_cv_objc_runtime_gnu, [ # The following uses quadrigraphs # '@<:@' = '[' # '@:>@' = ']' AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #include <objc/objc.h> #include <objc/objc-api.h> ], [ id class = objc_lookup_class("Object"); id obj = @<:@class alloc@:>@; puts(@<:@obj name@:>@); ]) ], [ ac_cv_objc_runtime_gnu="yes" ], [ ac_cv_objc_runtime_gnu="no" ] ) ]) AC_MSG_RESULT(${ac_cv_objc_runtime_gnu}) else ac_cv_objc_runtime_gnu="no" fi # NeXT runtime is prefered if test x"${ac_cv_objc_runtime_next}" == x"yes"; then OBJC_RUNTIME="NeXT" OBJC_RUNTIME_FLAGS="-fnext-runtime" AC_MSG_NOTICE([Using NeXT Objective C runtime]) AC_DEFINE([NeXT_RUNTIME], 1, [Define if using the NeXT Objective C runtime and compiler.]) elif test x"${ac_cv_objc_runtime_gnu}" == x"yes"; then OBJC_RUNTIME="GNU" OBJC_RUNTIME_FLAGS="-fgnu-runtime" AC_MSG_NOTICE([Using GNU Objective C runtime]) AC_DEFINE([GNU_RUNTIME], 1, [Define if using the GNU Objective C runtime and compiler.]) else AC_MSG_FAILURE([Could not locate a working Objective C runtime.]) fi AC_LANG_POP([Objective C]) ]) |