3 # This macro adds the name macrodir to the set of directories
4 # that `aclocal' searches for macros.
8 dnl AM_ACLOCAL_INCLUDE(macrodir)
9 AC_DEFUN([AM_ACLOCAL_INCLUDE],
11 AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y)
13 test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
15 for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done
17 dnl GNOME_COMPILE_WARNINGS
18 dnl Turn on many useful compiler warnings
19 dnl For now, only works on GCC
20 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
21 AC_ARG_ENABLE(compile-warnings,
22 [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum)
24 AC_MSG_CHECKING(what warning flags to pass to the C compiler)
26 if test "x$GCC" != xyes; then
27 enable_compile_warnings=no
30 if test "x$enable_compile_warnings" != "xno"; then
31 if test "x$GCC" = "xyes"; then
33 *[\ \ ]-Wall[\ \ ]*) ;;
34 *) warnCFLAGS="-Wall -Wunused" ;;
37 ## -W is not all that useful. And it cannot be controlled
38 ## with individual -Wno-xxx flags, unlike -Wall
39 if test "x$enable_compile_warnings" = "xyes"; then
40 warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations"
44 AC_MSG_RESULT($warnCFLAGS)
47 [ --enable-iso-c Try to warn if code is not ISO C ],,
50 AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
52 if test "x$enable_iso_c" != "xno"; then
53 if test "x$GCC" = "xyes"; then
55 *[\ \ ]-ansi[\ \ ]*) ;;
56 *) complCFLAGS="$complCFLAGS -ansi" ;;
60 *[\ \ ]-pedantic[\ \ ]*) ;;
61 *) complCFLAGS="$complCFLAGS -pedantic" ;;
65 AC_MSG_RESULT($complCFLAGS)
66 if test "x$cflags_set" != "xyes"; then
67 CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS"
73 dnl For C++, do basically the same thing.
75 AC_DEFUN([GNOME_CXX_WARNINGS],[
76 AC_ARG_ENABLE(cxx-warnings,
77 [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum)
79 AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
81 if test "x$GCC" != xyes; then
82 enable_compile_warnings=no
84 if test "x$enable_cxx_warnings" != "xno"; then
85 if test "x$GCC" = "xyes"; then
87 *[\ \ ]-Wall[\ \ ]*) ;;
88 *) warnCXXFLAGS="-Wall -Wno-unused" ;;
91 ## -W is not all that useful. And it cannot be controlled
92 ## with individual -Wno-xxx flags, unlike -Wall
93 if test "x$enable_cxx_warnings" = "xyes"; then
94 warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual"
98 AC_MSG_RESULT($warnCXXFLAGS)
100 AC_ARG_ENABLE(iso-cxx,
101 [ --enable-iso-cxx Try to warn if code is not ISO C++ ],,
104 AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
106 if test "x$enable_iso_cxx" != "xno"; then
107 if test "x$GCC" = "xyes"; then
108 case " $CXXFLAGS " in
109 *[\ \ ]-ansi[\ \ ]*) ;;
110 *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
113 case " $CXXFLAGS " in
114 *[\ \ ]-pedantic[\ \ ]*) ;;
115 *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
119 AC_MSG_RESULT($complCXXFLAGS)
120 if test "x$cxxflags_set" != "xyes"; then
121 CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
123 AC_SUBST(cxxflags_set)
126 dnl Curses detection: Munged from Midnight Commander's configure.in
131 dnl - Determine which version of curses is installed on your system
132 dnl and set the -I/-L/-l compiler entries and add a few preprocessor
134 dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
135 dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
137 dnl - Modify the following configure variables (these are the only
138 dnl curses.m4 variables you can access from within configure.in)
139 dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
140 dnl an ncurses.h that's been renamed to curses.h
142 dnl CURSES_LIBS - sets -L and -l's appropriately
143 dnl CFLAGS - if --with-sco, add -D_SVID3
144 dnl has_curses - exports result of tests to rest of configure
148 dnl 1) Add lines indicated below to acconfig.h
149 dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
150 dnl 3) Instead of #include <curses.h> you should use the following to
151 dnl properly locate ncurses or curses header file
153 dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
154 dnl #include <ncurses.h>
156 dnl #include <curses.h>
159 dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
160 dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
162 dnl Notes with automake:
163 dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
165 dnl - your Makefile.am can look something like this
166 dnl -----------------------------------------------
167 dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
169 dnl CURSES_TARGETS=name_of_curses_prog
171 dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
172 dnl other_programs_SOURCES = blah blah blah
173 dnl name_of_curses_prog_SOURCES = blah blah blah
174 dnl other_programs_LDADD = blah
175 dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
176 dnl -----------------------------------------------
179 dnl The following lines should be added to acconfig.h:
180 dnl ==================================================
182 dnl /*=== Curses version detection defines ===*/
183 dnl /* Found some version of curses that we're going to use */
184 dnl #undef HAS_CURSES
186 dnl /* Use SunOS SysV curses? */
187 dnl #undef USE_SUNOS_CURSES
189 dnl /* Use old BSD curses - not used right now */
190 dnl #undef USE_BSD_CURSES
192 dnl /* Use SystemV curses? */
193 dnl #undef USE_SYSV_CURSES
195 dnl /* Use Ncurses? */
196 dnl #undef USE_NCURSES
198 dnl /* If you Curses does not have color define this one */
199 dnl #undef NO_COLOR_CURSES
201 dnl /* Define if you want to turn on SCO-specific code */
202 dnl #undef SCO_FLAVOR
204 dnl /* Set to reflect version of ncurses *
205 dnl * 0 = version 1.*
206 dnl * 1 = version 1.9.9g
207 dnl * 2 = version 4.0/4.1 */
208 dnl #undef NCURSES_970530
210 dnl /*=== End new stuff for acconfig.h ===*/
214 AC_DEFUN(AC_CHECK_CURSES,[
221 AC_SUBST(CURSES_LIBS)
222 AC_SUBST(CURSES_INCLUDEDIR)
225 [ --with-sco Use this to turn on SCO-specific code],[
226 if test x$withval = xyes; then
227 AC_DEFINE(SCO_FLAVOR)
228 CFLAGS="$CFLAGS -D_SVID3"
232 AC_ARG_WITH(sunos-curses,
233 [ --with-sunos-curses Used to force SunOS 4.x curses],[
234 if test x$withval = xyes; then
239 AC_ARG_WITH(osf1-curses,
240 [ --with-osf1-curses Used to force OSF/1 curses],[
241 if test x$withval = xyes; then
247 [ --with-vcurses[=incdir] Used to force SysV curses],
248 if test x$withval != xyes; then
249 CURSES_INCLUDEDIR="-I$withval"
255 [ --with-ncurses[=dir] Compile with ncurses/locate base dir],
256 if test x$withval = xno ; then
258 elif test x$withval != xyes ; then
259 CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
260 CURSES_INCLUDEDIR="-I$withval/include"
262 screen_manager="ncurses"
263 AC_DEFINE(USE_NCURSES)
264 AC_DEFINE(HAS_CURSES)
278 AC_DEFUN(AC_USE_SUNOS_CURSES, [
280 screen_manager="SunOS 4.x /usr/5include curses"
281 AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
282 AC_DEFINE(USE_SUNOS_CURSES)
283 AC_DEFINE(HAS_CURSES)
285 AC_DEFINE(NO_COLOR_CURSES)
286 AC_DEFINE(USE_SYSV_CURSES)
287 CURSES_INCLUDEDIR="-I/usr/5include"
288 CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
289 AC_MSG_RESULT(Please note that some screen refreshs may fail)
292 AC_DEFUN(AC_USE_OSF1_CURSES, [
293 AC_MSG_RESULT(Using OSF1 curses)
295 screen_manager="OSF1 curses"
296 AC_DEFINE(HAS_CURSES)
298 AC_DEFINE(NO_COLOR_CURSES)
299 AC_DEFINE(USE_SYSV_CURSES)
300 CURSES_LIBS="-lcurses"
303 AC_DEFUN(AC_USE_SYSV_CURSES, [
304 AC_MSG_RESULT(Using SysV curses)
305 AC_DEFINE(HAS_CURSES)
307 AC_DEFINE(USE_SYSV_CURSES)
309 screen_manager="SysV/curses"
310 CURSES_LIBS="-lcurses"
313 dnl AC_ARG_WITH(bsd-curses,
314 dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
315 dnl search_ncurses=false
316 dnl screen_manager="Ultrix/cursesX"
317 dnl if test $system = ULTRIX
319 dnl THIS_CURSES=cursesX
321 dnl THIS_CURSES=curses
324 dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
325 dnl AC_DEFINE(HAS_CURSES)
327 dnl AC_DEFINE(USE_BSD_CURSES)
328 dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
329 dnl AC_WARN(Use of the bsdcurses extension has some)
330 dnl AC_WARN(display/input problems.)
331 dnl AC_WARN(Reconsider using xcurses)
336 dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
338 AC_DEFUN(AC_NCURSES, [
343 AC_MSG_RESULT(Found ncurses on $1/$2)
345 CURSES_INCLUDEDIR="$4"
348 AC_DEFINE(HAS_CURSES)
350 AC_DEFINE(USE_NCURSES)
355 AC_DEFUN(AC_SEARCH_NCURSES, [
356 AC_CHECKING("location of ncurses.h file")
358 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
359 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
360 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
361 AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
363 AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
365 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
368 dnl We couldn't find ncurses, try SysV curses
372 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
374 AC_EGREP_CPP(USE_NCURSES,[
381 CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
382 AC_DEFINE(HAS_CURSES)
384 AC_DEFINE(USE_NCURSES)
386 screen_manager="ncurses installed as curses"
391 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
392 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
393 dnl should be replaced by a more fine grained selection routine
397 if test -f /usr/5include/curses.h
402 # check for ncurses version, to properly ifdef mouse-fix
403 AC_MSG_CHECKING(for ncurses version)
404 ncurses_version=unknown
405 cat > conftest.$ac_ext <<EOF
406 [#]line __oline__ "configure"
407 #include "confdefs.h"
408 #ifdef RENAMED_NCURSES
414 VERSION:NCURSES_VERSION
416 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
417 egrep "VERSION:" >conftest.out 2>&1; then
419 ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
423 AC_MSG_RESULT($ncurses_version)
424 case "$ncurses_version" in
428 AC_DEFINE(NCURSES_970530,2)
431 AC_DEFINE(NCURSES_970530,1)
434 AC_DEFINE(NCURSES_970530,0)
444 # Configure paths for Bonobo
445 # Miguel de Icaza, 99-04-12
446 # Stolen from Chris Lahey 99-2-5
447 # stolen from Manish Singh again
448 # stolen back from Frank Belew
449 # stolen from Manish Singh
450 # Shamelessly stolen from Owen Taylor
452 dnl AM_PATH_BONOBO ([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
453 dnl Test for Bonobo, and define BONOBO_CFLAGS and BONOBO_LIBS
455 AC_DEFUN([AM_PATH_BONOBO],
458 dnl Get the cflags and libraries from the gnome-config script
460 AC_ARG_WITH(bonobo-prefix,[ --with-bonobo-prefix=PFX Prefix where Bonobo is installed (optional)],
461 bonobo_prefix="$withval", bonobo_prefix="")
462 AC_ARG_WITH(bonobo-exec-prefix,[ --with-bonobo-exec-prefix=PFX Exec prefix where Bonobo is installed (optional)],
463 bonobo_exec_prefix="$withval", bonobo_exec_prefix="")
464 AC_ARG_ENABLE(bonobotest, [ --disable-bonobotest Do not try to compile and run a test Bonobo program],
465 , enable_bonobotest=yes)
467 if test x$bonobo_exec_prefix != x ; then
468 bonobo_args="$bonobo_args --exec-prefix=$bonobo_exec_prefix"
469 if test x${GNOME_CONFIG+set} != xset ; then
470 GNOME_CONFIG=$bonobo_exec_prefix/bin/gnome-config
473 if test x$bonobo_prefix != x ; then
474 bonobo_args="$bonobo_args --prefix=$bonobo_prefix"
475 if test x${GNOME_CONFIG+set} != xset ; then
476 GNOME_CONFIG=$bonobo_prefix/bin/gnome-config
480 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
481 min_bonobo_version=ifelse([$1], ,0.1.0,$1)
482 AC_MSG_CHECKING(for BONOBO - version >= $min_bonobo_version)
484 if test "$GNOME_CONFIG" = "no" ; then
487 BONOBO_CFLAGS=`$GNOME_CONFIG $bonoboconf_args --cflags bonobo`
488 BONOBO_LIBS=`$GNOME_CONFIG $bonoboconf_args --libs bonobo`
490 bonobo_major_version=`$GNOME_CONFIG $bonobo_args --version | \
491 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
492 bonobo_minor_version=`$GNOME_CONFIG $bonobo_args --version | \
493 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
494 bonobo_micro_version=`$GNOME_CONFIG $bonobo_config_args --version | \
495 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
496 if test "x$enable_bonobotest" = "xyes" ; then
497 ac_save_CFLAGS="$CFLAGS"
499 CFLAGS="$CFLAGS $BONOBO_CFLAGS"
500 LIBS="$LIBS $BONOBO_LIBS"
502 dnl Now check if the installed BONOBO is sufficiently new. (Also sanity
503 dnl checks the results of gnome-config to some extent
505 rm -f conf.bonobotest
513 my_strdup (char *str)
519 new_str = malloc ((strlen (str) + 1) * sizeof(char));
520 strcpy (new_str, str);
530 int major, minor, micro;
533 system ("touch conf.bonobotest");
534 bonobo_object_get_type ();
538 ],, no_bonobo=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
539 CFLAGS="$ac_save_CFLAGS"
543 if test "x$no_bonobo" = x ; then
545 ifelse([$2], , :, [$2])
548 if test "$GNOME_CONFIG" = "no" ; then
549 echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
550 echo "*** If BONOBO was installed in PREFIX, make sure PREFIX/bin is in"
551 echo "*** your path, or set the GNOME_CONFIG environment variable to the"
552 echo "*** full path to gnome-config."
554 if test -f conf.bonobotest ; then
557 echo "*** Could not run BONOBO test program, checking why..."
558 CFLAGS="$CFLAGS $BONOBO_CFLAGS"
559 LIBS="$LIBS $BONOBO_LIBS"
562 #include <bonobo/gnome-object.h>
564 [ echo "*** The test program compiled, but did not run. This usually means"
565 echo "*** that the run-time linker is not finding BONOBO or finding the wrong"
566 echo "*** version of BONOBO. If it is not finding BONOBO, you'll need to set your"
567 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
568 echo "*** to the installed location Also, make sure you have run ldconfig if that"
569 echo "*** is required on your system"
571 echo "*** If you have an old version installed, it is best to remove it, although"
572 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
573 [ echo "*** The test program failed to compile or link. See the file config.log for the"
574 echo "*** exact error that occured. This usually means BONOBO was incorrectly installed"
575 echo "*** or that you have moved BONOBO since it was installed. In the latter case, you"
576 echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
577 CFLAGS="$ac_save_CFLAGS"
583 ifelse([$3], , :, [$3])
585 AC_SUBST(BONOBO_CFLAGS)
586 AC_SUBST(BONOBO_LIBS)
587 rm -f conf.bonobotest
590 AC_DEFUN([BONOBO_CHECK], [
591 AM_PATH_BONOBO(0.1.0,,[AC_MSG_ERROR(BONOBO not found)])
596 # This only for packages that are not in the GNOME CVS tree.
598 dnl GNOME_COMMON_INIT
600 AC_DEFUN([GNOME_COMMON_INIT],
602 GNOME_ACLOCAL_DIR=`$ACLOCAL --print-ac-dir`/gnome
603 AC_SUBST(GNOME_ACLOCAL_DIR)
605 ACLOCAL="$ACLOCAL -I $GNOME_ACLOCAL_DIR"
609 dnl GNOME_FILEUTILS_CHECKS
611 dnl checks that are needed for the diskusage applet.
614 AC_DEFUN([GNOME_FILEUTILS_CHECKS],
616 AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \
617 mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \
618 sys/filsys.h sys/fs_types.h sys/fs/s5param.h)
620 AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \
621 getcwd getmntinfo gettimeofday isascii lchown \
622 listmntent memcpy mkfifo strchr strerror strrchr vprintf)
624 dnl Set some defaults when cross-compiling
626 if test x$cross_compiling = xyes ; then
629 fu_cv_sys_mounted_getmntent1=yes
630 fu_cv_sys_stat_statfs2_bsize=yes
633 fu_cv_sys_stat_statfs4=yes
636 fu_cv_sys_stat_statfs2_bsize=yes
639 fu_cv_sys_stat_statfs3_osf1=yes
644 # Determine how to get the list of mounted filesystems.
647 # If the getmntent function is available but not in the standard library,
648 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
651 # This test must precede the ones for getmntent because Unicos-9 is
652 # reported to have the getmntent function, but its support is incompatible
653 # with other getmntent implementations.
655 # NOTE: Normally, I wouldn't use a check for system type as I've done for
656 # `CRAY' below since that goes against the whole autoconf philosophy. But
657 # I think there is too great a chance that some non-Cray system has a
658 # function named listmntent to risk the false positive.
660 if test -z "$list_mounted_fs"; then
662 AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
663 AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
664 [fu_cv_sys_mounted_cray_listmntent=no
669 ], [test $ac_cv_func_listmntent = yes \
670 && fu_cv_sys_mounted_cray_listmntent=yes]
674 AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
675 if test $fu_cv_sys_mounted_cray_listmntent = yes; then
676 list_mounted_fs=found
677 AC_DEFINE(MOUNTED_LISTMNTENT)
681 if test $ac_cv_func_getmntent = yes; then
683 # This system has the getmntent function.
684 # Determine whether it's the one-argument variant or the two-argument one.
686 if test -z "$list_mounted_fs"; then
687 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
688 AC_MSG_CHECKING([for one-argument getmntent function])
689 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
690 [test $ac_cv_header_mntent_h = yes \
691 && fu_cv_sys_mounted_getmntent1=yes \
692 || fu_cv_sys_mounted_getmntent1=no])
693 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
694 if test $fu_cv_sys_mounted_getmntent1 = yes; then
695 list_mounted_fs=found
696 AC_DEFINE(MOUNTED_GETMNTENT1)
700 if test -z "$list_mounted_fs"; then
702 AC_MSG_CHECKING([for two-argument getmntent function])
703 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
704 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
705 fu_cv_sys_mounted_getmntent2=yes,
706 fu_cv_sys_mounted_getmntent2=no)])
707 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
708 if test $fu_cv_sys_mounted_getmntent2 = yes; then
709 list_mounted_fs=found
710 AC_DEFINE(MOUNTED_GETMNTENT2)
714 if test -z "$list_mounted_fs"; then
715 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
720 if test -z "$list_mounted_fs"; then
721 # DEC Alpha running OSF/1.
722 AC_MSG_CHECKING([for getfsstat function])
723 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
725 #include <sys/types.h>
726 #include <sys/mount.h>
727 #include <sys/fs_types.h>],
728 [struct statfs *stats;
729 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
730 fu_cv_sys_mounted_getsstat=yes,
731 fu_cv_sys_mounted_getsstat=no)])
732 AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
733 if test $fu_cv_sys_mounted_getsstat = yes; then
734 list_mounted_fs=found
735 AC_DEFINE(MOUNTED_GETFSSTAT)
739 if test -z "$list_mounted_fs"; then
741 AC_MSG_CHECKING([for mntctl function and struct vmount])
742 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
743 [AC_TRY_CPP([#include <fshelp.h>],
744 fu_cv_sys_mounted_vmount=yes,
745 fu_cv_sys_mounted_vmount=no)])
746 AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
747 if test $fu_cv_sys_mounted_vmount = yes; then
748 list_mounted_fs=found
749 AC_DEFINE(MOUNTED_VMOUNT)
753 if test -z "$list_mounted_fs"; then
755 AC_MSG_CHECKING([for FIXME existence of three headers])
756 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
758 #include <sys/statfs.h>
759 #include <sys/fstyp.h>
760 #include <mnttab.h>],
761 fu_cv_sys_mounted_fread_fstyp=yes,
762 fu_cv_sys_mounted_fread_fstyp=no)])
763 AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
764 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
765 list_mounted_fs=found
766 AC_DEFINE(MOUNTED_FREAD_FSTYP)
770 if test -z "$list_mounted_fs"; then
771 # 4.4BSD and DEC OSF/1.
772 AC_MSG_CHECKING([for getmntinfo function])
773 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
776 if test $ac_cv_func_getmntinfo = yes; then
777 AC_EGREP_HEADER(f_type;, sys/mount.h,
781 && fu_cv_sys_mounted_getmntinfo=yes \
782 || fu_cv_sys_mounted_getmntinfo=no
784 AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
785 if test $fu_cv_sys_mounted_getmntinfo = yes; then
786 list_mounted_fs=found
787 AC_DEFINE(MOUNTED_GETMNTINFO)
791 # FIXME: add a test for netbsd-1.1 here
793 if test -z "$list_mounted_fs"; then
795 AC_MSG_CHECKING([for getmnt function])
796 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
798 #include <sys/fs_types.h>
799 #include <sys/mount.h>],
800 fu_cv_sys_mounted_getmnt=yes,
801 fu_cv_sys_mounted_getmnt=no)])
802 AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
803 if test $fu_cv_sys_mounted_getmnt = yes; then
804 list_mounted_fs=found
805 AC_DEFINE(MOUNTED_GETMNT)
809 if test -z "$list_mounted_fs"; then
811 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
812 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
813 [AC_TRY_CPP([#include <mnttab.h>],
814 fu_cv_sys_mounted_fread=yes,
815 fu_cv_sys_mounted_fread=no)])
816 AC_MSG_RESULT($fu_cv_sys_mounted_fread)
817 if test $fu_cv_sys_mounted_fread = yes; then
818 list_mounted_fs=found
819 AC_DEFINE(MOUNTED_FREAD)
823 if test -z "$list_mounted_fs"; then
824 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
825 # FIXME -- no need to abort building the whole package
826 # Can't build mountlist.c or anything that needs its functions
829 AC_CHECKING(how to get filesystem space usage)
832 # Perform only the link test since it seems there are no variants of the
833 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
834 # because that got a false positive on SCO OSR5. Adding the declaration
835 # of a `struct statvfs' causes this test to fail (as it should) on such
836 # systems. That system is reported to work fine with STAT_STATFS4 which
837 # is what it gets when this test fails.
838 if test $space = no; then
840 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
841 [AC_TRY_LINK([#include <sys/types.h>
842 #include <sys/statvfs.h>],
843 [struct statvfs fsd; statvfs (0, &fsd);],
844 fu_cv_sys_stat_statvfs=yes,
845 fu_cv_sys_stat_statvfs=no)])
846 if test $fu_cv_sys_stat_statvfs = yes; then
848 AC_DEFINE(STAT_STATVFS)
852 if test $space = no; then
853 # DEC Alpha running OSF/1
854 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
855 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
857 #include <sys/param.h>
858 #include <sys/types.h>
859 #include <sys/mount.h>
864 exit (statfs (".", &fsd, sizeof (struct statfs)));
866 fu_cv_sys_stat_statfs3_osf1=yes,
867 fu_cv_sys_stat_statfs3_osf1=no,
868 fu_cv_sys_stat_statfs3_osf1=no)])
869 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
870 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
872 AC_DEFINE(STAT_STATFS3_OSF1)
876 if test $space = no; then
878 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
879 member (AIX, 4.3BSD)])
880 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
882 #ifdef HAVE_SYS_PARAM_H
883 #include <sys/param.h>
885 #ifdef HAVE_SYS_MOUNT_H
886 #include <sys/mount.h>
888 #ifdef HAVE_SYS_VFS_H
895 exit (statfs (".", &fsd));
897 fu_cv_sys_stat_statfs2_bsize=yes,
898 fu_cv_sys_stat_statfs2_bsize=no,
899 fu_cv_sys_stat_statfs2_bsize=no)])
900 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
901 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
903 AC_DEFINE(STAT_STATFS2_BSIZE)
907 if test $space = no; then
909 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
910 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
911 [AC_TRY_RUN([#include <sys/types.h>
912 #include <sys/statfs.h>
916 exit (statfs (".", &fsd, sizeof fsd, 0));
918 fu_cv_sys_stat_statfs4=yes,
919 fu_cv_sys_stat_statfs4=no,
920 fu_cv_sys_stat_statfs4=no)])
921 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
922 if test $fu_cv_sys_stat_statfs4 = yes; then
924 AC_DEFINE(STAT_STATFS4)
928 if test $space = no; then
930 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
931 member (4.4BSD and NetBSD)])
932 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
933 [AC_TRY_RUN([#include <sys/types.h>
934 #ifdef HAVE_SYS_PARAM_H
935 #include <sys/param.h>
937 #ifdef HAVE_SYS_MOUNT_H
938 #include <sys/mount.h>
944 exit (statfs (".", &fsd));
946 fu_cv_sys_stat_statfs2_fsize=yes,
947 fu_cv_sys_stat_statfs2_fsize=no,
948 fu_cv_sys_stat_statfs2_fsize=no)])
949 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
950 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
952 AC_DEFINE(STAT_STATFS2_FSIZE)
956 if test $space = no; then
958 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
959 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
960 [AC_TRY_RUN([#include <sys/types.h>
961 #ifdef HAVE_SYS_PARAM_H
962 #include <sys/param.h>
964 #ifdef HAVE_SYS_MOUNT_H
965 #include <sys/mount.h>
967 #ifdef HAVE_SYS_FS_TYPES_H
968 #include <sys/fs_types.h>
973 /* Ultrix's statfs returns 1 for success,
974 0 for not mounted, -1 for failure. */
975 exit (statfs (".", &fsd) != 1);
977 fu_cv_sys_stat_fs_data=yes,
978 fu_cv_sys_stat_fs_data=no,
979 fu_cv_sys_stat_fs_data=no)])
980 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
981 if test $fu_cv_sys_stat_fs_data = yes; then
983 AC_DEFINE(STAT_STATFS2_FS_DATA)
987 if test $space = no; then
989 AC_TRY_CPP([#include <sys/filsys.h>],
990 AC_DEFINE(STAT_READ_FILSYS) space=yes)
993 if test -n "$list_mounted_fs" && test $space != no; then
995 # LIBOBJS="$LIBOBJS fsusage.o"
996 # LIBOBJS="$LIBOBJS mountlist.o"
999 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
1000 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
1001 # enable the work-around code in fsusage.c.
1002 AC_MSG_CHECKING([for statfs that truncates block counts])
1003 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
1005 #if !defined(sun) && !defined(__sun)
1006 choke -- this is a workaround for a Sun-specific problem
1008 #include <sys/types.h>
1009 #include <sys/vfs.h>],
1010 [struct statfs t; long c = *(t.f_spare);],
1011 fu_cv_sys_truncating_statfs=yes,
1012 fu_cv_sys_truncating_statfs=no,
1014 if test $fu_cv_sys_truncating_statfs = yes; then
1015 AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS)
1017 AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
1019 AC_CHECKING(for AFS)
1020 test -d /afs && AC_DEFINE(AFS)
1022 AC_DEFUN([GNOME_GHTTP_CHECK],[
1023 AC_REQUIRE([GNOME_INIT_HOOK])
1025 AC_CHECK_FUNC(connect,,[
1026 AC_CHECK_LIB(socket,connect,
1027 GHTTP_LIB="-lsocket $GHTTP_LIB",,$GHTTP_LIB)])
1028 AC_CHECK_FUNC(gethostbyname,,[
1029 AC_CHECK_LIB(nsl,gethostbyname,
1030 GHTTP_LIB="-lnsl $GHTTP_LIB",,$GHTTP_LIB)])
1031 AC_CHECK_LIB(ghttp, ghttp_request_new,
1032 GHTTP_LIB="-lghttp $GHTTP_LIB",GHTTP_LIB="",-L$gnome_prefix $GHTTP_LIB)
1034 AC_PROVIDE([GNOME_GHTTP_CHECK])
1037 dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag)
1039 dnl if failflag is "failure" it aborts if gnorba is not found.
1042 AC_DEFUN([GNOME_GNORBA_HOOK],[
1043 GNOME_ORBIT_HOOK([],$2)
1044 AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[
1045 gnome_cv_gnorba_found=no
1046 if test x$gnome_cv_orbit_found = xyes; then
1047 GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
1048 GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
1049 if test -n "$GNORBA_LIBS"; then
1050 gnome_cv_gnorba_found=yes
1054 AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes)
1055 if test x$gnome_cv_orbit_found = xyes; then
1057 GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
1058 GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
1059 AC_SUBST(GNORBA_CFLAGS)
1060 AC_SUBST(GNORBA_LIBS)
1062 if test x$2 = xfailure; then
1063 AC_MSG_ERROR(gnorba library not installed or installation problem)
1068 AC_DEFUN([GNOME_GNORBA_CHECK], [
1069 GNOME_GNORBA_HOOK([],failure)
1072 dnl GNOME_CHECK_GUILE (failflag)
1074 dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found.
1077 AC_DEFUN([GNOME_CHECK_GUILE],
1079 saved_ldflags="$LDFLAGS"
1080 saved_cppflags="$CPPFLAGS"
1081 LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
1083 AC_CHECK_LIB(qthreads,qt_null,[
1084 QTTHREADS_LIB="-lqthreads"
1086 AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt")
1088 AC_SUBST(QTTHREADS_LIB)
1090 AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap")
1091 AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB)
1093 AC_SUBST(TERMCAP_LIB)
1094 AC_SUBST(READLINE_LIB)
1096 if test "x$cross_compiling" = "xyes" ; then
1097 name_build_guile="$target_alias-guile-config"
1099 name_build_guile="guile-config"
1102 AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
1104 if test "x$BUILD_GUILE" = "xyes"; then
1105 AC_MSG_CHECKING(whether $name_build_guile works)
1106 if test x`$name_build_guile --version >/dev/null 2>&1 || \
1107 echo no` = xno; then
1110 AC_MSG_RESULT($BUILD_GUILE)
1113 if test "x$cross_compiling" = "xyes" ; then
1114 name_build_guile="$target_alias-build-guile"
1116 name_build_guile="build-guile"
1119 AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
1121 if test "x$BUILD_GUILE" = "xyes"; then
1122 AC_MSG_CHECKING(whether $name_build_guile works)
1123 if test x`$name_build_guile --version >/dev/null 2>&1 || \
1124 echo no` = xno; then
1127 AC_MSG_RESULT($BUILD_GUILE)
1131 AC_CHECK_LIB(m, sin)
1133 if test "x$BUILD_GUILE" = "xyes"; then
1134 AC_MSG_CHECKING(for guile libraries)
1135 GUILE_LIBS="`$name_build_guile link`"
1136 AC_MSG_RESULT($GUILE_LIBS)
1137 AC_MSG_CHECKING(for guile headers)
1138 GUILE_INCS="`$name_build_guile compile`"
1139 AC_MSG_RESULT($GUILE_INCS)
1141 GUILE_LIBS="$GNOME_LIBDIR"
1142 GUILE_INCS="$GNOME_INCLUDEDIR"
1143 AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS")
1144 AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS")
1145 AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS")
1146 AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl")
1147 AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket")
1148 GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB"
1151 AC_SUBST(GUILE_LIBS)
1152 AC_SUBST(GUILE_INCS)
1155 LIBS="$LIBS $GUILE_LIBS"
1156 CPPFLAGS="$saved_cppflags $GUILE_INCS"
1158 AC_MSG_CHECKING(whether guile works)
1160 #include <libguile.h>
1161 #include <guile/gh.h>
1163 gh_eval_str("(newline)");
1164 scm_boot_guile(0,NULL,NULL,NULL);
1166 ac_cv_guile_found=yes
1167 AC_DEFINE(HAVE_GUILE)
1169 ac_cv_guile_found=no
1171 AC_MSG_RESULT($ac_cv_guile_found)
1173 if test x$ac_cv_guile_found = xno ; then
1174 if test x$1 = xfail ; then
1175 AC_MSG_ERROR(Can not find Guile on this system)
1177 AC_MSG_WARN(Can not find Guile on this system)
1179 ac_cv_guile_found=no
1180 GUILE_LIBS= GUILE_INCS=
1184 LDFLAGS="$saved_ldflags"
1185 CPPFLAGS="$saved_cppflags"
1187 AC_SUBST(GUILE_LIBS)
1188 AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes)
1191 dnl LIBGTOP_CHECK_TYPE
1193 dnl Improved version of AC_CHECK_TYPE which takes into account
1194 dnl that we need to #include some other header files on some
1195 dnl systems to get some types.
1197 dnl AC_LIBGTOP_CHECK_TYPE(TYPE, DEFAULT)
1198 AC_DEFUN(AC_LIBGTOP_CHECK_TYPE,
1199 [AC_REQUIRE([AC_HEADER_STDC])dnl
1200 AC_MSG_CHECKING(for $1)
1201 AC_CACHE_VAL(ac_cv_type_$1,
1203 changequote(<<,>>)dnl
1204 <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
1205 changequote([,]), [#include <sys/types.h>
1212 #ifdef HAVE_SYS_BITYPES_H
1213 #include <sys/bitypes.h>
1215 ], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
1216 AC_MSG_RESULT($ac_cv_type_$1)
1217 if test $ac_cv_type_$1 = no; then
1223 dnl GNOME_LIBGTOP_TYPES
1225 dnl some typechecks for libgtop.
1228 AC_DEFUN([GNOME_LIBGTOP_TYPES],
1230 AC_CHECK_HEADERS(sys/bitypes.h)
1231 AC_LIBGTOP_CHECK_TYPE(u_int64_t, unsigned long long int)
1232 AC_LIBGTOP_CHECK_TYPE(int64_t, signed long long int)
1236 dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag)
1238 dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop
1242 AC_DEFUN([GNOME_LIBGTOP_HOOK],
1244 AC_REQUIRE([GNOME_LIBGTOP_TYPES])
1246 AC_SUBST(LIBGTOP_LIBDIR)
1247 AC_SUBST(LIBGTOP_INCLUDEDIR)
1248 AC_SUBST(LIBGTOP_EXTRA_LIBS)
1249 AC_SUBST(LIBGTOP_LIBS)
1250 AC_SUBST(LIBGTOP_INCS)
1251 AC_SUBST(LIBGTOP_NAMES_LIBS)
1252 AC_SUBST(LIBGTOP_NAMES_INCS)
1253 AC_SUBST(LIBGTOP_MAJOR_VERSION)
1254 AC_SUBST(LIBGTOP_MINOR_VERSION)
1255 AC_SUBST(LIBGTOP_MICRO_VERSION)
1256 AC_SUBST(LIBGTOP_VERSION)
1257 AC_SUBST(LIBGTOP_VERSION_CODE)
1258 AC_SUBST(LIBGTOP_SERVER_VERSION)
1259 AC_SUBST(LIBGTOP_INTERFACE_AGE)
1260 AC_SUBST(LIBGTOP_BINARY_AGE)
1261 AC_SUBST(LIBGTOP_BINDIR)
1262 AC_SUBST(LIBGTOP_SERVER)
1264 dnl Get the cflags and libraries from the libgtop-config script
1266 AC_ARG_WITH(libgtop,
1267 [ --with-libgtop=PFX Prefix where LIBGTOP is installed (optional)],
1268 libgtop_config_prefix="$withval", libgtop_config_prefix="")
1269 AC_ARG_WITH(libgtop-exec,
1270 [ --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)],
1271 libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="")
1273 if test x$libgtop_config_exec_prefix != x ; then
1274 libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix"
1275 if test x${LIBGTOP_CONFIG+set} != xset ; then
1276 LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config
1279 if test x$libgtop_config_prefix != x ; then
1280 libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix"
1281 if test x${LIBGTOP_CONFIG+set} != xset ; then
1282 LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config
1286 AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no)
1287 dnl IMPORTANT NOTICE:
1288 dnl If you increase this number here, this means that *ALL*
1289 dnl modules will require the new version, even if they explicitly
1290 dnl give a lower number in their `configure.in' !!!
1291 real_min_libgtop_version=1.0.0
1292 min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1)
1293 dnl I know, the following code looks really ugly, but if you want
1294 dnl to make changes, please test it with a brain-dead /bin/sh and
1295 dnl with a brain-dead /bin/test (not all shells/tests support the
1296 dnl `<' operator to compare strings, that's why I convert everything
1297 dnl into numbers and test them).
1298 min_libgtop_major=`echo $min_libgtop_version | \
1299 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1300 min_libgtop_minor=`echo $min_libgtop_version | \
1301 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1302 min_libgtop_micro=`echo $min_libgtop_version | \
1303 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1304 test x$min_libgtop_micro = x && min_libgtop_micro=0
1305 real_min_libgtop_major=`echo $real_min_libgtop_version | \
1306 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1307 real_min_libgtop_minor=`echo $real_min_libgtop_version | \
1308 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1309 real_min_libgtop_micro=`echo $real_min_libgtop_version | \
1310 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1311 test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0
1312 dnl You cannot require a version less then $real_min_libgtop_version,
1313 dnl so you don't need to update each `configure.in' when it's increased.
1314 if test $real_min_libgtop_major -gt $min_libgtop_major ; then
1315 min_libgtop_major=$real_min_libgtop_major
1316 min_libgtop_minor=$real_min_libgtop_minor
1317 min_libgtop_micro=$real_min_libgtop_micro
1318 elif test $real_min_libgtop_major = $min_libgtop_major ; then
1319 if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then
1320 min_libgtop_minor=$real_min_libgtop_minor
1321 min_libgtop_micro=$real_min_libgtop_micro
1322 elif test $real_min_libgtop_minor = $min_libgtop_minor ; then
1323 if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then
1324 min_libgtop_micro=$real_min_libgtop_micro
1328 min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro"
1329 AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version)
1331 if test "$LIBGTOP_CONFIG" = "no" ; then
1334 configfile=`$LIBGTOP_CONFIG --config`
1335 libgtop_major_version=`$LIBGTOP_CONFIG --version | \
1336 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1337 libgtop_minor_version=`$LIBGTOP_CONFIG --version | \
1338 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1339 libgtop_micro_version=`$LIBGTOP_CONFIG --version | \
1340 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1341 if test $libgtop_major_version != $min_libgtop_major ; then
1344 test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes
1345 if test $libgtop_minor_version = $min_libgtop_minor ; then
1346 test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes
1351 if test x$no_libgtop = x ; then
1352 AC_DEFINE(HAVE_LIBGTOP)
1353 AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION")
1354 AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE)
1355 AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION)
1356 AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION)
1357 AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION)
1358 AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION)
1360 dnl Note that an empty true branch is not valid sh syntax.
1361 ifelse([$2], [], :, [$2])
1364 if test "$no_libgtop"x = mismatchx; then
1365 AC_MSG_ERROR(LibGTop major version mismatch $libgtop_major_version != $min_libgtop_major)
1367 if test "x$3" = "xfail"; then
1368 AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found)
1370 AC_MSG_WARN(LibGTop >= $min_libgtop_version not found)
1374 AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes)
1377 AC_DEFUN([GNOME_INIT_LIBGTOP],[
1378 GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2)
1382 dnl GNOME_LIBGTOP_DOCU
1384 dnl checks whether the documentation of LibGTop is installed
1387 AC_DEFUN([GNOME_LIBGTOP_DOCU],
1389 AC_REQUIRE([GNOME_LIBGTOP_HOOK])
1391 helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop"
1393 AC_MSG_CHECKING(whether you have the LibGTop Documentation)
1395 if test -f "$helpdir/C/topic.dat" ; then
1396 have_libgtop_docu=yes
1397 AC_DEFINE(HAVE_LIBGTOP_DOCU)
1399 have_libgtop_docu=no
1402 AC_MSG_RESULT($have_libgtop_docu)
1404 AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes)
1407 AC_DEFUN([GNOME_CHECK_OBJC],
1409 dnl Look for an ObjC compiler.
1410 dnl FIXME: extend list of possible names of ObjC compilers.
1411 AC_CHECK_PROGS(OBJC, $OBJC egcs, "")
1412 if test "x$OBJC" = "x" ; then
1413 AC_CHECK_PROGS(OBJC, $OBJC egcc, "")
1414 if test "x$OBJC" = "x" ; then
1415 AC_CHECK_PROGS(OBJC, $OBJC gcc, "")
1419 AC_REQUIRE([GNOME_PTHREAD_CHECK])
1421 OBJC_LIBS="-lobjc $PTHREAD_LIB"
1422 AC_CHECK_FUNC(sched_yield,,[
1423 AC_CHECK_LIB(rt,sched_yield,
1424 OBJC_LIBS="$OBJC_LIBS -lrt",[
1425 AC_CHECK_LIB(posix4,sched_yield,
1426 OBJC_LIBS="$OBJC_LIBS -lposix4",,
1431 AC_CACHE_CHECK([if Objective C compiler ($OBJC) works],
1432 ac_cv_prog_objc_works, [
1433 if test -n "$OBJC"; then
1434 cat > conftest.m <<EOF
1435 #include <objc/Object.h>
1436 @interface myRandomObj : Object
1440 @implementation myRandomObj
1443 /* No, you are not seeing double. Remember that square brackets
1444 are the autoconf m4 quotes. */
1445 id myid = [[myRandomObj alloc]];
1451 $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1
1455 if test $result -eq 0; then
1456 ac_cv_prog_objc_works=yes
1459 ac_cv_prog_objc_works=no
1463 AM_CONDITIONAL(OBJECTIVE_C, test x$ac_cv_prog_objc_works = xyes)
1464 dnl Also set the shell variable OBJECTIVE_C to "yes" or "no".
1465 OBJECTIVE_C=$ac_cv_prog_objc_works
1468 AC_DEFUN([GNOME_INIT_OBJC],
1470 AC_MSG_CHECKING(for an obGnomeConf.sh)
1471 my_gnome_libdir=`$GNOME_CONFIG --libdir`
1472 if test -f $my_gnome_libdir/obGnomeConf.sh; then
1473 . $my_gnome_libdir/obGnomeConf.sh
1474 AC_MSG_RESULT(found $my_gnome_libdir)
1475 ac_cv_have_gnome_objc=yes
1477 AC_MSG_RESULT(not found)
1478 AC_MSG_WARN(Could not find the obGnomeConf.sh file that is generated by gnome-objc install)
1479 ac_cv_have_gnome_objc=no
1482 dnl Add a conditional on whether or not we have gnome-objc
1483 AM_CONDITIONAL(HAVE_GNOME_OBJC, test x$ac_cv_have_gnome_objc = xyes)
1484 HAVE_GNOME_OBJC=$ac_cv_have_gnome_objc
1486 AC_SUBST(OBGNOME_INCLUDEDIR)
1487 AC_SUBST(OBGNOME_LIBS)
1488 AC_SUBST(OBGTK_LIBS)
1491 dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag)
1493 dnl if failflag is "failure" it aborts if orbit is not found.
1496 AC_DEFUN([GNOME_ORBIT_HOOK],[
1497 AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no)
1498 AC_PATH_PROG(ORBIT_IDL,orbit-idl,no)
1499 AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[
1500 if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then
1501 gnome_cv_orbit_found=no
1503 gnome_cv_orbit_found=yes
1506 AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes)
1507 if test x$gnome_cv_orbit_found = xyes; then
1509 ORBIT_CFLAGS=`orbit-config --cflags client server`
1510 ORBIT_LIBS=`orbit-config --use-service=name --libs client server`
1511 AC_SUBST(ORBIT_CFLAGS)
1512 AC_SUBST(ORBIT_LIBS)
1514 if test x$2 = xfailure; then
1515 AC_MSG_ERROR(ORBit not installed or installation problem)
1520 AC_DEFUN([GNOME_ORBIT_CHECK], [
1521 GNOME_ORBIT_HOOK([],failure)
1523 # Configure paths for GNOME-PRINT
1524 # Chris Lahey 99-2-5
1525 # stolen from Manish Singh again
1526 # stolen back from Frank Belew
1527 # stolen from Manish Singh
1528 # Shamelessly stolen from Owen Taylor
1530 dnl AM_PATH_GNOME_PRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1531 dnl Test for GNOME-PRINT, and define GNOME_PRINT_CFLAGS and GNOME_PRINT_LIBS
1533 AC_DEFUN(AM_PATH_GNOME_PRINT,
1535 dnl Get the cflags and libraries from the gnome-config script
1537 AC_ARG_WITH(gnome-print-prefix,[ --with-gnome-print-prefix=PFX Prefix where GNOME-PRINT is installed (optional)],
1538 gnome_print_prefix="$withval", gnome_print_prefix="")
1539 AC_ARG_WITH(gnome-print-exec-prefix,[ --with-gnome-print-exec-prefix=PFX Exec prefix where GNOME-PRINT is installed (optional)],
1540 gnome_print_exec_prefix="$withval", gnome_print_exec_prefix="")
1541 AC_ARG_ENABLE(gnome-printtest, [ --disable-gnome-printtest Do not try to compile and run a test GNOME-PRINT program],
1542 , enable_gnome_printtest=yes)
1544 if test x$gnome_print_exec_prefix != x ; then
1545 gnome_print_args="$gnome_print_args --exec-prefix=$gnome_print_exec_prefix"
1546 if test x${GNOME_CONFIG+set} != xset ; then
1547 GNOME_CONFIG=$gnome_print_exec_prefix/bin/gnome-config
1550 if test x$gnome_print_prefix != x ; then
1551 gnome_print_args="$gnome_print_args --prefix=$gnome_print_prefix"
1552 if test x${GNOME_CONFIG+set} != xset ; then
1553 GNOME_CONFIG=$gnome_print_prefix/bin/gnome-config
1557 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
1558 min_gnome_print_version=ifelse([$1], ,0.1.0,$1)
1559 AC_MSG_CHECKING(for GNOME-PRINT - version >= $min_gnome_print_version)
1561 if test "$GNOME_CONFIG" = "no" ; then
1564 GNOME_PRINT_CFLAGS=`$GNOME_CONFIG $gnome_printconf_args --cflags print`
1565 GNOME_PRINT_LIBS=`$GNOME_CONFIG $gnome_printconf_args --libs print`
1567 gnome_print_major_version=`$GNOME_CONFIG $gnome_print_args --version | \
1568 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1569 gnome_print_minor_version=`$GNOME_CONFIG $gnome_print_args --version | \
1570 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1571 gnome_print_micro_version=`$GNOME_CONFIG $gnome_print_config_args --version | \
1572 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1573 if test "x$enable_gnome_printtest" = "xyes" ; then
1574 ac_save_CFLAGS="$CFLAGS"
1575 ac_save_LIBS="$LIBS"
1576 CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
1577 LIBS="$LIBS $GNOME_PRINT_LIBS"
1579 dnl Now check if the installed GNOME-PRINT is sufficiently new. (Also sanity
1580 dnl checks the results of gnome-config to some extent
1582 rm -f conf.gnome_printtest
1587 #include <libgnomeprint/gnome-print.h>
1590 my_strdup (char *str)
1596 new_str = malloc ((strlen (str) + 1) * sizeof(char));
1597 strcpy (new_str, str);
1607 int major, minor, micro;
1610 system ("touch conf.gnome_printtest");
1612 /* HP/UX 9 (%@#!) writes to sscanf strings */
1613 tmp_version = my_strdup("$min_gnome_print_version");
1614 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
1615 printf("%s, bad version string\n", "$min_gnome_print_version");
1620 if (($gnome_print_major_version > major) ||
1621 (($gnome_print_major_version == major) && ($gnome_print_minor_version > minor)) ||
1622 (($gnome_print_major_version == major) && ($gnome_print_minor_version == minor) && ($gnome_print_micro_version >= micro)))
1628 printf("\n*** 'gnome-config print --version' returned %d.%d.%d, but the minimum version\n", $gnome_print_major_version, $gnome_print_minor_version, $gnome_print_micro_version);
1629 printf("*** of GNOME-PRINT required is %d.%d.%d. If gnome-config is correct, then it is\n", major, minor, micro);
1630 printf("*** best to upgrade to the required version.\n");
1631 printf("*** If gnome-config was wrong, set the environment variable GNOME_CONFIG\n");
1632 printf("*** to point to the correct copy of gnome-config, and remove the file\n");
1633 printf("*** config.cache before re-running configure\n");
1639 ],, no_gnome_print=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1640 CFLAGS="$ac_save_CFLAGS"
1641 LIBS="$ac_save_LIBS"
1644 if test "x$no_gnome_print" = x ; then
1646 ifelse([$2], , :, [$2])
1649 if test "$GNOME_CONFIG" = "no" ; then
1650 echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
1651 echo "*** If GNOME-PRINT was installed in PREFIX, make sure PREFIX/bin is in"
1652 echo "*** your path, or set the GNOME_CONFIG environment variable to the"
1653 echo "*** full path to gnome-config."
1655 if test -f conf.gnome_printtest ; then
1658 echo "*** Could not run GNOME-PRINT test program, checking why..."
1659 CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
1660 LIBS="$LIBS $GNOME_PRINT_LIBS"
1663 #include <libgnomeprint/gnome-print.h>
1665 [ echo "*** The test program compiled, but did not run. This usually means"
1666 echo "*** that the run-time linker is not finding GNOME-PRINT or finding the wrong"
1667 echo "*** version of GNOME-PRINT. If it is not finding GNOME-PRINT, you'll need to set your"
1668 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1669 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1670 echo "*** is required on your system"
1672 echo "*** If you have an old version installed, it is best to remove it, although"
1673 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1674 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1675 echo "*** exact error that occured. This usually means GNOME-PRINT was incorrectly installed"
1676 echo "*** or that you have moved GNOME-PRINT since it was installed. In the latter case, you"
1677 echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
1678 CFLAGS="$ac_save_CFLAGS"
1679 LIBS="$ac_save_LIBS"
1682 GNOME_PRINT_CFLAGS=""
1684 ifelse([$3], , :, [$3])
1686 AC_SUBST(GNOME_PRINT_CFLAGS)
1687 AC_SUBST(GNOME_PRINT_LIBS)
1688 rm -f conf.gnome_printtest
1691 AC_DEFUN([GNOME_PRINT_CHECK], [
1692 AM_PATH_GNOME_PRINT(0.1.0,,[AC_MSG_ERROR(GNOME-PRINT not found)])
1695 dnl And better, use gthreads instead...
1698 AC_DEFUN([GNOME_PTHREAD_CHECK],[
1700 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1701 [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1702 [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1703 [AC_CHECK_FUNC(pthread_create)]
1707 AC_SUBST(PTHREAD_LIB)
1708 AC_PROVIDE([GNOME_PTHREAD_CHECK])
1710 dnl GNOME_SUPPORT_CHECKS
1711 dnl Check for various support functions needed by the standard
1712 dnl Gnome libraries. Sets LIBOBJS, might define some macros.
1713 dnl This should only be used when building the Gnome libs;
1714 dnl Gnome clients should not need this macro.
1715 AC_DEFUN([GNOME_SUPPORT_CHECKS],[
1716 # we need an `awk' to build `gnomesupport.h'
1717 AC_REQUIRE([AC_PROG_AWK])
1719 # this should go away soon
1720 need_gnome_support=yes
1722 save_LIBOBJS="$LIBOBJS"
1725 AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
1730 # copied from `configure.in' of `libiberty'
1731 vars="program_invocation_short_name program_invocation_name sys_errlist"
1733 AC_MSG_CHECKING([for $v])
1734 AC_CACHE_VAL(gnome_cv_var_$v,
1735 [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
1736 [eval "gnome_cv_var_$v=yes"],
1737 [eval "gnome_cv_var_$v=no"])])
1738 if eval "test \"`echo '$gnome_cv_var_'$v`\" = yes"; then
1740 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1741 AC_DEFINE_UNQUOTED($n)
1747 AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen)
1748 AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf)
1750 AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o")
1752 # to include `error.c' error.c has some HAVE_* checks
1753 AC_CHECK_FUNCS(vprintf doprnt strerror_r)
1754 AM_FUNC_ERROR_AT_LINE
1756 # This is required if we declare setreuid () and setregid ().
1759 # see if we need to declare some functions. Solaris is notorious for
1760 # putting functions into the `libc' but not listing them in the headers
1761 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h dirent.h)
1762 GCC_NEED_DECLARATIONS(gethostname setreuid setregid getpagesize)
1763 GCC_NEED_DECLARATION(scandir,[
1764 #ifdef HAVE_DIRENT_H
1769 # Turn our LIBOBJS into libtool objects. This is gross, but it
1770 # requires changes to autoconf before it goes away.
1771 LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
1772 AC_SUBST(need_gnome_support)
1775 LIBOBJS="$save_LIBOBJS"
1776 AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes)
1778 dnl GNOME_UNDELFS_CHECKS
1779 dnl Check for ext2fs undel support.
1780 dnl Set shell variable ext2fs_undel to "yes" if we have it,
1781 dnl "no" otherwise. May define USE_EXT2FSLIB for cpp.
1782 dnl Will set EXT2FS_UNDEL_LIBS to required libraries.
1784 AC_DEFUN([GNOME_UNDELFS_CHECKS], [
1785 AC_CHECK_HEADERS(ext2fs/ext2fs.h linux/ext2_fs.h)
1788 if test x$ac_cv_header_ext2fs_ext2fs_h = xyes
1790 if test x$ac_cv_header_linux_ext2_fs_h = xyes
1792 AC_DEFINE(USE_EXT2FSLIB)
1794 EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
1798 dnl GNOME_VFS_CHECKS
1799 dnl Check for various functions needed by libvfs.
1800 dnl This has various effects:
1801 dnl Sets GNOME_VFS_LIBS to libraries required
1802 dnl Sets termnet to true or false depending on whether it is required.
1803 dnl If yes, defines USE_TERMNET.
1804 dnl Sets vfs_flags to "pretty" list of vfs implementations we include.
1805 dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
1806 dnl "no" (--without-vfs).
1807 dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv".
1810 AC_DEFUN([GNOME_WITH_VFS],[
1811 dnl FIXME: network checks should probably be in their own macro.
1812 AC_CHECK_LIB(nsl, t_accept)
1813 AC_CHECK_LIB(socket, socket)
1816 AC_CHECK_FUNCS(socket, have_socket=yes)
1817 if test $have_socket = no; then
1818 # socket is not in the default libraries. See if it's in some other.
1819 for lib in bsd socket inet; do
1820 AC_CHECK_LIB($lib, socket, [
1823 AC_DEFINE(HAVE_SOCKET)
1828 have_gethostbyname=no
1829 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
1830 if test $have_gethostbyname = no; then
1831 # gethostbyname is not in the default libraries. See if it's in some other.
1832 for lib in bsd socket inet; do
1833 AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
1839 if test $have_socket = yes; then
1841 AC_CHECK_FUNCS(pmap_set, , [
1842 AC_CHECK_LIB(rpc, pmap_set, [
1844 AC_DEFINE(HAVE_PMAP_SET)
1846 AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
1847 dnl add for source routing support setsockopt
1848 AC_CHECK_HEADERS(rpc/pmap_clnt.h)
1849 vfs_flags="$vfs_flags, mcfs, ftpfs, fish"
1859 [--with-samba Support smb virtual file system],[
1860 if test "x$withval != xno"; then
1861 AC_DEFINE(WITH_SMBFS)
1862 vfs_flags="$vfs_flags, smbfs"
1864 SAMBAFILES="\$(SAMBAFILES)"
1868 AC_SUBST(SAMBAFILES)
1871 dnl The termnet support
1874 AC_ARG_WITH(termnet,
1875 [--with-termnet If you want a termified net support],[
1876 if test x$withval = xyes; then
1877 AC_DEFINE(USE_TERMNET)
1884 if $use_net_code; then
1885 AC_DEFINE(USE_NETCODE)
1888 if test $have_socket = yes; then
1903 AC_DEFUN([GNOME_VFS_CHECKS],[
1906 [--with-vfs Compile with the VFS code],
1910 yes) GNOME_WITH_VFS;;
1913 dnl Should we issue a warning?
1920 dnl Basic X11 related checks for X11. At the end, the following will be
1921 dnl defined/changed:
1922 dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK
1923 dnl CPPFLAGS Will include $X_CFLAGS
1924 dnl GNOME_HAVE_SM `true' or `false' depending on whether session
1925 dnl management is available. It is available if
1926 dnl both -lSM and X11/SM/SMlib.h exist. (Some
1927 dnl Solaris boxes have the library but not the header)
1928 dnl XPM_LIBS -lXpm if Xpm library is present, otherwise ""
1930 dnl The following configure cache variables are defined (but not used):
1931 dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS}
1933 AC_DEFUN([GNOME_X_CHECKS],
1935 AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
1936 dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could
1937 dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes"
1939 dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses
1940 dnl CPPFLAGS, not CFLAGS
1941 CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
1943 saved_ldflags="$LDFLAGS"
1944 LDFLAGS="$LDFLAGS $GTK_LIBS"
1946 gnome_cv_passdown_x_libs="$GTK_LIBS"
1947 gnome_cv_passdown_X_LIBS="$GTK_LIBS"
1948 gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS"
1949 gnome_cv_passdown_GTK_LIBS="$GTK_LIBS"
1951 LDFLAGS="$saved_ldflags $GTK_LIBS"
1953 dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow.
1956 dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x])
1957 dnl AC_EGREP_CPP(answer_affirmatively,
1958 dnl [#include <gtk/gtkfeatures.h>
1959 dnl #ifdef GTK_HAVE_FEATURES_1_1_0
1960 dnl answer_affirmatively
1962 dnl ], dev_gtk=yes, dev_gtk=no)
1963 dnl if test "$dev_gtk" = "yes"; then
1966 dnl AC_MSG_RESULT("$dev_gtk")
1971 dnl Already found it.
1974 dnl Assume that if we have -lSM then we also have -lICE.
1975 AC_CHECK_LIB(SM, SmcSaveYourselfDone,
1976 [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false,
1981 if test "$GNOME_HAVE_SM" = true; then
1982 AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false)
1985 if test "$GNOME_HAVE_SM" = true; then
1986 AC_DEFINE(HAVE_LIBSM)
1990 AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
1993 AC_REQUIRE([GNOME_PTHREAD_CHECK])
1994 LDFLAGS="$saved_ldflags"
1996 AC_PROVIDE([GNOME_X_CHECKS])
1999 dnl GNOME_XML_HOOK (script-if-xml-found, failflag)
2001 dnl If failflag is "failure", script aborts due to lack of XML
2003 dnl Check for availability of the libxml library
2004 dnl the XML parser uses libz if available too
2007 AC_DEFUN([GNOME_XML_HOOK],[
2008 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
2009 if test "$GNOME_CONFIG" = no; then
2010 if test x$2 = xfailure; then
2011 AC_MSG_ERROR(Could not find gnome-config)
2014 AC_CHECK_LIB(xml, xmlNewDoc, [
2016 GNOME_XML_LIB=`$GNOME_CONFIG --libs xml`
2018 if test x$2 = xfailure; then
2019 AC_MSG_ERROR(Could not link sample xml program)
2021 ], `$GNOME_CONFIG --libs xml`)
2022 AC_SUBST(GNOME_XML_LIB)
2025 AC_DEFUN([GNOME_XML_CHECK], [
2026 GNOME_XML_HOOK([],failure)
2029 dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits])
2031 dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
2035 AC_DEFUN([GNOME_INIT_HOOK],[
2036 AC_SUBST(GNOME_LIBS)
2037 AC_SUBST(GNOMEUI_LIBS)
2038 AC_SUBST(GNOMEGNORBA_LIBS)
2039 AC_SUBST(GTKXMHTML_LIBS)
2041 AC_SUBST(GNOME_LIBDIR)
2042 AC_SUBST(GNOME_INCLUDEDIR)
2044 AC_ARG_WITH(gnome-includes,
2045 [ --with-gnome-includes Specify location of GNOME headers],[
2046 CFLAGS="$CFLAGS -I$withval"
2049 AC_ARG_WITH(gnome-libs,
2050 [ --with-gnome-libs Specify location of GNOME libs],[
2051 LDFLAGS="$LDFLAGS -L$withval"
2052 gnome_prefix=$withval
2056 [ --with-gnome Specify prefix for GNOME files],
2057 if test x$withval = xyes; then
2059 dnl Note that an empty true branch is not
2060 dnl valid sh syntax.
2061 ifelse([$1], [], :, [$1])
2063 if test "x$withval" = xno; then
2067 LDFLAGS="$LDFLAGS -L$withval/lib"
2068 CFLAGS="$CFLAGS -I$withval/include"
2069 gnome_prefix=$withval/lib
2074 if test "x$want_gnome" = xyes; then
2076 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
2077 if test "$GNOME_CONFIG" = "no"; then
2078 no_gnome_config="yes"
2080 AC_MSG_CHECKING(if $GNOME_CONFIG works)
2081 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
2083 GNOME_GNORBA_HOOK([],$2)
2084 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
2085 GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
2086 GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`"
2087 GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`"
2088 ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`"
2089 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
2090 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
2094 no_gnome_config="yes"
2098 if test x$exec_prefix = xNONE; then
2099 if test x$prefix = xNONE; then
2100 gnome_prefix=$ac_default_prefix/lib
2102 gnome_prefix=$prefix/lib
2105 gnome_prefix=`eval echo \`echo $libdir\``
2108 if test "$no_gnome_config" = "yes"; then
2109 AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
2110 if test -f $gnome_prefix/gnomeConf.sh; then
2111 AC_MSG_RESULT(found)
2112 echo "loading gnome configuration from" \
2113 "$gnome_prefix/gnomeConf.sh"
2114 . $gnome_prefix/gnomeConf.sh
2117 AC_MSG_RESULT(not found)
2118 if test x$2 = xfail; then
2119 AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
2125 if test -n "$3"; then
2128 AC_MSG_CHECKING(extra library \"$i\")
2131 AC_SUBST(GNOME_APPLETS_LIBS)
2132 GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets`
2133 AC_MSG_RESULT($GNOME_APPLETS_LIBS);;
2135 AC_SUBST(GNOME_DOCKLETS_LIBS)
2136 GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets`
2137 AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);;
2139 AC_SUBST(GNOME_CAPPLET_LIBS)
2140 GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet`
2141 AC_MSG_RESULT($GNOME_CAPPLET_LIBS);;
2143 AC_MSG_RESULT(unknown library)
2150 dnl GNOME_INIT ([additional-inits])
2153 AC_DEFUN([GNOME_INIT],[
2154 GNOME_INIT_HOOK([],fail,$1)
2157 dnl AC_PROG_GPERF (MINIMUM-VERSION)
2159 dnl Check for availability of gperf.
2160 dnl Abort if not found or if current version is not up to par.
2163 AC_DEFUN([AC_PROG_GPERF],[
2164 AC_PATH_PROG(GPERF, gperf, no)
2165 if test "$GPERF" = no; then
2166 AC_MSG_ERROR(Could not find gperf)
2168 min_gperf_version=ifelse([$1], ,2.7,$1)
2169 AC_MSG_CHECKING(for gperf - version >= $min_gperf_version)
2170 gperf_major_version=`$GPERF --version | \
2171 sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\1/'`
2172 gperf_minor_version=`$GPERF --version | \
2173 sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\2/'`
2176 dnl Now check if the installed gperf is sufficiently new.
2184 my_strdup (char *str)
2190 new_str = malloc ((strlen (str) + 1) * sizeof(char));
2191 strcpy (new_str, str);
2207 /* HP/UX 9 (%@#!) writes to sscanf strings */
2208 tmp_version = my_strdup("$min_gperf_version");
2209 if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) {
2210 printf ("%s, bad version string\n", "$min_gperf_version");
2214 if (($gperf_major_version > major) ||
2215 (($gperf_major_version == major) && ($gperf_minor_version >= minor))) {
2219 printf ("*** An old version of gperf ($gperf_major_version.$gperf_minor_version) was found.\n");
2220 printf ("*** You need a version of gperf newer than %d.%d.%d. The latest version of\n",
2222 printf ("*** gperf is always available from ftp://ftp.gnu.org.\n");
2227 ],,no_gperf=yes,[/bin/true])
2228 if test "x$no_gperf" = x ; then
2236 dnl Check for struct linger
2238 AC_DEFUN(AC_STRUCT_LINGER, [
2240 AC_MSG_CHECKING(struct linger is available)
2242 #include <sys/types.h>
2243 #include <sys/socket.h>
2254 AC_DEFINE(HAVE_STRUCT_LINGER)
2255 av_struct_linger=yes
2261 AC_MSG_RESULT($av_struct_linger)
2263 dnl See whether we need a declaration for a function.
2264 dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
2265 AC_DEFUN(GCC_NEED_DECLARATION,
2266 [AC_MSG_CHECKING([whether $1 must be declared])
2267 AC_CACHE_VAL(gcc_cv_decl_needed_$1,
2270 #ifdef HAVE_STRING_H
2273 #ifdef HAVE_STRINGS_H
2274 #include <strings.h>
2277 #ifdef HAVE_STDLIB_H
2280 #ifdef HAVE_UNISTD_H
2284 [char *(*pfn) = (char *(*)) $1],
2285 eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
2286 if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
2288 gcc_need_declarations="$gcc_need_declarations $1"
2289 gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2290 AC_DEFINE_UNQUOTED($gcc_tr_decl)
2296 dnl Check multiple functions to see whether each needs a declaration.
2297 dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
2298 AC_DEFUN(GCC_NEED_DECLARATIONS,
2301 GCC_NEED_DECLARATION($ac_func, $2)
2305 # Configure paths for GTK+
2306 # Owen Taylor 97-11-3
2308 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2309 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
2311 AC_DEFUN(AM_PATH_GTK,
2313 dnl Get the cflags and libraries from the gtk-config script
2315 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
2316 gtk_config_prefix="$withval", gtk_config_prefix="")
2317 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
2318 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
2319 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2320 , enable_gtktest=yes)
2326 gtk_config_args="$gtk_config_args gthread"
2331 if test x$gtk_config_exec_prefix != x ; then
2332 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
2333 if test x${GTK_CONFIG+set} != xset ; then
2334 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
2337 if test x$gtk_config_prefix != x ; then
2338 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
2339 if test x${GTK_CONFIG+set} != xset ; then
2340 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
2344 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
2345 min_gtk_version=ifelse([$1], ,0.99.7,$1)
2346 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2348 if test "$GTK_CONFIG" = "no" ; then
2351 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
2352 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
2353 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
2354 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2355 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
2356 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2357 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
2358 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2359 if test "x$enable_gtktest" = "xyes" ; then
2360 ac_save_CFLAGS="$CFLAGS"
2361 ac_save_LIBS="$LIBS"
2362 CFLAGS="$CFLAGS $GTK_CFLAGS"
2363 LIBS="$GTK_LIBS $LIBS"
2365 dnl Now check if the installed GTK is sufficiently new. (Also sanity
2366 dnl checks the results of gtk-config to some extent
2370 #include <gtk/gtk.h>
2377 int major, minor, micro;
2380 system ("touch conf.gtktest");
2382 /* HP/UX 9 (%@#!) writes to sscanf strings */
2383 tmp_version = g_strdup("$min_gtk_version");
2384 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2385 printf("%s, bad version string\n", "$min_gtk_version");
2389 if ((gtk_major_version != $gtk_config_major_version) ||
2390 (gtk_minor_version != $gtk_config_minor_version) ||
2391 (gtk_micro_version != $gtk_config_micro_version))
2393 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2394 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2395 gtk_major_version, gtk_minor_version, gtk_micro_version);
2396 printf ("*** was found! If gtk-config was correct, then it is best\n");
2397 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2398 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2399 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2400 printf("*** required on your system.\n");
2401 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
2402 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
2403 printf("*** before re-running configure\n");
2405 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
2406 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2407 (gtk_minor_version != GTK_MINOR_VERSION) ||
2408 (gtk_micro_version != GTK_MICRO_VERSION))
2410 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2411 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2412 printf("*** library (version %d.%d.%d)\n",
2413 gtk_major_version, gtk_minor_version, gtk_micro_version);
2415 #endif /* defined (GTK_MAJOR_VERSION) ... */
2418 if ((gtk_major_version > major) ||
2419 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2420 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2426 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2427 gtk_major_version, gtk_minor_version, gtk_micro_version);
2428 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2429 major, minor, micro);
2430 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2432 printf("*** If you have already installed a sufficiently new version, this error\n");
2433 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
2434 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2435 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
2436 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
2437 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2438 printf("*** so that the correct libraries are found at run-time))\n");
2443 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2444 CFLAGS="$ac_save_CFLAGS"
2445 LIBS="$ac_save_LIBS"
2448 if test "x$no_gtk" = x ; then
2450 ifelse([$2], , :, [$2])
2453 if test "$GTK_CONFIG" = "no" ; then
2454 echo "*** The gtk-config script installed by GTK could not be found"
2455 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
2456 echo "*** your path, or set the GTK_CONFIG environment variable to the"
2457 echo "*** full path to gtk-config."
2459 if test -f conf.gtktest ; then
2462 echo "*** Could not run GTK test program, checking why..."
2463 CFLAGS="$CFLAGS $GTK_CFLAGS"
2464 LIBS="$LIBS $GTK_LIBS"
2466 #include <gtk/gtk.h>
2468 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2469 [ echo "*** The test program compiled, but did not run. This usually means"
2470 echo "*** that the run-time linker is not finding GTK or finding the wrong"
2471 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
2472 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2473 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2474 echo "*** is required on your system"
2476 echo "*** If you have an old version installed, it is best to remove it, although"
2477 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
2479 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
2480 echo "*** came with the system with the command"
2482 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
2483 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2484 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
2485 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
2486 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
2487 CFLAGS="$ac_save_CFLAGS"
2488 LIBS="$ac_save_LIBS"
2493 ifelse([$3], , :, [$3])
2495 AC_SUBST(GTK_CFLAGS)