1 # checkbuild.m4 -*- Autoconf -*-
2 #==============================================================================
3 # Copyright (C)2003 by Eric Sunshine <sunshine@sunshineco.com>
5 # This library is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Library General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or (at your
8 # option) any later version.
10 # This library is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 # License for more details.
15 # You should have received a copy of the GNU Library General Public License
16 # along with this library; if not, write to the Free Software Foundation,
17 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #==============================================================================
22 #------------------------------------------------------------------------------
23 # CS_SPLIT_TUPLE(TUPLE, OUTPUT-VARIABLES)
24 # Split a build-tuple into its component parts. A build tuple is
25 # constructed by CS_CREATE_TUPLE() and is comprised of compiler flags,
26 # linker flags, and library references. OUTPUT-VARIABLES is a
27 # comma-delimited list of shell variables which should receive the
28 # extracted compiler flags, linker flags, and library references,
30 #------------------------------------------------------------------------------
31 AC_DEFUN([CS_SPLIT_TUPLE],
32 [CS_SPLIT([$1], [cs_dummy,$2], [@])
33 m4_map([_CS_SPLIT_TUPLE], [$2])])
35 AC_DEFUN([_CS_SPLIT_TUPLE],
36 [$1=`echo $$1 | sed 'y%@%:@% %'`
41 #------------------------------------------------------------------------------
42 # CS_CREATE_TUPLE([CFLAGS], [LFLAGS], [LIBS])
43 # Construct a build-tuple which is comprised of compiler flags, linker
44 # flags, and library references. Build tuples are encoded so as to
45 # preserve whitespace in each component. This makes it possible for
46 # macros (such as CS_BUILD_IFELSE) which employ build tuples to accept
47 # whitespace-delimited lists of tuples, and for shell "for" statements to
48 # iterate over tuple lists without compromising whitespace embedded
49 # within individual flags or library references.
50 #------------------------------------------------------------------------------
51 AC_DEFUN([CS_CREATE_TUPLE], [`echo @$1@$2@$3 | sed 'y% %@%:@%'`])
55 #------------------------------------------------------------------------------
57 # Return the literal string CFLAGS if the current language is C. Return
58 # the literal string CXXFLAGS if the current language is C++. Generic
59 # compiler test macros which need to modify or save the compiler flags
60 # can invoke this macro to get the name of the compiler flags environment
61 # variable (either CFLAGS or CXXFLAGS) depending upon the current
62 # language. For example:
63 # CS_LANG_CFLAGS="$CS_LANG_CFLAGS -Wall"
64 # With C, this expands to:
65 # CFLAGS="$CFLAGS -Wall"
66 # With C++, it expands to:
67 # CXXFLAGS="$CXXFLAGS -Wall"
68 #------------------------------------------------------------------------------
69 AC_DEFUN([CS_LANG_CFLAGS], [AC_LANG_CASE([C], [CFLAGS], [C++], [CXXFLAGS])])
73 #------------------------------------------------------------------------------
74 # CS_BUILD_IFELSE([PROGRAM], [FLAGS], [LANGUAGE], [ACTION-IF-BUILT],
75 # [ACTION-IF-NOT-BUILT], [OTHER-CFLAGS], [OTHER-LFLAGS],
76 # [OTHER-LIBS], [INHIBIT-OTHER-FLAGS], [ERROR-REGEX])
77 # Try building a program using the supplied compiler flags, linker flags,
78 # and library references. PROGRAM is typically a program composed via
79 # AC_LANG_PROGRAM(). PROGRAM may be omitted if you are interested only
80 # in learning if the compiler or linker respects certain flags. LANGUAGE
81 # is typically either C or C++ and specifies which compiler to use for
82 # the test. If LANGUAGE is omitted, C is used. FLAGS is a whitespace
83 # delimited list of build tuples. Tuples are created with
84 # CS_CREATE_TUPLE() and are composed of up to three elements each. The
85 # first element represents compiler flags, the second linker flags, and
86 # the third libraries used when linking the program. Each tuple from
87 # FLAGS is attempted in order. If you want a build attempted with no
88 # special flags prior to builds with specialized flags, create an empty
89 # tuple with CS_CREATE_TUPLE() at the start of the FLAGS list. If the
90 # build is successful, then the shell variables cs_build_ok is set to
91 # "yes", cs_build_cflags, cs_build_lflags, and cs_build_libs are set to
92 # the tuple elements which resulted in the successful build, and
93 # ACTION-IF-BUILT is invoked. Upon successful build, no further tuples
94 # are consulted. If no tuple results in a successful build, then
95 # cs_build_ok is set to "no" and ACTION-IF-NOT-BUILT is invoked.
96 # OTHER-CFLAGS, OTHER-LFLAGS, and OTHER-LIBS specify additional compiler
97 # flags, linker flags, and libraries which should be used with each tuple
98 # build attempt. Upon successful build, these additional flags are also
99 # reflected in the variables cs_build_cflags, cs_build_lflags, and
100 # cs_build_libs unless INHIBIT-OTHER-FLAGS is a non-empty string. The
101 # optional ERROR-REGEX places an additional constraint upon the build
102 # check. If specified, ERROR-REGEX, which is a standard `grep' regular
103 # expression, is applied to output captured from the compiler and linker.
104 # If ERROR-REGEX matches, then the build is deemed a failure, and
105 # cs_build_ok is set to "no". This facility is useful for broken build
106 # tools which emit an error message yet still return success as a result.
107 # In such cases, it should be possible to detect the failure by scanning
110 # IMPLEMENTATION NOTES
112 # In Autoconf 2.57 and earlier, AC_LINK_IFELSE() invokes AC_TRY_EVAL(),
113 # which does not provide access to the captured output. To work around
114 # this limitation, we temporarily re-define AC_TRY_EVAL() as
115 # _AC_EVAL_STDERR(), which leaves the captured output in conftest.err
116 # (which we must also delete). In Autoconf 2.58, however,
117 # AC_LINK_IFELSE() instead already invokes _AC_EVAL_STDERR() on our
118 # behalf, however we must be careful to apply ERROR-REGEX within the
119 # invocation AC_LINK_IFELSE(), since AC_LINK_IFELSE() deletes
120 # conftest.err before it returns.
121 #------------------------------------------------------------------------------
122 AC_DEFUN([CS_BUILD_IFELSE],
123 [AC_LANG_PUSH(m4_default([$3],[C]))
124 cs_cflags_save="$CS_LANG_CFLAGS"
125 cs_lflags_save="$LDFLAGS"
128 m4_ifval([$10], [m4_pushdef([AC_TRY_EVAL], [_AC_EVAL_STDERR]($$[1]))])
130 for cs_build_item in m4_default([$2],[CS_CREATE_TUPLE()])
133 [$cs_build_item],[cs_cflags_test,cs_lflags_test,cs_libs_test])
134 CS_LANG_CFLAGS="$cs_cflags_test $6 $cs_cflags_save"
135 LDFLAGS="$cs_lflags_test $7 $cs_lflags_save"
136 LIBS="$cs_libs_test $8 $cs_libs_save"
137 AC_LINK_IFELSE(m4_default([$1], [AC_LANG_PROGRAM([],[])]),
139 [AS_IF([AC_TRY_COMMAND(
140 [grep "AS_ESCAPE([$10])" conftest.err >/dev/null 2>&1])],
141 [cs_build_ok=no], [cs_build_ok=yes])],
143 AS_IF([test $cs_build_ok = yes], [break])
146 m4_ifval([$10], [m4_popdef([AC_TRY_EVAL]) rm -f conftest.err])
147 CS_LANG_CFLAGS=$cs_cflags_save
148 LDFLAGS=$cs_lflags_save
150 AC_LANG_POP(m4_default([$3],[C]))
152 AS_IF([test $cs_build_ok = yes],
153 [cs_build_cflags=CS_TRIM([$cs_cflags_test[]m4_ifval([$9],[],[ $6])])
154 cs_build_lflags=CS_TRIM([$cs_lflags_test[]m4_ifval([$9],[],[ $7])])
155 cs_build_libs=CS_TRIM([$cs_libs_test[]m4_ifval([$9],[],[ $8])])
161 #------------------------------------------------------------------------------
162 # CS_CHECK_BUILD(MESSAGE, CACHE-VAR, [PROGRAM], [FLAGS], [LANGUAGE],
163 # [ACTION-IF-BUILT], [ACTION-IF-NOT-BUILT], [IGNORE-CACHE],
164 # [OTHER-CFLAGS], [OTHER-LFLAGS], [OTHER-LIBS],
165 # [INHIBIT-OTHER-FLAGS], [ERROR-REGEX])
166 # Like CS_BUILD_IFELSE() but also prints "checking" and result messages,
167 # and optionally respects the cache. Sets CACHE-VAR to "yes" upon
168 # success, else "no" upon failure. Additionally, sets CACHE-VAR_cflags,
169 # CACHE-VAR_lflags, and CACHE-VAR_libs to the values which resulted in a
170 # successful build. If IGNORE-CACHE is "yes", then the cache variables
171 # are ignored upon entry to this macro, however they are still set to
172 # appropriate values upon exit.
173 #------------------------------------------------------------------------------
174 AC_DEFUN([CS_CHECK_BUILD],
175 [AS_IF([test "$8" != yes],
176 [AC_CACHE_CHECK([$1], [$2],
177 [CS_BUILD_IFELSE([$3], [$4], [$5],
179 $2_cflags=$cs_build_cflags
180 $2_lflags=$cs_build_lflags
181 $2_libs=$cs_build_libs],
182 [$2=no], [$9], [$10], [$11], [$12], [$13])])],
183 [AC_MSG_CHECKING([$1])
184 CS_BUILD_IFELSE([$3], [$4], [$5],
186 $2_cflags=$cs_build_cflags
187 $2_lflags=$cs_build_lflags
188 $2_libs=$cs_build_libs],
189 [$2=no], [$9], [$10], [$11], [$12], [$13])
190 AC_MSG_RESULT([$$2])])
191 AS_IF([test $$2 = yes], [$6],
199 #------------------------------------------------------------------------------
200 # CS_CHECK_BUILD_FLAGS(MESSAGE, CACHE-VAR, FLAGS, [LANGUAGE],
201 # [ACTION-IF-RECOGNIZED], [ACTION-IF-NOT-RECOGNIZED],
202 # [OTHER-CFLAGS], [OTHER-LFLAGS], [OTHER-LIBS],
204 # Like CS_CHECK_BUILD(), but checks only if the compiler or linker
205 # recognizes a command-line option or options. MESSAGE is the "checking"
206 # message. CACHE-VAR is the shell cache variable which receives the flag
207 # or flags recognized by the compiler or linker. FLAGS is a
208 # whitespace-delimited list of build tuples created with
209 # CS_CREATE_TUPLE(). Each tuple from FLAGS is attempted in order until
210 # one is found which is recognized by the compiler. After that, no
211 # further flags are checked. LANGUAGE is typically either C or C++ and
212 # specifies which compiler to use for the test. If LANGUAGE is omitted,
213 # C is used. If a command-line option is recognized, then CACHE-VAR is
214 # set to the composite value of $cs_build_cflags, $cs_build_lflags, and
215 # $cs_build_libs of the FLAGS element which succeeded (not including the
216 # "other" flags) and ACTION-IF-RECOGNIZED is invoked. If no options are
217 # recognized, then CACHE-VAR is set to the empty string, and
218 # ACTION-IF-NOT-RECOGNIZED is invoked. As a convenience, in case
219 # comparing CACHE-VAR against the empty string to test for failure is
220 # undesirable, a second variable named CACHE-VAR_ok is set to the literal
221 # "no" upon failure, and to the same value as CACHE-VAR upon success.
222 #------------------------------------------------------------------------------
223 AC_DEFUN([CS_CHECK_BUILD_FLAGS],
224 [AC_CACHE_CHECK([$1], [$2_ok],
225 [CS_BUILD_IFELSE([], [$3], [$4],
226 [$2=CS_TRIM([$cs_build_cflags $cs_build_lflags $cs_build_libs])
229 $2_ok=no], [$7], [$8], [$9], [Y], [$10])])
230 AS_IF([test "$$2_ok" != no], [$5], [$6])])
231 #==============================================================================
232 # Copyright (C)2003-2006 by Eric Sunshine <sunshine@sunshineco.com>
234 # This library is free software; you can redistribute it and/or modify it
235 # under the terms of the GNU Library General Public License as published by
236 # the Free Software Foundation; either version 2 of the License, or (at your
237 # option) any later version.
239 # This library is distributed in the hope that it will be useful, but
240 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
241 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
242 # License for more details.
244 # You should have received a copy of the GNU Library General Public License
245 # along with this library; if not, write to the Free Software Foundation,
246 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
248 #==============================================================================
251 #------------------------------------------------------------------------------
252 # CS_CHECK_COMMON_TOOLS_LINK
253 # Checks for common tools related to linking.
254 #------------------------------------------------------------------------------
255 AC_DEFUN([CS_CHECK_COMMON_TOOLS_LINK],
257 # The default RANLIB in Jambase is wrong on some platforms, and is also
258 # unsuitable during cross-compilation, so we set the value unconditionally
259 # (sixth argument of CS_EMIT_BUILD_PROPERTY).
261 CS_EMIT_BUILD_PROPERTY([RANLIB], [$RANLIB], [], [], [], [Y])
263 CS_CHECK_TOOLS([DLLTOOL], [dlltool])
264 CS_EMIT_BUILD_PROPERTY([CMD.DLLTOOL], [$DLLTOOL])
266 CS_CHECK_TOOLS([DLLWRAP], [dllwrap])
267 CS_EMIT_BUILD_PROPERTY([CMD.DLLWRAP], [$DLLWRAP])
269 CS_CHECK_TOOLS([WINDRES], [windres])
270 CS_EMIT_BUILD_PROPERTY([CMD.WINDRES], [$WINDRES])
272 CS_CHECK_TOOLS([STRINGS], [strings])
273 CS_EMIT_BUILD_PROPERTY([CMD.STRINGS], [$STRINGS])
275 CS_CHECK_TOOLS([OBJCOPY], [objcopy])
276 CS_EMIT_BUILD_PROPERTY([CMD.OBJCOPY], [$OBJCOPY])
279 CS_EMIT_BUILD_PROPERTY([LIBTOOL], [$LIBTOOL])
280 CS_EMIT_BUILD_PROPERTY([APPLE_LIBTOOL], [$APPLE_LIBTOOL])
284 #------------------------------------------------------------------------------
285 # CS_CHECK_COMMON_TOOLS_BASIC
286 # Checks for basic tools for building things.
287 #------------------------------------------------------------------------------
288 AC_DEFUN([CS_CHECK_COMMON_TOOLS_BASIC],
290 CS_EMIT_BUILD_PROPERTY([CMD.MKDIR], [$MKDIR])
291 CS_EMIT_BUILD_PROPERTY([CMD.MKDIRS], [$MKDIRS])
293 CS_CHECK_PROGS([INSTALL], [install])
294 CS_EMIT_BUILD_PROPERTY([INSTALL], [$INSTALL])])
297 #------------------------------------------------------------------------------
298 # CS_CHECK_COMMON_TOOLS_DOC_TEXINFO
299 # Checks for tools to generate documentation from texinfo files.
300 #------------------------------------------------------------------------------
301 AC_DEFUN([CS_CHECK_COMMON_TOOLS_DOC_TEXINFO],
302 [CS_CHECK_PROGS([TEXI2DVI], [texi2dvi])
303 CS_EMIT_BUILD_PROPERTY([CMD.TEXI2DVI], [$TEXI2DVI])
305 CS_CHECK_PROGS([TEXI2PDF], [texi2pdf])
306 CS_EMIT_BUILD_PROPERTY([CMD.TEXI2PDF], [$TEXI2PDF])
308 CS_CHECK_PROGS([DVIPS], [dvips])
309 CS_EMIT_BUILD_PROPERTY([CMD.DVIPS], [$DVIPS])
311 CS_CHECK_PROGS([DVIPDF], [dvipdf])
312 CS_EMIT_BUILD_PROPERTY([CMD.DVIPDF], [$DVIPDF])
314 CS_CHECK_PROGS([MAKEINFO], [makeinfo])
315 CS_EMIT_BUILD_PROPERTY([CMD.MAKEINFO], [$MAKEINFO])])
318 #------------------------------------------------------------------------------
319 # CS_CHECK_COMMON_TOOLS_DOC_DOXYGEN
320 # Checks for tools to generate source documentation via doxygen.
321 #------------------------------------------------------------------------------
322 AC_DEFUN([CS_CHECK_COMMON_TOOLS_DOC_DOXYGEN],
323 [CS_CHECK_PROGS([DOXYGEN], [doxygen])
324 CS_EMIT_BUILD_PROPERTY([CMD.DOXYGEN], [$DOXYGEN])
326 CS_CHECK_TOOLS([DOT], [dot])
327 CS_EMIT_BUILD_PROPERTY([CMD.DOT], [$DOT])])
330 #------------------------------------------------------------------------------
331 # CS_CHECK_COMMON_LIBS
332 # Check for typical required libraries (libm, libmx, libdl, libnsl).
333 #------------------------------------------------------------------------------
334 AC_DEFUN([CS_CHECK_COMMON_LIBS],
336 AC_CHECK_LIB([m], [pow], [cs_cv_libm_libs=-lm], [cs_cv_libm_libs=])
337 AC_CHECK_LIB([m], [cosf], [cs_cv_libm_libs=-lm])
338 AC_CHECK_LIB([mx], [cosf])
339 AC_CHECK_LIB([dl], [dlopen], [cs_cv_libdl_libs=-ldl], [cs_cv_libdl_libs=])
340 AC_CHECK_LIB([nsl], [gethostbyname])
342 # checkcppunit.m4 -*- Autoconf -*-
343 #==============================================================================
344 # Copyright (C)2005 by Eric Sunshine <sunshine@sunshineco.com>
346 # This library is free software; you can redistribute it and/or modify it
347 # under the terms of the GNU Library General Public License as published by
348 # the Free Software Foundation; either version 2 of the License, or (at your
349 # option) any later version.
351 # This library is distributed in the hope that it will be useful, but
352 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
353 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
354 # License for more details.
356 # You should have received a copy of the GNU Library General Public License
357 # along with this library; if not, write to the Free Software Foundation,
358 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
360 #==============================================================================
363 #------------------------------------------------------------------------------
364 # CS_CHECK_CPPUNIT([EMITTER])
365 # Check if CppUnit (http://cppunit.sourceforge.net/), the unit-testing
366 # framework is available. The shell variable cs_cv_libcppunit is set to
367 # "yes" if CppUnit is discovered, else "no". If available, then the
368 # variables cs_cv_libcppunit_cflags, cs_cv_libcppunit_lflags, and
369 # cs_cv_libcppunit_libs are set. If EMITTER is provided, then
370 # CS_EMIT_BUILD_RESULT() is invoked with EMITTER in order to record the
371 # results in an output file. As a convenience, if EMITTER is the literal
372 # value "emit" or "yes", then CS_EMIT_BUILD_RESULT()'s default emitter
374 #------------------------------------------------------------------------------
375 AC_DEFUN([CS_CHECK_CPPUNIT],
376 [CS_CHECK_LIB_WITH([cppunit],
377 [AC_LANG_PROGRAM([[#include <cppunit/ui/text/TestRunner.h>]],
378 [CppUnit::TextUi::TestRunner r; r.run();])],
381 AS_IF([test $cs_cv_libcppunit = yes],
382 [CS_CHECK_BUILD([if cppunit is sufficiently recent],
383 [cs_cv_libcppunit_recent],
385 [[#include <cppunit/BriefTestProgressListener.h>]],
386 [CppUnit::BriefTestProgressListener b; b.startTest(0);])],
388 [CS_EMIT_BUILD_RESULT([cs_cv_libcppunit], [CPPUNIT],
389 CS_EMITTER_OPTIONAL([$1]))], [], [],
390 [$cs_cv_libcppunit_cflags],
391 [$cs_cv_libcppunit_lflags],
392 [$cs_cv_libcppunit_libs])])])
393 # checklib.m4 -*- Autoconf -*-
394 #==============================================================================
395 # Copyright (C)2003-2005 by Eric Sunshine <sunshine@sunshineco.com>
397 # This library is free software; you can redistribute it and/or modify it
398 # under the terms of the GNU Library General Public License as published by
399 # the Free Software Foundation; either version 2 of the License, or (at your
400 # option) any later version.
402 # This library is distributed in the hope that it will be useful, but
403 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
404 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
405 # License for more details.
407 # You should have received a copy of the GNU Library General Public License
408 # along with this library; if not, write to the Free Software Foundation,
409 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
411 #==============================================================================
414 #------------------------------------------------------------------------------
415 # cs_lib_paths_default
416 # Whitespace delimited list of directory tuples in which to search, by
417 # default, for external libraries. Each list item can specify an
418 # include|library directory tuple (for example, "/usr/include|/usr/lib"),
419 # or a single directory (for example, "/usr"). If the second form is
420 # used, then "include" and "lib" subdirectories of the directory are
421 # searched. If the library resources are not found, then the directory
422 # itself is searched. Thus, "/proj" is shorthand for
423 # "/proj/include|/proj/lib /proj|/proj".
426 # /usr/local -- Not all compilers search here by default, so we specify
428 # /sw -- Fink, the MacOS/X manager of Unix packages, installs here by
430 # /opt/local -- DarwinPorts installs here by default.
431 #------------------------------------------------------------------------------
432 m4_define([cs_lib_paths_default],
433 [/usr/local/include|/usr/local/lib \
434 /sw/include|/sw/lib \
435 /opt/local/include|/opt/local/lib \
436 /opt/include|/opt/lib])
440 #------------------------------------------------------------------------------
441 # cs_pkg_paths_default
442 # Comma delimited list of additional directories in which the
443 # `pkg-config' command should search for its `.pc' files.
446 # /usr/local/lib/pkgconfig -- Although a common location for .pc files
447 # installed by "make install", many `pkg-config' commands neglect
448 # to search here automatically.
449 # /sw/lib/pkgconfig -- Fink, the MacOS/X manager of Unix packages,
450 # installs .pc files here by default.
451 # /opt/local/lib/pkgconfig -- DarwinPorts installs .pc files here by
453 #------------------------------------------------------------------------------
454 m4_define([cs_pkg_paths_default],
455 [/usr/local/lib/pkgconfig,
457 /opt/local/lib/pkgconfig,
462 #------------------------------------------------------------------------------
463 # CS_CHECK_LIB_WITH(LIBRARY, PROGRAM, [SEARCH-LIST], [LANGUAGE],
464 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-CFLAGS],
465 # [OTHER-LFLAGS], [OTHER-LIBS], [ALIASES])
466 # Very roughly similar in concept to AC_CHECK_LIB(), but allows caller to
467 # to provide list of directories in which to search for LIBRARY; allows
468 # user to override library location via --with-LIBRARY=dir; and consults
469 # `pkg-config' (if present) and `LIBRARY-config' (if present, i.e.
470 # `sdl-config') in order to obtain compiler and linker flags. LIBRARY is
471 # the name of the library or MacOS/X framework which is to be located
472 # (for example, "readline" for `libreadline.a' or `readline.framework').
473 # PROGRAM, which is typically composed with AC_LANG_PROGRAM(), is a
474 # program which references at least one function or symbol in LIBRARY.
475 # SEARCH-LIST is a whitespace-delimited list of paths in which to search
476 # for the library and its header files, in addition to those searched by
477 # the compiler and linker by default, and those referenced by the
478 # cs_lib_paths_default macro. Each list item can specify an
479 # `include|library' directory tuple (for example,
480 # "/usr/include|/usr/lib"), or a single directory (for example, "/usr").
481 # If the second form is used, then "include" and "lib" subdirectories of
482 # the directory are searched. If the library resources are not found,
483 # then the directory itself is searched. Thus, "/proj" is shorthand for
484 # "/proj/include|/proj/lib /proj|/proj". Items in the search list can
485 # include wildcards. SEARCH-LIST can be overridden by the user with the
486 # --with-LIBRARY=dir option, in which case only "dir/include|dir/lib" and
487 # "dir|dir" are searched. If SEARCH-LIST is omitted and the user did not
488 # override the search list via --with-LIBRARY=dir, then only the
489 # directories normally searched by the compiler and the directories
490 # mentioned via cs_lib_paths_default are searched. LANGUAGE is typically
491 # either C or C++ and specifies which compiler to use for the test. If
492 # LANGUAGE is omitted, C is used. OTHER-CFLAGS, OTHER-LFLAGS, and
493 # OTHER-LIBS can specify additional compiler flags, linker flags, and
494 # libraries needed to successfully link with LIBRARY. The optional
495 # ALIASES is a comma-delimited list of library names for which to search
496 # in case LIBRARY is not located (for example "[sdl1.2, sdl12]" for
497 # libsdl1.2.a, sdl1.2.framework, libsdl12.a, and sdl12.framework). If
498 # the library or one of its aliases is found and can be successfully
499 # linked into a program, then the shell cache variable cs_cv_libLIBRARY
500 # is set to "yes"; cs_cv_libLIBRARY_cflags, cs_cv_libLIBRARY_lflags, and
501 # cs_cv_libLIBRARY_libs are set, respectively, to the compiler flags
502 # (including OTHER-CFLAGS), linker flags (including OTHER-LFLAGS), and
503 # library references (including OTHER-LIBS) which resulted in a
504 # successful build; and ACTION-IF-FOUND is invoked. If the library was
505 # not found or was unlinkable, or if the user disabled the library via
506 # --without-LIBRARY, then cs_cv_libLIBRARY is set to "no" and
507 # ACTION-IF-NOT-FOUND is invoked. Note that the exported shell variable
508 # names are always composed from LIBRARY regardless of whether the test
509 # succeeded because the primary library was discovered or one of the
511 #------------------------------------------------------------------------------
512 AC_DEFUN([CS_CHECK_LIB_WITH],
513 [AC_ARG_WITH([$1], [AC_HELP_STRING([--with-$1=dir],
514 [specify location of lib$1 if not detected automatically; searches
515 dir/include, dir/lib, and dir])])
517 # Backward compatibility: Recognize --with-lib$1 as alias for --with-$1.
518 AS_IF([test -n "$with_lib$1" && test -z "$with_$1"],
519 [with_$1="$with_lib$1"])
521 AS_IF([test -z "$with_$1"], [with_$1=yes])
522 AS_IF([test "$with_$1" != no],
523 [# If --with-$1 value is same as cached value, then assume other
524 # cached values are also valid; otherwise, ignore all cached values.
525 AS_IF([test "$with_$1" != "$cs_cv_with_$1"],
526 [cs_ignore_cache=yes], [cs_ignore_cache=no])
528 cs_check_lib_flags=''
529 AS_IF([test $with_$1 = yes],
530 [m4_foreach([cs_check_lib_alias], [$1, $10],
531 [_CS_CHECK_LIB_PKG_CONFIG_FLAGS([cs_check_lib_flags],
533 _CS_CHECK_LIB_CONFIG_FLAGS([cs_check_lib_flags],
537 AS_IF([test $with_$1 != yes],
538 [cs_check_lib_paths=$with_$1],
539 [cs_check_lib_paths="| cs_lib_paths_default $3"])
540 m4_foreach([cs_check_lib_alias], [$1, $10],
541 [_CS_CHECK_LIB_CREATE_FLAGS([cs_check_lib_flags],
542 cs_check_lib_alias, [$cs_check_lib_paths])
545 CS_CHECK_BUILD([for lib$1], [cs_cv_lib$1], [$2], [$cs_check_lib_flags],
546 [$4], [], [], [$cs_ignore_cache], [$7], [$8], [$9])],
549 cs_cv_with_$1="$with_$1"
550 AS_IF([test "$cs_cv_lib$1" = yes], [$5], [$6])])
554 #------------------------------------------------------------------------------
555 # CS_CHECK_PKG_CONFIG
556 # Check if the `pkg-config' command is available and reasonably recent.
557 # This program acts as a central repository of build flags for various
558 # packages. For example, to determine the compiler flags for FreeType2
559 # use, "pkg-config --cflags freetype2"; and "pkg-config --libs freetype2"
560 # to determine the linker flags. If `pkg-config' is found and is
561 # sufficiently recent, PKG_CONFIG is set and AC_SUBST() invoked.
562 #------------------------------------------------------------------------------
563 m4_define([CS_PKG_CONFIG_MIN], [0.9.0])
564 AC_DEFUN([CS_CHECK_PKG_CONFIG],
565 [AS_IF([test "$cs_prog_pkg_config_checked" != yes],
566 [CS_CHECK_TOOLS([PKG_CONFIG], [pkg-config])
567 _CS_CHECK_PKG_CONFIG_PREPARE_PATH
568 cs_prog_pkg_config_checked=yes])
569 AS_IF([test -z "$cs_cv_prog_pkg_config_ok"],
570 [AS_IF([test -n "$PKG_CONFIG"],
571 [AS_IF([$PKG_CONFIG --atleast-pkgconfig-version=CS_PKG_CONFIG_MIN],
572 [cs_cv_prog_pkg_config_ok=yes],
573 [cs_cv_prog_pkg_config_ok=no])],
574 [cs_cv_prog_pkg_config_ok=no])])])
576 AC_DEFUN([_CS_CHECK_PKG_CONFIG_PREPARE_PATH],
577 [PKG_CONFIG_PATH="m4_foreach([cs_pkg_path], [cs_pkg_paths_default],
578 [cs_pkg_path$PATH_SEPARATOR])$PKG_CONFIG_PATH"
579 export PKG_CONFIG_PATH])
583 #------------------------------------------------------------------------------
584 # _CS_CHECK_LIB_PKG_CONFIG_FLAGS(VARIABLE, LIBRARY)
585 # Helper macro for CS_CHECK_LIB_WITH(). Checks if `pkg-config' knows
586 # about LIBRARY and, if so, appends a build tuple consisting of the
587 # compiler and linker flags reported by `pkg-config' to the list of
588 # tuples stored in the shell variable VARIABLE.
589 #------------------------------------------------------------------------------
590 AC_DEFUN([_CS_CHECK_LIB_PKG_CONFIG_FLAGS],
592 AS_IF([test $cs_cv_prog_pkg_config_ok = yes],
593 [AC_CACHE_CHECK([if $PKG_CONFIG recognizes $2], [_CS_CLPCF_CVAR([$2])],
594 [AS_IF([$PKG_CONFIG --exists $2],
595 [_CS_CLPCF_CVAR([$2])=yes], [_CS_CLPCF_CVAR([$2])=no])])
596 AS_IF([test $_CS_CLPCF_CVAR([$2]) = yes],
597 [_CS_CHECK_LIB_CONFIG_PROG_FLAGS([$1], [pkg_config_$2],
598 [$PKG_CONFIG], [$2])])])])
600 AC_DEFUN([_CS_CLPCF_CVAR], [AS_TR_SH([cs_cv_prog_pkg_config_$1])])
604 #------------------------------------------------------------------------------
605 # _CS_CHECK_LIB_CONFIG_FLAGS(VARIABLE, LIBRARY)
606 # Helper macro for CS_CHECK_LIB_WITH(). Checks if `LIBRARY-config'
607 # (i.e. `sdl-config') exists and, if so, appends a build tuple consisting
608 # of the compiler and linker flags reported by `LIBRARY-config' to the
609 # list of tuples stored in the shell variable VARIABLE.
610 #------------------------------------------------------------------------------
611 AC_DEFUN([_CS_CHECK_LIB_CONFIG_FLAGS],
612 [CS_CHECK_TOOLS(_CS_CLCF_SHVAR([$2]), [$2-config])
613 AS_IF([test -n "$_CS_CLCF_SHVAR([$2])"],
614 [AS_IF([test -z "$_CS_CLCF_CVAR([$2])"],
615 [AS_IF([$_CS_CLCF_SHVAR([$2]) --cflags --libs >/dev/null 2>&1],
616 [_CS_CLCF_CVAR([$2])=yes], [_CS_CLCF_CVAR([$2])=no])])
617 AS_IF([test $_CS_CLCF_CVAR([$2]) = yes],
618 [_CS_CHECK_LIB_CONFIG_PROG_FLAGS([$1], [config_$2],
619 [$_CS_CLCF_SHVAR([$2])])])])])
621 AC_DEFUN([_CS_CLCF_CVAR], [AS_TR_SH([cs_cv_prog_config_$1_ok])])
622 AC_DEFUN([_CS_CLCF_SHVAR], [m4_toupper(AS_TR_SH([CONFIG_$1]))])
626 #------------------------------------------------------------------------------
627 # _CS_CHECK_LIB_CONFIG_PROG_FLAGS(VARIABLE, TAG, CONFIG-PROGRAM, [ARGS])
628 # Helper macro for _CS_CHECK_LIB_PKG_CONFIG_FLAGS() and
629 # _CS_CHECK_LIB_CONFIG_FLAGS(). CONFIG-PROGRAM is a command which
630 # responds to the --cflags and --libs options and returns suitable
631 # compiler and linker flags for some package. ARGS, if supplied, is
632 # passed to CONFIG-PROGRAM after the --cflags or --libs argument. The
633 # results of the --cflags and --libs options are packed into a build
634 # tuple and appended to the list of tuples stored in the shell variable
635 # VARIABLE. TAG is used to compose the name of the cache variable. A good
636 # choice for TAG is some unique combination of the library name and
637 # configuration program.
638 #------------------------------------------------------------------------------
639 AC_DEFUN([_CS_CHECK_LIB_CONFIG_PROG_FLAGS],
640 [AS_IF([test -z "$_CS_CLCPF_CVAR([$2])"],
641 [cs_check_lib_cflag=CS_RUN_PATH_NORMALIZE([$3 --cflags $4])
642 cs_check_lib_lflag=''
643 cs_check_lib_libs=CS_RUN_PATH_NORMALIZE([$3 --libs $4])
644 _CS_CLCPF_CVAR([$2])=CS_CREATE_TUPLE(
645 [$cs_check_lib_cflag],
646 [$cs_check_lib_lflag],
647 [$cs_check_lib_libs])])
648 $1="$$1 $_CS_CLCPF_CVAR([$2])"])
650 AC_DEFUN([_CS_CLCPF_CVAR], [AS_TR_SH([cs_cv_prog_$1_flags])])
654 #------------------------------------------------------------------------------
655 # _CS_CHECK_LIB_CREATE_FLAGS(VARIABLE, LIBRARY, PATHS)
656 # Helper macro for CS_CHECK_LIB_WITH(). Constructs a list of build
657 # tuples suitable for CS_CHECK_BUILD() and appends the tuple list to the
658 # shell variable VARIABLE. LIBRARY and PATHS have the same meanings as
659 # the like-named arguments of CS_CHECK_LIB_WITH().
660 #------------------------------------------------------------------------------
661 AC_DEFUN([_CS_CHECK_LIB_CREATE_FLAGS],
662 [for cs_lib_item in $3
666 [$cs_lib_item], [cs_check_incdir,cs_check_libdir], [|])
667 _CS_CHECK_LIB_CREATE_FLAG([$1],
668 [$cs_check_incdir], [$cs_check_libdir], [$2])
670 *) _CS_CHECK_LIB_CREATE_FLAG([$1],
671 [$cs_lib_item/include], [$cs_lib_item/lib], [$2])
672 _CS_CHECK_LIB_CREATE_FLAG(
673 [$1], [$cs_lib_item], [$cs_lib_item], [$2])
680 #------------------------------------------------------------------------------
681 # _CS_CHECK_LIB_CREATE_FLAG(VARIABLE, HEADER-DIR, LIBRARY-DIR, LIBRARY)
682 # Helper macro for _CS_CHECK_LIB_CREATE_FLAGS(). Constructs build tuples
683 # suitable for CS_CHECK_BUILD() for given header and library directories,
684 # and appends the tuples to the shell variable VARIABLE. Synthesizes
685 # tuples which check for LIBRARY as a MacOS/X framework, and a standard
687 #------------------------------------------------------------------------------
688 AC_DEFUN([_CS_CHECK_LIB_CREATE_FLAG],
689 [AS_IF([test -n "$2"], [cs_check_lib_cflag="-I$2"], [cs_check_lib_cflag=''])
690 AS_IF([test -n "$3"], [cs_check_lib_lflag="-L$3"], [cs_check_lib_lflag=''])
691 AS_IF([test -n "$4"],
692 [cs_check_lib_libs="-l$4"
693 cs_check_lib_framework="-framework $4"],
694 [cs_check_lib_libs=''
695 cs_check_lib_framework=''])
698 [$cs_check_lib_cflag],
699 [$cs_check_lib_lflag],
700 [$cs_check_lib_framework])
702 [$cs_check_lib_cflag],
703 [$cs_check_lib_lflag],
704 [$cs_check_lib_libs])"])
705 # checklibtool.m4 -*- Autoconf -*-
706 #==============================================================================
707 # Copyright (C)2004 by Eric Sunshine <sunshine@sunshineco.com>
709 # This library is free software; you can redistribute it and/or modify it
710 # under the terms of the GNU Library General Public License as published by
711 # the Free Software Foundation; either version 2 of the License, or (at your
712 # option) any later version.
714 # This library is distributed in the hope that it will be useful, but
715 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
716 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
717 # License for more details.
719 # You should have received a copy of the GNU Library General Public License
720 # along with this library; if not, write to the Free Software Foundation,
721 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
723 #==============================================================================
726 #------------------------------------------------------------------------------
728 # Find and identify the various implementations of libtool. In
729 # particular, this macro is aware of GNU libtool and Apple's libtool
730 # (which serves a completely different purpose). On MacOS/X, GNU libtool
731 # is typically named glibtool, however a user might also use Fink to
732 # install the unadorned libtool; and the Fink-installed version might
733 # shadow Apple's own libtool if it appears in the PATH before the Apple
734 # tool. This macro jumps through the necessary hoops to distinguish and
735 # locate the various implementations. Sets the shell variable LIBTOOL to
736 # the located GNU libtool (if any), and APPLE_LIBTOOL to the located
737 # Apple libtool. Invokes AC_SUBST() for LIBTOOL and APPLE_LIBTOOL.
738 #------------------------------------------------------------------------------
739 AC_DEFUN([CS_CHECK_LIBTOOL],
740 [# GNU: Search for libtool before glibtool since Fink version is likely newer.
741 m4_define([cs_lt_path_gnu],
742 [/sw/bin$PATH_SEPARATOR/usr/local/bin$PATH_SEPARATOR$PATH])
743 AS_IF([test -z "$LIBTOOL"],
744 [CS_CHECK_TOOLS([LIBTOOL_TEST], [libtool glibtool gnulibtool], [],
746 AS_IF([test -n "$LIBTOOL_TEST"],
747 [CS_PATH_PROG([LIBTOOL_PATH], [$LIBTOOL_TEST], [], [cs_lt_path_gnu])
748 CS_LIBTOOL_CLASSIFY([$LIBTOOL_PATH],
749 [LIBTOOL="$LIBTOOL_PATH"],
750 [AS_IF([test -z "$APPLE_LIBTOOL"], [APPLE_LIBTOOL="$LIBTOOL_PATH"])
751 CS_CHECK_TOOLS([LIBTOOL], [glibtool gnulibtool])])])])
754 # Apple: Ensure that Apple libtool will be found before GNU libtool from Fink.
755 m4_define([cs_lt_path_apple],[/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH])
756 AS_IF([test -z "$APPLE_LIBTOOL"],
757 [CS_PATH_PROG([CS_LT_APPLE], [libtool], [], [cs_lt_path_apple])
758 CS_LIBTOOL_CLASSIFY([$CS_LT_APPLE], [],
759 [APPLE_LIBTOOL="$CS_LT_APPLE"])])
760 AC_SUBST([APPLE_LIBTOOL])])
762 AC_DEFUN([CS_LIBTOOL_CLASSIFY],
763 [AS_IF([test -n "$1"],
764 [AC_MSG_CHECKING([classification of $1])
765 CS_LIBTOOL_GNU_IFELSE([$1],
766 [AC_MSG_RESULT([gnu])
768 [AC_MSG_RESULT([apple])
771 AC_DEFUN([CS_LIBTOOL_GNU_IFELSE],
772 [AS_IF([AC_RUN_LOG([$1 --version 1>&2])], [$2], [$3])])
773 #==============================================================================
774 # Copyright (C)2003-2006 by Eric Sunshine <sunshine@sunshineco.com>
776 # This library is free software; you can redistribute it and/or modify it
777 # under the terms of the GNU Library General Public License as published by
778 # the Free Software Foundation; either version 2 of the License, or (at your
779 # option) any later version.
781 # This library is distributed in the hope that it will be useful, but
782 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
783 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
784 # License for more details.
786 # You should have received a copy of the GNU Library General Public License
787 # along with this library; if not, write to the Free Software Foundation,
788 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
790 #==============================================================================
793 #------------------------------------------------------------------------------
797 # IMPLEMENTATION NOTES
799 # Some Mesa installations require pthread, so pthread flags are employed if
802 # The check for opengl32 needs to precede other checks because Cygwin users
803 # often have Mesa installed, and Mesa's OpenGL library is compiled without the
804 # __stdcall flags which results in link errors, whereas Microsoft's native
805 # opengl32 works fine. Conversely, some Unix implementations have Wine
806 # installed (Windows emulation layer) which includes an opengl32.so library.
807 # We need to avoid detection of this library on Unix since it would cause an
808 # undesirable dependence upon Wine.
810 # Many OpenGL libraries on Unix already contain GLX, so there is no separate
811 # GLX library, thus we first check for GLX using the discovered OpenGL library
812 # before attempting to locate a separate GLX-specific library.
814 # On MacOS/X, some users have XFree86 installed which creates a link from
815 # /usr/include/GL to /usr/X11R6/include/GL. We want to ignore this directory
816 # and instead check for Apple's OpenGL.framework, if we are not cross-building
817 # for Darwin. We accomplish this by placing the OpenGL.framework test ahead of
820 # At least one user (Jorrit) has a strange installation in which inclusion of
821 # <windows.h> fails if an int32 is not present, thus we must take this into
823 #------------------------------------------------------------------------------
824 m4_define([cs_define_int32],
825 [[#if !HAVE_TYPE_INT32
830 # CS_GL_INCLUDE(CPP-MACRO,FALLBACK,HEADER)
831 AC_DEFUN([CS_GL_INCLUDE],
838 #ifndef CS_HEADER_GLOBAL
839 #define CS_HEADER_GLOBAL(X,Y) CS_HEADER_GLOBAL_COMPOSE(X,Y)
840 #define CS_HEADER_GLOBAL_COMPOSE(X,Y) <X/Y>
843 #include CS_HEADER_GLOBAL($1,$3)
848 AC_DEFUN([CS_CHECK_OPENGL],
849 [AC_REQUIRE([CS_CHECK_HOST])
850 AC_REQUIRE([CS_CHECK_COMMON_LIBS])
851 AC_REQUIRE([CS_CHECK_PTHREAD])
852 AC_REQUIRE([AC_PATH_X])
853 AC_REQUIRE([AC_PATH_XTRA])
854 AC_CHECK_TYPE([int32], [AC_DEFINE([HAVE_TYPE_INT32], [],
855 [Whether the int32 type is available])], [])
856 AC_CHECK_HEADERS([windows.h], [], [], [cs_define_int32])
858 # Apply plaform-specific flags if necessary.
862 AS_IF([test -n "$cs_cv_libm_cflags$cs_cv_libm_lflags$cs_cv_libm_libs"],
863 [cs_gl_plat_cflags="$cs_cv_libm_cflags $cs_gl_plat_cflags"
864 cs_gl_plat_lflags="$cs_cv_libm_lflags $cs_gl_plat_lflags"
865 cs_gl_plat_libs="$cs_cv_libm_libs $cs_gl_plat_libs"])
866 AS_IF([test $cs_cv_sys_pthread = yes],
867 [cs_gl_plat_cflags="$cs_cv_sys_pthread_cflags $cs_gl_plat_cflags"
868 cs_gl_plat_lflags="$cs_cv_sys_pthread_lflags $cs_gl_plat_lflags"
869 cs_gl_plat_libs="$cs_cv_sys_pthread_libs $cs_gl_plat_libs"])
870 AS_IF([test "$no_x" != yes],
871 [cs_gl_plat_cflags="$X_CFLAGS $cs_gl_plat_cflags"
872 cs_gl_plat_lflags="$cs_gl_plat_lflags"
874 $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS $cs_gl_plat_libs"])
877 AC_ARG_WITH([mesa], [AC_HELP_STRING([--with-mesa],
878 [use Mesa OpenGL library if available (default YES)])],
881 AS_IF([test $with_mesa != no],
882 [cs_mesa_gl=CS_CREATE_TUPLE([],[],[-lMesaGL])])
885 AS_IF([test "x$cs_host_macosx" = "xyes"],
886 [cs_osx_gl=CS_CREATE_TUPLE([-DCS_OPENGL_PATH=OpenGL],[],[-framework OpenGL])])
887 AS_IF([test "x$cs_host_macosx" = "xyes"],
888 [cs_gl_plat_lflags="$cs_plat_lflags -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"])
891 AS_IF([test $cs_host_family = windows],
892 [cs_win32_gl=CS_CREATE_TUPLE([],[],[-lopengl32])])
895 CS_CHECK_BUILD([for OpenGL], [cs_cv_libgl],
896 [AC_LANG_PROGRAM([CS_GL_INCLUDE([CS_OPENGL_PATH],[GL],[gl.h])],[glEnd()])],
899 CS_CREATE_TUPLE([],[],[-lGL]) \
900 CS_CREATE_TUPLE([],[],[-lgl]) \
902 [CS_EMIT_BUILD_RESULT([cs_cv_libgl], [GL])], [], [],
903 [$cs_gl_plat_cflags], [$cs_gl_plat_lflags], [$cs_gl_plat_libs])])
906 #------------------------------------------------------------------------------
909 #------------------------------------------------------------------------------
910 AC_DEFUN([CS_CHECK_GLU],
911 [AC_REQUIRE([CS_CHECK_OPENGL])
912 AS_IF([test $cs_cv_libgl = yes],
913 [AS_IF([test $with_mesa != no],
914 [cs_mesa_glu=CS_CREATE_TUPLE([],[],[-lMesaGLU])])
917 AS_IF([test "x$cs_host_macosx" = "xyes"],
918 [cs_osx_glu=CS_CREATE_TUPLE([-DCS_GLU_PATH=OpenGL],[],[-framework OpenGL])])
921 AS_IF([test $cs_host_family = windows],
922 [cs_win32_glu=CS_CREATE_TUPLE([],[],[-lglu32])])
925 CS_CHECK_BUILD([for GLU], [cs_cv_libglu],
927 [CS_GL_INCLUDE([CS_GLU_PATH],[GL],[glu.h])], [gluNewQuadric()])],
931 CS_CREATE_TUPLE([],[],[-lGLU]) \
932 CS_CREATE_TUPLE([],[],[-lglu]) \
934 [CS_EMIT_BUILD_RESULT([cs_cv_libglu], [GLU])], [], [],
935 [$cs_cv_libgl_cflags], [$cs_cv_libgl_lflags], [$cs_cv_libgl_libs])])])
938 #------------------------------------------------------------------------------
941 #------------------------------------------------------------------------------
942 AC_DEFUN([CS_CHECK_GLX],
943 [AC_REQUIRE([CS_CHECK_OPENGL])
944 AS_IF([test $cs_cv_libgl = yes],
945 [AS_IF([test $with_mesa != no],
946 [cs_mesa_glx=CS_CREATE_TUPLE([],[],[-lMesaGLX])])
949 AS_IF([test "$no_x" != yes],
950 [CS_CHECK_BUILD([for GLX], [cs_cv_libglx],
951 [AC_LANG_PROGRAM([[#include <GL/glx.h>]], [glXWaitGL()])],
953 CS_CREATE_TUPLE([],[],[-lGLX]) \
954 CS_CREATE_TUPLE([],[],[-lglx]) \
956 [CS_EMIT_BUILD_RESULT([cs_cv_libglx], [GLX])], [], [],
957 [$cs_cv_libgl_cflags], [$cs_cv_libgl_lflags], [$cs_cv_libgl_libs])])])])
960 #------------------------------------------------------------------------------
961 # CS_CHECK_GLXEXT([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
962 # Check for GLX extensions.
963 #------------------------------------------------------------------------------
964 AC_DEFUN([CS_CHECK_GLXEXT],
965 [AC_REQUIRE([CS_CHECK_GLX])
966 AS_IF([test x$cs_cv_libglx = "xyes"],
967 [# Check for GLX extensions.
968 CS_CHECK_BUILD([for GLX extensions], [cs_cv_libglx_extensions],
970 [[#define GLX_GLXEXT_PROTOTYPES
971 #include <GL/glx.h>]],
972 [glXGetProcAddressARB(0)])],
974 [$cs_cv_libglx_cflags],
975 [$cs_cv_libglx_lflags],
976 [$cs_cv_libglx_libs])],
981 #------------------------------------------------------------------------------
984 #------------------------------------------------------------------------------
985 AC_DEFUN([CS_CHECK_GLUT],
986 [AC_REQUIRE([CS_CHECK_GLU])
987 AS_IF([test x$cs_cv_libglu = "xyes"],
988 [# MacOS/X or Darwin?
989 AS_IF([test "x$cs_host_macosx" = "xyes"],
990 [cs_osx_glut=CS_CREATE_TUPLE([-DCS_GLUT_PATH=GLUT],[],[-framework GLUT])])
993 AS_IF([test $cs_host_family = windows],
994 [cs_win32_glut=CS_CREATE_TUPLE([],[],[-lglut32])])
997 CS_CHECK_BUILD([for GLUT], [cs_cv_libglut],
999 [CS_GL_INCLUDE([CS_GLUT_PATH],[GL],[glut.h])], [glutSwapBuffers()])],
1003 CS_CREATE_TUPLE([],[],[-lGLUT]) \
1004 CS_CREATE_TUPLE([],[],[-lglut])], [],
1005 [CS_EMIT_BUILD_RESULT([cs_cv_libglut], [GLUT])], [], [],
1006 [$cs_cv_libgl_cflags $cs_cv_libglu_cflags],
1007 [$cs_cv_libgl_lflags $cs_cv_libglu_lflags],
1008 [$cs_cv_libgl_libs $cs_cv_libglu_libs])])])
1010 # checkpic.m4 -*- Autoconf -*-
1011 #==============================================================================
1012 # Copyright (C)2005 by Eric Sunshine <sunshine@sunshineco.com>
1014 # This library is free software; you can redistribute it and/or modify it
1015 # under the terms of the GNU Library General Public License as published by
1016 # the Free Software Foundation; either version 2 of the License, or (at your
1017 # option) any later version.
1019 # This library is distributed in the hope that it will be useful, but
1020 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1021 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
1022 # License for more details.
1024 # You should have received a copy of the GNU Library General Public License
1025 # along with this library; if not, write to the Free Software Foundation,
1026 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1028 #==============================================================================
1031 #------------------------------------------------------------------------------
1032 # CS_COMPILER_PIC([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND],
1033 # [ACTION-IF-NOT-FOUND])
1034 # Check if compiler can be instructed to produce
1035 # position-independent-code (PIC). This feature is required by some
1036 # platforms when building plugin modules and shared libraries. If
1037 # LANGUAGE is not provided, then `C' is assumed (other options include
1038 # `C++'). If CACHE-VAR is not provided, then it defaults to the name
1039 # "cs_cv_prog_compiler_pic". If a PIC-enabling option (such as `-fPIC')
1040 # is discovered, then it is assigned to CACHE-VAR and ACTION-IF-FOUND is
1041 # invoked; otherwise the empty string is assigned to CACHE-VAR and
1042 # ACTION-IF-NOT-FOUND is invoked.
1044 # IMPLEMENTATION NOTES
1046 # On some platforms (such as Windows), the -fPIC option is superfluous
1047 # and emits a warning "-fPIC ignored for target (all code is position
1048 # independent)", despite the fact that the compiler accepts the option
1049 # and returns a success code. We want to re-interpret the warning as a
1050 # failure in order to avoid unnecessary compiler diagnostics in case the
1051 # client inserts the result of this check into CFLAGS, for instance. We
1052 # do so by attempting to promote warnings to errors using the result of
1053 # CS_COMPILER_ERRORS(). As an extra safe-guard, we also scan the compiler
1054 # output for an appropriate diagnostic because some gcc warnings fail to
1055 # promote to error status despite use of -Werror.
1056 #------------------------------------------------------------------------------
1057 AC_DEFUN([CS_COMPILER_PIC],
1058 [CS_COMPILER_ERRORS([$1],
1059 [m4_default([$2_werror],[cs_cv_prog_compiler_pic_werror])])
1060 CS_CHECK_BUILD_FLAGS(
1061 [how to enable m4_default([$1],[C]) PIC generation],
1062 [m4_default([$2],[cs_cv_prog_compiler_pic])],
1063 [CS_CREATE_TUPLE([-fPIC])], [$1], [$3], [$4],
1064 [m4_default([$$2_werror],[$cs_cv_prog_compiler_pic_werror])], [], [],
1067 # Backward-compatiblity alias.
1068 AC_DEFUN([CS_CHECK_COMPILER_PIC], [CS_COMPILER_PIC([$1],[$2],[$3],[$4])])
1069 # checkprog.m4 -*- Autoconf -*-
1070 #==============================================================================
1071 # Copyright (C)2004 by Eric Sunshine <sunshine@sunshineco.com>
1073 # This library is free software; you can redistribute it and/or modify it
1074 # under the terms of the GNU Library General Public License as published by
1075 # the Free Software Foundation; either version 2 of the License, or (at your
1076 # option) any later version.
1078 # This library is distributed in the hope that it will be useful, but
1079 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1080 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
1081 # License for more details.
1083 # You should have received a copy of the GNU Library General Public License
1084 # along with this library; if not, write to the Free Software Foundation,
1085 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1087 #==============================================================================
1090 #------------------------------------------------------------------------------
1091 # cs_bin_paths_default
1092 # Comma delimited list of additional directories in which tools and
1093 # commands might be found.
1096 # /usr/local/bin -- Although a common location for executables, it is
1097 # now-and-then absent from the default PATH setting.
1098 # /sw/bin -- Fink, the MacOS/X manager of Unix packages, installs
1100 #------------------------------------------------------------------------------
1101 m4_define([cs_bin_paths_default], [/usr/local/bin, /sw/bin])
1104 #------------------------------------------------------------------------------
1105 # CS_CHECK_PROG(VARIABLE, PROGRAM, VALUE-IF-FOUND, [VALUE-IF-NOT-FOUND],
1107 # Simple wrapper for AC_CHECK_PROG() which ensures that the search path
1108 # is augmented by the directories mentioned in cs_bin_paths_default.
1109 #------------------------------------------------------------------------------
1110 AC_DEFUN([CS_CHECK_PROG],
1111 [_CS_PROG_PATH_PREPARE
1112 AC_CHECK_PROG([$1], [$2], [$3], [$4],
1113 m4_ifval([$5], [_CS_PROG_CLIENT_PATH([$5])]), [$6])])
1116 #------------------------------------------------------------------------------
1117 # CS_CHECK_PROGS(VARIABLE, PROGRAMS, [VALUE-IF-NOT-FOUND], [PATH])
1118 # Simple wrapper for AC_CHECK_PROGS() which ensures that the search path
1119 # is augmented by the directories mentioned in cs_bin_paths_default.
1120 #------------------------------------------------------------------------------
1121 AC_DEFUN([CS_CHECK_PROGS],
1122 [_CS_PROG_PATH_PREPARE
1123 AC_CHECK_PROGS([$1], [$2], [$3],
1124 m4_ifval([$4], [_CS_PROG_CLIENT_PATH([$4])]))])
1127 #------------------------------------------------------------------------------
1128 # CS_CHECK_TOOL(VARIABLE, TOOL, [VALUE-IF-NOT-FOUND], [PATH])
1129 # Simple wrapper for AC_CHECK_TOOL() which ensures that the search path
1130 # is augmented by the directories mentioned in cs_bin_paths_default.
1131 #------------------------------------------------------------------------------
1132 AC_DEFUN([CS_CHECK_TOOL],
1133 [_CS_PROG_PATH_PREPARE
1134 AC_CHECK_TOOL([$1], [$2], [$3],
1135 m4_ifval([$4], [_CS_PROG_CLIENT_PATH([$4])]))])
1138 #------------------------------------------------------------------------------
1139 # CS_CHECK_TOOLS(VARIABLE, TOOLS, [VALUE-IF-NOT-FOUND], [PATH])
1140 # Simple wrapper for AC_CHECK_TOOLS() which ensures that the search path
1141 # is augmented by the directories mentioned in cs_bin_paths_default.
1142 #------------------------------------------------------------------------------
1143 AC_DEFUN([CS_CHECK_TOOLS],
1144 [_CS_PROG_PATH_PREPARE
1145 AC_CHECK_TOOLS([$1], [$2], [$3],
1146 m4_ifval([$4], [_CS_PROG_CLIENT_PATH([$4])]))])
1149 #------------------------------------------------------------------------------
1150 # CS_PATH_PROG(VARIABLE, PROGRAM, [VALUE-IF-NOT-FOUND], [PATH])
1151 # Simple wrapper for AC_PATH_PROG() which ensures that the search path
1152 # is augmented by the directories mentioned in cs_bin_paths_default.
1153 #------------------------------------------------------------------------------
1154 AC_DEFUN([CS_PATH_PROG],
1155 [_CS_PROG_PATH_PREPARE
1156 AC_PATH_PROG([$1], [$2], [$3],
1157 m4_ifval([$4], [_CS_PROG_CLIENT_PATH([$4])]))])
1160 #------------------------------------------------------------------------------
1161 # CS_PATH_PROGS(VARIABLE, PROGRAMS, [VALUE-IF-NOT-FOUND], [PATH])
1162 # Simple wrapper for AC_PATH_PROGS() which ensures that the search path
1163 # is augmented by the directories mentioned in cs_bin_paths_default.
1164 #------------------------------------------------------------------------------
1165 AC_DEFUN([CS_PATH_PROGS],
1166 [_CS_PROG_PATH_PREPARE
1167 AC_PATH_PROGS([$1], [$2], [$3],
1168 m4_ifval([$4], [_CS_PROG_CLIENT_PATH([$4])]))])
1171 #------------------------------------------------------------------------------
1172 # CS_PATH_TOOL(VARIABLE, TOOL, [VALUE-IF-NOT-FOUND], [PATH])
1173 # Simple wrapper for AC_PATH_TOOL() which ensures that the search path
1174 # is augmented by the directories mentioned in cs_bin_paths_default.
1175 #------------------------------------------------------------------------------
1176 AC_DEFUN([CS_PATH_TOOL],
1177 [_CS_PROG_PATH_PREPARE
1178 AC_PATH_TOOL([$1], [$2], [$3],
1179 m4_ifval([$4], [_CS_PROG_CLIENT_PATH([$4])]))])
1182 #------------------------------------------------------------------------------
1183 # _CS_PROG_PATH_PREPARE
1184 # Ensure that the PATH environment variable mentions the set of
1185 # directories listed in cs_bin_paths_default. These directories may not
1186 # appear by default in the typical PATH, yet they might be common
1187 # locations for tools and commands.
1188 #------------------------------------------------------------------------------
1189 AC_DEFUN([_CS_PROG_PATH_PREPARE],
1190 [AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])
1191 AS_IF([test "$cs_prog_path_prepared" != yes],
1192 [cs_prog_path_prepared=yes
1193 PATH="$PATH[]m4_foreach([cs_bin_path], [cs_bin_paths_default],
1194 [$PATH_SEPARATOR[]cs_bin_path])"
1198 #------------------------------------------------------------------------------
1199 # _CS_PROG_CLIENT_PATH(CLIENT-PATH)
1200 # Given a client-supplied replacement for PATH, augment the list by
1201 # appending the locations mentioned in cs_bin_paths_default.
1202 #------------------------------------------------------------------------------
1203 AC_DEFUN([_CS_PROG_CLIENT_PATH],
1204 [AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])dnl
1205 $1[]m4_foreach([cs_bin_path], [cs_bin_paths_default],
1206 [$PATH_SEPARATOR[]cs_bin_path])])
1207 # checkpthread.m4 -*- Autoconf -*-
1208 #==============================================================================
1209 # Copyright (C)2003-2005 by Eric Sunshine <sunshine@sunshineco.com>
1211 # This library is free software; you can redistribute it and/or modify it
1212 # under the terms of the GNU Library General Public License as published by
1213 # the Free Software Foundation; either version 2 of the License, or (at your
1214 # option) any later version.
1216 # This library is distributed in the hope that it will be useful, but
1217 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1218 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
1219 # License for more details.
1221 # You should have received a copy of the GNU Library General Public License
1222 # along with this library; if not, write to the Free Software Foundation,
1223 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1225 #==============================================================================
1228 #------------------------------------------------------------------------------
1229 # CS_CHECK_PTHREAD([REJECT-MASK])
1230 # Check for pthread. Also check if the pthread implementation supports
1231 # the recursive and timed mutex extensions. (Timed mutexes are needed for
1232 # the NPTL: New Posix Thread Library on GNU/Linux if the mutex is going
1233 # to be used with any of the timed condition-wait functions.) The shell
1234 # variable cs_cv_sys_pthread is set to "yes" if pthread is available,
1235 # else "no". If available, then the variables cs_cv_sys_pthread_cflags,
1236 # cs_cv_sys_pthread_lflags, and cs_cv_sys_pthread_libs are set. (As a
1237 # convenience, these variables can be emitted to an output file with
1238 # CS_EMIT_BUILD_RESULT() by passing "cs_cv_sys_pthread" as its CACHE-VAR
1239 # argument.) If the recursive mutex extension is supported, then
1240 # cs_cv_sys_pthread_mutex_recursive will be set with the literal name of
1241 # the constant which must be passed to pthread_mutexattr_settype() to
1242 # enable this feature. The constant name will be typically
1243 # PTHREAD_MUTEX_RECURSIVE or PTHREAD_MUTEX_RECURSIVE_NP. If the recursive
1244 # mutex extension is not available, then
1245 # cs_cv_sys_pthread_mutex_recursive will be set to "no". If the timed
1246 # mutex extension is supported, then cs_cv_sys_pthread_mutex_timed will
1247 # be set with the literal name of the constant which must be passed to
1248 # pthread_mutexattr_settype() to enable this feature. The constant name
1249 # will be typically PTHREAD_MUTEX_TIMED or PTHREAD_MUTEX_TIMED_NP. If the
1250 # timed mutex extension is not available, then
1251 # cs_cv_sys_pthread_mutex_timed will be set to "no". REJECT-MASK can be
1252 # used to limit the platforms on which the pthread test is performed. It
1253 # is compared against $host_os; matches are rejected. If omitted, then
1254 # the test is performed on all platforms. Examples: To avoid testing on
1255 # Cygwin, use "cygwin*"; to avoid testing on Cygwin and AIX, use
1257 #------------------------------------------------------------------------------
1258 AC_DEFUN([CS_CHECK_PTHREAD],
1259 [AC_REQUIRE([AC_CANONICAL_HOST])
1263 cs_cv_sys_pthread=no
1267 CS_CHECK_BUILD([for pthread], [cs_cv_sys_pthread],
1269 [[#include <pthread.h>
1270 #include <semaphore.h>
1271 void* worker(void* p) { (void)p; return p; }]],
1274 pthread_create(&tid, 0, worker, 0);
1275 sem_init(&sem, 0, 0);
1276 sem_destroy(&sem);])],
1280 _CS_CHECK_MUTEX_FEATURE([PTHREAD_MUTEX_RECURSIVE],
1281 [cs_cv_sys_pthread_mutex_recursive], [for pthread recursive mutexes])])
1283 # _CS_CHECK_MUTEX_FEATURE(FEATURE, CACHE-VAR, MESSAGE)
1284 AC_DEFUN([_CS_CHECK_MUTEX_FEATURE],
1285 [AS_IF([test $cs_cv_sys_pthread = yes],
1286 [AC_CACHE_CHECK([$3], [$2],
1289 [[#include <pthread.h>]],
1290 [pthread_mutexattr_t attr;
1291 pthread_mutexattr_settype(&attr, CS_MUTEX_FEATURE);])],
1292 [CS_CREATE_TUPLE([-DCS_MUTEX_FEATURE=$1]) \
1293 CS_CREATE_TUPLE([-DCS_MUTEX_FEATURE=$1_NP])],
1295 [$2=`echo $cs_build_cflags | sed 's/.*\($1_*N*P*\).*/\1/'`],
1297 [$cs_cv_sys_pthread_cflags -D_GNU_SOURCE],
1298 [$cs_cv_sys_pthread_lflags],
1299 [$cs_cv_sys_pthread_libs])])],
1302 #------------------------------------------------------------------------------
1303 # CS_CHECK_PTHREAD_ATFORK(CACHE-VAR)
1304 # Checks whether the pthread library contains pthread_atfork(). Sets
1305 # CACHE-VAR to "yes" or "no", according to the test result.
1306 #------------------------------------------------------------------------------
1307 AC_DEFUN([CS_CHECK_PTHREAD_ATFORK],
1308 [AS_IF([test $cs_cv_sys_pthread = yes],
1309 [AC_CACHE_CHECK([for pthread_atfork support], [$1],
1312 [[#include <pthread.h>]],
1313 [pthread_atfork (0, 0, 0);])],
1316 [$cs_cv_sys_pthread_cflags -D_GNU_SOURCE],
1317 [$cs_cv_sys_pthread_lflags],
1318 [$cs_cv_sys_pthread_libs])])],
1321 m4_define([cs_pthread_flags],
1322 [CS_CREATE_TUPLE() \
1323 CS_CREATE_TUPLE([], [], [-lpthread]) \
1324 CS_CREATE_TUPLE([], [], [-lpthread -lrt]) \
1325 CS_CREATE_TUPLE([-pthread], [-pthread], []) \
1326 CS_CREATE_TUPLE([-pthread], [-pthread], [-lpthread]) \
1327 CS_CREATE_TUPLE([-pthread], [-pthread], [-lc_r])])
1328 # checktt2.m4 -*- Autoconf -*-
1329 #==============================================================================
1330 # Copyright (C)2004,2005 by Eric Sunshine <sunshine@sunshineco.com>
1332 # This library is free software; you can redistribute it and/or modify it
1333 # under the terms of the GNU Library General Public License as published by
1334 # the Free Software Foundation; either version 2 of the License, or (at your
1335 # option) any later version.
1337 # This library is distributed in the hope that it will be useful, but
1338 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1339 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
1340 # License for more details.
1342 # You should have received a copy of the GNU Library General Public License
1343 # along with this library; if not, write to the Free Software Foundation,
1344 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1346 #==============================================================================
1349 #------------------------------------------------------------------------------
1350 # CS_CHECK_TEMPLATE_TOOLKIT2([EMITTER])
1351 # Check if Template Toolkit 2 (http://www.tt2.org/) is available. The
1352 # shell variable cs_cv_perl_tt2 is set to "yes" if the package is
1353 # discovered, else "no". Also sets the shell variable TTREE to the name
1354 # path of the 'ttree' utility program and invokes AC_SUBST(). If EMITTER
1355 # is provided and the package was discovered, then
1356 # CS_EMIT_BUILD_PROPERTY() is invoked with EMITTER in order to record the
1357 # value of the TTREE variable in an output file. As a convenience, if
1358 # EMITTER is the literal value "emit" or "yes", then
1359 # CS_EMIT_BUILD_RESULT()'s default emitter will be used.
1360 #------------------------------------------------------------------------------
1361 AC_DEFUN([CS_CHECK_TEMPLATE_TOOLKIT2],
1362 [CS_CHECK_PROGS([PERL], [perl5 perl])
1363 AS_IF([test -n "$PERL"],
1364 [AC_CACHE_CHECK([for TemplateToolkit], [cs_cv_perl_tt2],
1366 [$PERL -M'Template 2.11' -MTemplate::Plugin -e 0 1>&2])],
1367 [cs_cv_perl_tt2=yes],
1368 [cs_cv_perl_tt2=no])])
1369 CS_PATH_PROGS([TTREE], [ttree])
1370 AS_IF([test $cs_cv_perl_tt2 = yes && test -n "$TTREE"],
1371 [CS_EMIT_BUILD_PROPERTY([TTREE], [$TTREE], [], [],
1372 CS_EMITTER_OPTIONAL([$1]))])])])
1373 # compiler.m4 -*- Autoconf -*-
1374 #=============================================================================
1375 # Copyright (C)2003 by Matze Braun <matze@braunis.de>
1377 # This library is free software; you can redistribute it and/or modify it
1378 # under the terms of the GNU Library General Public License as published by
1379 # the Free Software Foundation; either version 2 of the License, or (at your
1380 # option) any later version.
1382 # This library is distributed in the hope that it will be useful, but
1383 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1384 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
1385 # License for more details.
1387 # You should have received a copy of the GNU Library General Public License
1388 # along with this library; if not, write to the Free Software Foundation,
1389 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1391 #=============================================================================
1393 #-----------------------------------------------------------------------------
1394 # Detection of C and C++ compilers and setting flags
1397 # Detects the C compiler. Also takes care of the CFLAGS, CPPFLAGS and CC
1398 # environment variables. This will filter out all -g and -O from the
1399 # CFLAGS variable because Autoconf's -g and -O defaults are not always
1400 # desired. This will also set the CMD.CC and COMPILER.CFLAGS variables
1403 # Detects the C++ compiler. Also takes care of the CXXFLAGS, CPPFLAGS
1404 # and CXX environment variables. This will filter out all -g and -O from
1405 # the CXXFLAGS variable because Autoconf's -g and -O defaults are not
1406 # always desired. This will also set the CMD.C++ and COMPILER.C++FLAGS
1407 # variables in Jamconfig
1409 # Tries to determine a linker. This is done by checking if a C++ or
1410 # Objecctive-C++ compiler is available in which case it is used for
1411 # linking; otherwise the C or Objective-C compiler is used. This also
1412 # sets the CMD.LINK and COMPILER.LFLAGS variables in Jamconfig and
1413 # respects the LDFLAGS environment variable. Finally, checks if linker
1414 # recognizes -shared and sets PLUGIN.LFLAGS; and checks if linker
1415 # recognizes -soname and sets PLUGIN.LFLAGS.USE_SONAME to "yes".
1416 #-----------------------------------------------------------------------------
1417 AC_DEFUN([CS_PROG_CC],[
1418 CFLAGS="$CFLAGS" # Filter undesired flags
1419 AS_IF([test -n "$CC"],[
1420 CS_EMIT_BUILD_PROPERTY([CMD.CC], [$CC])
1421 CS_EMIT_BUILD_PROPERTY([COMPILER.CFLAGS], [$CPPFLAGS $CFLAGS], [+])
1423 # Check if compiler recognizes -pipe directive.
1424 CS_EMIT_BUILD_FLAGS([if $CC accepts -pipe], [cs_cv_prog_cc_pipe],
1425 [CS_CREATE_TUPLE([-pipe])], [C], [COMPILER.CFLAGS], [+])
1429 AC_DEFUN([CS_PROG_CXX],[
1430 CXXFLAGS="$CXXFLAGS" # Filter undesired flags
1431 AS_IF([test -n "$CXX"],[
1432 CS_EMIT_BUILD_PROPERTY([CMD.C++], [$CXX])
1434 CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS], [$CPPFLAGS $CXXFLAGS], [+])
1436 # Check if compiler can be instructed to produce position-independent-code
1437 # (PIC). This feature is required by some platforms when building plugin
1438 # modules and shared libraries.
1439 CS_COMPILER_PIC([C++], [cs_cv_prog_cxx_pic],
1440 [CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS.PIC],
1441 [$cs_cv_prog_cxx_pic])])
1445 AC_DEFUN([CS_PROG_LINK],[
1446 AC_REQUIRE([CS_PROG_CXX])
1447 AS_IF([test -n "$CXX"],
1448 [CS_EMIT_BUILD_PROPERTY([CMD.LINK], [AS_ESCAPE([$(CMD.C++)])])],
1449 [CS_EMIT_BUILD_PROPERTY([CMD.LINK], [AS_ESCAPE([$(CMD.CC)])])])
1451 CS_EMIT_BUILD_PROPERTY([COMPILER.LFLAGS], [$LDFLAGS], [+])
1453 # Check if compiler/linker recognizes -shared directive which is needed for
1454 # linking plugin modules. Unfortunately, the Apple compiler (and possibly
1455 # others) requires extra effort. Even though the compiler does not recognize
1456 # the -shared option, it nevertheless returns a "success" result after emitting
1457 # the warning "unrecognized option `-shared'". Worse, even -Werror fails to
1458 # promote the warning to an error, so we must instead scan the compiler's
1459 # output for an appropriate diagnostic.
1460 CS_CHECK_BUILD_FLAGS([if -shared is accepted], [cs_cv_prog_link_shared],
1461 [CS_CREATE_TUPLE([-shared $cs_cv_prog_cxx_pic])], [C++],
1462 [CS_EMIT_BUILD_PROPERTY([PLUGIN.LFLAGS], [-shared], [+])], [],
1463 [], [], [], [shared])
1465 # Check if linker recognizes -soname which is used to assign a name internally
1466 # to plugin modules.
1467 CS_CHECK_BUILD([if -soname is accepted], [cs_cv_prog_link_soname], [],
1468 [CS_CREATE_TUPLE([-Wl,-soname,foobar])], [C++],
1469 [CS_EMIT_BUILD_PROPERTY([PLUGIN.LFLAGS.USE_SONAME], [yes])])
1471 #------------------------------------------------------------------------------
1472 # Determine host platform. Recognized families: Unix, Windows, MacOS/X.
1473 # Orginial Macros Copyright (C)2003 Eric Sunshine <sunshine@sunshineco.com>
1475 # This library is free software; you can redistribute it and/or modify it
1476 # under the terms of the GNU Library General Public License as published by
1477 # the Free Software Foundation; either version 2 of the License, or (at your
1478 # option) any later version.
1480 # This library is distributed in the hope that it will be useful, but
1481 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1482 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
1483 # License for more details.
1485 # You should have received a copy of the GNU Library General Public License
1486 # along with this library; if not, write to the Free Software Foundation,
1487 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1489 #------------------------------------------------------------------------------
1491 #------------------------------------------------------------------------------
1492 # Determine host CPU.
1495 # Set the shell variable cs_host_cpu to a normalized form of the CPU name
1496 # returned by config.guess/config.sub. Typically, Crystal Space's
1497 # conception of CPU name is the same as that returned by
1498 # config.guess/config.sub, but there may be exceptions as seen in the
1499 # `case' statement. Also takes the normalized name, uppercases it to
1500 # form a name suitable for the C preprocessor. Additionally sets the
1501 # TARGET.PROCESSOR Jamconfig property.
1502 #------------------------------------------------------------------------------
1503 AC_DEFUN([CS_CHECK_HOST_CPU],
1504 [AC_REQUIRE([AC_CANONICAL_HOST])
1506 [[Ii][3-9]86*|[Xx]86*]) cs_host_cpu=x86 ;;
1507 *) cs_host_cpu=$host_cpu ;;
1509 cs_host_cpu_normalized="AS_TR_CPP([$cs_host_cpu])"
1510 CS_JAMCONFIG_PROPERTY([TARGET.PROCESSOR], [$cs_host_cpu_normalized])
1514 #------------------------------------------------------------------------------
1516 # Sets the shell variables cs_host_target cs_host_family,
1517 # cs_host_os_normalized, and cs_host_os_normalized_uc. Emits appropriate
1518 # CS_PLATFORM_UNIX, CS_PLATFORM_WIN32, CS_PLATFORM_MACOSX via
1519 # AC_DEFINE(), and TARGET.OS and TARGET.OS.NORMALIZED to Jamconfig.
1520 #------------------------------------------------------------------------------
1521 AC_DEFUN([CS_CHECK_HOST],
1522 [AC_REQUIRE([AC_CANONICAL_HOST])
1524 cs_host_os_normalized=''
1527 cs_host_target=win32gcc
1528 cs_host_family=windows
1531 _CS_CHECK_HOST_DARWIN
1534 # Everything else is assumed to be Unix or Unix-like.
1540 case $cs_host_family in
1542 AC_DEFINE([CS_PLATFORM_WIN32], [],
1543 [Define when compiling for Win32])
1544 AS_IF([test -z "$cs_host_os_normalized"],
1545 [cs_host_os_normalized='Win32'])
1548 AC_DEFINE([CS_PLATFORM_UNIX], [],
1549 [Define when compiling for Unix and Unix-like (i.e. MacOS/X)])
1550 AS_IF([test -z "$cs_host_os_normalized"],
1551 [cs_host_os_normalized='Unix'])
1555 cs_host_os_normalized_uc="AS_TR_CPP([$cs_host_os_normalized])"
1556 CS_JAMCONFIG_PROPERTY([TARGET.OS], [$cs_host_os_normalized_uc])
1557 CS_JAMCONFIG_PROPERTY([TARGET.OS.NORMALIZED], [$cs_host_os_normalized])
1560 AC_DEFUN([_CS_CHECK_HOST_DARWIN],
1561 [AC_REQUIRE([CS_PROG_CC])
1562 AC_REQUIRE([CS_PROG_CXX])
1564 # Both MacOS/X and Darwin are identified via $host_os as "darwin". We need
1565 # a way to distinguish between the two. If Carbon.h is present, then
1566 # assume MacOX/S; if not, assume Darwin. If --with-x=yes was invoked, and
1567 # Carbon.h is present, then assume that user wants to cross-build for
1568 # Darwin even though build host is MacOS/X.
1569 # IMPLEMENTATION NOTE *1*
1570 # The QuickTime 7.0 installer removes <CarbonSound/CarbonSound.h>, which
1571 # causes #include <Carbon/Carbon.h> to fail unconditionally. Re-installing
1572 # the QuickTime SDK should restore the header, however not all developers
1573 # know to do this, so we work around the problem of the missing
1574 # CarbonSound.h by #defining __CARBONSOUND__ in the test in order to
1575 # prevent Carbon.h from attempting to #include the missing header.
1576 # IMPLEMENTATION NOTE *2*
1577 # At least one MacOS/X user switches between gcc 2.95 and gcc 3.3 with a
1578 # script which toggles the values of CC, CXX, and CPP. Unfortunately, CPP
1579 # was being set to run the preprocessor directly ("cpp", for instance)
1580 # rather than running it via the compiler ("gcc -E", for instance). The
1581 # problem with running the preprocessor directly is that __APPLE__ and
1582 # __GNUC__ are not defined, which causes the Carbon.h check to fail. We
1583 # avoid this problem by supplying a non-empty fourth argument to
1584 # AC_CHECK_HEADER(), which causes it to test compile the header only (which
1585 # is a more robust test), rather than also testing it via the preprocessor.
1587 AC_DEFINE([__CARBONSOUND__], [],
1588 [Avoid problem caused by missing <Carbon/CarbonSound.h>])
1589 AC_CHECK_HEADER([Carbon/Carbon.h],
1590 [cs_host_macosx=yes], [cs_host_macosx=no], [/* force compile */])
1592 AS_IF([test $cs_host_macosx = yes],
1593 [AC_MSG_CHECKING([for --with-x])
1594 AS_IF([test "${with_x+set}" = set && test "$with_x" = "yes"],
1595 [AC_MSG_RESULT([yes (assume Darwin)])
1597 [AC_MSG_RESULT([no])])])
1599 AS_IF([test $cs_host_macosx = yes],
1600 [cs_host_target=macosx
1602 cs_host_os_normalized='MacOS/X'
1603 AC_DEFINE([CS_PLATFORM_MACOSX], [],
1604 [Define when compiling for MacOS/X])
1606 AC_CACHE_CHECK([for Objective-C compiler], [cs_cv_prog_objc],
1607 [cs_cv_prog_objc="$CC"])
1608 CS_JAMCONFIG_PROPERTY([CMD.OBJC], [$cs_cv_prog_objc])
1609 AC_CACHE_CHECK([for Objective-C++ compiler], [cs_cv_prog_objcxx],
1610 [cs_cv_prog_objcxx="$CXX"])
1611 CS_JAMCONFIG_PROPERTY([CMD.OBJC++], [$cs_cv_prog_objcxx])],
1613 [cs_host_target=unix
1614 cs_host_family=unix])])
1615 # diagnose.m4 -*- Autoconf -*-
1616 #==============================================================================
1617 # Copyright (C)2003 by Eric Sunshine <sunshine@sunshineco.com>
1619 # This library is free software; you can redistribute it and/or modify it
1620 # under the terms of the GNU Library General Public License as published by
1621 # the Free Software Foundation; either version 2 of the License, or (at your
1622 # option) any later version.
1624 # This library is distributed in the hope that it will be useful, but
1625 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1626 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
1627 # License for more details.
1629 # You should have received a copy of the GNU Library General Public License
1630 # along with this library; if not, write to the Free Software Foundation,
1631 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1633 #==============================================================================
1636 #------------------------------------------------------------------------------
1637 # CS_MSG_ERROR(ERROR-DESCRIPTION, [EXIT-STATUS])
1638 # A convenience wrapper for AC_MSG_ERROR() which invokes AC_CACHE_SAVE()
1639 # before aborting the script. Saving the cache should make subsequent
1640 # re-invocations of the configure script faster once the user has
1641 # corrected the problem(s) which caused the failure.
1642 #------------------------------------------------------------------------------
1643 AC_DEFUN([CS_MSG_ERROR],
1645 AC_MSG_ERROR([$1], [$2])])
1646 # embed.m4 -*- Autoconf -*-
1647 #==============================================================================
1648 # Copyright (C)2003,2005 by Eric Sunshine <sunshine@sunshineco.com>
1650 # This library is free software; you can redistribute it and/or modify it
1651 # under the terms of the GNU Library General Public License as published by
1652 # the Free Software Foundation; either version 2 of the License, or (at your
1653 # option) any later version.
1655 # This library is distributed in the hope that it will be useful, but
1656 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1657 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
1658 # License for more details.
1660 # You should have received a copy of the GNU Library General Public License
1661 # along with this library; if not, write to the Free Software Foundation,
1662 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1664 #==============================================================================
1667 #------------------------------------------------------------------------------
1668 # CS_META_INFO_EMBED([EMITTER], [GPL-OKAY])
1669 # Determine if plugin meta-information should be embedded or if it should
1670 # exist in a stand-alone .csplugin file, and check if necessary tools and
1671 # libraries are present. Sets the shell variable
1672 # enable_meta_info_embedding to "yes" if the user requested embedding or
1673 # if it was enabled by default; otherwise sets it to "no".
1675 # If EMITTER is provided, then a subset of the following variables
1676 # (depending upon platform and availability) are recorded by invoking
1677 # CS_EMIT_BUILD_PROPERTY() with EMITTER. As a convenience, if EMITTER is
1678 # the literal value "emit" or "yes", then CS_EMIT_BUILD_RESULT()'s
1679 # default emitter will be used.
1681 # EMBED_META := yes or no
1682 # EMBED_META.CFLAGS := compiler flags
1683 # EMBED_META.LFLAGS := linker flags
1684 # CMD.WINDRES := windres.exe
1685 # OBJCOPY.AVAILABLE := yes or no
1686 # CMD.OBJCOPY := objcopy.exe
1687 # LIBBFD.AVAILABLE := yes or no
1688 # LIBBFD.CFLAGS := libbfd compiler flags
1689 # LIBBFD.LFLAGS := libbfd linker flags
1690 # ELF.AVAILABLE := yes or no
1692 # In general, clients need only concern themselves with the various
1693 # EMBED_META-related variables. For building plugin modules, utilize
1694 # EMBED_META.CFLAGS when compiling, and EMBED_META.LFLAGS when linking.
1696 # On Unix, when CS' own ELF metadata reader can't be used (because the
1697 # necessary header file elf.h was not found) embedding is accomplished
1698 # via libbfd, which carries a GPL license. Projects which carry licenses
1699 # not compatible with GPL should consider carefully before enabling
1700 # embedding on Unix. If your project is GPL-compatible, then set GPL-OKAY
1701 # to "yes". This will indicate that it is safe to use libbfd if the ELF
1702 # reader can not be used. If your project is not GPL-compatible, then
1703 # set it to "no" in order to disable embedding on Unix if the ELF reader
1704 # is not usable. (The user can still manually override the setting via
1705 # the --enable-meta-info-embedding option.)
1707 # IMPLEMENTATION NOTES
1709 # Recent versions of Mingw supply libbfd and libiberty. Since Crystal
1710 # Space uses native Win32 API for meta-information embedding on Windows,
1711 # we do not require these libraries on Windows. More importantly, users
1712 # do not want to see these GPL-licensed libraries appear in the link
1713 # statement for plugin modules, thus we explicitly disable the libbfd
1715 #------------------------------------------------------------------------------
1716 AC_DEFUN([CS_META_INFO_EMBED],
1717 [AC_REQUIRE([AC_CANONICAL_HOST])
1718 _CS_META_INFO_EMBED_ENABLE([$1], [$2])
1719 AS_IF([test $enable_meta_info_embedding = yes],
1720 [_CS_META_INFO_EMBED_TOOLS([$1])
1721 AS_IF([test $cs_header_elf_h = yes],
1722 [CS_EMIT_BUILD_PROPERTY([ELF.AVAILABLE], [yes], [], [],
1723 CS_EMITTER_OPTIONAL([$1]))],
1727 CS_CHECK_LIBBFD([$1],
1728 [CS_EMIT_BUILD_PROPERTY([EMBED_META.CFLAGS],
1729 [$cs_cv_libbfd_ok_cflags], [+], [],
1730 CS_EMITTER_OPTIONAL([$1]))
1731 CS_EMIT_BUILD_PROPERTY([EMBED_META.LFLAGS],
1732 [$cs_cv_libbfd_ok_lflags $cs_cv_libbfd_ok_libs],
1733 [+], [], CS_EMITTER_OPTIONAL([$1]))])
1738 #------------------------------------------------------------------------------
1739 # _CS_META_INFO_EMBED_ENABLE([EMITTER], [GPL-OKAY])
1740 # Helper for CS_META_INFO_EMBED which adds an
1741 # --enable-meta-info-embedding option to the configure script allowing
1742 # the user to control embedding. Sets the shell variable
1743 # enable_meta_info_embedding to yes or no.
1745 # IMPLEMENTATION NOTES
1747 # On Unix, embedding is enabled by default if elf.h is found and disabled
1748 # by default unless overridden via GPL-OKAY because libbfd carries a GPL
1749 # license which may be incompatible with a project's own license (such as
1751 #------------------------------------------------------------------------------
1752 AC_DEFUN([_CS_META_INFO_EMBED_ENABLE],
1753 [AC_REQUIRE([CS_CHECK_HOST])
1754 AC_CHECK_HEADERS([elf.h], [cs_header_elf_h=yes], [cs_header_elf_h=no])
1755 AC_MSG_CHECKING([whether to embed plugin meta-information])
1756 case $cs_host_target in
1757 unix) AS_IF([test $cs_header_elf_h = yes],
1758 [cs_embed_meta_info_default=yes],
1759 [cs_embed_meta_info_default=m4_ifval([$2],[$2],[no])]) ;;
1760 *) cs_embed_meta_info_default=yes ;;
1762 AC_ARG_ENABLE([meta-info-embedding],
1763 [AC_HELP_STRING([--enable-meta-info-embedding],
1764 [store plugin meta-information directly inside plugin modules if
1765 supported by platform; if disabled, meta-information is stored in
1766 stand-alone .csplugin files; this option is enabled by default for
1767 non-Unix platforms and on Unix platforms with ELF-format object
1768 files; it is disabled by default on Unix platforms if ELF is not
1769 available and the project uses a non-GPL-compatible license (such
1770 as LGPL) since the non-ELF Unix embedding technology requires the
1771 GPL-licensed libbfd library; if ELF is not available, enable this
1772 option on Unix only if you are certain you want a GPL-licensed
1773 library infecting your project])],
1774 [], [enable_meta_info_embedding=$cs_embed_meta_info_default])
1775 AC_MSG_RESULT([$enable_meta_info_embedding])
1776 CS_EMIT_BUILD_PROPERTY([EMBED_META], [$enable_meta_info_embedding],
1777 [], [], CS_EMITTER_OPTIONAL([$1]))])
1781 #------------------------------------------------------------------------------
1782 # _CS_META_INFO_EMBED_TOOLS([EMITTER])
1783 # Helper for CS_META_INFO_EMBED() which searches for tools required for
1784 # plugin meta-info embedding.
1785 #------------------------------------------------------------------------------
1786 AC_DEFUN([_CS_META_INFO_EMBED_TOOLS],
1787 [CS_CHECK_TOOLS([WINDRES], [windres])
1788 CS_EMIT_BUILD_PROPERTY([CMD.WINDRES], [$WINDRES], [], [],
1789 CS_EMITTER_OPTIONAL([$1]))
1791 CS_CHECK_TOOLS([OBJCOPY], [objcopy])
1792 AS_IF([test -n "$OBJCOPY"],
1793 [CS_EMIT_BUILD_PROPERTY([OBJCOPY.AVAILABLE], [yes], [], [],
1794 CS_EMITTER_OPTIONAL([$1]))
1795 CS_EMIT_BUILD_PROPERTY([CMD.OBJCOPY], [$OBJCOPY], [], [],
1796 CS_EMITTER_OPTIONAL([$1]))])])
1800 #------------------------------------------------------------------------------
1801 # CS_CHECK_LIBBFD([EMITTER], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1802 # Exhaustive check for a usable GPL-licensed libbfd, the Binary File
1803 # Descriptor library, a component of binutils, which allows low-level
1804 # manipulation of executable and object files. If EMITTER is provided,
1805 # then the following variables are recorded by invoking
1806 # CS_EMIT_BUILD_PROPERTY() with EMITTER. As a convenience, if EMITTER is
1807 # the literal value "emit" or "yes", then CS_EMIT_BUILD_RESULT()'s
1808 # default emitter will be used.
1810 # LIBBFD.AVAILABLE := yes or no
1811 # LIBBFD.CFLAGS := libbfd compiler flags
1812 # LIBBFD.LFLAGS := libbfd linker flags
1814 # The shell variable cs_cv_libbfd_ok is set to yes if a usable libbfd was
1815 # discovered, else no. If found, the additional shell variables
1816 # cs_cv_libbfd_ok_cflags, cs_cv_libbfd_ok_lflags, and
1817 # cs_cv_libbfd_ok_libs are also set.
1821 # libbfd carries a GPL license which is incompatible with the LGPL
1822 # license of Crystal Space. Do not use this library with projects under
1823 # less restrictive licenses, such as LGPL.
1825 # IMPLEMENTATION NOTES
1827 # It seems that some platforms have two version of libiberty installed:
1828 # one from binutils and one from gcc. The binutils version resides in
1829 # /usr/lib, whereas the gcc version resides in the gcc installation
1830 # directory. The gcc version, by default, takes precedence at link time
1831 # over the binutils version. Unfortunately, in broken cases, the gcc
1832 # version of libiberty is missing htab_create_alloc() which is required
1833 # by some libbfd functions. The extensive secondary check of libbfd
1834 # catches this anomalous case of broken gcc libiberty. It turns out that
1835 # it is possible to make the linker prefer the binutils version by
1836 # specifying -L/usr/lib, thus the extensive test attempts to do so in an
1837 # effort to resolve this unfortunate issue.
1838 #------------------------------------------------------------------------------
1839 AC_DEFUN([CS_CHECK_LIBBFD],
1840 [CS_CHECK_LIB_WITH([bfd],
1841 [AC_LANG_PROGRAM([[#include <bfd.h>]], [bfd_init();])],
1842 [], [], [], [], [], [], [-liberty])
1844 AS_IF([test $cs_cv_libbfd = yes],
1845 [CS_CHECK_BUILD([if libbfd is usable], [cs_cv_libbfd_ok],
1846 [AC_LANG_PROGRAM([[#include <bfd.h>]],
1851 bfd_check_format(p,bfd_object);
1852 bfd_get_section_by_name(p,0);
1853 bfd_section_size(p,s);
1854 bfd_get_section_contents(p,s,0,0,0);
1856 [CS_CREATE_TUPLE() CS_CREATE_TUPLE([],[-L/usr/lib],[])],
1858 [$cs_cv_libbfd_cflags],
1859 [$cs_cv_libbfd_lflags],
1860 [$cs_cv_libbfd_libs])],
1861 [cs_cv_libbfd_ok=no])
1863 AS_IF([test $cs_cv_libbfd_ok = yes],
1864 [CS_EMIT_BUILD_RESULT([cs_cv_libbfd_ok], [LIBBFD],
1865 CS_EMITTER_OPTIONAL([$1]))
1868 # emit.m4 -*- Autoconf -*-
1869 #==============================================================================
1870 # Copyright (C)2003-2005 by Eric Sunshine <sunshine@sunshineco.com>
1872 # This library is free software; you can redistribute it and/or modify it
1873 # under the terms of the GNU Library General Public License as published by
1874 # the Free Software Foundation; either version 2 of the License, or (at your
1875 # option) any later version.
1877 # This library is distributed in the hope that it will be useful, but
1878 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1879 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
1880 # License for more details.
1882 # You should have received a copy of the GNU Library General Public License
1883 # along with this library; if not, write to the Free Software Foundation,
1884 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1886 #==============================================================================
1889 #------------------------------------------------------------------------------
1890 # CS_EMIT_BUILD_PROPERTY(KEY, VALUE, [APPEND], [EMPTY-OKAY], [EMITTER],
1892 # A utility function which invokes an emitter to record the KEY/VALUE
1893 # tuple if VALUE is not the empty string (after leading and trailing
1894 # whitespace is stripped). If EMPTY-OKAY is not an empty string, then the
1895 # property is emitted even if VALUE is empty; that is, it is emitted
1896 # unconditionally. If APPEND is the empty string, then the emitter sets
1897 # the key's value directly (though it may be overridden by the
1898 # environment), otherwise the emitter appends VALUE to the existing value
1899 # of the key. EMITTER is a macro name, such as CS_JAMCONFIG_PROPERTY or
1900 # CS_MAKEFILE_PROPERTY, which performs the actual task of emitting the
1901 # KEY/VALUE tuple; it should also accept APPEND as an optional third
1902 # argument. If EMITTER is omitted, CS_JAMCONFIG_PROPERTY is used. Some
1903 # emitters accept an optional fourth argument, UNCONDITIONAL, which
1904 # instructs it to set KEY's value unconditionally, even if KEY already
1905 # had been assigned a value via some other mechanism (such as imported
1906 # from the environment, or from Jambase, in the case of
1907 # CS_JAMCONFIG_PROPERTY).
1908 #------------------------------------------------------------------------------
1909 AC_DEFUN([CS_EMIT_BUILD_PROPERTY],
1910 [cs_build_prop_val="$2"
1911 cs_build_prop_val=CS_TRIM([$cs_build_prop_val])
1913 [CS_JAMCONFIG_PROPERTY([$1], [$cs_build_prop_val], [$3])],
1914 AS_IF([test -n "$cs_build_prop_val"],
1915 [m4_default([$5],[CS_JAMCONFIG_PROPERTY])(
1916 [$1], [$cs_build_prop_val], [$3], [$6])]))])
1920 #------------------------------------------------------------------------------
1921 # CS_EMIT_BUILD_RESULT(CACHE-VAR, PREFIX, [EMITTER])
1922 # Record the results of CS_CHECK_BUILD() or CS_CHECK_LIB_WITH() via some
1923 # emitter. If CACHE-VAR indicates that the build succeeded, then the
1924 # following properties are emitted:
1926 # PREFIX.AVAILABLE = yes
1927 # PREFIX.CFLAGS = $CACHE-VAR_cflags
1928 # PREFIX.LFLAGS = $CACHE-VAR_lflags $CACHE-VAR_libs
1930 # EMITTER is a macro name, such as CS_JAMCONFIG_PROPERTY or
1931 # CS_MAKEFILE_PROPERTY, which performs the actual task of emitting the
1932 # KEY/VALUE tuple. If EMITTER is omitted, CS_JAMCONFIG_PROPERTY is used.
1933 #------------------------------------------------------------------------------
1934 AC_DEFUN([CS_EMIT_BUILD_RESULT],
1935 [AS_IF([test "$$1" = yes],
1936 [CS_EMIT_BUILD_PROPERTY([$2.AVAILABLE], [yes], [], [], [$3])
1937 CS_EMIT_BUILD_PROPERTY([$2.CFLAGS], [$$1_cflags], [], [], [$3])
1938 CS_EMIT_BUILD_PROPERTY([$2.LFLAGS], [$$1_lflags $$1_libs],
1943 #------------------------------------------------------------------------------
1944 # CS_EMIT_BUILD_FLAGS(MESSAGE, CACHE-VAR, FLAGS, [LANGUAGE], EMITTER-KEY,
1945 # [APPEND], [ACTION-IF-RECOGNIZED],
1946 # [ACTION-IF-NOT-RECOGNIZED], [EMITTER])
1947 # A convenience wrapper for CS_CHECK_BUILD_FLAGS() which also records the
1948 # results via CS_EMIT_BUILD_PROPERTY(). Checks if the compiler or linker
1949 # recognizes a command-line option. MESSAGE is the "checking" message.
1950 # CACHE-VAR is the shell cache variable which receives the flag
1951 # recognized by the compiler or linker, or "no" if the flag was not
1952 # recognized. FLAGS is a whitespace- delimited list of build tuples
1953 # created with CS_CREATE_TUPLE(). Each tuple from FLAGS is attempted in
1954 # order until one is found which is recognized by the compiler. After
1955 # that, no further flags are checked. LANGUAGE is typically either C or
1956 # C++ and specifies which compiler to use for the test. If LANGUAGE is
1957 # omitted, C is used. EMITTER-KEY is the name to pass as the emitter's
1958 # "key" argument if a usable flag is encountered. If APPEND is not the
1959 # empty string, then the discovered flag is appended to the existing
1960 # value of the EMITTER-KEY. If the command-line option was recognized,
1961 # then ACTION-IF-RECOGNIZED is invoked, otherwise
1962 # ACTION-IF-NOT-RECOGNIZED is invoked. EMITTER is a macro name, such as
1963 # CS_JAMCONFIG_PROPERTY or CS_MAKEFILE_PROPERTY, which performs the
1964 # actual task of emitting the KEY/VALUE tuple; it should also accept
1965 # APPEND as an optional third argument. If EMITTER is omitted,
1966 # CS_JAMCONFIG_PROPERTY is used.
1967 #------------------------------------------------------------------------------
1968 AC_DEFUN([CS_EMIT_BUILD_FLAGS],
1969 [CS_CHECK_BUILD_FLAGS([$1], [$2], [$3], [$4],
1970 [CS_EMIT_BUILD_PROPERTY([$5], [$$2], [$6], [], [$9])
1976 #------------------------------------------------------------------------------
1977 # CS_EMITTER_OPTIONAL([EMITTER])
1978 # The CS_EMIT_FOO() macros optionally accept an emitter. If no emitter is
1979 # supplied to those macros, then a default emitter is chosen. Other
1980 # macros, however, which perform testing and optionally emit the results
1981 # may wish to interpret an omitted EMITTER as a request not to emit the
1982 # results. CS_EMITTER_OPTIONAL() is a convenience macro to help in these
1983 # cases. It should be passed to one of the CS_EMIT_FOO() macros in place
1984 # of the literal EMITTER argument. It functions by re-interpretating
1985 # EMITTER as follows:
1987 # - If EMITTER is omitted, then CS_NULL_EMITTER is returned, effectively
1988 # disabling output by the CS_EMIT_FOO() macro.
1989 # - If EMITTER is the literal string "emit" or "yes", then it returns an
1990 # empty string, which signals to the CS_EMIT_FOO() macro that is should
1991 # use its default emitter.
1992 # - Any other value for EMITTER is passed along as-is to the
1993 # CS_EMIT_FOO() macro.
1994 #------------------------------------------------------------------------------
1995 AC_DEFUN([CS_EMITTER_OPTIONAL],
1997 [], [[CS_NULL_EMITTER]],
2004 #------------------------------------------------------------------------------
2005 # CS_NULL_EMITTER(KEY, VALUE, [APPEND])
2006 # A do-nothing emitter suitable for use as the EMITTER argument of one of
2007 # the CS_EMIT_FOO() macros.
2008 #------------------------------------------------------------------------------
2009 AC_DEFUN([CS_NULL_EMITTER], [:
2014 #------------------------------------------------------------------------------
2015 # CS_SUBST_EMITTER(KEY, VALUE, [APPEND])
2016 # An emitter wrapped around AC_SUBST(). Invokes
2017 # AC_SUBST(AS_TR_SH(KEY),VALUE). The APPEND argument is ignored.
2018 # Suitable for use as the EMITTER argument of one of the CS_EMIT_FOO()
2019 # macros. The call to AS_TR_SH() ensures that KEY is transformed into a
2020 # valid shell variable. For instance, if a macro attempts to emit
2021 # MYLIB.CFLAGS and MYLIB.LFLAGS via CS_SUBST_EMITTER(), then the names
2022 # will be transformed to MYLIB_CFLAGS and MYLIB_LFLAGS, respectively, for
2023 # the invocation of AC_SUBST().
2024 #------------------------------------------------------------------------------
2025 AC_DEFUN([CS_SUBST_EMITTER], [AC_SUBST(AS_TR_SH([$1]),[$2])])
2029 #------------------------------------------------------------------------------
2030 # CS_DEFINE_EMITTER(KEY, VALUE, [APPEND])
2031 # An emitter wrapped around AC_DEFINE_UNQUOTED(). Invokes
2032 # AC_DEFINE_UNQUOTED(AS_TR_CPP(KEY),VALUE). The APPEND argument is
2033 # ignored. Suitable for use as the EMITTER argument of one of the
2034 # CS_EMIT_FOO() macros. The call to AS_TR_CPP() ensures that KEY is a
2035 # well-formed token for the C-preprocessor.
2036 #------------------------------------------------------------------------------
2037 AC_DEFUN([CS_DEFINE_EMITTER],
2038 [AC_DEFINE_UNQUOTED(AS_TR_CPP([$1]),[$2],
2039 [Define when feature is available])])
2040 # headercache.m4 -*- Autoconf -*-
2041 #==============================================================================
2042 # Copyright (C)2003 by Eric Sunshine <sunshine@sunshineco.com>
2044 # This library is free software; you can redistribute it and/or modify it
2045 # under the terms of the GNU Library General Public License as published by
2046 # the Free Software Foundation; either version 2 of the License, or (at your
2047 # option) any later version.
2049 # This library is distributed in the hope that it will be useful, but
2050 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2051 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2052 # License for more details.
2054 # You should have received a copy of the GNU Library General Public License
2055 # along with this library; if not, write to the Free Software Foundation,
2056 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2058 #==============================================================================
2061 #------------------------------------------------------------------------------
2062 # Text cache facility for C-style #define properties. The cache is stored in
2063 # the shell variable cs_header_text.
2065 # CS_HEADER_APPEND(TEXT)
2066 # Append text to the C header text cache. This is a cover for
2067 # CS_TEXT_CACHE_APPEND().
2069 # CS_HEADER_PREPEND(TEXT)
2070 # Prepend text to the C header text cache. This is a cover for
2071 # CS_TEXT_CACHE_PREPEND().
2073 # CS_HEADER_PROPERTY(KEY, [VALUE])
2074 # Append a line of the form "#define KEY VALUE" to the C header text
2075 # cache. If the VALUE argument is omitted, then the appended line has
2076 # the simplified form "#define KEY".
2078 # CS_HEADER_OUTPUT(FILENAME)
2079 # Instruct config.status to write the C header text cache to the given
2080 # filename. This is a cover for CS_TEXT_CACHE_OUTPUT().
2081 #------------------------------------------------------------------------------
2082 AC_DEFUN([CS_HEADER_APPEND], [CS_TEXT_CACHE_APPEND([cs_header_text], [$1])])
2083 AC_DEFUN([CS_HEADER_PREPEND], [CS_TEXT_CACHE_PREPEND([cs_header_text], [$1])])
2084 AC_DEFUN([CS_HEADER_PROPERTY],
2085 [CS_HEADER_APPEND([@%:@define $1[]m4_ifval([$2], [ $2], [])
2087 AC_DEFUN([CS_HEADER_OUTPUT], [CS_TEXT_CACHE_OUTPUT([cs_header_text], [$1])])
2088 #-----------------------------------------------------------------------------
2089 # installdirs.m4 (c) Matze Braun <matze@braunis.de>
2090 # Macro for emitting the installation paths gathered by Autoconf.
2092 # This library is free software; you can redistribute it and/or modify it
2093 # under the terms of the GNU Library General Public License as published by
2094 # the Free Software Foundation; either version 2 of the License, or (at your
2095 # option) any later version.
2097 # This library is distributed in the hope that it will be useful, but
2098 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2099 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2100 # License for more details.
2102 # You should have received a copy of the GNU Library General Public License
2103 # along with this library; if not, write to the Free Software Foundation,
2104 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2106 #-----------------------------------------------------------------------------
2108 #-----------------------------------------------------------------------------
2109 # CS_OUTPUT_INSTALLDIRS([EMITTER], [RAW-BACKSLASHES])
2110 # Emit installation directories collected by Autoconf. EMITTER is a macro
2111 # name, such as CS_JAMCONFIG_PROPERTY or CS_MAKEFILE_PROPERTY, which performs
2112 # the actual task of emitting the KEY/VALUE tuple. If EMITTER is omitted,
2113 # CS_JAMCONFIG_PROPERTY is used. If RAW-BACKSLASHES is not provided, then
2114 # backslashes in emitted values are each escaped with an additional
2115 # backslash. If RAW-BACKSLASHES is not the null value, then backslashes are
2116 # emitted raw. The following properties are emitted:
2132 #-----------------------------------------------------------------------------
2133 AC_DEFUN([CS_OUTPUT_INSTALLDIRS],[
2134 # Handle the case when no prefix is given, and the special case when a path
2135 # contains more than 2 slashes, these paths seem to be correct but Jam fails
2137 AS_IF([test $prefix = NONE],
2138 [cs_install_prefix="$ac_default_prefix"],
2139 [cs_install_prefix=`echo "$prefix" | sed -e 's:///*:/:g'`])
2140 AS_IF([test $exec_prefix = NONE],
2141 [cs_install_exec_prefix="AS_ESCAPE([$(prefix)])"],
2142 [cs_install_exec_prefix=`echo "$exec_prefix" | sed -e 's:///*:/:g'`])
2144 _CS_OUTPUT_INSTALL_DIRS([$1], [prefix],
2145 [CS_PREPARE_INSTALLPATH([$cs_install_prefix], [$2])])
2146 _CS_OUTPUT_INSTALL_DIRS([$1], [exec_prefix],
2147 [CS_PREPARE_INSTALLPATH([$cs_install_exec_prefix], [$2])])
2148 _CS_OUTPUT_INSTALL_DIRS([$1], [bindir],
2149 [CS_PREPARE_INSTALLPATH([$bindir], [$2])])
2150 _CS_OUTPUT_INSTALL_DIRS([$1], [sbindir],
2151 [CS_PREPARE_INSTALLPATH([$sbindir], [$2])])
2152 _CS_OUTPUT_INSTALL_DIRS([$1], [libexecdir],
2153 [CS_PREPARE_INSTALLPATH([$libexecdir], [$2])])
2154 _CS_OUTPUT_INSTALL_DIRS([$1], [datadir],
2155 [CS_PREPARE_INSTALLPATH([$datadir], [$2])])
2156 _CS_OUTPUT_INSTALL_DIRS([$1], [sysconfdir],
2157 [CS_PREPARE_INSTALLPATH([$sysconfdir], [$2])])
2158 _CS_OUTPUT_INSTALL_DIRS([$1], [sharedstatedir],
2159 [CS_PREPARE_INSTALLPATH([$sharedstatedir], [$2])])
2160 _CS_OUTPUT_INSTALL_DIRS([$1], [localstatedir],
2161 [CS_PREPARE_INSTALLPATH([$localstatedir], [$2])])
2162 _CS_OUTPUT_INSTALL_DIRS([$1], [libdir],
2163 [CS_PREPARE_INSTALLPATH([$libdir], [$2])])
2164 _CS_OUTPUT_INSTALL_DIRS([$1], [includedir],
2165 [CS_PREPARE_INSTALLPATH([$includedir], [$2])])
2166 _CS_OUTPUT_INSTALL_DIRS([$1], [oldincludedir],
2167 [CS_PREPARE_INSTALLPATH([$oldincludedir], [$2])])
2168 _CS_OUTPUT_INSTALL_DIRS([$1], [infodir],
2169 [CS_PREPARE_INSTALLPATH([$infodir], [$2])])
2170 _CS_OUTPUT_INSTALL_DIRS([$1], [mandir],
2171 [CS_PREPARE_INSTALLPATH([$mandir], [$2])])
2174 AC_DEFUN([_CS_OUTPUT_INSTALL_DIRS],
2175 [m4_default([$1], [CS_JAMCONFIG_PROPERTY])([$2], [$3])])
2178 #-----------------------------------------------------------------------------
2179 # CS_PREPARE_INSTALLPATH(VALUE, [RAW-BACKSLASHES])
2180 # Transform variable references of the form ${bla} to $(bla) in VALUE and
2181 # correctly quotes backslashes. This is needed if you need to emit some of
2182 # the paths from Autoconf. RAW-BACKSLASHES has the same meaning as in
2183 # CS_OUTPUT_INSTALLDIRS.
2184 #-----------------------------------------------------------------------------
2185 AC_DEFUN([CS_PREPARE_INSTALLPATH],
2186 [`echo "$1" | sed 's/\${\([[a-zA-Z_][a-zA-Z_]]*\)}/$(\1)/g;m4_ifval([$2],
2187 [s/\\/\\\\/g], [s/\\\\/\\\\\\\\/g])'`])
2188 # jamcache.m4 -*- Autoconf -*-
2189 #==============================================================================
2190 # Copyright (C)2003 by Eric Sunshine <sunshine@sunshineco.com>
2192 # This library is free software; you can redistribute it and/or modify it
2193 # under the terms of the GNU Library General Public License as published by
2194 # the Free Software Foundation; either version 2 of the License, or (at your
2195 # option) any later version.
2197 # This library is distributed in the hope that it will be useful, but
2198 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2199 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2200 # License for more details.
2202 # You should have received a copy of the GNU Library General Public License
2203 # along with this library; if not, write to the Free Software Foundation,
2204 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2206 #==============================================================================
2209 #------------------------------------------------------------------------------
2210 # Text cache facility for Jam-style properties. The cache is stored in
2211 # the shell variable cs_jamfile_text.
2213 # CS_JAMCONFIG_APPEND(TEXT)
2214 # Append text to the Jam text cache. This is a cover for
2215 # CS_TEXT_CACHE_APPEND().
2217 # CS_JAMCONFIG_PREPEND(TEXT)
2218 # Prepend text to the Jam text cache. This is a cover for
2219 # CS_TEXT_CACHE_PREPEND().
2221 # CS_JAMCONFIG_PROPERTY(KEY, VALUE, [APPEND], [UNCONDITIONAL])
2222 # Append a line of the form "KEY ?= VALUE" to the Jam text cache. If the
2223 # APPEND argument is not the empty string, then VALUE is appended to the
2224 # existing value of KEY using the form "KEY += VALUE". If the
2225 # UNCONDITIONAL argument is not empty, then the value of KEY is set
2226 # unconditionally "KEY = VALUE", rather than via "KEY ?= VALUE". APPEND
2227 # takes precedence over UNCONDITIONAL. Note that if VALUE references
2228 # other Jam variables, for example $(OBJS), then be sure to protect the
2229 # value with AS_ESCAPE(). For example:
2230 # CS_JAMCONFIG_PROPERTY([ALLOBJS], [AS_ESCAPE([$(OBJS) $(LIBOBJS)])])
2232 # CS_JAMCONFIG_OUTPUT(FILENAME)
2233 # Instruct config.status to write the Jam text cache to the given
2234 # filename. This is a cover for CS_TEXT_CACHE_OUTPUT().
2235 #------------------------------------------------------------------------------
2236 AC_DEFUN([CS_JAMCONFIG_APPEND],
2237 [CS_TEXT_CACHE_APPEND([cs_jamconfig_text], [$1])])
2238 AC_DEFUN([CS_JAMCONFIG_PREPEND],
2239 [CS_TEXT_CACHE_PREPEND([cs_jamconfig_text], [$1])])
2240 AC_DEFUN([CS_JAMCONFIG_PROPERTY],
2241 [CS_JAMCONFIG_APPEND(
2242 [$1 m4_ifval([$3], [+=], m4_ifval([$4], [=], [?=])) \"$2\" ;
2244 AC_DEFUN([CS_JAMCONFIG_OUTPUT],
2245 [CS_TEXT_CACHE_OUTPUT([cs_jamconfig_text], [$1])])
2246 # makecache.m4 -*- Autoconf -*-
2247 #==============================================================================
2248 # Copyright (C)2003 by Eric Sunshine <sunshine@sunshineco.com>
2250 # This library is free software; you can redistribute it and/or modify it
2251 # under the terms of the GNU Library General Public License as published by
2252 # the Free Software Foundation; either version 2 of the License, or (at your
2253 # option) any later version.
2255 # This library is distributed in the hope that it will be useful, but
2256 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2257 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2258 # License for more details.
2260 # You should have received a copy of the GNU Library General Public License
2261 # along with this library; if not, write to the Free Software Foundation,
2262 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2264 #==============================================================================
2267 #------------------------------------------------------------------------------
2268 # Text cache facility for makefile-style properties. The cache is stored in
2269 # the shell variable cs_makefile_text.
2271 # CS_MAKEFILE_APPEND(TEXT)
2272 # Append text to the makefile text cache. This is a cover for
2273 # CS_TEXT_CACHE_APPEND().
2275 # CS_MAKEFILE_PREPEND(TEXT)
2276 # Prepend text to the makefile text cache. This is a cover for
2277 # CS_TEXT_CACHE_PREPEND().
2279 # CS_MAKEFILE_PROPERTY(KEY, VALUE, [APPEND])
2280 # Append a line of the form "KEY = VALUE" to the makefile text cache. If
2281 # the APPEND argument is not the empty string, then VALUE is appended to
2282 # the existing value of KEY using the form "KEY += VALUE". Note that if
2283 # VALUE references other makefile variables, for example $(OBJS), then be
2284 # sure to protect the value with AS_ESCAPE(). For example:
2285 # CS_MAKEFILE_PROPERTY([ALLOBJS], [AS_ESCAPE([$(OBJS) $(LIBOBJS)])])
2287 # CS_MAKEFILE_OUTPUT(FILENAME)
2288 # Instruct config.status to write the makefile text cache to the given
2289 # filename. This is a cover for CS_TEXT_CACHE_OUTPUT().
2290 #------------------------------------------------------------------------------
2291 AC_DEFUN([CS_MAKEFILE_APPEND],
2292 [CS_TEXT_CACHE_APPEND([cs_makefile_text], [$1])])
2293 AC_DEFUN([CS_MAKEFILE_PREPEND],
2294 [CS_TEXT_CACHE_PREPEND([cs_makefile_text], [$1])])
2295 AC_DEFUN([CS_MAKEFILE_PROPERTY],
2296 [CS_MAKEFILE_APPEND([$1 m4_ifval([$3], [+=], [=]) $2
2298 AC_DEFUN([CS_MAKEFILE_OUTPUT],[CS_TEXT_CACHE_OUTPUT([cs_makefile_text], [$1])])
2299 # mkdir.m4 -*- Autoconf -*-
2300 #==============================================================================
2301 # Copyright (C)2003 by Eric Sunshine <sunshine@sunshineco.com>
2303 # This library is free software; you can redistribute it and/or modify it
2304 # under the terms of the GNU Library General Public License as published by
2305 # the Free Software Foundation; either version 2 of the License, or (at your
2306 # option) any later version.
2308 # This library is distributed in the hope that it will be useful, but
2309 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2310 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2311 # License for more details.
2313 # You should have received a copy of the GNU Library General Public License
2314 # along with this library; if not, write to the Free Software Foundation,
2315 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2317 #==============================================================================
2320 #------------------------------------------------------------------------------
2322 # Determine how to create a directory and a directory tree. Sets the
2323 # shell variable MKDIR to the command which creates a directory, and
2324 # MKDIRS to the command which creates a directory tree. Invokes
2325 # AC_SUBST() for MKDIR and MKDIRS.
2327 # IMPLEMENTATION NOTES
2328 # We need to know the exact commands, so that we can emit them, thus the
2329 # AS_MKDIR_P function is not what we want to use here since it does not
2330 # provide access to the commands (and might not even discover suitable
2331 # commands). First try "mkdir -p", then try the older "mkdirs".
2332 # Finally, if the mkdir command failed to recognize -p, then it might
2333 # have created a directory named "-p", so clean up that bogus directory.
2334 #------------------------------------------------------------------------------
2335 AC_DEFUN([CS_CHECK_MKDIR],
2336 [AC_CACHE_CHECK([how to create a directory], [cs_cv_shell_mkdir],
2337 [cs_cv_shell_mkdir='mkdir'])
2338 AC_SUBST([MKDIR], [$cs_cv_shell_mkdir])
2340 AC_CACHE_CHECK([how to create a directory tree], [cs_cv_shell_mkdir_p],
2341 [if $cs_cv_shell_mkdir -p . 2>/dev/null; then
2342 cs_cv_shell_mkdir_p='mkdir -p'
2343 elif mkdirs . 2>/dev/null; then
2344 cs_cv_shell_mkdir_p='mkdirs'
2346 test -d ./-p && rmdir ./-p])
2347 AS_VAR_SET_IF([cs_cv_shell_mkdir_p],
2348 [AC_SUBST([MKDIRS], [$cs_cv_shell_mkdir_p])],
2349 [CS_MSG_ERROR([do not know how to create a directory tree])])])
2353 #------------------------------------------------------------------------------
2354 # Replacement for AS_MKDIR_P() from m4sugar/m4sh.m4 which fixes two problems
2355 # which are present in Autoconf 2.57 and probably all earlier 2.5x versions.
2356 # This bug, along with a patch, was submitted to the Autoconf GNATS database by
2357 # Eric Sunshine as #227 on 17-Dec-2002. The bogus "-p" directory bug was fixed
2358 # for Autoconf 2.58 on 26-Sep-2003. The "mkdirs" optimization was not accepted
2359 # (since it is unnecessary; it's only an optimization).
2361 # 1) Removes bogus "-p" directory which the stock AS_MKDIR_P() leaves laying
2362 # around in the working directory if the mkdir command does not recognize
2364 # 2) Takes advantage of the older "mkdirs" program if it exists and if "mkdir
2365 # -p" does not work.
2366 #------------------------------------------------------------------------------
2367 m4_defun([_AS_MKDIR_P_PREPARE],
2368 [if mkdir -p . 2>/dev/null; then
2369 as_mkdir_p='mkdir -p'
2370 elif mkdirs . 2>/dev/null; then
2375 test -d ./-p && rmdir ./-p
2376 ])# _AS_MKDIR_P_PREPARE
2378 m4_define([AS_MKDIR_P],
2379 [AS_REQUIRE([_$0_PREPARE])dnl
2380 { if test -n "$as_mkdir_p"; then
2385 while test ! -d "$as_dir"; do
2386 as_dirs="$as_dir $as_dirs"
2387 as_dir=`AS_DIRNAME("$as_dir")`
2389 test ! -n "$as_dirs" || mkdir $as_dirs
2390 fi || AS_ERROR([cannot create directory $1]); }
2392 #==============================================================================
2394 # Macros for setting general info on the package, such as name and version
2395 # numbers and propagate them to the generated make and Jam property files.
2397 # Copyright (C)2003 by Matthias Braun <matze@braunis.de>
2398 # Copyright (C)2003,2004 by Eric Sunshine <sunshine@sunshineco.com>
2400 # This library is free software; you can redistribute it and/or modify it
2401 # under the terms of the GNU Library General Public License as published by
2402 # the Free Software Foundation; either version 2 of the License, or (at your
2403 # option) any later version.
2405 # This library is distributed in the hope that it will be useful, but
2406 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2407 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2408 # License for more details.
2410 # You should have received a copy of the GNU Library General Public License
2411 # along with this library; if not, write to the Free Software Foundation,
2412 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2414 #==============================================================================
2416 #------------------------------------------------------------------------------
2417 # CS_PACKAGEINFO([LONGNAME], [COPYRIGHT, [HOMEPAGE])
2418 # Set additional information for the package. Note that the version
2419 # number of your application should only contain numbers, because on
2420 # Windows you can only set numerical values in some of the file
2421 # properties (such as versioninfo .rc files).
2422 #------------------------------------------------------------------------------
2423 AC_DEFUN([CS_PACKAGEINFO],
2424 [PACKAGE_LONGNAME="[$1]"
2425 PACKAGE_COPYRIGHT="[$2]"
2426 PACKAGE_HOMEPAGE="[$3]"
2430 #------------------------------------------------------------------------------
2431 # CS_EMIT_PACKAGEINFO([EMITTER])
2432 # Emit extended package information using the provided EMITTER. EMITTER
2433 # is a macro name, such as CS_JAMCONFIG_PROPERTY or CS_MAKEFILE_PROPERTY,
2434 # which performs the actual task of emitting the KEY/VALUE tuple. If
2435 # EMITTER is omitted, CS_JAMCONFIG_PROPERTY is used. For backward
2436 # compatibility, if EMITTER is the literal value "jam", then
2437 # CS_JAMCONFIG_PROPERTY is used; if it is "make", then
2438 # CS_MAKEFILE_PROPERTY is used; however use of these literal names is
2439 # highly discouraged.
2440 #------------------------------------------------------------------------------
2441 AC_DEFUN([CS_EMIT_PACKAGEINFO],
2442 [_CS_EMIT_PACKAGEINFO([$1], [PACKAGE_NAME], [$PACKAGE_NAME])
2443 _CS_EMIT_PACKAGEINFO([$1], [PACKAGE_VERSION], [$PACKAGE_VERSION])
2444 _CS_EMIT_PACKAGEINFO([$1], [PACKAGE_STRING], [$PACKAGE_STRING])
2445 _CS_EMIT_PACKAGEINFO([$1], [PACKAGE_BUGREPORT], [$PACKAGE_BUGREPORT])
2446 _CS_EMIT_PACKAGEINFO([$1], [PACKAGE_LONGNAME], [$PACKAGE_LONGNAME])
2447 _CS_EMIT_PACKAGEINFO([$1], [PACKAGE_HOMEPAGE], [$PACKAGE_HOMEPAGE])
2448 _CS_EMIT_PACKAGEINFO([$1], [PACKAGE_COPYRIGHT], [$PACKAGE_COPYRIGHT])
2449 for cs_veritem in m4_translit(AC_PACKAGE_VERSION, [.], [ ]); do
2450 _CS_EMIT_PACKAGEINFO([$1], [PACKAGE_VERSION_LIST], [$cs_veritem], [+])
2454 AC_DEFUN([_CS_EMIT_PACKAGEINFO],
2456 [make], [CS_MAKEFILE_PROPERTY([$2], [$3], [$4])],
2457 [jam], [CS_JAMCONFIG_PROPERTY([$2], [$3], [$4])],
2458 [], [CS_JAMCONFIG_PROPERTY([$2], [$3], [$4])],
2459 [$1([$2], [$3], [$4])])])
2460 # path.m4 -*- Autoconf -*-
2461 #==============================================================================
2462 # Copyright (C)2004 by Eric Sunshine <sunshine@sunshineco.com>
2464 # This library is free software; you can redistribute it and/or modify it
2465 # under the terms of the GNU Library General Public License as published by
2466 # the Free Software Foundation; either version 2 of the License, or (at your
2467 # option) any later version.
2469 # This library is distributed in the hope that it will be useful, but
2470 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2471 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2472 # License for more details.
2474 # You should have received a copy of the GNU Library General Public License
2475 # along with this library; if not, write to the Free Software Foundation,
2476 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2478 #==============================================================================
2481 #------------------------------------------------------------------------------
2482 # CS_PATH_NORMALIZE(STRING)
2483 # Normalize a pathname at run-time by transliterating Windows/DOS
2484 # backslashes to forward slashes. Also collapses whitespace.
2485 #------------------------------------------------------------------------------
2486 AC_DEFUN([CS_PATH_NORMALIZE],
2487 [`echo "x$1" | tr '\\\\' '/' | sed 's/^x//;s/ */ /g;s/^ //;s/ $//'`])
2490 #------------------------------------------------------------------------------
2491 # CS_RUN_PATH_NORMALIZE(COMMAND)
2492 # Normalize the pathname emitted by COMMAND by transliterating
2493 # Windows/DOS backslashes to forward slashes. Also collapses whitespace.
2494 #------------------------------------------------------------------------------
2495 AC_DEFUN([CS_RUN_PATH_NORMALIZE],
2496 [`AC_RUN_LOG([$1]) | tr '\\\\' '/' | sed 's/^x//;s/ */ /g;s/^ //;s/ $//'`])
2497 ###############################################################################
2499 # Written by Norman Kramer <norman@users.sourceforge.net>
2501 # This library is free software; you can redistribute it and/or modify it
2502 # under the terms of the GNU Library General Public License as published by
2503 # the Free Software Foundation; either version 2 of the License, or (at your
2504 # option) any later version.
2506 # This library is distributed in the hope that it will be useful, but
2507 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2508 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2509 # License for more details.
2511 # You should have received a copy of the GNU Library General Public License
2512 # along with this library; if not, write to the Free Software Foundation,
2513 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2515 ###############################################################################
2517 # From the input pattern we create regular expressions we send through sed
2518 # to extract the version information from the standard input to sed.
2519 # Then we extract from the resulting version string subparts.
2520 # The same happens with the supplied version string. It too is split into its
2521 # subparts according to the pattern.
2522 # Then the subparts from the gathered version string and the supplied one are
2525 # How does the pattern look like ?
2526 # It is a sequence of 9s and _s and separators.
2527 # 9 denotes a non empty sequence of digits.
2528 # _ denotes a non empty sequence of characters from the class [a-zA-Z].
2529 # | everything behind is optional
2530 # Everything else is treated as a separator.
2531 # Consecutive 9s and _s are compressed to contain only one of each type.
2532 # For instance "99_.9.__abc9_" will become "9_.9._abc9_".
2534 # How we find the parts we compare ?
2535 # From this transformed string we yield the parts we will later compare.
2536 # We break up the string as follows:
2537 # Any sequence of separators represent one breakup. Additional breakups are
2538 # placed behind every 9 and _ .
2539 # So the example from above will give:
2541 # "99_.9.__abc9_" ===compress==> "9_.9._abc9_" ===breakup==> "9" "_" "9" "_" "9" "_"
2543 # How we create the regular expressions ?
2544 # We take the compressed pattern and quote every separator.
2545 # The we replace the 9s with [0-9][0-9]*
2546 # and the _s with [a-zA-Z][a-zA-Z]* .
2547 # The above example will become:
2549 # "99_.9.__abc9_" ===compress==> "9_.9._abc9_" ===rexify==>
2550 # [0-9][0-9]*[a-zA-Z][a-zA-Z]*\.[0-9][0-9]*\.[a-zA-Z][a-zA-Z]*\a\b\c[0-9][0-9]*[a-zA-Z][a-zA-Z]*
2554 # To yield the subparts from the string we additionally enclose the
2555 # 9s and _s with \( and \).
2557 ###############################################################################
2559 # ****************************************************************
2560 # ** helper definitions **
2561 # ****************************************************************
2562 m4_define([CS_VCHK_RUNTH], [m4_pushdef([i], [$1])m4_if($1,0,,[CS_VCHK_RUNTH(m4_decr($1), [$2])][$2])m4_popdef([i])])
2563 m4_define([CS_VCHK_PREFIX], [])
2564 m4_define([CS_VCHK_SUFFIX], [])
2565 m4_define([CS_VCHK_GROUPPREFIX], [\(])
2566 m4_define([CS_VCHK_GROUPSUFFIX], [\)])
2567 m4_define([CS_VCHK_CHAR], [[[[a-zA-Z]]]])
2568 m4_define([CS_VCHK_DIGIT], [[[0-9]]])
2569 m4_define([CS_VCHK_SEQUENCE], [CS_VCHK_PREFIX[]CS_VCHK_SINGLE[]CS_VCHK_SINGLE[]*CS_VCHK_SUFFIX[]])
2570 m4_define([CS_VCHK_OPTSEQUENCE], [CS_VCHK_PREFIX[]CS_VCHK_SINGLE[]*CS_VCHK_SUFFIX[]])
2571 m4_define([CS_VCHK_REXSEQ], [m4_bpatsubst($1, [$2], [[]CS_VCHK_SEQUENCE[]])])
2572 m4_define([CS_VCHK_GROUPINGON], [m4_pushdef([CS_VCHK_PREFIX], [CS_VCHK_GROUPPREFIX])m4_pushdef([CS_VCHK_SUFFIX], [CS_VCHK_GROUPSUFFIX])])
2573 m4_define([CS_VCHK_GROUPINGOFF], [m4_popdef([CS_VCHK_SUFFIX])m4_popdef([CS_VCHK_PREFIX])])
2574 m4_define([CS_VCHK_OPTON], [m4_pushdef([CS_VCHK_SEQUENCE], [CS_VCHK_OPTSEQUENCE])])
2575 m4_define([CS_VCHK_OPTOFF], [m4_popdef([CS_VCHK_SEQUENCE])])
2576 m4_define([CS_VCHK_RMOPT], [CS_VCHK_RMCHAR([$1], m4_index([$1], [|]))])
2577 m4_define([CS_VCHK_RMCHAR], [m4_if($2,-1,[$1],m4_substr([$1], 0, $2)[]m4_substr([$1], m4_incr($2)))])
2578 m4_define([CS_VCHK_RMALL], [m4_translit([$1], [|], [])])
2579 m4_define([CS_VCHK_CUTOFF], [m4_if(m4_index($1,[|]),-1, [$1], [m4_substr($1, 0, m4_index($1,[|]))])])
2580 m4_define([CS_VCHK_CYCLEOPT], [
2581 m4_if($2,-1,, [m4_pushdef([i], CS_VCHK_CUTOFF([$1])) m4_pushdef([j], CS_VCHK_DUMMY_TAIL([$1])) CS_VCHK_CYCLEOPT( CS_VCHK_RMOPT([$1]), m4_index($1, [|]), [$3])$3 m4_popdef([i]) m4_popdef([j])])
2583 m4_define([CS_VCHK_TAIL], [m4_if(m4_index($1,[|]),-1, [], [m4_substr($1, m4_incr(m4_index($1,[|])))])])
2584 m4_define([CS_VCHK_DUMMY_COMPRESS], [m4_bpatsubst(m4_bpatsubst([$1], [__*], [A]), [99*], [0])])
2585 m4_define([CS_VCHK_DUMMY_TAIL], [CS_VCHK_DUMMY_COMPRESS(m4_translit(CS_VCHK_TAIL([$1]), [|], []))])
2587 # ****************************************************************
2588 # ** FlagsOn / FlagsOff **
2589 # ****************************************************************
2590 m4_define([CS_VCHK_FLAGSON],
2593 [$1], [group], [CS_VCHK_GROUPINGON[]],
2594 [$1], [opt], [CS_VCHK_OPTON[]])dnl
2595 m4_if($#, 0, [], $1, [], [], [CS_VCHK_FLAGSON(m4_shift($@))])])
2597 m4_define([CS_VCHK_FLAGSOFF],
2600 $1, [group], [CS_VCHK_GROUPINGOFF[]],
2601 [$1], [opt], [CS_VCHK_OPTOFF[]])dnl
2602 m4_if($#, 0, [], $1, [], [], [CS_VCHK_FLAGSOFF(m4_shift($@))])])
2604 # ****************************************************************
2605 # ** rexify / sedify **
2606 # ****************************************************************
2607 m4_define([CS_VCHK_REXIFY],
2608 [m4_pushdef([CS_VCHK_SINGLE], [$1])dnl
2609 CS_VCHK_FLAGSON(m4_shift(m4_shift(m4_shift($@))))dnl
2610 CS_VCHK_REXSEQ([$3], [$2])dnl
2611 CS_VCHK_FLAGSOFF(m4_shift(m4_shift(m4_shift($@))))dnl
2612 m4_popdef([CS_VCHK_SINGLE])])
2614 m4_define([CS_VCHK_QUOTESEP], [m4_bpatsubst($1, [[^9_]], [\\\&])])
2616 m4_define([CS_VCHK_REXCHAR], [CS_VCHK_REXIFY([CS_VCHK_CHAR], [__*], $@)])
2617 m4_define([CS_VCHK_REXDIGIT], [CS_VCHK_REXIFY([CS_VCHK_DIGIT], [99*], $@)])
2618 m4_define([CS_VCHK_SEDIFY], [CS_VCHK_REXDIGIT([CS_VCHK_REXCHAR([CS_VCHK_QUOTESEP([$1])], m4_shift($@))], m4_shift($@))])
2619 m4_define([CS_VCHK_SEDEXPRALL], [/CS_VCHK_SEDIFY([$1])/!d;s/.*\(CS_VCHK_SEDIFY([$1])\).*/\1/;q])
2620 m4_define([CS_VCHK_SEDEXPRNTH], [/CS_VCHK_SEDIFY([$1])/!d;s/.*CS_VCHK_SEDIFY([$1],[group]).*/\$2/])
2622 # ****************************************************************
2623 # ** Pattern splitting **
2624 # ****************************************************************
2625 m4_define([CS_VCHK_SPLITSEP], [CS_VCHK_REXIFY([s], [[^9_][^9_]*], $@)])
2626 m4_define([CS_VCHK_SPLITDIGIT], [CS_VCHK_REXIFY([d], [99*], $@)])
2627 m4_define([CS_VCHK_SPLITCHAR], [CS_VCHK_REXIFY([c], [__*], $@)])
2629 # ****************************************************************
2630 # ** return a list of 's' 'd' 'c' 'e' chars denoting the kind **
2631 # ** pattern parts: separator, digit, char, end **
2632 # ****************************************************************
2633 m4_define([CS_VCHK_PATTERNLIST], [m4_pushdef([CS_VCHK_SEQUENCE], [CS_VCHK_SINGLE ])dnl
2634 m4_translit(CS_VCHK_SPLITDIGIT([CS_VCHK_SPLITCHAR([CS_VCHK_SPLITSEP([$1])])]), [ ], m4_if([$2],[],[ ],[$2]))e[]dnl
2635 m4_popdef([CS_VCHK_SEQUENCE])])
2637 # ****************************************************************
2638 # ** Build the shell commands we emit to the configure script. **
2639 # ****************************************************************
2640 m4_define([CS_VCHK_PATCOUNT], [m4_len(m4_bpatsubst(CS_VCHK_PATTERNLIST([$1]), [[^dc]]))])
2642 # ****************************************************************************************
2643 # ** CS_VCHK_EXTRACTVERSION(EXTRACT_CALL, MIN_VERSION, PATTERN, PRGPREFIX, COMPARISION) **
2644 # ****************************************************************************************
2645 m4_define([CS_VCHK_EXTRACTVERSION],
2646 [cs_prog_$4_is_version=
2647 cs_prog_$4_min_version=
2648 cs_prog_$4_is_suffix=
2649 cs_prog_$4_min_suffix=
2650 cs_prog_$4_is_suffix_done=
2651 cs_prog_$4_min_suffix_done=
2652 CS_VCHK_CYCLEOPT([$3], [],
2653 [test -z $cs_prog_$4_is_version && cs_prog_$4_is_version=`$1 | sed 'CS_VCHK_SEDEXPRALL([i])'`
2654 test -n "$cs_prog_$4_is_version" && test -z $cs_prog_$4_is_suffix_done && { cs_prog_$4_is_suffix_done=yes ; cs_prog_$4_is_suffix=j ; }
2656 CS_VCHK_CYCLEOPT([$3], ,
2657 [test -z $cs_prog_$4_min_version && cs_prog_$4_min_version=`echo $2 | sed 'CS_VCHK_SEDEXPRALL([i])'`
2658 test -n "$cs_prog_$4_min_version" && test -z $cs_prog_$4_min_suffix_done && { cs_prog_$4_min_suffix_done=yes ; cs_prog_$4_min_suffix=j ; }
2660 CS_VCHK_RUNTH([CS_VCHK_PATCOUNT([$3])],
2661 [cs_prog_$4_is_ver_[]i=`echo ${cs_prog_$4_is_version}${cs_prog_$4_is_suffix} | sed 'CS_VCHK_SEDEXPRNTH([CS_VCHK_RMALL([$3])], [i])'`
2663 CS_VCHK_RUNTH([CS_VCHK_PATCOUNT([$3])],
2664 [cs_prog_$4_min_ver_[]i=`echo $cs_prog_$4_min_version${cs_prog_$4_min_suffix} | sed 'CS_VCHK_SEDEXPRNTH([CS_VCHK_RMALL([$3])], [i])'`
2666 cs_cv_prog_$4_version_ok=''
2667 CS_VCHK_RUNTH([CS_VCHK_PATCOUNT([$3])],
2668 [test -z "$cs_cv_prog_$4_version_ok" && { expr "$cs_prog_$4_is_ver_[]i" "$5" "$cs_prog_$4_min_ver_[]i" >/dev/null || cs_cv_prog_$4_version_ok=no ; }
2669 test -z "$cs_cv_prog_$4_version_ok" && { expr "$cs_prog_$4_min_ver_[]i" "$5" "$cs_prog_$4_is_ver_[]i" >/dev/null || cs_cv_prog_$4_version_ok=yes ; }
2671 AS_IF([test -z "$cs_cv_prog_$4_version_ok"], [cs_cv_prog_$4_version_ok=yes])
2672 cs_cv_prog_$4_version_ok_annotated="$cs_cv_prog_$4_version_ok"
2673 AS_IF([test -n "$cs_prog_$4_is_version"],
2674 [cs_cv_prog_$4_version_ok_annotated="$cs_cv_prog_$4_version_ok_annotated (version $cs_prog_$4_is_version)"])
2677 ##############################################################################
2678 # CS_CHECK_PROG_VERSION(PROG, EXTRACT_CALL, VERSION, PATTERN,
2679 # [ACTION-IF-OKAY], [ACTION-IF-NOT-OKAY], [CMP])
2680 # Check the version of a program PROG.
2681 # Version information is emitted by EXTRACT_CALL (for instance "bison -V").
2682 # The discovered program version is compared against VERSION.
2683 # The pattern of the version string matches PATTERN
2684 # The extracted version and the supplied version are compared with the CMP
2685 # operator. i.e. EXTRACTED_VERSION CMP SUPPLIED_VERSION
2686 # CMP defaults to >= if not specified.
2687 # ACTION-IF-OKAY is invoked if comparision yields true, otherwise
2688 # ACTION-IF-NOT-OKAY is invoked.
2690 # PATTERN literals: 9 .. marks a non empty sequence of digits
2691 # _ .. marks a non empty sequence of characters from [a-zA-Z]
2692 # | .. everything behind is optional
2693 # .. everything else is taken as separator - it is better
2694 # to not try stuff like space, slash or comma.
2696 # The test results in cs_cv_prog_PROG_version_ok being either yes or no.
2697 ##############################################################################
2698 AC_DEFUN([CS_CHECK_PROG_VERSION],
2699 [AC_CACHE_CHECK([if $1 version m4_default([$7],[>=]) $3],
2700 [AS_TR_SH([cs_cv_prog_$1_version_ok_annotated])],
2701 [CS_VCHK_EXTRACTVERSION([$2], [$3], [$4], AS_TR_SH([$1]),
2702 m4_default([$7],[>=]))])
2703 AS_IF([test "$AS_TR_SH([cs_cv_prog_$1_version_ok])" = yes], [$5], [$6])])
2704 # qualify.m4 -*- Autoconf -*-
2705 #==============================================================================
2706 # Copyright (C)2005 by Eric Sunshine <sunshine@sunshineco.com>
2708 # This library is free software; you can redistribute it and/or modify it
2709 # under the terms of the GNU Library General Public License as published by
2710 # the Free Software Foundation; either version 2 of the License, or (at your
2711 # option) any later version.
2713 # This library is distributed in the hope that it will be useful, but
2714 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2715 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2716 # License for more details.
2718 # You should have received a copy of the GNU Library General Public License
2719 # along with this library; if not, write to the Free Software Foundation,
2720 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2722 #==============================================================================
2725 #------------------------------------------------------------------------------
2726 # CS_SYMBOL_QUALIFIER(MESSAGE, CACHE-VAR, QUALIFIERS, [SYMBOL], [LANG],
2727 # [ACTION-IF-ACCEPTED], [ACTION-IF-NOT-ACCEPTED])
2728 # Test if a symbol can be qualified by one of the elements of the
2729 # comma-separated list of QUALIFIERS. Examples of qualifiers include
2730 # __attribute__((deprecated)), __declspec(dllimport), etc. MESSAGE is the
2731 # "checking" message. CACHE-VAR is the variable which receives the
2732 # qualifier which succeeded, or the the literal "no" if none were
2733 # accepted. SYMBOL is the symbol to which the qualifier should be
2734 # applied. If omitted, then SYMBOL defaults to "void f();". LANG is the
2735 # language of the test, typically "C" or "C++". It defaults to "C" if
2736 # omitted. ACTION-IF-ACCEPTED is invoked after CACHE-VAR is set if one of
2737 # the qualifiers is accepted, else ACTION-IF-NOT-ACCEPTED is invoked.
2738 #------------------------------------------------------------------------------
2739 AC_DEFUN([CS_SYMBOL_QUALIFIER],
2740 [AC_CACHE_CHECK([$1], [$2],
2742 m4_foreach([cs_symbol_qualifier], [$3],
2743 [AS_IF([test "$$2" = no],
2746 [cs_symbol_qualifier m4_default([$4],[void f()]);],
2748 [], [$5], [$2='cs_symbol_qualifier'], [$2='no'])])])])
2749 AS_IF([test $$2 != no], [$6], [$7])])
2750 # split.m4 -*- Autoconf -*-
2751 #==============================================================================
2752 # Copyright (C)2003 by Eric Sunshine <sunshine@sunshineco.com>
2754 # This library is free software; you can redistribute it and/or modify it
2755 # under the terms of the GNU Library General Public License as published by
2756 # the Free Software Foundation; either version 2 of the License, or (at your
2757 # option) any later version.
2759 # This library is distributed in the hope that it will be useful, but
2760 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2761 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2762 # License for more details.
2764 # You should have received a copy of the GNU Library General Public License
2765 # along with this library; if not, write to the Free Software Foundation,
2766 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2768 #==============================================================================
2771 #------------------------------------------------------------------------------
2772 # CS_SPLIT(LINE, [OUTPUT-VARIABLES], [DELIMITER], [FILLER])
2773 # Split LINE into individual tokens. Tokens are delimited by DELIMITER,
2774 # which is the space character if omitted. OUTPUT-VARIABLES is a
2775 # comma-delimited list of shell variables which should receive the
2776 # extracted tokens. If there are too few tokens to fill the output
2777 # variables, then the excess variables will be assigned the empty string.
2778 # If there are too few output variables, then the excess tokens will be
2779 # ignored. If OUTPUT-VARIABLES is omitted, then the split tokens will be
2780 # assigned to the shell meta-variables $1, $2, $3, etc. When
2781 # OUTPUT-VARIABLES is omitted, FILLER is assigned to meta-variables in
2782 # cases where DELIMITER delimits a zero-length token. FILLER defaults
2783 # to "filler". For example, if DELIMITER is "+" and OUTPUT-VARIABLES is
2784 # omitted, given the line "one++three", $1 will be "one", $2 will be
2785 # "filler", and $3 will be "three".
2786 #------------------------------------------------------------------------------
2787 AC_DEFUN([CS_SPLIT],
2788 [m4_define([cs_split_filler], m4_default([$4],[filler]))
2789 set cs_split_filler `echo "$1" | awk 'BEGIN { FS="m4_default([$3],[ ])" }
2790 { for (i=1; i <= NF; ++i)
2791 { if ($i == "") print "cs_split_filler"; else print $i } }'`
2793 m4_map([_CS_SPLIT], [$2])])
2795 AC_DEFUN([_CS_SPLIT],
2796 [AS_IF([test $[@%:@] -eq 0], [$1=''],
2797 [AS_IF([test "$[1]" = cs_split_filler], [$1=''], [$1=$[1]])
2799 # textcache.m4 -*- Autoconf -*-
2800 #==============================================================================
2801 # Copyright (C)2003 by Eric Sunshine <sunshine@sunshineco.com>
2803 # This library is free software; you can redistribute it and/or modify it
2804 # under the terms of the GNU Library General Public License as published by
2805 # the Free Software Foundation; either version 2 of the License, or (at your
2806 # option) any later version.
2808 # This library is distributed in the hope that it will be useful, but
2809 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2810 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2811 # License for more details.
2813 # You should have received a copy of the GNU Library General Public License
2814 # along with this library; if not, write to the Free Software Foundation,
2815 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2817 #==============================================================================
2820 #------------------------------------------------------------------------------
2821 # Text cache facility. These macros provide a way to incrementally store
2822 # arbitrary text in a shell variable, and to write the saved text to a file.
2824 # CS_TEXT_CACHE_APPEND(VARIABLE, TEXT)
2825 # Append text to the contents of the named shell variable. If the text
2826 # contains references to shell variables (such as $foo), then those
2827 # references will be expanded. If expansion is not desired, then protect
2828 # the text with AS_ESCAPE().
2830 # CS_TEXT_CACHE_PREPEND(VARIABLE, TEXT)
2831 # Prepend text to the contents of the named shell variable. If the text
2832 # contains references to shell variables (such as $foo), then those
2833 # references will be expanded. If expansion is not desired, then protect
2834 # the text with AS_ESCAPE().
2836 # CS_TEXT_CACHE_OUTPUT(VARIABLE, FILENAME)
2837 # Instruct config.status to write the contents of the named shell
2838 # variable to the given filename. If the file resides in a directory,
2839 # the directory will be created, if necessary. If the output file
2840 # already exists, and if the cached text is identical to the contents of
2841 # the existing file, then the existing file is left alone, thus its time
2842 # stamp remains unmolested. This heuristic may help to minimize rebuilds
2843 # when the file is listed as a dependency in a makefile.
2846 # There is a bug in Autoconf 2.57 and probably all earlier 2.5x versions
2847 # which results in errors if AC_CONFIG_COMMANDS is invoked for a `tag'
2848 # which represents a file in a directory which does not yet exist.
2849 # Unfortunately, even invoking AS_MKDIR_P in the `cmd' portion of
2850 # AC_CONFIG_COMMANDS does not solve the problem because the generated
2851 # configure script attempts to access information about the directory
2852 # before AS_MKDIR_P has a chance to create it. This forces us to invoke
2853 # AS_MKDIR_P in the third argument to AC_CONFIG_COMMANDS (the
2854 # `init-cmds') rather than the second (the `cmds'). This is undesirable
2855 # because it means that the directory will be created anytime
2856 # config.status is invoked (even for a simple --help), rather than being
2857 # created only when requested to output the text cache. This bug was
2858 # submitted to the Autoconf GNATS database by Eric Sunshine as #228 on
2859 # 27-Dec-2002. It was fixed for Autoconf 2.58 on 26-Sep-2003. The
2860 # official fix makes the assumption that `tag' always represents a file
2861 # (as opposed to some generic target), and creates the file's directory
2863 #------------------------------------------------------------------------------
2864 AC_DEFUN([CS_TEXT_CACHE_APPEND], [$1="${$1}$2"])
2865 AC_DEFUN([CS_TEXT_CACHE_PREPEND], [$1="$2${$1}"])
2866 AC_DEFUN([CS_TEXT_CACHE_OUTPUT],
2867 [AC_CONFIG_COMMANDS([$2],
2868 [echo $ECHO_N "$$1$ECHO_C" > $tmp/tcache
2869 AS_IF([diff $2 $tmp/tcache >/dev/null 2>&1],
2870 [AC_MSG_NOTICE([$2 is unchanged])],
2875 cs_dir=`AS_DIRNAME([$2])`
2876 AS_ESCAPE(AS_MKDIR_P([$cs_dir]), [$`\])])])
2877 # trim.m4 -*- Autoconf -*-
2878 #==============================================================================
2879 # Copyright (C)2003 by Eric Sunshine <sunshine@sunshineco.com>
2881 # This library is free software; you can redistribute it and/or modify it
2882 # under the terms of the GNU Library General Public License as published by
2883 # the Free Software Foundation; either version 2 of the License, or (at your
2884 # option) any later version.
2886 # This library is distributed in the hope that it will be useful, but
2887 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2888 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2889 # License for more details.
2891 # You should have received a copy of the GNU Library General Public License
2892 # along with this library; if not, write to the Free Software Foundation,
2893 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2895 #==============================================================================
2898 #------------------------------------------------------------------------------
2900 # Strip leading and trailing spaces from STRING and collapse internal
2901 # runs of multiple spaces to a single space.
2902 #------------------------------------------------------------------------------
2903 AC_DEFUN([CS_TRIM], [`echo x$1 | sed 's/^x//;s/ */ /g;s/^ //;s/ $//'`])
2904 # warnings.m4 -*- Autoconf -*-
2905 #==============================================================================
2906 # Copyright (C)2005 by Eric Sunshine <sunshine@sunshineco.com>
2908 # This library is free software; you can redistribute it and/or modify it
2909 # under the terms of the GNU Library General Public License as published by
2910 # the Free Software Foundation; either version 2 of the License, or (at your
2911 # option) any later version.
2913 # This library is distributed in the hope that it will be useful, but
2914 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2915 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
2916 # License for more details.
2918 # You should have received a copy of the GNU Library General Public License
2919 # along with this library; if not, write to the Free Software Foundation,
2920 # Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2922 #==============================================================================
2925 #------------------------------------------------------------------------------
2926 # CS_COMPILER_WARNINGS([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND],
2927 # [ACTION-IF-NOT-FOUND])
2928 # Check how to enable compilation warnings. If LANGUAGE is not provided,
2929 # then `C' is assumed (other options include `C++'). If CACHE-VAR is not
2930 # provided, then it defaults to the name
2931 # "cs_cv_prog_compiler_enable_warnings". If an option for enabling
2932 # warnings (such as `-Wall') is discovered, then it is assigned to
2933 # CACHE-VAR and ACTION-IF-FOUND is invoked; otherwise the empty string is
2934 # assigned to CACHE-VAR and ACTION-IF-NOT-FOUND is invoked.
2936 # IMPLEMENTATION NOTES
2938 # On some platforms, it is more appropriate to use -Wmost rather than
2939 # -Wall even if the compiler understands both, thus we attempt -Wmost
2941 #------------------------------------------------------------------------------
2942 AC_DEFUN([CS_COMPILER_WARNINGS],
2943 [CS_CHECK_BUILD_FLAGS(
2944 [how to enable m4_default([$1],[C]) compilation warnings],
2945 [m4_default([$2],[cs_cv_prog_compiler_enable_warnings])],
2946 [CS_CREATE_TUPLE([-Wmost]) CS_CREATE_TUPLE([-Wall])],
2951 #------------------------------------------------------------------------------
2952 # CS_COMPILER_ERRORS([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND],
2953 # [ACTION-IF-NOT-FOUND])
2954 # Check how to promote compilation diganostics from warning to error
2955 # status. If LANGUAGE is not provided, then `C' is assumed (other options
2956 # include `C++'). If CACHE-VAR is not provided, then it defaults to the
2957 # name "cs_cv_prog_compiler_enable_errors". If an option for performing
2958 # this promotion (such as `-Werror') is discovered, then it is assigned
2959 # to CACHE-VAR and ACTION-IF-FOUND is invoked; otherwise the empty string
2960 # is assigned to CACHE-VAR and ACTION-IF-NOT-FOUND is invoked.
2961 #------------------------------------------------------------------------------
2962 AC_DEFUN([CS_COMPILER_ERRORS],
2963 [CS_CHECK_BUILD_FLAGS(
2964 [how to treat m4_default([$1],[C]) warnings as errors],
2965 [m4_default([$2],[cs_cv_prog_compiler_enable_errors])],
2966 [CS_CREATE_TUPLE([-Werror])], [$1], [$3], [$4])])
2970 #------------------------------------------------------------------------------
2971 # CS_COMPILER_IGNORE_UNUSED([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND],
2972 # [ACTION-IF-NOT-FOUND])
2973 # Check how to instruct compiler to ignore unused variables and
2974 # arguments. This option may be useful for code generated by tools, such
2975 # as Swig, Bison, and Flex, over which the client has no control, yet
2976 # wishes to compile without excessive diagnostic spew. If LANGUAGE is
2977 # not provided, then `C' is assumed (other options include `C++'). If
2978 # CACHE-VAR is not provided, then it defaults to the name
2979 # "cs_cv_prog_compiler_ignore_unused". If an option (such as
2980 # `-Wno-unused') is discovered, then it is assigned to CACHE-VAR and
2981 # ACTION-IF-FOUND is invoked; otherwise the empty string is assigned to
2982 # CACHE-VAR and ACTION-IF-NOT-FOUND is invoked.
2983 #------------------------------------------------------------------------------
2984 AC_DEFUN([CS_COMPILER_IGNORE_UNUSED],
2985 [CS_CHECK_BUILD_FLAGS(
2986 [how to suppress m4_default([$1],[C]) unused variable warnings],
2987 [m4_default([$2],[cs_cv_prog_compiler_ignore_unused])],
2988 [CS_CREATE_TUPLE([-Wno-unused])], [$1], [$3], [$4])])
2992 #------------------------------------------------------------------------------
2993 # CS_COMPILER_IGNORE_UNINITIALIZED([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND],
2994 # [ACTION-IF-NOT-FOUND])
2995 # Check how to instruct compiler to ignore uninitialized variables. This
2996 # option may be useful for code generated by tools, such as Swig, Bison,
2997 # and Flex, over which the client has no control, yet wishes to compile
2998 # without excessive diagnostic spew. If LANGUAGE is not provided, then
2999 # `C' is assumed (other options include `C++'). If CACHE-VAR is not
3000 # provided, then it defaults to the name
3001 # "cs_cv_prog_compiler_ignore_uninitialized". If an option (such as
3002 # `-Wno-uninitialized') is discovered, then it is assigned to CACHE-VAR
3003 # and ACTION-IF-FOUND is invoked; otherwise the empty string is assigned
3004 # to CACHE-VAR and ACTION-IF-NOT-FOUND is invoked.
3005 #------------------------------------------------------------------------------
3006 AC_DEFUN([CS_COMPILER_IGNORE_UNINITIALIZED],
3007 [CS_CHECK_BUILD_FLAGS(
3008 [how to suppress m4_default([$1],[C]) uninitialized warnings],
3010 [cs_cv_prog_compiler_ignore_uninitialized_variables])],
3011 [CS_CREATE_TUPLE([-Wno-uninitialized])], [$1], [$3], [$4])])
3015 #------------------------------------------------------------------------------
3016 # CS_COMPILER_IGNORE_PRAGMAS([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND],
3017 # [ACTION-IF-NOT-FOUND])
3018 # Check how to instruct compiler to ignore unrecognized #pragma
3019 # directives. This option may be useful for code which contains
3020 # unprotected #pragmas which are not understood by all compilers. If
3021 # LANGUAGE is not provided, then `C' is assumed (other options include
3022 # `C++'). If CACHE-VAR is not provided, then it defaults to the name
3023 # "cs_cv_prog_compiler_ignore_unknown_pragmas". If an option (such as
3024 # `-Wno-unknown-pragmas') is discovered, then it is assigned to CACHE-VAR
3025 # and ACTION-IF-FOUND is invoked; otherwise the empty string is assigned
3026 # to CACHE-VAR and ACTION-IF-NOT-FOUND is invoked.
3027 #------------------------------------------------------------------------------
3028 AC_DEFUN([CS_COMPILER_IGNORE_PRAGMAS],
3029 [CS_CHECK_BUILD_FLAGS(
3030 [how to suppress m4_default([$1],[C]) unknown [#pragma] warnings],
3031 [m4_default([$2],[cs_cv_prog_compiler_ignore_unknown_pragmas])],
3032 [CS_CREATE_TUPLE([-Wno-unknown-pragmas])], [$1], [$3], [$4])])
3036 #------------------------------------------------------------------------------
3037 # CS_COMPILER_IGNORE_LONG_DOUBLE([LANGUAGE], [CACHE-VAR], [ACTION-IF-FOUND],
3038 # [ACTION-IF-NOT-FOUND])
3039 # Check how to instruct compiler to suppress warnings about `long double'
3040 # usage. This option may be useful for code generated by tools, such as
3041 # Swig, Bison, and Flex, over which the client has no control, yet wishes
3042 # to compile without excessive diagnostic spew. If LANGUAGE is not
3043 # provided, then `C' is assumed (other options include `C++'). If
3044 # CACHE-VAR is not provided, then it defaults to the name
3045 # "cs_cv_prog_compiler_ignore_long_double". If an option (such as
3046 # `-Wno-long-double') is discovered, then it is assigned to CACHE-VAR and
3047 # ACTION-IF-FOUND is invoked; otherwise the empty string is assigned to
3048 # CACHE-VAR and ACTION-IF-NOT-FOUND is invoked.
3049 #------------------------------------------------------------------------------
3050 AC_DEFUN([CS_COMPILER_IGNORE_LONG_DOUBLE],
3051 [CS_CHECK_BUILD_FLAGS(
3052 [how to suppress m4_default([$1],[C]) `long double' warnings],
3053 [m4_default([$2],[cs_cv_prog_compiler_ignore_long_double])],
3054 [CS_CREATE_TUPLE([-Wno-long-double])], [$1], [$3], [$4])])