@@ -10,6 +10,21 @@ AC_ARG_WITH([blocks-runtime],
10
10
LIBS="$LIBS -L$blocks_runtime"]
11
11
)
12
12
13
+ #
14
+ # Configure argument to enable/disable using an embedded blocks runtime
15
+ #
16
+ AC_ARG_ENABLE ( [ embedded_blocks_runtime] ,
17
+ [ AS_HELP_STRING ( [ --enable_embedded_blocks_runtime] ,
18
+ [ Enable usage of blocks runtime embedded in libdispatch] ) ] ,,
19
+ [ case $target_os in
20
+ linux*)
21
+ enable_embedded_blocks_runtime=yes
22
+ ;;
23
+ *)
24
+ enable_embedded_blocks_runtime=no
25
+ esac]
26
+ )
27
+
13
28
#
14
29
# Detect compiler support for Blocks; perhaps someday -fblocks won't be
15
30
# required, in which case we'll need to change this.
@@ -29,30 +44,32 @@ AC_CACHE_CHECK([for C Blocks support], [dispatch_cv_cblocks], [
29
44
AS_IF ( [ test "x$dispatch_cv_cblocks" != "xno"] , [
30
45
CBLOCKS_FLAGS="$dispatch_cv_cblocks"
31
46
32
- #
33
- # It may be necessary to directly link the Blocks runtime on some
34
- # systems, so give it a try if we can't link a C program that uses
35
- # Blocks. We will want to remove this at somepoint, as really -fblocks
36
- # should force that linkage already.
37
- #
38
- saveCFLAGS="$CFLAGS"
39
- CFLAGS="$CFLAGS -fblocks -O0"
40
- AC_MSG_CHECKING ( [ whether additional libraries are required for the Blocks runtime] )
41
- AC_TRY_LINK ( [ ] , [
42
- ^{ int j; j=0; }();
43
- ] , [
44
- AC_MSG_RESULT ( [ no] ) ;
45
- ] , [
46
- saveLIBS="$LIBS"
47
- LIBS="$LIBS -lBlocksRuntime"
48
- AC_TRY_LINK ( [ ] , [
49
- ^{ int k; k=0; }();
50
- ] , [
51
- AC_MSG_RESULT ( [ -lBlocksRuntime] )
52
- ] , [
53
- AC_MSG_ERROR ( [ can't find Blocks runtime] )
54
- ] )
55
- ] )
47
+ AS_IF ( [ test "x$enable_embedded_blocks_runtime" != "xyes"] , [
48
+ #
49
+ # It may be necessary to directly link the Blocks runtime on some
50
+ # systems, so give it a try if we can't link a C program that uses
51
+ # Blocks. We will want to remove this at somepoint, as really -fblocks
52
+ # should force that linkage already.
53
+ #
54
+ saveCFLAGS="$CFLAGS"
55
+ CFLAGS="$CFLAGS -fblocks -O0"
56
+ AC_MSG_CHECKING ( [ whether additional libraries are required for the Blocks runtime] )
57
+ AC_TRY_LINK ( [ ] , [
58
+ ^{ int j; j=0; }();
59
+ ] , [
60
+ AC_MSG_RESULT ( [ no] ) ;
61
+ ] , [
62
+ saveLIBS="$LIBS"
63
+ LIBS="$LIBS -lBlocksRuntime"
64
+ AC_TRY_LINK ( [ ] , [
65
+ ^{ int k; k=0; }();
66
+ ] , [
67
+ AC_MSG_RESULT ( [ -lBlocksRuntime] )
68
+ ] , [
69
+ AC_MSG_ERROR ( [ can't find Blocks runtime] )
70
+ ] )
71
+ ] )
72
+ ] )
56
73
CFLAGS="$saveCFLAGS"
57
74
have_cblocks=true
58
75
] , [
@@ -61,6 +78,7 @@ AS_IF([test "x$dispatch_cv_cblocks" != "xno"], [
61
78
] )
62
79
AM_CONDITIONAL(HAVE_CBLOCKS, $have_cblocks)
63
80
AC_SUBST ( [ CBLOCKS_FLAGS] )
81
+ AM_CONDITIONAL([ BUILD_OWN_BLOCKS_RUNTIME] , [ test "x$enable_embedded_blocks_runtime" = "xyes"] )
64
82
65
83
#
66
84
# Because a different C++ compiler may be specified than C compiler, we have
@@ -82,24 +100,26 @@ AC_CACHE_CHECK([for C++ Blocks support], [dispatch_cv_cxxblocks], [
82
100
AS_IF ( [ test "x$dispatch_cv_cxxblocks" != "xno"] , [
83
101
CXXBLOCKS_FLAGS="$dispatch_cv_cxxblocks"
84
102
85
- saveCXXFLAGS="$CXXFLAGS"
86
- CXXFLAGS="$CXXFLAGS -fblocks -O0"
87
- AC_MSG_CHECKING ( [ whether additional libraries are required for the Blocks runtime] )
88
- AC_TRY_LINK ( [ ] , [
89
- ^{ int j; j=0; }();
90
- ] , [
91
- AC_MSG_RESULT ( [ no] ) ;
92
- ] , [
93
- saveLIBS="$LIBS"
94
- LIBS="$LIBS -lBlocksRuntime"
95
- AC_TRY_LINK ( [ ] , [
96
- ^{ int k; k=0; }();
97
- ] , [
98
- AC_MSG_RESULT ( [ -lBlocksRuntime] )
99
- ] , [
100
- AC_MSG_ERROR ( [ can't find Blocks runtime] )
101
- ] )
102
- ] )
103
+ AS_IF ( [ test "x$enable_embedded_blocks_runtime" != "xyes"] , [
104
+ saveCXXFLAGS="$CXXFLAGS"
105
+ CXXFLAGS="$CXXFLAGS -fblocks -O0"
106
+ AC_MSG_CHECKING ( [ whether additional libraries are required for the Blocks runtime] )
107
+ AC_TRY_LINK ( [ ] , [
108
+ ^{ int j; j=0; }();
109
+ ] , [
110
+ AC_MSG_RESULT ( [ no] ) ;
111
+ ] , [
112
+ saveLIBS="$LIBS"
113
+ LIBS="$LIBS -lBlocksRuntime"
114
+ AC_TRY_LINK ( [ ] , [
115
+ ^{ int k; k=0; }();
116
+ ] , [
117
+ AC_MSG_RESULT ( [ -lBlocksRuntime] )
118
+ ] , [
119
+ AC_MSG_ERROR ( [ can't find Blocks runtime] )
120
+ ] )
121
+ ] )
122
+ ] )
103
123
CXXFLAGS="$saveCXXFLAGS"
104
124
have_cxxblocks=true
105
125
] , [
0 commit comments