mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-23 22:33:28 +00:00
Detect -fblocks in the compiler when running configure, and if available, use it.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@32827 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d431fc8780
commit
2063f0887a
5 changed files with 122 additions and 3 deletions
|
@ -1,3 +1,12 @@
|
|||
2011-04-09 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* configure.ac: Check if the compiler supports -fblocks, and if
|
||||
so, enable it. Added --disable-fblocks option to turn this off if
|
||||
desired.
|
||||
* configure: Regenerated.
|
||||
* config.make.in (OPTFLAG): Added @GNUSTEP_C_FBLOCKS_FLAG@.
|
||||
* common.make: Updated comments.
|
||||
|
||||
2011-04-09 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* configure.ac: Updated comments.
|
||||
|
|
|
@ -95,7 +95,7 @@ include $(GNUSTEP_MAKEFILES)/library-combo.make
|
|||
|
||||
#
|
||||
# Get the config information (host/target/library-combo specific),
|
||||
# this includes CC, OPTFLAGS etc.
|
||||
# this includes CC, OPTFLAG etc.
|
||||
#
|
||||
include $(GNUSTEP_MAKEFILES)/$(GNUSTEP_TARGET_LDIR)/config.make
|
||||
|
||||
|
@ -664,7 +664,7 @@ ifeq ($(profile), yes)
|
|||
endif
|
||||
|
||||
# The default set of compilation flags are set in config.make in the
|
||||
# OPTFLAGS variable. They should default to -g -O2. These should be
|
||||
# OPTFLAG variable. They should default to -g -O2. These should be
|
||||
# an "average" set of flags, midway between debugging and performance;
|
||||
# they are used, unchanged, when we build with debug=no (the default
|
||||
# unless --enable-debug-by-default was used when configuring
|
||||
|
|
|
@ -62,7 +62,7 @@ endif
|
|||
# which will strip the object files upon installation; still, it's not
|
||||
# very elegant since -g is already added elsewhere for debug=yes, and
|
||||
# it ends up appearing twice in the gcc command-line.
|
||||
OPTFLAG = @CFLAGS@
|
||||
OPTFLAG = @CFLAGS@ @GNUSTEP_C_FBLOCKS_FLAG@
|
||||
OBJCFLAGS= @OBJCFLAGS@
|
||||
OBJC_LIB_FLAG = @OBJC_LIB_FLAG@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
|
|
66
configure
vendored
66
configure
vendored
|
@ -584,6 +584,7 @@ OBJCFLAGS
|
|||
LIB_DIR
|
||||
INCLUDES
|
||||
SOLARIS_SHARED
|
||||
GNUSTEP_C_FBLOCKS_FLAG
|
||||
GCC_WITH_PRECOMPILED_HEADERS
|
||||
AUTO_DEPENDENCIES
|
||||
USE_OBJC_EXCEPTIONS
|
||||
|
@ -751,6 +752,7 @@ with_objc_lib_flag
|
|||
with_thread_lib
|
||||
enable_objc_nonfragile_abi
|
||||
enable_native_objc_exceptions
|
||||
enable_fblocks
|
||||
enable_debug_by_default
|
||||
enable_strip_makefiles
|
||||
enable_parallel_building
|
||||
|
@ -1490,6 +1492,13 @@ Optional Features:
|
|||
Use this option if you do not want to use the native Objective-C
|
||||
exception support provided by newer compilers.
|
||||
|
||||
--disable-fblocks
|
||||
Disable the '-fblocks' option when compiling C/Objective-C. Normally,
|
||||
if the compiler supports '-fblocks' (which is expected to enable support
|
||||
for the 'blocks' extension to C and Objective-C), gnustep-make automatically
|
||||
uses it. Use this option to force gnustep-make to not pass '-fblocks'
|
||||
to the compiler when compiling C or Objective-C even if it supports it.
|
||||
|
||||
|
||||
--enable-debug-by-default
|
||||
Enable building with 'make debug=yes' by default. When you use
|
||||
|
@ -5848,6 +5857,63 @@ fi
|
|||
LIBS="$saved_LIBS"
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check if compiler supports -fblocks
|
||||
#--------------------------------------------------------------------
|
||||
# Check whether --enable-fblocks was given.
|
||||
if test "${enable_fblocks+set}" = set; then :
|
||||
enableval=$enable_fblocks; USE_FBLOCKS=$enableval
|
||||
else
|
||||
USE_FBLOCKS=maybe
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fblocks" >&5
|
||||
$as_echo_n "checking whether the compiler supports -fblocks... " >&6; }
|
||||
if test x"$USE_FBLOCKS" = x"no"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: check disabled" >&5
|
||||
$as_echo "check disabled" >&6; }
|
||||
else
|
||||
# Attempt compiling something that contains blocks with the
|
||||
# '-fblocks' flag. If it succeeds, use it. Else, disable it.
|
||||
CFLAGS_no_fblocks="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fblocks"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
void (^block)(void) = ^(void) {};
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
USE_FBLOCKS=yes
|
||||
else
|
||||
USE_FBLOCKS=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
if test x"$USE_FBLOCKS" = xno; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
fi
|
||||
CFLAGS="$CFLAGS_no_fblocks"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use -fblocks when compiling C/ObjC" >&5
|
||||
$as_echo_n "checking whether to use -fblocks when compiling C/ObjC... " >&6; }
|
||||
if test x"$USE_FBLOCKS" = xno; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
GNUSTEP_C_FBLOCKS_FLAG=
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
GNUSTEP_C_FBLOCKS_FLAG=-fblocks
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check if compiler requires -shared flag on Solaris ...
|
||||
#--------------------------------------------------------------------
|
||||
|
|
44
configure.ac
44
configure.ac
|
@ -1539,6 +1539,50 @@ AC_SUBST(GCC_WITH_PRECOMPILED_HEADERS)
|
|||
LIBS="$saved_LIBS"
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check if compiler supports -fblocks
|
||||
#--------------------------------------------------------------------
|
||||
AC_ARG_ENABLE(fblocks,
|
||||
[--disable-fblocks
|
||||
Disable the '-fblocks' option when compiling C/Objective-C. Normally,
|
||||
if the compiler supports '-fblocks' (which is expected to enable support
|
||||
for the 'blocks' extension to C and Objective-C), gnustep-make automatically
|
||||
uses it. Use this option to force gnustep-make to not pass '-fblocks'
|
||||
to the compiler when compiling C or Objective-C even if it supports it.
|
||||
],
|
||||
USE_FBLOCKS=$enableval,
|
||||
USE_FBLOCKS=maybe)
|
||||
|
||||
AC_MSG_CHECKING(whether the compiler supports -fblocks)
|
||||
if test x"$USE_FBLOCKS" = x"no"; then
|
||||
AC_MSG_RESULT(check disabled)
|
||||
else
|
||||
# Attempt compiling something that contains blocks with the
|
||||
# '-fblocks' flag. If it succeeds, use it. Else, disable it.
|
||||
CFLAGS_no_fblocks="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fblocks"
|
||||
AC_COMPILE_IFELSE([[
|
||||
void (^block)(void) = ^(void) {};
|
||||
]], USE_FBLOCKS=yes, USE_FBLOCKS=no)
|
||||
if test x"$USE_FBLOCKS" = xno; then
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
CFLAGS="$CFLAGS_no_fblocks"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether to use -fblocks when compiling C/ObjC)
|
||||
if test x"$USE_FBLOCKS" = xno; then
|
||||
AC_MSG_RESULT(no)
|
||||
GNUSTEP_C_FBLOCKS_FLAG=
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
GNUSTEP_C_FBLOCKS_FLAG=-fblocks
|
||||
fi
|
||||
|
||||
AC_SUBST(GNUSTEP_C_FBLOCKS_FLAG)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check if compiler requires -shared flag on Solaris ...
|
||||
#--------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue