Code

free step_list on error. fix for #317
[rrdtool-all.git] / contrib / php4 / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 dnl $Id$
14 dnl
15 dnl This file contains local autoconf functions.
17 sinclude(dynlib.m4)
19 dnl PHP_EVAL_LIBLINE(LINE, SHARED-LIBADD)
20 dnl
21 dnl Use this macro, if you need to add libraries and or library search
22 dnl paths to the PHP build system which are only given in compiler
23 dnl notation.
24 dnl
25 AC_DEFUN(PHP_EVAL_LIBLINE,[
26   for ac_i in $1; do
27     case "$ac_i" in
28     -l*)
29       ac_ii=`echo $ac_i|cut -c 3-`
30       AC_ADD_LIBRARY($ac_ii,,$2)
31     ;;
32     -L*)
33       ac_ii=`echo $ac_i|cut -c 3-`
34       AC_ADD_LIBPATH($ac_ii,$2)
35     ;;
36     esac
37   done
38 ])
40 dnl PHP_EVAL_INCLINE(LINE)
41 dnl
42 dnl Use this macro, if you need to add header search paths to the PHP
43 dnl build system which are only given in compiler notation.
44 dnl
45 AC_DEFUN(PHP_EVAL_INCLINE,[
46   for ac_i in $1; do
47     case "$ac_i" in
48     -I*)
49       ac_ii=`echo $ac_i|cut -c 3-`
50       AC_ADD_INCLUDE($ac_ii)
51     ;;
52     esac
53   done
54 ])
55         
56 AC_DEFUN(PHP_READDIR_R_TYPE,[
57   dnl HAVE_READDIR_R is also defined by libmysql
58   AC_CHECK_FUNC(readdir_r,ac_cv_func_readdir_r=yes,ac_cv_func_readdir=no)
59   if test "$ac_cv_func_readdir_r" = "yes"; then
60   AC_CACHE_CHECK(for type of readdir_r, ac_cv_what_readdir_r,[
61     AC_TRY_RUN([
62 #define _REENTRANT
63 #include <sys/types.h>
64 #include <dirent.h>
66 main() {
67         DIR *dir;
68         struct dirent entry, *pentry;
70         dir = opendir("/");
71         if (!dir) 
72                 exit(1);
73         if (readdir_r(dir, &entry, &pentry) == 0)
74                 exit(0);
75         exit(1);
76 }
77     ],[
78       ac_cv_what_readdir_r=POSIX
79     ],[
80       AC_TRY_CPP([
81 #define _REENTRANT
82 #include <sys/types.h>
83 #include <dirent.h>
84 int readdir_r(DIR *, struct dirent *);
85         ],[
86           ac_cv_what_readdir_r=old-style
87         ],[
88           ac_cv_what_readdir_r=none
89       ])
90     ],[
91       ac_cv_what_readdir_r=none
92    ])
93   ])
94     case "$ac_cv_what_readdir_r" in
95     POSIX)
96       AC_DEFINE(HAVE_POSIX_READDIR_R,1,[whether you have POSIX readdir_r]);;
97     old-style)
98       AC_DEFINE(HAVE_OLD_READDIR_R,1,[whether you have old-style readdir_r]);;
99     esac
100   fi
101 ])
103 AC_DEFUN(PHP_SHLIB_SUFFIX_NAME,[
104   PHP_SUBST(SHLIB_SUFFIX_NAME)
105   SHLIB_SUFFIX_NAME=so
106   case "$host_alias" in
107   *hpux*)
108         SHLIB_SUFFIX_NAME=sl
109         ;;
110   esac
111 ])
113 AC_DEFUN(PHP_DEBUG_MACRO,[
114   DEBUG_LOG="$1"
115   cat >$1 <<X
116 CONFIGURE:  $CONFIGURE_COMMAND
117 CC:         $CC
118 CFLAGS:     $CFLAGS
119 CPPFLAGS:   $CPPFLAGS
120 CXX:        $CXX
121 CXXFLAGS:   $CXXFLAGS
122 INCLUDES:   $INCLUDES
123 LDFLAGS:    $LDFLAGS
124 LIBS:       $LIBS
125 DLIBS:      $DLIBS
126 SAPI:       $PHP_SAPI
127 PHP_RPATHS: $PHP_RPATHS
128 uname -a:   `uname -a`
131     cat >conftest.$ac_ext <<X
132 main()
134   exit(0);
137     (eval echo \"$ac_link\"; eval $ac_link && ./conftest) >>$1 2>&1
138     rm -fr conftest*
139 ])
140         
141 AC_DEFUN(PHP_MISSING_TIME_R_DECL,[
142   AC_MSG_CHECKING(for missing declarations of reentrant functions)
143   AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = localtime_r],[
144     :
145   ],[
146     AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared])
147   ])
148   AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = gmtime_r],[
149     :
150   ],[
151     AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared])
152   ])
153   AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = asctime_r],[
154     :
155   ],[
156     AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared])
157   ])
158   AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = ctime_r],[
159     :
160   ],[
161     AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared])
162   ])
163   AC_TRY_COMPILE([#include <string.h>],[char *(*func)() = strtok_r],[
164     :
165   ],[
166     AC_DEFINE(MISSING_STRTOK_R_DECL,1,[Whether strtok_r is declared])
167   ])
168   AC_MSG_RESULT(done)
169 ])
171 dnl
172 dnl PHP_LIBGCC_LIBPATH(gcc)
173 dnl Stores the location of libgcc in libgcc_libpath
174 dnl
175 AC_DEFUN(PHP_LIBGCC_LIBPATH,[
176   changequote({,})
177   libgcc_libpath="`$1 --print-libgcc-file-name|sed 's%/*[^/][^/]*$%%'`"
178   changequote([,])
179 ])
181 AC_DEFUN(PHP_ARG_ANALYZE,[
182 case "[$]$1" in
183 shared,*)
184   ext_output="yes, shared"
185   ext_shared=yes
186   $1=`echo $ac_n "[$]$1$ac_c"|sed s/^shared,//`
187   ;;
188 shared)
189   ext_output="yes, shared"
190   ext_shared=yes
191   $1=yes
192   ;;
193 no)
194   ext_output="no"
195   ext_shared=no
196   ;;
197 *)
198   ext_output="yes"
199   ext_shared=no
200   ;;
201 esac
203 if test "$php_always_shared" = "yes"; then
204   ext_output="yes, shared"
205   ext_shared=yes
206   test "[$]$1" = "no" && $1=yes
207 fi
209 AC_MSG_RESULT($ext_output)
210 ])
212 dnl
213 dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val])
214 dnl Sets PHP_ARG_NAME either to the user value or to the default value.
215 dnl default-val defaults to no. 
216 dnl
217 AC_DEFUN(PHP_ARG_WITH,[
218 PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_))
219 ])
221 AC_DEFUN(PHP_REAL_ARG_WITH,[
222 AC_MSG_CHECKING($2)
223 AC_ARG_WITH($1,[$3],$5=[$]withval,$5=ifelse($4,,no,$4))
224 PHP_ARG_ANALYZE($5)
225 ])
227 dnl
228 dnl PHP_ARG_ENABLE(arg-name, check message, help text[, default-val])
229 dnl Sets PHP_ARG_NAME either to the user value or to the default value.
230 dnl default-val defaults to no. 
231 dnl
232 AC_DEFUN(PHP_ARG_ENABLE,[
233 PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_))
234 ])
236 AC_DEFUN(PHP_REAL_ARG_ENABLE,[
237 AC_MSG_CHECKING($2)
238 AC_ARG_ENABLE($1,[$3],$5=[$]enableval,$5=ifelse($4,,no,$4))
239 PHP_ARG_ANALYZE($5)
240 ])
242 AC_DEFUN(PHP_MODULE_PTR,[
243   EXTRA_MODULE_PTRS="$EXTRA_MODULE_PTRS $1,"
244 ])
245  
246 AC_DEFUN(PHP_CONFIG_NICE,[
247   rm -f $1
248   cat >$1<<EOF
249 #! /bin/sh
251 # Created by configure
253 EOF
255   for arg in [$]0 "[$]@"; do
256     echo "\"[$]arg\" \\" >> $1
257   done
258   echo '"[$]@"' >> $1
259   chmod +x $1
260 ])
262 AC_DEFUN(PHP_TIME_R_TYPE,[
263 AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
264 AC_TRY_RUN([
265 #include <time.h>
266 #include <stdlib.h>
268 main() {
269 char buf[27];
270 struct tm t;
271 time_t old = 0;
272 int r, s;
274 s = gmtime_r(&old, &t);
275 r = (int) asctime_r(&t, buf, 26);
276 if (r == s && s == 0) exit(0);
277 exit(1);
279 ],[
280   ac_cv_time_r_type=hpux
281 ],[
282   ac_cv_time_r_type=POSIX
283 ],[
284   ac_cv_time_r_type=POSIX
285 ])
286 ])
287 if test "$ac_cv_time_r_type" = "hpux"; then
288   AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x])
289 fi
290 ])
292 AC_DEFUN(PHP_SUBST,[
293   PHP_VAR_SUBST="$PHP_VAR_SUBST $1"
294   AC_SUBST($1)
295 ])
297 AC_DEFUN(PHP_FAST_OUTPUT,[
298   PHP_FAST_OUTPUT_FILES="$PHP_FAST_OUTPUT_FILES $1"
299 ])
301 AC_DEFUN(PHP_MKDIR_P_CHECK,[
302   AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
303     test -d conftestdir && rm -rf conftestdir
304     mkdir -p conftestdir/somedir >/dev/null 2>&1
305     if test -d conftestdir/somedir; then
306       ac_cv_mkdir_p=yes
307     else
308       ac_cv_mkdir_p=no
309     fi
310     rm -rf conftestdir
311   ])
312 ])
314 AC_DEFUN(PHP_GEN_CONFIG_VARS,[
315   PHP_MKDIR_P_CHECK
316   echo creating config_vars.mk
317   > config_vars.mk
318   for i in $PHP_VAR_SUBST; do
319     eval echo "$i = \$$i" >> config_vars.mk
320   done
321 ])
323 AC_DEFUN(PHP_GEN_MAKEFILES,[
324   $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $PHP_FAST_OUTPUT_FILES
325 ])
327 AC_DEFUN(PHP_TM_GMTOFF,[
328 AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
329 [AC_TRY_COMPILE([#include <sys/types.h>
330 #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
331   ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
333 if test "$ac_cv_struct_tm_gmtoff" = yes; then
334   AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm])
335 fi
336 ])
338 dnl PHP_CONFIGURE_PART(MESSAGE)
339 dnl Idea borrowed from mm
340 AC_DEFUN(PHP_CONFIGURE_PART,[
341   AC_MSG_RESULT()
342   AC_MSG_RESULT(${T_MD}$1${T_ME})
343 ])
345 AC_DEFUN(PHP_PROG_SENDMAIL,[
346 AC_PATH_PROG(PROG_SENDMAIL, sendmail, /usr/lib/sendmail, $PATH:/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib)
347 if test -n "$PROG_SENDMAIL"; then
348   AC_DEFINE(HAVE_SENDMAIL,1,[whether you have sendmail])
349 fi
350 ])
352 AC_DEFUN(PHP_RUNPATH_SWITCH,[
353 dnl check for -R, etc. switch
354 AC_MSG_CHECKING(if compiler supports -R)
355 AC_CACHE_VAL(php_cv_cc_dashr,[
356         SAVE_LIBS="${LIBS}"
357         LIBS="-R /usr/lib ${LIBS}"
358         AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
359         LIBS="${SAVE_LIBS}"])
360 AC_MSG_RESULT($php_cv_cc_dashr)
361 if test $php_cv_cc_dashr = "yes"; then
362         ld_runpath_switch="-R"
363 else
364         AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
365         AC_CACHE_VAL(php_cv_cc_rpath,[
366                 SAVE_LIBS="${LIBS}"
367                 LIBS="-Wl,-rpath,/usr/lib ${LIBS}"
368                 AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
369                 LIBS="${SAVE_LIBS}"])
370         AC_MSG_RESULT($php_cv_cc_rpath)
371         if test $php_cv_cc_rpath = "yes"; then
372                 ld_runpath_switch="-Wl,-rpath,"
373         else
374                 dnl something innocuous
375                 ld_runpath_switch="-L"
376         fi
377 fi
378 ])
380 AC_DEFUN(PHP_STRUCT_FLOCK,[
381 AC_CACHE_CHECK(for struct flock,ac_cv_struct_flock,
382     AC_TRY_COMPILE([
383 #include <unistd.h>
384 #include <fcntl.h>
385         ],
386         [struct flock x;],
387         [
388           ac_cv_struct_flock=yes
389         ],[
390           ac_cv_struct_flock=no
391         ])
393 if test "$ac_cv_struct_flock" = "yes" ; then
394     AC_DEFINE(HAVE_STRUCT_FLOCK, 1,[whether you have struct flock])
395 fi
396 ])
398 AC_DEFUN(PHP_SOCKLEN_T,[
399 AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t,
400   AC_TRY_COMPILE([
401 #include <sys/types.h>
402 #include <sys/socket.h>
403 ],[
404 socklen_t x;
405 ],[
406   ac_cv_socklen_t=yes
407 ],[
408   ac_cv_socklen_t=no
409 ]))
410 if test "$ac_cv_socklen_t" = "yes"; then
411   AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
412 fi
413 ])
415 dnl
416 dnl PHP_SET_SYM_FILE(path)
417 dnl
418 dnl set the path of the file which contains the symbol export list
419 dnl
420 AC_DEFUN(PHP_SET_SYM_FILE,
422   PHP_SYM_FILE="$1"
423 ])
425 dnl
426 dnl PHP_BUILD_THREAD_SAFE
427 dnl
428 AC_DEFUN(PHP_BUILD_THREAD_SAFE,[
429   enable_experimental_zts=yes
430   if test "$pthreads_working" != "yes"; then
431     AC_MSG_ERROR(ZTS currently requires working POSIX threads. Your system does not support this.)
432   fi
433 ])
435 dnl
436 dnl PHP_BUILD_SHARED
437 dnl
438 AC_DEFUN(PHP_BUILD_SHARED,[
439   php_build_target=shared
440 ])
442 dnl
443 dnl PHP_BUILD_STATIC
444 dnl
445 AC_DEFUN(PHP_BUILD_STATIC,[
446   php_build_target=static
447 ])
449 dnl
450 dnl PHP_BUILD_PROGRAM
451 dnl
452 AC_DEFUN(PHP_BUILD_PROGRAM,[
453   php_build_target=program
454 ])
456 dnl
457 dnl AC_PHP_ONCE(namespace, variable, code)
458 dnl
459 dnl execute code, if variable is not set in namespace
460 dnl
461 AC_DEFUN(AC_PHP_ONCE,[
462   changequote({,})
463   unique=`echo $2|sed 's/[^a-zA-Z0-9]/_/g'`
464   changequote([,])
465   cmd="echo $ac_n \"\$$1$unique$ac_c\""
466   if test -n "$unique" && test "`eval $cmd`" = "" ; then
467     eval "$1$unique=set"
468     $3
469   fi
470 ])
472 dnl
473 dnl AC_EXPAND_PATH(path, variable)
474 dnl
475 dnl expands path to an absolute path and assigns it to variable
476 dnl
477 AC_DEFUN(AC_EXPAND_PATH,[
478   if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
479     $2="$1"
480   else
481     changequote({,})
482     ep_dir="`echo $1|sed 's%/*[^/][^/]*$%%'`"
483     changequote([,])
484     ep_realdir="`(cd \"$ep_dir\" && pwd)`"
485     $2="$ep_realdir/`basename \"$1\"`"
486   fi
487 ])
489 dnl
490 dnl AC_ADD_LIBPATH(path[, shared-libadd])
491 dnl
492 dnl add a library to linkpath/runpath
493 dnl
494 AC_DEFUN(AC_ADD_LIBPATH,[
495   if test "$1" != "/usr/lib"; then
496     AC_EXPAND_PATH($1, ai_p)
497     if test "$ext_shared" = "yes" && test -n "$2"; then
498       $2="-R$1 -L$1 [$]$2"
499     else
500       AC_PHP_ONCE(LIBPATH, $ai_p, [
501         test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p"
502         LDFLAGS="$LDFLAGS -L$ai_p"
503         PHP_RPATHS="$PHP_RPATHS $ai_p"
504       ])
505     fi
506   fi
507 ])
509 dnl
510 dnl AC_BUILD_RPATH()
511 dnl
512 dnl builds RPATH from PHP_RPATHS
513 dnl
514 AC_DEFUN(AC_BUILD_RPATH,[
515   if test "$PHP_RPATH" = "yes" && test -n "$PHP_RPATHS"; then
516     OLD_RPATHS="$PHP_RPATHS"
517     PHP_RPATHS=""
518     for i in $OLD_RPATHS; do
519       PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
520       PHP_RPATHS="$PHP_RPATHS -R $i"
521       NATIVE_RPATHS="$NATIVE_RPATHS ${ld_runpath_switch}$i"
522     done
523   fi
524 ])
526 dnl
527 dnl AC_ADD_INCLUDE(path)
528 dnl
529 dnl add a include path
530 dnl
531 AC_DEFUN(AC_ADD_INCLUDE,[
532   if test "$1" != "/usr/include"; then
533     AC_EXPAND_PATH($1, ai_p)
534     AC_PHP_ONCE(INCLUDEPATH, $ai_p, [
535       INCLUDES="$INCLUDES -I$ai_p"
536     ])
537   fi
538 ])
540 AC_DEFUN(PHP_X_ADD_LIBRARY,[
541   ifelse($2,,$3="-l$1 [$]$3", $3="[$]$3 -l$1")
542 ])
544 dnl
545 dnl AC_ADD_LIBRARY(library[, append[, shared-libadd]])
546 dnl
547 dnl add a library to the link line
548 dnl
549 AC_DEFUN(AC_ADD_LIBRARY,[
550  case "$1" in
551  c|c_r|pthread*) ;;
552  *)
553 ifelse($3,,[
554    AC_PHP_ONCE(LIBRARY, $1, [
555      PHP_X_ADD_LIBRARY($1,$2,LIBS)
556    ])
557 ],[
558    if test "$ext_shared" = "yes"; then
559      PHP_X_ADD_LIBRARY($1,$2,$3)
560    else
561      AC_ADD_LIBRARY($1,$2)
562    fi
563 ])
564   ;;
565   esac
566 ])
568 dnl
569 dnl AC_ADD_LIBRARY_DEFER(library[, append])
570 dnl
571 dnl add a library to the link line (deferred)
572 AC_DEFUN(AC_ADD_LIBRARY_DEFER,[
573   AC_PHP_ONCE(LIBRARY, $1, [
574     ifelse($#, 1, DLIBS="-l$1 $DLIBS", DLIBS="$DLIBS -l$1")
575   ])
576 ])
578 dnl
579 dnl AC_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])
580 dnl
581 dnl add a library to the link line and path to linkpath/runpath.
582 dnl if shared-libadd is not empty and $ext_shared is yes,
583 dnl shared-libadd will be assigned the library information
584 dnl
585 AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH,[
586 ifelse($3,,[
587   if test -n "$2"; then
588     AC_ADD_LIBPATH($2)
589   fi
590   AC_ADD_LIBRARY($1)
591 ],[
592   if test "$ext_shared" = "yes"; then
593     $3="-l$1 [$]$3"
594     if test -n "$2"; then
595       AC_ADD_LIBPATH($2,$3)
596     fi
597   else
598     AC_ADD_LIBRARY_WITH_PATH($1,$2)
599   fi
600 ])
601 ])
603 dnl
604 dnl AC_ADD_LIBRARY_DEFER_WITH_PATH(library, path)
605 dnl
606 dnl add a library to the link line (deferred)
607 dnl and path to linkpath/runpath (not deferred)
608 dnl
609 AC_DEFUN(AC_ADD_LIBRARY_DEFER_WITH_PATH,[
610   AC_ADD_LIBPATH($2)
611   AC_ADD_LIBRARY_DEFER($1)
612 ])
614 AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
615   LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
616 ])
618 dnl
619 dnl Check for cc option
620 dnl
621 AC_DEFUN(AC_CHECK_CC_OPTION,[
622   echo "main(){return 0;}" > conftest.$ac_ext
623   opt="$1"
624   changequote({,})
625   var=`echo $opt|sed 's/[^a-zA-Z0-9]/_/g'`
626   changequote([,])
627   AC_MSG_CHECKING([if compiler supports -$1 really])
628   ac_php_compile="${CC-cc} -$opt -o conftest $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1"
629   if eval $ac_php_compile 2>&1 | egrep "$opt" > /dev/null 2>&1 ; then
630     eval php_cc_$var=no
631         AC_MSG_RESULT(no)
632   else
633     if eval ./conftest 2>/dev/null ; then
634       eval php_cc_$var=yes
635           AC_MSG_RESULT(yes)
636     else
637       eval php_cc_$var=no
638           AC_MSG_RESULT(no)
639     fi
640   fi
641 ])
643 AC_DEFUN(PHP_REGEX,[
645 if test "$REGEX_TYPE" = "php"; then
646   REGEX_LIB=regex/libregex.la
647   REGEX_DIR=regex
648   AC_DEFINE(HSREGEX,1,[ ])
649   AC_DEFINE(REGEX,1,[ ])
650   PHP_FAST_OUTPUT(regex/Makefile)
651 elif test "$REGEX_TYPE" = "system"; then
652   AC_DEFINE(REGEX,0,[ ])
653 fi
655 AC_MSG_CHECKING(which regex library to use)
656 AC_MSG_RESULT($REGEX_TYPE)
658 PHP_SUBST(REGEX_DIR)
659 PHP_SUBST(REGEX_LIB)
660 PHP_SUBST(HSREGEX)
661 ])
663 dnl
664 dnl See if we have broken header files like SunOS has.
665 dnl
666 AC_DEFUN(AC_MISSING_FCLOSE_DECL,[
667   AC_MSG_CHECKING([for fclose declaration])
668   AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
669     AC_DEFINE(MISSING_FCLOSE_DECL,0,[ ])
670     AC_MSG_RESULT(ok)
671   ],[
672     AC_DEFINE(MISSING_FCLOSE_DECL,1,[ ])
673     AC_MSG_RESULT(missing)
674   ])
675 ])
677 dnl
678 dnl Check for broken sprintf()
679 dnl
680 AC_DEFUN(AC_BROKEN_SPRINTF,[
681   AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
682     AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
683       ac_cv_broken_sprintf=no
684     ],[
685       ac_cv_broken_sprintf=yes
686     ],[
687       ac_cv_broken_sprintf=no
688     ])
689   ])
690   if test "$ac_cv_broken_sprintf" = "yes"; then
691     AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [ ])
692   else
693     AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [ ])
694   fi
695 ])
697 dnl
698 dnl PHP_EXTENSION(extname [, shared])
699 dnl
700 dnl Includes an extension in the build.
701 dnl
702 dnl "extname" is the name of the ext/ subdir where the extension resides
703 dnl "shared" can be set to "shared" or "yes" to build the extension as
704 dnl a dynamically loadable library.
705 dnl
706 AC_DEFUN(PHP_EXTENSION,[
707   EXT_SUBDIRS="$EXT_SUBDIRS $1"
708   
709   if test -d "$abs_srcdir/ext/$1"; then
710 dnl ---------------------------------------------- Internal Module
711     ext_builddir="ext/$1"
712     ext_srcdir="$abs_srcdir/ext/$1"
713   else
714 dnl ---------------------------------------------- External Module
715     ext_builddir="."
716     ext_srcdir="$abs_srcdir"
717   fi
719   if test "$2" != "shared" && test "$2" != "yes"; then
720 dnl ---------------------------------------------- Static module
721     LIB_BUILD($ext_builddir)
722     EXT_LTLIBS="$EXT_LTLIBS $ext_builddir/lib$1.la"
723     EXT_STATIC="$EXT_STATIC $1"
724   else 
725 dnl ---------------------------------------------- Shared module
726     LIB_BUILD($ext_builddir,yes)
727     AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module)
728   fi
730   PHP_FAST_OUTPUT($ext_builddir/Makefile)
731 ])
733 PHP_SUBST(EXT_SUBDIRS)
734 PHP_SUBST(EXT_STATIC)
735 PHP_SUBST(EXT_SHARED)
736 PHP_SUBST(EXT_LIBS)
737 PHP_SUBST(EXT_LTLIBS)
739 dnl
740 dnl Solaris requires main code to be position independent in order
741 dnl to let shared objects find symbols.  Weird.  Ugly.
742 dnl
743 dnl Must be run after all --with-NN options that let the user
744 dnl choose dynamic extensions, and after the gcc test.
745 dnl
746 AC_DEFUN(PHP_SOLARIS_PIC_WEIRDNESS,[
747   AC_MSG_CHECKING(whether -fPIC is required)
748   if test "$EXT_SHARED" != ""; then
749     os=`uname -sr 2>/dev/null`
750     case "$os" in
751         "SunOS 5.6"|"SunOS 5.7")
752           case "$CC" in
753             gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
754             *) CFLAGS="$CFLAGS -fpic";;
755           esac
756           AC_MSG_RESULT(yes);;
757         *)
758           AC_MSG_RESULT(no);;
759     esac
760   else
761     AC_MSG_RESULT(no)
762   fi
763 ])
765 dnl
766 dnl Checks whether $withval is "shared" or starts with "shared,XXX"
767 dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff
768 dnl from $withval.
769 dnl
770 AC_DEFUN(PHP_WITH_SHARED,[
771     case $withval in
772         shared)
773             shared=yes
774             withval=yes
775             ;;
776         shared,*)
777             shared=yes
778             withval=`echo $withval | sed -e 's/^shared,//'`      
779             ;;
780         *)
781             shared=no
782             ;;
783     esac
784     if test -n "$php_always_shared"; then
785                 shared=yes
786         fi
787 ])
789 dnl The problem is that the default compilation flags in Solaris 2.6 won't
790 dnl let programs access large files;  you need to tell the compiler that
791 dnl you actually want your programs to work on large files.  For more
792 dnl details about this brain damage please see:
793 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
795 dnl Written by Paul Eggert <eggert@twinsun.com>.
797 AC_DEFUN(AC_SYS_LFS,
798 [dnl
799   # If available, prefer support for large files unless the user specified
800   # one of the CPPFLAGS, LDFLAGS, or LIBS variables.
801   AC_MSG_CHECKING(whether large file support needs explicit enabling)
802   ac_getconfs=''
803   ac_result=yes
804   ac_set=''
805   ac_shellvars='CPPFLAGS LDFLAGS LIBS'
806   for ac_shellvar in $ac_shellvars; do
807     case $ac_shellvar in
808       CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
809       *) ac_lfsvar=LFS_$ac_shellvar ;;
810     esac
811     eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
812     (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
813     ac_getconf=`getconf $ac_lfsvar`
814     ac_getconfs=$ac_getconfs$ac_getconf
815     eval ac_test_$ac_shellvar=\$ac_getconf
816   done
817   case "$ac_result$ac_getconfs" in
818     yes) ac_result=no ;;
819   esac
820   case "$ac_result$ac_set" in
821     yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
822   esac
823   AC_MSG_RESULT($ac_result)
824   case $ac_result in
825     yes)
826       for ac_shellvar in $ac_shellvars; do
827         eval $ac_shellvar=\$ac_test_$ac_shellvar
828       done ;;
829   esac
830 ])
832 AC_DEFUN(AC_SOCKADDR_SA_LEN,[
833   AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[
834     AC_TRY_COMPILE([#include <sys/types.h>
835 #include <sys/socket.h>],
836     [struct sockaddr s; s.sa_len;],
837     [ac_cv_sockaddr_sa_len=yes
838      AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[ ])],
839     [ac_cv_sockaddr_sa_len=no])
840   ])
841 ])
844 dnl ## PHP_AC_OUTPUT(file)
845 dnl ## adds "file" to the list of files generated by AC_OUTPUT
846 dnl ## This macro can be used several times.
847 AC_DEFUN(PHP_OUTPUT,[
848   PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"
849 ])
851 AC_DEFUN(PHP_DECLARED_TIMEZONE,[
852   AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[
853     AC_TRY_COMPILE([
854 #include <sys/types.h>
855 #include <time.h>
856 #ifdef HAVE_SYS_TIME_H
857 #include <sys/time.h>
858 #endif
859 ],[
860     time_t foo = (time_t) timezone;
861 ],[
862   ac_cv_declared_timezone=yes
863 ],[
864   ac_cv_declared_timezone=no
865 ])])
866   if test "$ac_cv_declared_timezone" = "yes"; then
867     AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone])
868   fi
869 ])
871 AC_DEFUN(PHP_EBCDIC,[
872   AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
873   AC_TRY_RUN( [
874 int main(void) { 
875   return (unsigned char)'A' != (unsigned char)0xC1; 
876
877 ],[
878   ac_cv_ebcdic="yes"
879 ],[
880   ac_cv_ebcdic="no"
881 ],[
882   ac_cv_ebcdic="no"
883 ])])
884   if test "$ac_cv_ebcdic" = "yes"; then
885     AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC])
886   fi
887 ])
891 # serial 40 AC_PROG_LIBTOOL
892 AC_DEFUN(AC_PROG_LIBTOOL,
893 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
895 # Save cache, so that ltconfig can load it
896 AC_CACHE_SAVE
898 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
899 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
900 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
901 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
902 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
903 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
904 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
905 || AC_MSG_ERROR([libtool configure failed])
907 # Reload cache, that may have been modified by ltconfig
908 AC_CACHE_LOAD
910 # This can be used to rebuild libtool when needed
911 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
913 # Always use our own libtool.
914 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
915 AC_SUBST(LIBTOOL)dnl
917 # Redirect the config.log output again, so that the ltconfig log is not
918 # clobbered by the next message.
919 exec 5>>./config.log
920 ])
922 AC_DEFUN(AC_LIBTOOL_SETUP,
923 [AC_PREREQ(2.13)dnl
924 AC_REQUIRE([AC_ENABLE_SHARED])dnl
925 AC_REQUIRE([AC_ENABLE_STATIC])dnl
926 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
927 AC_REQUIRE([AC_CANONICAL_HOST])dnl
928 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
929 AC_REQUIRE([AC_PROG_RANLIB])dnl
930 AC_REQUIRE([AC_PROG_CC])dnl
931 AC_REQUIRE([AC_PROG_LD])dnl
932 AC_REQUIRE([AC_PROG_NM])dnl
933 AC_REQUIRE([AC_PROG_LN_S])dnl
934 dnl
936 # Check for any special flags to pass to ltconfig.
937 libtool_flags="--cache-file=$cache_file"
938 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
939 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
940 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
941 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
942 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
943 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
944 [libtool_flags="$libtool_flags --enable-dlopen"])
945 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
946 [libtool_flags="$libtool_flags --enable-win32-dll"])
947 AC_ARG_ENABLE(libtool-lock,
948   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
949 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
950 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
952 # Some flags need to be propagated to the compiler or linker for good
953 # libtool support.
954 case "$host" in
955 *-*-irix6*)
956   # Find out which ABI we are using.
957   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
958   if AC_TRY_EVAL(ac_compile); then
959     case "`/usr/bin/file conftest.o`" in
960     *32-bit*)
961       LD="${LD-ld} -32"
962       ;;
963     *N32*)
964       LD="${LD-ld} -n32"
965       ;;
966     *64-bit*)
967       LD="${LD-ld} -64"
968       ;;
969     esac
970   fi
971   rm -rf conftest*
972   ;;
974 *-*-sco3.2v5*)
975   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
976   SAVE_CFLAGS="$CFLAGS"
977   CFLAGS="$CFLAGS -belf"
978   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
979     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
980   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
981     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
982     CFLAGS="$SAVE_CFLAGS"
983   fi
984   ;;
986 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
987 [*-*-cygwin* | *-*-mingw*)
988   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
989   AC_CHECK_TOOL(AS, as, false)
990   AC_CHECK_TOOL(OBJDUMP, objdump, false)
991   ;;
992 ])
993 esac
994 ])
996 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
997 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
999 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
1000 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
1002 # AC_ENABLE_SHARED - implement the --enable-shared flag
1003 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
1004 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1005 #   `yes'.
1006 AC_DEFUN(AC_ENABLE_SHARED, [dnl
1007 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
1008 AC_ARG_ENABLE(shared,
1009 changequote(<<, >>)dnl
1010 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
1011 changequote([, ])dnl
1012 [p=${PACKAGE-default}
1013 case "$enableval" in
1014 yes) enable_shared=yes ;;
1015 no) enable_shared=no ;;
1016 *)
1017   enable_shared=no
1018   # Look at the argument we got.  We use all the common list separators.
1019   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1020   for pkg in $enableval; do
1021     if test "X$pkg" = "X$p"; then
1022       enable_shared=yes
1023     fi
1024   done
1025   IFS="$ac_save_ifs"
1026   ;;
1027 esac],
1028 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
1029 ])
1031 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
1032 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1033 AC_ENABLE_SHARED(no)])
1035 # AC_ENABLE_STATIC - implement the --enable-static flag
1036 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
1037 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1038 #   `yes'.
1039 AC_DEFUN(AC_ENABLE_STATIC, [dnl
1040 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
1041 AC_ARG_ENABLE(static,
1042 changequote(<<, >>)dnl
1043 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
1044 changequote([, ])dnl
1045 [p=${PACKAGE-default}
1046 case "$enableval" in
1047 yes) enable_static=yes ;;
1048 no) enable_static=no ;;
1049 *)
1050   enable_static=no
1051   # Look at the argument we got.  We use all the common list separators.
1052   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1053   for pkg in $enableval; do
1054     if test "X$pkg" = "X$p"; then
1055       enable_static=yes
1056     fi
1057   done
1058   IFS="$ac_save_ifs"
1059   ;;
1060 esac],
1061 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
1062 ])
1064 # AC_DISABLE_STATIC - set the default static flag to --disable-static
1065 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1066 AC_ENABLE_STATIC(no)])
1069 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
1070 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
1071 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1072 #   `yes'.
1073 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
1074 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
1075 AC_ARG_ENABLE(fast-install,
1076 changequote(<<, >>)dnl
1077 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
1078 changequote([, ])dnl
1079 [p=${PACKAGE-default}
1080 case "$enableval" in
1081 yes) enable_fast_install=yes ;;
1082 no) enable_fast_install=no ;;
1083 *)
1084   enable_fast_install=no
1085   # Look at the argument we got.  We use all the common list separators.
1086   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1087   for pkg in $enableval; do
1088     if test "X$pkg" = "X$p"; then
1089       enable_fast_install=yes
1090     fi
1091   done
1092   IFS="$ac_save_ifs"
1093   ;;
1094 esac],
1095 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
1096 ])
1098 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
1099 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1100 AC_ENABLE_FAST_INSTALL(no)])
1102 # AC_PROG_LD - find the path to the GNU or non-GNU linker
1103 AC_DEFUN(AC_PROG_LD,
1104 [AC_ARG_WITH(gnu-ld,
1105 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1106 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1107 AC_REQUIRE([AC_PROG_CC])dnl
1108 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1109 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1110 ac_prog=ld
1111 if test "$ac_cv_prog_gcc" = yes; then
1112   # Check if gcc -print-prog-name=ld gives a path.
1113   AC_MSG_CHECKING([for ld used by GCC])
1114   ac_prog=`($CC -print-prog-name=ld) 2>&5`
1115   case "$ac_prog" in
1116     # Accept absolute paths.
1117 changequote(,)dnl
1118     [\\/]* | [A-Za-z]:[\\/]*)
1119       re_direlt='/[^/][^/]*/\.\./'
1120 changequote([,])dnl
1121       # Canonicalize the path of ld
1122       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1123       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1124         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1125       done
1126       test -z "$LD" && LD="$ac_prog"
1127       ;;
1128   "")
1129     # If it fails, then pretend we aren't using GCC.
1130     ac_prog=ld
1131     ;;
1132   *)
1133     # If it is relative, then search for the first ld in PATH.
1134     with_gnu_ld=unknown
1135     ;;
1136   esac
1137 elif test "$with_gnu_ld" = yes; then
1138   AC_MSG_CHECKING([for GNU ld])
1139 else
1140   AC_MSG_CHECKING([for non-GNU ld])
1141 fi
1142 AC_CACHE_VAL(ac_cv_path_LD,
1143 [if test -z "$LD"; then
1144   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1145   for ac_dir in $PATH; do
1146     test -z "$ac_dir" && ac_dir=.
1147     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1148       ac_cv_path_LD="$ac_dir/$ac_prog"
1149       # Check to see if the program is GNU ld.  I'd rather use --version,
1150       # but apparently some GNU ld's only accept -v.
1151       # Break only if it was the GNU/non-GNU ld that we prefer.
1152       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
1153         test "$with_gnu_ld" != no && break
1154       else
1155         test "$with_gnu_ld" != yes && break
1156       fi
1157     fi
1158   done
1159   IFS="$ac_save_ifs"
1160 else
1161   ac_cv_path_LD="$LD" # Let the user override the test with a path.
1162 fi])
1163 LD="$ac_cv_path_LD"
1164 if test -n "$LD"; then
1165   AC_MSG_RESULT($LD)
1166 else
1167   AC_MSG_RESULT(no)
1168 fi
1169 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1170 AC_SUBST(LD)
1171 AC_PROG_LD_GNU
1172 ])
1174 AC_DEFUN(AC_PROG_LD_GNU,
1175 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
1176 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1177 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
1178   ac_cv_prog_gnu_ld=yes
1179 else
1180   ac_cv_prog_gnu_ld=no
1181 fi])
1182 ])
1184 # AC_PROG_NM - find the path to a BSD-compatible name lister
1185 AC_DEFUN(AC_PROG_NM,
1186 [AC_MSG_CHECKING([for BSD-compatible nm])
1187 AC_CACHE_VAL(ac_cv_path_NM,
1188 [if test -n "$NM"; then
1189   # Let the user override the test.
1190   ac_cv_path_NM="$NM"
1191 else
1192   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1193   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
1194     test -z "$ac_dir" && ac_dir=.
1195     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
1196       # Check to see if the nm accepts a BSD-compat flag.
1197       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
1198       #   nm: unknown option "B" ignored
1199       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1200         ac_cv_path_NM="$ac_dir/nm -B"
1201         break
1202       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1203         ac_cv_path_NM="$ac_dir/nm -p"
1204         break
1205       else
1206         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
1207         continue # so that we can try to find one that supports BSD flags
1208       fi
1209     fi
1210   done
1211   IFS="$ac_save_ifs"
1212   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
1213 fi])
1214 NM="$ac_cv_path_NM"
1215 AC_MSG_RESULT([$NM])
1216 AC_SUBST(NM)
1217 ])
1219 # AC_CHECK_LIBM - check for math library
1220 AC_DEFUN(AC_CHECK_LIBM,
1221 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
1222 LIBM=
1223 case "$host" in
1224 *-*-beos* | *-*-cygwin*)
1225   # These system don't have libm
1226   ;;
1227 *-ncr-sysv4.3*)
1228   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
1229   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
1230   ;;
1231 *)
1232   AC_CHECK_LIB(m, main, LIBM="-lm")
1233   ;;
1234 esac
1235 ])
1237 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
1238 # the libltdl convenience library, adds --enable-ltdl-convenience to
1239 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1240 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1241 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1242 # '${top_builddir}/' (note the single quotes!) if your package is not
1243 # flat, and, if you're not using automake, define top_builddir as
1244 # appropriate in the Makefiles.
1245 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1246   case "$enable_ltdl_convenience" in
1247   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
1248   "") enable_ltdl_convenience=yes
1249       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
1250   esac
1251   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
1252   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
1253 ])
1255 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
1256 # the libltdl installable library, and adds --enable-ltdl-install to
1257 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1258 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1259 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1260 # '${top_builddir}/' (note the single quotes!) if your package is not
1261 # flat, and, if you're not using automake, define top_builddir as
1262 # appropriate in the Makefiles.
1263 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
1264 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1265   AC_CHECK_LIB(ltdl, main,
1266   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
1267   [if test x"$enable_ltdl_install" = xno; then
1268      AC_MSG_WARN([libltdl not installed, but installation disabled])
1269    else
1270      enable_ltdl_install=yes
1271    fi
1272   ])
1273   if test x"$enable_ltdl_install" = x"yes"; then
1274     ac_configure_args="$ac_configure_args --enable-ltdl-install"
1275     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
1276     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
1277   else
1278     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
1279     LIBLTDL="-lltdl"
1280     INCLTDL=
1281   fi
1282 ])
1284 dnl old names
1285 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
1286 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
1287 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
1288 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
1289 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
1290 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
1291 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
1293 dnl This is just to silence aclocal about the macro not being used
1294 ifelse([AC_DISABLE_FAST_INSTALL])dnl