1 dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
2 dnl if the cache file is inconsistent with the current host,
3 dnl target and build system types, execute CMD or print a default
5 AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
6 AC_REQUIRE([AC_CANONICAL_SYSTEM])
7 AC_MSG_CHECKING([config.cache system type])
8 if { test x"${ac_cv_host_system_type+set}" = x"set" &&
9 test x"$ac_cv_host_system_type" != x"$host"; } ||
10 { test x"${ac_cv_build_system_type+set}" = x"set" &&
11 test x"$ac_cv_build_system_type" != x"$build"; } ||
12 { test x"${ac_cv_target_system_type+set}" = x"set" &&
13 test x"$ac_cv_target_system_type" != x"$target"; }; then
14 AC_MSG_RESULT([different])
16 [AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
20 ac_cv_host_system_type="$host"
21 ac_cv_build_system_type="$build"
22 ac_cv_target_system_type="$target"
26 dnl test whether dirent has a d_off member
27 AC_DEFUN(AC_DIRENT_D_OFF,
28 [AC_CACHE_CHECK([for d_off in dirent], ac_cv_dirent_d_off,
31 #include <sys/types.h>
32 #include <dirent.h>], [struct dirent d; d.d_off;],
33 ac_cv_dirent_d_off=yes, ac_cv_dirent_d_off=no)])
34 if test $ac_cv_dirent_d_off = yes; then
35 AC_DEFINE(HAVE_DIRENT_D_OFF,1,[Whether dirent has a d_off member])
39 dnl Mark specified module as shared
40 dnl SMB_MODULE(name,static_files,shared_files,subsystem,whatif-static,whatif-shared)
43 AC_MSG_CHECKING([how to build $1])
44 if test "$[MODULE_][$1]"; then
46 elif test "$[MODULE_]translit([$4], [A-Z], [a-z])" -a "$[MODULE_DEFAULT_][$1]"; then
47 DEST=$[MODULE_]translit([$4], [A-Z], [a-z])
49 DEST=$[MODULE_DEFAULT_][$1]
52 if test x"$DEST" = xSHARED; then
53 AC_DEFINE([$1][_init], [init_module], [Whether to build $1 as shared module])
54 $4_MODULES="$$4_MODULES $3"
55 AC_MSG_RESULT([shared])
57 elif test x"$DEST" = xSTATIC; then
58 [init_static_modules_]translit([$4], [A-Z], [a-z])="$[init_static_modules_]translit([$4], [A-Z], [a-z]) $1_init();"
59 string_static_modules="$string_static_modules $1"
60 $4_STATIC="$$4_STATIC $2"
63 AC_MSG_RESULT([static])
69 AC_DEFUN(SMB_SUBSYSTEM,
73 AC_DEFINE_UNQUOTED([static_init_]translit([$1], [A-Z], [a-z]), [{$init_static_modules_]translit([$1], [A-Z], [a-z])[}], [Static init functions])
74 ifelse([$2], , :, [touch $2])
77 dnl AC_PROG_CC_FLAG(flag)
78 AC_DEFUN(AC_PROG_CC_FLAG,
79 [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
80 [echo 'void f(){}' > conftest.c
81 if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
89 dnl see if a declaration exists for a function or variable
90 dnl defines HAVE_function_DECL if it exists
91 dnl AC_HAVE_DECL(var, includes)
92 AC_DEFUN(AC_HAVE_DECL,
94 AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
95 AC_TRY_COMPILE([$2],[int i = (int)$1],
96 ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
97 if test x"$ac_cv_have_$1_decl" = x"yes"; then
98 AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL],1,[Whether $1() is available])
103 dnl check for a function in a library, but don't
104 dnl keep adding the same library to the LIBS variable.
105 dnl AC_LIBTESTFUNC(lib,func)
106 AC_DEFUN(AC_LIBTESTFUNC,
108 *-l$1*) AC_CHECK_FUNCS($2) ;;
109 *) AC_CHECK_LIB($1, $2)
115 # AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
116 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
117 # [ADD-ACTION-IF-FOUND],[OTHER-LIBRARIES])
118 # ------------------------------------------------------
120 # Use a cache variable name containing both the library and function name,
121 # because the test really is for library $1 defining function $3, not
122 # just for library $1. Separate tests with the same $1 and different $3s
123 # may have different results.
125 # Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$3])
126 # is asking for troubles, since AC_CHECK_LIB($lib, fun) would give
127 # ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence
128 # the AS_LITERAL_IF indirection.
130 # FIXME: This macro is extremely suspicious. It DEFINEs unconditionnally,
131 # whatever the FUNCTION, in addition to not being a *S macro. Note
132 # that the cache does depend upon the function we are looking for.
134 # It is on purpose we used `ac_check_lib_ext_save_LIBS' and not just
135 # `ac_save_LIBS': there are many macros which don't want to see `LIBS'
136 # changed but still want to use AC_CHECK_LIB_EXT, so they save `LIBS'.
137 # And ``ac_save_LIBS' is too tempting a name, so let's leave them some
139 AC_DEFUN([AC_CHECK_LIB_EXT],
141 AH_CHECK_LIB_EXT([$1])
142 ac_check_lib_ext_save_LIBS=$LIBS
143 LIBS="-l$1 $$2 $7 $LIBS"
145 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1])],
146 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1''])])dnl
150 AH_CHECK_FUNC_EXT([$3])
152 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1_$3])],
153 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1''_$3])])dnl
154 AC_CACHE_CHECK([for $3 in -l$1], ac_Lib_func,
155 [AC_TRY_LINK_FUNC($3,
156 [AS_VAR_SET(ac_Lib_func, yes);
157 AS_VAR_SET(ac_Lib_ext, yes)],
158 [AS_VAR_SET(ac_Lib_func, no);
159 AS_VAR_SET(ac_Lib_ext, no)])
161 AS_IF([test AS_VAR_GET(ac_Lib_func) = yes],
162 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3))])dnl
163 AS_VAR_POPDEF([ac_Lib_func])dnl
165 AC_CACHE_CHECK([for -l$1], ac_Lib_ext,
166 [AC_TRY_LINK_FUNC([main],
167 [AS_VAR_SET(ac_Lib_ext, yes)],
168 [AS_VAR_SET(ac_Lib_ext, no)])
171 LIBS=$ac_check_lib_ext_save_LIBS
173 AS_IF([test AS_VAR_GET(ac_Lib_ext) = yes],
175 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
186 AS_VAR_POPDEF([ac_Lib_ext])dnl
189 # AH_CHECK_LIB_EXT(LIBNAME)
190 # ---------------------
191 m4_define([AH_CHECK_LIB_EXT],
192 [AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
193 [Define to 1 if you have the `]$1[' library (-l]$1[).])])
195 # AC_CHECK_FUNCS_EXT(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
196 # -----------------------------------------------------------------
197 dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable.
198 dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE)
199 AC_DEFUN([AC_CHECK_FUNC_EXT],
201 AH_CHECK_FUNC_EXT($1)
202 ac_check_func_ext_save_LIBS=$LIBS
204 AS_VAR_PUSHDEF([ac_var], [ac_cv_func_ext_$1])dnl
205 AC_CACHE_CHECK([for $1], ac_var,
206 [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
207 [AS_VAR_SET(ac_var, yes)],
208 [AS_VAR_SET(ac_var, no)])])
209 LIBS=$ac_check_func_ext_save_LIBS
210 AS_IF([test AS_VAR_GET(ac_var) = yes],
211 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) $3],
213 AS_VAR_POPDEF([ac_var])dnl
216 # AH_CHECK_FUNC_EXT(FUNCNAME)
217 # ---------------------
218 m4_define([AH_CHECK_FUNC_EXT],
219 [AH_TEMPLATE(AS_TR_CPP(HAVE_$1),
220 [Define to 1 if you have the `]$1[' function.])])
222 dnl Define an AC_DEFINE with ifndef guard.
223 dnl AC_N_DEFINE(VARIABLE [, VALUE])
225 [cat >> confdefs.h <<\EOF
227 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
233 dnl AC_ADD_INCLUDE(VARIABLE)
234 define(AC_ADD_INCLUDE,
235 [cat >> confdefs.h <<\EOF
240 dnl Copied from libtool.m4
241 AC_DEFUN(AC_PROG_LD_GNU,
242 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
243 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
244 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
245 ac_cv_prog_gnu_ld=yes
251 # Configure paths for LIBXML2
252 # Toshio Kuratomi 2001-04-21
254 # Configure paths for GLIB
255 # Owen Taylor 97-11-3
257 dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
258 dnl Test for XML, and define XML_CFLAGS and XML_LIBS
260 AC_DEFUN(AM_PATH_XML2,[
261 AC_ARG_WITH(xml-prefix,
262 [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)],
263 xml_config_prefix="$withval", xml_config_prefix="")
264 AC_ARG_WITH(xml-exec-prefix,
265 [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)],
266 xml_config_exec_prefix="$withval", xml_config_exec_prefix="")
267 AC_ARG_ENABLE(xmltest,
268 [ --disable-xmltest Do not try to compile and run a test LIBXML program],,
271 if test x$xml_config_exec_prefix != x ; then
272 xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix"
273 if test x${XML2_CONFIG+set} != xset ; then
274 XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
277 if test x$xml_config_prefix != x ; then
278 xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
279 if test x${XML2_CONFIG+set} != xset ; then
280 XML2_CONFIG=$xml_config_prefix/bin/xml2-config
284 AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
285 min_xml_version=ifelse([$1], ,2.0.0,[$1])
286 AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
288 if test "$XML2_CONFIG" = "no" ; then
291 XML_CFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
292 XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
293 xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
294 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
295 xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
296 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
297 xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
298 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
299 if test "x$enable_xmltest" = "xyes" ; then
300 ac_save_CFLAGS="$CFLAGS"
302 CFLAGS="$CFLAGS $XML_CFLAGS"
303 LIBS="$XML_LIBS $LIBS"
305 dnl Now check if the installed libxml is sufficiently new.
306 dnl (Also sanity checks the results of xml2-config to some extent)
313 #include <libxml/xmlversion.h>
318 int xml_major_version, xml_minor_version, xml_micro_version;
319 int major, minor, micro;
322 system("touch conf.xmltest");
324 /* Capture xml2-config output via autoconf/configure variables */
325 /* HP/UX 9 (%@#!) writes to sscanf strings */
326 tmp_version = (char *)strdup("$min_xml_version");
327 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
328 printf("%s, bad version string from xml2-config\n", "$min_xml_version");
333 /* Capture the version information from the header files */
334 tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
335 if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
336 printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
341 /* Compare xml2-config output to the libxml headers */
342 if ((xml_major_version != $xml_config_major_version) ||
343 (xml_minor_version != $xml_config_minor_version) ||
344 (xml_micro_version != $xml_config_micro_version))
346 printf("*** libxml header files (version %d.%d.%d) do not match\n",
347 xml_major_version, xml_minor_version, xml_micro_version);
348 printf("*** xml2-config (version %d.%d.%d)\n",
349 $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
352 /* Compare the headers to the library to make sure we match */
353 /* Less than ideal -- doesn't provide us with return value feedback,
354 * only exits if there's a serious mismatch between header and library.
358 /* Test that the library is greater than our minimum version */
359 if ((xml_major_version > major) ||
360 ((xml_major_version == major) && (xml_minor_version > minor)) ||
361 ((xml_major_version == major) && (xml_minor_version == minor) &&
362 (xml_micro_version >= micro)))
368 printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
369 xml_major_version, xml_minor_version, xml_micro_version);
370 printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
371 major, minor, micro);
372 printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
374 printf("*** If you have already installed a sufficiently new version, this error\n");
375 printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
376 printf("*** being found. The easiest way to fix this is to remove the old version\n");
377 printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
378 printf("*** correct copy of xml2-config. (In this case, you will have to\n");
379 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
380 printf("*** so that the correct libraries are found at run-time))\n");
384 ],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
385 CFLAGS="$ac_save_CFLAGS"
390 if test "x$no_xml" = x ; then
391 AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
392 ifelse([$2], , :, [$2])
395 if test "$XML2_CONFIG" = "no" ; then
396 echo "*** The xml2-config script installed by LIBXML could not be found"
397 echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
398 echo "*** your path, or set the XML2_CONFIG environment variable to the"
399 echo "*** full path to xml2-config."
401 if test -f conf.xmltest ; then
404 echo "*** Could not run libxml test program, checking why..."
405 CFLAGS="$CFLAGS $XML_CFLAGS"
406 LIBS="$LIBS $XML_LIBS"
408 #include <libxml/xmlversion.h>
410 ], [ LIBXML_TEST_VERSION; return 0;],
411 [ echo "*** The test program compiled, but did not run. This usually means"
412 echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
413 echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
414 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
415 echo "*** to the installed location Also, make sure you have run ldconfig if that"
416 echo "*** is required on your system"
418 echo "*** If you have an old version installed, it is best to remove it, although"
419 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
420 [ echo "*** The test program failed to compile or link. See the file config.log for the"
421 echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
422 echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
423 echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
424 CFLAGS="$ac_save_CFLAGS"
431 ifelse([$3], , :, [$3])
438 # =========================================================================
439 # AM_PATH_MYSQL : MySQL library
441 dnl AM_PATH_MYSQL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
442 dnl Test for MYSQL, and define MYSQL_CFLAGS and MYSQL_LIBS
444 AC_DEFUN(AM_PATH_MYSQL,
446 dnl Get the cflags and libraries from the mysql_config script
448 AC_ARG_WITH(mysql-prefix,[ --with-mysql-prefix=PFX Prefix where MYSQL is installed (optional)],
449 mysql_prefix="$withval", mysql_prefix="")
450 AC_ARG_WITH(mysql-exec-prefix,[ --with-mysql-exec-prefix=PFX Exec prefix where MYSQL is installed (optional)],
451 mysql_exec_prefix="$withval", mysql_exec_prefix="")
453 if test x$mysql_exec_prefix != x ; then
454 mysql_args="$mysql_args --exec-prefix=$mysql_exec_prefix"
455 if test x${MYSQL_CONFIG+set} != xset ; then
456 MYSQL_CONFIG=$mysql_exec_prefix/bin/mysql_config
459 if test x$mysql_prefix != x ; then
460 mysql_args="$mysql_args --prefix=$mysql_prefix"
461 if test x${MYSQL_CONFIG+set} != xset ; then
462 MYSQL_CONFIG=$mysql_prefix/bin/mysql_config
466 AC_REQUIRE([AC_CANONICAL_TARGET])
467 AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no)
468 AC_MSG_CHECKING(for MYSQL)
470 if test "$MYSQL_CONFIG" = "no" ; then
474 ifelse([$2], , :, [$2])
476 MYSQL_CFLAGS=`$MYSQL_CONFIG $mysqlconf_args --cflags | sed -e "s/'//g"`
477 MYSQL_LIBS=`$MYSQL_CONFIG $mysqlconf_args --libs | sed -e "s/'//g"`
479 ifelse([$1], , :, [$1])
481 AC_SUBST(MYSQL_CFLAGS)
485 dnl Removes -I/usr/include/? from given variable
486 AC_DEFUN(CFLAGS_REMOVE_USR_INCLUDE,[
490 -I/usr/include|-I/usr/include/) ;;
491 *) ac_new_flags="[$]ac_new_flags [$]i" ;;
497 dnl Removes -L/usr/lib/? from given variable
498 AC_DEFUN(LIB_REMOVE_USR_LIB,[
502 -L/usr/lib|-L/usr/lib/) ;;
503 *) ac_new_flags="[$]ac_new_flags [$]i" ;;
509 dnl From Bruno Haible.
513 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
514 dnl those with the standalone portable libiconv installed).
515 AC_MSG_CHECKING(for iconv in $1)
516 jm_cv_func_iconv="no"
520 LIBS="$LIBS -lbiconv"
521 AC_TRY_LINK([#include <stdlib.h>
522 #include <biconv.h>],
523 [iconv_t cd = iconv_open("","");
524 iconv(cd,NULL,NULL,NULL,NULL);
528 jm_cv_include="biconv.h"
529 jm_cv_lib_iconv="yes")
532 if test "$jm_cv_func_iconv" != yes; then
533 AC_TRY_LINK([#include <stdlib.h>
534 #include <giconv.h>],
535 [iconv_t cd = iconv_open("","");
536 iconv(cd,NULL,NULL,NULL,NULL);
539 jm_cv_include="giconv.h"
542 if test "$jm_cv_func_iconv" != yes; then
543 AC_TRY_LINK([#include <stdlib.h>
545 [iconv_t cd = iconv_open("","");
546 iconv(cd,NULL,NULL,NULL,NULL);
548 jm_cv_include="iconv.h"
549 jm_cv_func_iconv=yes)
551 if test "$jm_cv_lib_iconv" != yes; then
553 LIBS="$LIBS -lgiconv"
554 AC_TRY_LINK([#include <stdlib.h>
555 #include <giconv.h>],
556 [iconv_t cd = iconv_open("","");
557 iconv(cd,NULL,NULL,NULL,NULL);
561 jm_cv_include="giconv.h"
565 if test "$jm_cv_func_iconv" != yes; then
568 AC_TRY_LINK([#include <stdlib.h>
570 [iconv_t cd = iconv_open("","");
571 iconv(cd,NULL,NULL,NULL,NULL);
574 jm_cv_include="iconv.h"
575 jm_cv_func_iconv=yes)
581 if test "$jm_cv_func_iconv" = yes; then
582 if test "$jm_cv_giconv" = yes; then
583 AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h])
587 if test "$jm_cv_biconv" = yes; then
588 AC_DEFINE(HAVE_BICONV, 1, [What header to include for iconv() function: biconv.h])
592 AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h])
600 if test "$jm_cv_lib_iconv" = yes; then
601 if test "$jm_cv_giconv" = yes; then
602 LIBS="$LIBS -lgiconv"
604 if test "$jm_cv_biconv" = yes; then
605 LIBS="$LIBS -lbiconv"
613 AC_DEFUN(rjs_CHARSET,[
614 dnl Find out if we can convert from $1 to UCS2-LE
615 AC_MSG_CHECKING([can we convert from $1 to UCS2-LE?])
617 #include <$jm_cv_include>
619 iconv_t cd = iconv_open("$1", "UCS-2LE");
620 if (cd == 0 || cd == (iconv_t)-1) {
625 ],ICONV_CHARSET=$1,ICONV_CHARSET=no,ICONV_CHARSET=cross)
626 AC_MSG_RESULT($ICONV_CHARSET)
629 dnl CFLAGS_ADD_DIR(CFLAGS, $INCDIR)
630 dnl This function doesn't add -I/usr/include into CFLAGS
631 AC_DEFUN(CFLAGS_ADD_DIR,[
632 if test "$2" != "/usr/include" ; then
637 dnl LIB_ADD_DIR(LDFLAGS, $LIBDIR)
638 dnl This function doesn't add -L/usr/lib into LDFLAGS
639 AC_DEFUN(LIB_ADD_DIR,[
640 if test "$2" != "/usr/lib" ; then
645 dnl AC_ENABLE_SHARED - implement the --enable-shared flag
646 dnl Usage: AC_ENABLE_SHARED[(DEFAULT)]
647 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
649 AC_DEFUN([AC_ENABLE_SHARED],
650 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
651 AC_ARG_ENABLE(shared,
652 changequote(<<, >>)dnl
653 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
655 [p=${PACKAGE-default}
657 yes) enable_shared=yes ;;
658 no) enable_shared=no ;;
661 # Look at the argument we got. We use all the common list separators.
662 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
663 for pkg in $enableval; do
664 if test "X$pkg" = "X$p"; then
672 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
675 dnl AC_ENABLE_STATIC - implement the --enable-static flag
676 dnl Usage: AC_ENABLE_STATIC[(DEFAULT)]
677 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
679 AC_DEFUN([AC_ENABLE_STATIC],
680 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
681 AC_ARG_ENABLE(static,
682 changequote(<<, >>)dnl
683 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
685 [p=${PACKAGE-default}
687 yes) enable_static=yes ;;
688 no) enable_static=no ;;
691 # Look at the argument we got. We use all the common list separators.
692 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
693 for pkg in $enableval; do
694 if test "X$pkg" = "X$p"; then
701 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
704 dnl AC_DISABLE_STATIC - set the default static flag to --disable-static
705 AC_DEFUN([AC_DISABLE_STATIC],
706 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
707 AC_ENABLE_STATIC(no)])
709 dnl AC_TRY_RUN_STRICT(PROGRAM,CFLAGS,CPPFLAGS,LDFLAGS,
710 dnl [ACTION-IF-TRUE],[ACTION-IF-FALSE],
711 dnl [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
712 AC_DEFUN( [AC_TRY_RUN_STRICT],
714 old_CFLAGS="$CFLAGS";
717 old_CPPFLAGS="$CPPFLAGS";
720 old_LDFLAGS="$LDFLAGS";
723 AC_TRY_RUN([$1],[$5],[$6],[$7]);
724 CFLAGS="$old_CFLAGS";
727 CPPFLAGS="$old_CPPFLAGS";
730 LDFLAGS="$old_LDFLAGS";