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 Specify the default build method of this module
40 dnl SMB_MODULE_DEFAULT(1:name,2:default_build)
41 AC_DEFUN(SMB_MODULE_DEFAULT,
43 dnl Fall back to static if dlopen() is not available
44 [MODULE_DEFAULT_][$1]=$2
46 if test x"$[MODULE_DEFAULT_][$1]" = xSHARED -a x"$ac_cv_func_dlopen" != xyes; then
47 [MODULE_DEFAULT_][$1]=STATIC
51 dnl Mark specified module as shared
52 dnl SMB_MODULE(1:name,2:subsystem,3:default_build,4:object_files,5:private_proto_file,6:libs,7:whatif-static,8:whatif-shared,9:whatif-not)
55 AC_MSG_CHECKING([how to build $1])
56 if test -z "$[MODULE_DEFAULT_][$1]"; then
57 [MODULE_DEFAULT_][$1]=$3
59 if test x"$[MODULE_DEFAULT_][$1]" = xSHARED -a x"$ac_cv_func_dlopen" != xyes; then
60 [MODULE_DEFAULT_][$1]=STATIC
64 if test "$[MODULE_][$1]"; then
66 elif test "$[MODULE_]translit([$2], [A-Z], [a-z])" -a x"$[MODULE_DEFAULT_][$1]" != xNOT; then
67 DEST=$[MODULE_]translit([$2], [A-Z], [a-z])
69 DEST=$[MODULE_DEFAULT_][$1]
72 if test x"$DEST" = xSHARED; then
73 AC_DEFINE([$1][_init], [init_module], [Whether to build $1 as shared module])
74 $2_MODULES="$$2_MODULES bin/$1.$SHLIBEXT"
75 [MODULE_][$1][_PROTO]="$5"
76 [MODULE_][$1][_LIBS]="$6"
77 AC_MSG_RESULT([shared])
79 string_shared_modules="$string_shared_modules $1"
80 elif test x"$DEST" = xSTATIC; then
81 [init_static_modules_]translit([$2], [A-Z], [a-z])="$[init_static_modules_]translit([$2], [A-Z], [a-z]) $1_init();"
82 string_static_modules="$string_static_modules $1"
83 [MODULE_][$1][_PROTO]="$5"
84 $2_STATIC="$$2_STATIC $4"
87 AC_MSG_RESULT([static])
89 string_ignored_modules="$string_ignored_modules $1"
95 dnl SMB_SUBSYSTEM(1:name,2:init_objectfile,3:extra_objectfiles,4:public_proto_header,5:private_proto_header,6:libs)
96 AC_DEFUN(SMB_SUBSYSTEM,
98 dnl the core object files of the subsystem
102 dnl the staticly linked modules of the subsystem
105 dnl all object files of the subsystem
106 $1_OBJS="$$1_BASE $$1_STATIC"
109 dnl the libs required by the subsystem
110 $1_LIBS="$6 $$1_LIBS"
113 dnl the shared objects modules of the subsystem
116 dnl the public_prototype_header file
117 $1_PUBLIC_HEADER="$4"
118 AC_SUBST($1_PUBLIC_PROTO)
120 dnl the private_prototype_header file
121 $1_PRIVATE_HEADER="$5"
122 AC_SUBST($1_PRIVATE_PROTO)
124 AC_DEFINE_UNQUOTED([static_init_]translit([$1], [A-Z], [a-z]), [{$init_static_modules_]translit([$1], [A-Z], [a-z])[}], [Static init functions])
125 ifelse([$2], , :, [rm -f $2])
128 dnl AC_PROG_CC_FLAG(flag)
129 AC_DEFUN(AC_PROG_CC_FLAG,
130 [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
131 [echo 'void f(){}' > conftest.c
132 if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
140 dnl see if a declaration exists for a function or variable
141 dnl defines HAVE_function_DECL if it exists
142 dnl AC_HAVE_DECL(var, includes)
143 AC_DEFUN(AC_HAVE_DECL,
145 AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
146 AC_TRY_COMPILE([$2],[int i = (int)$1],
147 ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
148 if test x"$ac_cv_have_$1_decl" = x"yes"; then
149 AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL],1,[Whether $1() is available])
154 dnl check for a function in a library, but don't
155 dnl keep adding the same library to the LIBS variable.
156 dnl AC_LIBTESTFUNC(lib,func)
157 AC_DEFUN(AC_LIBTESTFUNC,
159 *-l$1*) AC_CHECK_FUNCS($2) ;;
160 *) AC_CHECK_LIB($1, $2)
166 # AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
167 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
168 # [ADD-ACTION-IF-FOUND],[OTHER-LIBRARIES])
169 # ------------------------------------------------------
171 # Use a cache variable name containing both the library and function name,
172 # because the test really is for library $1 defining function $3, not
173 # just for library $1. Separate tests with the same $1 and different $3s
174 # may have different results.
176 # Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$3])
177 # is asking for trouble, since AC_CHECK_LIB($lib, fun) would give
178 # ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence
179 # the AS_LITERAL_IF indirection.
181 # FIXME: This macro is extremely suspicious. It DEFINEs unconditionally,
182 # whatever the FUNCTION, in addition to not being a *S macro. Note
183 # that the cache does depend upon the function we are looking for.
185 # It is on purpose we used `ac_check_lib_ext_save_LIBS' and not just
186 # `ac_save_LIBS': there are many macros which don't want to see `LIBS'
187 # changed but still want to use AC_CHECK_LIB_EXT, so they save `LIBS'.
188 # And ``ac_save_LIBS' is too tempting a name, so let's leave them some
190 AC_DEFUN([AC_CHECK_LIB_EXT],
192 AH_CHECK_LIB_EXT([$1])
193 ac_check_lib_ext_save_LIBS=$LIBS
194 LIBS="-l$1 $$2 $7 $LIBS"
196 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1])],
197 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1''])])dnl
201 AH_CHECK_FUNC_EXT([$3])
203 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1_$3])],
204 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1''_$3])])dnl
205 AC_CACHE_CHECK([for $3 in -l$1], ac_Lib_func,
206 [AC_TRY_LINK_FUNC($3,
207 [AS_VAR_SET(ac_Lib_func, yes);
208 AS_VAR_SET(ac_Lib_ext, yes)],
209 [AS_VAR_SET(ac_Lib_func, no);
210 AS_VAR_SET(ac_Lib_ext, no)])
212 AS_IF([test AS_VAR_GET(ac_Lib_func) = yes],
213 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3))])dnl
214 AS_VAR_POPDEF([ac_Lib_func])dnl
216 AC_CACHE_CHECK([for -l$1], ac_Lib_ext,
217 [AC_TRY_LINK_FUNC([main],
218 [AS_VAR_SET(ac_Lib_ext, yes)],
219 [AS_VAR_SET(ac_Lib_ext, no)])
222 LIBS=$ac_check_lib_ext_save_LIBS
224 AS_IF([test AS_VAR_GET(ac_Lib_ext) = yes],
226 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
237 AS_VAR_POPDEF([ac_Lib_ext])dnl
240 # AH_CHECK_LIB_EXT(LIBNAME)
241 # ---------------------
242 m4_define([AH_CHECK_LIB_EXT],
243 [AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
244 [Define to 1 if you have the `]$1[' library (-l]$1[).])])
246 # AC_CHECK_FUNCS_EXT(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
247 # -----------------------------------------------------------------
248 dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable.
249 dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE)
250 AC_DEFUN([AC_CHECK_FUNC_EXT],
252 AH_CHECK_FUNC_EXT($1)
253 ac_check_func_ext_save_LIBS=$LIBS
255 AS_VAR_PUSHDEF([ac_var], [ac_cv_func_ext_$1])dnl
256 AC_CACHE_CHECK([for $1], ac_var,
257 [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
258 [AS_VAR_SET(ac_var, yes)],
259 [AS_VAR_SET(ac_var, no)])])
260 LIBS=$ac_check_func_ext_save_LIBS
261 AS_IF([test AS_VAR_GET(ac_var) = yes],
262 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) $3],
264 AS_VAR_POPDEF([ac_var])dnl
267 # AH_CHECK_FUNC_EXT(FUNCNAME)
268 # ---------------------
269 m4_define([AH_CHECK_FUNC_EXT],
270 [AH_TEMPLATE(AS_TR_CPP(HAVE_$1),
271 [Define to 1 if you have the `]$1[' function.])])
273 dnl Define an AC_DEFINE with ifndef guard.
274 dnl AC_N_DEFINE(VARIABLE [, VALUE])
276 [cat >> confdefs.h <<\EOF
278 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
284 dnl AC_ADD_INCLUDE(VARIABLE)
285 define(AC_ADD_INCLUDE,
286 [cat >> confdefs.h <<\EOF
291 dnl Copied from libtool.m4
292 AC_DEFUN(AC_PROG_LD_GNU,
293 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
294 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
295 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
296 ac_cv_prog_gnu_ld=yes
302 # Configure paths for LIBXML2
303 # Toshio Kuratomi 2001-04-21
305 # Configure paths for GLIB
306 # Owen Taylor 97-11-3
308 dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
309 dnl Test for XML, and define XML_CFLAGS and XML_LIBS
311 AC_DEFUN(AM_PATH_XML2,[
312 AC_ARG_WITH(xml-prefix,
313 [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)],
314 xml_config_prefix="$withval", xml_config_prefix="")
315 AC_ARG_WITH(xml-exec-prefix,
316 [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)],
317 xml_config_exec_prefix="$withval", xml_config_exec_prefix="")
318 AC_ARG_ENABLE(xmltest,
319 [ --disable-xmltest Do not try to compile and run a test LIBXML program],,
322 if test x$xml_config_exec_prefix != x ; then
323 xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix"
324 if test x${XML2_CONFIG+set} != xset ; then
325 XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
328 if test x$xml_config_prefix != x ; then
329 xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
330 if test x${XML2_CONFIG+set} != xset ; then
331 XML2_CONFIG=$xml_config_prefix/bin/xml2-config
335 AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
336 min_xml_version=ifelse([$1], ,2.0.0,[$1])
337 AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
339 if test "$XML2_CONFIG" = "no" ; then
342 XML_CFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
343 XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
344 xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
345 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
346 xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
347 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
348 xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
349 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
350 if test "x$enable_xmltest" = "xyes" ; then
351 ac_save_CFLAGS="$CFLAGS"
353 CFLAGS="$CFLAGS $XML_CFLAGS"
354 LIBS="$XML_LIBS $LIBS"
356 dnl Now check if the installed libxml is sufficiently new.
357 dnl (Also sanity checks the results of xml2-config to some extent)
364 #include <libxml/xmlversion.h>
369 int xml_major_version, xml_minor_version, xml_micro_version;
370 int major, minor, micro;
373 system("touch conf.xmltest");
375 /* Capture xml2-config output via autoconf/configure variables */
376 /* HP/UX 9 (%@#!) writes to sscanf strings */
377 tmp_version = (char *)strdup("$min_xml_version");
378 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
379 printf("%s, bad version string from xml2-config\n", "$min_xml_version");
384 /* Capture the version information from the header files */
385 tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
386 if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
387 printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
392 /* Compare xml2-config output to the libxml headers */
393 if ((xml_major_version != $xml_config_major_version) ||
394 (xml_minor_version != $xml_config_minor_version) ||
395 (xml_micro_version != $xml_config_micro_version))
397 printf("*** libxml header files (version %d.%d.%d) do not match\n",
398 xml_major_version, xml_minor_version, xml_micro_version);
399 printf("*** xml2-config (version %d.%d.%d)\n",
400 $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
403 /* Compare the headers to the library to make sure we match */
404 /* Less than ideal -- doesn't provide us with return value feedback,
405 * only exits if there's a serious mismatch between header and library.
409 /* Test that the library is greater than our minimum version */
410 if ((xml_major_version > major) ||
411 ((xml_major_version == major) && (xml_minor_version > minor)) ||
412 ((xml_major_version == major) && (xml_minor_version == minor) &&
413 (xml_micro_version >= micro)))
419 printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
420 xml_major_version, xml_minor_version, xml_micro_version);
421 printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
422 major, minor, micro);
423 printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
425 printf("*** If you have already installed a sufficiently new version, this error\n");
426 printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
427 printf("*** being found. The easiest way to fix this is to remove the old version\n");
428 printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
429 printf("*** correct copy of xml2-config. (In this case, you will have to\n");
430 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
431 printf("*** so that the correct libraries are found at run-time))\n");
435 ],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
436 CFLAGS="$ac_save_CFLAGS"
441 if test "x$no_xml" = x ; then
442 AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
443 ifelse([$2], , :, [$2])
446 if test "$XML2_CONFIG" = "no" ; then
447 echo "*** The xml2-config script installed by LIBXML could not be found"
448 echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
449 echo "*** your path, or set the XML2_CONFIG environment variable to the"
450 echo "*** full path to xml2-config."
452 if test -f conf.xmltest ; then
455 echo "*** Could not run libxml test program, checking why..."
456 CFLAGS="$CFLAGS $XML_CFLAGS"
457 LIBS="$LIBS $XML_LIBS"
459 #include <libxml/xmlversion.h>
461 ], [ LIBXML_TEST_VERSION; return 0;],
462 [ echo "*** The test program compiled, but did not run. This usually means"
463 echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
464 echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
465 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
466 echo "*** to the installed location Also, make sure you have run ldconfig if that"
467 echo "*** is required on your system"
469 echo "*** If you have an old version installed, it is best to remove it, although"
470 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
471 [ echo "*** The test program failed to compile or link. See the file config.log for the"
472 echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
473 echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
474 echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
475 CFLAGS="$ac_save_CFLAGS"
482 ifelse([$3], , :, [$3])
489 # =========================================================================
490 # AM_PATH_MYSQL : MySQL library
492 dnl AM_PATH_MYSQL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
493 dnl Test for MYSQL, and define MYSQL_CFLAGS and MYSQL_LIBS
495 AC_DEFUN(AM_PATH_MYSQL,
497 dnl Get the cflags and libraries from the mysql_config script
499 AC_ARG_WITH(mysql-prefix,[ --with-mysql-prefix=PFX Prefix where MYSQL is installed (optional)],
500 mysql_prefix="$withval", mysql_prefix="")
501 AC_ARG_WITH(mysql-exec-prefix,[ --with-mysql-exec-prefix=PFX Exec prefix where MYSQL is installed (optional)],
502 mysql_exec_prefix="$withval", mysql_exec_prefix="")
504 if test x$mysql_exec_prefix != x ; then
505 mysql_args="$mysql_args --exec-prefix=$mysql_exec_prefix"
506 if test x${MYSQL_CONFIG+set} != xset ; then
507 MYSQL_CONFIG=$mysql_exec_prefix/bin/mysql_config
510 if test x$mysql_prefix != x ; then
511 mysql_args="$mysql_args --prefix=$mysql_prefix"
512 if test x${MYSQL_CONFIG+set} != xset ; then
513 MYSQL_CONFIG=$mysql_prefix/bin/mysql_config
517 AC_REQUIRE([AC_CANONICAL_TARGET])
518 AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no)
519 AC_MSG_CHECKING(for MYSQL)
521 if test "$MYSQL_CONFIG" = "no" ; then
525 ifelse([$2], , :, [$2])
527 MYSQL_CFLAGS=`$MYSQL_CONFIG $mysqlconf_args --cflags | sed -e "s/'//g"`
528 MYSQL_LIBS=`$MYSQL_CONFIG $mysqlconf_args --libs | sed -e "s/'//g"`
530 ifelse([$1], , :, [$1])
532 AC_SUBST(MYSQL_CFLAGS)
536 dnl Removes -I/usr/include/? from given variable
537 AC_DEFUN(CFLAGS_REMOVE_USR_INCLUDE,[
541 -I/usr/include|-I/usr/include/) ;;
542 *) ac_new_flags="[$]ac_new_flags [$]i" ;;
548 dnl Removes -L/usr/lib/? from given variable
549 AC_DEFUN(LIB_REMOVE_USR_LIB,[
553 -L/usr/lib|-L/usr/lib/) ;;
554 *) ac_new_flags="[$]ac_new_flags [$]i" ;;
560 dnl From Bruno Haible.
564 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
565 dnl those with the standalone portable libiconv installed).
566 AC_MSG_CHECKING(for iconv in $1)
567 jm_cv_func_iconv="no"
570 AC_TRY_LINK([#include <stdlib.h>
571 #include <giconv.h>],
572 [iconv_t cd = iconv_open("","");
573 iconv(cd,NULL,NULL,NULL,NULL);
578 if test "$jm_cv_func_iconv" != yes; then
579 AC_TRY_LINK([#include <stdlib.h>
581 [iconv_t cd = iconv_open("","");
582 iconv(cd,NULL,NULL,NULL,NULL);
584 jm_cv_func_iconv=yes)
586 if test "$jm_cv_lib_iconv" != yes; then
588 LIBS="$LIBS -lgiconv"
589 AC_TRY_LINK([#include <stdlib.h>
590 #include <giconv.h>],
591 [iconv_t cd = iconv_open("","");
592 iconv(cd,NULL,NULL,NULL,NULL);
599 if test "$jm_cv_func_iconv" != yes; then
602 AC_TRY_LINK([#include <stdlib.h>
604 [iconv_t cd = iconv_open("","");
605 iconv(cd,NULL,NULL,NULL,NULL);
608 jm_cv_func_iconv=yes)
614 if test "$jm_cv_func_iconv" = yes; then
615 if test "$jm_cv_giconv" = yes; then
616 AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h])
620 AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h])
627 if test "$jm_cv_lib_iconv" = yes; then
628 if test "$jm_cv_giconv" = yes; then
629 LIBS="$LIBS -lgiconv"
636 dnl CFLAGS_ADD_DIR(CFLAGS, $INCDIR)
637 dnl This function doesn't add -I/usr/include into CFLAGS
638 AC_DEFUN(CFLAGS_ADD_DIR,[
639 if test "$2" != "/usr/include" ; then
644 dnl LIB_ADD_DIR(LDFLAGS, $LIBDIR)
645 dnl This function doesn't add -L/usr/lib into LDFLAGS
646 AC_DEFUN(LIB_ADD_DIR,[
647 if test "$2" != "/usr/lib" ; then
652 dnl AC_ENABLE_SHARED - implement the --enable-shared flag
653 dnl Usage: AC_ENABLE_SHARED[(DEFAULT)]
654 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
656 AC_DEFUN([AC_ENABLE_SHARED],
657 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
658 AC_ARG_ENABLE(shared,
659 changequote(<<, >>)dnl
660 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
662 [p=${PACKAGE-default}
664 yes) enable_shared=yes ;;
665 no) enable_shared=no ;;
668 # Look at the argument we got. We use all the common list separators.
669 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
670 for pkg in $enableval; do
671 if test "X$pkg" = "X$p"; then
679 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
682 dnl AC_ENABLE_STATIC - implement the --enable-static flag
683 dnl Usage: AC_ENABLE_STATIC[(DEFAULT)]
684 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
686 AC_DEFUN([AC_ENABLE_STATIC],
687 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
688 AC_ARG_ENABLE(static,
689 changequote(<<, >>)dnl
690 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
692 [p=${PACKAGE-default}
694 yes) enable_static=yes ;;
695 no) enable_static=no ;;
698 # Look at the argument we got. We use all the common list separators.
699 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
700 for pkg in $enableval; do
701 if test "X$pkg" = "X$p"; then
708 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
711 dnl AC_DISABLE_STATIC - set the default static flag to --disable-static
712 AC_DEFUN([AC_DISABLE_STATIC],
713 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
714 AC_ENABLE_STATIC(no)])
717 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
718 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
719 dnl also defines GSTUFF_PKG_ERRORS on error
720 AC_DEFUN(PKG_CHECK_MODULES, [
723 if test -z "$PKG_CONFIG"; then
724 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
727 if test "$PKG_CONFIG" = "no" ; then
728 echo "*** The pkg-config script could not be found. Make sure it is"
729 echo "*** in your path, or set the PKG_CONFIG environment variable"
730 echo "*** to the full path to pkg-config."
731 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
733 PKG_CONFIG_MIN_VERSION=0.9.0
734 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
735 AC_MSG_CHECKING(for $2)
737 if $PKG_CONFIG --exists "$2" ; then
741 AC_MSG_CHECKING($1_CFLAGS)
742 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
743 AC_MSG_RESULT($$1_CFLAGS)
745 AC_MSG_CHECKING($1_LIBS)
746 $1_LIBS=`$PKG_CONFIG --libs "$2"`
747 AC_MSG_RESULT($$1_LIBS)
751 ## If we have a custom action on failure, don't print errors, but
752 ## do set a variable so people can do so.
753 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
754 ifelse([$4], ,echo $$1_PKG_ERRORS,)
760 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
761 echo "*** See http://www.freedesktop.org/software/pkgconfig"
765 if test $succeeded = yes; then
766 ifelse([$3], , :, [$3])
768 ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])