]> git.sur5r.net Git - glabels/blob - glabels1/aclocal.m4
Initial revision
[glabels] / glabels1 / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
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.
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
354 # serial 1
355
356 # @defmac AC_PROG_CC_STDC
357 # @maindex PROG_CC_STDC
358 # @ovindex CC
359 # If the C compiler in not in ANSI C mode by default, try to add an option
360 # to output variable @code{CC} to make it so.  This macro tries various
361 # options that select ANSI C on some system or another.  It considers the
362 # compiler to be in ANSI C mode if it handles function prototypes correctly.
363 #
364 # If you use this macro, you should check after calling it whether the C
365 # compiler has been set to accept ANSI C; if not, the shell variable
366 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
367 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
368 # program @code{ansi2knr}, which comes with Ghostscript.
369 # @end defmac
370
371 AC_DEFUN(AM_PROG_CC_STDC,
372 [AC_REQUIRE([AC_PROG_CC])
373 AC_BEFORE([$0], [AC_C_INLINE])
374 AC_BEFORE([$0], [AC_C_CONST])
375 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
376 dnl a magic option to avoid problems with ANSI preprocessor commands
377 dnl like #elif.
378 dnl FIXME: can't do this because then AC_AIX won't work due to a
379 dnl circular dependency.
380 dnl AC_BEFORE([$0], [AC_PROG_CPP])
381 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
382 AC_CACHE_VAL(am_cv_prog_cc_stdc,
383 [am_cv_prog_cc_stdc=no
384 ac_save_CC="$CC"
385 # Don't try gcc -ansi; that turns off useful extensions and
386 # breaks some systems' header files.
387 # AIX                   -qlanglvl=ansi
388 # Ultrix and OSF/1      -std1
389 # HP-UX                 -Aa -D_HPUX_SOURCE
390 # SVR4                  -Xc -D__EXTENSIONS__
391 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
392 do
393   CC="$ac_save_CC $ac_arg"
394   AC_TRY_COMPILE(
395 [#include <stdarg.h>
396 #include <stdio.h>
397 #include <sys/types.h>
398 #include <sys/stat.h>
399 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
400 struct buf { int x; };
401 FILE * (*rcsopen) (struct buf *, struct stat *, int);
402 static char *e (p, i)
403      char **p;
404      int i;
405 {
406   return p[i];
407 }
408 static char *f (char * (*g) (char **, int), char **p, ...)
409 {
410   char *s;
411   va_list v;
412   va_start (v,p);
413   s = g (p, va_arg (v,int));
414   va_end (v);
415   return s;
416 }
417 int test (int i, double x);
418 struct s1 {int (*f) (int a);};
419 struct s2 {int (*f) (double a);};
420 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
421 int argc;
422 char **argv;
423 ], [
424 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
425 ],
426 [am_cv_prog_cc_stdc="$ac_arg"; break])
427 done
428 CC="$ac_save_CC"
429 ])
430 if test -z "$am_cv_prog_cc_stdc"; then
431   AC_MSG_RESULT([none needed])
432 else
433   AC_MSG_RESULT($am_cv_prog_cc_stdc)
434 fi
435 case "x$am_cv_prog_cc_stdc" in
436   x|xno) ;;
437   *) CC="$CC $am_cv_prog_cc_stdc" ;;
438 esac
439 ])
440
441 dnl GNOME_COMPILE_WARNINGS
442 dnl Turn on many useful compiler warnings
443 dnl For now, only works on GCC
444 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
445   AC_ARG_ENABLE(compile-warnings, 
446     [  --enable-compile-warnings=[no/minimum/yes]       Turn on compiler warnings.],,enable_compile_warnings=minimum)
447
448   AC_MSG_CHECKING(what warning flags to pass to the C compiler)
449   warnCFLAGS=
450   if test "x$GCC" != xyes; then
451     enable_compile_warnings=no
452   fi
453
454   if test "x$enable_compile_warnings" != "xno"; then
455     if test "x$GCC" = "xyes"; then
456       case " $CFLAGS " in
457       *[\ \     ]-Wall[\ \      ]*) ;;
458       *) warnCFLAGS="-Wall -Wunused" ;;
459       esac
460
461       ## -W is not all that useful.  And it cannot be controlled
462       ## with individual -Wno-xxx flags, unlike -Wall
463       if test "x$enable_compile_warnings" = "xyes"; then
464         warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith"
465       fi
466     fi
467   fi
468   AC_MSG_RESULT($warnCFLAGS)
469
470   AC_ARG_ENABLE(iso-c,
471     [  --enable-iso-c          Try to warn if code is not ISO C ],,
472     enable_iso_c=no)
473
474   AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
475   complCFLAGS=
476   if test "x$enable_iso_c" != "xno"; then
477     if test "x$GCC" = "xyes"; then
478       case " $CFLAGS " in
479       *[\ \     ]-ansi[\ \      ]*) ;;
480       *) complCFLAGS="$complCFLAGS -ansi" ;;
481       esac
482
483       case " $CFLAGS " in
484       *[\ \     ]-pedantic[\ \  ]*) ;;
485       *) complCFLAGS="$complCFLAGS -pedantic" ;;
486       esac
487     fi
488   fi
489   AC_MSG_RESULT($complCFLAGS)
490   if test "x$cflags_set" != "xyes"; then
491     CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS"
492     cflags_set=yes
493     AC_SUBST(cflags_set)
494   fi
495 ])
496
497 dnl For C++, do basically the same thing.
498
499 AC_DEFUN([GNOME_CXX_WARNINGS],[
500   AC_ARG_ENABLE(cxx-warnings, 
501     [  --enable-cxx-warnings=[no/minimum/yes]   Turn on compiler warnings.],,enable_cxx_warnings=minimum)
502
503   AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
504   warnCXXFLAGS=
505   if test "x$GCC" != xyes; then
506     enable_compile_warnings=no
507   fi
508   if test "x$enable_cxx_warnings" != "xno"; then
509     if test "x$GCC" = "xyes"; then
510       case " $CXXFLAGS " in
511       *[\ \     ]-Wall[\ \      ]*) ;;
512       *) warnCXXFLAGS="-Wall -Wno-unused" ;;
513       esac
514
515       ## -W is not all that useful.  And it cannot be controlled
516       ## with individual -Wno-xxx flags, unlike -Wall
517       if test "x$enable_cxx_warnings" = "xyes"; then
518         warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wshadow -Woverloaded-virtual"
519       fi
520     fi
521   fi
522   AC_MSG_RESULT($warnCXXFLAGS)
523
524    AC_ARG_ENABLE(iso-cxx,
525      [  --enable-iso-cxx          Try to warn if code is not ISO C++ ],,
526      enable_iso_cxx=no)
527
528    AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
529    complCXXFLAGS=
530    if test "x$enable_iso_cxx" != "xno"; then
531      if test "x$GCC" = "xyes"; then
532       case " $CXXFLAGS " in
533       *[\ \     ]-ansi[\ \      ]*) ;;
534       *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
535       esac
536
537       case " $CXXFLAGS " in
538       *[\ \     ]-pedantic[\ \  ]*) ;;
539       *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
540       esac
541      fi
542    fi
543   AC_MSG_RESULT($complCXXFLAGS)
544   if test "x$cxxflags_set" != "xyes"; then
545     CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
546     cxxflags_set=yes
547     AC_SUBST(cxxflags_set)
548   fi
549 ])
550
551 dnl GNOME_X_CHECKS
552 dnl
553 dnl Basic X11 related checks for X11.  At the end, the following will be
554 dnl defined/changed:
555 dnl   GTK_{CFLAGS,LIBS}      From AM_PATH_GTK
556 dnl   CPPFLAGS               Will include $X_CFLAGS
557 dnl   GNOME_HAVE_SM          `true' or `false' depending on whether session
558 dnl                          management is available.  It is available if
559 dnl                          both -lSM and X11/SM/SMlib.h exist.  (Some
560 dnl                          Solaris boxes have the library but not the header)
561 dnl   XPM_LIBS               -lXpm if Xpm library is present, otherwise ""
562 dnl
563 dnl The following configure cache variables are defined (but not used):
564 dnl   gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS}
565 dnl
566 AC_DEFUN([GNOME_X_CHECKS],
567 [
568         AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
569         dnl Hope that GTK_CFLAGS have only -I and -D.  Otherwise, we could
570         dnl   test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes"
571         dnl
572         dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses
573         dnl CPPFLAGS, not CFLAGS
574         CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
575
576         saved_ldflags="$LDFLAGS"
577         LDFLAGS="$LDFLAGS $GTK_LIBS"
578
579         gnome_cv_passdown_x_libs="$GTK_LIBS"
580         gnome_cv_passdown_X_LIBS="$GTK_LIBS"
581         gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS"
582         gnome_cv_passdown_GTK_LIBS="$GTK_LIBS"
583
584         LDFLAGS="$saved_ldflags $GTK_LIBS"
585
586 dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow.
587         USE_DEVGTK=true
588
589 dnl     AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x])
590 dnl     AC_EGREP_CPP(answer_affirmatively,
591 dnl     [#include <gtk/gtkfeatures.h>
592 dnl     #ifdef GTK_HAVE_FEATURES_1_1_0
593 dnl        answer_affirmatively
594 dnl     #endif
595 dnl     ], dev_gtk=yes, dev_gtk=no)
596 dnl     if test "$dev_gtk" = "yes"; then
597 dnl        USE_DEVGTK=true
598 dnl     fi
599 dnl     AC_MSG_RESULT("$dev_gtk")
600
601         GNOME_HAVE_SM=true
602         case "$GTK_LIBS" in
603          *-lSM*)
604             dnl Already found it.
605             ;;
606          *)
607             dnl Assume that if we have -lSM then we also have -lICE.
608             AC_CHECK_LIB(SM, SmcSaveYourselfDone,
609                 [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false,
610                 $x_libs -lICE)
611             ;;
612         esac
613
614         if test "$GNOME_HAVE_SM" = true; then
615            AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false)
616         fi
617
618         if test "$GNOME_HAVE_SM" = true; then
619            AC_DEFINE(HAVE_LIBSM)
620         fi
621
622         XPM_LIBS=""
623         AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
624         AC_SUBST(XPM_LIBS)
625
626         AC_REQUIRE([GNOME_PTHREAD_CHECK])
627         LDFLAGS="$saved_ldflags"
628
629         AC_PROVIDE([GNOME_X_CHECKS])
630 ])
631
632 # Configure paths for GTK+
633 # Owen Taylor     97-11-3
634
635 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
636 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
637 dnl
638 AC_DEFUN(AM_PATH_GTK,
639 [dnl 
640 dnl Get the cflags and libraries from the gtk-config script
641 dnl
642 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
643             gtk_config_prefix="$withval", gtk_config_prefix="")
644 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
645             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
646 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
647                     , enable_gtktest=yes)
648
649   for module in . $4
650   do
651       case "$module" in
652          gthread) 
653              gtk_config_args="$gtk_config_args gthread"
654          ;;
655       esac
656   done
657
658   if test x$gtk_config_exec_prefix != x ; then
659      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
660      if test x${GTK_CONFIG+set} != xset ; then
661         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
662      fi
663   fi
664   if test x$gtk_config_prefix != x ; then
665      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
666      if test x${GTK_CONFIG+set} != xset ; then
667         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
668      fi
669   fi
670
671   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
672   min_gtk_version=ifelse([$1], ,0.99.7,$1)
673   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
674   no_gtk=""
675   if test "$GTK_CONFIG" = "no" ; then
676     no_gtk=yes
677   else
678     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
679     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
680     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
681            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
682     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
683            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
684     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
685            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
686     if test "x$enable_gtktest" = "xyes" ; then
687       ac_save_CFLAGS="$CFLAGS"
688       ac_save_LIBS="$LIBS"
689       CFLAGS="$CFLAGS $GTK_CFLAGS"
690       LIBS="$GTK_LIBS $LIBS"
691 dnl
692 dnl Now check if the installed GTK is sufficiently new. (Also sanity
693 dnl checks the results of gtk-config to some extent
694 dnl
695       rm -f conf.gtktest
696       AC_TRY_RUN([
697 #include <gtk/gtk.h>
698 #include <stdio.h>
699 #include <stdlib.h>
700
701 int 
702 main ()
703 {
704   int major, minor, micro;
705   char *tmp_version;
706
707   system ("touch conf.gtktest");
708
709   /* HP/UX 9 (%@#!) writes to sscanf strings */
710   tmp_version = g_strdup("$min_gtk_version");
711   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
712      printf("%s, bad version string\n", "$min_gtk_version");
713      exit(1);
714    }
715
716   if ((gtk_major_version != $gtk_config_major_version) ||
717       (gtk_minor_version != $gtk_config_minor_version) ||
718       (gtk_micro_version != $gtk_config_micro_version))
719     {
720       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
721              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
722              gtk_major_version, gtk_minor_version, gtk_micro_version);
723       printf ("*** was found! If gtk-config was correct, then it is best\n");
724       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
725       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
726       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
727       printf("*** required on your system.\n");
728       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
729       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
730       printf("*** before re-running configure\n");
731     } 
732 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
733   else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
734            (gtk_minor_version != GTK_MINOR_VERSION) ||
735            (gtk_micro_version != GTK_MICRO_VERSION))
736     {
737       printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
738              GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
739       printf("*** library (version %d.%d.%d)\n",
740              gtk_major_version, gtk_minor_version, gtk_micro_version);
741     }
742 #endif /* defined (GTK_MAJOR_VERSION) ... */
743   else
744     {
745       if ((gtk_major_version > major) ||
746         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
747         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
748       {
749         return 0;
750        }
751      else
752       {
753         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
754                gtk_major_version, gtk_minor_version, gtk_micro_version);
755         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
756                major, minor, micro);
757         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
758         printf("***\n");
759         printf("*** If you have already installed a sufficiently new version, this error\n");
760         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
761         printf("*** being found. The easiest way to fix this is to remove the old version\n");
762         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
763         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
764         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
765         printf("*** so that the correct libraries are found at run-time))\n");
766       }
767     }
768   return 1;
769 }
770 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
771        CFLAGS="$ac_save_CFLAGS"
772        LIBS="$ac_save_LIBS"
773      fi
774   fi
775   if test "x$no_gtk" = x ; then
776      AC_MSG_RESULT(yes)
777      ifelse([$2], , :, [$2])     
778   else
779      AC_MSG_RESULT(no)
780      if test "$GTK_CONFIG" = "no" ; then
781        echo "*** The gtk-config script installed by GTK could not be found"
782        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
783        echo "*** your path, or set the GTK_CONFIG environment variable to the"
784        echo "*** full path to gtk-config."
785      else
786        if test -f conf.gtktest ; then
787         :
788        else
789           echo "*** Could not run GTK test program, checking why..."
790           CFLAGS="$CFLAGS $GTK_CFLAGS"
791           LIBS="$LIBS $GTK_LIBS"
792           AC_TRY_LINK([
793 #include <gtk/gtk.h>
794 #include <stdio.h>
795 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
796         [ echo "*** The test program compiled, but did not run. This usually means"
797           echo "*** that the run-time linker is not finding GTK or finding the wrong"
798           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
799           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
800           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
801           echo "*** is required on your system"
802           echo "***"
803           echo "*** If you have an old version installed, it is best to remove it, although"
804           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
805           echo "***"
806           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
807           echo "*** came with the system with the command"
808           echo "***"
809           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
810         [ echo "*** The test program failed to compile or link. See the file config.log for the"
811           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
812           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
813           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
814           CFLAGS="$ac_save_CFLAGS"
815           LIBS="$ac_save_LIBS"
816        fi
817      fi
818      GTK_CFLAGS=""
819      GTK_LIBS=""
820      ifelse([$3], , :, [$3])
821   fi
822   AC_SUBST(GTK_CFLAGS)
823   AC_SUBST(GTK_LIBS)
824   rm -f conf.gtktest
825 ])
826
827 dnl
828 dnl And better, use gthreads instead...
829 dnl
830
831 AC_DEFUN([GNOME_PTHREAD_CHECK],[
832         PTHREAD_LIB=""
833         AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
834                 [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
835                     [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
836                         [AC_CHECK_FUNC(pthread_create)]
837                     )]
838                 )]
839         )
840         AC_SUBST(PTHREAD_LIB)
841         AC_PROVIDE([GNOME_PTHREAD_CHECK])
842 ])
843
844 # Macro to add for using GNU gettext.
845 # Ulrich Drepper <drepper@cygnus.com>, 1995.
846 #
847 # This file can be copied and used freely without restrictions.  It can
848 # be used in projects which are not available under the GNU Public License
849 # but which still want to provide support for the GNU gettext functionality.
850 # Please note that the actual code is *not* freely available.
851
852 # serial 5
853
854 AC_DEFUN(AM_WITH_NLS,
855   [AC_MSG_CHECKING([whether NLS is requested])
856     dnl Default is enabled NLS
857     AC_ARG_ENABLE(nls,
858       [  --disable-nls           do not use Native Language Support],
859       USE_NLS=$enableval, USE_NLS=yes)
860     AC_MSG_RESULT($USE_NLS)
861     AC_SUBST(USE_NLS)
862
863     USE_INCLUDED_LIBINTL=no
864
865     dnl If we use NLS figure out what method
866     if test "$USE_NLS" = "yes"; then
867       AC_DEFINE(ENABLE_NLS)
868       AC_MSG_CHECKING([whether included gettext is requested])
869       AC_ARG_WITH(included-gettext,
870         [  --with-included-gettext use the GNU gettext library included here],
871         nls_cv_force_use_gnu_gettext=$withval,
872         nls_cv_force_use_gnu_gettext=no)
873       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
874
875       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
876       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
877         dnl User does not insist on using GNU NLS library.  Figure out what
878         dnl to use.  If gettext or catgets are available (in this order) we
879         dnl use this.  Else we have to fall back to GNU NLS library.
880         dnl catgets is only used if permitted by option --with-catgets.
881         nls_cv_header_intl=
882         nls_cv_header_libgt=
883         CATOBJEXT=NONE
884
885         AC_CHECK_HEADER(libintl.h,
886           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
887             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
888                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
889
890            if test "$gt_cv_func_gettext_libc" != "yes"; then
891              AC_CHECK_LIB(intl, bindtextdomain,
892                [AC_CACHE_CHECK([for gettext in libintl],
893                  gt_cv_func_gettext_libintl,
894                  [AC_CHECK_LIB(intl, gettext,
895                   gt_cv_func_gettext_libintl=yes,
896                   gt_cv_func_gettext_libintl=no)],
897                  gt_cv_func_gettext_libintl=no)])
898            fi
899
900            if test "$gt_cv_func_gettext_libc" = "yes" \
901               || test "$gt_cv_func_gettext_libintl" = "yes"; then
902               AC_DEFINE(HAVE_GETTEXT)
903               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
904                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
905               if test "$MSGFMT" != "no"; then
906                 AC_CHECK_FUNCS(dcgettext)
907                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
908                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
909                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
910                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
911                                return _nl_msg_cat_cntr],
912                   [CATOBJEXT=.gmo
913                    DATADIRNAME=share],
914                   [CATOBJEXT=.mo
915                    DATADIRNAME=lib])
916                 INSTOBJEXT=.mo
917               fi
918             fi
919         ])
920
921         if test "$CATOBJEXT" = "NONE"; then
922           AC_MSG_CHECKING([whether catgets can be used])
923           AC_ARG_WITH(catgets,
924             [  --with-catgets          use catgets functions if available],
925             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
926           AC_MSG_RESULT($nls_cv_use_catgets)
927
928           if test "$nls_cv_use_catgets" = "yes"; then
929             dnl No gettext in C library.  Try catgets next.
930             AC_CHECK_LIB(i, main)
931             AC_CHECK_FUNC(catgets,
932               [AC_DEFINE(HAVE_CATGETS)
933                INTLOBJS="\$(CATOBJS)"
934                AC_PATH_PROG(GENCAT, gencat, no)dnl
935                if test "$GENCAT" != "no"; then
936                  AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
937                  if test "$GMSGFMT" = "no"; then
938                    AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
939                     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
940                  fi
941                  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
942                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
943                  USE_INCLUDED_LIBINTL=yes
944                  CATOBJEXT=.cat
945                  INSTOBJEXT=.cat
946                  DATADIRNAME=lib
947                  INTLDEPS='$(top_builddir)/intl/libintl.a'
948                  INTLLIBS=$INTLDEPS
949                  LIBS=`echo $LIBS | sed -e 's/-lintl//'`
950                  nls_cv_header_intl=intl/libintl.h
951                  nls_cv_header_libgt=intl/libgettext.h
952                fi])
953           fi
954         fi
955
956         if test "$CATOBJEXT" = "NONE"; then
957           dnl Neither gettext nor catgets in included in the C library.
958           dnl Fall back on GNU gettext library.
959           nls_cv_use_gnu_gettext=yes
960         fi
961       fi
962
963       if test "$nls_cv_use_gnu_gettext" = "yes"; then
964         dnl Mark actions used to generate GNU NLS library.
965         INTLOBJS="\$(GETTOBJS)"
966         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
967           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
968         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
969         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
970           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
971         AC_SUBST(MSGFMT)
972         USE_INCLUDED_LIBINTL=yes
973         CATOBJEXT=.gmo
974         INSTOBJEXT=.mo
975         DATADIRNAME=share
976         INTLDEPS='$(top_builddir)/intl/libintl.a'
977         INTLLIBS=$INTLDEPS
978         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
979         nls_cv_header_intl=intl/libintl.h
980         nls_cv_header_libgt=intl/libgettext.h
981       fi
982
983       dnl Test whether we really found GNU xgettext.
984       if test "$XGETTEXT" != ":"; then
985         dnl If it is no GNU xgettext we define it as : so that the
986         dnl Makefiles still can work.
987         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
988           : ;
989         else
990           AC_MSG_RESULT(
991             [found xgettext program is not GNU xgettext; ignore it])
992           XGETTEXT=":"
993         fi
994       fi
995
996       # We need to process the po/ directory.
997       POSUB=po
998     else
999       DATADIRNAME=share
1000       nls_cv_header_intl=intl/libintl.h
1001       nls_cv_header_libgt=intl/libgettext.h
1002     fi
1003     AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
1004     AC_OUTPUT_COMMANDS(
1005      [case "$CONFIG_FILES" in *po/Makefile.in*)
1006         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
1007       esac])
1008
1009
1010     # If this is used in GNU gettext we have to set USE_NLS to `yes'
1011     # because some of the sources are only built for this goal.
1012     if test "$PACKAGE" = gettext; then
1013       USE_NLS=yes
1014       USE_INCLUDED_LIBINTL=yes
1015     fi
1016
1017     dnl These rules are solely for the distribution goal.  While doing this
1018     dnl we only have to keep exactly one list of the available catalogs
1019     dnl in configure.in.
1020     for lang in $ALL_LINGUAS; do
1021       GMOFILES="$GMOFILES $lang.gmo"
1022       POFILES="$POFILES $lang.po"
1023     done
1024
1025     dnl Make all variables we use known to autoconf.
1026     AC_SUBST(USE_INCLUDED_LIBINTL)
1027     AC_SUBST(CATALOGS)
1028     AC_SUBST(CATOBJEXT)
1029     AC_SUBST(DATADIRNAME)
1030     AC_SUBST(GMOFILES)
1031     AC_SUBST(INSTOBJEXT)
1032     AC_SUBST(INTLDEPS)
1033     AC_SUBST(INTLLIBS)
1034     AC_SUBST(INTLOBJS)
1035     AC_SUBST(POFILES)
1036     AC_SUBST(POSUB)
1037   ])
1038
1039 AC_DEFUN(AM_GNU_GETTEXT,
1040   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1041    AC_REQUIRE([AC_PROG_CC])dnl
1042    AC_REQUIRE([AC_PROG_RANLIB])dnl
1043    AC_REQUIRE([AC_ISC_POSIX])dnl
1044    AC_REQUIRE([AC_HEADER_STDC])dnl
1045    AC_REQUIRE([AC_C_CONST])dnl
1046    AC_REQUIRE([AC_C_INLINE])dnl
1047    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1048    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1049    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1050    AC_REQUIRE([AC_FUNC_MMAP])dnl
1051
1052    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
1053 unistd.h sys/param.h])
1054    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
1055 strdup __argz_count __argz_stringify __argz_next])
1056
1057    if test "${ac_cv_func_stpcpy+set}" != "set"; then
1058      AC_CHECK_FUNCS(stpcpy)
1059    fi
1060    if test "${ac_cv_func_stpcpy}" = "yes"; then
1061      AC_DEFINE(HAVE_STPCPY)
1062    fi
1063
1064    AM_LC_MESSAGES
1065    AM_WITH_NLS
1066
1067    if test "x$CATOBJEXT" != "x"; then
1068      if test "x$ALL_LINGUAS" = "x"; then
1069        LINGUAS=
1070      else
1071        AC_MSG_CHECKING(for catalogs to be installed)
1072        NEW_LINGUAS=
1073        for lang in ${LINGUAS=$ALL_LINGUAS}; do
1074          case "$ALL_LINGUAS" in
1075           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
1076          esac
1077        done
1078        LINGUAS=$NEW_LINGUAS
1079        AC_MSG_RESULT($LINGUAS)
1080      fi
1081
1082      dnl Construct list of names of catalog files to be constructed.
1083      if test -n "$LINGUAS"; then
1084        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1085      fi
1086    fi
1087
1088    dnl The reference to <locale.h> in the installed <libintl.h> file
1089    dnl must be resolved because we cannot expect the users of this
1090    dnl to define HAVE_LOCALE_H.
1091    if test $ac_cv_header_locale_h = yes; then
1092      INCLUDE_LOCALE_H="#include <locale.h>"
1093    else
1094      INCLUDE_LOCALE_H="\
1095 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
1096    fi
1097    AC_SUBST(INCLUDE_LOCALE_H)
1098
1099    dnl Determine which catalog format we have (if any is needed)
1100    dnl For now we know about two different formats:
1101    dnl   Linux libc-5 and the normal X/Open format
1102    test -d intl || mkdir intl
1103    if test "$CATOBJEXT" = ".cat"; then
1104      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
1105
1106      dnl Transform the SED scripts while copying because some dumb SEDs
1107      dnl cannot handle comments.
1108      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
1109    fi
1110    dnl po2tbl.sed is always needed.
1111    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
1112      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
1113
1114    dnl In the intl/Makefile.in we have a special dependency which makes
1115    dnl only sense for gettext.  We comment this out for non-gettext
1116    dnl packages.
1117    if test "$PACKAGE" = "gettext"; then
1118      GT_NO="#NO#"
1119      GT_YES=
1120    else
1121      GT_NO=
1122      GT_YES="#YES#"
1123    fi
1124    AC_SUBST(GT_NO)
1125    AC_SUBST(GT_YES)
1126
1127    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1128    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
1129    dnl Try to locate is.
1130    MKINSTALLDIRS=
1131    if test -n "$ac_aux_dir"; then
1132      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1133    fi
1134    if test -z "$MKINSTALLDIRS"; then
1135      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1136    fi
1137    AC_SUBST(MKINSTALLDIRS)
1138
1139    dnl *** For now the libtool support in intl/Makefile is not for real.
1140    l=
1141    AC_SUBST(l)
1142
1143    dnl Generate list of files to be processed by xgettext which will
1144    dnl be included in po/Makefile.
1145    test -d po || mkdir po
1146    if test "x$srcdir" != "x."; then
1147      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
1148        posrcprefix="$srcdir/"
1149      else
1150        posrcprefix="../$srcdir/"
1151      fi
1152    else
1153      posrcprefix="../"
1154    fi
1155    rm -f po/POTFILES
1156    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
1157         < $srcdir/po/POTFILES.in > po/POTFILES
1158   ])
1159
1160 # Search path for a program which passes the given test.
1161 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1162 #
1163 # This file can be copied and used freely without restrictions.  It can
1164 # be used in projects which are not available under the GNU Public License
1165 # but which still want to provide support for the GNU gettext functionality.
1166 # Please note that the actual code is *not* freely available.
1167
1168 # serial 1
1169
1170 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1171 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1172 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
1173 [# Extract the first word of "$2", so it can be a program name with args.
1174 set dummy $2; ac_word=[$]2
1175 AC_MSG_CHECKING([for $ac_word])
1176 AC_CACHE_VAL(ac_cv_path_$1,
1177 [case "[$]$1" in
1178   /*)
1179   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1180   ;;
1181   *)
1182   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1183   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1184     test -z "$ac_dir" && ac_dir=.
1185     if test -f $ac_dir/$ac_word; then
1186       if [$3]; then
1187         ac_cv_path_$1="$ac_dir/$ac_word"
1188         break
1189       fi
1190     fi
1191   done
1192   IFS="$ac_save_ifs"
1193 dnl If no 4th arg is given, leave the cache variable unset,
1194 dnl so AC_PATH_PROGS will keep looking.
1195 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1196 ])dnl
1197   ;;
1198 esac])dnl
1199 $1="$ac_cv_path_$1"
1200 if test -n "[$]$1"; then
1201   AC_MSG_RESULT([$]$1)
1202 else
1203   AC_MSG_RESULT(no)
1204 fi
1205 AC_SUBST($1)dnl
1206 ])
1207
1208 # Check whether LC_MESSAGES is available in <locale.h>.
1209 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1210 #
1211 # This file can be copied and used freely without restrictions.  It can
1212 # be used in projects which are not available under the GNU Public License
1213 # but which still want to provide support for the GNU gettext functionality.
1214 # Please note that the actual code is *not* freely available.
1215
1216 # serial 1
1217
1218 AC_DEFUN(AM_LC_MESSAGES,
1219   [if test $ac_cv_header_locale_h = yes; then
1220     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1221       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1222        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1223     if test $am_cv_val_LC_MESSAGES = yes; then
1224       AC_DEFINE(HAVE_LC_MESSAGES)
1225     fi
1226   fi])
1227