Basically, this commit only simplifies configure.ac and makes the
[asterisk/asterisk.git] / acinclude.m4
1 # AST_GCC_ATTRIBUTE([attribute name])
2
3 AC_DEFUN([AST_GCC_ATTRIBUTE],
4 [
5 AC_MSG_CHECKING(for compiler 'attribute $1' support)
6 AC_COMPILE_IFELSE(
7         AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}],
8                         []),
9         AC_MSG_RESULT(yes)
10         AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
11         AC_MSG_RESULT(no))
12 ])
13
14 # AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text])
15
16 AC_DEFUN([AST_EXT_LIB_SETUP],
17 [
18 $1_DESCRIP="$2"
19 $1_OPTION="$3"
20 AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]),[
21 case ${withval} in
22      n|no)
23      USE_$1=no
24      ;;
25      y|ye|yes)
26      ac_mandatory_list="${ac_mandatory_list} $1"
27      ;;
28      *)
29      $1_DIR="${withval}"
30      ac_mandatory_list="${ac_mandatory_list} $1"
31      ;;
32 esac
33 ])
34 PBX_$1=0
35 AC_SUBST([$1_LIB])
36 AC_SUBST([$1_INCLUDE])
37 AC_SUBST([PBX_$1])
38 ])
39
40 # Check whether any of the mandatory modules are not present, and
41 # print error messages in case.
42
43 AC_DEFUN([AST_CHECK_MANDATORY],
44 [
45         AC_MSG_CHECKING([for mandatory modules: ${ac_mandatory_list}])
46         err=0;
47         for i in ${ac_mandatory_list}; do
48                 eval "a=\${PBX_$i}"
49                 if test "x${a}" = "x1" ; then continue; fi
50                 if test ${err} = "0" ; then AC_MSG_RESULT(fail) ; fi
51                 AC_MSG_RESULT()
52                 eval "a=\${${i}_OPTION}"
53                 AC_MSG_NOTICE(***)
54                 AC_MSG_NOTICE(*** The $i installation appears to be missing or broken.)
55                 AC_MSG_NOTICE(*** Either correct the installation, or run configure)
56                 AC_MSG_NOTICE(*** including --without-${a}.)
57                 err=1
58         done
59         if test $err = 1 ; then exit 1; fi
60         AC_MSG_RESULT(ok)
61 ])
62
63 #-- The following two tests are only performed if PBX_$1 != 1,
64 #   so you can use multiple tests and stop at the first matching one.
65 #   On success, set PBX_$1 = 1, and also #define HAVE_$1 1
66 #   and #define HAVE_$1_VERSION ${last_argument} so you can tell which
67 #   test succeeded.
68 #   They should be called after AST_EXT_LIB_SETUP($1, ...)
69
70 # Check if a given macro is defined in a certain header.
71
72 # AST_C_DEFINE_CHECK([package symbol name], [macro name], [header file], [version])
73 AC_DEFUN([AST_C_DEFINE_CHECK],
74 [
75     if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
76         AC_MSG_CHECKING([for $2 in $3])
77         saved_cppflags="${CPPFLAGS}"
78         if test "x${$1_DIR}" != "x"; then
79             $1_INCLUDE= "-I${$1_DIR}/include"
80         fi
81         CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
82
83         AC_COMPILE_IFELSE(
84             [ AC_LANG_PROGRAM( [#include <$3>], [int foo = $2;]) ],
85             [   AC_MSG_RESULT(yes)
86                 PBX_$1=1
87                 AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.])
88                 AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version])
89             ],
90             [       AC_MSG_RESULT(no) ] 
91         )
92         CPPFLAGS="${saved_cppflags}"
93     fi
94 ])
95
96
97 # Check for existence of a given package ($1), either looking up a function
98 # in a library, or, if no function is supplied, only check for the
99 # existence of the header files.
100
101 # AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data], [version])
102 AC_DEFUN([AST_EXT_LIB_CHECK],
103 [
104 if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
105    pbxlibdir=""
106    if test "x${$1_DIR}" != "x"; then
107       if test -d ${$1_DIR}/lib; then
108          pbxlibdir="-L${$1_DIR}/lib"
109       else
110          pbxlibdir="-L${$1_DIR}"
111       fi
112    fi
113    pbxfuncname="$3"
114    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
115       AST_$1_FOUND=yes
116    else
117       AC_CHECK_LIB([$2], [${pbxfuncname}], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5)
118    fi
119
120    if test "${AST_$1_FOUND}" = "yes"; then
121       $1_LIB="-l$2 $5"
122       $1_HEADER_FOUND="1"
123       if test "x${$1_DIR}" != "x"; then
124          $1_LIB="${pbxlibdir} ${$1_LIB}"
125          $1_INCLUDE="-I${$1_DIR}/include"
126          if test "x$4" != "x" ; then
127             AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
128          fi
129       else
130          if test "x$4" != "x" ; then
131             AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
132          fi
133       fi
134       if test "x${$1_HEADER_FOUND}" = "x0" ; then
135          $1_LIB=""
136          $1_INCLUDE=""
137       else
138          if test "x${pbxfuncname}" = "x" ; then         # only checking headers -> no library
139             $1_LIB=""
140          fi
141          PBX_$1=1
142          # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
143          AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define this to indicate the ${$1_DESCRIP} library])
144          AC_DEFINE_UNQUOTED([HAVE_$1_VERSION], [$6], [Define to indicate the ${$1_DESCRIP} library version])
145       fi
146    fi
147 fi
148 ])
149
150
151 AC_DEFUN(
152 [AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE,
153    GNU_MAKE='Not Found' ;
154    GNU_MAKE_VERSION_MAJOR=0 ;
155    GNU_MAKE_VERSION_MINOR=0 ;
156    for a in make gmake gnumake ; do
157       if test -z "$a" ; then continue ; fi ;
158       if ( sh -c "$a --version" 2> /dev/null | grep GNU  2>&1 > /dev/null ) ;  then
159          GNU_MAKE=$a ;
160          GNU_MAKE_VERSION_MAJOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'`
161          GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2`
162          break;
163       fi
164    done ;
165 ) ;
166 if test  "x$GNU_MAKE" = "xNot Found"  ; then
167    AC_MSG_ERROR( *** Please install GNU make.  It is required to build Asterisk!)
168    exit 1
169 fi
170 AC_SUBST([GNU_MAKE])
171 ])
172
173
174 AC_DEFUN(
175 [AST_CHECK_PWLIB], [
176 PWLIB_INCDIR=
177 PWLIB_LIBDIR=
178 if test "${PWLIBDIR:-unset}" != "unset" ; then
179   AC_CHECK_FILE(${PWLIBDIR}/version.h, HAS_PWLIB=1, )
180 fi
181 if test "${HAS_PWLIB:-unset}" = "unset" ; then
182   if test "${OPENH323DIR:-unset}" != "unset"; then
183     AC_CHECK_FILE(${OPENH323DIR}/../pwlib/version.h, HAS_PWLIB=1, )
184   fi
185   if test "${HAS_PWLIB:-unset}" != "unset" ; then
186     PWLIBDIR="${OPENH323DIR}/../pwlib"
187   else
188     AC_CHECK_FILE(${HOME}/pwlib/include/ptlib.h, HAS_PWLIB=1, )
189     if test "${HAS_PWLIB:-unset}" != "unset" ; then
190       PWLIBDIR="${HOME}/pwlib"
191     else
192       AC_CHECK_FILE(/usr/local/include/ptlib.h, HAS_PWLIB=1, )
193       if test "${HAS_PWLIB:-unset}" != "unset" ; then
194         AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/bin)
195         if test "${PTLIB_CONFIG:-unset}" = "unset" ; then
196           AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/share/pwlib/make)
197         fi
198         PWLIB_INCDIR="/usr/local/include"
199         if test "x$LIB64" != "x"; then
200           PWLIB_LIBDIR="/usr/local/lib64"
201         else
202           PWLIB_LIBDIR="/usr/local/lib"
203         fi
204       else
205         AC_CHECK_FILE(/usr/include/ptlib.h, HAS_PWLIB=1, )
206         if test "${HAS_PWLIB:-unset}" != "unset" ; then
207           AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/share/pwlib/make)
208           PWLIB_INCDIR="/usr/include"
209           if test "x$LIB64" != "x"; then
210                 PWLIB_LIBDIR="/usr/lib64"
211           else
212                 PWLIB_LIBDIR="/usr/lib"
213               fi
214         fi
215       fi
216     fi
217   fi
218 fi
219
220 #if test "${HAS_PWLIB:-unset}" = "unset" ; then
221 #  echo "Cannot find pwlib - please install or set PWLIBDIR and try again"
222 #  exit
223 #fi
224
225 if test "${HAS_PWLIB:-unset}" != "unset" ; then
226   if test "${PWLIBDIR:-unset}" = "unset" ; then
227     if test "${PTLIB_CONFIG:-unset}" != "unset" ; then
228       PWLIBDIR=`$PTLIB_CONFIG --prefix`
229     else
230       echo "Cannot find ptlib-config - please install and try again"
231       exit
232     fi
233   fi
234
235   if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then
236     PWLIBDIR="/usr/share/pwlib"
237     PWLIB_INCDIR="/usr/include"
238     if test "x$LIB64" != "x"; then
239       PWLIB_LIBDIR="/usr/lib64"
240     else
241       PWLIB_LIBDIR="/usr/lib"
242     fi
243   fi
244   if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then
245     PWLIBDIR="/usr/local/share/pwlib"
246     PWLIB_INCDIR="/usr/local/include"
247     if test "x$LIB64" != "x"; then
248       PWLIB_LIBDIR="/usr/local/lib64"
249     else
250       PWLIB_LIBDIR="/usr/local/lib"
251     fi
252   fi
253
254   if test "${PWLIB_INCDIR:-unset}" = "unset"; then
255     PWLIB_INCDIR="${PWLIBDIR}/include"
256   fi
257   if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
258     PWLIB_LIBDIR="${PWLIBDIR}/lib"
259   fi
260
261   AC_SUBST([PWLIBDIR])
262   AC_SUBST([PWLIB_INCDIR])
263   AC_SUBST([PWLIB_LIBDIR])
264 fi
265 ])
266
267
268 AC_DEFUN(
269 [AST_CHECK_OPENH323_PLATFORM], [
270 PWLIB_OSTYPE=
271 case "$host_os" in
272   linux*)          PWLIB_OSTYPE=linux ;
273                 ;;
274   freebsd* )       PWLIB_OSTYPE=FreeBSD ;
275                 ;;
276   openbsd* )       PWLIB_OSTYPE=OpenBSD ;
277                                    ENDLDLIBS="-lossaudio" ;
278                 ;;
279   netbsd* )        PWLIB_OSTYPE=NetBSD ;
280                                    ENDLDLIBS="-lossaudio" ;
281                 ;;
282   solaris* | sunos* ) PWLIB_OSTYPE=solaris ;
283                 ;;
284   darwin* )            PWLIB_OSTYPE=Darwin ;
285                 ;;
286   beos*)           PWLIB_OSTYPE=beos ;
287                    STDCCFLAGS="$STDCCFLAGS -D__BEOS__"
288                 ;;
289   cygwin*)         PWLIB_OSTYPE=cygwin ;
290                 ;;
291   mingw*)              PWLIB_OSTYPE=mingw ;
292                            STDCCFLAGS="$STDCCFLAGS -mms-bitfields" ;
293                            ENDLDLIBS="-lwinmm -lwsock32 -lsnmpapi -lmpr -lcomdlg32 -lgdi32 -lavicap32" ;
294                 ;;
295   * )                  PWLIB_OSTYPE="$host_os" ;
296                            AC_MSG_WARN("OS $PWLIB_OSTYPE not recognized - proceed with caution!") ;
297                 ;;
298 esac
299
300 PWLIB_MACHTYPE=
301 case "$host_cpu" in
302    x86 | i686 | i586 | i486 | i386 ) PWLIB_MACHTYPE=x86
303                    ;;
304
305    x86_64)         PWLIB_MACHTYPE=x86_64 ;
306                    P_64BIT=1 ;
307                    LIB64=1 ;
308                    ;;
309
310    alpha | alphaev56 | alphaev6 | alphaev67 | alphaev7) PWLIB_MACHTYPE=alpha ;
311                    P_64BIT=1 ;
312                    ;;
313
314    sparc )         PWLIB_MACHTYPE=sparc ;
315                    ;;
316
317    powerpc )       PWLIB_MACHTYPE=ppc ;
318                    ;;
319
320    ppc )           PWLIB_MACHTYPE=ppc ;
321                    ;;
322
323    powerpc64 )     PWLIB_MACHTYPE=ppc64 ;
324                    P_64BIT=1 ;
325                    LIB64=1 ;
326                    ;;
327
328    ppc64 )         PWLIB_MACHTYPE=ppc64 ;
329                    P_64BIT=1 ;
330                    LIB64=1 ;
331                    ;;
332
333    ia64)           PWLIB_MACHTYPE=ia64 ;
334                    P_64BIT=1 ;
335                    ;;
336
337    s390x)          PWLIB_MACHTYPE=s390x ;
338                    P_64BIT=1 ;
339                    LIB64=1 ;
340                    ;;
341
342    s390)           PWLIB_MACHTYPE=s390 ;
343                    ;;
344
345    * )             PWLIB_MACHTYPE="$host_cpu";
346                    AC_MSG_WARN("CPU $PWLIB_MACHTYPE not recognized - proceed with caution!") ;;
347 esac
348
349 PWLIB_PLATFORM="${PWLIB_OSTYPE}_${PWLIB_MACHTYPE}"
350
351 AC_SUBST([PWLIB_PLATFORM])
352 ])
353
354
355 AC_DEFUN(
356 [AST_CHECK_OPENH323], [
357 OPENH323_INCDIR=
358 OPENH323_LIBDIR=
359 if test "${OPENH323DIR:-unset}" != "unset" ; then
360   AC_CHECK_FILE(${OPENH323DIR}/version.h, HAS_OPENH323=1, )
361 fi
362 if test "${HAS_OPENH323:-unset}" = "unset" ; then
363   AC_CHECK_FILE(${PWLIBDIR}/../openh323/version.h, OPENH323DIR="${PWLIBDIR}/../openh323"; HAS_OPENH323=1, )
364   if test "${HAS_OPENH323:-unset}" != "unset" ; then
365     OPENH323DIR="${PWLIBDIR}/../openh323"
366     AC_CHECK_FILE(${OPENH323DIR}/include/h323.h, , OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}")
367   else
368     AC_CHECK_FILE(${HOME}/openh323/include/h323.h, HAS_OPENH323=1, )
369     if test "${HAS_OPENH323:-unset}" != "unset" ; then
370       OPENH323DIR="${HOME}/openh323"
371     else
372       AC_CHECK_FILE(/usr/local/include/openh323/h323.h, HAS_OPENH323=1, )
373       if test "${HAS_OPENH323:-unset}" != "unset" ; then
374         OPENH323DIR="/usr/local/share/openh323"
375         OPENH323_INCDIR="/usr/local/include/openh323"
376         if test "x$LIB64" != "x"; then
377           OPENH323_LIBDIR="/usr/local/lib64"
378         else
379           OPENH323_LIBDIR="/usr/local/lib"
380         fi
381       else
382         AC_CHECK_FILE(/usr/include/openh323/h323.h, HAS_OPENH323=1, )
383         if test "${HAS_OPENH323:-unset}" != "unset" ; then
384           OPENH323DIR="/usr/share/openh323"
385           OPENH323_INCDIR="/usr/include/openh323"
386           if test "x$LIB64" != "x"; then
387             OPENH323_LIBDIR="/usr/lib64"
388           else
389             OPENH323_LIBDIR="/usr/lib"
390           fi
391         fi
392       fi
393     fi
394   fi
395 fi
396
397 if test "${HAS_OPENH323:-unset}" != "unset" ; then
398   if test "${OPENH323_INCDIR:-unset}" = "unset"; then
399     OPENH323_INCDIR="${OPENH323DIR}/include"
400   fi
401   if test "${OPENH323_LIBDIR:-unset}" = "unset"; then
402     OPENH323_LIBDIR="${OPENH323DIR}/lib"
403   fi
404
405   AC_SUBST([OPENH323DIR])
406   AC_SUBST([OPENH323_INCDIR])
407   AC_SUBST([OPENH323_LIBDIR])
408 fi
409 ])
410
411
412 AC_DEFUN(
413 [AST_CHECK_PWLIB_VERSION], [
414         if test "${HAS_$2:-unset}" != "unset"; then
415                 $2_VERSION=`grep "$2_VERSION" ${$2_INCDIR}/$3 | cut -f2 -d ' ' | sed -e 's/"//g'`
416                 $2_MAJOR_VERSION=`echo ${$2_VERSION} | cut -f1 -d.`
417                 $2_MINOR_VERSION=`echo ${$2_VERSION} | cut -f2 -d.`
418                 $2_BUILD_NUMBER=`echo ${$2_VERSION} | cut -f3 -d.`
419                 let $2_VER=${$2_MAJOR_VERSION}*10000+${$2_MINOR_VERSION}*100+${$2_BUILD_NUMBER}
420                 let $2_REQ=$4*10000+$5*100+$6
421
422                 AC_MSG_CHECKING(if $1 version ${$2_VERSION} is compatible with chan_h323)
423                 if test ${$2_VER} -lt ${$2_REQ}; then
424                         AC_MSG_RESULT(no)
425                         unset HAS_$2
426                 else
427                         AC_MSG_RESULT(yes)
428                 fi
429         fi
430 ])
431
432
433 AC_DEFUN(
434 [AST_CHECK_PWLIB_BUILD], [
435         if test "${HAS_$2:-unset}" != "unset"; then
436            AC_MSG_CHECKING($1 installation validity)
437
438            saved_cppflags="${CPPFLAGS}"
439            saved_libs="${LIBS}"
440            LIBS="${LIBS} -L${$2_LIBDIR} -l${PLATFORM_$2} $7"
441            CPPFLAGS="${CPPFLAGS} -I${$2_INCDIR} $6"
442
443            AC_LANG_PUSH([C++])
444
445            AC_LINK_IFELSE(
446                 [AC_LANG_PROGRAM([$4],[$5])],
447                 [       AC_MSG_RESULT(yes) 
448                         ac_cv_lib_$2="yes" 
449                 ],
450                 [       AC_MSG_RESULT(no) 
451                         ac_cv_lib_$2="no" 
452                 ]
453                 )
454
455            AC_LANG_POP([C++])
456
457            LIBS="${saved_libs}"
458            CPPFLAGS="${saved_cppflags}"
459
460            if test "${ac_cv_lib_$2}" = "yes"; then
461               if test "${$2_LIBDIR}" != "" -a "${$2_LIBDIR}" != "/usr/lib"; then
462                  $2_LIB="-L${$2_LIBDIR} -l${PLATFORM_$2}"
463               else
464                  $2_LIB="-l${PLATFORM_$2}"
465               fi
466               if test "${$2_INCDIR}" != "" -a "${$2_INCDIR}" != "/usr/include"; then
467                  $2_INCLUDE="-I${$2_INCDIR}"
468               fi
469                   PBX_$2=1
470                   AC_DEFINE([HAVE_$2], 1, [$3])
471            fi
472         fi
473 ])
474
475 AC_DEFUN(
476 [AST_CHECK_OPENH323_BUILD], [
477         if test "${HAS_OPENH323:-unset}" != "unset"; then
478                 AC_MSG_CHECKING(OpenH323 build option)
479                 OPENH323_SUFFIX=
480                 files=`ls -l ${OPENH323_LIBDIR}/libh323_${PWLIB_PLATFORM}_*.so*`
481                 libfile=
482                 if test -n "$files"; then
483                         for f in $files; do
484                                 if test -f $f -a ! -L $f; then
485                                         libfile=`basename $f`
486                                         break;
487                                 fi
488                         done
489                 fi
490                 if test "${libfile:-unset}" != "unset"; then
491                         OPENH323_SUFFIX=`eval "echo ${libfile} | sed -e 's/libh323_${PWLIB_PLATFORM}_\(@<:@^.@:>@*\)\..*/\1/'"`
492                 fi
493                 case "${OPENH323_SUFFIX}" in
494                         n)
495                                 OPENH323_BUILD="notrace";;
496                         r)
497                                 OPENH323_BUILD="opt";;
498                         d)
499                                 OPENH323_BUILD="debug";;
500                         *)
501                                 OPENH323_BUILD="notrace";;
502                 esac
503                 AC_MSG_RESULT(${OPENH323_BUILD})
504
505                 AC_SUBST([OPENH323_SUFFIX])
506                 AC_SUBST([OPENH323_BUILD])
507         fi
508 ])
509
510
511 # AST_FUNC_FORK
512 # -------------
513 AN_FUNCTION([fork],  [AST_FUNC_FORK])
514 AN_FUNCTION([vfork], [AST_FUNC_FORK])
515 AC_DEFUN([AST_FUNC_FORK],
516 [AC_REQUIRE([AC_TYPE_PID_T])dnl
517 AC_CHECK_HEADERS(vfork.h)
518 AC_CHECK_FUNCS(fork vfork)
519 if test "x$ac_cv_func_fork" = xyes; then
520   _AST_FUNC_FORK
521 else
522   ac_cv_func_fork_works=$ac_cv_func_fork
523 fi
524 if test "x$ac_cv_func_fork_works" = xcross; then
525   case $host in
526     *-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* )
527       # Override, as these systems have only a dummy fork() stub
528       ac_cv_func_fork_works=no
529       ;;
530     *)
531       ac_cv_func_fork_works=yes
532       ;;
533   esac
534   AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation])
535 fi
536 ac_cv_func_vfork_works=$ac_cv_func_vfork
537 if test "x$ac_cv_func_vfork" = xyes; then
538   _AC_FUNC_VFORK
539 fi;
540 if test "x$ac_cv_func_fork_works" = xcross; then
541   ac_cv_func_vfork_works=$ac_cv_func_vfork
542   AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation])
543 fi
544
545 if test "x$ac_cv_func_vfork_works" = xyes; then
546   AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.])
547 else
548   AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
549 fi
550 if test "x$ac_cv_func_fork_works" = xyes; then
551   AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.])
552 fi
553 ])# AST_FUNC_FORK
554
555
556 # _AST_FUNC_FORK
557 # -------------
558 AC_DEFUN([_AST_FUNC_FORK],
559   [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,
560     [AC_RUN_IFELSE(
561       [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
562         [
563           /* By Ruediger Kuhlmann. */
564           return fork () < 0;
565         ])],
566       [ac_cv_func_fork_works=yes],
567       [ac_cv_func_fork_works=no],
568       [ac_cv_func_fork_works=cross])])]
569 )# _AST_FUNC_FORK