Initial revision
[gpiv.git] / aclocal.m4
blobf500a64c7baf828bbfdaa6d40604c4cd269daea7
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 # 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.
17 # serial 1
19 dnl Usage:
20 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
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])
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])])
47 # Check to make sure that the build environment is sane.
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
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
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])
86 rm -f conftest*
87 AC_MSG_RESULT(yes)])
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)
103 AC_SUBST($1)])
105 # Like AC_CONFIG_HEADER, but automatically create stamp file.
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([,]))])
128 # aclocal-include.m4
130 # This macro adds the name macrodir to the set of directories
131 # that `aclocal' searches for macros.  
133 # serial 1
135 dnl AM_ACLOCAL_INCLUDE(macrodir)
136 AC_DEFUN([AM_ACLOCAL_INCLUDE],
138         AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y)
140         test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
142         for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done
145 # Define a conditional.
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])
159 dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits])
161 dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
162 dnl is not found. 
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)
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         ])
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)
204         if test "x$want_gnome" = xyes; then
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
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
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               docklets)
265                 AC_SUBST(GNOME_DOCKLETS_LIBS)
266                 GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets`
267                 AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);;
268               capplet)
269                 AC_SUBST(GNOME_CAPPLET_LIBS)
270                 GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet`
271                 AC_MSG_RESULT($GNOME_CAPPLET_LIBS);;
272               *)
273                 AC_MSG_RESULT(unknown library)
274             esac
275           done
276         fi
280 dnl GNOME_INIT ([additional-inits])
283 AC_DEFUN([GNOME_INIT],[
284         GNOME_INIT_HOOK([],fail,$1)
288 dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag)
290 dnl if failflag is "failure" it aborts if gnorba is not found.
293 AC_DEFUN([GNOME_GNORBA_HOOK],[
294         GNOME_ORBIT_HOOK([],$2)
295         AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[
296                 gnome_cv_gnorba_found=no
297                 if test x$gnome_cv_orbit_found = xyes; then
298                         GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
299                         GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
300                         if test -n "$GNORBA_LIBS"; then
301                                 gnome_cv_gnorba_found=yes
302                         fi
303                 fi
304         ])
305         AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes)
306         if test x$gnome_cv_orbit_found = xyes; then
307                 $1
308                 GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
309                 GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
310                 AC_SUBST(GNORBA_CFLAGS)
311                 AC_SUBST(GNORBA_LIBS)
312         else
313                 if test x$2 = xfailure; then
314                         AC_MSG_ERROR(gnorba library not installed or installation problem)
315                 fi
316         fi
319 AC_DEFUN([GNOME_GNORBA_CHECK], [
320         GNOME_GNORBA_HOOK([],failure)
324 dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag)
326 dnl if failflag is "failure" it aborts if orbit is not found.
329 AC_DEFUN([GNOME_ORBIT_HOOK],[
330         AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no)
331         AC_PATH_PROG(ORBIT_IDL,orbit-idl,no)
332         AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[
333                 if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then
334                         gnome_cv_orbit_found=no
335                 else
336                         gnome_cv_orbit_found=yes
337                 fi
338         ])
339         AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes)
340         if test x$gnome_cv_orbit_found = xyes; then
341                 $1
342                 ORBIT_CFLAGS=`orbit-config --cflags client server`
343                 ORBIT_LIBS=`orbit-config --use-service=name --libs client server`
344                 AC_SUBST(ORBIT_CFLAGS)
345                 AC_SUBST(ORBIT_LIBS)
346         else
347                 if test x$2 = xfailure; then
348                         AC_MSG_ERROR(ORBit not installed or installation problem)
349                 fi
350         fi
353 AC_DEFUN([GNOME_ORBIT_CHECK], [
354         GNOME_ORBIT_HOOK([],failure)
357 #serial 1
358 # This test replaces the one in autoconf.
359 # Currently this macro should have the same name as the autoconf macro
360 # because gettext's gettext.m4 (distributed in the automake package)
361 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
362 # give these diagnostics:
363 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
364 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
366 undefine([AC_ISC_POSIX])
368 AC_DEFUN([AC_ISC_POSIX],
369   [
370     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
371     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
372   ]
376 # serial 1
378 # @defmac AC_PROG_CC_STDC
379 # @maindex PROG_CC_STDC
380 # @ovindex CC
381 # If the C compiler in not in ANSI C mode by default, try to add an option
382 # to output variable @code{CC} to make it so.  This macro tries various
383 # options that select ANSI C on some system or another.  It considers the
384 # compiler to be in ANSI C mode if it handles function prototypes correctly.
386 # If you use this macro, you should check after calling it whether the C
387 # compiler has been set to accept ANSI C; if not, the shell variable
388 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
389 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
390 # program @code{ansi2knr}, which comes with Ghostscript.
391 # @end defmac
393 AC_DEFUN(AM_PROG_CC_STDC,
394 [AC_REQUIRE([AC_PROG_CC])
395 AC_BEFORE([$0], [AC_C_INLINE])
396 AC_BEFORE([$0], [AC_C_CONST])
397 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
398 dnl a magic option to avoid problems with ANSI preprocessor commands
399 dnl like #elif.
400 dnl FIXME: can't do this because then AC_AIX won't work due to a
401 dnl circular dependency.
402 dnl AC_BEFORE([$0], [AC_PROG_CPP])
403 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
404 AC_CACHE_VAL(am_cv_prog_cc_stdc,
405 [am_cv_prog_cc_stdc=no
406 ac_save_CC="$CC"
407 # Don't try gcc -ansi; that turns off useful extensions and
408 # breaks some systems' header files.
409 # AIX                   -qlanglvl=ansi
410 # Ultrix and OSF/1      -std1
411 # HP-UX                 -Aa -D_HPUX_SOURCE
412 # SVR4                  -Xc -D__EXTENSIONS__
413 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
415   CC="$ac_save_CC $ac_arg"
416   AC_TRY_COMPILE(
417 [#include <stdarg.h>
418 #include <stdio.h>
419 #include <sys/types.h>
420 #include <sys/stat.h>
421 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
422 struct buf { int x; };
423 FILE * (*rcsopen) (struct buf *, struct stat *, int);
424 static char *e (p, i)
425      char **p;
426      int i;
428   return p[i];
430 static char *f (char * (*g) (char **, int), char **p, ...)
432   char *s;
433   va_list v;
434   va_start (v,p);
435   s = g (p, va_arg (v,int));
436   va_end (v);
437   return s;
439 int test (int i, double x);
440 struct s1 {int (*f) (int a);};
441 struct s2 {int (*f) (double a);};
442 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
443 int argc;
444 char **argv;
445 ], [
446 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
448 [am_cv_prog_cc_stdc="$ac_arg"; break])
449 done
450 CC="$ac_save_CC"
452 if test -z "$am_cv_prog_cc_stdc"; then
453   AC_MSG_RESULT([none needed])
454 else
455   AC_MSG_RESULT($am_cv_prog_cc_stdc)
457 case "x$am_cv_prog_cc_stdc" in
458   x|xno) ;;
459   *) CC="$CC $am_cv_prog_cc_stdc" ;;
460 esac
463 dnl GNOME_COMPILE_WARNINGS
464 dnl Turn on many useful compiler warnings
465 dnl For now, only works on GCC
466 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
467   AC_ARG_ENABLE(compile-warnings, 
468     [  --enable-compile-warnings=[no/minimum/yes]       Turn on compiler warnings.],,enable_compile_warnings=minimum)
470   AC_MSG_CHECKING(what warning flags to pass to the C compiler)
471   warnCFLAGS=
472   if test "x$GCC" != xyes; then
473     enable_compile_warnings=no
474   fi
476   if test "x$enable_compile_warnings" != "xno"; then
477     if test "x$GCC" = "xyes"; then
478       case " $CFLAGS " in
479       *[\ \     ]-Wall[\ \      ]*) ;;
480       *) warnCFLAGS="-Wall -Wunused" ;;
481       esac
483       ## -W is not all that useful.  And it cannot be controlled
484       ## with individual -Wno-xxx flags, unlike -Wall
485       if test "x$enable_compile_warnings" = "xyes"; then
486         warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations"
487       fi
488     fi
489   fi
490   AC_MSG_RESULT($warnCFLAGS)
492   AC_ARG_ENABLE(iso-c,
493     [  --enable-iso-c          Try to warn if code is not ISO C ],,
494     enable_iso_c=no)
496   AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
497   complCFLAGS=
498   if test "x$enable_iso_c" != "xno"; then
499     if test "x$GCC" = "xyes"; then
500       case " $CFLAGS " in
501       *[\ \     ]-ansi[\ \      ]*) ;;
502       *) complCFLAGS="$complCFLAGS -ansi" ;;
503       esac
505       case " $CFLAGS " in
506       *[\ \     ]-pedantic[\ \  ]*) ;;
507       *) complCFLAGS="$complCFLAGS -pedantic" ;;
508       esac
509     fi
510   fi
511   AC_MSG_RESULT($complCFLAGS)
512   if test "x$cflags_set" != "xyes"; then
513     CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS"
514     cflags_set=yes
515     AC_SUBST(cflags_set)
516   fi
519 dnl For C++, do basically the same thing.
521 AC_DEFUN([GNOME_CXX_WARNINGS],[
522   AC_ARG_ENABLE(cxx-warnings, 
523     [  --enable-cxx-warnings=[no/minimum/yes]   Turn on compiler warnings.],,enable_cxx_warnings=minimum)
525   AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
526   warnCXXFLAGS=
527   if test "x$GCC" != xyes; then
528     enable_compile_warnings=no
529   fi
530   if test "x$enable_cxx_warnings" != "xno"; then
531     if test "x$GCC" = "xyes"; then
532       case " $CXXFLAGS " in
533       *[\ \     ]-Wall[\ \      ]*) ;;
534       *) warnCXXFLAGS="-Wall -Wno-unused" ;;
535       esac
537       ## -W is not all that useful.  And it cannot be controlled
538       ## with individual -Wno-xxx flags, unlike -Wall
539       if test "x$enable_cxx_warnings" = "xyes"; then
540         warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual"
541       fi
542     fi
543   fi
544   AC_MSG_RESULT($warnCXXFLAGS)
546    AC_ARG_ENABLE(iso-cxx,
547      [  --enable-iso-cxx          Try to warn if code is not ISO C++ ],,
548      enable_iso_cxx=no)
550    AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
551    complCXXFLAGS=
552    if test "x$enable_iso_cxx" != "xno"; then
553      if test "x$GCC" = "xyes"; then
554       case " $CXXFLAGS " in
555       *[\ \     ]-ansi[\ \      ]*) ;;
556       *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
557       esac
559       case " $CXXFLAGS " in
560       *[\ \     ]-pedantic[\ \  ]*) ;;
561       *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
562       esac
563      fi
564    fi
565   AC_MSG_RESULT($complCXXFLAGS)
566   if test "x$cxxflags_set" != "xyes"; then
567     CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
568     cxxflags_set=yes
569     AC_SUBST(cxxflags_set)
570   fi
573 dnl GNOME_X_CHECKS
575 dnl Basic X11 related checks for X11.  At the end, the following will be
576 dnl defined/changed:
577 dnl   GTK_{CFLAGS,LIBS}      From AM_PATH_GTK
578 dnl   CPPFLAGS               Will include $X_CFLAGS
579 dnl   GNOME_HAVE_SM          `true' or `false' depending on whether session
580 dnl                          management is available.  It is available if
581 dnl                          both -lSM and X11/SM/SMlib.h exist.  (Some
582 dnl                          Solaris boxes have the library but not the header)
583 dnl   XPM_LIBS               -lXpm if Xpm library is present, otherwise ""
585 dnl The following configure cache variables are defined (but not used):
586 dnl   gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS}
588 AC_DEFUN([GNOME_X_CHECKS],
590         AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
591         dnl Hope that GTK_CFLAGS have only -I and -D.  Otherwise, we could
592         dnl   test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes"
593         dnl
594         dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses
595         dnl CPPFLAGS, not CFLAGS
596         CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
598         saved_ldflags="$LDFLAGS"
599         LDFLAGS="$LDFLAGS $GTK_LIBS"
601         gnome_cv_passdown_x_libs="$GTK_LIBS"
602         gnome_cv_passdown_X_LIBS="$GTK_LIBS"
603         gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS"
604         gnome_cv_passdown_GTK_LIBS="$GTK_LIBS"
606         LDFLAGS="$saved_ldflags $GTK_LIBS"
608 dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow.
609         USE_DEVGTK=true
611 dnl     AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x])
612 dnl     AC_EGREP_CPP(answer_affirmatively,
613 dnl     [#include <gtk/gtkfeatures.h>
614 dnl     #ifdef GTK_HAVE_FEATURES_1_1_0
615 dnl        answer_affirmatively
616 dnl     #endif
617 dnl     ], dev_gtk=yes, dev_gtk=no)
618 dnl     if test "$dev_gtk" = "yes"; then
619 dnl        USE_DEVGTK=true
620 dnl     fi
621 dnl     AC_MSG_RESULT("$dev_gtk")
623         GNOME_HAVE_SM=true
624         case "$GTK_LIBS" in
625          *-lSM*)
626             dnl Already found it.
627             ;;
628          *)
629             dnl Assume that if we have -lSM then we also have -lICE.
630             AC_CHECK_LIB(SM, SmcSaveYourselfDone,
631                 [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false,
632                 $x_libs -lICE)
633             ;;
634         esac
636         if test "$GNOME_HAVE_SM" = true; then
637            AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false)
638         fi
640         if test "$GNOME_HAVE_SM" = true; then
641            AC_DEFINE(HAVE_LIBSM)
642         fi
644         XPM_LIBS=""
645         AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
646         AC_SUBST(XPM_LIBS)
648         AC_REQUIRE([GNOME_PTHREAD_CHECK])
649         LDFLAGS="$saved_ldflags"
651         AC_PROVIDE([GNOME_X_CHECKS])
654 # Configure paths for GTK+
655 # Owen Taylor     97-11-3
657 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
658 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
660 AC_DEFUN(AM_PATH_GTK,
661 [dnl 
662 dnl Get the cflags and libraries from the gtk-config script
664 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
665             gtk_config_prefix="$withval", gtk_config_prefix="")
666 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
667             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
668 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
669                     , enable_gtktest=yes)
671   for module in . $4
672   do
673       case "$module" in
674          gthread) 
675              gtk_config_args="$gtk_config_args gthread"
676          ;;
677       esac
678   done
680   if test x$gtk_config_exec_prefix != x ; then
681      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
682      if test x${GTK_CONFIG+set} != xset ; then
683         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
684      fi
685   fi
686   if test x$gtk_config_prefix != x ; then
687      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
688      if test x${GTK_CONFIG+set} != xset ; then
689         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
690      fi
691   fi
693   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
694   min_gtk_version=ifelse([$1], ,0.99.7,$1)
695   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
696   no_gtk=""
697   if test "$GTK_CONFIG" = "no" ; then
698     no_gtk=yes
699   else
700     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
701     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
702     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
703            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
704     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
705            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
706     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
707            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
708     if test "x$enable_gtktest" = "xyes" ; then
709       ac_save_CFLAGS="$CFLAGS"
710       ac_save_LIBS="$LIBS"
711       CFLAGS="$CFLAGS $GTK_CFLAGS"
712       LIBS="$GTK_LIBS $LIBS"
714 dnl Now check if the installed GTK is sufficiently new. (Also sanity
715 dnl checks the results of gtk-config to some extent
717       rm -f conf.gtktest
718       AC_TRY_RUN([
719 #include <gtk/gtk.h>
720 #include <stdio.h>
721 #include <stdlib.h>
723 int 
724 main ()
726   int major, minor, micro;
727   char *tmp_version;
729   system ("touch conf.gtktest");
731   /* HP/UX 9 (%@#!) writes to sscanf strings */
732   tmp_version = g_strdup("$min_gtk_version");
733   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
734      printf("%s, bad version string\n", "$min_gtk_version");
735      exit(1);
736    }
738   if ((gtk_major_version != $gtk_config_major_version) ||
739       (gtk_minor_version != $gtk_config_minor_version) ||
740       (gtk_micro_version != $gtk_config_micro_version))
741     {
742       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
743              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
744              gtk_major_version, gtk_minor_version, gtk_micro_version);
745       printf ("*** was found! If gtk-config was correct, then it is best\n");
746       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
747       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
748       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
749       printf("*** required on your system.\n");
750       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
751       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
752       printf("*** before re-running configure\n");
753     } 
754 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
755   else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
756            (gtk_minor_version != GTK_MINOR_VERSION) ||
757            (gtk_micro_version != GTK_MICRO_VERSION))
758     {
759       printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
760              GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
761       printf("*** library (version %d.%d.%d)\n",
762              gtk_major_version, gtk_minor_version, gtk_micro_version);
763     }
764 #endif /* defined (GTK_MAJOR_VERSION) ... */
765   else
766     {
767       if ((gtk_major_version > major) ||
768         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
769         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
770       {
771         return 0;
772        }
773      else
774       {
775         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
776                gtk_major_version, gtk_minor_version, gtk_micro_version);
777         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
778                major, minor, micro);
779         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
780         printf("***\n");
781         printf("*** If you have already installed a sufficiently new version, this error\n");
782         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
783         printf("*** being found. The easiest way to fix this is to remove the old version\n");
784         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
785         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
786         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
787         printf("*** so that the correct libraries are found at run-time))\n");
788       }
789     }
790   return 1;
792 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
793        CFLAGS="$ac_save_CFLAGS"
794        LIBS="$ac_save_LIBS"
795      fi
796   fi
797   if test "x$no_gtk" = x ; then
798      AC_MSG_RESULT(yes)
799      ifelse([$2], , :, [$2])     
800   else
801      AC_MSG_RESULT(no)
802      if test "$GTK_CONFIG" = "no" ; then
803        echo "*** The gtk-config script installed by GTK could not be found"
804        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
805        echo "*** your path, or set the GTK_CONFIG environment variable to the"
806        echo "*** full path to gtk-config."
807      else
808        if test -f conf.gtktest ; then
809         :
810        else
811           echo "*** Could not run GTK test program, checking why..."
812           CFLAGS="$CFLAGS $GTK_CFLAGS"
813           LIBS="$LIBS $GTK_LIBS"
814           AC_TRY_LINK([
815 #include <gtk/gtk.h>
816 #include <stdio.h>
817 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
818         [ echo "*** The test program compiled, but did not run. This usually means"
819           echo "*** that the run-time linker is not finding GTK or finding the wrong"
820           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
821           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
822           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
823           echo "*** is required on your system"
824           echo "***"
825           echo "*** If you have an old version installed, it is best to remove it, although"
826           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
827           echo "***"
828           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
829           echo "*** came with the system with the command"
830           echo "***"
831           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
832         [ echo "*** The test program failed to compile or link. See the file config.log for the"
833           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
834           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
835           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
836           CFLAGS="$ac_save_CFLAGS"
837           LIBS="$ac_save_LIBS"
838        fi
839      fi
840      GTK_CFLAGS=""
841      GTK_LIBS=""
842      ifelse([$3], , :, [$3])
843   fi
844   AC_SUBST(GTK_CFLAGS)
845   AC_SUBST(GTK_LIBS)
846   rm -f conf.gtktest
850 dnl And better, use gthreads instead...
853 AC_DEFUN([GNOME_PTHREAD_CHECK],[
854         PTHREAD_LIB=""
855         AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
856                 [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
857                     [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
858                         [AC_CHECK_FUNC(pthread_create)]
859                     )]
860                 )]
861         )
862         AC_SUBST(PTHREAD_LIB)
863         AC_PROVIDE([GNOME_PTHREAD_CHECK])
866 # Macro to add for using GNU gettext.
867 # Ulrich Drepper <drepper@cygnus.com>, 1995.
869 # This file can be copied and used freely without restrictions.  It can
870 # be used in projects which are not available under the GNU General Public
871 # License or the GNU Library General Public License but which still want
872 # to provide support for the GNU gettext functionality.
873 # Please note that the actual code of the GNU gettext library is covered
874 # by the GNU Library General Public License, and the rest of the GNU
875 # gettext package package is covered by the GNU General Public License.
876 # They are *not* in the public domain.
878 # serial 10
880 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
881 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
882 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
883 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
884 dnl    AM-DISABLE-SHARED). Otherwise, a static library
885 dnl    $(top_builddir)/intl/libintl.a will be created.
886 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
887 dnl    implementations (in libc or libintl) without the ngettext() function
888 dnl    will be ignored.
889 dnl LIBDIR is used to find the intl libraries.  If empty,
890 dnl    the value `$(top_builddir)/intl/' is used.
892 dnl The result of the configuration is one of three cases:
893 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
894 dnl    and used.
895 dnl    Catalog format: GNU --> install in $(datadir)
896 dnl    Catalog extension: .mo after installation, .gmo in source tree
897 dnl 2) GNU gettext has been found in the system's C library.
898 dnl    Catalog format: GNU --> install in $(datadir)
899 dnl    Catalog extension: .mo after installation, .gmo in source tree
900 dnl 3) No internationalization, always use English msgid.
901 dnl    Catalog format: none
902 dnl    Catalog extension: none
903 dnl The use of .gmo is historical (it was needed to avoid overwriting the
904 dnl GNU format catalogs when building on a platform with an X/Open gettext),
905 dnl but we keep it in order not to force irrelevant filename changes on the
906 dnl maintainers.
908 AC_DEFUN([AM_WITH_NLS],
909   [AC_MSG_CHECKING([whether NLS is requested])
910     dnl Default is enabled NLS
911     AC_ARG_ENABLE(nls,
912       [  --disable-nls           do not use Native Language Support],
913       USE_NLS=$enableval, USE_NLS=yes)
914     AC_MSG_RESULT($USE_NLS)
915     AC_SUBST(USE_NLS)
917     BUILD_INCLUDED_LIBINTL=no
918     USE_INCLUDED_LIBINTL=no
919     INTLLIBS=
921     dnl If we use NLS figure out what method
922     if test "$USE_NLS" = "yes"; then
923       AC_DEFINE(ENABLE_NLS, 1,
924         [Define to 1 if translation of program messages to the user's native language
925    is requested.])
926       AC_MSG_CHECKING([whether included gettext is requested])
927       AC_ARG_WITH(included-gettext,
928         [  --with-included-gettext use the GNU gettext library included here],
929         nls_cv_force_use_gnu_gettext=$withval,
930         nls_cv_force_use_gnu_gettext=no)
931       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
933       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
934       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
935         dnl User does not insist on using GNU NLS library.  Figure out what
936         dnl to use.  If GNU gettext is available we use this.  Else we have
937         dnl to fall back to GNU NLS library.
938         CATOBJEXT=NONE
940         dnl Add a version number to the cache macros.
941         define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
942         define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
944         AC_CHECK_HEADER(libintl.h,
945           [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
946             [AC_TRY_LINK([#include <libintl.h>
947 extern int _nl_msg_cat_cntr;],
948                [bindtextdomain ("", "");
949 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
950                gt_cv_func_gnugettext_libc=yes,
951                gt_cv_func_gnugettext_libc=no)])
953            if test "$gt_cv_func_gnugettext_libc" != "yes"; then
954              AC_CACHE_CHECK([for GNU gettext in libintl],
955                gt_cv_func_gnugettext_libintl,
956                [gt_save_LIBS="$LIBS"
957                 LIBS="$LIBS -lintl $LIBICONV"
958                 AC_TRY_LINK([#include <libintl.h>
959 extern int _nl_msg_cat_cntr;],
960                   [bindtextdomain ("", "");
961 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
962                   gt_cv_func_gnugettext_libintl=yes,
963                   gt_cv_func_gnugettext_libintl=no)
964                 LIBS="$gt_save_LIBS"])
965            fi
967            dnl If an already present or preinstalled GNU gettext() is found,
968            dnl use it.  But if this macro is used in GNU gettext, and GNU
969            dnl gettext is already preinstalled in libintl, we update this
970            dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
971            if test "$gt_cv_func_gnugettext_libc" = "yes" \
972               || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
973                    && test "$PACKAGE" != gettext; }; then
974              AC_DEFINE(HAVE_GETTEXT, 1,
975                [Define if the GNU gettext() function is already present or preinstalled.])
977              if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
978                dnl If iconv() is in a separate libiconv library, then anyone
979                dnl linking with libintl{.a,.so} also needs to link with
980                dnl libiconv.
981                INTLLIBS="-lintl $LIBICONV"
982              fi
984              gt_save_LIBS="$LIBS"
985              LIBS="$LIBS $INTLLIBS"
986              AC_CHECK_FUNCS(dcgettext)
987              LIBS="$gt_save_LIBS"
989              dnl Search for GNU msgfmt in the PATH.
990              AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
991                [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
992              AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
994              dnl Search for GNU xgettext in the PATH.
995              AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
996                [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
998              CATOBJEXT=.gmo
999            fi
1000         ])
1002         if test "$CATOBJEXT" = "NONE"; then
1003           dnl GNU gettext is not found in the C library.
1004           dnl Fall back on GNU gettext library.
1005           nls_cv_use_gnu_gettext=yes
1006         fi
1007       fi
1009       if test "$nls_cv_use_gnu_gettext" = "yes"; then
1010         dnl Mark actions used to generate GNU NLS library.
1011         INTLOBJS="\$(GETTOBJS)"
1012         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1013           [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1014         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1015         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1016           [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1017         AC_SUBST(MSGFMT)
1018         BUILD_INCLUDED_LIBINTL=yes
1019         USE_INCLUDED_LIBINTL=yes
1020         CATOBJEXT=.gmo
1021         INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
1022         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1023       fi
1025       dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1026       dnl Test whether we really found GNU msgfmt.
1027       if test "$GMSGFMT" != ":"; then
1028         dnl If it is no GNU msgfmt we define it as : so that the
1029         dnl Makefiles still can work.
1030         if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
1031           : ;
1032         else
1033           AC_MSG_RESULT(
1034             [found msgfmt program is not GNU msgfmt; ignore it])
1035           GMSGFMT=":"
1036         fi
1037       fi
1039       dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1040       dnl Test whether we really found GNU xgettext.
1041       if test "$XGETTEXT" != ":"; then
1042         dnl If it is no GNU xgettext we define it as : so that the
1043         dnl Makefiles still can work.
1044         if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
1045           : ;
1046         else
1047           AC_MSG_RESULT(
1048             [found xgettext program is not GNU xgettext; ignore it])
1049           XGETTEXT=":"
1050         fi
1051       fi
1053       dnl We need to process the po/ directory.
1054       POSUB=po
1055     fi
1056     AC_OUTPUT_COMMANDS(
1057      [for ac_file in $CONFIG_FILES; do
1058         # Support "outfile[:infile[:infile...]]"
1059         case "$ac_file" in
1060           *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1061         esac
1062         # PO directories have a Makefile.in generated from Makefile.in.in.
1063         case "$ac_file" in */Makefile.in)
1064           # Adjust a relative srcdir.
1065           ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1066           ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1067           ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1068           # In autoconf-2.13 it is called $ac_given_srcdir.
1069           # In autoconf-2.50 it is called $srcdir.
1070           test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1071           case "$ac_given_srcdir" in
1072             .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1073             /*) top_srcdir="$ac_given_srcdir" ;;
1074             *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
1075           esac
1076           if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1077             rm -f "$ac_dir/POTFILES"
1078             test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1079             sed -e "/^#/d" -e "/^[      ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1080             test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1081             sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1082           fi
1083           ;;
1084         esac
1085       done])
1088     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1089     dnl to 'yes' because some of the testsuite requires it.
1090     if test "$PACKAGE" = gettext; then
1091       BUILD_INCLUDED_LIBINTL=yes
1092     fi
1094     dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1095     dnl because plural.y uses bison specific features. It requires at least
1096     dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1097     dnl compile.
1098     dnl bison is only needed for the maintainer (who touches plural.y). But in
1099     dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1100     dnl the rule in general Makefile. Now, some people carelessly touch the
1101     dnl files or have a broken "make" program, hence the plural.c rule will
1102     dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1103     dnl present or too old.
1104     AC_CHECK_PROGS([INTLBISON], [bison])
1105     if test -z "$INTLBISON"; then
1106       ac_verc_fail=yes
1107     else
1108       dnl Found it, now check the version.
1109       AC_MSG_CHECKING([version of bison])
1110 changequote(<<,>>)dnl
1111       ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1112       case $ac_prog_version in
1113         '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1114         1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1115 changequote([,])dnl
1116            ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1117         *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1118       esac
1119       AC_MSG_RESULT([$ac_prog_version])
1120     fi
1121     if test $ac_verc_fail = yes; then
1122       INTLBISON=:
1123     fi
1125     dnl These rules are solely for the distribution goal.  While doing this
1126     dnl we only have to keep exactly one list of the available catalogs
1127     dnl in configure.in.
1128     for lang in $ALL_LINGUAS; do
1129       GMOFILES="$GMOFILES $lang.gmo"
1130       POFILES="$POFILES $lang.po"
1131     done
1133     dnl Make all variables we use known to autoconf.
1134     AC_SUBST(BUILD_INCLUDED_LIBINTL)
1135     AC_SUBST(USE_INCLUDED_LIBINTL)
1136     AC_SUBST(CATALOGS)
1137     AC_SUBST(CATOBJEXT)
1138     AC_SUBST(GMOFILES)
1139     AC_SUBST(INTLLIBS)
1140     AC_SUBST(INTLOBJS)
1141     AC_SUBST(POFILES)
1142     AC_SUBST(POSUB)
1144     dnl For backward compatibility. Some configure.ins may be using this.
1145     nls_cv_header_intl=
1146     nls_cv_header_libgt=
1148     dnl For backward compatibility. Some Makefiles may be using this.
1149     DATADIRNAME=share
1150     AC_SUBST(DATADIRNAME)
1152     dnl For backward compatibility. Some Makefiles may be using this.
1153     INSTOBJEXT=.mo
1154     AC_SUBST(INSTOBJEXT)
1156     dnl For backward compatibility. Some Makefiles may be using this.
1157     GENCAT=gencat
1158     AC_SUBST(GENCAT)
1159   ])
1161 dnl Usage: Just like AM_WITH_NLS, which see.
1162 AC_DEFUN([AM_GNU_GETTEXT],
1163   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1164    AC_REQUIRE([AC_PROG_CC])dnl
1165    AC_REQUIRE([AC_CANONICAL_HOST])dnl
1166    AC_REQUIRE([AC_PROG_RANLIB])dnl
1167    AC_REQUIRE([AC_ISC_POSIX])dnl
1168    AC_REQUIRE([AC_HEADER_STDC])dnl
1169    AC_REQUIRE([AC_C_CONST])dnl
1170    AC_REQUIRE([AC_C_INLINE])dnl
1171    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1172    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1173    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1174    AC_REQUIRE([AC_FUNC_MMAP])dnl
1175    AC_REQUIRE([jm_GLIBC21])dnl
1177    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1178 stdlib.h string.h unistd.h sys/param.h])
1179    AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1180 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1181 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1183    AM_ICONV
1184    AM_LANGINFO_CODESET
1185    AM_LC_MESSAGES
1186    AM_WITH_NLS([$1],[$2],[$3])
1188    if test "x$CATOBJEXT" != "x"; then
1189      if test "x$ALL_LINGUAS" = "x"; then
1190        LINGUAS=
1191      else
1192        AC_MSG_CHECKING(for catalogs to be installed)
1193        NEW_LINGUAS=
1194        for presentlang in $ALL_LINGUAS; do
1195          useit=no
1196          for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
1197            # Use the presentlang catalog if desiredlang is
1198            #   a. equal to presentlang, or
1199            #   b. a variant of presentlang (because in this case,
1200            #      presentlang can be used as a fallback for messages
1201            #      which are not translated in the desiredlang catalog).
1202            case "$desiredlang" in
1203              "$presentlang"*) useit=yes;;
1204            esac
1205          done
1206          if test $useit = yes; then
1207            NEW_LINGUAS="$NEW_LINGUAS $presentlang"
1208          fi
1209        done
1210        LINGUAS=$NEW_LINGUAS
1211        AC_MSG_RESULT($LINGUAS)
1212      fi
1214      dnl Construct list of names of catalog files to be constructed.
1215      if test -n "$LINGUAS"; then
1216        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1217      fi
1218    fi
1220    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1221    dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1222    dnl Try to locate is.
1223    MKINSTALLDIRS=
1224    if test -n "$ac_aux_dir"; then
1225      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1226    fi
1227    if test -z "$MKINSTALLDIRS"; then
1228      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1229    fi
1230    AC_SUBST(MKINSTALLDIRS)
1232    dnl Enable libtool support if the surrounding package wishes it.
1233    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1234    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1235   ])
1237 # Search path for a program which passes the given test.
1238 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1240 # This file can be copied and used freely without restrictions.  It can
1241 # be used in projects which are not available under the GNU General Public
1242 # License or the GNU Library General Public License but which still want
1243 # to provide support for the GNU gettext functionality.
1244 # Please note that the actual code of the GNU gettext library is covered
1245 # by the GNU Library General Public License, and the rest of the GNU
1246 # gettext package package is covered by the GNU General Public License.
1247 # They are *not* in the public domain.
1249 # serial 2
1251 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1252 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1253 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
1254 [# Extract the first word of "$2", so it can be a program name with args.
1255 set dummy $2; ac_word=[$]2
1256 AC_MSG_CHECKING([for $ac_word])
1257 AC_CACHE_VAL(ac_cv_path_$1,
1258 [case "[$]$1" in
1259   /*)
1260   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1261   ;;
1262   *)
1263   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1264   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1265     test -z "$ac_dir" && ac_dir=.
1266     if test -f $ac_dir/$ac_word; then
1267       if [$3]; then
1268         ac_cv_path_$1="$ac_dir/$ac_word"
1269         break
1270       fi
1271     fi
1272   done
1273   IFS="$ac_save_ifs"
1274 dnl If no 4th arg is given, leave the cache variable unset,
1275 dnl so AC_PATH_PROGS will keep looking.
1276 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1277 ])dnl
1278   ;;
1279 esac])dnl
1280 $1="$ac_cv_path_$1"
1281 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1282   AC_MSG_RESULT([$]$1)
1283 else
1284   AC_MSG_RESULT(no)
1286 AC_SUBST($1)dnl
1289 #serial 2
1291 # Test for the GNU C Library, version 2.1 or newer.
1292 # From Bruno Haible.
1294 AC_DEFUN([jm_GLIBC21],
1295   [
1296     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
1297       ac_cv_gnu_library_2_1,
1298       [AC_EGREP_CPP([Lucky GNU user],
1299         [
1300 #include <features.h>
1301 #ifdef __GNU_LIBRARY__
1302  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
1303   Lucky GNU user
1304  #endif
1305 #endif
1306         ],
1307         ac_cv_gnu_library_2_1=yes,
1308         ac_cv_gnu_library_2_1=no)
1309       ]
1310     )
1311     AC_SUBST(GLIBC21)
1312     GLIBC21="$ac_cv_gnu_library_2_1"
1313   ]
1316 #serial AM2
1318 dnl From Bruno Haible.
1320 AC_DEFUN([AM_ICONV],
1322   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
1323   dnl those with the standalone portable GNU libiconv installed).
1325   AC_ARG_WITH([libiconv-prefix],
1326 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
1327     for dir in `echo "$withval" | tr : ' '`; do
1328       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
1329       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
1330     done
1331    ])
1333   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
1334     am_cv_func_iconv="no, consider installing GNU libiconv"
1335     am_cv_lib_iconv=no
1336     AC_TRY_LINK([#include <stdlib.h>
1337 #include <iconv.h>],
1338       [iconv_t cd = iconv_open("","");
1339        iconv(cd,NULL,NULL,NULL,NULL);
1340        iconv_close(cd);],
1341       am_cv_func_iconv=yes)
1342     if test "$am_cv_func_iconv" != yes; then
1343       am_save_LIBS="$LIBS"
1344       LIBS="$LIBS -liconv"
1345       AC_TRY_LINK([#include <stdlib.h>
1346 #include <iconv.h>],
1347         [iconv_t cd = iconv_open("","");
1348          iconv(cd,NULL,NULL,NULL,NULL);
1349          iconv_close(cd);],
1350         am_cv_lib_iconv=yes
1351         am_cv_func_iconv=yes)
1352       LIBS="$am_save_LIBS"
1353     fi
1354   ])
1355   if test "$am_cv_func_iconv" = yes; then
1356     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
1357     AC_MSG_CHECKING([for iconv declaration])
1358     AC_CACHE_VAL(am_cv_proto_iconv, [
1359       AC_TRY_COMPILE([
1360 #include <stdlib.h>
1361 #include <iconv.h>
1362 extern
1363 #ifdef __cplusplus
1365 #endif
1366 #if defined(__STDC__) || defined(__cplusplus)
1367 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1368 #else
1369 size_t iconv();
1370 #endif
1371 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
1372       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);"])
1373     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1374     AC_MSG_RESULT([$]{ac_t:-
1375          }[$]am_cv_proto_iconv)
1376     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
1377       [Define as const if the declaration of iconv() needs const.])
1378   fi
1379   LIBICONV=
1380   if test "$am_cv_lib_iconv" = yes; then
1381     LIBICONV="-liconv"
1382   fi
1383   AC_SUBST(LIBICONV)
1386 #serial AM1
1388 dnl From Bruno Haible.
1390 AC_DEFUN([AM_LANGINFO_CODESET],
1392   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
1393     [AC_TRY_LINK([#include <langinfo.h>],
1394       [char* cs = nl_langinfo(CODESET);],
1395       am_cv_langinfo_codeset=yes,
1396       am_cv_langinfo_codeset=no)
1397     ])
1398   if test $am_cv_langinfo_codeset = yes; then
1399     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
1400       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
1401   fi
1404 # Check whether LC_MESSAGES is available in <locale.h>.
1405 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1407 # This file can be copied and used freely without restrictions.  It can
1408 # be used in projects which are not available under the GNU General Public
1409 # License or the GNU Library General Public License but which still want
1410 # to provide support for the GNU gettext functionality.
1411 # Please note that the actual code of the GNU gettext library is covered
1412 # by the GNU Library General Public License, and the rest of the GNU
1413 # gettext package package is covered by the GNU General Public License.
1414 # They are *not* in the public domain.
1416 # serial 2
1418 AC_DEFUN([AM_LC_MESSAGES],
1419   [if test $ac_cv_header_locale_h = yes; then
1420     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1421       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1422        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1423     if test $am_cv_val_LC_MESSAGES = yes; then
1424       AC_DEFINE(HAVE_LC_MESSAGES, 1,
1425         [Define if your <locale.h> file defines LC_MESSAGES.])
1426     fi
1427   fi])