@@ -155,21 +155,25 @@ ]) 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_ARG_ENABLE(runtime, + AS_HELP_STRING([--enable-runtime], [use the included runtime])) +AS_IF([test x"$enable_runtime" != x"yes"], [ + 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 @@ -176,10 +180,13 @@ "ObjFW runtime") AC_DEFINE(OF_OBJFW_RUNTIME, 1, [Whether we use the ObjFW runtime]) AC_SUBST(GNU_RUNTIME, "-fgnu-runtime") OBJCFLAGS="$OBJCFLAGS -fgnu-runtime" + + AX_CHECK_COMPILER_FLAGS(-fno-objc-nonfragile-abi, [ + OBJCFLAGS="$OBJCFLAGS -fno-objc-nonfragile-abi"]) AC_SUBST(RUNTIME, "runtime") if test x"$enable_shared" != x"no"; then AC_SUBST(RUNTIME_LIB_A, "runtime.lib.a") AC_SUBST(RUNTIME_RUNTIME_LIB_A, "runtime/runtime.lib.a") @@ -209,12 +216,14 @@ case "$host_os" in darwin*) AC_SUBST(REEXPORT_LIBOBJC, ["-Wl,-reexport-lobjc"]) AC_SUBST(LDFLAGS_REEXPORT, ["-Wl,-reexport-lobjfw"]) - AC_SUBST(MACH_ALIAS_LIST, - ["-Xarch_x86_64 -Wl,-alias_list,mach_alias_list"]) + AS_IF([test x"$objc_runtime" = x"Apple runtime"], [ + tmp="-Xarch_x86_64 -Wl,-alias_list,mach_alias_list" + AC_SUBST(MACH_ALIAS_LIST, $tmp) + ]) ;; esac AC_C_BIGENDIAN([ AC_DEFINE(OF_BIG_ENDIAN, 1, [Whether we are big endian])