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