put this value into the correct property
[asterisk-bristuff.git] / acinclude.m4
blob6152b96968407683bb80134cd8055ec407e2b752
1 # AST_GCC_ATTRIBUTE([attribute name])
3 AC_DEFUN([AST_GCC_ATTRIBUTE],
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))
14 # AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text])
16 AC_DEFUN([AST_EXT_LIB_SETUP],
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      $1_MANDATORY="yes"
27      ;;
28      *)
29      $1_DIR="${withval}"
30      $1_MANDATORY="yes"
31      ;;
32 esac
34 PBX_$1=0
35 AC_SUBST([$1_LIB])
36 AC_SUBST([$1_INCLUDE])
37 AC_SUBST([PBX_$1])
40 # AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data])
42 AC_DEFUN([AST_EXT_LIB_CHECK],
44 if test "${USE_$1}" != "no"; then
45    pbxlibdir=""
46    if test "x${$1_DIR}" != "x"; then
47       if test -d ${$1_DIR}/lib; then
48          pbxlibdir="-L${$1_DIR}/lib"
49       else
50          pbxlibdir="-L${$1_DIR}"
51       fi
52    fi
53    AC_CHECK_LIB([$2], [$3], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5)
55    if test "${AST_$1_FOUND}" = "yes"; then
56       $1_LIB="-l$2 $5"
57       $1_HEADER_FOUND="1"
58       if test "x${$1_DIR}" != "x"; then
59          $1_LIB="${pbxlibdir} ${$1_LIB}"
60          $1_INCLUDE="-I${$1_DIR}/include"
61          if test "x$4" != "x" ; then
62             AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
63          fi
64       else
65          if test "x$4" != "x" ; then
66             AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
67          fi
68       fi
69       if test "x${$1_HEADER_FOUND}" = "x0" ; then
70          if test ! -z "${$1_MANDATORY}" ;
71          then
72             AC_MSG_NOTICE([***])
73             AC_MSG_NOTICE([*** It appears that you do not have the $2 development package installed.])
74             AC_MSG_NOTICE([*** Please install it to include ${$1_DESCRIP} support, or re-run configure])
75             AC_MSG_NOTICE([*** without explicitly specifying --with-${$1_OPTION}])
76             exit 1
77          fi
78          $1_LIB=""
79          $1_INCLUDE=""
80          PBX_$1=0
81       else
82          PBX_$1=1
83          AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define to indicate the ${$1_DESCRIP} library])
84       fi
85    elif test ! -z "${$1_MANDATORY}";
86    then
87       AC_MSG_NOTICE([***])
88       AC_MSG_NOTICE([*** The ${$1_DESCRIP} installation on this system appears to be broken.])
89       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
90       AC_MSG_NOTICE([*** without explicitly specifying --with-${$1_OPTION}])
91       exit 1
92    fi
97 AC_DEFUN(
98 [AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE,
99    GNU_MAKE='Not Found' ;
100    GNU_MAKE_VERSION_MAJOR=0 ;
101    GNU_MAKE_VERSION_MINOR=0 ;
102    for a in make gmake gnumake ; do
103       if test -z "$a" ; then continue ; fi ;
104       if ( sh -c "$a --version" 2> /dev/null | grep GNU  2>&1 > /dev/null ) ;  then
105          GNU_MAKE=$a ;
106          GNU_MAKE_VERSION_MAJOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'`
107          GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2`
108          break;
109       fi
110    done ;
111 ) ;
112 if test  "x$GNU_MAKE" = "xNot Found"  ; then
113    AC_MSG_ERROR( *** Please install GNU make.  It is required to build Asterisk!)
114    exit 1
116 AC_SUBST([GNU_MAKE])
120 AC_DEFUN(
121 [AST_CHECK_PWLIB], [
122 PWLIB_INCDIR=
123 PWLIB_LIBDIR=
124 if test "${PWLIBDIR:-unset}" != "unset" ; then
125   AC_CHECK_FILE(${PWLIBDIR}/version.h, HAS_PWLIB=1, )
127 if test "${HAS_PWLIB:-unset}" = "unset" ; then
128   if test "${OPENH323DIR:-unset}" != "unset"; then
129     AC_CHECK_FILE(${OPENH323DIR}/../pwlib/version.h, HAS_PWLIB=1, )
130   fi
131   if test "${HAS_PWLIB:-unset}" != "unset" ; then
132     PWLIBDIR="${OPENH323DIR}/../pwlib"
133   else
134     AC_CHECK_FILE(${HOME}/pwlib/include/ptlib.h, HAS_PWLIB=1, )
135     if test "${HAS_PWLIB:-unset}" != "unset" ; then
136       PWLIBDIR="${HOME}/pwlib"
137     else
138       AC_CHECK_FILE(/usr/local/include/ptlib.h, HAS_PWLIB=1, )
139       if test "${HAS_PWLIB:-unset}" != "unset" ; then
140         AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/bin)
141         if test "${PTLIB_CONFIG:-unset}" = "unset" ; then
142           AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/share/pwlib/make)
143         fi
144         PWLIB_INCDIR="/usr/local/include"
145         PWLIB_LIBDIR="/usr/local/lib"
146       else
147         AC_CHECK_FILE(/usr/include/ptlib.h, HAS_PWLIB=1, )
148         if test "${HAS_PWLIB:-unset}" != "unset" ; then
149           AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/share/pwlib/make)
150           PWLIB_INCDIR="/usr/include"
151           PWLIB_LIBDIR="/usr/lib"
152         fi
153       fi
154     fi
155   fi
158 #if test "${HAS_PWLIB:-unset}" = "unset" ; then
159 #  echo "Cannot find pwlib - please install or set PWLIBDIR and try again"
160 #  exit
163 if test "${HAS_PWLIB:-unset}" != "unset" ; then
164   if test "${PWLIBDIR:-unset}" = "unset" ; then
165     if test "${PTLIB_CONFIG:-unset}" != "unset" ; then
166       PWLIBDIR=`$PTLIB_CONFIG --prefix`
167     else
168       echo "Cannot find ptlib-config - please install and try again"
169       exit
170     fi
171   fi
173   if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then
174     PWLIBDIR="/usr/share/pwlib"
175     PWLIB_INCDIR="/usr/include"
176     PWLIB_LIBDIR="/usr/lib"
177   fi
178   if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then
179     PWLIBDIR="/usr/local/share/pwlib"
180     PWLIB_INCDIR="/usr/local/include"
181     PWLIB_LIBDIR="/usr/local/lib"
182   fi
184   if test "${PWLIB_INCDIR:-unset}" = "unset"; then
185     PWLIB_INCDIR="${PWLIBDIR}/include"
186   fi
187   if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
188     PWLIB_LIBDIR="${PWLIBDIR}/lib"
189   fi
191   AC_SUBST([PWLIBDIR])
192   AC_SUBST([PWLIB_INCDIR])
193   AC_SUBST([PWLIB_LIBDIR])
198 AC_DEFUN(
199 [AST_CHECK_OPENH323_PLATFORM], [
200 PWLIB_OSTYPE=
201 case "$host_os" in
202   linux*)          PWLIB_OSTYPE=linux ;
203                 ;;
204   freebsd* )       PWLIB_OSTYPE=FreeBSD ;
205                 ;;
206   openbsd* )       PWLIB_OSTYPE=OpenBSD ;
207                                    ENDLDLIBS="-lossaudio" ;
208                 ;;
209   netbsd* )        PWLIB_OSTYPE=NetBSD ;
210                                    ENDLDLIBS="-lossaudio" ;
211                 ;;
212   solaris* | sunos* ) PWLIB_OSTYPE=solaris ;
213                 ;;
214   darwin* )            PWLIB_OSTYPE=Darwin ;
215                 ;;
216   beos*)           PWLIB_OSTYPE=beos ;
217                    STDCCFLAGS="$STDCCFLAGS -D__BEOS__"
218                 ;;
219   cygwin*)         PWLIB_OSTYPE=cygwin ;
220                 ;;
221   mingw*)              PWLIB_OSTYPE=mingw ;
222                            STDCCFLAGS="$STDCCFLAGS -mms-bitfields" ;
223                            ENDLDLIBS="-lwinmm -lwsock32 -lsnmpapi -lmpr -lcomdlg32 -lgdi32 -lavicap32" ;
224                 ;;
225   * )                  PWLIB_OSTYPE="$host_os" ;
226                            AC_MSG_WARN("OS $PWLIB_OSTYPE not recognized - proceed with caution!") ;
227                 ;;
228 esac
230 PWLIB_MACHTYPE=
231 case "$host_cpu" in
232    x86 | i686 | i586 | i486 | i386 ) PWLIB_MACHTYPE=x86
233                    ;;
235    x86_64)         PWLIB_MACHTYPE=x86_64 ;
236                    P_64BIT=1 ;
237                    LIB64=1 ;
238                    ;;
240    alpha | alphaev56 | alphaev6 | alphaev67 | alphaev7) PWLIB_MACHTYPE=alpha ;
241                    P_64BIT=1 ;
242                    ;;
244    sparc )         PWLIB_MACHTYPE=sparc ;
245                    ;;
247    powerpc )       PWLIB_MACHTYPE=ppc ;
248                    ;;
250    ppc )           PWLIB_MACHTYPE=ppc ;
251                    ;;
253    powerpc64 )     PWLIB_MACHTYPE=ppc64 ;
254                    P_64BIT=1 ;
255                    LIB64=1 ;
256                    ;;
258    ppc64 )         PWLIB_MACHTYPE=ppc64 ;
259                    P_64BIT=1 ;
260                    LIB64=1 ;
261                    ;;
263    ia64)           PWLIB_MACHTYPE=ia64 ;
264                    P_64BIT=1 ;
265                    ;;
267    s390x)          PWLIB_MACHTYPE=s390x ;
268                    P_64BIT=1 ;
269                    LIB64=1 ;
270                    ;;
272    s390)           PWLIB_MACHTYPE=s390 ;
273                    ;;
275    * )             PWLIB_MACHTYPE="$host_cpu";
276                    AC_MSG_WARN("CPU $PWLIB_MACHTYPE not recognized - proceed with caution!") ;;
277 esac
279 PWLIB_PLATFORM="${PWLIB_OSTYPE}_${PWLIB_MACHTYPE}"
281 AC_SUBST([PWLIB_PLATFORM])
285 AC_DEFUN(
286 [AST_CHECK_OPENH323], [
287 OPENH323_INCDIR=
288 OPENH323_LIBDIR=
289 if test "${OPENH323DIR:-unset}" != "unset" ; then
290   AC_CHECK_FILE(${OPENH323DIR}/version.h, HAS_OPENH323=1, )
292 if test "${HAS_OPENH323:-unset}" = "unset" ; then
293   AC_CHECK_FILE(${PWLIBDIR}/../openh323/version.h, OPENH323DIR="${PWLIBDIR}/../openh323"; HAS_OPENH323=1, )
294   if test "${HAS_OPENH323:-unset}" != "unset" ; then
295     OPENH323DIR="${PWLIBDIR}/../openh323"
296     AC_CHECK_FILE(${OPENH323DIR}/include/h323.h, , OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}")
297   else
298     AC_CHECK_FILE(${HOME}/openh323/include/h323.h, HAS_OPENH323=1, )
299     if test "${HAS_OPENH323:-unset}" != "unset" ; then
300       OPENH323DIR="${HOME}/openh323"
301     else
302       AC_CHECK_FILE(/usr/local/include/openh323/h323.h, HAS_OPENH323=1, )
303       if test "${HAS_OPENH323:-unset}" != "unset" ; then
304         OPENH323DIR="/usr/local/share/openh323"
305         OPENH323_INCDIR="/usr/local/include/openh323"
306         OPENH323_LIBDIR="/usr/local/lib"
307       else
308         AC_CHECK_FILE(/usr/include/openh323/h323.h, HAS_OPENH323=1, )
309         if test "${HAS_OPENH323:-unset}" != "unset" ; then
310           OPENH323DIR="/usr/share/openh323"
311           OPENH323_INCDIR="/usr/include/openh323"
312           OPENH323_LIBDIR="/usr/lib"
313         fi
314       fi
315     fi
316   fi
319 if test "${HAS_OPENH323:-unset}" != "unset" ; then
320   if test "${OPENH323_INCDIR:-unset}" = "unset"; then
321     OPENH323_INCDIR="${OPENH323DIR}/include"
322   fi
323   if test "${OPENH323_LIBDIR:-unset}" = "unset"; then
324     OPENH323_LIBDIR="${OPENH323DIR}/lib"
325   fi
327   AC_SUBST([OPENH323DIR])
328   AC_SUBST([OPENH323_INCDIR])
329   AC_SUBST([OPENH323_LIBDIR])
334 AC_DEFUN(
335 [AST_CHECK_PWLIB_VERSION], [
336         if test "${HAS_$2:-unset}" != "unset"; then
337                 $2_VERSION=`grep "$2_VERSION" ${$2_INCDIR}/$3 | cut -f2 -d ' ' | sed -e 's/"//g'`
338                 $2_MAJOR_VERSION=`echo ${$2_VERSION} | cut -f1 -d.`
339                 $2_MINOR_VERSION=`echo ${$2_VERSION} | cut -f2 -d.`
340                 $2_BUILD_NUMBER=`echo ${$2_VERSION} | cut -f3 -d.`
341                 let $2_VER=${$2_MAJOR_VERSION}*10000+${$2_MINOR_VERSION}*100+${$2_BUILD_NUMBER}
342                 let $2_REQ=$4*10000+$5*100+$6
344                 AC_MSG_CHECKING(if $1 version ${$2_VERSION} is compatible with chan_h323)
345                 if test ${$2_VER} -lt ${$2_REQ}; then
346                         AC_MSG_RESULT(no)
347                         unset HAS_$2
348                 else
349                         AC_MSG_RESULT(yes)
350                 fi
351         fi
355 AC_DEFUN(
356 [AST_CHECK_PWLIB_BUILD], [
357         if test "${HAS_$2:-unset}" != "unset"; then
358            AC_MSG_CHECKING($1 installation validity)
360            saved_cppflags="${CPPFLAGS}"
361            saved_libs="${LIBS}"
362            LIBS="${LIBS} -L${$2_LIBDIR} -l${PLATFORM_$2} $7"
363            CPPFLAGS="${CPPFLAGS} -I${$2_INCDIR} $6"
365            AC_LANG_PUSH([C++])
367            AC_LINK_IFELSE(
368                 [AC_LANG_PROGRAM([$4],[$5])],
369                 [       AC_MSG_RESULT(yes) 
370                         ac_cv_lib_$2="yes" 
371                 ],
372                 [       AC_MSG_RESULT(no) 
373                         ac_cv_lib_$2="no" 
374                 ]
375                 )
377            AC_LANG_POP([C++])
379            LIBS="${saved_libs}"
380            CPPFLAGS="${saved_cppflags}"
382            if test "${ac_cv_lib_$2}" = "yes"; then
383               if test "${$2_LIBDIR}" != "" -a "${$2_LIBDIR}" != "/usr/lib"; then
384                  $2_LIB="-L${$2_LIBDIR} -l${PLATFORM_$2}"
385               else
386                  $2_LIB="-l${PLATFORM_$2}"
387               fi
388               if test "${$2_INCDIR}" != "" -a "${$2_INCDIR}" != "/usr/include"; then
389                  $2_INCLUDE="-I${$2_INCDIR}"
390               fi
391                   PBX_$2=1
392                   AC_DEFINE([HAVE_$2], 1, [$3])
393            fi
394         fi
397 AC_DEFUN(
398 [AST_CHECK_OPENH323_BUILD], [
399         if test "${HAS_OPENH323:-unset}" != "unset"; then
400                 AC_MSG_CHECKING(OpenH323 build option)
401                 OPENH323_SUFFIX=
402                 files=`ls -l ${OPENH323_LIBDIR}/libh323_${PWLIB_PLATFORM}_*.so*`
403                 libfile=
404                 if test -n "$files"; then
405                         for f in $files; do
406                                 if test -f $f -a ! -L $f; then
407                                         libfile=`basename $f`
408                                         break;
409                                 fi
410                         done
411                 fi
412                 if test "${libfile:-unset}" != "unset"; then
413                         OPENH323_SUFFIX=`eval "echo ${libfile} | sed -e 's/libh323_${PWLIB_PLATFORM}_\(@<:@^.@:>@*\)\..*/\1/'"`
414                 fi
415                 case "${OPENH323_SUFFIX}" in
416                         n)
417                                 OPENH323_BUILD="notrace";;
418                         r)
419                                 OPENH323_BUILD="opt";;
420                         d)
421                                 OPENH323_BUILD="debug";;
422                         *)
423                                 OPENH323_BUILD="notrace";;
424                 esac
425                 AC_MSG_RESULT(${OPENH323_BUILD})
427                 AC_SUBST([OPENH323_SUFFIX])
428                 AC_SUBST([OPENH323_BUILD])
429         fi
433 # AST_FUNC_FORK
434 # -------------
435 AN_FUNCTION([fork],  [AST_FUNC_FORK])
436 AN_FUNCTION([vfork], [AST_FUNC_FORK])
437 AC_DEFUN([AST_FUNC_FORK],
438 [AC_REQUIRE([AC_TYPE_PID_T])dnl
439 AC_CHECK_HEADERS(vfork.h)
440 AC_CHECK_FUNCS(fork vfork)
441 if test "x$ac_cv_func_fork" = xyes; then
442   _AST_FUNC_FORK
443 else
444   ac_cv_func_fork_works=$ac_cv_func_fork
446 if test "x$ac_cv_func_fork_works" = xcross; then
447   case $host in
448     *-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* )
449       # Override, as these systems have only a dummy fork() stub
450       ac_cv_func_fork_works=no
451       ;;
452     *)
453       ac_cv_func_fork_works=yes
454       ;;
455   esac
456   AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation])
458 ac_cv_func_vfork_works=$ac_cv_func_vfork
459 if test "x$ac_cv_func_vfork" = xyes; then
460   _AC_FUNC_VFORK
462 if test "x$ac_cv_func_fork_works" = xcross; then
463   ac_cv_func_vfork_works=$ac_cv_func_vfork
464   AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation])
467 if test "x$ac_cv_func_vfork_works" = xyes; then
468   AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.])
469 else
470   AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
472 if test "x$ac_cv_func_fork_works" = xyes; then
473   AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.])
475 ])# AST_FUNC_FORK
478 # _AST_FUNC_FORK
479 # -------------
480 AC_DEFUN([_AST_FUNC_FORK],
481   [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,
482     [AC_RUN_IFELSE(
483       [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
484         [
485           /* By Ruediger Kuhlmann. */
486           return fork () < 0;
487         ])],
488       [ac_cv_func_fork_works=yes],
489       [ac_cv_func_fork_works=no],
490       [ac_cv_func_fork_works=cross])])]
491 )# _AST_FUNC_FORK
493 # AST_PROG_LD
494 # ----------
495 # find the pathname to the GNU or non-GNU linker
496 AC_DEFUN([AST_PROG_LD],
497 [AC_ARG_WITH([gnu-ld],
498     [AC_HELP_STRING([--with-gnu-ld],
499         [assume the C compiler uses GNU ld @<:@default=no@:>@])],
500     [test "$withval" = no || with_gnu_ld=yes],
501     [with_gnu_ld=no])
502 AC_REQUIRE([AST_PROG_SED])dnl
503 AC_REQUIRE([AC_PROG_CC])dnl
504 AC_REQUIRE([AC_CANONICAL_HOST])dnl
505 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
506 ac_prog=ld
507 if test "$GCC" = yes; then
508   # Check if gcc -print-prog-name=ld gives a path.
509   AC_MSG_CHECKING([for ld used by $CC])
510   case $host in
511   *-*-mingw*)
512     # gcc leaves a trailing carriage return which upsets mingw
513     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
514   *)
515     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
516   esac
517   case $ac_prog in
518     # Accept absolute paths.
519     [[\\/]]* | ?:[[\\/]]*)
520       re_direlt='/[[^/]][[^/]]*/\.\./'
521       # Canonicalize the pathname of ld
522       ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
523       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
524         ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
525       done
526       test -z "$LD" && LD="$ac_prog"
527       ;;
528   "")
529     # If it fails, then pretend we aren't using GCC.
530     ac_prog=ld
531     ;;
532   *)
533     # If it is relative, then search for the first ld in PATH.
534     with_gnu_ld=unknown
535     ;;
536   esac
537 elif test "$with_gnu_ld" = yes; then
538   AC_MSG_CHECKING([for GNU ld])
539 else
540   AC_MSG_CHECKING([for non-GNU ld])
542 AC_CACHE_VAL(lt_cv_path_LD,
543 [if test -z "$LD"; then
544   lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
545   for ac_dir in $PATH; do
546     IFS="$lt_save_ifs"
547     test -z "$ac_dir" && ac_dir=.
548     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
549       lt_cv_path_LD="$ac_dir/$ac_prog"
550       # Check to see if the program is GNU ld.  I'd rather use --version,
551       # but apparently some variants of GNU ld only accept -v.
552       # Break only if it was the GNU/non-GNU ld that we prefer.
553       case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
554       *GNU* | *'with BFD'*)
555         test "$with_gnu_ld" != no && break
556         ;;
557       *)
558         test "$with_gnu_ld" != yes && break
559         ;;
560       esac
561     fi
562   done
563   IFS="$lt_save_ifs"
564 else
565   lt_cv_path_LD="$LD" # Let the user override the test with a path.
566 fi])
567 LD="$lt_cv_path_LD"
568 if test -n "$LD"; then
569   AC_MSG_RESULT($LD)
570 else
571   AC_MSG_RESULT(no)
573 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
574 AST_PROG_LD_GNU
575 ])# AST_PROG_LD
578 # AST_PROG_LD_GNU
579 # --------------
580 AC_DEFUN([AST_PROG_LD_GNU],
581 [AC_REQUIRE([AST_PROG_EGREP])dnl
582 AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
583 [# I'd rather use --version here, but apparently some GNU lds only accept -v.
584 case `$LD -v 2>&1 </dev/null` in
585 *GNU* | *'with BFD'*)
586   lt_cv_prog_gnu_ld=yes
587   ;;
589   lt_cv_prog_gnu_ld=no
590   ;;
591 esac])
592 with_gnu_ld=$lt_cv_prog_gnu_ld
593 ])# AST_PROG_LD_GNU
595 # AST_PROG_EGREP
596 # -------------
597 m4_ifndef([AST_PROG_EGREP], [AC_DEFUN([AST_PROG_EGREP],
598 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
599    [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
600     then ac_cv_prog_egrep='grep -E'
601     else ac_cv_prog_egrep='egrep'
602     fi])
603  EGREP=$ac_cv_prog_egrep
604  AC_SUBST([EGREP])
605 ])]) # AST_PROG_EGREP
607 # AST_PROG_SED
608 # -----------
609 # Check for a fully functional sed program that truncates
610 # as few characters as possible.  Prefer GNU sed if found.
611 AC_DEFUN([AST_PROG_SED],
612 [AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED,
613     [dnl ac_script should not contain more than 99 commands (for HP-UX sed),
614      dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed.
615      ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
616      for ac_i in 1 2 3 4 5 6 7; do
617        ac_script="$ac_script$as_nl$ac_script"
618      done
619      echo "$ac_script" | sed 99q >conftest.sed
620      $as_unset ac_script || ac_script=
621      _AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed],
622         [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED],
623                 ["$ac_path_SED" -f conftest.sed])])])
624  SED="$ac_cv_path_SED"
625  AC_SUBST([SED])dnl
626  rm -f conftest.sed
627 ])# AST_PROG_SED