[libdispatch-dev] [PATCH 1/4] specify headers of the blocks runtime at configure time

Mario Schwalbe schwalbe at inf.tu-dresden.de
Wed Nov 18 06:08:24 PST 2009


Hi,

If the blocks runtime isn't installed in standard paths, it's headers
are missing as well. But --with-blocks-runtime doesn't add -I<path>
to CFLAGS, so I added another option --with-blocks-include.

Please note that the -I<path> option is added to CBLOCKS_FLAGS and
CXXBLOCKS_FLAGS, because it seemed appropriate and can be reused for
libshims.la and the testing directory.

Please also note that this path must also be specified when checking
whether additional libraries are required. Otherwise the check fails to
add -lBlocksRuntime. But I cannot explain why, as the checked
code fragment shouldn't need any headers at all.

ciao,
Mario

Index: m4/blocks.m4
===================================================================
--- m4/blocks.m4        (Revision 171)
+++ m4/blocks.m4        (Arbeitskopie)
@@ -1,6 +1,18 @@
 AC_DEFUN([DISPATCH_C_BLOCKS], [
 #
 # Allow configure to be passed a path to the directory where it should look
+# for the Blocks runtime headers, if any.
+#
+AC_ARG_WITH([blocks-include],
+  [AS_HELP_STRING([--with-blocks-include=PATH],
+    [Specify path to the blocks runtime include files])],
+  [blocks_include=${withval}
+    CBLOCKS_FLAGS="-I$blocks_include"
+    CXXBLOCKS_FLAGS="-I$blocks_include"]
+)
+
+#
+# Allow configure to be passed a path to the directory where it should look
 # for the Blocks runtime library, if any.
 #
 AC_ARG_WITH([blocks-runtime],
@@ -27,7 +39,7 @@
 ])

 AS_IF([test "x$dispatch_cv_cblocks" != "xno"], [
-    CBLOCKS_FLAGS="$dispatch_cv_cblocks"
+    CBLOCKS_FLAGS="$CBLOCKS_FLAGS $dispatch_cv_cblocks"

     #
     # It may be necessary to directly link the Blocks runtime on some
@@ -36,7 +48,7 @@
     # should force that linkage already.
     #
     saveCFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -fblocks"
+    CFLAGS="$CFLAGS $CBLOCKS_FLAGS"
     AC_MSG_CHECKING([whether additional libraries are required for the Blocks runtime])
     AC_TRY_LINK([], [
        ^{ int j; j=0; }();
@@ -80,10 +92,10 @@
 ])

 AS_IF([test "x$dispatch_cv_cxxblocks" != "xno"], [
-    CXXBLOCKS_FLAGS="$dispatch_cv_cxxblocks"
+    CXXBLOCKS_FLAGS="$CXXBLOCKS_FLAGS $dispatch_cv_cxxblocks"

     saveCXXFLAGS="$CXXFLAGS"
-    CXXFLAGS="$CXXFLAGS -fblocks"
+    CXXFLAGS="$CXXFLAGS $CXXBLOCKS_FLAGS"
     AC_MSG_CHECKING([whether additional libraries are required for the Blocks runtime])
     AC_TRY_LINK([], [
        ^{ int j; j=0; }();



More information about the libdispatch-dev mailing list