]> git.sur5r.net Git - glabels/blob - glabels1/aclocal.m4
Updated aclocal.m4.
[glabels] / glabels1 / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p5
2
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.
7
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.
12
13 # Do all the work for Automake.  This macro actually does too much --
14 # some checks are only needed if your package does certain things.
15 # But this isn't really a big deal.
16
17 # serial 1
18
19 dnl Usage:
20 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
21
22 AC_DEFUN([AM_INIT_AUTOMAKE],
23 [AC_REQUIRE([AC_PROG_INSTALL])
24 PACKAGE=[$1]
25 AC_SUBST(PACKAGE)
26 VERSION=[$2]
27 AC_SUBST(VERSION)
28 dnl test to see if srcdir already configured
29 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
30   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
31 fi
32 ifelse([$3],,
33 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
34 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
35 AC_REQUIRE([AM_SANITY_CHECK])
36 AC_REQUIRE([AC_ARG_PROGRAM])
37 dnl FIXME This is truly gross.
38 missing_dir=`cd $ac_aux_dir && pwd`
39 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
40 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
41 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
42 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
43 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
44 AC_REQUIRE([AC_PROG_MAKE_SET])])
45
46 #
47 # Check to make sure that the build environment is sane.
48 #
49
50 AC_DEFUN([AM_SANITY_CHECK],
51 [AC_MSG_CHECKING([whether build environment is sane])
52 # Just in case
53 sleep 1
54 echo timestamp > conftestfile
55 # Do `set' in a subshell so we don't clobber the current shell's
56 # arguments.  Must try -L first in case configure is actually a
57 # symlink; some systems play weird games with the mod time of symlinks
58 # (eg FreeBSD returns the mod time of the symlink's containing
59 # directory).
60 if (
61    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
62    if test "[$]*" = "X"; then
63       # -L didn't work.
64       set X `ls -t $srcdir/configure conftestfile`
65    fi
66    if test "[$]*" != "X $srcdir/configure conftestfile" \
67       && test "[$]*" != "X conftestfile $srcdir/configure"; then
68
69       # If neither matched, then we have a broken ls.  This can happen
70       # if, for instance, CONFIG_SHELL is bash and it inherits a
71       # broken ls alias from the environment.  This has actually
72       # happened.  Such a system could not be considered "sane".
73       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
74 alias in your environment])
75    fi
76
77    test "[$]2" = conftestfile
78    )
79 then
80    # Ok.
81    :
82 else
83    AC_MSG_ERROR([newly created file is older than distributed files!
84 Check your system clock])
85 fi
86 rm -f conftest*
87 AC_MSG_RESULT(yes)])
88
89 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
90 dnl The program must properly implement --version.
91 AC_DEFUN([AM_MISSING_PROG],
92 [AC_MSG_CHECKING(for working $2)
93 # Run test in a subshell; some versions of sh will print an error if
94 # an executable is not found, even if stderr is redirected.
95 # Redirect stdin to placate older versions of autoconf.  Sigh.
96 if ($2 --version) < /dev/null > /dev/null 2>&1; then
97    $1=$2
98    AC_MSG_RESULT(found)
99 else
100    $1="$3/missing $2"
101    AC_MSG_RESULT(missing)
102 fi
103 AC_SUBST($1)])
104
105 # Like AC_CONFIG_HEADER, but automatically create stamp file.
106
107 AC_DEFUN([AM_CONFIG_HEADER],
108 [AC_PREREQ([2.12])
109 AC_CONFIG_HEADER([$1])
110 dnl When config.status generates a header, we must update the stamp-h file.
111 dnl This file resides in the same directory as the config header
112 dnl that is generated.  We must strip everything past the first ":",
113 dnl and everything past the last "/".
114 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
115 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
116 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
117 <<am_indx=1
118 for am_file in <<$1>>; do
119   case " <<$>>CONFIG_HEADERS " in
120   *" <<$>>am_file "*<<)>>
121     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
122     ;;
123   esac
124   am_indx=`expr "<<$>>am_indx" + 1`
125 done<<>>dnl>>)
126 changequote([,]))])
127
128 # aclocal-include.m4
129
130 # This macro adds the name macrodir to the set of directories
131 # that `aclocal' searches for macros.  
132
133 # serial 1
134
135 dnl AM_ACLOCAL_INCLUDE(macrodir)
136 AC_DEFUN([AM_ACLOCAL_INCLUDE],
137 [
138         AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y)
139
140         test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
141
142         for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done
143 ])
144
145 # Define a conditional.
146
147 AC_DEFUN([AM_CONDITIONAL],
148 [AC_SUBST($1_TRUE)
149 AC_SUBST($1_FALSE)
150 if $2; then
151   $1_TRUE=
152   $1_FALSE='#'
153 else
154   $1_TRUE='#'
155   $1_FALSE=
156 fi])
157
158 dnl
159 dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits])
160 dnl
161 dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
162 dnl is not found. 
163 dnl
164
165 AC_DEFUN([GNOME_INIT_HOOK],[
166         AC_SUBST(GNOME_LIBS)
167         AC_SUBST(GNOMEUI_LIBS)
168         AC_SUBST(GNOMEGNORBA_LIBS)
169         AC_SUBST(GTKXMHTML_LIBS)
170         AC_SUBST(ZVT_LIBS)
171         AC_SUBST(GNOME_LIBDIR)
172         AC_SUBST(GNOME_INCLUDEDIR)
173
174         AC_ARG_WITH(gnome-includes,
175         [  --with-gnome-includes   Specify location of GNOME headers],[
176         CFLAGS="$CFLAGS -I$withval"
177         ])
178         
179         AC_ARG_WITH(gnome-libs,
180         [  --with-gnome-libs       Specify location of GNOME libs],[
181         LDFLAGS="$LDFLAGS -L$withval"
182         gnome_prefix=$withval
183         ])
184
185         AC_ARG_WITH(gnome,
186         [  --with-gnome            Specify prefix for GNOME files],
187                 if test x$withval = xyes; then
188                         want_gnome=yes
189                         dnl Note that an empty true branch is not
190                         dnl valid sh syntax.
191                         ifelse([$1], [], :, [$1])
192                 else
193                         if test "x$withval" = xno; then
194                                 want_gnome=no
195                         else
196                                 want_gnome=yes
197                                 LDFLAGS="$LDFLAGS -L$withval/lib"
198                                 CFLAGS="$CFLAGS -I$withval/include"
199                                 gnome_prefix=$withval/lib
200                         fi
201                 fi,
202                 want_gnome=yes)
203
204         if test "x$want_gnome" = xyes; then
205
206             AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
207             if test "$GNOME_CONFIG" = "no"; then
208               no_gnome_config="yes"
209             else
210               AC_MSG_CHECKING(if $GNOME_CONFIG works)
211               if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
212                 AC_MSG_RESULT(yes)
213                 GNOME_GNORBA_HOOK([],$2)
214                 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
215                 GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
216                 GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`"
217                 GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`"
218                 ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`"
219                 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
220                 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
221                 $1
222               else
223                 AC_MSG_RESULT(no)
224                 no_gnome_config="yes"
225               fi
226             fi
227
228             if test x$exec_prefix = xNONE; then
229                 if test x$prefix = xNONE; then
230                     gnome_prefix=$ac_default_prefix/lib
231                 else
232                     gnome_prefix=$prefix/lib
233                 fi
234             else
235                 gnome_prefix=`eval echo \`echo $libdir\``
236             fi
237         
238             if test "$no_gnome_config" = "yes"; then
239               AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
240               if test -f $gnome_prefix/gnomeConf.sh; then
241                 AC_MSG_RESULT(found)
242                 echo "loading gnome configuration from" \
243                      "$gnome_prefix/gnomeConf.sh"
244                 . $gnome_prefix/gnomeConf.sh
245                 $1
246               else
247                 AC_MSG_RESULT(not found)
248                 if test x$2 = xfail; then
249                   AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
250                 fi
251               fi
252             fi
253         fi
254
255         if test -n "$3"; then
256           n="$3"
257           for i in $n; do
258             AC_MSG_CHECKING(extra library \"$i\")
259             case $i in 
260               applets)
261                 AC_SUBST(GNOME_APPLETS_LIBS)
262                 GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets`
263                 AC_MSG_RESULT($GNOME_APPLETS_LIBS);;
264               capplet)
265                 AC_SUBST(GNOME_CAPPLET_LIBS)
266                 GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet`
267                 AC_MSG_RESULT($GNOME_CAPPLET_LIBS);;
268               *)
269                 AC_MSG_RESULT(unknown library)
270             esac
271           done
272         fi
273 ])
274
275 dnl
276 dnl GNOME_INIT ([additional-inits])
277 dnl
278
279 AC_DEFUN([GNOME_INIT],[
280         GNOME_INIT_HOOK([],fail,$1)
281 ])
282
283 dnl
284 dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag)
285 dnl
286 dnl if failflag is "failure" it aborts if gnorba is not found.
287 dnl
288
289 AC_DEFUN([GNOME_GNORBA_HOOK],[
290         GNOME_ORBIT_HOOK([],$2)
291         AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[
292                 gnome_cv_gnorba_found=no
293                 if test x$gnome_cv_orbit_found = xyes; then
294                         GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
295                         GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
296                         if test -n "$GNORBA_LIBS"; then
297                                 gnome_cv_gnorba_found=yes
298                         fi
299                 fi
300         ])
301         AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes)
302         if test x$gnome_cv_orbit_found = xyes; then
303                 $1
304                 GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
305                 GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
306                 AC_SUBST(GNORBA_CFLAGS)
307                 AC_SUBST(GNORBA_LIBS)
308         else
309                 if test x$2 = xfailure; then
310                         AC_MSG_ERROR(gnorba library not installed or installation problem)
311                 fi
312         fi
313 ])
314
315 AC_DEFUN([GNOME_GNORBA_CHECK], [
316         GNOME_GNORBA_HOOK([],failure)
317 ])
318
319 dnl
320 dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag)
321 dnl
322 dnl if failflag is "failure" it aborts if orbit is not found.
323 dnl
324
325 AC_DEFUN([GNOME_ORBIT_HOOK],[
326         AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no)
327         AC_PATH_PROG(ORBIT_IDL,orbit-idl,no)
328         AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[
329                 if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then
330                         gnome_cv_orbit_found=no
331                 else
332                         gnome_cv_orbit_found=yes
333                 fi
334         ])
335         AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes)
336         if test x$gnome_cv_orbit_found = xyes; then
337                 $1
338                 ORBIT_CFLAGS=`orbit-config --cflags client server`
339                 ORBIT_LIBS=`orbit-config --use-service=name --libs client server`
340                 AC_SUBST(ORBIT_CFLAGS)
341                 AC_SUBST(ORBIT_LIBS)
342         else
343                 if test x$2 = xfailure; then
344                         AC_MSG_ERROR(ORBit not installed or installation problem)
345                 fi
346         fi
347 ])
348
349 AC_DEFUN([GNOME_ORBIT_CHECK], [
350         GNOME_ORBIT_HOOK([],failure)
351 ])
352
353 # isc-posix.m4 serial 1 (gettext-0.10.40)
354 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
355 dnl This file is free software, distributed under the terms of the GNU
356 dnl General Public License.  As a special exception to the GNU General
357 dnl Public License, this file may be distributed as part of a program
358 dnl that contains a configuration script generated by Autoconf, under
359 dnl the same distribution terms as the rest of that program.
360
361 # This test replaces the one in autoconf.
362 # Currently this macro should have the same name as the autoconf macro
363 # because gettext's gettext.m4 (distributed in the automake package)
364 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
365 # give these diagnostics:
366 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
367 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
368
369 undefine([AC_ISC_POSIX])
370
371 AC_DEFUN([AC_ISC_POSIX],
372   [
373     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
374     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
375   ]
376 )
377
378
379 # serial 1
380
381 # @defmac AC_PROG_CC_STDC
382 # @maindex PROG_CC_STDC
383 # @ovindex CC
384 # If the C compiler in not in ANSI C mode by default, try to add an option
385 # to output variable @code{CC} to make it so.  This macro tries various
386 # options that select ANSI C on some system or another.  It considers the
387 # compiler to be in ANSI C mode if it handles function prototypes correctly.
388 #
389 # If you use this macro, you should check after calling it whether the C
390 # compiler has been set to accept ANSI C; if not, the shell variable
391 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
392 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
393 # program @code{ansi2knr}, which comes with Ghostscript.
394 # @end defmac
395
396 AC_DEFUN([AM_PROG_CC_STDC],
397 [AC_REQUIRE([AC_PROG_CC])
398 AC_BEFORE([$0], [AC_C_INLINE])
399 AC_BEFORE([$0], [AC_C_CONST])
400 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
401 dnl a magic option to avoid problems with ANSI preprocessor commands
402 dnl like #elif.
403 dnl FIXME: can't do this because then AC_AIX won't work due to a
404 dnl circular dependency.
405 dnl AC_BEFORE([$0], [AC_PROG_CPP])
406 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
407 AC_CACHE_VAL(am_cv_prog_cc_stdc,
408 [am_cv_prog_cc_stdc=no
409 ac_save_CC="$CC"
410 # Don't try gcc -ansi; that turns off useful extensions and
411 # breaks some systems' header files.
412 # AIX                   -qlanglvl=ansi
413 # Ultrix and OSF/1      -std1
414 # HP-UX                 -Aa -D_HPUX_SOURCE
415 # SVR4                  -Xc -D__EXTENSIONS__
416 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
417 do
418   CC="$ac_save_CC $ac_arg"
419   AC_TRY_COMPILE(
420 [#include <stdarg.h>
421 #include <stdio.h>
422 #include <sys/types.h>
423 #include <sys/stat.h>
424 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
425 struct buf { int x; };
426 FILE * (*rcsopen) (struct buf *, struct stat *, int);
427 static char *e (p, i)
428      char **p;
429      int i;
430 {
431   return p[i];
432 }
433 static char *f (char * (*g) (char **, int), char **p, ...)
434 {
435   char *s;
436   va_list v;
437   va_start (v,p);
438   s = g (p, va_arg (v,int));
439   va_end (v);
440   return s;
441 }
442 int test (int i, double x);
443 struct s1 {int (*f) (int a);};
444 struct s2 {int (*f) (double a);};
445 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
446 int argc;
447 char **argv;
448 ], [
449 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
450 ],
451 [am_cv_prog_cc_stdc="$ac_arg"; break])
452 done
453 CC="$ac_save_CC"
454 ])
455 if test -z "$am_cv_prog_cc_stdc"; then
456   AC_MSG_RESULT([none needed])
457 else
458   AC_MSG_RESULT($am_cv_prog_cc_stdc)
459 fi
460 case "x$am_cv_prog_cc_stdc" in
461   x|xno) ;;
462   *) CC="$CC $am_cv_prog_cc_stdc" ;;
463 esac
464 ])
465
466 dnl GNOME_COMPILE_WARNINGS
467 dnl Turn on many useful compiler warnings
468 dnl For now, only works on GCC
469 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
470   AC_ARG_ENABLE(compile-warnings, 
471     [  --enable-compile-warnings=[no/minimum/yes]       Turn on compiler warnings.],,enable_compile_warnings=minimum)
472
473   AC_MSG_CHECKING(what warning flags to pass to the C compiler)
474   warnCFLAGS=
475   if test "x$GCC" != xyes; then
476     enable_compile_warnings=no
477   fi
478
479   if test "x$enable_compile_warnings" != "xno"; then
480     if test "x$GCC" = "xyes"; then
481       case " $CFLAGS " in
482       *[\ \     ]-Wall[\ \      ]*) ;;
483       *) warnCFLAGS="-Wall -Wunused" ;;
484       esac
485
486       ## -W is not all that useful.  And it cannot be controlled
487       ## with individual -Wno-xxx flags, unlike -Wall
488       if test "x$enable_compile_warnings" = "xyes"; then
489         warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith"
490       fi
491     fi
492   fi
493   AC_MSG_RESULT($warnCFLAGS)
494
495   AC_ARG_ENABLE(iso-c,
496     [  --enable-iso-c          Try to warn if code is not ISO C ],,
497     enable_iso_c=no)
498
499   AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
500   complCFLAGS=
501   if test "x$enable_iso_c" != "xno"; then
502     if test "x$GCC" = "xyes"; then
503       case " $CFLAGS " in
504       *[\ \     ]-ansi[\ \      ]*) ;;
505       *) complCFLAGS="$complCFLAGS -ansi" ;;
506       esac
507
508       case " $CFLAGS " in
509       *[\ \     ]-pedantic[\ \  ]*) ;;
510       *) complCFLAGS="$complCFLAGS -pedantic" ;;
511       esac
512     fi
513   fi
514   AC_MSG_RESULT($complCFLAGS)
515   if test "x$cflags_set" != "xyes"; then
516     CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS"
517     cflags_set=yes
518     AC_SUBST(cflags_set)
519   fi
520 ])
521
522 dnl For C++, do basically the same thing.
523
524 AC_DEFUN([GNOME_CXX_WARNINGS],[
525   AC_ARG_ENABLE(cxx-warnings, 
526     [  --enable-cxx-warnings=[no/minimum/yes]   Turn on compiler warnings.],,enable_cxx_warnings=minimum)
527
528   AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
529   warnCXXFLAGS=
530   if test "x$GCC" != xyes; then
531     enable_compile_warnings=no
532   fi
533   if test "x$enable_cxx_warnings" != "xno"; then
534     if test "x$GCC" = "xyes"; then
535       case " $CXXFLAGS " in
536       *[\ \     ]-Wall[\ \      ]*) ;;
537       *) warnCXXFLAGS="-Wall -Wno-unused" ;;
538       esac
539
540       ## -W is not all that useful.  And it cannot be controlled
541       ## with individual -Wno-xxx flags, unlike -Wall
542       if test "x$enable_cxx_warnings" = "xyes"; then
543         warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wshadow -Woverloaded-virtual"
544       fi
545     fi
546   fi
547   AC_MSG_RESULT($warnCXXFLAGS)
548
549    AC_ARG_ENABLE(iso-cxx,
550      [  --enable-iso-cxx          Try to warn if code is not ISO C++ ],,
551      enable_iso_cxx=no)
552
553    AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
554    complCXXFLAGS=
555    if test "x$enable_iso_cxx" != "xno"; then
556      if test "x$GCC" = "xyes"; then
557       case " $CXXFLAGS " in
558       *[\ \     ]-ansi[\ \      ]*) ;;
559       *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
560       esac
561
562       case " $CXXFLAGS " in
563       *[\ \     ]-pedantic[\ \  ]*) ;;
564       *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
565       esac
566      fi
567    fi
568   AC_MSG_RESULT($complCXXFLAGS)
569   if test "x$cxxflags_set" != "xyes"; then
570     CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
571     cxxflags_set=yes
572     AC_SUBST(cxxflags_set)
573   fi
574 ])
575
576 dnl GNOME_X_CHECKS
577 dnl
578 dnl Basic X11 related checks for X11.  At the end, the following will be
579 dnl defined/changed:
580 dnl   GTK_{CFLAGS,LIBS}      From AM_PATH_GTK
581 dnl   CPPFLAGS               Will include $X_CFLAGS
582 dnl   GNOME_HAVE_SM          `true' or `false' depending on whether session
583 dnl                          management is available.  It is available if
584 dnl                          both -lSM and X11/SM/SMlib.h exist.  (Some
585 dnl                          Solaris boxes have the library but not the header)
586 dnl   XPM_LIBS               -lXpm if Xpm library is present, otherwise ""
587 dnl
588 dnl The following configure cache variables are defined (but not used):
589 dnl   gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS}
590 dnl
591 AC_DEFUN([GNOME_X_CHECKS],
592 [
593         AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
594         dnl Hope that GTK_CFLAGS have only -I and -D.  Otherwise, we could
595         dnl   test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes"
596         dnl
597         dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses
598         dnl CPPFLAGS, not CFLAGS
599         CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
600
601         saved_ldflags="$LDFLAGS"
602         LDFLAGS="$LDFLAGS $GTK_LIBS"
603
604         gnome_cv_passdown_x_libs="$GTK_LIBS"
605         gnome_cv_passdown_X_LIBS="$GTK_LIBS"
606         gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS"
607         gnome_cv_passdown_GTK_LIBS="$GTK_LIBS"
608
609         LDFLAGS="$saved_ldflags $GTK_LIBS"
610
611 dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow.
612         USE_DEVGTK=true
613
614 dnl     AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x])
615 dnl     AC_EGREP_CPP(answer_affirmatively,
616 dnl     [#include <gtk/gtkfeatures.h>
617 dnl     #ifdef GTK_HAVE_FEATURES_1_1_0
618 dnl        answer_affirmatively
619 dnl     #endif
620 dnl     ], dev_gtk=yes, dev_gtk=no)
621 dnl     if test "$dev_gtk" = "yes"; then
622 dnl        USE_DEVGTK=true
623 dnl     fi
624 dnl     AC_MSG_RESULT("$dev_gtk")
625
626         GNOME_HAVE_SM=true
627         case "$GTK_LIBS" in
628          *-lSM*)
629             dnl Already found it.
630             ;;
631          *)
632             dnl Assume that if we have -lSM then we also have -lICE.
633             AC_CHECK_LIB(SM, SmcSaveYourselfDone,
634                 [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false,
635                 $x_libs -lICE)
636             ;;
637         esac
638
639         if test "$GNOME_HAVE_SM" = true; then
640            AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false)
641         fi
642
643         if test "$GNOME_HAVE_SM" = true; then
644            AC_DEFINE(HAVE_LIBSM)
645         fi
646
647         XPM_LIBS=""
648         AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
649         AC_SUBST(XPM_LIBS)
650
651         AC_REQUIRE([GNOME_PTHREAD_CHECK])
652         LDFLAGS="$saved_ldflags"
653
654         AC_PROVIDE([GNOME_X_CHECKS])
655 ])
656
657 # Configure paths for GTK+
658 # Owen Taylor     97-11-3
659
660 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
661 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
662 dnl
663 AC_DEFUN(AM_PATH_GTK,
664 [dnl 
665 dnl Get the cflags and libraries from the gtk-config script
666 dnl
667 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
668             gtk_config_prefix="$withval", gtk_config_prefix="")
669 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
670             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
671 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
672                     , enable_gtktest=yes)
673
674   for module in . $4
675   do
676       case "$module" in
677          gthread) 
678              gtk_config_args="$gtk_config_args gthread"
679          ;;
680       esac
681   done
682
683   if test x$gtk_config_exec_prefix != x ; then
684      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
685      if test x${GTK_CONFIG+set} != xset ; then
686         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
687      fi
688   fi
689   if test x$gtk_config_prefix != x ; then
690      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
691      if test x${GTK_CONFIG+set} != xset ; then
692         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
693      fi
694   fi
695
696   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
697   min_gtk_version=ifelse([$1], ,0.99.7,$1)
698   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
699   no_gtk=""
700   if test "$GTK_CONFIG" = "no" ; then
701     no_gtk=yes
702   else
703     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
704     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
705     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
706            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
707     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
708            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
709     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
710            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
711     if test "x$enable_gtktest" = "xyes" ; then
712       ac_save_CFLAGS="$CFLAGS"
713       ac_save_LIBS="$LIBS"
714       CFLAGS="$CFLAGS $GTK_CFLAGS"
715       LIBS="$GTK_LIBS $LIBS"
716 dnl
717 dnl Now check if the installed GTK is sufficiently new. (Also sanity
718 dnl checks the results of gtk-config to some extent
719 dnl
720       rm -f conf.gtktest
721       AC_TRY_RUN([
722 #include <gtk/gtk.h>
723 #include <stdio.h>
724 #include <stdlib.h>
725
726 int 
727 main ()
728 {
729   int major, minor, micro;
730   char *tmp_version;
731
732   system ("touch conf.gtktest");
733
734   /* HP/UX 9 (%@#!) writes to sscanf strings */
735   tmp_version = g_strdup("$min_gtk_version");
736   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
737      printf("%s, bad version string\n", "$min_gtk_version");
738      exit(1);
739    }
740
741   if ((gtk_major_version != $gtk_config_major_version) ||
742       (gtk_minor_version != $gtk_config_minor_version) ||
743       (gtk_micro_version != $gtk_config_micro_version))
744     {
745       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
746              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
747              gtk_major_version, gtk_minor_version, gtk_micro_version);
748       printf ("*** was found! If gtk-config was correct, then it is best\n");
749       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
750       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
751       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
752       printf("*** required on your system.\n");
753       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
754       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
755       printf("*** before re-running configure\n");
756     } 
757 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
758   else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
759            (gtk_minor_version != GTK_MINOR_VERSION) ||
760            (gtk_micro_version != GTK_MICRO_VERSION))
761     {
762       printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
763              GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
764       printf("*** library (version %d.%d.%d)\n",
765              gtk_major_version, gtk_minor_version, gtk_micro_version);
766     }
767 #endif /* defined (GTK_MAJOR_VERSION) ... */
768   else
769     {
770       if ((gtk_major_version > major) ||
771         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
772         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
773       {
774         return 0;
775        }
776      else
777       {
778         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
779                gtk_major_version, gtk_minor_version, gtk_micro_version);
780         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
781                major, minor, micro);
782         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
783         printf("***\n");
784         printf("*** If you have already installed a sufficiently new version, this error\n");
785         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
786         printf("*** being found. The easiest way to fix this is to remove the old version\n");
787         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
788         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
789         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
790         printf("*** so that the correct libraries are found at run-time))\n");
791       }
792     }
793   return 1;
794 }
795 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
796        CFLAGS="$ac_save_CFLAGS"
797        LIBS="$ac_save_LIBS"
798      fi
799   fi
800   if test "x$no_gtk" = x ; then
801      AC_MSG_RESULT(yes)
802      ifelse([$2], , :, [$2])     
803   else
804      AC_MSG_RESULT(no)
805      if test "$GTK_CONFIG" = "no" ; then
806        echo "*** The gtk-config script installed by GTK could not be found"
807        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
808        echo "*** your path, or set the GTK_CONFIG environment variable to the"
809        echo "*** full path to gtk-config."
810      else
811        if test -f conf.gtktest ; then
812         :
813        else
814           echo "*** Could not run GTK test program, checking why..."
815           CFLAGS="$CFLAGS $GTK_CFLAGS"
816           LIBS="$LIBS $GTK_LIBS"
817           AC_TRY_LINK([
818 #include <gtk/gtk.h>
819 #include <stdio.h>
820 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
821         [ echo "*** The test program compiled, but did not run. This usually means"
822           echo "*** that the run-time linker is not finding GTK or finding the wrong"
823           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
824           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
825           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
826           echo "*** is required on your system"
827           echo "***"
828           echo "*** If you have an old version installed, it is best to remove it, although"
829           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
830           echo "***"
831           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
832           echo "*** came with the system with the command"
833           echo "***"
834           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
835         [ echo "*** The test program failed to compile or link. See the file config.log for the"
836           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
837           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
838           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
839           CFLAGS="$ac_save_CFLAGS"
840           LIBS="$ac_save_LIBS"
841        fi
842      fi
843      GTK_CFLAGS=""
844      GTK_LIBS=""
845      ifelse([$3], , :, [$3])
846   fi
847   AC_SUBST(GTK_CFLAGS)
848   AC_SUBST(GTK_LIBS)
849   rm -f conf.gtktest
850 ])
851
852 dnl
853 dnl And better, use gthreads instead...
854 dnl
855
856 AC_DEFUN([GNOME_PTHREAD_CHECK],[
857         PTHREAD_LIB=""
858         AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
859                 [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
860                     [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
861                         [AC_CHECK_FUNC(pthread_create)]
862                     )]
863                 )]
864         )
865         AC_SUBST(PTHREAD_LIB)
866         AC_PROVIDE([GNOME_PTHREAD_CHECK])
867 ])
868
869 # gettext.m4 serial 13 (gettext-0.11.1)
870 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
871 dnl This file is free software, distributed under the terms of the GNU
872 dnl General Public License.  As a special exception to the GNU General
873 dnl Public License, this file may be distributed as part of a program
874 dnl that contains a configuration script generated by Autoconf, under
875 dnl the same distribution terms as the rest of that program.
876 dnl
877 dnl This file can can be used in projects which are not available under
878 dnl the GNU General Public License or the GNU Library General Public
879 dnl License but which still want to provide support for the GNU gettext
880 dnl functionality.
881 dnl Please note that the actual code of the GNU gettext library is covered
882 dnl by the GNU Library General Public License, and the rest of the GNU
883 dnl gettext package package is covered by the GNU General Public License.
884 dnl They are *not* in the public domain.
885
886 dnl Authors:
887 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
888 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2002.
889
890 dnl Macro to add for using GNU gettext.
891
892 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
893 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
894 dnl    default (if it is not specified or empty) is 'no-libtool'.
895 dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
896 dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
897 dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
898 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
899 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
900 dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
901 dnl    $(top_builddir)/intl/libintl.a will be created.
902 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
903 dnl    implementations (in libc or libintl) without the ngettext() function
904 dnl    will be ignored.
905 dnl INTLDIR is used to find the intl libraries.  If empty,
906 dnl    the value `$(top_builddir)/intl/' is used.
907 dnl
908 dnl The result of the configuration is one of three cases:
909 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
910 dnl    and used.
911 dnl    Catalog format: GNU --> install in $(datadir)
912 dnl    Catalog extension: .mo after installation, .gmo in source tree
913 dnl 2) GNU gettext has been found in the system's C library.
914 dnl    Catalog format: GNU --> install in $(datadir)
915 dnl    Catalog extension: .mo after installation, .gmo in source tree
916 dnl 3) No internationalization, always use English msgid.
917 dnl    Catalog format: none
918 dnl    Catalog extension: none
919 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
920 dnl The use of .gmo is historical (it was needed to avoid overwriting the
921 dnl GNU format catalogs when building on a platform with an X/Open gettext),
922 dnl but we keep it in order not to force irrelevant filename changes on the
923 dnl maintainers.
924 dnl
925 AC_DEFUN([AM_GNU_GETTEXT],
926 [
927   dnl Argument checking.
928   ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
929     [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
930 ])])])])])
931   ifelse([$2], [], , [ifelse([$2], [need-ngettext], ,
932     [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
933 ])])])
934   define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
935   define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
936
937   AC_REQUIRE([AM_PO_SUBDIRS])dnl
938   ifelse(gt_included_intl, yes, [
939     AC_REQUIRE([AM_INTL_SUBDIR])dnl
940   ])
941
942   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
943   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
944   AC_REQUIRE([AC_LIB_RPATH])
945
946   AC_MSG_CHECKING([whether NLS is requested])
947   dnl Default is enabled NLS
948   AC_ARG_ENABLE(nls,
949     [  --disable-nls           do not use Native Language Support],
950     USE_NLS=$enableval, USE_NLS=yes)
951   AC_MSG_RESULT($USE_NLS)
952   AC_SUBST(USE_NLS)
953
954   ifelse(gt_included_intl, yes, [
955     BUILD_INCLUDED_LIBINTL=no
956     USE_INCLUDED_LIBINTL=no
957   ])
958   LIBINTL=
959   LTLIBINTL=
960   POSUB=
961
962   dnl If we use NLS figure out what method
963   if test "$USE_NLS" = "yes"; then
964     gt_use_preinstalled_gnugettext=no
965     ifelse(gt_included_intl, yes, [
966       AC_MSG_CHECKING([whether included gettext is requested])
967       AC_ARG_WITH(included-gettext,
968         [  --with-included-gettext use the GNU gettext library included here],
969         nls_cv_force_use_gnu_gettext=$withval,
970         nls_cv_force_use_gnu_gettext=no)
971       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
972
973       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
974       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
975     ])
976         dnl User does not insist on using GNU NLS library.  Figure out what
977         dnl to use.  If GNU gettext is available we use this.  Else we have
978         dnl to fall back to GNU NLS library.
979
980         dnl Add a version number to the cache macros.
981         define([gt_api_version], ifelse([$2], [need-ngettext], 2, 1))
982         define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
983         define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
984
985         AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
986          [AC_TRY_LINK([#include <libintl.h>
987 extern int _nl_msg_cat_cntr;
988 extern int *_nl_domain_bindings;],
989             [bindtextdomain ("", "");
990 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
991             gt_cv_func_gnugettext_libc=yes,
992             gt_cv_func_gnugettext_libc=no)])
993
994         if test "$gt_cv_func_gnugettext_libc" != "yes"; then
995           dnl Sometimes libintl requires libiconv, so first search for libiconv.
996           ifelse(gt_included_intl, yes, , [
997             AM_ICONV_LINK
998           ])
999           dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
1000           dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
1001           dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
1002           dnl even if libiconv doesn't exist.
1003           AC_LIB_LINKFLAGS_BODY([intl])
1004           AC_CACHE_CHECK([for GNU gettext in libintl],
1005             gt_cv_func_gnugettext_libintl,
1006            [gt_save_CPPFLAGS="$CPPFLAGS"
1007             CPPFLAGS="$CPPFLAGS $INCINTL"
1008             gt_save_LIBS="$LIBS"
1009             LIBS="$LIBS $LIBINTL"
1010             dnl Now see whether libintl exists and does not depend on libiconv.
1011             AC_TRY_LINK([#include <libintl.h>
1012 extern int _nl_msg_cat_cntr;
1013 extern int *_nl_domain_bindings;
1014 extern
1015 #ifdef __cplusplus
1016 "C"
1017 #endif
1018 const char *_nl_expand_alias ();],
1019               [bindtextdomain ("", "");
1020 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings + *_nl_expand_alias (0)],
1021               gt_cv_func_gnugettext_libintl=yes,
1022               gt_cv_func_gnugettext_libintl=no)
1023             dnl Now see whether libintl exists and depends on libiconv.
1024             if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
1025               LIBS="$LIBS $LIBICONV"
1026               AC_TRY_LINK([#include <libintl.h>
1027 extern int _nl_msg_cat_cntr;
1028 extern int *_nl_domain_bindings;
1029 extern
1030 #ifdef __cplusplus
1031 "C"
1032 #endif
1033 const char *_nl_expand_alias ();],
1034                 [bindtextdomain ("", "");
1035 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings + *_nl_expand_alias (0)],
1036                [LIBINTL="$LIBINTL $LIBICONV"
1037                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
1038                 gt_cv_func_gnugettext_libintl=yes
1039                ])
1040             fi
1041             CPPFLAGS="$gt_save_CPPFLAGS"
1042             LIBS="$gt_save_LIBS"])
1043         fi
1044
1045         dnl If an already present or preinstalled GNU gettext() is found,
1046         dnl use it.  But if this macro is used in GNU gettext, and GNU
1047         dnl gettext is already preinstalled in libintl, we update this
1048         dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
1049         if test "$gt_cv_func_gnugettext_libc" = "yes" \
1050            || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1051                 && test "$PACKAGE" != gettext; }; then
1052           gt_use_preinstalled_gnugettext=yes
1053         else
1054           dnl Reset the values set by searching for libintl.
1055           LIBINTL=
1056           LTLIBINTL=
1057           INCINTL=
1058         fi
1059
1060     ifelse(gt_included_intl, yes, [
1061         if test "$gt_use_preinstalled_gnugettext" != "yes"; then
1062           dnl GNU gettext is not found in the C library.
1063           dnl Fall back on included GNU gettext library.
1064           nls_cv_use_gnu_gettext=yes
1065         fi
1066       fi
1067
1068       if test "$nls_cv_use_gnu_gettext" = "yes"; then
1069         dnl Mark actions used to generate GNU NLS library.
1070         INTLOBJS="\$(GETTOBJS)"
1071         BUILD_INCLUDED_LIBINTL=yes
1072         USE_INCLUDED_LIBINTL=yes
1073         LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
1074         LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
1075         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1076       fi
1077
1078       if test "$gt_use_preinstalled_gnugettext" = "yes" \
1079          || test "$nls_cv_use_gnu_gettext" = "yes"; then
1080         dnl Mark actions to use GNU gettext tools.
1081         CATOBJEXT=.gmo
1082       fi
1083     ])
1084
1085     if test "$gt_use_preinstalled_gnugettext" = "yes" \
1086        || test "$nls_cv_use_gnu_gettext" = "yes"; then
1087       AC_DEFINE(ENABLE_NLS, 1,
1088         [Define to 1 if translation of program messages to the user's native language
1089    is requested.])
1090     else
1091       USE_NLS=no
1092     fi
1093   fi
1094
1095   if test "$USE_NLS" = "yes"; then
1096
1097     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
1098       if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1099         AC_MSG_CHECKING([how to link with libintl])
1100         AC_MSG_RESULT([$LIBINTL])
1101         AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
1102       fi
1103
1104       dnl For backward compatibility. Some packages may be using this.
1105       AC_DEFINE(HAVE_GETTEXT, 1,
1106        [Define if the GNU gettext() function is already present or preinstalled.])
1107       AC_DEFINE(HAVE_DCGETTEXT, 1,
1108        [Define if the GNU dcgettext() function is already present or preinstalled.])
1109     fi
1110
1111     dnl We need to process the po/ directory.
1112     POSUB=po
1113   fi
1114
1115   ifelse(gt_included_intl, yes, [
1116     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1117     dnl to 'yes' because some of the testsuite requires it.
1118     if test "$PACKAGE" = gettext; then
1119       BUILD_INCLUDED_LIBINTL=yes
1120     fi
1121
1122     dnl Make all variables we use known to autoconf.
1123     AC_SUBST(BUILD_INCLUDED_LIBINTL)
1124     AC_SUBST(USE_INCLUDED_LIBINTL)
1125     AC_SUBST(CATOBJEXT)
1126     AC_SUBST(INTLOBJS)
1127
1128     dnl For backward compatibility. Some configure.ins may be using this.
1129     nls_cv_header_intl=
1130     nls_cv_header_libgt=
1131
1132     dnl For backward compatibility. Some Makefiles may be using this.
1133     DATADIRNAME=share
1134     AC_SUBST(DATADIRNAME)
1135
1136     dnl For backward compatibility. Some Makefiles may be using this.
1137     INSTOBJEXT=.mo
1138     AC_SUBST(INSTOBJEXT)
1139
1140     dnl For backward compatibility. Some Makefiles may be using this.
1141     GENCAT=gencat
1142     AC_SUBST(GENCAT)
1143
1144     dnl Enable libtool support if the surrounding package wishes it.
1145     INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
1146     AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1147   ])
1148
1149   dnl For backward compatibility. Some Makefiles may be using this.
1150   INTLLIBS="$LIBINTL"
1151   AC_SUBST(INTLLIBS)
1152
1153   dnl Make all documented variables known to autoconf.
1154   AC_SUBST(LIBINTL)
1155   AC_SUBST(LTLIBINTL)
1156   AC_SUBST(POSUB)
1157 ])
1158
1159
1160 dnl Checks for all prerequisites of the po subdirectory,
1161 dnl except for USE_NLS.
1162 AC_DEFUN([AM_PO_SUBDIRS],
1163 [
1164   AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1165   AC_REQUIRE([AC_PROG_INSTALL])dnl
1166   AC_REQUIRE([AM_MKINSTALLDIRS])dnl
1167
1168   dnl Perform the following tests also if --disable-nls has been given,
1169   dnl because they are needed for "make dist" to work.
1170
1171   dnl Search for GNU msgfmt in the PATH.
1172   dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
1173   dnl The second test excludes FreeBSD msgfmt.
1174   AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1175     [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
1176      (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
1177     :)
1178   AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1179
1180   dnl Search for GNU xgettext 0.11 or newer in the PATH.
1181   dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
1182   dnl The second test excludes FreeBSD xgettext.
1183   AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1184     [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
1185      (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
1186     :)
1187   dnl Remove leftover from FreeBSD xgettext call.
1188   rm -f messages.po
1189
1190   dnl Search for GNU msgmerge 0.11 or newer in the PATH.
1191   AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
1192     [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
1193
1194   dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1195   dnl Test whether we really found GNU msgfmt.
1196   if test "$GMSGFMT" != ":"; then
1197     dnl If it is no GNU msgfmt we define it as : so that the
1198     dnl Makefiles still can work.
1199     if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
1200        (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
1201       : ;
1202     else
1203       GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
1204       AC_MSG_RESULT(
1205         [found $GMSGFMT program is not GNU msgfmt; ignore it])
1206       GMSGFMT=":"
1207     fi
1208   fi
1209
1210   dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1211   dnl Test whether we really found GNU xgettext.
1212   if test "$XGETTEXT" != ":"; then
1213     dnl If it is no GNU xgettext we define it as : so that the
1214     dnl Makefiles still can work.
1215     if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
1216        (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
1217       : ;
1218     else
1219       AC_MSG_RESULT(
1220         [found xgettext program is not GNU xgettext; ignore it])
1221       XGETTEXT=":"
1222     fi
1223     dnl Remove leftover from FreeBSD xgettext call.
1224     rm -f messages.po
1225   fi
1226
1227   AC_OUTPUT_COMMANDS([
1228     for ac_file in $CONFIG_FILES; do
1229       # Support "outfile[:infile[:infile...]]"
1230       case "$ac_file" in
1231         *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1232       esac
1233       # PO directories have a Makefile.in generated from Makefile.in.in.
1234       case "$ac_file" in */Makefile.in)
1235         # Adjust a relative srcdir.
1236         ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1237         ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1238         ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1239         # In autoconf-2.13 it is called $ac_given_srcdir.
1240         # In autoconf-2.50 it is called $srcdir.
1241         test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1242         case "$ac_given_srcdir" in
1243           .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1244           /*) top_srcdir="$ac_given_srcdir" ;;
1245           *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
1246         esac
1247         if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1248           rm -f "$ac_dir/POTFILES"
1249           test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1250           cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[   ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
1251           # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
1252           # on $ac_dir but don't depend on user-specified configuration
1253           # parameters.
1254           if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
1255             # The LINGUAS file contains the set of available languages.
1256             if test -n "$ALL_LINGUAS"; then
1257               test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
1258             fi
1259             ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
1260             # Hide the ALL_LINGUAS assigment from automake.
1261             eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
1262           fi
1263           case "$ac_given_srcdir" in
1264             .) srcdirpre= ;;
1265             *) srcdirpre='$(srcdir)/' ;;
1266           esac
1267           POFILES=
1268           GMOFILES=
1269           UPDATEPOFILES=
1270           DUMMYPOFILES=
1271           for lang in $ALL_LINGUAS; do
1272             POFILES="$POFILES $srcdirpre$lang.po"
1273             GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
1274             UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
1275             DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
1276           done
1277           # CATALOGS depends on both $ac_dir and the user's LINGUAS
1278           # environment variable.
1279           INST_LINGUAS=
1280           if test -n "$ALL_LINGUAS"; then
1281             for presentlang in $ALL_LINGUAS; do
1282               useit=no
1283               if test "%UNSET%" != "$LINGUAS"; then
1284                 desiredlanguages="$LINGUAS"
1285               else
1286                 desiredlanguages="$ALL_LINGUAS"
1287               fi
1288               for desiredlang in $desiredlanguages; do
1289                 # Use the presentlang catalog if desiredlang is
1290                 #   a. equal to presentlang, or
1291                 #   b. a variant of presentlang (because in this case,
1292                 #      presentlang can be used as a fallback for messages
1293                 #      which are not translated in the desiredlang catalog).
1294                 case "$desiredlang" in
1295                   "$presentlang"*) useit=yes;;
1296                 esac
1297               done
1298               if test $useit = yes; then
1299                 INST_LINGUAS="$INST_LINGUAS $presentlang"
1300               fi
1301             done
1302           fi
1303           CATALOGS=
1304           if test -n "$INST_LINGUAS"; then
1305             for lang in $INST_LINGUAS; do
1306               CATALOGS="$CATALOGS $lang.gmo"
1307             done
1308           fi
1309           test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1310           sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1311           for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
1312             if test -f "$f"; then
1313               case "$f" in
1314                 *.orig | *.bak | *~) ;;
1315                 *) cat "$f" >> "$ac_dir/Makefile" ;;
1316               esac
1317             fi
1318           done
1319         fi
1320         ;;
1321       esac
1322     done],
1323    [# Capture the value of obsolete $ALL_LINGUAS because we need it to compute
1324     # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
1325     # from automake.
1326     eval 'ALL_LINGUAS''="$ALL_LINGUAS"'
1327     # Capture the value of LINGUAS because we need it to compute CATALOGS.
1328     LINGUAS="${LINGUAS-%UNSET%}"
1329    ])
1330 ])
1331
1332
1333 dnl Checks for all prerequisites of the intl subdirectory,
1334 dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
1335 dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
1336 AC_DEFUN([AM_INTL_SUBDIR],
1337 [
1338   AC_REQUIRE([AC_PROG_INSTALL])dnl
1339   AC_REQUIRE([AM_MKINSTALLDIRS])dnl
1340   AC_REQUIRE([AC_PROG_CC])dnl
1341   AC_REQUIRE([AC_CANONICAL_HOST])dnl
1342   AC_REQUIRE([AC_PROG_RANLIB])dnl
1343   AC_REQUIRE([AC_ISC_POSIX])dnl
1344   AC_REQUIRE([AC_HEADER_STDC])dnl
1345   AC_REQUIRE([AC_C_CONST])dnl
1346   AC_REQUIRE([AC_C_INLINE])dnl
1347   AC_REQUIRE([AC_TYPE_OFF_T])dnl
1348   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1349   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1350   AC_REQUIRE([AC_FUNC_MMAP])dnl
1351   AC_REQUIRE([jm_GLIBC21])dnl
1352
1353   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1354 stdlib.h string.h unistd.h sys/param.h])
1355   AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
1356 geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
1357 strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1358
1359   AM_ICONV
1360   AM_LANGINFO_CODESET
1361   AM_LC_MESSAGES
1362
1363   dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1364   dnl because plural.y uses bison specific features. It requires at least
1365   dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1366   dnl compile.
1367   dnl bison is only needed for the maintainer (who touches plural.y). But in
1368   dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1369   dnl the rule in general Makefile. Now, some people carelessly touch the
1370   dnl files or have a broken "make" program, hence the plural.c rule will
1371   dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1372   dnl present or too old.
1373   AC_CHECK_PROGS([INTLBISON], [bison])
1374   if test -z "$INTLBISON"; then
1375     ac_verc_fail=yes
1376   else
1377     dnl Found it, now check the version.
1378     AC_MSG_CHECKING([version of bison])
1379 changequote(<<,>>)dnl
1380     ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1381     case $ac_prog_version in
1382       '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1383       1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1384 changequote([,])dnl
1385          ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1386       *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1387     esac
1388     AC_MSG_RESULT([$ac_prog_version])
1389   fi
1390   if test $ac_verc_fail = yes; then
1391     INTLBISON=:
1392   fi
1393 ])
1394
1395
1396 AC_DEFUN([AM_MKINSTALLDIRS],
1397 [
1398   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1399   dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1400   dnl Try to locate is.
1401   MKINSTALLDIRS=
1402   if test -n "$ac_aux_dir"; then
1403     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1404   fi
1405   if test -z "$MKINSTALLDIRS"; then
1406     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1407   fi
1408   AC_SUBST(MKINSTALLDIRS)
1409 ])
1410
1411 # lib-link.m4 serial 1 (gettext-0.11)
1412 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
1413 dnl This file is free software, distributed under the terms of the GNU
1414 dnl General Public License.  As a special exception to the GNU General
1415 dnl Public License, this file may be distributed as part of a program
1416 dnl that contains a configuration script generated by Autoconf, under
1417 dnl the same distribution terms as the rest of that program.
1418
1419 dnl From Bruno Haible.
1420
1421 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
1422 dnl the libraries corresponding to explicit and implicit dependencies.
1423 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
1424 dnl augments the CPPFLAGS variable.
1425 AC_DEFUN([AC_LIB_LINKFLAGS],
1426 [
1427   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1428   AC_REQUIRE([AC_LIB_RPATH])
1429   define([Name],[translit([$1],[./-], [___])])
1430   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1431                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1432   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1433     AC_LIB_LINKFLAGS_BODY([$1], [$2])
1434     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1435     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1436     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1437   ])
1438   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1439   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1440   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1441   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1442   AC_SUBST([LIB]NAME)
1443   AC_SUBST([LTLIB]NAME)
1444   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1445   dnl results of this search when this library appears as a dependency.
1446   HAVE_LIB[]NAME=yes
1447   undefine([Name])
1448   undefine([NAME])
1449 ])
1450
1451 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
1452 dnl searches for libname and the libraries corresponding to explicit and
1453 dnl implicit dependencies, together with the specified include files and
1454 dnl the ability to compile and link the specified testcode. If found, it
1455 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
1456 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1457 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1458 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1459 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1460 [
1461   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1462   AC_REQUIRE([AC_LIB_RPATH])
1463   define([Name],[translit([$1],[./-], [___])])
1464   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1465                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1466
1467   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1468   dnl accordingly.
1469   AC_LIB_LINKFLAGS_BODY([$1], [$2])
1470
1471   dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1472   dnl because if the user has installed lib[]Name and not disabled its use
1473   dnl via --without-lib[]Name-prefix, he wants to use it.
1474   ac_save_CPPFLAGS="$CPPFLAGS"
1475   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1476
1477   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1478     ac_save_LIBS="$LIBS"
1479     LIBS="$LIBS $LIB[]NAME"
1480     AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
1481     LIBS="$ac_save_LIBS"
1482   ])
1483   if test "$ac_cv_lib[]Name" = yes; then
1484     HAVE_LIB[]NAME=yes
1485     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
1486     AC_MSG_CHECKING([how to link with lib[]$1])
1487     AC_MSG_RESULT([$LIB[]NAME])
1488   else
1489     HAVE_LIB[]NAME=no
1490     dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1491     dnl $INC[]NAME either.
1492     CPPFLAGS="$ac_save_CPPFLAGS"
1493     LIB[]NAME=
1494     LTLIB[]NAME=
1495   fi
1496   AC_SUBST([HAVE_LIB]NAME)
1497   AC_SUBST([LIB]NAME)
1498   AC_SUBST([LTLIB]NAME)
1499   undefine([Name])
1500   undefine([NAME])
1501 ])
1502
1503 dnl Determine the platform dependent parameters needed to use rpath:
1504 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
1505 dnl hardcode_direct, hardcode_minus_L,
1506 dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec.
1507 AC_DEFUN([AC_LIB_RPATH],
1508 [
1509   AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1510   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1511   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1512   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1513   AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
1514     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1515     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1516     . ./conftest.sh
1517     rm -f ./conftest.sh
1518     acl_cv_rpath=done
1519   ])
1520   wl="$acl_cv_wl"
1521   libext="$acl_cv_libext"
1522   shlibext="$acl_cv_shlibext"
1523   hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1524   hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1525   hardcode_direct="$acl_cv_hardcode_direct"
1526   hardcode_minus_L="$acl_cv_hardcode_minus_L"
1527   sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec"
1528   sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec"
1529 ])
1530
1531 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1532 dnl the libraries corresponding to explicit and implicit dependencies.
1533 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1534 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1535 [
1536   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1537                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1538   dnl By default, look in $includedir and $libdir.
1539   use_additional=yes
1540   AC_LIB_WITH_FINAL_PREFIX([
1541     eval additional_includedir=\"$includedir\"
1542     eval additional_libdir=\"$libdir\"
1543   ])
1544   AC_ARG_WITH([lib$1-prefix],
1545 [  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
1546   --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
1547 [
1548     if test "X$withval" = "Xno"; then
1549       use_additional=no
1550     else
1551       if test "X$withval" = "X"; then
1552         AC_LIB_WITH_FINAL_PREFIX([
1553           eval additional_includedir=\"$includedir\"
1554           eval additional_libdir=\"$libdir\"
1555         ])
1556       else
1557         additional_includedir="$withval/include"
1558         additional_libdir="$withval/lib"
1559       fi
1560     fi
1561 ])
1562   dnl Search the library and its dependencies in $additional_libdir and
1563   dnl $LDFLAGS. Using breadth-first-seach.
1564   LIB[]NAME=
1565   LTLIB[]NAME=
1566   INC[]NAME=
1567   rpathdirs=
1568   ltrpathdirs=
1569   names_already_handled=
1570   names_next_round='$1 $2'
1571   while test -n "$names_next_round"; do
1572     names_this_round="$names_next_round"
1573     names_next_round=
1574     for name in $names_this_round; do
1575       already_handled=
1576       for n in $names_already_handled; do
1577         if test "$n" = "$name"; then
1578           already_handled=yes
1579           break
1580         fi
1581       done
1582       if test -z "$already_handled"; then
1583         names_already_handled="$names_already_handled $name"
1584         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1585         dnl or AC_LIB_HAVE_LINKFLAGS call.
1586         uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1587         eval value=\"\$HAVE_LIB$uppername\"
1588         if test -n "$value"; then
1589           if test "$value" = yes; then
1590             eval value=\"\$LIB$uppername\"
1591             test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1592             eval value=\"\$LTLIB$uppername\"
1593             test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1594           else
1595             dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1596             dnl that this library doesn't exist. So just drop it.
1597             :
1598           fi
1599         else
1600           dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1601           dnl and the already constructed $LIBNAME/$LTLIBNAME.
1602           found_dir=
1603           found_la=
1604           found_so=
1605           found_a=
1606           if test $use_additional = yes; then
1607             if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
1608               found_dir="$additional_libdir"
1609               found_so="$additional_libdir/lib$name.$shlibext"
1610               if test -f "$additional_libdir/lib$name.la"; then
1611                 found_la="$additional_libdir/lib$name.la"
1612               fi
1613             else
1614               if test -f "$additional_libdir/lib$name.$libext"; then
1615                 found_dir="$additional_libdir"
1616                 found_a="$additional_libdir/lib$name.$libext"
1617                 if test -f "$additional_libdir/lib$name.la"; then
1618                   found_la="$additional_libdir/lib$name.la"
1619                 fi
1620               fi
1621             fi
1622           fi
1623           if test "X$found_dir" = "X"; then
1624             for x in $LDFLAGS $LTLIB[]NAME; do
1625               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1626               case "$x" in
1627                 -L*)
1628                   dir=`echo "X$x" | sed -e 's/^X-L//'`
1629                   if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
1630                     found_dir="$dir"
1631                     found_so="$dir/lib$name.$shlibext"
1632                     if test -f "$dir/lib$name.la"; then
1633                       found_la="$dir/lib$name.la"
1634                     fi
1635                   else
1636                     if test -f "$dir/lib$name.$libext"; then
1637                       found_dir="$dir"
1638                       found_a="$dir/lib$name.$libext"
1639                       if test -f "$dir/lib$name.la"; then
1640                         found_la="$dir/lib$name.la"
1641                       fi
1642                     fi
1643                   fi
1644                   ;;
1645               esac
1646               if test "X$found_dir" != "X"; then
1647                 break
1648               fi
1649             done
1650           fi
1651           if test "X$found_dir" != "X"; then
1652             dnl Found the library.
1653             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1654             if test "X$found_so" != "X"; then
1655               dnl Linking with a shared library. We attempt to hardcode its
1656               dnl directory into the executable's runpath, unless it's the
1657               dnl standard /usr/lib.
1658               if test "X$found_dir" = "X/usr/lib"; then
1659                 dnl No hardcoding is needed.
1660                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1661               else
1662                 dnl Use an explicit option to hardcode DIR into the resulting
1663                 dnl binary.
1664                 dnl Potentially add DIR to ltrpathdirs.
1665                 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1666                 haveit=
1667                 for x in $ltrpathdirs; do
1668                   if test "X$x" = "X$found_dir"; then
1669                     haveit=yes
1670                     break
1671                   fi
1672                 done
1673                 if test -z "$haveit"; then
1674                   ltrpathdirs="$ltrpathdirs $found_dir"
1675                 fi
1676                 dnl The hardcoding into $LIBNAME is system dependent.
1677                 if test "$hardcode_direct" = yes; then
1678                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1679                   dnl resulting binary.
1680                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1681                 else
1682                   if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1683                     dnl Use an explicit option to hardcode DIR into the resulting
1684                     dnl binary.
1685                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1686                     dnl Potentially add DIR to rpathdirs.
1687                     dnl The rpathdirs will be appended to $LIBNAME at the end.
1688                     haveit=
1689                     for x in $rpathdirs; do
1690                       if test "X$x" = "X$found_dir"; then
1691                         haveit=yes
1692                         break
1693                       fi
1694                     done
1695                     if test -z "$haveit"; then
1696                       rpathdirs="$rpathdirs $found_dir"
1697                     fi
1698                   else
1699                     dnl Rely on "-L$found_dir".
1700                     dnl But don't add it if it's already contained in the LDFLAGS
1701                     dnl or the already constructed $LIBNAME
1702                     haveit=
1703                     for x in $LDFLAGS $LIB[]NAME; do
1704                       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1705                       if test "X$x" = "X-L$found_dir"; then
1706                         haveit=yes
1707                         break
1708                       fi
1709                     done
1710                     if test -z "$haveit"; then
1711                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1712                     fi
1713                     if test "$hardcode_minus_L" != no; then
1714                       dnl FIXME: Not sure whether we should use
1715                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1716                       dnl here.
1717                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1718                     else
1719                       dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
1720                       dnl here, because this doesn't fit in flags passed to the
1721                       dnl compiler. So give up. No hardcoding. This affects only
1722                       dnl very old systems.
1723                       dnl FIXME: Not sure whether we should use
1724                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1725                       dnl here.
1726                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1727                     fi
1728                   fi
1729                 fi
1730               fi
1731             else
1732               if test "X$found_a" != "X"; then
1733                 dnl Linking with a static library.
1734                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1735               else
1736                 dnl We shouldn't come here, but anyway it's good to have a
1737                 dnl fallback.
1738                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1739               fi
1740             fi
1741             dnl Assume the include files are nearby.
1742             additional_includedir=
1743             case "$found_dir" in
1744               */lib | */lib/)
1745                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
1746                 additional_includedir="$basedir/include"
1747                 ;;
1748             esac
1749             if test "X$additional_includedir" != "X"; then
1750               dnl Potentially add $additional_includedir to $INCNAME.
1751               dnl But don't add it
1752               dnl   1. if it's the standard /usr/include,
1753               dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1754               dnl   3. if it's already present in $CPPFLAGS or the already
1755               dnl      constructed $INCNAME,
1756               dnl   4. if it doesn't exist as a directory.
1757               if test "X$additional_includedir" != "X/usr/include"; then
1758                 haveit=
1759                 if test "X$additional_includedir" = "X/usr/local/include"; then
1760                   if test -n "$GCC"; then
1761                     case $host_os in
1762                       linux*) haveit=yes;;
1763                     esac
1764                   fi
1765                 fi
1766                 if test -z "$haveit"; then
1767                   for x in $CPPFLAGS $INC[]NAME; do
1768                     AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1769                     if test "X$x" = "X-I$additional_includedir"; then
1770                       haveit=yes
1771                       break
1772                     fi
1773                   done
1774                   if test -z "$haveit"; then
1775                     if test -d "$additional_includedir"; then
1776                       dnl Really add $additional_includedir to $INCNAME.
1777                       INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1778                     fi
1779                   fi
1780                 fi
1781               fi
1782             fi
1783             dnl Look for dependencies.
1784             if test -n "$found_la"; then
1785               dnl Read the .la file. It defines the variables
1786               dnl dlname, library_names, old_library, dependency_libs, current,
1787               dnl age, revision, installed, dlopen, dlpreopen, libdir.
1788               save_libdir="$libdir"
1789               case "$found_la" in
1790                 */* | *\\*) . "$found_la" ;;
1791                 *) . "./$found_la" ;;
1792               esac
1793               libdir="$save_libdir"
1794               dnl We use only dependency_libs.
1795               for dep in $dependency_libs; do
1796                 case "$dep" in
1797                   -L*)
1798                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1799                     dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1800                     dnl But don't add it
1801                     dnl   1. if it's the standard /usr/lib,
1802                     dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1803                     dnl   3. if it's already present in $LDFLAGS or the already
1804                     dnl      constructed $LIBNAME,
1805                     dnl   4. if it doesn't exist as a directory.
1806                     if test "X$additional_libdir" != "X/usr/lib"; then
1807                       haveit=
1808                       if test "X$additional_libdir" = "X/usr/local/lib"; then
1809                         if test -n "$GCC"; then
1810                           case $host_os in
1811                             linux*) haveit=yes;;
1812                           esac
1813                         fi
1814                       fi
1815                       if test -z "$haveit"; then
1816                         haveit=
1817                         for x in $LDFLAGS $LIB[]NAME; do
1818                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1819                           if test "X$x" = "X-L$additional_libdir"; then
1820                             haveit=yes
1821                             break
1822                           fi
1823                         done
1824                         if test -z "$haveit"; then
1825                           if test -d "$additional_libdir"; then
1826                             dnl Really add $additional_libdir to $LIBNAME.
1827                             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1828                           fi
1829                         fi
1830                         haveit=
1831                         for x in $LDFLAGS $LTLIB[]NAME; do
1832                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1833                           if test "X$x" = "X-L$additional_libdir"; then
1834                             haveit=yes
1835                             break
1836                           fi
1837                         done
1838                         if test -z "$haveit"; then
1839                           if test -d "$additional_libdir"; then
1840                             dnl Really add $additional_libdir to $LTLIBNAME.
1841                             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1842                           fi
1843                         fi
1844                       fi
1845                     fi
1846                     ;;
1847                   -l*)
1848                     dnl Handle this in the next round.
1849                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1850                     ;;
1851                   *.la)
1852                     dnl Handle this in the next round. Throw away the .la's
1853                     dnl directory; it is already contained in a preceding -L
1854                     dnl option.
1855                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1856                     ;;
1857                   *)
1858                     dnl Most likely an immediate library name.
1859                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1860                     LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1861                     ;;
1862                 esac
1863               done
1864             fi
1865           else
1866             dnl Didn't find the library; assume it is in the system directories
1867             dnl known to the linker and runtime loader. (All the system
1868             dnl directories known to the linker should also be known to the
1869             dnl runtime loader, otherwise the system is severely misconfigured.)
1870             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1871             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1872           fi
1873         fi
1874       fi
1875     done
1876   done
1877   if test "X$rpathdirs" != "X"; then
1878     if test -n "$hardcode_libdir_separator"; then
1879       dnl Weird platform: only the last -rpath option counts, the user must
1880       dnl pass all path elements in one option. We can arrange that for a
1881       dnl single library, but not when more than one $LIBNAMEs are used.
1882       alldirs=
1883       for found_dir in $rpathdirs; do
1884         alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
1885       done
1886       dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
1887       acl_save_libdir="$libdir"
1888       libdir="$alldirs"
1889       eval flag=\"$hardcode_libdir_flag_spec\"
1890       libdir="$acl_save_libdir"
1891       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1892     else
1893       dnl The -rpath options are cumulative.
1894       for found_dir in $rpathdirs; do
1895         acl_save_libdir="$libdir"
1896         libdir="$found_dir"
1897         eval flag=\"$hardcode_libdir_flag_spec\"
1898         libdir="$acl_save_libdir"
1899         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1900       done
1901     fi
1902   fi
1903   if test "X$ltrpathdirs" != "X"; then
1904     dnl When using libtool, the option that works for both libraries and
1905     dnl executables is -R. The -R options are cumulative.
1906     for found_dir in $ltrpathdirs; do
1907       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1908     done
1909   fi
1910 ])
1911
1912 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1913 dnl unless already present in VAR.
1914 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1915 dnl contains two or three consecutive elements that belong together.
1916 AC_DEFUN([AC_LIB_APPENDTOVAR],
1917 [
1918   for element in [$2]; do
1919     haveit=
1920     for x in $[$1]; do
1921       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1922       if test "X$x" = "X$element"; then
1923         haveit=yes
1924         break
1925       fi
1926     done
1927     if test -z "$haveit"; then
1928       [$1]="${[$1]}${[$1]:+ }$element"
1929     fi
1930   done
1931 ])
1932
1933 # lib-prefix.m4 serial 1 (gettext-0.11)
1934 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
1935 dnl This file is free software, distributed under the terms of the GNU
1936 dnl General Public License.  As a special exception to the GNU General
1937 dnl Public License, this file may be distributed as part of a program
1938 dnl that contains a configuration script generated by Autoconf, under
1939 dnl the same distribution terms as the rest of that program.
1940
1941 dnl From Bruno Haible.
1942
1943 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1944 dnl to access previously installed libraries. The basic assumption is that
1945 dnl a user will want packages to use other packages he previously installed
1946 dnl with the same --prefix option.
1947 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1948 dnl libraries, but is otherwise very convenient.
1949 AC_DEFUN([AC_LIB_PREFIX],
1950 [
1951   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1952   AC_REQUIRE([AC_PROG_CC])
1953   AC_REQUIRE([AC_CANONICAL_HOST])
1954   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1955   dnl By default, look in $includedir and $libdir.
1956   use_additional=yes
1957   AC_LIB_WITH_FINAL_PREFIX([
1958     eval additional_includedir=\"$includedir\"
1959     eval additional_libdir=\"$libdir\"
1960   ])
1961   AC_ARG_WITH([lib-prefix],
1962 [  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1963   --without-lib-prefix    don't search for libraries in includedir and libdir],
1964 [
1965     if test "X$withval" = "Xno"; then
1966       use_additional=no
1967     else
1968       if test "X$withval" = "X"; then
1969         AC_LIB_WITH_FINAL_PREFIX([
1970           eval additional_includedir=\"$includedir\"
1971           eval additional_libdir=\"$libdir\"
1972         ])
1973       else
1974         additional_includedir="$withval/include"
1975         additional_libdir="$withval/lib"
1976       fi
1977     fi
1978 ])
1979   if test $use_additional = yes; then
1980     dnl Potentially add $additional_includedir to $CPPFLAGS.
1981     dnl But don't add it
1982     dnl   1. if it's the standard /usr/include,
1983     dnl   2. if it's already present in $CPPFLAGS,
1984     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1985     dnl   4. if it doesn't exist as a directory.
1986     if test "X$additional_includedir" != "X/usr/include"; then
1987       haveit=
1988       for x in $CPPFLAGS; do
1989         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1990         if test "X$x" = "X-I$additional_includedir"; then
1991           haveit=yes
1992           break
1993         fi
1994       done
1995       if test -z "$haveit"; then
1996         if test "X$additional_includedir" = "X/usr/local/include"; then
1997           if test -n "$GCC"; then
1998             case $host_os in
1999               linux*) haveit=yes;;
2000             esac
2001           fi
2002         fi
2003         if test -z "$haveit"; then
2004           if test -d "$additional_includedir"; then
2005             dnl Really add $additional_includedir to $CPPFLAGS.
2006             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
2007           fi
2008         fi
2009       fi
2010     fi
2011     dnl Potentially add $additional_libdir to $LDFLAGS.
2012     dnl But don't add it
2013     dnl   1. if it's the standard /usr/lib,
2014     dnl   2. if it's already present in $LDFLAGS,
2015     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
2016     dnl   4. if it doesn't exist as a directory.
2017     if test "X$additional_libdir" != "X/usr/lib"; then
2018       haveit=
2019       for x in $LDFLAGS; do
2020         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2021         if test "X$x" = "X-L$additional_libdir"; then
2022           haveit=yes
2023           break
2024         fi
2025       done
2026       if test -z "$haveit"; then
2027         if test "X$additional_libdir" = "X/usr/local/lib"; then
2028           if test -n "$GCC"; then
2029             case $host_os in
2030               linux*) haveit=yes;;
2031             esac
2032           fi
2033         fi
2034         if test -z "$haveit"; then
2035           if test -d "$additional_libdir"; then
2036             dnl Really add $additional_libdir to $LDFLAGS.
2037             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
2038           fi
2039         fi
2040       fi
2041     fi
2042   fi
2043 ])
2044
2045 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
2046 dnl acl_final_exec_prefix, containing the values to which $prefix and
2047 dnl $exec_prefix will expand at the end of the configure script.
2048 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
2049 [
2050   dnl Unfortunately, prefix and exec_prefix get only finally determined
2051   dnl at the end of configure.
2052   if test "X$prefix" = "XNONE"; then
2053     acl_final_prefix="$ac_default_prefix"
2054   else
2055     acl_final_prefix="$prefix"
2056   fi
2057   if test "X$exec_prefix" = "XNONE"; then
2058     acl_final_exec_prefix='${prefix}'
2059   else
2060     acl_final_exec_prefix="$exec_prefix"
2061   fi
2062   acl_save_prefix="$prefix"
2063   prefix="$acl_final_prefix"
2064   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
2065   prefix="$acl_save_prefix"
2066 ])
2067
2068 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
2069 dnl variables prefix and exec_prefix bound to the values they will have
2070 dnl at the end of the configure script.
2071 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
2072 [
2073   acl_save_prefix="$prefix"
2074   prefix="$acl_final_prefix"
2075   acl_save_exec_prefix="$exec_prefix"
2076   exec_prefix="$acl_final_exec_prefix"
2077   $1
2078   exec_prefix="$acl_save_exec_prefix"
2079   prefix="$acl_save_prefix"
2080 ])
2081
2082 # lib-ld.m4 serial 1 (gettext-0.11)
2083 dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
2084 dnl This file is free software, distributed under the terms of the GNU
2085 dnl General Public License.  As a special exception to the GNU General
2086 dnl Public License, this file may be distributed as part of a program
2087 dnl that contains a configuration script generated by Autoconf, under
2088 dnl the same distribution terms as the rest of that program.
2089
2090 dnl Subroutines of libtool.m4,
2091 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
2092 dnl with libtool.m4.
2093
2094 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
2095 AC_DEFUN([AC_LIB_PROG_LD_GNU],
2096 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
2097 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
2098 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
2099   acl_cv_prog_gnu_ld=yes
2100 else
2101   acl_cv_prog_gnu_ld=no
2102 fi])
2103 with_gnu_ld=$acl_cv_prog_gnu_ld
2104 ])
2105
2106 dnl From libtool-1.4. Sets the variable LD.
2107 AC_DEFUN([AC_LIB_PROG_LD],
2108 [AC_ARG_WITH(gnu-ld,
2109 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
2110 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
2111 AC_REQUIRE([AC_PROG_CC])dnl
2112 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2113 ac_prog=ld
2114 if test "$GCC" = yes; then
2115   # Check if gcc -print-prog-name=ld gives a path.
2116   AC_MSG_CHECKING([for ld used by GCC])
2117   case $host in
2118   *-*-mingw*)
2119     # gcc leaves a trailing carriage return which upsets mingw
2120     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2121   *)
2122     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
2123   esac
2124   case $ac_prog in
2125     # Accept absolute paths.
2126     [[\\/]* | [A-Za-z]:[\\/]*)]
2127       [re_direlt='/[^/][^/]*/\.\./']
2128       # Canonicalize the path of ld
2129       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2130       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2131         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2132       done
2133       test -z "$LD" && LD="$ac_prog"
2134       ;;
2135   "")
2136     # If it fails, then pretend we aren't using GCC.
2137     ac_prog=ld
2138     ;;
2139   *)
2140     # If it is relative, then search for the first ld in PATH.
2141     with_gnu_ld=unknown
2142     ;;
2143   esac
2144 elif test "$with_gnu_ld" = yes; then
2145   AC_MSG_CHECKING([for GNU ld])
2146 else
2147   AC_MSG_CHECKING([for non-GNU ld])
2148 fi
2149 AC_CACHE_VAL(acl_cv_path_LD,
2150 [if test -z "$LD"; then
2151   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2152   for ac_dir in $PATH; do
2153     test -z "$ac_dir" && ac_dir=.
2154     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2155       acl_cv_path_LD="$ac_dir/$ac_prog"
2156       # Check to see if the program is GNU ld.  I'd rather use --version,
2157       # but apparently some GNU ld's only accept -v.
2158       # Break only if it was the GNU/non-GNU ld that we prefer.
2159       if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
2160         test "$with_gnu_ld" != no && break
2161       else
2162         test "$with_gnu_ld" != yes && break
2163       fi
2164     fi
2165   done
2166   IFS="$ac_save_ifs"
2167 else
2168   acl_cv_path_LD="$LD" # Let the user override the test with a path.
2169 fi])
2170 LD="$acl_cv_path_LD"
2171 if test -n "$LD"; then
2172   AC_MSG_RESULT($LD)
2173 else
2174   AC_MSG_RESULT(no)
2175 fi
2176 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2177 AC_LIB_PROG_LD_GNU
2178 ])
2179
2180 # iconv.m4 serial AM3 (gettext-0.11)
2181 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2182 dnl This file is free software, distributed under the terms of the GNU
2183 dnl General Public License.  As a special exception to the GNU General
2184 dnl Public License, this file may be distributed as part of a program
2185 dnl that contains a configuration script generated by Autoconf, under
2186 dnl the same distribution terms as the rest of that program.
2187
2188 dnl From Bruno Haible.
2189
2190 AC_DEFUN([AM_ICONV_LINK],
2191 [
2192   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2193   dnl those with the standalone portable GNU libiconv installed).
2194
2195   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2196   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2197   AC_REQUIRE([AC_LIB_RPATH])
2198
2199   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2200   dnl accordingly.
2201   AC_LIB_LINKFLAGS_BODY([iconv])
2202
2203   dnl Add $INCICONV to CPPFLAGS before performing the following checks,
2204   dnl because if the user has installed libiconv and not disabled its use
2205   dnl via --without-libiconv-prefix, he wants to use it. The first
2206   dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
2207   am_save_CPPFLAGS="$CPPFLAGS"
2208   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
2209
2210   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2211     am_cv_func_iconv="no, consider installing GNU libiconv"
2212     am_cv_lib_iconv=no
2213     AC_TRY_LINK([#include <stdlib.h>
2214 #include <iconv.h>],
2215       [iconv_t cd = iconv_open("","");
2216        iconv(cd,NULL,NULL,NULL,NULL);
2217        iconv_close(cd);],
2218       am_cv_func_iconv=yes)
2219     if test "$am_cv_func_iconv" != yes; then
2220       am_save_LIBS="$LIBS"
2221       LIBS="$LIBS $LIBICONV"
2222       AC_TRY_LINK([#include <stdlib.h>
2223 #include <iconv.h>],
2224         [iconv_t cd = iconv_open("","");
2225          iconv(cd,NULL,NULL,NULL,NULL);
2226          iconv_close(cd);],
2227         am_cv_lib_iconv=yes
2228         am_cv_func_iconv=yes)
2229       LIBS="$am_save_LIBS"
2230     fi
2231   ])
2232   if test "$am_cv_func_iconv" = yes; then
2233     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2234   fi
2235   if test "$am_cv_lib_iconv" = yes; then
2236     AC_MSG_CHECKING([how to link with libiconv])
2237     AC_MSG_RESULT([$LIBICONV])
2238   else
2239     dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
2240     dnl either.
2241     CPPFLAGS="$am_save_CPPFLAGS"
2242     LIBICONV=
2243     LTLIBICONV=
2244   fi
2245   AC_SUBST(LIBICONV)
2246   AC_SUBST(LTLIBICONV)
2247 ])
2248
2249 AC_DEFUN([AM_ICONV],
2250 [
2251   AC_REQUIRE([AM_ICONV_LINK])
2252   if test "$am_cv_func_iconv" = yes; then
2253     AC_MSG_CHECKING([for iconv declaration])
2254     AC_CACHE_VAL(am_cv_proto_iconv, [
2255       AC_TRY_COMPILE([
2256 #include <stdlib.h>
2257 #include <iconv.h>
2258 extern
2259 #ifdef __cplusplus
2260 "C"
2261 #endif
2262 #if defined(__STDC__) || defined(__cplusplus)
2263 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2264 #else
2265 size_t iconv();
2266 #endif
2267 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2268       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);"])
2269     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2270     AC_MSG_RESULT([$]{ac_t:-
2271          }[$]am_cv_proto_iconv)
2272     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2273       [Define as const if the declaration of iconv() needs const.])
2274   fi
2275 ])
2276
2277 # progtest.m4 serial 2 (gettext-0.10.40)
2278 dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
2279 dnl This file is free software, distributed under the terms of the GNU
2280 dnl General Public License.  As a special exception to the GNU General
2281 dnl Public License, this file may be distributed as part of a program
2282 dnl that contains a configuration script generated by Autoconf, under
2283 dnl the same distribution terms as the rest of that program.
2284 dnl
2285 dnl This file can can be used in projects which are not available under
2286 dnl the GNU General Public License or the GNU Library General Public
2287 dnl License but which still want to provide support for the GNU gettext
2288 dnl functionality.
2289 dnl Please note that the actual code of the GNU gettext library is covered
2290 dnl by the GNU Library General Public License, and the rest of the GNU
2291 dnl gettext package package is covered by the GNU General Public License.
2292 dnl They are *not* in the public domain.
2293
2294 dnl Authors:
2295 dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
2296
2297 # Search path for a program which passes the given test.
2298
2299 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2300 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2301 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2302 [# Extract the first word of "$2", so it can be a program name with args.
2303 set dummy $2; ac_word=[$]2
2304 AC_MSG_CHECKING([for $ac_word])
2305 AC_CACHE_VAL(ac_cv_path_$1,
2306 [case "[$]$1" in
2307   /*)
2308   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2309   ;;
2310   *)
2311   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2312   for ac_dir in ifelse([$5], , $PATH, [$5]); do
2313     test -z "$ac_dir" && ac_dir=.
2314     if test -f $ac_dir/$ac_word; then
2315       if [$3]; then
2316         ac_cv_path_$1="$ac_dir/$ac_word"
2317         break
2318       fi
2319     fi
2320   done
2321   IFS="$ac_save_ifs"
2322 dnl If no 4th arg is given, leave the cache variable unset,
2323 dnl so AC_PATH_PROGS will keep looking.
2324 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2325 ])dnl
2326   ;;
2327 esac])dnl
2328 $1="$ac_cv_path_$1"
2329 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
2330   AC_MSG_RESULT([$]$1)
2331 else
2332   AC_MSG_RESULT(no)
2333 fi
2334 AC_SUBST($1)dnl
2335 ])
2336
2337 # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
2338 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2339 dnl This file is free software, distributed under the terms of the GNU
2340 dnl General Public License.  As a special exception to the GNU General
2341 dnl Public License, this file may be distributed as part of a program
2342 dnl that contains a configuration script generated by Autoconf, under
2343 dnl the same distribution terms as the rest of that program.
2344
2345 # Test for the GNU C Library, version 2.1 or newer.
2346 # From Bruno Haible.
2347
2348 AC_DEFUN([jm_GLIBC21],
2349   [
2350     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2351       ac_cv_gnu_library_2_1,
2352       [AC_EGREP_CPP([Lucky GNU user],
2353         [
2354 #include <features.h>
2355 #ifdef __GNU_LIBRARY__
2356  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2357   Lucky GNU user
2358  #endif
2359 #endif
2360         ],
2361         ac_cv_gnu_library_2_1=yes,
2362         ac_cv_gnu_library_2_1=no)
2363       ]
2364     )
2365     AC_SUBST(GLIBC21)
2366     GLIBC21="$ac_cv_gnu_library_2_1"
2367   ]
2368 )
2369
2370 # codeset.m4 serial AM1 (gettext-0.10.40)
2371 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2372 dnl This file is free software, distributed under the terms of the GNU
2373 dnl General Public License.  As a special exception to the GNU General
2374 dnl Public License, this file may be distributed as part of a program
2375 dnl that contains a configuration script generated by Autoconf, under
2376 dnl the same distribution terms as the rest of that program.
2377
2378 dnl From Bruno Haible.
2379
2380 AC_DEFUN([AM_LANGINFO_CODESET],
2381 [
2382   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
2383     [AC_TRY_LINK([#include <langinfo.h>],
2384       [char* cs = nl_langinfo(CODESET);],
2385       am_cv_langinfo_codeset=yes,
2386       am_cv_langinfo_codeset=no)
2387     ])
2388   if test $am_cv_langinfo_codeset = yes; then
2389     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2390       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2391   fi
2392 ])
2393
2394 # lcmessage.m4 serial 2 (gettext-0.10.40)
2395 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2396 dnl This file is free software, distributed under the terms of the GNU
2397 dnl General Public License.  As a special exception to the GNU General
2398 dnl Public License, this file may be distributed as part of a program
2399 dnl that contains a configuration script generated by Autoconf, under
2400 dnl the same distribution terms as the rest of that program.
2401 dnl
2402 dnl This file can can be used in projects which are not available under
2403 dnl the GNU General Public License or the GNU Library General Public
2404 dnl License but which still want to provide support for the GNU gettext
2405 dnl functionality.
2406 dnl Please note that the actual code of the GNU gettext library is covered
2407 dnl by the GNU Library General Public License, and the rest of the GNU
2408 dnl gettext package package is covered by the GNU General Public License.
2409 dnl They are *not* in the public domain.
2410
2411 dnl Authors:
2412 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
2413
2414 # Check whether LC_MESSAGES is available in <locale.h>.
2415
2416 AC_DEFUN([AM_LC_MESSAGES],
2417   [if test $ac_cv_header_locale_h = yes; then
2418     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2419       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2420        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2421     if test $am_cv_val_LC_MESSAGES = yes; then
2422       AC_DEFINE(HAVE_LC_MESSAGES, 1,
2423         [Define if your <locale.h> file defines LC_MESSAGES.])
2424     fi
2425   fi])
2426