b40152a6ee957a1b4e136a098ad3b098fb7c78ca
[samba.git] / source4 / aclocal.m4
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
4 dnl error message.
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])
15         ifelse($#, 1, [$1],
16                 [AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
17     else
18         AC_MSG_RESULT([same])
19     fi
20     ac_cv_host_system_type="$host"
21     ac_cv_build_system_type="$build"
22     ac_cv_target_system_type="$target"
23 ])
24
25
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,
29 [AC_TRY_COMPILE([
30 #include <unistd.h>
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])
36 fi
37 ])
38
39 dnl Specify the default build method of this module 
40 dnl SMB_MODULE_DEFAULT(name,default_build)
41 AC_DEFUN(SMB_MODULE_DEFAULT,
42 [
43         dnl Fall back to static if dlopen() is not available
44         eval MODULE_DEFAULT_$1=$2
45
46         if test x"MODULE_DEFAULT_$1" = xSHARED -a x"$ac_cv_func_dlopen" != xyes; then
47                 eval MODULE_DEFAULT_$1=STATIC
48         fi
49 ])
50
51 dnl Mark specified module as shared
52 dnl SMB_MODULE(name,default_build,static_files,shared_files,subsystem,whatif-static,whatif-shared,whatif-not)
53 AC_DEFUN(SMB_MODULE,
54 [
55         AC_MSG_CHECKING([how to build $1])
56         if test -z "$[MODULE_DEFAULT_][$1]"; then
57                 eval MODULE_DEFAULT_$1=$2
58
59                 if test x"MODULE_DEFAULT_$1" = xSHARED -a x"$ac_cv_func_dlopen" != xyes; then
60                         eval MODULE_DEFAULT_$1=STATIC
61                 fi
62         fi
63
64         if test "$[MODULE_][$1]"; then
65                 DEST=$[MODULE_][$1]
66         elif test "$[MODULE_]translit([$5], [A-Z], [a-z])" -a "$[MODULE_DEFAULT_][$1]"; then
67                 DEST=$[MODULE_]translit([$5], [A-Z], [a-z])
68         else
69                 DEST=$[MODULE_DEFAULT_][$1]
70         fi
71         
72         if test x"$DEST" = xSHARED; then
73                 AC_DEFINE([$1][_init], [init_module], [Whether to build $1 as shared module])
74                 $5_MODULES="$$5_MODULES $4"
75                 AC_MSG_RESULT([shared])
76                 [$7]
77                 string_shared_modules="$string_shared_modules $1"
78         elif test x"$DEST" = xSTATIC; then
79                 [init_static_modules_]translit([$5], [A-Z], [a-z])="$[init_static_modules_]translit([$5], [A-Z], [a-z]) $1_init();"
80                 string_static_modules="$string_static_modules $1"
81                 $5_STATIC="$$5_STATIC $3"
82                 AC_SUBST($5_STATIC)
83                 [$6]
84                 AC_MSG_RESULT([static])
85         else
86                 string_ignored_modules="$string_ignored_modules $1"
87                 [$8]
88                 AC_MSG_RESULT([not])
89         fi
90 ])
91
92 AC_DEFUN(SMB_SUBSYSTEM,
93 [
94         AC_SUBST($1_STATIC)
95         AC_SUBST($1_MODULES)
96         AC_DEFINE_UNQUOTED([static_init_]translit([$1], [A-Z], [a-z]), [{$init_static_modules_]translit([$1], [A-Z], [a-z])[}], [Static init functions])
97         ifelse([$2], , :, [rm -f $2])
98 ])
99
100 dnl AC_PROG_CC_FLAG(flag)
101 AC_DEFUN(AC_PROG_CC_FLAG,
102 [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
103 [echo 'void f(){}' > conftest.c
104 if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
105   ac_cv_prog_cc_$1=yes
106 else
107   ac_cv_prog_cc_$1=no
108 fi
109 rm -f conftest*
110 ])])
111
112 dnl see if a declaration exists for a function or variable
113 dnl defines HAVE_function_DECL if it exists
114 dnl AC_HAVE_DECL(var, includes)
115 AC_DEFUN(AC_HAVE_DECL,
116 [
117  AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
118     AC_TRY_COMPILE([$2],[int i = (int)$1],
119         ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
120  if test x"$ac_cv_have_$1_decl" = x"yes"; then
121     AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL],1,[Whether $1() is available])
122  fi
123 ])
124
125
126 dnl check for a function in a library, but don't
127 dnl keep adding the same library to the LIBS variable.
128 dnl AC_LIBTESTFUNC(lib,func)
129 AC_DEFUN(AC_LIBTESTFUNC,
130 [case "$LIBS" in
131   *-l$1*) AC_CHECK_FUNCS($2) ;;
132   *) AC_CHECK_LIB($1, $2) 
133      AC_CHECK_FUNCS($2)
134   ;;
135   esac
136 ])
137
138 dnl Define an AC_DEFINE with ifndef guard.
139 dnl AC_N_DEFINE(VARIABLE [, VALUE])
140 define(AC_N_DEFINE,
141 [cat >> confdefs.h <<\EOF
142 [#ifndef] $1
143 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
144 [#endif]
145 EOF
146 ])
147
148 dnl Add an #include
149 dnl AC_ADD_INCLUDE(VARIABLE)
150 define(AC_ADD_INCLUDE,
151 [cat >> confdefs.h <<\EOF
152 [#include] $1
153 EOF
154 ])
155
156 dnl Copied from libtool.m4
157 AC_DEFUN(AC_PROG_LD_GNU,
158 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
159 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
160 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
161   ac_cv_prog_gnu_ld=yes
162 else
163   ac_cv_prog_gnu_ld=no
164 fi])
165 ])
166
167 # Configure paths for LIBXML2
168 # Toshio Kuratomi 2001-04-21
169 # Adapted from:
170 # Configure paths for GLIB
171 # Owen Taylor     97-11-3
172
173 dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
174 dnl Test for XML, and define XML_CFLAGS and XML_LIBS
175 dnl
176 AC_DEFUN(AM_PATH_XML2,[ 
177 AC_ARG_WITH(xml-prefix,
178             [  --with-xml-prefix=PFX   Prefix where libxml is installed (optional)],
179             xml_config_prefix="$withval", xml_config_prefix="")
180 AC_ARG_WITH(xml-exec-prefix,
181             [  --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)],
182             xml_config_exec_prefix="$withval", xml_config_exec_prefix="")
183 AC_ARG_ENABLE(xmltest,
184               [  --disable-xmltest       Do not try to compile and run a test LIBXML program],,
185               enable_xmltest=yes)
186
187   if test x$xml_config_exec_prefix != x ; then
188      xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix"
189      if test x${XML2_CONFIG+set} != xset ; then
190         XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
191      fi
192   fi
193   if test x$xml_config_prefix != x ; then
194      xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
195      if test x${XML2_CONFIG+set} != xset ; then
196         XML2_CONFIG=$xml_config_prefix/bin/xml2-config
197      fi
198   fi
199
200   AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
201   min_xml_version=ifelse([$1], ,2.0.0,[$1])
202   AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
203   no_xml=""
204   if test "$XML2_CONFIG" = "no" ; then
205     no_xml=yes
206   else
207     XML_CFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
208     XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
209     xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
210            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
211     xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
212            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
213     xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
214            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
215     if test "x$enable_xmltest" = "xyes" ; then
216       ac_save_CFLAGS="$CFLAGS"
217       ac_save_LIBS="$LIBS"
218       CFLAGS="$CFLAGS $XML_CFLAGS"
219       LIBS="$XML_LIBS $LIBS"
220 dnl
221 dnl Now check if the installed libxml is sufficiently new.
222 dnl (Also sanity checks the results of xml2-config to some extent)
223 dnl
224       rm -f conf.xmltest
225       AC_TRY_RUN([
226 #include <stdlib.h>
227 #include <stdio.h>
228 #include <string.h>
229 #include <libxml/xmlversion.h>
230
231 int 
232 main()
233 {
234   int xml_major_version, xml_minor_version, xml_micro_version;
235   int major, minor, micro;
236   char *tmp_version;
237
238   system("touch conf.xmltest");
239
240   /* Capture xml2-config output via autoconf/configure variables */
241   /* HP/UX 9 (%@#!) writes to sscanf strings */
242   tmp_version = (char *)strdup("$min_xml_version");
243   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
244      printf("%s, bad version string from xml2-config\n", "$min_xml_version");
245      exit(1);
246    }
247    free(tmp_version);
248
249    /* Capture the version information from the header files */
250    tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
251    if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
252      printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
253      exit(1);
254    }
255    free(tmp_version);
256
257  /* Compare xml2-config output to the libxml headers */
258   if ((xml_major_version != $xml_config_major_version) ||
259       (xml_minor_version != $xml_config_minor_version) ||
260       (xml_micro_version != $xml_config_micro_version))
261     {
262       printf("*** libxml header files (version %d.%d.%d) do not match\n",
263          xml_major_version, xml_minor_version, xml_micro_version);
264       printf("*** xml2-config (version %d.%d.%d)\n",
265          $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
266       return 1;
267     } 
268 /* Compare the headers to the library to make sure we match */
269   /* Less than ideal -- doesn't provide us with return value feedback, 
270    * only exits if there's a serious mismatch between header and library.
271    */
272     LIBXML_TEST_VERSION;
273
274     /* Test that the library is greater than our minimum version */
275     if ((xml_major_version > major) ||
276         ((xml_major_version == major) && (xml_minor_version > minor)) ||
277         ((xml_major_version == major) && (xml_minor_version == minor) &&
278         (xml_micro_version >= micro)))
279       {
280         return 0;
281        }
282      else
283       {
284         printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
285                xml_major_version, xml_minor_version, xml_micro_version);
286         printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
287            major, minor, micro);
288         printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
289         printf("***\n");
290         printf("*** If you have already installed a sufficiently new version, this error\n");
291         printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
292         printf("*** being found. The easiest way to fix this is to remove the old version\n");
293         printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
294         printf("*** correct copy of xml2-config. (In this case, you will have to\n");
295         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
296         printf("*** so that the correct libraries are found at run-time))\n");
297     }
298   return 1;
299 }
300 ],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
301        CFLAGS="$ac_save_CFLAGS"
302        LIBS="$ac_save_LIBS"
303      fi
304   fi
305
306   if test "x$no_xml" = x ; then
307      AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
308      ifelse([$2], , :, [$2])     
309   else
310      AC_MSG_RESULT(no)
311      if test "$XML2_CONFIG" = "no" ; then
312        echo "*** The xml2-config script installed by LIBXML could not be found"
313        echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
314        echo "*** your path, or set the XML2_CONFIG environment variable to the"
315        echo "*** full path to xml2-config."
316      else
317        if test -f conf.xmltest ; then
318         :
319        else
320           echo "*** Could not run libxml test program, checking why..."
321           CFLAGS="$CFLAGS $XML_CFLAGS"
322           LIBS="$LIBS $XML_LIBS"
323           AC_TRY_LINK([
324 #include <libxml/xmlversion.h>
325 #include <stdio.h>
326 ],      [ LIBXML_TEST_VERSION; return 0;],
327         [ echo "*** The test program compiled, but did not run. This usually means"
328           echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
329           echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
330           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
331           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
332           echo "*** is required on your system"
333           echo "***"
334           echo "*** If you have an old version installed, it is best to remove it, although"
335           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
336         [ echo "*** The test program failed to compile or link. See the file config.log for the"
337           echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
338           echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
339           echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
340           CFLAGS="$ac_save_CFLAGS"
341           LIBS="$ac_save_LIBS"
342        fi
343      fi
344
345      XML_CFLAGS=""
346      XML_LIBS=""
347      ifelse([$3], , :, [$3])
348   fi
349   AC_SUBST(XML_CFLAGS)
350   AC_SUBST(XML_LIBS)
351   rm -f conf.xmltest
352 ])
353
354 # =========================================================================
355 # AM_PATH_MYSQL : MySQL library
356
357 dnl AM_PATH_MYSQL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
358 dnl Test for MYSQL, and define MYSQL_CFLAGS and MYSQL_LIBS
359 dnl
360 AC_DEFUN(AM_PATH_MYSQL,
361 [dnl
362 dnl Get the cflags and libraries from the mysql_config script
363 dnl
364 AC_ARG_WITH(mysql-prefix,[  --with-mysql-prefix=PFX   Prefix where MYSQL is installed (optional)],
365             mysql_prefix="$withval", mysql_prefix="")
366 AC_ARG_WITH(mysql-exec-prefix,[  --with-mysql-exec-prefix=PFX Exec prefix where MYSQL is installed (optional)],
367             mysql_exec_prefix="$withval", mysql_exec_prefix="")
368
369   if test x$mysql_exec_prefix != x ; then
370      mysql_args="$mysql_args --exec-prefix=$mysql_exec_prefix"
371      if test x${MYSQL_CONFIG+set} != xset ; then
372         MYSQL_CONFIG=$mysql_exec_prefix/bin/mysql_config
373      fi
374   fi
375   if test x$mysql_prefix != x ; then
376      mysql_args="$mysql_args --prefix=$mysql_prefix"
377      if test x${MYSQL_CONFIG+set} != xset ; then
378         MYSQL_CONFIG=$mysql_prefix/bin/mysql_config
379      fi
380   fi
381
382   AC_REQUIRE([AC_CANONICAL_TARGET])
383   AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no)
384   AC_MSG_CHECKING(for MYSQL)
385   no_mysql=""
386   if test "$MYSQL_CONFIG" = "no" ; then
387     MYSQL_CFLAGS=""
388     MYSQL_LIBS=""
389     AC_MSG_RESULT(no)
390      ifelse([$2], , :, [$2])
391   else
392     MYSQL_CFLAGS=`$MYSQL_CONFIG $mysqlconf_args --cflags | sed -e "s/'//g"`
393     MYSQL_LIBS=`$MYSQL_CONFIG $mysqlconf_args --libs | sed -e "s/'//g"`
394     AC_MSG_RESULT(yes)
395     ifelse([$1], , :, [$1])
396   fi
397   AC_SUBST(MYSQL_CFLAGS)
398   AC_SUBST(MYSQL_LIBS)
399 ])
400
401 dnl Removes -I/usr/include/? from given variable
402 AC_DEFUN(CFLAGS_REMOVE_USR_INCLUDE,[
403   ac_new_flags=""
404   for i in [$]$1; do
405     case [$]i in
406     -I/usr/include|-I/usr/include/) ;;
407     *) ac_new_flags="[$]ac_new_flags [$]i" ;;
408     esac
409   done
410   $1=[$]ac_new_flags
411 ])
412     
413 dnl Removes -L/usr/lib/? from given variable
414 AC_DEFUN(LIB_REMOVE_USR_LIB,[
415   ac_new_flags=""
416   for i in [$]$1; do
417     case [$]i in
418     -L/usr/lib|-L/usr/lib/) ;;
419     *) ac_new_flags="[$]ac_new_flags [$]i" ;;
420     esac
421   done
422   $1=[$]ac_new_flags
423 ])
424
425 dnl From Bruno Haible.
426
427 AC_DEFUN(jm_ICONV,
428 [
429   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
430   dnl those with the standalone portable libiconv installed).
431   AC_MSG_CHECKING(for iconv in $1)
432     jm_cv_func_iconv="no"
433     jm_cv_lib_iconv=no
434     jm_cv_giconv=no
435     AC_TRY_LINK([#include <stdlib.h>
436 #include <giconv.h>],
437       [iconv_t cd = iconv_open("","");
438        iconv(cd,NULL,NULL,NULL,NULL);
439        iconv_close(cd);],
440       jm_cv_func_iconv=yes
441       jm_cv_giconv=yes)
442
443     if test "$jm_cv_func_iconv" != yes; then
444       AC_TRY_LINK([#include <stdlib.h>
445 #include <iconv.h>],
446         [iconv_t cd = iconv_open("","");
447          iconv(cd,NULL,NULL,NULL,NULL);
448          iconv_close(cd);],
449         jm_cv_func_iconv=yes)
450
451         if test "$jm_cv_lib_iconv" != yes; then
452           jm_save_LIBS="$LIBS"
453           LIBS="$LIBS -lgiconv"
454           AC_TRY_LINK([#include <stdlib.h>
455 #include <giconv.h>],
456             [iconv_t cd = iconv_open("","");
457              iconv(cd,NULL,NULL,NULL,NULL);
458              iconv_close(cd);],
459             jm_cv_lib_iconv=yes
460             jm_cv_func_iconv=yes
461             jm_cv_giconv=yes)
462           LIBS="$jm_save_LIBS"
463
464       if test "$jm_cv_func_iconv" != yes; then
465         jm_save_LIBS="$LIBS"
466         LIBS="$LIBS -liconv"
467         AC_TRY_LINK([#include <stdlib.h>
468 #include <iconv.h>],
469           [iconv_t cd = iconv_open("","");
470            iconv(cd,NULL,NULL,NULL,NULL);
471            iconv_close(cd);],
472           jm_cv_lib_iconv=yes
473           jm_cv_func_iconv=yes)
474         LIBS="$jm_save_LIBS"
475         fi
476       fi
477     fi
478
479   if test "$jm_cv_func_iconv" = yes; then
480     if test "$jm_cv_giconv" = yes; then
481       AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h])
482       AC_MSG_RESULT(yes)
483       ICONV_FOUND=yes
484     else
485       AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h])
486       AC_MSG_RESULT(yes)
487       ICONV_FOUND=yes
488     fi
489   else
490     AC_MSG_RESULT(no)
491   fi
492   if test "$jm_cv_lib_iconv" = yes; then
493     if test "$jm_cv_giconv" = yes; then
494       LIBS="$LIBS -lgiconv"
495     else
496       LIBS="$LIBS -liconv"
497     fi
498   fi
499 ])
500
501 dnl CFLAGS_ADD_DIR(CFLAGS, $INCDIR)
502 dnl This function doesn't add -I/usr/include into CFLAGS
503 AC_DEFUN(CFLAGS_ADD_DIR,[
504 if test "$2" != "/usr/include" ; then
505     $1="$$1 -I$2"
506 fi
507 ])
508
509 dnl LIB_ADD_DIR(LDFLAGS, $LIBDIR)
510 dnl This function doesn't add -L/usr/lib into LDFLAGS
511 AC_DEFUN(LIB_ADD_DIR,[
512 if test "$2" != "/usr/lib" ; then
513     $1="$$1 -L$2"
514 fi
515 ])
516
517 dnl AC_ENABLE_SHARED - implement the --enable-shared flag
518 dnl Usage: AC_ENABLE_SHARED[(DEFAULT)]
519 dnl   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
520 dnl   `yes'.
521 AC_DEFUN([AC_ENABLE_SHARED],
522 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
523 AC_ARG_ENABLE(shared,
524 changequote(<<, >>)dnl
525 <<  --enable-shared[=PKGS]    build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
526 changequote([, ])dnl
527 [p=${PACKAGE-default}
528 case $enableval in
529 yes) enable_shared=yes ;;
530 no) enable_shared=no ;;
531 *)
532   enable_shared=no
533   # Look at the argument we got.  We use all the common list separators.
534   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
535   for pkg in $enableval; do
536     if test "X$pkg" = "X$p"; then
537       enable_shared=yes
538     fi
539
540   done
541   IFS="$ac_save_ifs"
542   ;;
543 esac],
544 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
545 ])
546
547 dnl AC_ENABLE_STATIC - implement the --enable-static flag
548 dnl Usage: AC_ENABLE_STATIC[(DEFAULT)]
549 dnl   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
550 dnl   `yes'.
551 AC_DEFUN([AC_ENABLE_STATIC],
552 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
553 AC_ARG_ENABLE(static,
554 changequote(<<, >>)dnl
555 <<  --enable-static[=PKGS]    build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
556 changequote([, ])dnl
557 [p=${PACKAGE-default}
558 case $enableval in
559 yes) enable_static=yes ;;
560 no) enable_static=no ;;
561 *)
562   enable_static=no
563   # Look at the argument we got.  We use all the common list separators.
564   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
565   for pkg in $enableval; do
566     if test "X$pkg" = "X$p"; then
567       enable_static=yes
568     fi
569   done
570   IFS="$ac_save_ifs"
571   ;;
572 esac],
573 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
574 ])
575
576 dnl AC_DISABLE_STATIC - set the default static flag to --disable-static
577 AC_DEFUN([AC_DISABLE_STATIC],
578 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
579 AC_ENABLE_STATIC(no)])