patch #8323
[mldonkey.git] / config / aclocal.m4
blob2dd5a6998c18464fce6c2ba1cac8cc9dc0dac79e
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p6
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 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 # lib-prefix.m4 serial 4 (gettext-0.14.2)
14 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
15 dnl This file is free software; the Free Software Foundation
16 dnl gives unlimited permission to copy and/or distribute it,
17 dnl with or without modifications, as long as this notice is preserved.
19 dnl From Bruno Haible.
21 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
22 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
23 dnl require excessive bracketing.
24 ifdef([AC_HELP_STRING],
25 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
26 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
28 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
29 dnl to access previously installed libraries. The basic assumption is that
30 dnl a user will want packages to use other packages he previously installed
31 dnl with the same --prefix option.
32 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
33 dnl libraries, but is otherwise very convenient.
34 AC_DEFUN([AC_LIB_PREFIX],
36   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
37   AC_REQUIRE([AC_PROG_CC])
38   AC_REQUIRE([AC_CANONICAL_HOST])
39   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
40   dnl By default, look in $includedir and $libdir.
41   use_additional=yes
42   AC_LIB_WITH_FINAL_PREFIX([
43     eval additional_includedir=\"$includedir\"
44     eval additional_libdir=\"$libdir\"
45   ])
46   AC_LIB_ARG_WITH([lib-prefix],
47 [  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
48   --without-lib-prefix    don't search for libraries in includedir and libdir],
50     if test "X$withval" = "Xno"; then
51       use_additional=no
52     else
53       if test "X$withval" = "X"; then
54         AC_LIB_WITH_FINAL_PREFIX([
55           eval additional_includedir=\"$includedir\"
56           eval additional_libdir=\"$libdir\"
57         ])
58       else
59         additional_includedir="$withval/include"
60         additional_libdir="$withval/lib"
61       fi
62     fi
64   if test $use_additional = yes; then
65     dnl Potentially add $additional_includedir to $CPPFLAGS.
66     dnl But don't add it
67     dnl   1. if it's the standard /usr/include,
68     dnl   2. if it's already present in $CPPFLAGS,
69     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
70     dnl   4. if it doesn't exist as a directory.
71     if test "X$additional_includedir" != "X/usr/include"; then
72       haveit=
73       for x in $CPPFLAGS; do
74         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
75         if test "X$x" = "X-I$additional_includedir"; then
76           haveit=yes
77           break
78         fi
79       done
80       if test -z "$haveit"; then
81         if test "X$additional_includedir" = "X/usr/local/include"; then
82           if test -n "$GCC"; then
83             case $host_os in
84               linux* | gnu* | k*bsd*-gnu) haveit=yes;;
85             esac
86           fi
87         fi
88         if test -z "$haveit"; then
89           if test -d "$additional_includedir"; then
90             dnl Really add $additional_includedir to $CPPFLAGS.
91             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
92           fi
93         fi
94       fi
95     fi
96     dnl Potentially add $additional_libdir to $LDFLAGS.
97     dnl But don't add it
98     dnl   1. if it's the standard /usr/lib,
99     dnl   2. if it's already present in $LDFLAGS,
100     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
101     dnl   4. if it doesn't exist as a directory.
102     if test "X$additional_libdir" != "X/usr/lib"; then
103       haveit=
104       for x in $LDFLAGS; do
105         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
106         if test "X$x" = "X-L$additional_libdir"; then
107           haveit=yes
108           break
109         fi
110       done
111       if test -z "$haveit"; then
112         if test "X$additional_libdir" = "X/usr/local/lib"; then
113           if test -n "$GCC"; then
114             case $host_os in
115               linux*) haveit=yes;;
116             esac
117           fi
118         fi
119         if test -z "$haveit"; then
120           if test -d "$additional_libdir"; then
121             dnl Really add $additional_libdir to $LDFLAGS.
122             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
123           fi
124         fi
125       fi
126     fi
127   fi
130 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
131 dnl acl_final_exec_prefix, containing the values to which $prefix and
132 dnl $exec_prefix will expand at the end of the configure script.
133 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
135   dnl Unfortunately, prefix and exec_prefix get only finally determined
136   dnl at the end of configure.
137   if test "X$prefix" = "XNONE"; then
138     acl_final_prefix="$ac_default_prefix"
139   else
140     acl_final_prefix="$prefix"
141   fi
142   if test "X$exec_prefix" = "XNONE"; then
143     acl_final_exec_prefix='${prefix}'
144   else
145     acl_final_exec_prefix="$exec_prefix"
146   fi
147   acl_save_prefix="$prefix"
148   prefix="$acl_final_prefix"
149   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
150   prefix="$acl_save_prefix"
153 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
154 dnl variables prefix and exec_prefix bound to the values they will have
155 dnl at the end of the configure script.
156 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
158   acl_save_prefix="$prefix"
159   prefix="$acl_final_prefix"
160   acl_save_exec_prefix="$exec_prefix"
161   exec_prefix="$acl_final_exec_prefix"
162   $1
163   exec_prefix="$acl_save_exec_prefix"
164   prefix="$acl_save_prefix"
167 # lib-link.m4 serial 6 (gettext-0.14.3)
168 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
169 dnl This file is free software; the Free Software Foundation
170 dnl gives unlimited permission to copy and/or distribute it,
171 dnl with or without modifications, as long as this notice is preserved.
173 dnl From Bruno Haible.
175 AC_PREREQ(2.50)
177 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
178 dnl the libraries corresponding to explicit and implicit dependencies.
179 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
180 dnl augments the CPPFLAGS variable.
181 AC_DEFUN([AC_LIB_LINKFLAGS],
183   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
184   AC_REQUIRE([AC_LIB_RPATH])
185   define([Name],[translit([$1],[./-], [___])])
186   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
187                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
188   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
189     AC_LIB_LINKFLAGS_BODY([$1], [$2])
190     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
191     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
192     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
193   ])
194   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
195   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
196   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
197   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
198   AC_SUBST([LIB]NAME)
199   AC_SUBST([LTLIB]NAME)
200   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
201   dnl results of this search when this library appears as a dependency.
202   HAVE_LIB[]NAME=yes
203   undefine([Name])
204   undefine([NAME])
207 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
208 dnl searches for libname and the libraries corresponding to explicit and
209 dnl implicit dependencies, together with the specified include files and
210 dnl the ability to compile and link the specified testcode. If found, it
211 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
212 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
213 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
214 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
215 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
217   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
218   AC_REQUIRE([AC_LIB_RPATH])
219   define([Name],[translit([$1],[./-], [___])])
220   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
221                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
223   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
224   dnl accordingly.
225   AC_LIB_LINKFLAGS_BODY([$1], [$2])
227   dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
228   dnl because if the user has installed lib[]Name and not disabled its use
229   dnl via --without-lib[]Name-prefix, he wants to use it.
230   ac_save_CPPFLAGS="$CPPFLAGS"
231   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
233   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
234     ac_save_LIBS="$LIBS"
235     LIBS="$LIBS $LIB[]NAME"
236     AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
237     LIBS="$ac_save_LIBS"
238   ])
239   if test "$ac_cv_lib[]Name" = yes; then
240     HAVE_LIB[]NAME=yes
241     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
242     AC_MSG_CHECKING([how to link with lib[]$1])
243     AC_MSG_RESULT([$LIB[]NAME])
244   else
245     HAVE_LIB[]NAME=no
246     dnl If $LIB[]NAME didn't lead to a usable library, we don't need
247     dnl $INC[]NAME either.
248     CPPFLAGS="$ac_save_CPPFLAGS"
249     LIB[]NAME=
250     LTLIB[]NAME=
251   fi
252   AC_SUBST([HAVE_LIB]NAME)
253   AC_SUBST([LIB]NAME)
254   AC_SUBST([LTLIB]NAME)
255   undefine([Name])
256   undefine([NAME])
259 dnl Determine the platform dependent parameters needed to use rpath:
260 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
261 dnl hardcode_direct, hardcode_minus_L.
262 AC_DEFUN([AC_LIB_RPATH],
264   dnl Tell automake >= 1.10 to complain if config.rpath is missing.
265   m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
266   AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
267   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
268   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
269   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
270   AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
271     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
272     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
273     . ./conftest.sh
274     rm -f ./conftest.sh
275     acl_cv_rpath=done
276   ])
277   wl="$acl_cv_wl"
278   libext="$acl_cv_libext"
279   shlibext="$acl_cv_shlibext"
280   hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
281   hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
282   hardcode_direct="$acl_cv_hardcode_direct"
283   hardcode_minus_L="$acl_cv_hardcode_minus_L"
284   dnl Determine whether the user wants rpath handling at all.
285   AC_ARG_ENABLE(rpath,
286     [  --disable-rpath         do not hardcode runtime library paths],
287     :, enable_rpath=yes)
290 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
291 dnl the libraries corresponding to explicit and implicit dependencies.
292 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
293 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
295   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
296                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
297   dnl By default, look in $includedir and $libdir.
298   use_additional=yes
299   AC_LIB_WITH_FINAL_PREFIX([
300     eval additional_includedir=\"$includedir\"
301     eval additional_libdir=\"$libdir\"
302   ])
303   AC_LIB_ARG_WITH([lib$1-prefix],
304 [  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
305   --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
307     if test "X$withval" = "Xno"; then
308       use_additional=no
309     else
310       if test "X$withval" = "X"; then
311         AC_LIB_WITH_FINAL_PREFIX([
312           eval additional_includedir=\"$includedir\"
313           eval additional_libdir=\"$libdir\"
314         ])
315       else
316         additional_includedir="$withval/include"
317         additional_libdir="$withval/lib"
318       fi
319     fi
321   dnl Search the library and its dependencies in $additional_libdir and
322   dnl $LDFLAGS. Using breadth-first-seach.
323   LIB[]NAME=
324   LTLIB[]NAME=
325   INC[]NAME=
326   rpathdirs=
327   ltrpathdirs=
328   names_already_handled=
329   names_next_round='$1 $2'
330   while test -n "$names_next_round"; do
331     names_this_round="$names_next_round"
332     names_next_round=
333     for name in $names_this_round; do
334       already_handled=
335       for n in $names_already_handled; do
336         if test "$n" = "$name"; then
337           already_handled=yes
338           break
339         fi
340       done
341       if test -z "$already_handled"; then
342         names_already_handled="$names_already_handled $name"
343         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
344         dnl or AC_LIB_HAVE_LINKFLAGS call.
345         uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
346         eval value=\"\$HAVE_LIB$uppername\"
347         if test -n "$value"; then
348           if test "$value" = yes; then
349             eval value=\"\$LIB$uppername\"
350             test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
351             eval value=\"\$LTLIB$uppername\"
352             test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
353           else
354             dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
355             dnl that this library doesn't exist. So just drop it.
356             :
357           fi
358         else
359           dnl Search the library lib$name in $additional_libdir and $LDFLAGS
360           dnl and the already constructed $LIBNAME/$LTLIBNAME.
361           found_dir=
362           found_la=
363           found_so=
364           found_a=
365           if test $use_additional = yes; then
366             if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
367               found_dir="$additional_libdir"
368               found_so="$additional_libdir/lib$name.$shlibext"
369               if test -f "$additional_libdir/lib$name.la"; then
370                 found_la="$additional_libdir/lib$name.la"
371               fi
372             else
373               if test -f "$additional_libdir/lib$name.$libext"; then
374                 found_dir="$additional_libdir"
375                 found_a="$additional_libdir/lib$name.$libext"
376                 if test -f "$additional_libdir/lib$name.la"; then
377                   found_la="$additional_libdir/lib$name.la"
378                 fi
379               fi
380             fi
381           fi
382           if test "X$found_dir" = "X"; then
383             for x in $LDFLAGS $LTLIB[]NAME; do
384               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
385               case "$x" in
386                 -L*)
387                   dir=`echo "X$x" | sed -e 's/^X-L//'`
388                   if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
389                     found_dir="$dir"
390                     found_so="$dir/lib$name.$shlibext"
391                     if test -f "$dir/lib$name.la"; then
392                       found_la="$dir/lib$name.la"
393                     fi
394                   else
395                     if test -f "$dir/lib$name.$libext"; then
396                       found_dir="$dir"
397                       found_a="$dir/lib$name.$libext"
398                       if test -f "$dir/lib$name.la"; then
399                         found_la="$dir/lib$name.la"
400                       fi
401                     fi
402                   fi
403                   ;;
404               esac
405               if test "X$found_dir" != "X"; then
406                 break
407               fi
408             done
409           fi
410           if test "X$found_dir" != "X"; then
411             dnl Found the library.
412             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
413             if test "X$found_so" != "X"; then
414               dnl Linking with a shared library. We attempt to hardcode its
415               dnl directory into the executable's runpath, unless it's the
416               dnl standard /usr/lib.
417               if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
418                 dnl No hardcoding is needed.
419                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
420               else
421                 dnl Use an explicit option to hardcode DIR into the resulting
422                 dnl binary.
423                 dnl Potentially add DIR to ltrpathdirs.
424                 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
425                 haveit=
426                 for x in $ltrpathdirs; do
427                   if test "X$x" = "X$found_dir"; then
428                     haveit=yes
429                     break
430                   fi
431                 done
432                 if test -z "$haveit"; then
433                   ltrpathdirs="$ltrpathdirs $found_dir"
434                 fi
435                 dnl The hardcoding into $LIBNAME is system dependent.
436                 if test "$hardcode_direct" = yes; then
437                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
438                   dnl resulting binary.
439                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
440                 else
441                   if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
442                     dnl Use an explicit option to hardcode DIR into the resulting
443                     dnl binary.
444                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
445                     dnl Potentially add DIR to rpathdirs.
446                     dnl The rpathdirs will be appended to $LIBNAME at the end.
447                     haveit=
448                     for x in $rpathdirs; do
449                       if test "X$x" = "X$found_dir"; then
450                         haveit=yes
451                         break
452                       fi
453                     done
454                     if test -z "$haveit"; then
455                       rpathdirs="$rpathdirs $found_dir"
456                     fi
457                   else
458                     dnl Rely on "-L$found_dir".
459                     dnl But don't add it if it's already contained in the LDFLAGS
460                     dnl or the already constructed $LIBNAME
461                     haveit=
462                     for x in $LDFLAGS $LIB[]NAME; do
463                       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
464                       if test "X$x" = "X-L$found_dir"; then
465                         haveit=yes
466                         break
467                       fi
468                     done
469                     if test -z "$haveit"; then
470                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
471                     fi
472                     if test "$hardcode_minus_L" != no; then
473                       dnl FIXME: Not sure whether we should use
474                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
475                       dnl here.
476                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
477                     else
478                       dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
479                       dnl here, because this doesn't fit in flags passed to the
480                       dnl compiler. So give up. No hardcoding. This affects only
481                       dnl very old systems.
482                       dnl FIXME: Not sure whether we should use
483                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
484                       dnl here.
485                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
486                     fi
487                   fi
488                 fi
489               fi
490             else
491               if test "X$found_a" != "X"; then
492                 dnl Linking with a static library.
493                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
494               else
495                 dnl We shouldn't come here, but anyway it's good to have a
496                 dnl fallback.
497                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
498               fi
499             fi
500             dnl Assume the include files are nearby.
501             additional_includedir=
502             case "$found_dir" in
503               */lib | */lib/)
504                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
505                 additional_includedir="$basedir/include"
506                 ;;
507             esac
508             if test "X$additional_includedir" != "X"; then
509               dnl Potentially add $additional_includedir to $INCNAME.
510               dnl But don't add it
511               dnl   1. if it's the standard /usr/include,
512               dnl   2. if it's /usr/local/include and we are using GCC on Linux,
513               dnl   3. if it's already present in $CPPFLAGS or the already
514               dnl      constructed $INCNAME,
515               dnl   4. if it doesn't exist as a directory.
516               if test "X$additional_includedir" != "X/usr/include"; then
517                 haveit=
518                 if test "X$additional_includedir" = "X/usr/local/include"; then
519                   if test -n "$GCC"; then
520                     case $host_os in
521                       linux* | gnu* | k*bsd*-gnu) haveit=yes;;
522                     esac
523                   fi
524                 fi
525                 if test -z "$haveit"; then
526                   for x in $CPPFLAGS $INC[]NAME; do
527                     AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
528                     if test "X$x" = "X-I$additional_includedir"; then
529                       haveit=yes
530                       break
531                     fi
532                   done
533                   if test -z "$haveit"; then
534                     if test -d "$additional_includedir"; then
535                       dnl Really add $additional_includedir to $INCNAME.
536                       INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
537                     fi
538                   fi
539                 fi
540               fi
541             fi
542             dnl Look for dependencies.
543             if test -n "$found_la"; then
544               dnl Read the .la file. It defines the variables
545               dnl dlname, library_names, old_library, dependency_libs, current,
546               dnl age, revision, installed, dlopen, dlpreopen, libdir.
547               save_libdir="$libdir"
548               case "$found_la" in
549                 */* | *\\*) . "$found_la" ;;
550                 *) . "./$found_la" ;;
551               esac
552               libdir="$save_libdir"
553               dnl We use only dependency_libs.
554               for dep in $dependency_libs; do
555                 case "$dep" in
556                   -L*)
557                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
558                     dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
559                     dnl But don't add it
560                     dnl   1. if it's the standard /usr/lib,
561                     dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
562                     dnl   3. if it's already present in $LDFLAGS or the already
563                     dnl      constructed $LIBNAME,
564                     dnl   4. if it doesn't exist as a directory.
565                     if test "X$additional_libdir" != "X/usr/lib"; then
566                       haveit=
567                       if test "X$additional_libdir" = "X/usr/local/lib"; then
568                         if test -n "$GCC"; then
569                           case $host_os in
570                             linux* | gnu* | k*bsd*-gnu) haveit=yes;;
571                           esac
572                         fi
573                       fi
574                       if test -z "$haveit"; then
575                         haveit=
576                         for x in $LDFLAGS $LIB[]NAME; do
577                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
578                           if test "X$x" = "X-L$additional_libdir"; then
579                             haveit=yes
580                             break
581                           fi
582                         done
583                         if test -z "$haveit"; then
584                           if test -d "$additional_libdir"; then
585                             dnl Really add $additional_libdir to $LIBNAME.
586                             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
587                           fi
588                         fi
589                         haveit=
590                         for x in $LDFLAGS $LTLIB[]NAME; do
591                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
592                           if test "X$x" = "X-L$additional_libdir"; then
593                             haveit=yes
594                             break
595                           fi
596                         done
597                         if test -z "$haveit"; then
598                           if test -d "$additional_libdir"; then
599                             dnl Really add $additional_libdir to $LTLIBNAME.
600                             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
601                           fi
602                         fi
603                       fi
604                     fi
605                     ;;
606                   -R*)
607                     dir=`echo "X$dep" | sed -e 's/^X-R//'`
608                     if test "$enable_rpath" != no; then
609                       dnl Potentially add DIR to rpathdirs.
610                       dnl The rpathdirs will be appended to $LIBNAME at the end.
611                       haveit=
612                       for x in $rpathdirs; do
613                         if test "X$x" = "X$dir"; then
614                           haveit=yes
615                           break
616                         fi
617                       done
618                       if test -z "$haveit"; then
619                         rpathdirs="$rpathdirs $dir"
620                       fi
621                       dnl Potentially add DIR to ltrpathdirs.
622                       dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
623                       haveit=
624                       for x in $ltrpathdirs; do
625                         if test "X$x" = "X$dir"; then
626                           haveit=yes
627                           break
628                         fi
629                       done
630                       if test -z "$haveit"; then
631                         ltrpathdirs="$ltrpathdirs $dir"
632                       fi
633                     fi
634                     ;;
635                   -l*)
636                     dnl Handle this in the next round.
637                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
638                     ;;
639                   *.la)
640                     dnl Handle this in the next round. Throw away the .la's
641                     dnl directory; it is already contained in a preceding -L
642                     dnl option.
643                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
644                     ;;
645                   *)
646                     dnl Most likely an immediate library name.
647                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
648                     LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
649                     ;;
650                 esac
651               done
652             fi
653           else
654             dnl Didn't find the library; assume it is in the system directories
655             dnl known to the linker and runtime loader. (All the system
656             dnl directories known to the linker should also be known to the
657             dnl runtime loader, otherwise the system is severely misconfigured.)
658             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
659             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
660           fi
661         fi
662       fi
663     done
664   done
665   if test "X$rpathdirs" != "X"; then
666     if test -n "$hardcode_libdir_separator"; then
667       dnl Weird platform: only the last -rpath option counts, the user must
668       dnl pass all path elements in one option. We can arrange that for a
669       dnl single library, but not when more than one $LIBNAMEs are used.
670       alldirs=
671       for found_dir in $rpathdirs; do
672         alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
673       done
674       dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
675       acl_save_libdir="$libdir"
676       libdir="$alldirs"
677       eval flag=\"$hardcode_libdir_flag_spec\"
678       libdir="$acl_save_libdir"
679       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
680     else
681       dnl The -rpath options are cumulative.
682       for found_dir in $rpathdirs; do
683         acl_save_libdir="$libdir"
684         libdir="$found_dir"
685         eval flag=\"$hardcode_libdir_flag_spec\"
686         libdir="$acl_save_libdir"
687         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
688       done
689     fi
690   fi
691   if test "X$ltrpathdirs" != "X"; then
692     dnl When using libtool, the option that works for both libraries and
693     dnl executables is -R. The -R options are cumulative.
694     for found_dir in $ltrpathdirs; do
695       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
696     done
697   fi
700 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
701 dnl unless already present in VAR.
702 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
703 dnl contains two or three consecutive elements that belong together.
704 AC_DEFUN([AC_LIB_APPENDTOVAR],
706   for element in [$2]; do
707     haveit=
708     for x in $[$1]; do
709       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
710       if test "X$x" = "X$element"; then
711         haveit=yes
712         break
713       fi
714     done
715     if test -z "$haveit"; then
716       [$1]="${[$1]}${[$1]:+ }$element"
717     fi
718   done
721 # lib-ld.m4 serial 3 (gettext-0.13)
722 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
723 dnl This file is free software; the Free Software Foundation
724 dnl gives unlimited permission to copy and/or distribute it,
725 dnl with or without modifications, as long as this notice is preserved.
727 dnl Subroutines of libtool.m4,
728 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
729 dnl with libtool.m4.
731 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
732 AC_DEFUN([AC_LIB_PROG_LD_GNU],
733 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
734 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
735 case `$LD -v 2>&1 </dev/null` in
736 *GNU* | *'with BFD'*)
737   acl_cv_prog_gnu_ld=yes ;;
739   acl_cv_prog_gnu_ld=no ;;
740 esac])
741 with_gnu_ld=$acl_cv_prog_gnu_ld
744 dnl From libtool-1.4. Sets the variable LD.
745 AC_DEFUN([AC_LIB_PROG_LD],
746 [AC_ARG_WITH(gnu-ld,
747 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
748 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
749 AC_REQUIRE([AC_PROG_CC])dnl
750 AC_REQUIRE([AC_CANONICAL_HOST])dnl
751 # Prepare PATH_SEPARATOR.
752 # The user is always right.
753 if test "${PATH_SEPARATOR+set}" != set; then
754   echo "#! /bin/sh" >conf$$.sh
755   echo  "exit 0"   >>conf$$.sh
756   chmod +x conf$$.sh
757   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
758     PATH_SEPARATOR=';'
759   else
760     PATH_SEPARATOR=:
761   fi
762   rm -f conf$$.sh
764 ac_prog=ld
765 if test "$GCC" = yes; then
766   # Check if gcc -print-prog-name=ld gives a path.
767   AC_MSG_CHECKING([for ld used by GCC])
768   case $host in
769   *-*-mingw*)
770     # gcc leaves a trailing carriage return which upsets mingw
771     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
772   *)
773     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
774   esac
775   case $ac_prog in
776     # Accept absolute paths.
777     [[\\/]* | [A-Za-z]:[\\/]*)]
778       [re_direlt='/[^/][^/]*/\.\./']
779       # Canonicalize the path of ld
780       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
781       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
782         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
783       done
784       test -z "$LD" && LD="$ac_prog"
785       ;;
786   "")
787     # If it fails, then pretend we aren't using GCC.
788     ac_prog=ld
789     ;;
790   *)
791     # If it is relative, then search for the first ld in PATH.
792     with_gnu_ld=unknown
793     ;;
794   esac
795 elif test "$with_gnu_ld" = yes; then
796   AC_MSG_CHECKING([for GNU ld])
797 else
798   AC_MSG_CHECKING([for non-GNU ld])
800 AC_CACHE_VAL(acl_cv_path_LD,
801 [if test -z "$LD"; then
802   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
803   for ac_dir in $PATH; do
804     test -z "$ac_dir" && ac_dir=.
805     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
806       acl_cv_path_LD="$ac_dir/$ac_prog"
807       # Check to see if the program is GNU ld.  I'd rather use --version,
808       # but apparently some GNU ld's only accept -v.
809       # Break only if it was the GNU/non-GNU ld that we prefer.
810       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
811       *GNU* | *'with BFD'*)
812         test "$with_gnu_ld" != no && break ;;
813       *)
814         test "$with_gnu_ld" != yes && break ;;
815       esac
816     fi
817   done
818   IFS="$ac_save_ifs"
819 else
820   acl_cv_path_LD="$LD" # Let the user override the test with a path.
821 fi])
822 LD="$acl_cv_path_LD"
823 if test -n "$LD"; then
824   AC_MSG_RESULT($LD)
825 else
826   AC_MSG_RESULT(no)
828 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
829 AC_LIB_PROG_LD_GNU
832 # iconv.m4 serial AM4 (gettext-0.11.3)
833 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
834 dnl This file is free software; the Free Software Foundation
835 dnl gives unlimited permission to copy and/or distribute it,
836 dnl with or without modifications, as long as this notice is preserved.
838 dnl From Bruno Haible.
840 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
842   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
843   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
844   AC_REQUIRE([AC_LIB_RPATH])
846   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
847   dnl accordingly.
848   AC_LIB_LINKFLAGS_BODY([iconv])
851 AC_DEFUN([AM_ICONV_LINK],
853   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
854   dnl those with the standalone portable GNU libiconv installed).
856   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
857   dnl accordingly.
858   AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
860   dnl Add $INCICONV to CPPFLAGS before performing the following checks,
861   dnl because if the user has installed libiconv and not disabled its use
862   dnl via --without-libiconv-prefix, he wants to use it. The first
863   dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
864   am_save_CPPFLAGS="$CPPFLAGS"
865   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
867   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
868     am_cv_func_iconv="no, consider installing GNU libiconv"
869     am_cv_lib_iconv=no
870     AC_TRY_LINK([#include <stdlib.h>
871 #include <iconv.h>],
872       [iconv_t cd = iconv_open("","");
873        iconv(cd,NULL,NULL,NULL,NULL);
874        iconv_close(cd);],
875       am_cv_func_iconv=yes)
876     if test "$am_cv_func_iconv" != yes; then
877       am_save_LIBS="$LIBS"
878       LIBS="$LIBS $LIBICONV"
879       AC_TRY_LINK([#include <stdlib.h>
880 #include <iconv.h>],
881         [iconv_t cd = iconv_open("","");
882          iconv(cd,NULL,NULL,NULL,NULL);
883          iconv_close(cd);],
884         am_cv_lib_iconv=yes
885         am_cv_func_iconv=yes)
886       LIBS="$am_save_LIBS"
887     fi
888   ])
889   if test "$am_cv_func_iconv" = yes; then
890     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
891   fi
892   if test "$am_cv_lib_iconv" = yes; then
893     AC_MSG_CHECKING([how to link with libiconv])
894     AC_MSG_RESULT([$LIBICONV])
895   else
896     dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
897     dnl either.
898     CPPFLAGS="$am_save_CPPFLAGS"
899     LIBICONV=
900     LTLIBICONV=
901   fi
902   AC_SUBST(LIBICONV)
903   AC_SUBST(LTLIBICONV)
906 AC_DEFUN([AM_ICONV],
908   AM_ICONV_LINK
909   if test "$am_cv_func_iconv" = yes; then
910     AC_MSG_CHECKING([for iconv declaration])
911     AC_CACHE_VAL(am_cv_proto_iconv, [
912       AC_TRY_COMPILE([
913 #include <stdlib.h>
914 #include <iconv.h>
915 extern
916 #ifdef __cplusplus
918 #endif
919 #if defined(__STDC__) || defined(__cplusplus)
920 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
921 #else
922 size_t iconv();
923 #endif
924 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
925       am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
926     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
927     AC_MSG_RESULT([$]{ac_t:-
928          }[$]am_cv_proto_iconv)
929     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
930       [Define as const if the declaration of iconv() needs const.])
931   fi
934 dnl Available from the GNU Autoconf Macro Archive at:
935 dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
937 AC_DEFUN([ACX_PTHREAD], [
938 AC_REQUIRE([AC_CANONICAL_HOST])
939 AC_LANG_SAVE
940 AC_LANG_C
941 acx_pthread_ok=no
943 # We used to check for pthread.h first, but this fails if pthread.h
944 # requires special compiler flags (e.g. on True64 or Sequent).
945 # It gets checked for in the link test anyway.
947 # First of all, check if the user has set any of the PTHREAD_LIBS,
948 # etcetera environment variables, and if threads linking works using
949 # them:
950 if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
951         save_CFLAGS="$CFLAGS"
952         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
953         save_LIBS="$LIBS"
954         LIBS="$PTHREAD_LIBS $LIBS"
955         AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
956         AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
957         AC_MSG_RESULT($acx_pthread_ok)
958         if test x"$acx_pthread_ok" = xno; then
959                 PTHREAD_LIBS=""
960                 PTHREAD_CFLAGS=""
961         fi
962         LIBS="$save_LIBS"
963         CFLAGS="$save_CFLAGS"
966 # We must check for the threads library under a number of different
967 # names; the ordering is very important because some systems
968 # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
969 # libraries is broken (non-POSIX).
971 # Create a list of thread flags to try.  Items starting with a "-" are
972 # C compiler flags, and other items are library names, except for "none"
973 # which indicates that we try without any flags at all, and "pthread-config"
974 # which is a program returning the flags for the Pth emulation library.
976 acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
978 # The ordering *is* (sometimes) important.  Some notes on the
979 # individual items follow:
981 # pthreads: AIX (must check this before -lpthread)
982 # none: in case threads are in libc; should be tried before -Kthread and
983 #       other compiler flags to prevent continual compiler warnings
984 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
985 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
986 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
987 # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
988 # -pthreads: Solaris/gcc
989 # -mthreads: Mingw32/gcc, Lynx/gcc
990 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
991 #      doesn't hurt to check since this sometimes defines pthreads too;
992 #      also defines -D_REENTRANT)
993 # pthread: Linux, etcetera
994 # --thread-safe: KAI C++
995 # pthread-config: use pthread-config program (for GNU Pth library)
997 case "${host_cpu}-${host_os}" in
998         *solaris*)
1000         # On Solaris (at least, for some versions), libc contains stubbed
1001         # (non-functional) versions of the pthreads routines, so link-based
1002         # tests will erroneously succeed.  (We need to link with -pthread or
1003         # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
1004         # a function called by this macro, so we could check for that, but
1005         # who knows whether they'll stub that too in a future libc.)  So,
1006         # we'll just look for -pthreads and -lpthread first:
1008         acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
1009         ;;
1010 esac
1012 if test x"$acx_pthread_ok" = xno; then
1013 for flag in $acx_pthread_flags; do
1015         case $flag in
1016                 none)
1017                 AC_MSG_CHECKING([whether pthreads work without any flags])
1018                 ;;
1020                 -*)
1021                 AC_MSG_CHECKING([whether pthreads work with $flag])
1022                 PTHREAD_CFLAGS="$flag"
1023                 ;;
1025                 pthread-config)
1026                 AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
1027                 if test x"$acx_pthread_config" = xno; then continue; fi
1028                 PTHREAD_CFLAGS="`pthread-config --cflags`"
1029                 PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
1030                 ;;
1032                 *)
1033                 AC_MSG_CHECKING([for the pthreads library -l$flag])
1034                 PTHREAD_LIBS="-l$flag"
1035                 ;;
1036         esac
1038         save_LIBS="$LIBS"
1039         save_CFLAGS="$CFLAGS"
1040         LIBS="$PTHREAD_LIBS $LIBS"
1041         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1043         # Check for various functions.  We must include pthread.h,
1044         # since some functions may be macros.  (On the Sequent, we
1045         # need a special flag -Kthread to make this header compile.)
1046         # We check for pthread_join because it is in -lpthread on IRIX
1047         # while pthread_create is in libc.  We check for pthread_attr_init
1048         # due to DEC craziness with -lpthreads.  We check for
1049         # pthread_cleanup_push because it is one of the few pthread
1050         # functions on Solaris that doesn't have a non-functional libc stub.
1051         # We try pthread_create on general principles.
1052         AC_TRY_LINK([#include <pthread.h>],
1053                     [pthread_t th; pthread_join(th, 0);
1054                      pthread_attr_init(0); pthread_cleanup_push(0, 0);
1055                      pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
1056                     [acx_pthread_ok=yes])
1058         LIBS="$save_LIBS"
1059         CFLAGS="$save_CFLAGS"
1061         AC_MSG_RESULT($acx_pthread_ok)
1062         if test "x$acx_pthread_ok" = xyes; then
1063                 break;
1064         fi
1066         PTHREAD_LIBS=""
1067         PTHREAD_CFLAGS=""
1068 done
1071 # Various other checks:
1072 if test "x$acx_pthread_ok" = xyes; then
1073         save_LIBS="$LIBS"
1074         LIBS="$PTHREAD_LIBS $LIBS"
1075         save_CFLAGS="$CFLAGS"
1076         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1078         # Detect AIX lossage: threads are created detached by default
1079         # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
1080         AC_MSG_CHECKING([for joinable pthread attribute])
1081         AC_TRY_LINK([#include <pthread.h>],
1082                     [int attr=PTHREAD_CREATE_JOINABLE;],
1083                     ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
1084         if test x"$ok" = xunknown; then
1085                 AC_TRY_LINK([#include <pthread.h>],
1086                             [int attr=PTHREAD_CREATE_UNDETACHED;],
1087                             ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
1088         fi
1089         if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
1090                 AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
1091                           [Define to the necessary symbol if this constant
1092                            uses a non-standard name on your system.])
1093         fi
1094         AC_MSG_RESULT(${ok})
1095         if test x"$ok" = xunknown; then
1096                 AC_MSG_WARN([we do not know how to create joinable pthreads])
1097         fi
1099         AC_MSG_CHECKING([if more special flags are required for pthreads])
1100         flag=no
1101         case "${host_cpu}-${host_os}" in
1102                 *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
1103                 *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
1104         esac
1105         AC_MSG_RESULT(${flag})
1106         if test "x$flag" != xno; then
1107                 PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
1108         fi
1110         LIBS="$save_LIBS"
1111         CFLAGS="$save_CFLAGS"
1113         # More AIX lossage: must compile with cc_r
1114         AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
1115 else
1116         PTHREAD_CC="$CC"
1119 AC_SUBST(PTHREAD_LIBS)
1120 AC_SUBST(PTHREAD_CFLAGS)
1121 AC_SUBST(PTHREAD_CC)
1123 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
1124 if test x"$acx_pthread_ok" = xyes; then
1125         ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
1126         :
1127 else
1128         acx_pthread_ok=no
1129         $2
1131 AC_LANG_RESTORE
1132 ])dnl ACX_PTHREAD
1134 AC_DEFUN(ACX_CHECK_CC_FLAGS,
1136 AC_REQUIRE([AC_PROG_CC])
1137 AC_CACHE_CHECK(whether ${CC} accepts $1, ac_$2,
1138 [echo 'void f(){}' > conftest.c
1139 if test -z "`${CC} $1 -c conftest.c 2>&1`"; then
1140         ac_$2=yes
1141 else
1142         ac_$2=no
1144 rm -f conftest*
1146 if test "$ac_$2" = yes; then
1147         :
1148         $3
1149 else
1150         :
1151         $4
1155 AC_DEFUN(ACX_CHECK_CXX_FLAGS,
1157 AC_REQUIRE([AC_PROG_CXX])
1158 AC_CACHE_CHECK(whether ${CXX} accepts $1, ac_$2,
1159 [echo 'void f(){}' > conftest.cpp
1160 if test -z "`${CXX} $1 -c conftest.cpp 2>&1`"; then
1161         ac_$2=yes
1162 else
1163         ac_$2=no
1165 rm -f conftest*
1167 if test "$ac_$2" = yes; then
1168         :
1169         $3
1170 else
1171         :
1172         $4