1 dnl sxe-mem.m4 -- memory managers
3 AC_DEFUN([SXE_CHECK_BDWGC], [dnl
5 AC_REQUIRE([SXE_CHECK_CC_VERSION])
7 AC_CACHE_CHECK([for Boehm-Demers-Weiser GC support],
8 [sxe_cv_feat_bdwgc], [_SXE_CHECK_BDWGC])
10 ## quick compiler check
11 if test "$with_experimental_features_bdwgc" = "yes"; then
12 case "$compiler_version" in
13 gcc*\ 3.* | gcc*\ 2.* )
15 Stop right there, my friend!
16 The powers that be have deemed you unworthy of succeeding in building
17 SXEmacs in BDWGC mode with _that_ compiler ($compiler_version)!
19 It's not that we are going to stop you now but this will definitely fail.
20 In order to build a BDWGC-flavoured SXEmacs you want to use a GCC C compiler
23 The alternative is likewisely simple, do NOT enable the BDWGC feature,
24 that is leave --with-experimental-features alone, or explicitly turn off the
25 BDWGC feature like so: --with-experimental-features=nobdwgc.
27 I shall now give you a grace period of 32 seconds to consider your answer,
28 will you (from most recommended to least recommended)
29 a) upgrade your gcc, or
30 b) rerun configure not requesting the BDWGC feature, or
31 c) continue the build and promise not to complain?
35 Your time is up and you've made the wrongest decision, possibly, ever!
36 Well, you can still press C-c (control c, that is).
43 AM_CONDITIONAL([HAVE_BDWGC], [test "$have_bdwgc" = "yes"])
46 AC_DEFUN([SXE_CHECK_BDWGC_HEADERS], [dnl
47 ## defines sxe_cv_bdwgc_headers
49 AC_MSG_CHECKING([for bdwgc includes directory])
50 if test -n "${with_bdwgc_includes}"; then
51 SXE_BDWGC_INCLUDES_PATH([${with_bdwgc_includes}])
52 elif test -n "${with_bdwgc}"; then
53 SXE_BDWGC_INCLUDES_PATH([${with_bdwgc}])
55 ## just try ${prefix}/include
56 SXE_BDWGC_INCLUDES_PATH([${prefix}])
58 AC_MSG_RESULT([$BDWGC_CPPFLAGS])
61 CPPFLAGS="$CPPFLAGS ${BDWGC_CPPFLAGS}"
62 SXE_CHECK_HEADERS([gc.h])
63 SXE_CHECK_HEADERS([gc/gc.h])
64 SXE_CHECK_HEADERS([cord.h])
65 SXE_CHECK_HEADERS([gc/cord.h])
68 if test "$ac_cv_header_gc_gc_h" = "yes" -o \
69 "$ac_cv_header_gc_h" = "yes"; then
70 sxe_cv_bdwgc_headers="yes"
72 sxe_cv_bdwgc_headers="no"
75 AC_SUBST([BDWGC_CPPFLAGS])
76 ])dnl SXE_CHECK_BDWGC_HEADERS
78 AC_DEFUN([SXE_CHECK_BDWGC_LIBS], [dnl
79 AC_MSG_CHECKING([for bdwgc library])
80 if test -n "$with_bdwgc_libs"; then
81 SXE_BDWGC_LIBS_PATH([${with_bdwgc_libs}])
82 elif test -n "${with_bdwgc}"; then
83 SXE_BDWGC_LIBS_PATH([${with_bdwgc}])
85 ## just try under ${prefix}/lib
86 SXE_BDWGC_LIBS_PATH([${prefix}])
88 AC_MSG_RESULT([$BDWGC_LDFLAGS])
90 AC_CHECK_LIB([gc], [GC_init], [:], [:])
91 AC_CHECK_LIB([gc], [GC_malloc], [:], [:])
92 AC_CHECK_LIB([gc], [GC_malloc_atomic], [:], [:])
93 AC_CHECK_LIB([gc], [GC_malloc_uncollectable], [:], [:])
94 AC_CHECK_LIB([gc], [GC_realloc], [:], [:])
95 AC_CHECK_LIB([gc], [GC_strdup], [:], [:])
96 AC_CHECK_LIB([gc], [GC_free], [:], [:])
98 if test "$ac_cv_lib_gc___GC_init" = "yes" -a \
99 "$ac_cv_lib_gc___GC_malloc" = "yes" -a \
100 "$ac_cv_lib_gc___GC_malloc_atomic" = "yes" -a \
101 "$ac_cv_lib_gc___GC_malloc_uncollectable" = "yes" -a \
102 "$ac_cv_lib_gc___GC_realloc" = "yes" -a \
103 "$ac_cv_lib_gc___GC_strdup" = "yes" -a \
104 "$ac_cv_lib_gc___GC_free" = "yes"; then
105 sxe_cv_bdwgc_libs="yes"
108 elif test "$ac_cv_lib_gc_GC_init" = "yes" -a \
109 "$ac_cv_lib_gc_GC_malloc" = "yes" -a \
110 "$ac_cv_lib_gc_GC_malloc_atomic" = "yes" -a \
111 "$ac_cv_lib_gc_GC_malloc_uncollectable" = "yes" -a \
112 "$ac_cv_lib_gc_GC_realloc" = "yes" -a \
113 "$ac_cv_lib_gc_GC_strdup" = "yes" -a \
114 "$ac_cv_lib_gc_GC_free" = "yes"; then
115 sxe_cv_bdwgc_libs="yes"
119 sxe_cv_bdwgc_libs="no"
122 AC_SUBST([BDWGC_LDFLAGS])
123 AC_SUBST([BDWGC_LIBS])
124 ])dnl SXE_CHECK_BDWGC_LIBS
126 AC_DEFUN([_SXE_CHECK_BDWGC], [dnl
127 ## defines have_bdwgc and sxe_cv_feat_bdwgc
128 AC_REQUIRE([SXE_CHECK_BDWGC_HEADERS])
129 AC_REQUIRE([SXE_CHECK_BDWGC_LIBS])
131 if test "$sxe_cv_bdwgc_headers" = "yes" -a \
132 "$sxe_cv_bdwgc_libs" = "yes"; then
133 AC_DEFINE([HAVE_BDWGC], [1],
134 [Whether all necessary functions could be found in lgc.])
139 sxe_cv_feat_bdwgc="$have_bdwgc"
140 ])dnl _SXE_CHECK_BDWGC
142 AC_DEFUN([SXE_BDWGC_INCLUDES_PATH], [dnl
143 ## arg 1 is /path/to/kant/src
144 pushdef([bdwgc_path], [$1])
146 if test -d "/[]bdwgc_path[]"; then
148 elif test -d "$(pwd)/[]bdwgc_path[]" -o -d "[]bdwgc_path[]"; then
150 path=$(pwd)/[]bdwgc_path
151 elif test -f "/[]bdwgc_path[]"; then
153 path=/$(dirname []bdwgc_path[])
154 elif test -f "$(pwd)/[]bdwgc_path[]" -o -f "[]bdwgc_path[]"; then
156 path=$(dirname $(pwd)/[]bdwgc_path[])
157 elif test -n "[]bdwgc_path[]"; then
160 ## yuck, path's empty, dunno what to do
164 if test -d "$path/include" -a \
165 -e "$path/include/gc/gc.h" -o \
166 -d "$path/include" -a \
167 -e "$path/include/gc.h"; then
170 elif test -d "$path/../include" -a \
171 -e "$path/../include/gc/gc.h" -o \
172 -d "$path/../include" -a \
173 -e "$path/../include/gc.h"; then
174 ## we went to directly to the include dir
175 path="${path}/../include"
181 ## simple canonicalisation
182 if test -n "$path"; then
183 SXE_CANONICALISE_PATH([path])
184 BDWGC_CPPFLAGS="${BDWGC_CPPFLAGS} -I${path}"
188 ])dnl SXE_BDWGC_INCLUDES_PATH
190 AC_DEFUN([SXE_BDWGC_LIBS_PATH], [dnl
191 ## arg 1 is /path/to/libgc.so
192 pushdef([bdwgc_path], [$1])
194 if test -d "/[]bdwgc_path[]"; then
196 elif test -d "$(pwd)/[]bdwgc_path[]" -o -d "[]bdwgc_path[]"; then
198 path=$(pwd)/[]bdwgc_path
199 elif test -f "/[]bdwgc_path[]"; then
201 path=/$(dirname []bdwgc_path[])
202 elif test -f "$(pwd)/[]bdwgc_path[]" -o -f "[]bdwgc_path[]"; then
204 path=$(dirname $(pwd)/[]bdwgc_path[])
205 elif test -n "[]bdwgc_path[]"; then
208 ## yuck, path's empty, dunno what to do
212 if test -d "$path/lib" -a -e "$path/lib/libgc.so"; then
215 elif test -d "$path/../lib" -a -e "$path/../lib/libgc.so"; then
216 ## we went to directly to the lib dir
217 path="${path}/../lib"
223 ## simple canonicalisation
224 if test -n "$path"; then
225 SXE_CANONICALISE_PATH([path])
226 BDWGC_LDFLAGS="${BDWGC_LDFLAGS} -L${path}"
230 ])dnl SXE_BDWGC_LIBS_PATH
233 dnl sxe-mem.m4 ends here