Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -126,88 +126,45 @@ ], [ AC_MSG_RESULT(no) OBJCFLAGS="$old_OBJCFLAGS" ]) -AC_CHECK_HEADERS([objfw-rt.h objc/objc.h]) - -test x"$ac_cv_header_objfw_rt_h" = x"yes" && objc_runtime="ObjFW-RT" - -AC_MSG_CHECKING(which Objective C runtime we use) -AS_IF([test x"$ac_cv_header_objc_objc_h" = x"yes"], [ - dnl Only accept it if it's from gcc >= 4.7, as the one in 4.6 is buggy - dnl when using the new API. - AC_EGREP_CPP(yes, [ - #import - #if defined(__GNU_LIBOBJC__) && __GNU_LIBOBJC__ >= 20110608 - yes - #endif - ], [ - test x"$objc_runtime" = x"" && objc_runtime="GNU" - ], [ - dnl TODO: This is ugly. Let's think of a better check. - AC_EGREP_CPP(yes, [ - #import - #ifdef __objc_INCLUDE_GNU - yes - #endif - ], [ - test x"$objc_runtime" = x"" && objc_runtime="old GNU" - ], [ - objc_runtime="Apple" - ]) +objc_runtime="ObjFW runtime" +AC_CHECK_HEADER(objc/objc.h) +AC_MSG_CHECKING(which Objective C runtime to use) +AS_IF([test x"$ac_cv_header_objc_objc_h" = x"yes"], [ + dnl TODO: This is ugly. Let's think of a better check. + AC_EGREP_CPP(yes, [ + #import + #ifdef __objc_INCLUDE_GNU + yes + #endif + ], [ + dnl We don't want the GNU runtime + ], [ + objc_runtime="Apple runtime" ]) ]) AC_MSG_RESULT($objc_runtime) case $objc_runtime in - ObjFW-RT) + "ObjFW runtime") AC_DEFINE(OF_OBJFW_RUNTIME, 1, [Whether we use the ObjFW runtime]) AC_SUBST(GNU_RUNTIME, "-fgnu-runtime") OBJCFLAGS="$OBJCFLAGS -fgnu-runtime" - - AC_CHECK_LIB(objfw-rt, objc_msg_lookup, [ - LIBS="-lobjfw-rt $LIBS" - ], [ - AC_MSG_ERROR([libobjfw-rt not found!]) - ]) ;; - Apple) + "Apple runtime") AC_DEFINE(OF_APPLE_RUNTIME, 1, [Whether we use the Apple ObjC runtime]) AC_CHECK_LIB(objc, objc_msgSend, [ LIBS="-lobjc $LIBS" ], [ AC_MSG_ERROR([libobjc not found!]) ]) ;; - GNU) - AC_DEFINE(OF_GNU_RUNTIME, 1, - [Whether we use the GNU ObjC runtime]) - - AC_CHECK_LIB(objc, objc_msg_lookup, [ - LIBS="-lobjc $LIBS" - ], [ - AC_MSG_ERROR([libobjc not found!]) - ]) - ;; - "old GNU") - AC_DEFINE(OF_OLD_GNU_RUNTIME, 1, - [Whether we use the old GNU ObjC runtime]) - - AC_CHECK_LIB(objc, objc_msg_lookup, [ - LIBS="-lobjc $LIBS" - ], [ - AC_MSG_ERROR([libobjc not found!]) - ]) - ;; - *) - AC_MSG_RESULT(none) - AC_MSG_ERROR(No ObjC runtime found! Please install ObjFW-RT!) - ;; esac AC_CHECK_FUNC(objc_getProperty,, [ AC_DEFINE(NEED_OBJC_PROPERTIES_INIT, 1, [Whether objc_properties_init needs to be called]) @@ -226,16 +183,20 @@ AS_IF([test x"$enable_shared" != x"no"], [ BUILDSYS_SHARED_LIB AC_SUBST(OBJFW_SHARED_LIB, "${LIB_PREFIX}objfw${LIB_SUFFIX}") AC_SUBST(EXCEPTIONS_LIB_A, "exceptions.lib.a") AC_SUBST(EXCEPTIONS_EXCEPTIONS_LIB_A, "exceptions/exceptions.lib.a") + AC_SUBST(RUNTIME_LIB_A, "runtime.lib.a") + AC_SUBST(RUNTIME_RUNTIME_LIB_A, "runtime/runtime.lib.a") ]) AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static], [build static library])) AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [ AC_SUBST(OBJFW_STATIC_LIB, "libobjfw.a") AC_SUBST(EXCEPTIONS_A, "exceptions.a") AC_SUBST(EXCEPTIONS_EXCEPTIONS_A, "exceptions/exceptions.a") + AC_SUBST(RUNTIME_A, "runtime.a") + AC_SUBST(RUNTIME_RUNTIME_A, "runtime/runtime.a.") ]) AC_DEFINE_UNQUOTED(PLUGIN_SUFFIX, "$PLUGIN_SUFFIX", [Suffix for plugins]) AS_IF([test x"$PLUGIN_SUFFIX" != x""], [ AC_SUBST(OFPLUGIN_M, "OFPlugin.m") @@ -576,11 +537,11 @@ ]) ], [ AC_MSG_RESULT(no) ]) -AS_IF([test x"$objc_runtime" = x"Apple"], [ +AS_IF([test x"$objc_runtime" = x"Apple runtime"], [ AC_CHECK_HEADER(Foundation/NSObject.h, [ AC_SUBST(FOUNDATION_COMPAT_M, "foundation-compat.m") ]) ]) Index: extra.mk.in ================================================================== --- extra.mk.in +++ extra.mk.in @@ -24,9 +24,13 @@ OFSTREAMOBSERVER_SELECT_M = @OFSTREAMOBSERVER_SELECT_M@ OFTHREAD_M = @OFTHREAD_M@ OFTHREADTESTS_M = @OFTHREADTESTS_M@ PROPERTIESTESTS_M = @PROPERTIESTESTS_M@ REEXPORT_LIBOBJC = @REEXPORT_LIBOBJC@ +RUNTIME_A = @RUNTIME_A@ +RUNTIME_RUNTIME_A = @RUNTIME_RUNTIME_A@ +RUNTIME_RUNTIME_LIB_A = @RUNTIME_RUNTIME_LIB_A@ +RUNTIME_LIB_A = @RUNTIME_LIB_A@ TESTPLUGIN = @TESTPLUGIN@ TESTS = @TESTS@ TEST_LAUNCHER = @TEST_LAUNCHER@ THREADING_H = @THREADING_H@ Index: src/Makefile ================================================================== --- src/Makefile +++ src/Makefile @@ -1,8 +1,8 @@ include ../extra.mk -SUBDIRS = exceptions +SUBDIRS = exceptions runtime SHARED_LIB = ${OBJFW_SHARED_LIB} STATIC_LIB = ${OBJFW_STATIC_LIB} LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} @@ -98,11 +98,11 @@ ${OBJC_PROPERTIES_M} \ ${OBJC_SYNC_M} include ../buildsys.mk -CPPFLAGS += -I. -I.. -Iexceptions +CPPFLAGS += -I. -I.. -Iexceptions -Iruntime LD = ${OBJC} LDFLAGS += ${REEXPORT_LIBOBJC} ${MACH_ALIAS_LIST} -LIB_OBJS := ${LIB_OBJS} ${EXCEPTIONS_EXCEPTIONS_LIB_A} -OBJS += ${EXCEPTIONS_EXCEPTIONS_A} +LIB_OBJS := ${LIB_OBJS} ${EXCEPTIONS_EXCEPTIONS_LIB_A} ${RUNTIME_RUNTIME_LIB_A} +OBJS += ${EXCEPTIONS_EXCEPTIONS_A} ${RUNTIME_RUNTIME_A} ADDED src/runtime/Makefile Index: src/runtime/Makefile ================================================================== --- src/runtime/Makefile +++ src/runtime/Makefile @@ -0,0 +1,9 @@ +include ../../extra.mk + +STATIC_PIC_LIB_NOINST = ${RUNTIME_LIB_A} +STATIC_LIB_NOINST = ${RUNTIME_A} + +include ../../buildsys.mk + +CPPFLAGS += -I. -I.. -I../.. +LD = ${OBJC}