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)
48 dnl For C++, do basically the same thing.
50 AC_DEFUN([GNOME_CXX_WARNINGS],[
51 AC_ARG_ENABLE(cxx-warnings,
52 [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum)
54 AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
56 if test "x$GCC" != xyes; then
57 enable_compile_warnings=no
59 if test "x$enable_cxx_warnings" != "xno"; then
60 if test "x$GCC" = "xyes"; then
62 *[\ \ ]-Wall[\ \ ]*) ;;
63 *) warnCXXFLAGS="-Wall -Wno-unused" ;;
66 ## -W is not all that useful. And it cannot be controlled
67 ## with individual -Wno-xxx flags, unlike -Wall
68 if test "x$enable_cxx_warnings" = "xyes"; then
69 warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual"
73 AC_MSG_RESULT($warnCXXFLAGS)
76 dnl Curses detection: Munged from Midnight Commander's configure.in
81 dnl - Determine which version of curses is installed on your system
82 dnl and set the -I/-L/-l compiler entries and add a few preprocessor
84 dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
85 dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
87 dnl - Modify the following configure variables (these are the only
88 dnl curses.m4 variables you can access from within configure.in)
89 dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
90 dnl an ncurses.h that's been renamed to curses.h
92 dnl CURSES_LIBS - sets -L and -l's appropriately
93 dnl CFLAGS - if --with-sco, add -D_SVID3
94 dnl has_curses - exports result of tests to rest of configure
98 dnl 1) Add lines indicated below to acconfig.h
99 dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
100 dnl 3) Instead of #include <curses.h> you should use the following to
101 dnl properly locate ncurses or curses header file
103 dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
104 dnl #include <ncurses.h>
106 dnl #include <curses.h>
109 dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
110 dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
112 dnl Notes with automake:
113 dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
115 dnl - your Makefile.am can look something like this
116 dnl -----------------------------------------------
117 dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
119 dnl CURSES_TARGETS=name_of_curses_prog
121 dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
122 dnl other_programs_SOURCES = blah blah blah
123 dnl name_of_curses_prog_SOURCES = blah blah blah
124 dnl other_programs_LDADD = blah
125 dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
126 dnl -----------------------------------------------
129 dnl The following lines should be added to acconfig.h:
130 dnl ==================================================
132 dnl /*=== Curses version detection defines ===*/
133 dnl /* Found some version of curses that we're going to use */
134 dnl #undef HAS_CURSES
136 dnl /* Use SunOS SysV curses? */
137 dnl #undef USE_SUNOS_CURSES
139 dnl /* Use old BSD curses - not used right now */
140 dnl #undef USE_BSD_CURSES
142 dnl /* Use SystemV curses? */
143 dnl #undef USE_SYSV_CURSES
145 dnl /* Use Ncurses? */
146 dnl #undef USE_NCURSES
148 dnl /* If you Curses does not have color define this one */
149 dnl #undef NO_COLOR_CURSES
151 dnl /* Define if you want to turn on SCO-specific code */
152 dnl #undef SCO_FLAVOR
154 dnl /* Set to reflect version of ncurses *
155 dnl * 0 = version 1.*
156 dnl * 1 = version 1.9.9g
157 dnl * 2 = version 4.0/4.1 */
158 dnl #undef NCURSES_970530
160 dnl /*=== End new stuff for acconfig.h ===*/
164 AC_DEFUN(AC_CHECK_CURSES,[
171 AC_SUBST(CURSES_LIBS)
172 AC_SUBST(CURSES_INCLUDEDIR)
175 [ --with-sco Use this to turn on SCO-specific code],[
176 if test x$withval = xyes; then
177 AC_DEFINE(SCO_FLAVOR, 1, [dummy])
178 CFLAGS="$CFLAGS -D_SVID3"
182 AC_ARG_WITH(sunos-curses,
183 [ --with-sunos-curses Used to force SunOS 4.x curses],[
184 if test x$withval = xyes; then
189 AC_ARG_WITH(osf1-curses,
190 [ --with-osf1-curses Used to force OSF/1 curses],[
191 if test x$withval = xyes; then
197 [ --with-vcurses[=incdir] Used to force SysV curses],
198 if test x$withval != xyes; then
199 CURSES_INCLUDEDIR="-I$withval"
205 [ --with-ncurses[=dir] Compile with ncurses/locate base dir],
206 if test x$withval = xno ; then
208 elif test x$withval != xyes ; then
209 CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
210 CURSES_INCLUDEDIR="-I$withval/include"
212 screen_manager="ncurses"
213 AC_DEFINE(USE_NCURSES, 1, [dummy])
214 AC_DEFINE(HAS_CURSES, 1, [dummy])
228 AC_DEFUN(AC_USE_SUNOS_CURSES, [
230 screen_manager="SunOS 4.x /usr/5include curses"
231 AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
232 AC_DEFINE(USE_SUNOS_CURSES, 1, [dummy])
233 AC_DEFINE(HAS_CURSES, 1, [dummy])
235 AC_DEFINE(NO_COLOR_CURSES, 1, [dummy])
236 AC_DEFINE(USE_SYSV_CURSES, 1, [dummy])
237 CURSES_INCLUDEDIR="-I/usr/5include"
238 CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
239 AC_MSG_RESULT(Please note that some screen refreshs may fail)
242 AC_DEFUN(AC_USE_OSF1_CURSES, [
243 AC_MSG_RESULT(Using OSF1 curses)
245 screen_manager="OSF1 curses"
246 AC_DEFINE(HAS_CURSES, 1, [dummy])
248 AC_DEFINE(NO_COLOR_CURSES, 1 [dummy])
249 AC_DEFINE(USE_SYSV_CURSES, 1, [dummy])
250 CURSES_LIBS="-lcurses"
253 AC_DEFUN(AC_USE_SYSV_CURSES, [
254 AC_MSG_RESULT(Using SysV curses)
255 AC_DEFINE(HAS_CURSES, 1, [dummy])
257 AC_DEFINE(USE_SYSV_CURSES, 1, [dummy])
259 screen_manager="SysV/curses"
260 CURSES_LIBS="-lcurses"
263 dnl AC_ARG_WITH(bsd-curses,
264 dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
265 dnl search_ncurses=false
266 dnl screen_manager="Ultrix/cursesX"
267 dnl if test $system = ULTRIX
269 dnl THIS_CURSES=cursesX
271 dnl THIS_CURSES=curses
274 dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
275 dnl AC_DEFINE(HAS_CURSES, 1, [dummy])
277 dnl AC_DEFINE(USE_BSD_CURSES, 1, [dummy])
278 dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
279 dnl AC_MSG_WARN(Use of the bsdcurses extension has some)
280 dnl AC_MSG_WARN(display/input problems.)
281 dnl AC_MSG_WARN(Reconsider using xcurses)
286 dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
288 AC_DEFUN(AC_NCURSES, [
293 AC_MSG_RESULT(Found ncurses on $1/$2)
295 CURSES_INCLUDEDIR="$4"
298 AC_DEFINE(HAS_CURSES, 1, [dummy])
300 AC_DEFINE(USE_NCURSES, 1, [dummy])
305 AC_DEFUN(AC_SEARCH_NCURSES, [
306 AC_MSG_NOTICE("checking location of ncurses.h file")
308 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
309 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
310 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
311 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")
313 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")
315 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
318 dnl We couldn't find ncurses, try SysV curses
322 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
324 AC_EGREP_CPP(USE_NCURSES,[
331 CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
332 AC_DEFINE(HAS_CURSES, 1, [dummy])
334 AC_DEFINE(USE_NCURSES, 1, [dummy])
336 screen_manager="ncurses installed as curses"
341 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
342 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
343 dnl should be replaced by a more fine grained selection routine
347 if test -f /usr/5include/curses.h
352 # check for ncurses version, to properly ifdef mouse-fix
353 AC_MSG_CHECKING(for ncurses version)
354 ncurses_version=unknown
355 cat > conftest.$ac_ext <<EOF
356 [#]line __oline__ "configure"
357 #include "confdefs.h"
358 #ifdef RENAMED_NCURSES
364 VERSION:NCURSES_VERSION
366 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
367 egrep "VERSION:" >conftest.out 2>&1; then
369 ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
373 AC_MSG_RESULT($ncurses_version)
374 case "$ncurses_version" in
378 AC_DEFINE(NCURSES_970530, 2, [dummy])
381 AC_DEFINE(NCURSES_970530, 1, [dummy])
384 AC_DEFINE(NCURSES_970530, 0, [dummy])
394 # Configure paths for Bonobo
395 # Miguel de Icaza, 99-04-12
396 # Stolen from Chris Lahey 99-2-5
397 # stolen from Manish Singh again
398 # stolen back from Frank Belew
399 # stolen from Manish Singh
400 # Shamelessly stolen from Owen Taylor
402 dnl AM_PATH_BONOBO ([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
403 dnl Test for Bonobo, and define BONOBO_CFLAGS and BONOBO_LIBS
405 AC_DEFUN([AM_PATH_BONOBO],
408 dnl Get the cflags and libraries from the gnome-config script
410 AC_ARG_WITH(bonobo-prefix,[ --with-bonobo-prefix=PFX Prefix where Bonobo is installed (optional)],
411 bonobo_prefix="$withval", bonobo_prefix="")
412 AC_ARG_WITH(bonobo-exec-prefix,[ --with-bonobo-exec-prefix=PFX Exec prefix where Bonobo is installed (optional)],
413 bonobo_exec_prefix="$withval", bonobo_exec_prefix="")
414 AC_ARG_ENABLE(bonobotest, [ --disable-bonobotest Do not try to compile and run a test Bonobo program],
415 , enable_bonobotest=yes)
417 if test x$bonobo_exec_prefix != x ; then
418 bonobo_args="$bonobo_args --exec-prefix=$bonobo_exec_prefix"
419 if test x${GNOME_CONFIG+set} != xset ; then
420 GNOME_CONFIG=$bonobo_exec_prefix/bin/gnome-config
423 if test x$bonobo_prefix != x ; then
424 bonobo_args="$bonobo_args --prefix=$bonobo_prefix"
425 if test x${GNOME_CONFIG+set} != xset ; then
426 GNOME_CONFIG=$bonobo_prefix/bin/gnome-config
430 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
431 min_bonobo_version=ifelse([$1], ,0.1.0,$1)
432 AC_MSG_CHECKING(for BONOBO - version >= $min_bonobo_version)
434 if test "$GNOME_CONFIG" = "no" ; then
437 BONOBO_CFLAGS=`$GNOME_CONFIG $bonoboconf_args --cflags bonobo`
438 BONOBO_LIBS=`$GNOME_CONFIG $bonoboconf_args --libs bonobo`
440 bonobo_major_version=`$GNOME_CONFIG $bonobo_args --version | \
441 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
442 bonobo_minor_version=`$GNOME_CONFIG $bonobo_args --version | \
443 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
444 bonobo_micro_version=`$GNOME_CONFIG $bonobo_config_args --version | \
445 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
446 if test "x$enable_bonobotest" = "xyes" ; then
447 ac_save_CFLAGS="$CFLAGS"
449 CFLAGS="$CFLAGS $BONOBO_CFLAGS"
450 LIBS="$LIBS $BONOBO_LIBS"
452 dnl Now check if the installed BONOBO is sufficiently new. (Also sanity
453 dnl checks the results of gnome-config to some extent
455 rm -f conf.bonobotest
463 my_strdup (char *str)
469 new_str = malloc ((strlen (str) + 1) * sizeof(char));
470 strcpy (new_str, str);
480 int major, minor, micro;
483 system ("touch conf.bonobotest");
484 bonobo_object_get_type ();
488 ],, no_bonobo=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
489 CFLAGS="$ac_save_CFLAGS"
493 if test "x$no_bonobo" = x ; then
495 ifelse([$2], , :, [$2])
498 if test "$GNOME_CONFIG" = "no" ; then
499 echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
500 echo "*** If BONOBO was installed in PREFIX, make sure PREFIX/bin is in"
501 echo "*** your path, or set the GNOME_CONFIG environment variable to the"
502 echo "*** full path to gnome-config."
504 if test -f conf.bonobotest ; then
507 echo "*** Could not run BONOBO test program, checking why..."
508 CFLAGS="$CFLAGS $BONOBO_CFLAGS"
509 LIBS="$LIBS $BONOBO_LIBS"
512 #include <bonobo/gnome-object.h>
514 [ echo "*** The test program compiled, but did not run. This usually means"
515 echo "*** that the run-time linker is not finding BONOBO or finding the wrong"
516 echo "*** version of BONOBO. If it is not finding BONOBO, you'll need to set your"
517 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
518 echo "*** to the installed location Also, make sure you have run ldconfig if that"
519 echo "*** is required on your system"
521 echo "*** If you have an old version installed, it is best to remove it, although"
522 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
523 [ echo "*** The test program failed to compile or link. See the file config.log for the"
524 echo "*** exact error that occured. This usually means BONOBO was incorrectly installed"
525 echo "*** or that you have moved BONOBO since it was installed. In the latter case, you"
526 echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
527 CFLAGS="$ac_save_CFLAGS"
533 ifelse([$3], , :, [$3])
535 AC_SUBST(BONOBO_CFLAGS)
536 AC_SUBST(BONOBO_LIBS)
537 rm -f conf.bonobotest
540 AC_DEFUN([BONOBO_CHECK], [
541 AM_PATH_BONOBO(0.1.0,,[AC_MSG_ERROR(BONOBO not found)])
546 # This only for packages that are not in the GNOME CVS tree.
548 dnl GNOME_COMMON_INIT
550 AC_DEFUN([GNOME_COMMON_INIT],
552 GNOME_ACLOCAL_DIR=`$ACLOCAL --print-ac-dir`/gnome
553 AC_SUBST(GNOME_ACLOCAL_DIR)
555 ACLOCAL="$ACLOCAL -I $GNOME_ACLOCAL_DIR"
559 dnl GNOME_FILEUTILS_CHECKS
561 dnl checks that are needed for the diskusage applet.
564 AC_DEFUN([GNOME_FILEUTILS_CHECKS],
566 AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \
567 mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \
568 sys/filsys.h sys/fs_types.h sys/fs/s5param.h)
570 AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \
571 getcwd getmntinfo gettimeofday isascii lchown \
572 listmntent memcpy mkfifo strchr strerror strrchr vprintf)
574 dnl Set some defaults when cross-compiling
576 if test x$cross_compiling = xyes ; then
579 fu_cv_sys_mounted_getmntent1=yes
580 fu_cv_sys_stat_statfs2_bsize=yes
583 fu_cv_sys_stat_statfs4=yes
586 fu_cv_sys_stat_statfs2_bsize=yes
589 fu_cv_sys_stat_statfs3_osf1=yes
594 # Determine how to get the list of mounted filesystems.
597 # If the getmntent function is available but not in the standard library,
598 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
601 # This test must precede the ones for getmntent because Unicos-9 is
602 # reported to have the getmntent function, but its support is incompatible
603 # with other getmntent implementations.
605 # NOTE: Normally, I wouldn't use a check for system type as I've done for
606 # `CRAY' below since that goes against the whole autoconf philosophy. But
607 # I think there is too great a chance that some non-Cray system has a
608 # function named listmntent to risk the false positive.
610 if test -z "$list_mounted_fs"; then
612 AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
613 AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
614 [fu_cv_sys_mounted_cray_listmntent=no
619 ], [test $ac_cv_func_listmntent = yes \
620 && fu_cv_sys_mounted_cray_listmntent=yes]
624 AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
625 if test $fu_cv_sys_mounted_cray_listmntent = yes; then
626 list_mounted_fs=found
627 AC_DEFINE(MOUNTED_LISTMNTENT, 1, [dummy])
631 if test $ac_cv_func_getmntent = yes; then
633 # This system has the getmntent function.
634 # Determine whether it's the one-argument variant or the two-argument one.
636 if test -z "$list_mounted_fs"; then
637 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
638 AC_MSG_CHECKING([for one-argument getmntent function])
639 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
640 [test $ac_cv_header_mntent_h = yes \
641 && fu_cv_sys_mounted_getmntent1=yes \
642 || fu_cv_sys_mounted_getmntent1=no])
643 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
644 if test $fu_cv_sys_mounted_getmntent1 = yes; then
645 list_mounted_fs=found
646 AC_DEFINE(MOUNTED_GETMNTENT1, 1, [dummy])
650 if test -z "$list_mounted_fs"; then
652 AC_MSG_CHECKING([for two-argument getmntent function])
653 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
654 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
655 fu_cv_sys_mounted_getmntent2=yes,
656 fu_cv_sys_mounted_getmntent2=no)])
657 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
658 if test $fu_cv_sys_mounted_getmntent2 = yes; then
659 list_mounted_fs=found
660 AC_DEFINE(MOUNTED_GETMNTENT2, 1, [dummy])
664 if test -z "$list_mounted_fs"; then
665 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
670 if test -z "$list_mounted_fs"; then
671 # DEC Alpha running OSF/1.
672 AC_MSG_CHECKING([for getfsstat function])
673 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
675 #include <sys/types.h>
676 #include <sys/mount.h>
677 #include <sys/fs_types.h>],
678 [struct statfs *stats;
679 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
680 fu_cv_sys_mounted_getsstat=yes,
681 fu_cv_sys_mounted_getsstat=no)])
682 AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
683 if test $fu_cv_sys_mounted_getsstat = yes; then
684 list_mounted_fs=found
685 AC_DEFINE(MOUNTED_GETFSSTAT, 1, [dummy])
689 if test -z "$list_mounted_fs"; then
691 AC_MSG_CHECKING([for mntctl function and struct vmount])
692 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
693 [AC_TRY_CPP([#include <fshelp.h>],
694 fu_cv_sys_mounted_vmount=yes,
695 fu_cv_sys_mounted_vmount=no)])
696 AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
697 if test $fu_cv_sys_mounted_vmount = yes; then
698 list_mounted_fs=found
699 AC_DEFINE(MOUNTED_VMOUNT, 1, [dummy])
703 if test -z "$list_mounted_fs"; then
705 AC_MSG_CHECKING([for FIXME existence of three headers])
706 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
708 #include <sys/statfs.h>
709 #include <sys/fstyp.h>
710 #include <mnttab.h>],
711 fu_cv_sys_mounted_fread_fstyp=yes,
712 fu_cv_sys_mounted_fread_fstyp=no)])
713 AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
714 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
715 list_mounted_fs=found
716 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1, [dummy])
720 if test -z "$list_mounted_fs"; then
721 # 4.4BSD and DEC OSF/1.
722 AC_MSG_CHECKING([for getmntinfo function])
723 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
726 if test $ac_cv_func_getmntinfo = yes; then
727 AC_EGREP_HEADER(f_type;, sys/mount.h,
731 && fu_cv_sys_mounted_getmntinfo=yes \
732 || fu_cv_sys_mounted_getmntinfo=no
734 AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
735 if test $fu_cv_sys_mounted_getmntinfo = yes; then
736 list_mounted_fs=found
737 AC_DEFINE(MOUNTED_GETMNTINFO, 1, [dummy])
741 # FIXME: add a test for netbsd-1.1 here
743 if test -z "$list_mounted_fs"; then
745 AC_MSG_CHECKING([for getmnt function])
746 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
748 #include <sys/fs_types.h>
749 #include <sys/mount.h>],
750 fu_cv_sys_mounted_getmnt=yes,
751 fu_cv_sys_mounted_getmnt=no)])
752 AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
753 if test $fu_cv_sys_mounted_getmnt = yes; then
754 list_mounted_fs=found
755 AC_DEFINE(MOUNTED_GETMNT, 1, [dummy])
759 if test -z "$list_mounted_fs"; then
761 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
762 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
763 [AC_TRY_CPP([#include <mnttab.h>],
764 fu_cv_sys_mounted_fread=yes,
765 fu_cv_sys_mounted_fread=no)])
766 AC_MSG_RESULT($fu_cv_sys_mounted_fread)
767 if test $fu_cv_sys_mounted_fread = yes; then
768 list_mounted_fs=found
769 AC_DEFINE(MOUNTED_FREAD, 1, [dummy])
773 if test -z "$list_mounted_fs"; then
774 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
775 # FIXME -- no need to abort building the whole package
776 # Can't build mountlist.c or anything that needs its functions
779 AC_MSG_NOTICE(checking how to get filesystem space usage)
782 # Perform only the link test since it seems there are no variants of the
783 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
784 # because that got a false positive on SCO OSR5. Adding the declaration
785 # of a `struct statvfs' causes this test to fail (as it should) on such
786 # systems. That system is reported to work fine with STAT_STATFS4 which
787 # is what it gets when this test fails.
788 if test $space = no; then
790 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
791 [AC_TRY_LINK([#include <sys/types.h>
792 #include <sys/statvfs.h>],
793 [struct statvfs fsd; statvfs (0, &fsd);],
794 fu_cv_sys_stat_statvfs=yes,
795 fu_cv_sys_stat_statvfs=no)])
796 if test $fu_cv_sys_stat_statvfs = yes; then
798 AC_DEFINE(STAT_STATVFS, 1, [dummy])
802 if test $space = no; then
803 # DEC Alpha running OSF/1
804 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
805 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
807 #include <sys/param.h>
808 #include <sys/types.h>
809 #include <sys/mount.h>
814 exit (statfs (".", &fsd, sizeof (struct statfs)));
816 fu_cv_sys_stat_statfs3_osf1=yes,
817 fu_cv_sys_stat_statfs3_osf1=no,
818 fu_cv_sys_stat_statfs3_osf1=no)])
819 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
820 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
822 AC_DEFINE(STAT_STATFS3_OSF1, 1, [dummy])
826 if test $space = no; then
828 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
829 member (AIX, 4.3BSD)])
830 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
832 #ifdef HAVE_SYS_PARAM_H
833 #include <sys/param.h>
835 #ifdef HAVE_SYS_MOUNT_H
836 #include <sys/mount.h>
838 #ifdef HAVE_SYS_VFS_H
845 exit (statfs (".", &fsd));
847 fu_cv_sys_stat_statfs2_bsize=yes,
848 fu_cv_sys_stat_statfs2_bsize=no,
849 fu_cv_sys_stat_statfs2_bsize=no)])
850 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
851 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
853 AC_DEFINE(STAT_STATFS2_BSIZE, 1, [dummy])
857 if test $space = no; then
859 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
860 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
861 [AC_TRY_RUN([#include <sys/types.h>
862 #include <sys/statfs.h>
866 exit (statfs (".", &fsd, sizeof fsd, 0));
868 fu_cv_sys_stat_statfs4=yes,
869 fu_cv_sys_stat_statfs4=no,
870 fu_cv_sys_stat_statfs4=no)])
871 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
872 if test $fu_cv_sys_stat_statfs4 = yes; then
874 AC_DEFINE(STAT_STATFS4, 1, [dummy])
878 if test $space = no; then
880 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
881 member (4.4BSD and NetBSD)])
882 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
883 [AC_TRY_RUN([#include <sys/types.h>
884 #ifdef HAVE_SYS_PARAM_H
885 #include <sys/param.h>
887 #ifdef HAVE_SYS_MOUNT_H
888 #include <sys/mount.h>
894 exit (statfs (".", &fsd));
896 fu_cv_sys_stat_statfs2_fsize=yes,
897 fu_cv_sys_stat_statfs2_fsize=no,
898 fu_cv_sys_stat_statfs2_fsize=no)])
899 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
900 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
902 AC_DEFINE(STAT_STATFS2_FSIZE, 1, [dummy])
906 if test $space = no; then
908 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
909 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
910 [AC_TRY_RUN([#include <sys/types.h>
911 #ifdef HAVE_SYS_PARAM_H
912 #include <sys/param.h>
914 #ifdef HAVE_SYS_MOUNT_H
915 #include <sys/mount.h>
917 #ifdef HAVE_SYS_FS_TYPES_H
918 #include <sys/fs_types.h>
923 /* Ultrix's statfs returns 1 for success,
924 0 for not mounted, -1 for failure. */
925 exit (statfs (".", &fsd) != 1);
927 fu_cv_sys_stat_fs_data=yes,
928 fu_cv_sys_stat_fs_data=no,
929 fu_cv_sys_stat_fs_data=no)])
930 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
931 if test $fu_cv_sys_stat_fs_data = yes; then
933 AC_DEFINE(STAT_STATFS2_FS_DATA, 1, [dummy])
937 if test $space = no; then
939 AC_TRY_CPP([#include <sys/filsys.h>],
940 AC_DEFINE(STAT_READ_FILSYS, 1, [dummy]) space=yes)
943 if test -n "$list_mounted_fs" && test $space != no; then
945 # LIBOBJS="$LIBOBJS fsusage.o"
946 # LIBOBJS="$LIBOBJS mountlist.o"
949 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
950 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
951 # enable the work-around code in fsusage.c.
952 AC_MSG_CHECKING([for statfs that truncates block counts])
953 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
955 #if !defined(sun) && !defined(__sun)
956 choke -- this is a workaround for a Sun-specific problem
958 #include <sys/types.h>
959 #include <sys/vfs.h>],
960 [struct statfs t; long c = *(t.f_spare);],
961 fu_cv_sys_truncating_statfs=yes,
962 fu_cv_sys_truncating_statfs=no,
964 if test $fu_cv_sys_truncating_statfs = yes; then
965 AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1, [dummy])
967 AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
970 test -d /afs && AC_DEFINE(AFS, 1, [dummy])
972 AC_DEFUN([GNOME_GHTTP_CHECK],[
973 AC_REQUIRE([GNOME_INIT_HOOK])
975 AC_CHECK_FUNC(connect,,[
976 AC_CHECK_LIB(socket,connect,
977 GHTTP_LIB="-lsocket $GHTTP_LIB",,$GHTTP_LIB)])
978 AC_CHECK_FUNC(gethostbyname,,[
979 AC_CHECK_LIB(nsl,gethostbyname,
980 GHTTP_LIB="-lnsl $GHTTP_LIB",,$GHTTP_LIB)])
981 AC_CHECK_LIB(ghttp, ghttp_request_new,
982 GHTTP_LIB="-lghttp $GHTTP_LIB",GHTTP_LIB="",-L$gnome_prefix $GHTTP_LIB)
984 AC_PROVIDE([GNOME_GHTTP_CHECK])
987 dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag)
989 dnl if failflag is "failure" it aborts if gnorba is not found.
992 AC_DEFUN([GNOME_GNORBA_HOOK],[
993 GNOME_ORBIT_HOOK([],$2)
994 AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[
995 gnome_cv_gnorba_found=no
996 if test x$gnome_cv_orbit_found = xyes; then
997 GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
998 GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
999 if test -n "$GNORBA_LIBS"; then
1000 gnome_cv_gnorba_found=yes
1004 AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes)
1005 if test x$gnome_cv_orbit_found = xyes; then
1007 GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
1008 GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
1009 AC_SUBST(GNORBA_CFLAGS)
1010 AC_SUBST(GNORBA_LIBS)
1012 if test x$2 = xfailure; then
1013 AC_MSG_ERROR(gnorba library not installed or installation problem)
1018 AC_DEFUN([GNOME_GNORBA_CHECK], [
1019 GNOME_GNORBA_HOOK([],failure)
1022 dnl GNOME_CHECK_GUILE (failflag)
1024 dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found.
1027 AC_DEFUN([GNOME_CHECK_GUILE],
1029 saved_ldflags="$LDFLAGS"
1030 saved_cppflags="$CPPFLAGS"
1031 LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
1033 AC_CHECK_LIB(qthreads,qt_null,[
1034 QTTHREADS_LIB="-lqthreads"
1036 AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt")
1038 AC_SUBST(QTTHREADS_LIB)
1040 AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap")
1041 AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB)
1043 AC_SUBST(TERMCAP_LIB)
1044 AC_SUBST(READLINE_LIB)
1046 if test "x$cross_compiling" = "xyes" ; then
1047 name_build_guile="$target_alias-guile-config"
1049 name_build_guile="guile-config"
1052 AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
1054 if test "x$BUILD_GUILE" = "xyes"; then
1055 AC_MSG_CHECKING(whether $name_build_guile works)
1056 if test x`$name_build_guile --version >/dev/null 2>&1 || \
1057 echo no` = xno; then
1060 AC_MSG_RESULT($BUILD_GUILE)
1063 if test "x$cross_compiling" = "xyes" ; then
1064 name_build_guile="$target_alias-build-guile"
1066 name_build_guile="build-guile"
1069 AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
1071 if test "x$BUILD_GUILE" = "xyes"; then
1072 AC_MSG_CHECKING(whether $name_build_guile works)
1073 if test x`$name_build_guile --version >/dev/null 2>&1 || \
1074 echo no` = xno; then
1077 AC_MSG_RESULT($BUILD_GUILE)
1081 AC_CHECK_LIB(m, sin)
1083 if test "x$BUILD_GUILE" = "xyes"; then
1084 AC_MSG_CHECKING(for guile libraries)
1085 GUILE_LIBS="`$name_build_guile link`"
1086 AC_MSG_RESULT($GUILE_LIBS)
1087 AC_MSG_CHECKING(for guile headers)
1088 GUILE_INCS="`$name_build_guile compile`"
1089 AC_MSG_RESULT($GUILE_INCS)
1091 GUILE_LIBS="$GNOME_LIBDIR"
1092 GUILE_INCS="$GNOME_INCLUDEDIR"
1093 AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS")
1094 AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS")
1095 AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS")
1096 AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl")
1097 AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket")
1098 GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB"
1101 AC_SUBST(GUILE_LIBS)
1102 AC_SUBST(GUILE_INCS)
1105 LIBS="$LIBS $GUILE_LIBS"
1106 CPPFLAGS="$saved_cppflags $GUILE_INCS"
1108 AC_MSG_CHECKING(whether guile works)
1110 #include <libguile.h>
1111 #include <guile/gh.h>
1113 gh_eval_str("(newline)");
1114 scm_boot_guile(0,NULL,NULL,NULL);
1116 ac_cv_guile_found=yes
1117 AC_DEFINE(HAVE_GUILE, 1, [dummy])
1119 ac_cv_guile_found=no
1121 AC_MSG_RESULT($ac_cv_guile_found)
1123 if test x$ac_cv_guile_found = xno ; then
1124 if test x$1 = xfail ; then
1125 AC_MSG_ERROR(Can not find Guile on this system)
1127 AC_MSG_WARN(Can not find Guile on this system)
1129 ac_cv_guile_found=no
1130 GUILE_LIBS= GUILE_INCS=
1134 LDFLAGS="$saved_ldflags"
1135 CPPFLAGS="$saved_cppflags"
1137 AC_SUBST(GUILE_LIBS)
1138 AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes)
1141 dnl LIBGTOP_CHECK_TYPE
1143 dnl Improved version of AC_CHECK_TYPE which takes into account
1144 dnl that we need to #include some other header files on some
1145 dnl systems to get some types.
1147 dnl AC_LIBGTOP_CHECK_TYPE(TYPE, DEFAULT)
1148 AC_DEFUN(AC_LIBGTOP_CHECK_TYPE,
1149 [AC_REQUIRE([AC_HEADER_STDC])dnl
1150 AC_MSG_CHECKING(for $1)
1151 AC_CACHE_VAL(ac_cv_type_$1,
1153 changequote(<<,>>)dnl
1154 <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
1155 changequote([,]), [#include <sys/types.h>
1162 #ifdef HAVE_SYS_BITYPES_H
1163 #include <sys/bitypes.h>
1165 ], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
1166 AC_MSG_RESULT($ac_cv_type_$1)
1167 if test $ac_cv_type_$1 = no; then
1168 AC_DEFINE($1, $2, [dummy])
1173 dnl GNOME_LIBGTOP_TYPES
1175 dnl some typechecks for libgtop.
1178 AC_DEFUN([GNOME_LIBGTOP_TYPES],
1180 AC_CHECK_HEADERS(sys/bitypes.h)
1181 AC_LIBGTOP_CHECK_TYPE(u_int64_t, unsigned long long int)
1182 AC_LIBGTOP_CHECK_TYPE(int64_t, signed long long int)
1186 dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag)
1188 dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop
1192 AC_DEFUN([GNOME_LIBGTOP_HOOK],
1194 AC_REQUIRE([GNOME_LIBGTOP_TYPES])
1196 AC_SUBST(LIBGTOP_LIBDIR)
1197 AC_SUBST(LIBGTOP_INCLUDEDIR)
1198 AC_SUBST(LIBGTOP_EXTRA_LIBS)
1199 AC_SUBST(LIBGTOP_LIBS)
1200 AC_SUBST(LIBGTOP_INCS)
1201 AC_SUBST(LIBGTOP_NAMES_LIBS)
1202 AC_SUBST(LIBGTOP_NAMES_INCS)
1203 AC_SUBST(LIBGTOP_MAJOR_VERSION)
1204 AC_SUBST(LIBGTOP_MINOR_VERSION)
1205 AC_SUBST(LIBGTOP_MICRO_VERSION)
1206 AC_SUBST(LIBGTOP_VERSION)
1207 AC_SUBST(LIBGTOP_VERSION_CODE)
1208 AC_SUBST(LIBGTOP_SERVER_VERSION)
1209 AC_SUBST(LIBGTOP_INTERFACE_AGE)
1210 AC_SUBST(LIBGTOP_BINARY_AGE)
1211 AC_SUBST(LIBGTOP_BINDIR)
1212 AC_SUBST(LIBGTOP_SERVER)
1214 dnl Get the cflags and libraries from the libgtop-config script
1216 AC_ARG_WITH(libgtop,
1217 [ --with-libgtop=PFX Prefix where LIBGTOP is installed (optional)],
1218 libgtop_config_prefix="$withval", libgtop_config_prefix="")
1219 AC_ARG_WITH(libgtop-exec,
1220 [ --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)],
1221 libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="")
1223 if test x$libgtop_config_exec_prefix != x ; then
1224 libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix"
1225 if test x${LIBGTOP_CONFIG+set} != xset ; then
1226 LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config
1229 if test x$libgtop_config_prefix != x ; then
1230 libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix"
1231 if test x${LIBGTOP_CONFIG+set} != xset ; then
1232 LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config
1236 AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no)
1237 dnl IMPORTANT NOTICE:
1238 dnl If you increase this number here, this means that *ALL*
1239 dnl modules will require the new version, even if they explicitly
1240 dnl give a lower number in their `configure.in' !!!
1241 real_min_libgtop_version=1.0.0
1242 min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1)
1243 dnl I know, the following code looks really ugly, but if you want
1244 dnl to make changes, please test it with a brain-dead /bin/sh and
1245 dnl with a brain-dead /bin/test (not all shells/tests support the
1246 dnl `<' operator to compare strings, that's why I convert everything
1247 dnl into numbers and test them).
1248 min_libgtop_major=`echo $min_libgtop_version | \
1249 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1250 min_libgtop_minor=`echo $min_libgtop_version | \
1251 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1252 min_libgtop_micro=`echo $min_libgtop_version | \
1253 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1254 test x$min_libgtop_micro = x && min_libgtop_micro=0
1255 real_min_libgtop_major=`echo $real_min_libgtop_version | \
1256 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1257 real_min_libgtop_minor=`echo $real_min_libgtop_version | \
1258 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1259 real_min_libgtop_micro=`echo $real_min_libgtop_version | \
1260 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1261 test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0
1262 dnl You cannot require a version less then $real_min_libgtop_version,
1263 dnl so you don't need to update each `configure.in' when it's increased.
1264 if test $real_min_libgtop_major -gt $min_libgtop_major ; then
1265 min_libgtop_major=$real_min_libgtop_major
1266 min_libgtop_minor=$real_min_libgtop_minor
1267 min_libgtop_micro=$real_min_libgtop_micro
1268 elif test $real_min_libgtop_major = $min_libgtop_major ; then
1269 if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then
1270 min_libgtop_minor=$real_min_libgtop_minor
1271 min_libgtop_micro=$real_min_libgtop_micro
1272 elif test $real_min_libgtop_minor = $min_libgtop_minor ; then
1273 if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then
1274 min_libgtop_micro=$real_min_libgtop_micro
1278 min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro"
1279 AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version)
1281 if test "$LIBGTOP_CONFIG" = "no" ; then
1284 configfile=`$LIBGTOP_CONFIG --config`
1285 libgtop_major_version=`$LIBGTOP_CONFIG --version | \
1286 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1287 libgtop_minor_version=`$LIBGTOP_CONFIG --version | \
1288 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1289 libgtop_micro_version=`$LIBGTOP_CONFIG --version | \
1290 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1291 if test $libgtop_major_version != $min_libgtop_major ; then
1294 test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes
1295 if test $libgtop_minor_version = $min_libgtop_minor ; then
1296 test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes
1301 if test x$no_libgtop = x ; then
1302 AC_DEFINE(HAVE_LIBGTOP, 1, [dummy])
1303 AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION", [dummy])
1304 AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE, [dummy])
1305 AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION, [dummy])
1306 AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION, [dummy])
1307 AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION, [dummy])
1308 AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION, [dummy]
1310 dnl Note that an empty true branch is not valid sh syntax.
1311 ifelse([$2], [], :, [$2])
1314 if test "$no_libgtop"x = mismatchx; then
1315 AC_MSG_ERROR(LibGTop major version mismatch $libgtop_major_version != $min_libgtop_major)
1317 if test "x$3" = "xfail"; then
1318 AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found)
1320 AC_MSG_WARN(LibGTop >= $min_libgtop_version not found)
1324 AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes)
1327 AC_DEFUN([GNOME_INIT_LIBGTOP],[
1328 GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2)
1332 dnl GNOME_LIBGTOP_DOCU
1334 dnl checks whether the documentation of LibGTop is installed
1337 AC_DEFUN([GNOME_LIBGTOP_DOCU],
1339 AC_REQUIRE([GNOME_LIBGTOP_HOOK])
1341 helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop"
1343 AC_MSG_CHECKING(whether you have the LibGTop Documentation)
1345 if test -f "$helpdir/C/topic.dat" ; then
1346 have_libgtop_docu=yes
1347 AC_DEFINE(HAVE_LIBGTOP_DOCU, 1, [dummy])
1349 have_libgtop_docu=no
1352 AC_MSG_RESULT($have_libgtop_docu)
1354 AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes)
1357 AC_DEFUN([GNOME_CHECK_OBJC],
1359 dnl Look for an ObjC compiler.
1360 dnl FIXME: extend list of possible names of ObjC compilers.
1361 AC_CHECK_PROGS(OBJC, $OBJC egcs, "")
1362 if test "x$OBJC" = "x" ; then
1363 AC_CHECK_PROGS(OBJC, $OBJC egcc, "")
1364 if test "x$OBJC" = "x" ; then
1365 AC_CHECK_PROGS(OBJC, $OBJC gcc, "")
1369 AC_REQUIRE([GNOME_PTHREAD_CHECK])
1371 OBJC_LIBS="-lobjc $PTHREAD_LIB"
1372 AC_CHECK_FUNC(sched_yield,,[
1373 AC_CHECK_LIB(rt,sched_yield,
1374 OBJC_LIBS="$OBJC_LIBS -lrt",[
1375 AC_CHECK_LIB(posix4,sched_yield,
1376 OBJC_LIBS="$OBJC_LIBS -lposix4",,
1381 AC_CACHE_CHECK([if Objective C compiler ($OBJC) works],
1382 ac_cv_prog_objc_works, [
1383 if test -n "$OBJC"; then
1384 cat > conftest.m <<EOF
1385 #include <objc/Object.h>
1386 @interface myRandomObj : Object
1390 @implementation myRandomObj
1393 /* No, you are not seeing double. Remember that square brackets
1394 are the autoconf m4 quotes. */
1395 id myid = [[myRandomObj alloc]];
1401 $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1
1405 if test $result -eq 0; then
1406 ac_cv_prog_objc_works=yes
1409 ac_cv_prog_objc_works=no
1413 AM_CONDITIONAL(OBJECTIVE_C, test x$ac_cv_prog_objc_works = xyes)
1414 dnl Also set the shell variable OBJECTIVE_C to "yes" or "no".
1415 OBJECTIVE_C=$ac_cv_prog_objc_works
1418 AC_DEFUN([GNOME_INIT_OBJC],
1420 AC_MSG_CHECKING(for an obGnomeConf.sh)
1421 my_gnome_libdir=`$GNOME_CONFIG --libdir`
1422 if test -f $my_gnome_libdir/obGnomeConf.sh; then
1423 . $my_gnome_libdir/obGnomeConf.sh
1424 AC_MSG_RESULT(found $my_gnome_libdir)
1425 ac_cv_have_gnome_objc=yes
1427 AC_MSG_RESULT(not found)
1428 AC_MSG_WARN(Could not find the obGnomeConf.sh file that is generated by gnome-objc install)
1429 ac_cv_have_gnome_objc=no
1432 dnl Add a conditional on whether or not we have gnome-objc
1433 AM_CONDITIONAL(HAVE_GNOME_OBJC, test x$ac_cv_have_gnome_objc = xyes)
1434 HAVE_GNOME_OBJC=$ac_cv_have_gnome_objc
1436 AC_SUBST(OBGNOME_INCLUDEDIR)
1437 AC_SUBST(OBGNOME_LIBS)
1438 AC_SUBST(OBGTK_LIBS)
1441 dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag)
1443 dnl if failflag is "failure" it aborts if orbit is not found.
1446 AC_DEFUN([GNOME_ORBIT_HOOK],[
1447 AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no)
1448 AC_PATH_PROG(ORBIT_IDL,orbit-idl,no)
1449 AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[
1450 if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then
1451 gnome_cv_orbit_found=no
1453 gnome_cv_orbit_found=yes
1456 AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes)
1457 if test x$gnome_cv_orbit_found = xyes; then
1459 ORBIT_CFLAGS=`orbit-config --cflags client server`
1460 ORBIT_LIBS=`orbit-config --use-service=name --libs client server`
1461 AC_SUBST(ORBIT_CFLAGS)
1462 AC_SUBST(ORBIT_LIBS)
1464 if test x$2 = xfailure; then
1465 AC_MSG_ERROR(ORBit not installed or installation problem)
1470 AC_DEFUN([GNOME_ORBIT_CHECK], [
1471 GNOME_ORBIT_HOOK([],failure)
1473 # Configure paths for GNOME-PRINT
1474 # Chris Lahey 99-2-5
1475 # stolen from Manish Singh again
1476 # stolen back from Frank Belew
1477 # stolen from Manish Singh
1478 # Shamelessly stolen from Owen Taylor
1480 dnl AM_PATH_GNOME_PRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1481 dnl Test for GNOME-PRINT, and define GNOME_PRINT_CFLAGS and GNOME_PRINT_LIBS
1483 AC_DEFUN(AM_PATH_GNOME_PRINT,
1485 dnl Get the cflags and libraries from the gnome-config script
1487 AC_ARG_WITH(gnome-print-prefix,[ --with-gnome-print-prefix=PFX Prefix where GNOME-PRINT is installed (optional)],
1488 gnome_print_prefix="$withval", gnome_print_prefix="")
1489 AC_ARG_WITH(gnome-print-exec-prefix,[ --with-gnome-print-exec-prefix=PFX Exec prefix where GNOME-PRINT is installed (optional)],
1490 gnome_print_exec_prefix="$withval", gnome_print_exec_prefix="")
1491 AC_ARG_ENABLE(gnome-printtest, [ --disable-gnome-printtest Do not try to compile and run a test GNOME-PRINT program],
1492 , enable_gnome_printtest=yes)
1494 if test x$gnome_print_exec_prefix != x ; then
1495 gnome_print_args="$gnome_print_args --exec-prefix=$gnome_print_exec_prefix"
1496 if test x${GNOME_CONFIG+set} != xset ; then
1497 GNOME_CONFIG=$gnome_print_exec_prefix/bin/gnome-config
1500 if test x$gnome_print_prefix != x ; then
1501 gnome_print_args="$gnome_print_args --prefix=$gnome_print_prefix"
1502 if test x${GNOME_CONFIG+set} != xset ; then
1503 GNOME_CONFIG=$gnome_print_prefix/bin/gnome-config
1507 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
1508 min_gnome_print_version=ifelse([$1], ,0.1.0,$1)
1509 AC_MSG_CHECKING(for GNOME-PRINT - version >= $min_gnome_print_version)
1511 if test "$GNOME_CONFIG" = "no" ; then
1514 GNOME_PRINT_CFLAGS=`$GNOME_CONFIG $gnome_printconf_args --cflags print`
1515 GNOME_PRINT_LIBS=`$GNOME_CONFIG $gnome_printconf_args --libs print`
1517 gnome_print_major_version=`$GNOME_CONFIG $gnome_print_args --version | \
1518 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1519 gnome_print_minor_version=`$GNOME_CONFIG $gnome_print_args --version | \
1520 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1521 gnome_print_micro_version=`$GNOME_CONFIG $gnome_print_config_args --version | \
1522 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1523 if test "x$enable_gnome_printtest" = "xyes" ; then
1524 ac_save_CFLAGS="$CFLAGS"
1525 ac_save_LIBS="$LIBS"
1526 CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
1527 LIBS="$LIBS $GNOME_PRINT_LIBS"
1529 dnl Now check if the installed GNOME-PRINT is sufficiently new. (Also sanity
1530 dnl checks the results of gnome-config to some extent
1532 rm -f conf.gnome_printtest
1537 #include <libgnomeprint/gnome-print.h>
1540 my_strdup (char *str)
1546 new_str = malloc ((strlen (str) + 1) * sizeof(char));
1547 strcpy (new_str, str);
1557 int major, minor, micro;
1560 system ("touch conf.gnome_printtest");
1562 /* HP/UX 9 (%@#!) writes to sscanf strings */
1563 tmp_version = my_strdup("$min_gnome_print_version");
1564 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
1565 printf("%s, bad version string\n", "$min_gnome_print_version");
1570 if (($gnome_print_major_version > major) ||
1571 (($gnome_print_major_version == major) && ($gnome_print_minor_version > minor)) ||
1572 (($gnome_print_major_version == major) && ($gnome_print_minor_version == minor) && ($gnome_print_micro_version >= micro)))
1578 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);
1579 printf("*** of GNOME-PRINT required is %d.%d.%d. If gnome-config is correct, then it is\n", major, minor, micro);
1580 printf("*** best to upgrade to the required version.\n");
1581 printf("*** If gnome-config was wrong, set the environment variable GNOME_CONFIG\n");
1582 printf("*** to point to the correct copy of gnome-config, and remove the file\n");
1583 printf("*** config.cache before re-running configure\n");
1589 ],, no_gnome_print=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1590 CFLAGS="$ac_save_CFLAGS"
1591 LIBS="$ac_save_LIBS"
1594 if test "x$no_gnome_print" = x ; then
1596 ifelse([$2], , :, [$2])
1599 if test "$GNOME_CONFIG" = "no" ; then
1600 echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
1601 echo "*** If GNOME-PRINT was installed in PREFIX, make sure PREFIX/bin is in"
1602 echo "*** your path, or set the GNOME_CONFIG environment variable to the"
1603 echo "*** full path to gnome-config."
1605 if test -f conf.gnome_printtest ; then
1608 echo "*** Could not run GNOME-PRINT test program, checking why..."
1609 CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
1610 LIBS="$LIBS $GNOME_PRINT_LIBS"
1613 #include <libgnomeprint/gnome-print.h>
1615 [ echo "*** The test program compiled, but did not run. This usually means"
1616 echo "*** that the run-time linker is not finding GNOME-PRINT or finding the wrong"
1617 echo "*** version of GNOME-PRINT. If it is not finding GNOME-PRINT, you'll need to set your"
1618 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1619 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1620 echo "*** is required on your system"
1622 echo "*** If you have an old version installed, it is best to remove it, although"
1623 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1624 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1625 echo "*** exact error that occured. This usually means GNOME-PRINT was incorrectly installed"
1626 echo "*** or that you have moved GNOME-PRINT since it was installed. In the latter case, you"
1627 echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
1628 CFLAGS="$ac_save_CFLAGS"
1629 LIBS="$ac_save_LIBS"
1632 GNOME_PRINT_CFLAGS=""
1634 ifelse([$3], , :, [$3])
1636 AC_SUBST(GNOME_PRINT_CFLAGS)
1637 AC_SUBST(GNOME_PRINT_LIBS)
1638 rm -f conf.gnome_printtest
1641 AC_DEFUN([GNOME_PRINT_CHECK], [
1642 AM_PATH_GNOME_PRINT(0.1.0,,[AC_MSG_ERROR(GNOME-PRINT not found)])
1645 dnl And better, use gthreads instead...
1648 AC_DEFUN([GNOME_PTHREAD_CHECK],[
1650 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1651 [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1652 [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1653 [AC_CHECK_FUNC(pthread_create)]
1657 AC_SUBST(PTHREAD_LIB)
1658 AC_PROVIDE([GNOME_PTHREAD_CHECK])
1660 dnl GNOME_SUPPORT_CHECKS
1661 dnl Check for various support functions needed by the standard
1662 dnl Gnome libraries. Sets LIBOBJS, might define some macros.
1663 dnl This should only be used when building the Gnome libs;
1664 dnl Gnome clients should not need this macro.
1665 AC_DEFUN([GNOME_SUPPORT_CHECKS],[
1666 # we need an `awk' to build `gnomesupport.h'
1667 AC_REQUIRE([AC_PROG_AWK])
1669 # this should go away soon
1670 need_gnome_support=yes
1672 save_LIBOBJS="$LIBOBJS"
1675 AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
1680 # copied from `configure.in' of `libiberty'
1681 vars="program_invocation_short_name program_invocation_name sys_errlist"
1683 AC_MSG_CHECKING([for $v])
1684 AC_CACHE_VAL(gnome_cv_var_$v,
1685 [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
1686 [eval "gnome_cv_var_$v=yes"],
1687 [eval "gnome_cv_var_$v=no"])])
1688 if eval "test \"`echo '$gnome_cv_var_'$v`\" = yes"; then
1690 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1691 AC_DEFINE_UNQUOTED($n, 1, [dummy])
1697 AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen)
1698 AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf)
1700 AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o")
1702 # to include `error.c' error.c has some HAVE_* checks
1703 AC_CHECK_FUNCS(vprintf doprnt strerror_r)
1704 AC_FUNC_ERROR_AT_LINE
1706 # This is required if we declare setreuid () and setregid ().
1709 # see if we need to declare some functions. Solaris is notorious for
1710 # putting functions into the `libc' but not listing them in the headers
1711 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h dirent.h)
1712 GCC_NEED_DECLARATIONS(gethostname setreuid setregid getpagesize)
1713 GCC_NEED_DECLARATION(scandir,[
1714 #ifdef HAVE_DIRENT_H
1719 # Turn our LIBOBJS into libtool objects. This is gross, but it
1720 # requires changes to autoconf before it goes away.
1721 LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
1722 AC_SUBST(need_gnome_support)
1725 LIBOBJS="$save_LIBOBJS"
1726 AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes)
1728 dnl GNOME_UNDELFS_CHECKS
1729 dnl Check for ext2fs undel support.
1730 dnl Set shell variable ext2fs_undel to "yes" if we have it,
1731 dnl "no" otherwise. May define USE_EXT2FSLIB for cpp.
1732 dnl Will set EXT2FS_UNDEL_LIBS to required libraries.
1734 AC_DEFUN([GNOME_UNDELFS_CHECKS], [
1735 AC_CHECK_HEADERS(ext2fs/ext2fs.h linux/ext2_fs.h)
1738 if test x$ac_cv_header_ext2fs_ext2fs_h = xyes
1740 if test x$ac_cv_header_linux_ext2_fs_h = xyes
1742 AC_DEFINE(USE_EXT2FSLIB, 1, [dummy])
1744 EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
1748 dnl GNOME_VFS_CHECKS
1749 dnl Check for various functions needed by libvfs.
1750 dnl This has various effects:
1751 dnl Sets GNOME_VFS_LIBS to libraries required
1752 dnl Sets termnet to true or false depending on whether it is required.
1753 dnl If yes, defines USE_TERMNET.
1754 dnl Sets vfs_flags to "pretty" list of vfs implementations we include.
1755 dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
1756 dnl "no" (--without-vfs).
1757 dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv".
1760 AC_DEFUN([GNOME_WITH_VFS],[
1761 dnl FIXME: network checks should probably be in their own macro.
1762 AC_CHECK_LIB(nsl, t_accept)
1763 AC_CHECK_LIB(socket, socket)
1766 AC_CHECK_FUNCS(socket, have_socket=yes)
1767 if test $have_socket = no; then
1768 # socket is not in the default libraries. See if it's in some other.
1769 for lib in bsd socket inet; do
1770 AC_CHECK_LIB($lib, socket, [
1773 AC_DEFINE(HAVE_SOCKET, 1, [dummy])
1778 have_gethostbyname=no
1779 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
1780 if test $have_gethostbyname = no; then
1781 # gethostbyname is not in the default libraries. See if it's in some other.
1782 for lib in bsd socket inet; do
1783 AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
1789 if test $have_socket = yes; then
1791 AC_CHECK_FUNCS(pmap_set, , [
1792 AC_CHECK_LIB(rpc, pmap_set, [
1794 AC_DEFINE(HAVE_PMAP_SET, 1, [dummy])
1796 AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
1797 dnl add for source routing support setsockopt
1798 AC_CHECK_HEADERS(rpc/pmap_clnt.h)
1799 vfs_flags="$vfs_flags, mcfs, ftpfs, fish"
1809 [--with-samba Support smb virtual file system],[
1810 if test "x$withval != xno"; then
1811 AC_DEFINE(WITH_SMBFS, 1, [dummy])
1812 vfs_flags="$vfs_flags, smbfs"
1814 SAMBAFILES="\$(SAMBAFILES)"
1818 AC_SUBST(SAMBAFILES)
1821 dnl The termnet support
1824 AC_ARG_WITH(termnet,
1825 [--with-termnet If you want a termified net support],[
1826 if test x$withval = xyes; then
1827 AC_DEFINE(USE_TERMNET, 1, [dummy])
1833 AC_DEFINE(USE_VFS, 1, [dummy])
1834 if $use_net_code; then
1835 AC_DEFINE(USE_NETCODE, [dummy])
1838 if test $have_socket = yes; then
1853 AC_DEFUN([GNOME_VFS_CHECKS],[
1856 [--with-vfs Compile with the VFS code],
1860 yes) GNOME_WITH_VFS;;
1863 dnl Should we issue a warning?
1870 dnl Basic X11 related checks for X11. At the end, the following will be
1871 dnl defined/changed:
1872 dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK
1873 dnl CPPFLAGS Will include $X_CFLAGS
1874 dnl GNOME_HAVE_SM `true' or `false' depending on whether session
1875 dnl management is available. It is available if
1876 dnl both -lSM and X11/SM/SMlib.h exist. (Some
1877 dnl Solaris boxes have the library but not the header)
1878 dnl XPM_LIBS -lXpm if Xpm library is present, otherwise ""
1880 dnl The following configure cache variables are defined (but not used):
1881 dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS}
1883 AC_DEFUN([GNOME_X_CHECKS],
1885 AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
1886 dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could
1887 dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes"
1889 dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses
1890 dnl CPPFLAGS, not CFLAGS
1891 CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
1893 saved_ldflags="$LDFLAGS"
1894 LDFLAGS="$LDFLAGS $GTK_LIBS"
1896 gnome_cv_passdown_x_libs="$GTK_LIBS"
1897 gnome_cv_passdown_X_LIBS="$GTK_LIBS"
1898 gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS"
1899 gnome_cv_passdown_GTK_LIBS="$GTK_LIBS"
1901 LDFLAGS="$saved_ldflags $GTK_LIBS"
1903 dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow.
1906 dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x])
1907 dnl AC_EGREP_CPP(answer_affirmatively,
1908 dnl [#include <gtk/gtkfeatures.h>
1909 dnl #ifdef GTK_HAVE_FEATURES_1_1_0
1910 dnl answer_affirmatively
1912 dnl ], dev_gtk=yes, dev_gtk=no)
1913 dnl if test "$dev_gtk" = "yes"; then
1916 dnl AC_MSG_RESULT("$dev_gtk")
1921 dnl Already found it.
1924 dnl Assume that if we have -lSM then we also have -lICE.
1925 AC_CHECK_LIB(SM, SmcSaveYourselfDone,
1926 [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false,
1931 if test "$GNOME_HAVE_SM" = true; then
1932 AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false)
1935 if test "$GNOME_HAVE_SM" = true; then
1936 AC_DEFINE(HAVE_LIBSM, 1, [dummy])
1940 AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
1943 AC_REQUIRE([GNOME_PTHREAD_CHECK])
1944 LDFLAGS="$saved_ldflags"
1946 AC_PROVIDE([GNOME_X_CHECKS])
1949 dnl GNOME_XML_HOOK (script-if-xml-found, failflag)
1951 dnl If failflag is "failure", script aborts due to lack of XML
1953 dnl Check for availability of the libxml library
1954 dnl the XML parser uses libz if available too
1957 AC_DEFUN([GNOME_XML_HOOK],[
1958 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
1959 if test "$GNOME_CONFIG" = no; then
1960 if test x$2 = xfailure; then
1961 AC_MSG_ERROR(Could not find gnome-config)
1964 AC_CHECK_LIB(xml, xmlNewDoc, [
1966 GNOME_XML_LIB=`$GNOME_CONFIG --libs xml`
1968 if test x$2 = xfailure; then
1969 AC_MSG_ERROR(Could not link sample xml program)
1971 ], `$GNOME_CONFIG --libs xml`)
1972 AC_SUBST(GNOME_XML_LIB)
1975 AC_DEFUN([GNOME_XML_CHECK], [
1976 GNOME_XML_HOOK([],failure)
1979 dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits])
1981 dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
1985 AC_DEFUN([GNOME_INIT_HOOK],[
1986 AC_SUBST(GNOME_LIBS)
1987 AC_SUBST(GNOMEUI_LIBS)
1988 AC_SUBST(GNOMEGNORBA_LIBS)
1989 AC_SUBST(GTKXMHTML_LIBS)
1991 AC_SUBST(GNOME_LIBDIR)
1992 AC_SUBST(GNOME_INCLUDEDIR)
1994 AC_ARG_WITH(gnome-includes,
1995 [ --with-gnome-includes Specify location of GNOME headers],[
1996 CFLAGS="$CFLAGS -I$withval"
1999 AC_ARG_WITH(gnome-libs,
2000 [ --with-gnome-libs Specify location of GNOME libs],[
2001 LDFLAGS="$LDFLAGS -L$withval"
2002 gnome_prefix=$withval
2006 [ --with-gnome Specify prefix for GNOME files],
2007 if test x$withval = xyes; then
2009 dnl Note that an empty true branch is not
2010 dnl valid sh syntax.
2011 ifelse([$1], [], :, [$1])
2013 if test "x$withval" = xno; then
2017 LDFLAGS="$LDFLAGS -L$withval/lib"
2018 CFLAGS="$CFLAGS -I$withval/include"
2019 gnome_prefix=$withval/lib
2024 if test "x$want_gnome" = xyes; then
2026 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
2027 if test "$GNOME_CONFIG" = "no"; then
2028 no_gnome_config="yes"
2030 AC_MSG_CHECKING(if $GNOME_CONFIG works)
2031 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
2033 GNOME_GNORBA_HOOK([],$2)
2034 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
2035 GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
2036 GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`"
2037 GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`"
2038 ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`"
2039 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
2040 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
2044 no_gnome_config="yes"
2048 if test x$exec_prefix = xNONE; then
2049 if test x$prefix = xNONE; then
2050 gnome_prefix=$ac_default_prefix/lib
2052 gnome_prefix=$prefix/lib
2055 gnome_prefix=`eval echo \`echo $libdir\``
2058 if test "$no_gnome_config" = "yes"; then
2059 AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
2060 if test -f $gnome_prefix/gnomeConf.sh; then
2061 AC_MSG_RESULT(found)
2062 echo "loading gnome configuration from" \
2063 "$gnome_prefix/gnomeConf.sh"
2064 . $gnome_prefix/gnomeConf.sh
2067 AC_MSG_RESULT(not found)
2068 if test x$2 = xfail; then
2069 AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
2075 if test -n "$3"; then
2078 AC_MSG_CHECKING(extra library \"$i\")
2081 AC_SUBST(GNOME_APPLETS_LIBS)
2082 GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets`
2083 AC_MSG_RESULT($GNOME_APPLETS_LIBS);;
2085 AC_SUBST(GNOME_DOCKLETS_LIBS)
2086 GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets`
2087 AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);;
2089 AC_SUBST(GNOME_CAPPLET_LIBS)
2090 GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet`
2091 AC_MSG_RESULT($GNOME_CAPPLET_LIBS);;
2093 AC_MSG_RESULT(unknown library)
2100 dnl GNOME_INIT ([additional-inits])
2103 AC_DEFUN([GNOME_INIT],[
2104 GNOME_INIT_HOOK([],fail,$1)
2107 dnl AC_PROG_GPERF (MINIMUM-VERSION)
2109 dnl Check for availability of gperf.
2110 dnl Abort if not found or if current version is not up to par.
2113 AC_DEFUN([AC_PROG_GPERF],[
2114 AC_PATH_PROG(GPERF, gperf, no)
2115 if test "$GPERF" = no; then
2116 AC_MSG_ERROR(Could not find gperf)
2118 min_gperf_version=ifelse([$1], ,2.7,$1)
2119 AC_MSG_CHECKING(for gperf - version >= $min_gperf_version)
2120 gperf_major_version=`$GPERF --version | \
2121 sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\1/'`
2122 gperf_minor_version=`$GPERF --version | \
2123 sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\2/'`
2126 dnl Now check if the installed gperf is sufficiently new.
2134 my_strdup (char *str)
2140 new_str = malloc ((strlen (str) + 1) * sizeof(char));
2141 strcpy (new_str, str);
2157 /* HP/UX 9 (%@#!) writes to sscanf strings */
2158 tmp_version = my_strdup("$min_gperf_version");
2159 if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) {
2160 printf ("%s, bad version string\n", "$min_gperf_version");
2164 if (($gperf_major_version > major) ||
2165 (($gperf_major_version == major) && ($gperf_minor_version >= minor))) {
2169 printf ("*** An old version of gperf ($gperf_major_version.$gperf_minor_version) was found.\n");
2170 printf ("*** You need a version of gperf newer than %d.%d.%d. The latest version of\n",
2172 printf ("*** gperf is always available from ftp://ftp.gnu.org.\n");
2177 ],,no_gperf=yes,[/bin/true])
2178 if test "x$no_gperf" = x ; then
2186 dnl Check for struct linger
2188 AC_DEFUN(AC_STRUCT_LINGER, [
2190 AC_MSG_CHECKING(struct linger is available)
2192 #include <sys/types.h>
2193 #include <sys/socket.h>
2204 AC_DEFINE(HAVE_STRUCT_LINGER, 1, [dummy])
2205 av_struct_linger=yes
2211 AC_MSG_RESULT($av_struct_linger)
2213 dnl See whether we need a declaration for a function.
2214 dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
2215 AC_DEFUN(GCC_NEED_DECLARATION,
2216 [AC_MSG_CHECKING([whether $1 must be declared])
2217 AC_CACHE_VAL(gcc_cv_decl_needed_$1,
2220 #ifdef HAVE_STRING_H
2223 #ifdef HAVE_STRINGS_H
2224 #include <strings.h>
2227 #ifdef HAVE_STDLIB_H
2230 #ifdef HAVE_UNISTD_H
2234 [char *(*pfn) = (char *(*)) $1],
2235 eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
2236 if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
2238 gcc_need_declarations="$gcc_need_declarations $1"
2239 gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2240 AC_DEFINE_UNQUOTED($gcc_tr_decl, 1, [dummy])
2246 dnl Check multiple functions to see whether each needs a declaration.
2247 dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
2248 AC_DEFUN(GCC_NEED_DECLARATIONS,
2251 GCC_NEED_DECLARATION($ac_func, $2)
2255 # Configure paths for GTK+
2256 # Owen Taylor 97-11-3
2258 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2259 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
2261 AC_DEFUN(AM_PATH_GTK,
2263 dnl Get the cflags and libraries from the gtk-config script
2265 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
2266 gtk_config_prefix="$withval", gtk_config_prefix="")
2267 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
2268 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
2269 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2270 , enable_gtktest=yes)
2276 gtk_config_args="$gtk_config_args gthread"
2281 if test x$gtk_config_exec_prefix != x ; then
2282 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
2283 if test x${GTK_CONFIG+set} != xset ; then
2284 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
2287 if test x$gtk_config_prefix != x ; then
2288 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
2289 if test x${GTK_CONFIG+set} != xset ; then
2290 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
2294 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
2295 min_gtk_version=ifelse([$1], ,0.99.7,$1)
2296 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2298 if test "$GTK_CONFIG" = "no" ; then
2301 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
2302 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
2303 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
2304 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2305 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
2306 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2307 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
2308 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2309 if test "x$enable_gtktest" = "xyes" ; then
2310 ac_save_CFLAGS="$CFLAGS"
2311 ac_save_LIBS="$LIBS"
2312 CFLAGS="$CFLAGS $GTK_CFLAGS"
2313 LIBS="$GTK_LIBS $LIBS"
2315 dnl Now check if the installed GTK is sufficiently new. (Also sanity
2316 dnl checks the results of gtk-config to some extent
2320 #include <gtk/gtk.h>
2327 int major, minor, micro;
2330 system ("touch conf.gtktest");
2332 /* HP/UX 9 (%@#!) writes to sscanf strings */
2333 tmp_version = g_strdup("$min_gtk_version");
2334 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2335 printf("%s, bad version string\n", "$min_gtk_version");
2339 if ((gtk_major_version != $gtk_config_major_version) ||
2340 (gtk_minor_version != $gtk_config_minor_version) ||
2341 (gtk_micro_version != $gtk_config_micro_version))
2343 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2344 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2345 gtk_major_version, gtk_minor_version, gtk_micro_version);
2346 printf ("*** was found! If gtk-config was correct, then it is best\n");
2347 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2348 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2349 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2350 printf("*** required on your system.\n");
2351 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
2352 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
2353 printf("*** before re-running configure\n");
2355 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
2356 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2357 (gtk_minor_version != GTK_MINOR_VERSION) ||
2358 (gtk_micro_version != GTK_MICRO_VERSION))
2360 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2361 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2362 printf("*** library (version %d.%d.%d)\n",
2363 gtk_major_version, gtk_minor_version, gtk_micro_version);
2365 #endif /* defined (GTK_MAJOR_VERSION) ... */
2368 if ((gtk_major_version > major) ||
2369 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2370 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2376 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2377 gtk_major_version, gtk_minor_version, gtk_micro_version);
2378 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2379 major, minor, micro);
2380 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2382 printf("*** If you have already installed a sufficiently new version, this error\n");
2383 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
2384 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2385 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
2386 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
2387 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2388 printf("*** so that the correct libraries are found at run-time))\n");
2393 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2394 CFLAGS="$ac_save_CFLAGS"
2395 LIBS="$ac_save_LIBS"
2398 if test "x$no_gtk" = x ; then
2400 ifelse([$2], , :, [$2])
2403 if test "$GTK_CONFIG" = "no" ; then
2404 echo "*** The gtk-config script installed by GTK could not be found"
2405 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
2406 echo "*** your path, or set the GTK_CONFIG environment variable to the"
2407 echo "*** full path to gtk-config."
2409 if test -f conf.gtktest ; then
2412 echo "*** Could not run GTK test program, checking why..."
2413 CFLAGS="$CFLAGS $GTK_CFLAGS"
2414 LIBS="$LIBS $GTK_LIBS"
2416 #include <gtk/gtk.h>
2418 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2419 [ echo "*** The test program compiled, but did not run. This usually means"
2420 echo "*** that the run-time linker is not finding GTK or finding the wrong"
2421 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
2422 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2423 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2424 echo "*** is required on your system"
2426 echo "*** If you have an old version installed, it is best to remove it, although"
2427 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
2429 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
2430 echo "*** came with the system with the command"
2432 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
2433 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2434 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
2435 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
2436 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
2437 CFLAGS="$ac_save_CFLAGS"
2438 LIBS="$ac_save_LIBS"
2443 ifelse([$3], , :, [$3])
2445 AC_SUBST(GTK_CFLAGS)