Use classic.shoutcast.com.
[ncast.git] / acinclude.m4
blob5cf1fb51f2e71b5a345522e8771530d97ca1f712
1 # LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
2 #                       [ACTION-IF-YES], [ACTION-IF-NO])
3 # ----------------------------------------------------------
4 #      David Shaw <dshaw@jabberwocky.com>   Jun-21-2005
6 # Checks for libcurl.  DEFAULT-ACTION is the string yes or no to
7 # specify whether to default to --with-libcurl or --without-libcurl.
8 # If not supplied, DEFAULT-ACTION is yes.  MINIMUM-VERSION is the
9 # minimum version of libcurl to accept.  Pass the version as a regular
10 # version number like 7.10.1. If not supplied, any version is
11 # accepted.  ACTION-IF-YES is a list of shell commands to run if
12 # libcurl was successfully found and passed the various tests.
13 # ACTION-IF-NO is a list of shell commands that are run otherwise.
14 # Note that using --without-libcurl does run ACTION-IF-NO.
16 # This macro defines HAVE_LIBCURL if a working libcurl setup is found,
17 # and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary values.
18 # Other useful defines are LIBCURL_FEATURE_xxx where xxx are the
19 # various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
20 # where yyy are the various protocols supported by libcurl.  Both xxx
21 # and yyy are capitalized.  See the list of AH_TEMPLATEs at the top of
22 # the macro for the complete list of possible defines.  Shell
23 # variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
24 # defined to 'yes' for those features and protocols that were found.
25 # Note that xxx and yyy keep the same capitalization as in the
26 # curl-config list (e.g. it's "HTTP" and not "http").
28 # Users may override the detected values by doing something like:
29 # LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure
31 # For the sake of sanity, this macro assumes that any libcurl that is
32 # found is after version 7.7.2, the first version that included the
33 # curl-config script.  Note that it is very important for people
34 # packaging binary versions of libcurl to include this script!
35 # Without curl-config, we can only guess what protocols are available.
37 AC_DEFUN([LIBCURL_CHECK_CONFIG],
39   AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL])
40   AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4])
41   AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
42   AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
43   AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
45   AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
46   AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
47   AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
48   AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
49   AH_TEMPLATE([LIBCURL_PROTOCOL_GOPHER],[Defined if libcurl supports GOPHER])
50   AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
51   AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
52   AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
53   AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
55   AC_ARG_WITH(libcurl,
56      AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]),
57      [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
59   if test "$_libcurl_with" != "no" ; then
61      AC_PROG_AWK
63      _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
65      _libcurl_try_link=yes
67      if test -d "$_libcurl_with" ; then
68         CPPFLAGS="${CPPFLAGS} -I$withval/include"
69         LDFLAGS="${LDFLAGS} -L$withval/lib"
70      fi
72      AC_PATH_PROG([_libcurl_config],[curl-config])
74      if test x$_libcurl_config != "x" ; then
75         AC_CACHE_CHECK([for the version of libcurl],
76            [libcurl_cv_lib_curl_version],
77            [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`])
79         _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
80         _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse`
82         if test $_libcurl_wanted -gt 0 ; then
83            AC_CACHE_CHECK([for libcurl >= version $2],
84               [libcurl_cv_lib_version_ok],
85               [
86               if test $_libcurl_version -ge $_libcurl_wanted ; then
87                  libcurl_cv_lib_version_ok=yes
88               else
89                  libcurl_cv_lib_version_ok=no
90               fi
91               ])
92         fi
94         if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
95            if test x"$LIBCURL_CPPFLAGS" = "x" ; then
96               LIBCURL_CPPFLAGS=`$_libcurl_config --cflags`
97            fi
98            if test x"$LIBCURL" = "x" ; then
99               LIBCURL=`$_libcurl_config --libs`
101               # This is so silly, but Apple actually has a bug in their
102               # curl-config script.  Fixed in Tiger, but there are still
103               # lots of Panther installs around.
104               case "${host}" in
105                  powerpc-apple-darwin7*)
106                     LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'`
107                  ;;
108               esac
109            fi
111            # All curl-config scripts support --feature
112            _libcurl_features=`$_libcurl_config --feature`
114            # Is it modern enough to have --protocols? (7.12.4)
115            if test $_libcurl_version -ge 461828 ; then
116               _libcurl_protocols=`$_libcurl_config --protocols`
117            fi
118         else
119            _libcurl_try_link=no
120         fi
122         unset _libcurl_wanted
123      fi
125      if test $_libcurl_try_link = yes ; then
127         # we didn't find curl-config, so let's see if the user-supplied
128         # link line (or failing that, "-lcurl") is enough.
129         LIBCURL=${LIBCURL-"-lcurl"}
131         AC_CACHE_CHECK([whether libcurl is usable],
132            [libcurl_cv_lib_curl_usable],
133            [
134            _libcurl_save_cppflags=$CPPFLAGS
135            CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
136            _libcurl_save_libs=$LIBS
137            LIBS="$LIBS $LIBCURL"
139            AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[
140 /* Try and use a few common options to force a failure if we are
141    missing symbols or can't link. */
142 int x;
143 curl_easy_setopt(NULL,CURLOPT_URL,NULL);
144 x=CURL_ERROR_SIZE;
145 x=CURLOPT_WRITEFUNCTION;
146 x=CURLOPT_FILE;
147 x=CURLOPT_ERRORBUFFER;
148 x=CURLOPT_STDERR;
149 x=CURLOPT_VERBOSE;
150 ]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
152            CPPFLAGS=$_libcurl_save_cppflags
153            LIBS=$_libcurl_save_libs
154            unset _libcurl_save_cppflags
155            unset _libcurl_save_libs
156            ])
158         if test $libcurl_cv_lib_curl_usable = yes ; then
160            # Does curl_free() exist in this version of libcurl?
161            # If not, fake it with free()
163            _libcurl_save_cppflags=$CPPFLAGS
164            CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
165            _libcurl_save_libs=$LIBS
166            LIBS="$LIBS $LIBCURL"
168            AC_CHECK_FUNC(curl_free,,
169               AC_DEFINE(curl_free,free,
170                 [Define curl_free() as free() if our version of curl lacks curl_free.]))
172            CPPFLAGS=$_libcurl_save_cppflags
173            LIBS=$_libcurl_save_libs
174            unset _libcurl_save_cppflags
175            unset _libcurl_save_libs
177            AC_DEFINE(HAVE_LIBCURL,1,
178              [Define to 1 if you have a functional curl library.])
179            AC_SUBST(LIBCURL_CPPFLAGS)
180            AC_SUBST(LIBCURL)
182            for _libcurl_feature in $_libcurl_features ; do
183               AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
184               eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
185            done
187            if test "x$_libcurl_protocols" = "x" ; then
189               # We don't have --protocols, so just assume that all
190               # protocols are available
191               _libcurl_protocols="HTTP FTP GOPHER FILE TELNET LDAP DICT"
193               if test x$libcurl_feature_SSL = xyes ; then
194                  _libcurl_protocols="$_libcurl_protocols HTTPS"
196                  # FTPS wasn't standards-compliant until version
197                  # 7.11.0
198                  if test $_libcurl_version -ge 461568; then
199                     _libcurl_protocols="$_libcurl_protocols FTPS"
200                  fi
201               fi
202            fi
204            for _libcurl_protocol in $_libcurl_protocols ; do
205               AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
206               eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
207            done
208         fi
209      fi
211      unset _libcurl_try_link
212      unset _libcurl_version_parse
213      unset _libcurl_config
214      unset _libcurl_feature
215      unset _libcurl_features
216      unset _libcurl_protocol
217      unset _libcurl_protocols
218      unset _libcurl_version
219   fi
221   if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
222      # This is the IF-NO path
223      ifelse([$4],,:,[$4])
224   else
225      # This is the IF-YES path
226      ifelse([$3],,:,[$3])
227   fi
229   unset _libcurl_with
230 ])dnl
232 dnl ##
233 dnl ##  GNU Pth - The GNU Portable Threads
234 dnl ##  Copyright (c) 1999-2005 Ralf S. Engelschall <rse@engelschall.com>
235 dnl ##
236 dnl ##  This file is part of GNU Pth, a non-preemptive thread scheduling
237 dnl ##  library which can be found at http://www.gnu.org/software/pth/.
238 dnl ##
239 dnl ##  This library is free software; you can redistribute it and/or
240 dnl ##  modify it under the terms of the GNU Lesser General Public
241 dnl ##  License as published by the Free Software Foundation; either
242 dnl ##  version 2.1 of the License, or (at your option) any later version.
243 dnl ##
244 dnl ##  This library is distributed in the hope that it will be useful,
245 dnl ##  but WITHOUT ANY WARRANTY; without even the implied warranty of
246 dnl ##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
247 dnl ##  Lesser General Public License for more details.
248 dnl ##
249 dnl ##  You should have received a copy of the GNU Lesser General Public
250 dnl ##  License along with this library; if not, write to the Free Software
251 dnl ##  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
252 dnl ##  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
253 dnl ##
254 dnl ##  pth.m4: Autoconf macro for locating GNU Pth from within
255 dnl ##          configure.ac of third-party software packages
256 dnl ##
258 dnl ##
259 dnl ##  Synopsis:
260 dnl ##  AC_CHECK_PTH([MIN-VERSION [,          # minimum Pth version, e.g. 1.2.0
261 dnl ##                DEFAULT-WITH-PTH [,     # default value for --with-pth option
262 dnl ##                DEFAULT-WITH-PTH-TEST [,# default value for --with-pth-test option
263 dnl ##                EXTEND-VARS [,          # whether CFLAGS/LDFLAGS/etc are extended
264 dnl ##                ACTION-IF-FOUND [,      # action to perform if Pth was found
265 dnl ##                ACTION-IF-NOT-FOUND     # action to perform if Pth was not found
266 dnl ##                ]]]]]])
267 dnl ##  Examples:
268 dnl ##  AC_CHECK_PTH(1.2.0)
269 dnl ##  AC_CHECK_PTH(1.2.0,,,no,CFLAGS="$CFLAGS -DHAVE_PTH $PTH_CFLAGS")
270 dnl ##  AC_CHECK_PTH(1.2.0,yes,yes,yes,CFLAGS="$CFLAGS -DHAVE_PTH")
271 dnl ##
273 dnl #   auxilliary macros
274 AC_DEFUN([_AC_PTH_ERROR], [dnl
275 AC_MSG_RESULT([*FAILED*])
276 m4_define(_ac_pth_line,dnl
277 "+------------------------------------------------------------------------+")
278 echo " _ac_pth_line" 1>&2
279 cat <<EOT | sed -e 's/^[[       ]]*/ | /' -e 's/>>/  /' 1>&2
282 echo " _ac_pth_line" 1>&2
283 exit 1
285 AC_DEFUN([_AC_PTH_VERBOSE], [dnl
286 if test ".$verbose" = .yes; then
287     AC_MSG_RESULT([  $1])
290 dnl #   the user macro
291 AC_DEFUN([AC_CHECK_PTH], [dnl
293 dnl #   prerequisites
294 AC_REQUIRE([AC_PROG_CC])dnl
295 AC_REQUIRE([AC_PROG_CPP])dnl
297 PTH_CPPFLAGS=''
298 PTH_CFLAGS=''
299 PTH_LDFLAGS=''
300 PTH_LIBS=''
301 AC_SUBST(PTH_CPPFLAGS)
302 AC_SUBST(PTH_CFLAGS)
303 AC_SUBST(PTH_LDFLAGS)
304 AC_SUBST(PTH_LIBS)
305 dnl #   command line options
306 AC_MSG_CHECKING(for GNU Pth)
307 _AC_PTH_VERBOSE([])
308 AC_ARG_WITH(pth,dnl
309 [  --with-pth[=ARG]        Build with GNU Pth Library  (default=]ifelse([$2],,yes,$2)[)],dnl
310 ,dnl
311 with_pth="ifelse([$2],,yes,$2)"
312 )dnl
313 AC_ARG_WITH(pth-test,dnl
314 [  --with-pth-test         Perform GNU Pth Sanity Test (default=]ifelse([$3],,yes,$3)[)],dnl
315 ,dnl
316 with_pth_test="ifelse([$3],,yes,$3)"
317 )dnl
318 _AC_PTH_VERBOSE([+ Command Line Options:])
319 _AC_PTH_VERBOSE([    o --with-pth=$with_pth])
320 _AC_PTH_VERBOSE([    o --with-pth-test=$with_pth_test])
322 dnl #   configuration
323 if test ".$with_pth" != .no; then
324     _pth_subdir=no
325     _pth_subdir_opts=''
326     case "$with_pth" in
327         subdir:* )
328             _pth_subdir=yes
329             changequote(, )dnl
330             _pth_subdir_opts=`echo $with_pth | sed -e 's/^subdir:[^     ]*[     ]*//'`
331             with_pth=`echo $with_pth | sed -e 's/^subdir:\([^   ]*\).*$/\1/'`
332             changequote([, ])dnl
333             ;;
334     esac
335     _pth_version=""
336     _pth_location=""
337     _pth_type=""
338     _pth_cppflags=""
339     _pth_cflags=""
340     _pth_ldflags=""
341     _pth_libs=""
342     if test ".$with_pth" = .yes; then
343         #   via config script in $PATH
344         changequote(, )dnl
345         _pth_version=`(pth-config --version) 2>/dev/null |\
346                       sed -e 's/^.*\([0-9]\.[0-9]*[ab.][0-9]*\).*$/\1/'`
347         changequote([, ])dnl
348         if test ".$_pth_version" != .; then
349             _pth_location=`pth-config --prefix`
350             _pth_type='installed'
351             _pth_cppflags=`pth-config --cflags`
352             _pth_cflags=`pth-config --cflags`
353             _pth_ldflags=`pth-config --ldflags`
354             _pth_libs=`pth-config --libs`
355         fi
356     elif test -d "$with_pth"; then
357         with_pth=`echo $with_pth | sed -e 's;/*$;;'`
358         _pth_found=no
359         #   via locally included source tree
360         if test ".$_pth_subdir" = .yes; then
361             _pth_location="$with_pth"
362             _pth_type='local'
363             _pth_cppflags="-I$with_pth"
364             _pth_cflags="-I$with_pth"
365             if test -f "$with_pth/ltconfig"; then
366                 _pth_ldflags="-L$with_pth/.libs"
367             else
368                 _pth_ldflags="-L$with_pth"
369             fi
370             _pth_libs="-lpth"
371             changequote(, )dnl
372             _pth_version=`grep '^const char PTH_Hello' $with_pth/pth_vers.c |\
373                           sed -e 's;^.*Version[         ]*\([0-9]*\.[0-9]*[.ab][0-9]*\)[        ].*$;\1;'`
374             changequote([, ])dnl
375             _pth_found=yes
376             ac_configure_args="$ac_configure_args --enable-subdir $_pth_subdir_opts"
377             with_pth_test=no
378         fi
379         #   via config script under a specified directory
380         #   (a standard installation, but not a source tree)
381         if test ".$_pth_found" = .no; then
382             for _dir in $with_pth/bin $with_pth; do
383                 if test -f "$_dir/pth-config"; then
384                     test -f "$_dir/pth-config.in" && continue # pth-config in source tree!
385                     changequote(, )dnl
386                     _pth_version=`($_dir/pth-config --version) 2>/dev/null |\
387                                   sed -e 's/^.*\([0-9]\.[0-9]*[ab.][0-9]*\).*$/\1/'`
388                     changequote([, ])dnl
389                     if test ".$_pth_version" != .; then
390                         _pth_location=`$_dir/pth-config --prefix`
391                         _pth_type="installed"
392                         _pth_cppflags=`$_dir/pth-config --cflags`
393                         _pth_cflags=`$_dir/pth-config --cflags`
394                         _pth_ldflags=`$_dir/pth-config --ldflags`
395                         _pth_libs=`$_dir/pth-config --libs`
396                         _pth_found=yes
397                         break
398                     fi
399                 fi
400             done
401         fi
402         #   in any subarea under a specified directory
403         #   (either a special installation or a Pth source tree)
404         if test ".$_pth_found" = .no; then
405             changequote(, )dnl
406             _pth_found=0
407             for _file in x `find $with_pth -name "pth.h" -type f -print`; do
408                 test .$_file = .x && continue
409                 _dir=`echo $_file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
410                 _pth_version=`($_dir/pth-config --version) 2>/dev/null |\
411                               sed -e 's/^.*\([0-9]\.[0-9]*[ab.][0-9]*\).*$/\1/'`
412                 if test ".$_pth_version" = .; then
413                     _pth_version=`grep '^#define PTH_VERSION_STR' $_file |\
414                                   sed -e 's;^#define[   ]*PTH_VERSION_STR[      ]*"\([0-9]*\.[0-9]*[.ab][0-9]*\)[       ].*$;\1;'`
415                 fi
416                 _pth_cppflags="-I$_dir"
417                 _pth_cflags="-I$_dir"
418                 _pth_found=`expr $_pth_found + 1`
419             done
420             for _file in x `find $with_pth -name "libpth.[aso]" -type f -print`; do
421                 test .$_file = .x && continue
422                 _dir=`echo $_file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
423                 _pth_ldflags="-L$_dir"
424                 _pth_libs="-lpth"
425                 _pth_found=`expr $_pth_found + 1`
426             done
427             changequote([, ])dnl
428             if test ".$_pth_found" = .2; then
429                 _pth_location="$with_pth"
430                 _pth_type="uninstalled"
431             else
432                 _pth_version=''
433             fi
434         fi
435     fi
436     _AC_PTH_VERBOSE([+ Determined Location:])
437     _AC_PTH_VERBOSE([    o path: $_pth_location])
438     _AC_PTH_VERBOSE([    o type: $_pth_type])
439     if test ".$_pth_version" = .; then
440         if test ".$with_pth" != .yes; then
441              _AC_PTH_ERROR([dnl
442              Unable to locate GNU Pth under $with_pth.
443              Please specify the correct path to either a GNU Pth installation tree
444              (use --with-pth=DIR if you used --prefix=DIR for installing GNU Pth in
445              the past) or to a GNU Pth source tree (use --with-pth=DIR if DIR is a
446              path to a pth-X.Y.Z/ directory; but make sure the package is already
447              built, i.e., the "configure; make" step was already performed there).])
448         else
449              _AC_PTH_ERROR([dnl
450              Unable to locate GNU Pth in any system-wide location (see \$PATH).
451              Please specify the correct path to either a GNU Pth installation tree
452              (use --with-pth=DIR if you used --prefix=DIR for installing GNU Pth in
453              the past) or to a GNU Pth source tree (use --with-pth=DIR if DIR is a
454              path to a pth-X.Y.Z/ directory; but make sure the package is already
455              built, i.e., the "configure; make" step was already performed there).])
456         fi
457     fi
458     dnl #
459     dnl #  Check whether the found version is sufficiently new
460     dnl #
461     _req_version="ifelse([$1],,1.0.0,$1)"
462     for _var in _pth_version _req_version; do
463         eval "_val=\"\$${_var}\""
464         _major=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\1/'`
465         _minor=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\2/'`
466         _rtype=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\3/'`
467         _micro=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\4/'`
468         case $_rtype in
469             "a" ) _rtype=0 ;;
470             "b" ) _rtype=1 ;;
471             "." ) _rtype=2 ;;
472         esac
473         _hex=`echo dummy | awk '{ printf("%d%02d%1d%02d", major, minor, rtype, micro); }' \
474               "major=$_major" "minor=$_minor" "rtype=$_rtype" "micro=$_micro"`
475         eval "${_var}_hex=\"\$_hex\""
476     done
477     _AC_PTH_VERBOSE([+ Determined Versions:])
478     _AC_PTH_VERBOSE([    o existing: $_pth_version -> 0x$_pth_version_hex])
479     _AC_PTH_VERBOSE([    o required: $_req_version -> 0x$_req_version_hex])
480     _ok=0
481     if test ".$_pth_version_hex" != .; then
482         if test ".$_req_version_hex" != .; then
483             if test $_pth_version_hex -ge $_req_version_hex; then
484                 _ok=1
485             fi
486         fi
487     fi
488     if test ".$_ok" = .0; then
489         _AC_PTH_ERROR([dnl
490         Found Pth version $_pth_version, but required at least version $_req_version.
491         Upgrade Pth under $_pth_location to $_req_version or higher first, please.])
492     fi
493     dnl #
494     dnl #   Perform Pth Sanity Compile Check
495     dnl #
496     if test ".$with_pth_test" = .yes; then
497         _ac_save_CPPFLAGS="$CPPFLAGS"
498         _ac_save_CFLAGS="$CFLAGS"
499         _ac_save_LDFLAGS="$LDFLAGS"
500         _ac_save_LIBS="$LIBS"
501         CPPFLAGS="$CPPFLAGS $_pth_cppflags"
502         CFLAGS="$CFLAGS $_pth_cflags"
503         LDFLAGS="$LDFLAGS $_pth_ldflags"
504         LIBS="$LIBS $_pth_libs"
505         _AC_PTH_VERBOSE([+ Test Build Environment:])
506         _AC_PTH_VERBOSE([    o CPPFLAGS=\"$CPPFLAGS\"])
507         _AC_PTH_VERBOSE([    o CFLAGS=\"$CFLAGS\"])
508         _AC_PTH_VERBOSE([    o LDFLAGS=\"$LDFLAGS\"])
509         _AC_PTH_VERBOSE([    o LIBS=\"$LIBS\"])
510         cross_compile=no
511         m4_define(_code1, [dnl
512         #include <stdio.h>
513         #include <pth.h>
514         ])
515         m4_define(_code2, [dnl
516         int main(int argc, char *argv[])
517         {
518             FILE *fp;
519             if (!(fp = fopen("conftestval", "w")))
520                 exit(1);
521             fprintf(fp, "hmm");
522             fclose(fp);
523             pth_init();
524             pth_kill();
525             if (!(fp = fopen("conftestval", "w")))
526                 exit(1);
527             fprintf(fp, "yes");
528             fclose(fp);
529             exit(0);
530         }
531         ])
532         _AC_PTH_VERBOSE([+ Performing Sanity Checks:])
533         _AC_PTH_VERBOSE([    o pre-processor test])
534         AC_TRY_CPP(_code1, _ok=yes, _ok=no)
535         if test ".$_ok" != .yes; then
536             _AC_PTH_ERROR([dnl
537             Found GNU Pth $_pth_version under $_pth_location, but
538             was unable to perform a sanity pre-processor check. This means
539             the GNU Pth header pth.h was not found.
540             We used the following build environment:
541             >> CPP="$CPP"
542             >> CPPFLAGS="$CPPFLAGS"
543             See config.log for possibly more details.])
544         fi
545         _AC_PTH_VERBOSE([    o link check])
546         AC_TRY_LINK(_code1, _code2, _ok=yes, _ok=no)
547         if test ".$_ok" != .yes; then
548             _AC_PTH_ERROR([dnl
549             Found GNU Pth $_pth_version under $_pth_location, but
550             was unable to perform a sanity linker check. This means
551             the GNU Pth library libpth.a was not found.
552             We used the following build environment:
553             >> CC="$CC"
554             >> CFLAGS="$CFLAGS"
555             >> LDFLAGS="$LDFLAGS"
556             >> LIBS="$LIBS"
557             See config.log for possibly more details.])
558         fi
559         _AC_PTH_VERBOSE([    o run-time check])
560         AC_TRY_RUN(_code1 _code2, _ok=`cat conftestval`, _ok=no, _ok=no)
561         if test ".$_ok" != .yes; then
562             if test ".$_ok" = .no; then
563                 _AC_PTH_ERROR([dnl
564                 Found GNU Pth $_pth_version under $_pth_location, but
565                 was unable to perform a sanity execution check. This usually
566                 means that the GNU Pth shared library libpth.so is present
567                 but \$LD_LIBRARY_PATH is incomplete to execute a Pth test.
568                 In this case either disable this test via --without-pth-test,
569                 or extend \$LD_LIBRARY_PATH, or build GNU Pth as a static
570                 library only via its --disable-shared Autoconf option.
571                 We used the following build environment:
572                 >> CC="$CC"
573                 >> CFLAGS="$CFLAGS"
574                 >> LDFLAGS="$LDFLAGS"
575                 >> LIBS="$LIBS"
576                 See config.log for possibly more details.])
577             else
578                 _AC_PTH_ERROR([dnl
579                 Found GNU Pth $_pth_version under $_pth_location, but
580                 was unable to perform a sanity run-time check. This usually
581                 means that the GNU Pth library failed to work and possibly
582                 caused a core dump in the test program. In this case it
583                 is strongly recommended that you re-install GNU Pth and this
584                 time make sure that it really passes its "make test" procedure.
585                 We used the following build environment:
586                 >> CC="$CC"
587                 >> CFLAGS="$CFLAGS"
588                 >> LDFLAGS="$LDFLAGS"
589                 >> LIBS="$LIBS"
590                 See config.log for possibly more details.])
591             fi
592         fi
593         _extendvars="ifelse([$4],,yes,$4)"
594         if test ".$_extendvars" != .yes; then
595             CPPFLAGS="$_ac_save_CPPFLAGS"
596             CFLAGS="$_ac_save_CFLAGS"
597             LDFLAGS="$_ac_save_LDFLAGS"
598             LIBS="$_ac_save_LIBS"
599         fi
600     else
601         _extendvars="ifelse([$4],,yes,$4)"
602         if test ".$_extendvars" = .yes; then
603             if test ".$_pth_subdir" = .yes; then
604                 CPPFLAGS="$CPPFLAGS $_pth_cppflags"
605                 CFLAGS="$CFLAGS $_pth_cflags"
606                 LDFLAGS="$LDFLAGS $_pth_ldflags"
607                 LIBS="$LIBS $_pth_libs"
608             fi
609         fi
610     fi
611     PTH_CPPFLAGS="$_pth_cppflags"
612     PTH_CFLAGS="$_pth_cflags"
613     PTH_LDFLAGS="$_pth_ldflags"
614     PTH_LIBS="$_pth_libs"
615     AC_SUBST(PTH_CPPFLAGS)
616     AC_SUBST(PTH_CFLAGS)
617     AC_SUBST(PTH_LDFLAGS)
618     AC_SUBST(PTH_LIBS)
619     _AC_PTH_VERBOSE([+ Final Results:])
620     _AC_PTH_VERBOSE([    o PTH_CPPFLAGS=\"$PTH_CPPFLAGS\"])
621     _AC_PTH_VERBOSE([    o PTH_CFLAGS=\"$PTH_CFLAGS\"])
622     _AC_PTH_VERBOSE([    o PTH_LDFLAGS=\"$PTH_LDFLAGS\"])
623     _AC_PTH_VERBOSE([    o PTH_LIBS=\"$PTH_LIBS\"])
625 if test ".$with_pth" != .no; then
626     AC_MSG_RESULT([version $_pth_version, $_pth_type under $_pth_location])
627     ifelse([$5], , :, [$5])
628 else
629     AC_MSG_RESULT([no])
630     ifelse([$6], , :, [$6])