Skip to content

Commit

Permalink
Use configure time check for Objective-C runtime header directory
Browse files Browse the repository at this point in the history
workaround on Darwin/OS X.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@32956 72102866-910b-0410-8b05-ffd578937521
  • Loading branch information
wlux committed Apr 30, 2011
1 parent b3a0232 commit 45fae3c
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 8 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2011-04-12 Wolfgang Lux <[email protected]>

* configure.ac:
* config.make.in:
* target.make: Use configure time check for Objective-C runtime
header directory workaround on Darwin/OS X.
* configure: Regenerated.

2011-04-14 Adam Fedor <[email protected]>

* Version 2.6.0
Expand Down
1 change: 1 addition & 0 deletions config.make.in
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ LATEX2HTML = @LATEX2HTML@
# Darwin specific flags
CC_CPPPRECOMP = @cc_cppprecomp@
CC_BUNDLE = @cc_bundle@
CC_GNURUNTIME = @cc_gnuruntime@

# Backend bundle
BACKEND_BUNDLE=@BACKEND_BUNDLE@
Expand Down
27 changes: 27 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ OBJCXX
ac_cv_objc_threaded
objc_threaded
OBJC_LIB_FLAG
cc_gnuruntime
BACKEND_BUNDLE
GNUSTEP_MULTI_PLATFORM
GNUSTEP_USER_DIR
Expand Down Expand Up @@ -5165,6 +5166,32 @@ if test "$gs_cv_objc_libdir" != "NONE"; then
esac
fi
# Special case for Apple systems: When compiling plain C source files that
# include Objective-C runtime headers we must make sure that the correct
# header files are used with a gnu-*-* combo. The -fgnu-runtime compiler
# option takes care of this when compiling Objective-C source files, but
# has no effect when compiling plain C (or C++) source files.
cc_gnuruntime=
case $target_os-$ac_cv_library_combo in
darwin*-gnu-*-* )
if test "$gs_cv_objc_libdir" = "NONE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking GNU Objective-C runtime header directory" >&5
$as_echo_n "checking GNU Objective-C runtime header directory... " >&6; }
install_dir="`$CC -print-search-dirs | sed -n 's/install: //p'`"
if test -n "${install_dir}" && \
test -d "${install_dir}"include-gnu-runtime; then
cc_gnuruntime="${install_dir}"include-gnu-runtime
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cc_gnuruntime" >&5
$as_echo "$cc_gnuruntime" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NONE" >&5
$as_echo "NONE" >&6; }
fi
fi
;;
esac
# TODO: This flag needs to be moved to gnustep-base since it concerns
# the runtime library (see explanations at the beginning of this
# file).
Expand Down
23 changes: 23 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,29 @@ if test "$gs_cv_objc_libdir" != "NONE"; then
esac
fi

# Special case for Apple systems: When compiling plain C source files that
# include Objective-C runtime headers we must make sure that the correct
# header files are used with a gnu-*-* combo. The -fgnu-runtime compiler
# option takes care of this when compiling Objective-C source files, but
# has no effect when compiling plain C (or C++) source files.
cc_gnuruntime=
case $target_os-$ac_cv_library_combo in
darwin*-gnu-*-* )
if test "$gs_cv_objc_libdir" = "NONE"; then
AC_MSG_CHECKING(GNU Objective-C runtime header directory)
install_dir="`$CC -print-search-dirs | sed -n 's/install: //p'`"
if test -n "${install_dir}" && \
test -d "${install_dir}"include-gnu-runtime; then
cc_gnuruntime="${install_dir}"include-gnu-runtime
AC_MSG_RESULT($cc_gnuruntime)
else
AC_MSG_RESULT(NONE)
fi
fi
;;
esac
AC_SUBST(cc_gnuruntime)

# TODO: This flag needs to be moved to gnustep-base since it concerns
# the runtime library (see explanations at the beginning of this
# file).
Expand Down
16 changes: 8 additions & 8 deletions target.make
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,14 @@ endif
ifeq ($(OBJC_RUNTIME_LIB), gnu)
# GNU runtime

# FIXME: The following will cause a shell + compiler + sed invocation
# for every single recursive make invocation ... which is extremely
# slow. It needs to be rewritten as a configure check.

# Make sure that compiler includes the right Objective-C runtime headers when
# compiling C source files. Normally, the required include path is implicitly
# added -fgnu-runtime, but this seems to be ignored when compiling C files.
INTERNAL_CFLAGS := -isystem $(shell $(CC) -print-search-dirs | sed -n '/install:/s/install: //p')include-gnu-runtime
# Make sure that the compiler includes the right Objective-C runtime headers
# when compiling plain C source files. When compiling Objective-C source files
# the necessary directory is implicitly added by the -fgnu-runtime option, but
# this option is ignored when compiling plain C files.
ifneq ($(strip $(CC_GNURUNTIME)),)
INTERNAL_CFLAGS += -isystem $(CC_GNURUNTIME)
endif

INTERNAL_LDFLAGS += -undefined dynamic_lookup

SHARED_LD_PREFLAGS += -Wl,-noall_load -read_only_relocs warning $(CC_LDFLAGS)
Expand Down

0 comments on commit 45fae3c

Please sign in to comment.