From d8b75819d69b793ba40007013dcec026158c2c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Mon, 24 Jul 2000 22:42:35 +0000 Subject: [PATCH] the gtk patch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@917 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 49 + acconfig.h | 4 + acinclude.m4 | 2577 ++++++++++++++++++++++++++- autogen.sh | 2 +- config/gnome/aclocal-include.m4 | 16 + config/gnome/compiler-flags.m4 | 109 ++ config/gnome/curses.m4 | 318 ++++ config/gnome/gnome--.m4 | 49 + config/gnome/gnome-bonobo-check.m4 | 150 ++ config/gnome/gnome-common.m4 | 14 + config/gnome/gnome-fileutils.m4 | 414 +++++ config/gnome/gnome-ghttp-check.m4 | 14 + config/gnome/gnome-gnorba-check.m4 | 35 + config/gnome/gnome-guile-checks.m4 | 119 ++ config/gnome/gnome-libgtop-check.m4 | 217 +++ config/gnome/gnome-objc-checks.m4 | 83 + config/gnome/gnome-orbit-check.m4 | 33 + config/gnome/gnome-print-check.m4 | 171 ++ config/gnome/gnome-pthread-check.m4 | 16 + config/gnome/gnome-support.m4 | 68 + config/gnome/gnome-undelfs.m4 | 20 + config/gnome/gnome-vfs.m4 | 120 ++ config/gnome/gnome-x-checks.m4 | 80 + config/gnome/gnome-xml-check.m4 | 30 + config/gnome/gnome.m4 | 128 ++ config/gnome/gperf-check.m4 | 79 + config/gnome/gtk--.m4 | 195 ++ config/gnome/linger.m4 | 28 + config/gnome/need-declaration.m4 | 42 + config/lyxinclude.m4 | 2 +- configure.in | 18 +- src/frontends/gtk/.cvsignore | 1 + src/frontends/gtk/Dialogs.C | 101 ++ src/frontends/gtk/FormCopyright.C | 71 + src/frontends/gtk/FormCopyright.h | 71 + src/frontends/gtk/Makefile.am | 36 + src/lyx_gui.C | 8 + src/main.C | 10 +- 38 files changed, 5479 insertions(+), 19 deletions(-) create mode 100644 config/gnome/aclocal-include.m4 create mode 100644 config/gnome/compiler-flags.m4 create mode 100644 config/gnome/curses.m4 create mode 100644 config/gnome/gnome--.m4 create mode 100644 config/gnome/gnome-bonobo-check.m4 create mode 100644 config/gnome/gnome-common.m4 create mode 100644 config/gnome/gnome-fileutils.m4 create mode 100644 config/gnome/gnome-ghttp-check.m4 create mode 100644 config/gnome/gnome-gnorba-check.m4 create mode 100644 config/gnome/gnome-guile-checks.m4 create mode 100644 config/gnome/gnome-libgtop-check.m4 create mode 100644 config/gnome/gnome-objc-checks.m4 create mode 100644 config/gnome/gnome-orbit-check.m4 create mode 100644 config/gnome/gnome-print-check.m4 create mode 100644 config/gnome/gnome-pthread-check.m4 create mode 100644 config/gnome/gnome-support.m4 create mode 100644 config/gnome/gnome-undelfs.m4 create mode 100644 config/gnome/gnome-vfs.m4 create mode 100644 config/gnome/gnome-x-checks.m4 create mode 100644 config/gnome/gnome-xml-check.m4 create mode 100644 config/gnome/gnome.m4 create mode 100644 config/gnome/gperf-check.m4 create mode 100644 config/gnome/gtk--.m4 create mode 100644 config/gnome/linger.m4 create mode 100644 config/gnome/need-declaration.m4 create mode 100644 src/frontends/gtk/.cvsignore create mode 100644 src/frontends/gtk/Dialogs.C create mode 100644 src/frontends/gtk/FormCopyright.C create mode 100644 src/frontends/gtk/FormCopyright.h create mode 100644 src/frontends/gtk/Makefile.am diff --git a/ChangeLog b/ChangeLog index fb7bd09db3..b1ebe9e6a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,52 @@ +2000-07-14 Marko Vendelin + + * src/frontends/gtk/Dialogs.C: + * src/frontends/gtk/FormCopyright.C: + * src/frontends/gtk/FormCopyright.h: + * src/frontends/gtk/Makefile.am: added these source-files for the + Gtk/Gnome support of the Copyright-Dialog. + + * src/main.C: added Gnome::Main initialization if using + Gtk/Gnome frontend-GUI. + + * src/lyx_gui.C: added Gnome event loop if using Gtk/Gnome + frontend-GUI. + * config/gnome/aclocal-include.m4 + * config/gnome/compiler-flags.m4 + * config/gnome/curses.m4 + * config/gnome/gnome--.m4 + * config/gnome/gnome-bonobo-check.m4 + * config/gnome/gnome-common.m4 + * config/gnome/gnome-fileutils.m4 + * config/gnome/gnome-ghttp-check.m4 + * config/gnome/gnome-gnorba-check.m4 + * config/gnome/gnome-guile-checks.m4 + * config/gnome/gnome-libgtop-check.m4 + * config/gnome/gnome-objc-checks.m4 + * config/gnome/gnome-orbit-check.m4 + * config/gnome/gnome-print-check.m4 + * config/gnome/gnome-pthread-check.m4 + * config/gnome/gnome-support.m4 + * config/gnome/gnome-undelfs.m4 + * config/gnome/gnome-vfs.m4 + * config/gnome/gnome-x-checks.m4 + * config/gnome/gnome-xml-check.m4 + * config/gnome/gnome.m4 + * config/gnome/gperf-check.m4 + * config/gnome/gtk--.m4 + * config/gnome/linger.m4 + * config/gnome/need-declaration.m4: added configuration scripts + for Gtk/Gnome frontend-GUI + + * configure.in: added support for the --with-frontend=gtk option + + * autogen.sh: added config/gnome/* to list of config-files + + * acconfig.h: added define for GTKGUI-support + + * config/lyxinclude.m4: added --with-frontend[=value] option value + for Gtk/Gnome frontend-GUI support. + 2000-07-25 Lars Gullik Bjønnes * src/support/lstrings.C (prefixIs): rewrite so that gcc bastring diff --git a/acconfig.h b/acconfig.h index 2ef1ccd84c..a9df3d55f0 100644 --- a/acconfig.h +++ b/acconfig.h @@ -43,6 +43,10 @@ /* here are the defines for what Toolkit to use (default is XForms) */ #undef KDEGUI +#undef GTKGUI + +#undef HAVE_LIBSM + @BOTTOM@ /************************************************************ diff --git a/acinclude.m4 b/acinclude.m4 index ca5db23548..d38bd4ed4b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -381,7 +381,6 @@ dnl has a std::string that is close to the standard. So close that dnl methods not found in "unstandard" std::strings are present here. AC_DEFUN(LYX_CXX_GOOD_STD_STRING,[ AC_REQUIRE([LYX_PROG_CXX]) -dnl AC_MSG_CHECKING(whether the systems std::string is really good) AC_CACHE_CHECK([whether the systems std::string is really good], [lyx_cv_std_string_good], [AC_TRY_COMPILE([ @@ -426,7 +425,6 @@ AC_DEFUN(LYX_REGEX,[ dnl LYX_CXX_MUTABLE AC_DEFUN(LYX_CXX_MUTABLE, [ AC_REQUIRE([LYX_PROG_CXX]) -dnl AC_MSG_CHECKING(if C++ compiler supports mutable) AC_CACHE_CHECK([if C++ compiler supports mutable], lyx_cv_cxx_mutable,[ AC_TRY_COMPILE( @@ -472,7 +470,7 @@ AC_DEFUN(LYX_CXX_PARTIAL, [ ]) ]) if test x$lyx_cv_cxx_partial_specialization = xyes ; then - AC_DEFINE(HAVE_PARTIAL_SPECIALIZATION, 1, + AC_DEFINE(HAVE_PARTIAL_SPECIALIZATION, 1, [Defined if your compiler supports partial specialization.]) fi ]) @@ -483,20 +481,21 @@ dnl has a correct namespace handling and define CXX_WORKING_NAMESPACES dnl if true. This macro does not do a thourough test, but it should be dnl good enough to suit our needs. AC_DEFUN(LYX_CXX_NAMESPACES,[ -AC_CACHE_CHECK(for correct namespaces support,lyx_cv_cxx_namespace, - [AC_TRY_COMPILE([ - namespace foo { - int bar; - } -],[ + AC_CACHE_CHECK(for correct namespaces support,lyx_cv_cxx_namespace, + [AC_TRY_COMPILE([ + namespace foo { + int bar; + } + ],[ foo::bar = 0; return 0; -],lyx_cv_cxx_namespace=yes,lyx_cv_cxx_namespace=no) + ],lyx_cv_cxx_namespace=yes,lyx_cv_cxx_namespace=no) + ]) + if test x$lyx_cv_cxx_namespace = xyes ; then + AC_DEFINE(CXX_WORKING_NAMESPACES, 1, + [Define if your C++ compiler has correct support for namespaces]) + fi ]) -if test x$lyx_cv_cxx_namespace = xyes ; then - AC_DEFINE(CXX_WORKING_NAMESPACES, 1, - [Define if your C++ compiler has correct support for namespaces]) -fi]) dnl Usage: LYX_CXX_CHEADERS : checks whether the C++ compiler @@ -907,7 +906,7 @@ AC_DEFUN(LYX_USE_FRONTEND, [AC_MSG_CHECKING(what frontend should be used as main GUI) AC_ARG_WITH(frontend, [ --with-frontend[=value] Use THIS frontend as main GUI: - Possible values: xforms,kde], + Possible values: xforms,kde,gtk], [lyx_use_frontend="$withval"], [lyx_use_frontend="xforms"]) AC_MSG_RESULT($lyx_use_frontend) lyx_flags="$lyx_flags frontend-$lyx_use_frontend" @@ -4360,3 +4359,2551 @@ if test -n "$LIBXDMCP"; then fi ]) +# aclocal-include.m4 +# +# This macro adds the name macrodir to the set of directories +# that `aclocal' searches for macros. + +# serial 1 + +dnl AM_ACLOCAL_INCLUDE(macrodir) +AC_DEFUN([AM_ACLOCAL_INCLUDE], +[ + AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y) + + test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done +]) +# Configure paths for GNOME-PRINT +# Chris Lahey 99-2-5 +# stolen from Manish Singh again +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_GNOME_PRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GNOME-PRINT, and define GNOME_PRINT_CFLAGS and GNOME_PRINT_LIBS +dnl +AC_DEFUN(AM_PATH_GNOME_PRINT, +[dnl +dnl Get the cflags and libraries from the gnome-config script +dnl +AC_ARG_WITH(gnome-print-prefix,[ --with-gnome-print-prefix=PFX Prefix where GNOME-PRINT is installed (optional)], + gnome_print_prefix="$withval", gnome_print_prefix="") +AC_ARG_WITH(gnome-print-exec-prefix,[ --with-gnome-print-exec-prefix=PFX Exec prefix where GNOME-PRINT is installed (optional)], + gnome_print_exec_prefix="$withval", gnome_print_exec_prefix="") +AC_ARG_ENABLE(gnome-printtest, [ --disable-gnome-printtest Do not try to compile and run a test GNOME-PRINT program], + , enable_gnome_printtest=yes) + + if test x$gnome_print_exec_prefix != x ; then + gnome_print_args="$gnome_print_args --exec-prefix=$gnome_print_exec_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$gnome_print_exec_prefix/bin/gnome-config + fi + fi + if test x$gnome_print_prefix != x ; then + gnome_print_args="$gnome_print_args --prefix=$gnome_print_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$gnome_print_prefix/bin/gnome-config + fi + fi + + AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) + min_gnome_print_version=ifelse([$1], ,0.1.0,$1) + AC_MSG_CHECKING(for GNOME-PRINT - version >= $min_gnome_print_version) + no_gnome_print="" + if test "$GNOME_CONFIG" = "no" ; then + no_gnome_print=yes + else + GNOME_PRINT_CFLAGS=`$GNOME_CONFIG $gnome_printconf_args --cflags print` + GNOME_PRINT_LIBS=`$GNOME_CONFIG $gnome_printconf_args --libs print` + + gnome_print_major_version=`$GNOME_CONFIG $gnome_print_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gnome_print_minor_version=`$GNOME_CONFIG $gnome_print_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gnome_print_micro_version=`$GNOME_CONFIG $gnome_print_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gnome_printtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS" + LIBS="$LIBS $GNOME_PRINT_LIBS" +dnl +dnl Now check if the installed GNOME-PRINT is sufficiently new. (Also sanity +dnl checks the results of gnome-config to some extent +dnl + rm -f conf.gnome_printtest + AC_TRY_RUN([ +#include +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gnome_printtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_gnome_print_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gnome_print_version"); + exit(1); + } + return 0; +#if 0 + if (($gnome_print_major_version > major) || + (($gnome_print_major_version == major) && ($gnome_print_minor_version > minor)) || + (($gnome_print_major_version == major) && ($gnome_print_minor_version == minor) && ($gnome_print_micro_version >= micro))) + { + return 0; + } + else + { + 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); + printf("*** of GNOME-PRINT required is %d.%d.%d. If gnome-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If gnome-config was wrong, set the environment variable GNOME_CONFIG\n"); + printf("*** to point to the correct copy of gnome-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +#endif +} + +],, no_gnome_print=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gnome_print" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GNOME_CONFIG" = "no" ; then + echo "*** The gnome-config script installed by GNOME-LIBS could not be found" + echo "*** If GNOME-PRINT was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GNOME_CONFIG environment variable to the" + echo "*** full path to gnome-config." + else + if test -f conf.gnome_printtest ; then + : + else + echo "*** Could not run GNOME-PRINT test program, checking why..." + CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS" + LIBS="$LIBS $GNOME_PRINT_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GNOME-PRINT or finding the wrong" + echo "*** version of GNOME-PRINT. If it is not finding GNOME-PRINT, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GNOME-PRINT was incorrectly installed" + echo "*** or that you have moved GNOME-PRINT since it was installed. In the latter case, you" + echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GNOME_PRINT_CFLAGS="" + GNOME_PRINT_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GNOME_PRINT_CFLAGS) + AC_SUBST(GNOME_PRINT_LIBS) + rm -f conf.gnome_printtest +]) + +AC_DEFUN([GNOME_PRINT_CHECK], [ + AM_PATH_GNOME_PRINT(0.1.0,,[AC_MSG_ERROR(GNOME-PRINT not found)]) +]) +dnl GNOME_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([GNOME_COMPILE_WARNINGS],[ + AC_ARG_ENABLE(compile-warnings, + [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + if test "x$enable_compile_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCFLAGS="-Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compile_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations" + fi + fi + fi + AC_MSG_RESULT($warnCFLAGS) + + AC_ARG_ENABLE(iso-c, + [ --enable-iso-c Try to warn if code is not ISO C ],, + enable_iso_c=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCFLAGS) + if test "x$cflags_set" != "xyes"; then + CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" + cflags_set=yes + AC_SUBST(cflags_set) + fi +]) + +dnl For C++, do basically the same thing. + +AC_DEFUN([GNOME_CXX_WARNINGS],[ + AC_ARG_ENABLE(cxx-warnings, + [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C++ compiler) + warnCXXFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + if test "x$enable_cxx_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCXXFLAGS="-Wall -Wno-unused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_cxx_warnings" = "xyes"; then + warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual" + fi + fi + fi + AC_MSG_RESULT($warnCXXFLAGS) + + AC_ARG_ENABLE(iso-cxx, + [ --enable-iso-cxx Try to warn if code is not ISO C++ ],, + enable_iso_cxx=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler) + complCXXFLAGS= + if test "x$enable_iso_cxx" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -ansi" ;; + esac + + case " $CXXFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCXXFLAGS) + if test "x$cxxflags_set" != "xyes"; then + CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" + cxxflags_set=yes + AC_SUBST(cxxflags_set) + fi +]) +dnl +dnl And better, use gthreads instead... +dnl + +AC_DEFUN([GNOME_PTHREAD_CHECK],[ + PTHREAD_LIB="" + AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread", + [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads", + [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r", + [AC_CHECK_FUNC(pthread_create)] + )] + )] + ) + AC_SUBST(PTHREAD_LIB) + AC_PROVIDE([GNOME_PTHREAD_CHECK]) +]) +dnl Curses detection: Munged from Midnight Commander's configure.in +dnl +dnl What it does: +dnl ============= +dnl +dnl - Determine which version of curses is installed on your system +dnl and set the -I/-L/-l compiler entries and add a few preprocessor +dnl symbols +dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that +dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in +dnl Makefile.in's +dnl - Modify the following configure variables (these are the only +dnl curses.m4 variables you can access from within configure.in) +dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if +dnl an ncurses.h that's been renamed to curses.h +dnl is found. +dnl CURSES_LIBS - sets -L and -l's appropriately +dnl CFLAGS - if --with-sco, add -D_SVID3 +dnl has_curses - exports result of tests to rest of configure +dnl +dnl Usage: +dnl ====== +dnl 1) Add lines indicated below to acconfig.h +dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in +dnl 3) Instead of #include you should use the following to +dnl properly locate ncurses or curses header file +dnl +dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +dnl #include +dnl #else +dnl #include +dnl #endif +dnl +dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags +dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS +dnl +dnl Notes with automake: +dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from +dnl configure.in +dnl - your Makefile.am can look something like this +dnl ----------------------------------------------- +dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR) +dnl if HAS_CURSES +dnl CURSES_TARGETS=name_of_curses_prog +dnl endif +dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS) +dnl other_programs_SOURCES = blah blah blah +dnl name_of_curses_prog_SOURCES = blah blah blah +dnl other_programs_LDADD = blah +dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS) +dnl ----------------------------------------------- +dnl +dnl +dnl The following lines should be added to acconfig.h: +dnl ================================================== +dnl +dnl /*=== Curses version detection defines ===*/ +dnl /* Found some version of curses that we're going to use */ +dnl #undef HAS_CURSES +dnl +dnl /* Use SunOS SysV curses? */ +dnl #undef USE_SUNOS_CURSES +dnl +dnl /* Use old BSD curses - not used right now */ +dnl #undef USE_BSD_CURSES +dnl +dnl /* Use SystemV curses? */ +dnl #undef USE_SYSV_CURSES +dnl +dnl /* Use Ncurses? */ +dnl #undef USE_NCURSES +dnl +dnl /* If you Curses does not have color define this one */ +dnl #undef NO_COLOR_CURSES +dnl +dnl /* Define if you want to turn on SCO-specific code */ +dnl #undef SCO_FLAVOR +dnl +dnl /* Set to reflect version of ncurses * +dnl * 0 = version 1.* +dnl * 1 = version 1.9.9g +dnl * 2 = version 4.0/4.1 */ +dnl #undef NCURSES_970530 +dnl +dnl /*=== End new stuff for acconfig.h ===*/ +dnl + + +AC_DEFUN(AC_CHECK_CURSES,[ + search_ncurses=true + screen_manager="" + has_curses=false + + CFLAGS=${CFLAGS--O} + + AC_SUBST(CURSES_LIBS) + AC_SUBST(CURSES_INCLUDEDIR) + + AC_ARG_WITH(sco, + [ --with-sco Use this to turn on SCO-specific code],[ + if test x$withval = xyes; then + AC_DEFINE(SCO_FLAVOR) + CFLAGS="$CFLAGS -D_SVID3" + fi + ]) + + AC_ARG_WITH(sunos-curses, + [ --with-sunos-curses Used to force SunOS 4.x curses],[ + if test x$withval = xyes; then + AC_USE_SUNOS_CURSES + fi + ]) + + AC_ARG_WITH(osf1-curses, + [ --with-osf1-curses Used to force OSF/1 curses],[ + if test x$withval = xyes; then + AC_USE_OSF1_CURSES + fi + ]) + + AC_ARG_WITH(vcurses, + [ --with-vcurses[=incdir] Used to force SysV curses], + if test x$withval != xyes; then + CURSES_INCLUDEDIR="-I$withval" + fi + AC_USE_SYSV_CURSES + ) + + AC_ARG_WITH(ncurses, + [ --with-ncurses[=dir] Compile with ncurses/locate base dir], + if test x$withval = xno ; then + search_ncurses=false + elif test x$withval != xyes ; then + CURSES_LIBS="$LIBS -L$withval/lib -lncurses" + CURSES_INCLUDEDIR="-I$withval/include" + search_ncurses=false + screen_manager="ncurses" + AC_DEFINE(USE_NCURSES) + AC_DEFINE(HAS_CURSES) + has_curses=true + fi + ) + + if $search_ncurses + then + AC_SEARCH_NCURSES() + fi + + +]) + + +AC_DEFUN(AC_USE_SUNOS_CURSES, [ + search_ncurses=false + screen_manager="SunOS 4.x /usr/5include curses" + AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses) + AC_DEFINE(USE_SUNOS_CURSES) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES) + AC_DEFINE(USE_SYSV_CURSES) + CURSES_INCLUDEDIR="-I/usr/5include" + CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a" + AC_MSG_RESULT(Please note that some screen refreshs may fail) +]) + +AC_DEFUN(AC_USE_OSF1_CURSES, [ + AC_MSG_RESULT(Using OSF1 curses) + search_ncurses=false + screen_manager="OSF1 curses" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES) + AC_DEFINE(USE_SYSV_CURSES) + CURSES_LIBS="-lcurses" +]) + +AC_DEFUN(AC_USE_SYSV_CURSES, [ + AC_MSG_RESULT(Using SysV curses) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_SYSV_CURSES) + search_ncurses=false + screen_manager="SysV/curses" + CURSES_LIBS="-lcurses" +]) + +dnl AC_ARG_WITH(bsd-curses, +dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy], +dnl search_ncurses=false +dnl screen_manager="Ultrix/cursesX" +dnl if test $system = ULTRIX +dnl then +dnl THIS_CURSES=cursesX +dnl else +dnl THIS_CURSES=curses +dnl fi +dnl +dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap" +dnl AC_DEFINE(HAS_CURSES) +dnl has_curses=true +dnl AC_DEFINE(USE_BSD_CURSES) +dnl AC_MSG_RESULT(Please note that some screen refreshs may fail) +dnl AC_WARN(Use of the bsdcurses extension has some) +dnl AC_WARN(display/input problems.) +dnl AC_WARN(Reconsider using xcurses) +dnl) + + +dnl +dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename +dnl +AC_DEFUN(AC_NCURSES, [ + if $search_ncurses + then + if test -f $1/$2 + then + AC_MSG_RESULT(Found ncurses on $1/$2) + CURSES_LIBS="$3" + CURSES_INCLUDEDIR="$4" + search_ncurses=false + screen_manager=$5 + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + fi + fi +]) + +AC_DEFUN(AC_SEARCH_NCURSES, [ + AC_CHECKING("location of ncurses.h file") + + AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include") + AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses") + AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local") + 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") + + 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") + + AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses") + + dnl + dnl We couldn't find ncurses, try SysV curses + dnl + if $search_ncurses + then + AC_EGREP_HEADER(init_color, /usr/include/curses.h, + AC_USE_SYSV_CURSES) + AC_EGREP_CPP(USE_NCURSES,[ +#include +#ifdef __NCURSES_H +#undef USE_NCURSES +USE_NCURSES +#endif +],[ + CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + search_ncurses=false + screen_manager="ncurses installed as curses" +]) + fi + + dnl + dnl Try SunOS 4.x /usr/5{lib,include} ncurses + dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES + dnl should be replaced by a more fine grained selection routine + dnl + if $search_ncurses + then + if test -f /usr/5include/curses.h + then + AC_USE_SUNOS_CURSES + fi + else + # check for ncurses version, to properly ifdef mouse-fix + AC_MSG_CHECKING(for ncurses version) + ncurses_version=unknown +cat > conftest.$ac_ext < +#else +#include +#endif +#undef VERSION +VERSION:NCURSES_VERSION +EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | + egrep "VERSION:" >conftest.out 2>&1; then +changequote(,)dnl + ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'` +changequote([,])dnl + fi + rm -rf conftest* + AC_MSG_RESULT($ncurses_version) + case "$ncurses_version" in +changequote(,)dnl + 4.[01]) +changequote([,])dnl + AC_DEFINE(NCURSES_970530,2) + ;; + 1.9.9g) + AC_DEFINE(NCURSES_970530,1) + ;; + 1*) + AC_DEFINE(NCURSES_970530,0) + ;; + esac + fi +]) + + + + + +dnl GNOME_SUPPORT_CHECKS +dnl Check for various support functions needed by the standard +dnl Gnome libraries. Sets LIBOBJS, might define some macros. +dnl This should only be used when building the Gnome libs; +dnl Gnome clients should not need this macro. +AC_DEFUN([GNOME_SUPPORT_CHECKS],[ + # we need an `awk' to build `gnomesupport.h' + AC_REQUIRE([AC_PROG_AWK]) + + # this should go away soon + need_gnome_support=yes + + save_LIBOBJS="$LIBOBJS" + LIBOBJS= + + AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o") + + # for `scandir' + AC_HEADER_DIRENT + + # copied from `configure.in' of `libiberty' + vars="program_invocation_short_name program_invocation_name sys_errlist" + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(gnome_cv_var_$v, + [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;], + [eval "gnome_cv_var_$v=yes"], + [eval "gnome_cv_var_$v=no"])]) + if eval "test \"`echo '$gnome_cv_var_'$v`\" = yes"; then + AC_MSG_RESULT(yes) + n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + else + AC_MSG_RESULT(no) + fi + done + + AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen) + AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf) + + AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o") + + # to include `error.c' error.c has some HAVE_* checks + AC_CHECK_FUNCS(vprintf doprnt strerror_r) + AM_FUNC_ERROR_AT_LINE + + # This is required if we declare setreuid () and setregid (). + AC_TYPE_UID_T + + # see if we need to declare some functions. Solaris is notorious for + # putting functions into the `libc' but not listing them in the headers + AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h dirent.h) + GCC_NEED_DECLARATIONS(gethostname setreuid setregid getpagesize) + GCC_NEED_DECLARATION(scandir,[ +#ifdef HAVE_DIRENT_H +#include +#endif +]) + + # Turn our LIBOBJS into libtool objects. This is gross, but it + # requires changes to autoconf before it goes away. + LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'` + AC_SUBST(need_gnome_support) + AC_SUBST(LTLIBOBJS) + + LIBOBJS="$save_LIBOBJS" + AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes) +]) +# Configure paths for Bonobo +# Miguel de Icaza, 99-04-12 +# Stolen from Chris Lahey 99-2-5 +# stolen from Manish Singh again +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_BONOBO ([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for Bonobo, and define BONOBO_CFLAGS and BONOBO_LIBS +dnl +AC_DEFUN([AM_PATH_BONOBO], +[ +dnl +dnl Get the cflags and libraries from the gnome-config script +dnl +AC_ARG_WITH(bonobo-prefix,[ --with-bonobo-prefix=PFX Prefix where Bonobo is installed (optional)], + bonobo_prefix="$withval", bonobo_prefix="") +AC_ARG_WITH(bonobo-exec-prefix,[ --with-bonobo-exec-prefix=PFX Exec prefix where Bonobo is installed (optional)], + bonobo_exec_prefix="$withval", bonobo_exec_prefix="") +AC_ARG_ENABLE(bonobotest, [ --disable-bonobotest Do not try to compile and run a test Bonobo program], + , enable_bonobotest=yes) + + if test x$bonobo_exec_prefix != x ; then + bonobo_args="$bonobo_args --exec-prefix=$bonobo_exec_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$bonobo_exec_prefix/bin/gnome-config + fi + fi + if test x$bonobo_prefix != x ; then + bonobo_args="$bonobo_args --prefix=$bonobo_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$bonobo_prefix/bin/gnome-config + fi + fi + + AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) + min_bonobo_version=ifelse([$1], ,0.1.0,$1) + AC_MSG_CHECKING(for BONOBO - version >= $min_bonobo_version) + no_bonobo="" + if test "$GNOME_CONFIG" = "no" ; then + no_bonobo=yes + else + BONOBO_CFLAGS=`$GNOME_CONFIG $bonoboconf_args --cflags bonobo` + BONOBO_LIBS=`$GNOME_CONFIG $bonoboconf_args --libs bonobo` + + bonobo_major_version=`$GNOME_CONFIG $bonobo_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + bonobo_minor_version=`$GNOME_CONFIG $bonobo_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + bonobo_micro_version=`$GNOME_CONFIG $bonobo_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_bonobotest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $BONOBO_CFLAGS" + LIBS="$LIBS $BONOBO_LIBS" +dnl +dnl Now check if the installed BONOBO is sufficiently new. (Also sanity +dnl checks the results of gnome-config to some extent +dnl + rm -f conf.bonobotest + AC_TRY_RUN([ +#include +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.bonobotest"); + bonobo_object_get_type (); + return 0; +} + +],, no_bonobo=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_bonobo" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GNOME_CONFIG" = "no" ; then + echo "*** The gnome-config script installed by GNOME-LIBS could not be found" + echo "*** If BONOBO was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GNOME_CONFIG environment variable to the" + echo "*** full path to gnome-config." + else + if test -f conf.bonobotest ; then + : + else + echo "*** Could not run BONOBO test program, checking why..." + CFLAGS="$CFLAGS $BONOBO_CFLAGS" + LIBS="$LIBS $BONOBO_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding BONOBO or finding the wrong" + echo "*** version of BONOBO. If it is not finding BONOBO, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means BONOBO was incorrectly installed" + echo "*** or that you have moved BONOBO since it was installed. In the latter case, you" + echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + BONOBO_CFLAGS="" + BONOBO_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(BONOBO_CFLAGS) + AC_SUBST(BONOBO_LIBS) + rm -f conf.bonobotest +]) + +AC_DEFUN([BONOBO_CHECK], [ + AM_PATH_BONOBO(0.1.0,,[AC_MSG_ERROR(BONOBO not found)]) +]) + +dnl GNOME_UNDELFS_CHECKS +dnl Check for ext2fs undel support. +dnl Set shell variable ext2fs_undel to "yes" if we have it, +dnl "no" otherwise. May define USE_EXT2FSLIB for cpp. +dnl Will set EXT2FS_UNDEL_LIBS to required libraries. + +AC_DEFUN([GNOME_UNDELFS_CHECKS], [ + AC_CHECK_HEADERS(ext2fs/ext2fs.h linux/ext2_fs.h) + ext2fs_undel=no + EXT2FS_UNDEL_LIBS= + if test x$ac_cv_header_ext2fs_ext2fs_h = xyes + then + if test x$ac_cv_header_linux_ext2_fs_h = xyes + then + AC_DEFINE(USE_EXT2FSLIB) + ext2fs_undel=yes + EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err" + fi + fi +]) +# gnome-common.m4 +# +# This only for packages that are not in the GNOME CVS tree. + +dnl GNOME_COMMON_INIT + +AC_DEFUN([GNOME_COMMON_INIT], +[ + GNOME_ACLOCAL_DIR=`$ACLOCAL --print-ac-dir`/gnome + AC_SUBST(GNOME_ACLOCAL_DIR) + + ACLOCAL="$ACLOCAL -I $GNOME_ACLOCAL_DIR" +]) + +dnl GNOME_VFS_CHECKS +dnl Check for various functions needed by libvfs. +dnl This has various effects: +dnl Sets GNOME_VFS_LIBS to libraries required +dnl Sets termnet to true or false depending on whether it is required. +dnl If yes, defines USE_TERMNET. +dnl Sets vfs_flags to "pretty" list of vfs implementations we include. +dnl Sets shell variable use_vfs to yes (default, --with-vfs) or +dnl "no" (--without-vfs). +dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv". + +dnl Private define +AC_DEFUN([GNOME_WITH_VFS],[ + dnl FIXME: network checks should probably be in their own macro. + AC_CHECK_LIB(nsl, t_accept) + AC_CHECK_LIB(socket, socket) + + have_socket=no + AC_CHECK_FUNCS(socket, have_socket=yes) + if test $have_socket = no; then + # socket is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, socket, [ + LIBS="$LIBS -l$lib" + have_socket=yes + AC_DEFINE(HAVE_SOCKET) + break]) + done + fi + + have_gethostbyname=no + AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes) + if test $have_gethostbyname = no; then + # gethostbyname is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break]) + done + fi + + vfs_flags="tarfs" + use_net_code=false + if test $have_socket = yes; then + AC_STRUCT_LINGER + AC_CHECK_FUNCS(pmap_set, , [ + AC_CHECK_LIB(rpc, pmap_set, [ + LIBS="-lrpc $LIBS" + AC_DEFINE(HAVE_PMAP_SET) + ])]) + AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport) + dnl add for source routing support setsockopt + AC_CHECK_HEADERS(rpc/pmap_clnt.h) + vfs_flags="$vfs_flags, mcfs, ftpfs, fish" + use_net_code=true + fi + + dnl + dnl Samba support + dnl + smbfs="" + SAMBAFILES="" + AC_ARG_WITH(samba, + [--with-samba Support smb virtual file system],[ + if test "x$withval != xno"; then + AC_DEFINE(WITH_SMBFS) + vfs_flags="$vfs_flags, smbfs" + smbfs="smbfs.o" + SAMBAFILES="\$(SAMBAFILES)" + fi + ]) + AC_SUBST(smbfs) + AC_SUBST(SAMBAFILES) + + dnl + dnl The termnet support + dnl + termnet=false + AC_ARG_WITH(termnet, + [--with-termnet If you want a termified net support],[ + if test x$withval = xyes; then + AC_DEFINE(USE_TERMNET) + termnet=true + fi + ]) + + TERMNET="" + AC_DEFINE(USE_VFS) + if $use_net_code; then + AC_DEFINE(USE_NETCODE) + fi + mcserv= + if test $have_socket = yes; then + mcserv="mcserv" + if $termnet; then + TERMNET="-ltermnet" + fi + fi + + AC_SUBST(TERMNET) + AC_SUBST(mcserv) + +dnl FIXME: +dnl GNOME_VFS_LIBS= + +]) + +AC_DEFUN([GNOME_VFS_CHECKS],[ + use_vfs=yes + AC_ARG_WITH(vfs, + [--with-vfs Compile with the VFS code], + use_vfs=$withval + ) + case $use_vfs in + yes) GNOME_WITH_VFS;; + no) use_vfs=no;; + *) use_vfs=no;; + dnl Should we issue a warning? + esac +]) + + +dnl +dnl GNOME_FILEUTILS_CHECKS +dnl +dnl checks that are needed for the diskusage applet. +dnl + +AC_DEFUN([GNOME_FILEUTILS_CHECKS], +[ +AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \ +mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \ +sys/filsys.h sys/fs_types.h sys/fs/s5param.h) + +AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \ +getcwd getmntinfo gettimeofday isascii lchown \ +listmntent memcpy mkfifo strchr strerror strrchr vprintf) + +dnl Set some defaults when cross-compiling + +if test x$cross_compiling = xyes ; then + case "$host_os" in + linux*) + fu_cv_sys_mounted_getmntent1=yes + fu_cv_sys_stat_statfs2_bsize=yes + ;; + sunos*) + fu_cv_sys_stat_statfs4=yes + ;; + freebsd*) + fu_cv_sys_stat_statfs2_bsize=yes + ;; + osf*) + fu_cv_sys_stat_statfs3_osf1=yes + ;; + esac +fi + +# Determine how to get the list of mounted filesystems. +list_mounted_fs= + +# If the getmntent function is available but not in the standard library, +# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX). +AC_FUNC_GETMNTENT + +# This test must precede the ones for getmntent because Unicos-9 is +# reported to have the getmntent function, but its support is incompatible +# with other getmntent implementations. + +# NOTE: Normally, I wouldn't use a check for system type as I've done for +# `CRAY' below since that goes against the whole autoconf philosophy. But +# I think there is too great a chance that some non-Cray system has a +# function named listmntent to risk the false positive. + +if test -z "$list_mounted_fs"; then +# Cray UNICOS 9 +AC_MSG_CHECKING([for listmntent of Cray/Unicos-9]) +AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent, +[fu_cv_sys_mounted_cray_listmntent=no +AC_EGREP_CPP(yes, +[#ifdef _CRAY +yes +#endif +], [test $ac_cv_func_listmntent = yes \ +&& fu_cv_sys_mounted_cray_listmntent=yes] +) +] +) +AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent) +if test $fu_cv_sys_mounted_cray_listmntent = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_LISTMNTENT) +fi +fi + +if test $ac_cv_func_getmntent = yes; then + +# This system has the getmntent function. +# Determine whether it's the one-argument variant or the two-argument one. + +if test -z "$list_mounted_fs"; then +# 4.3BSD, SunOS, HP-UX, Dynix, Irix +AC_MSG_CHECKING([for one-argument getmntent function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1, +[test $ac_cv_header_mntent_h = yes \ +&& fu_cv_sys_mounted_getmntent1=yes \ +|| fu_cv_sys_mounted_getmntent1=no]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1) +if test $fu_cv_sys_mounted_getmntent1 = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTENT1) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR4 +AC_MSG_CHECKING([for two-argument getmntent function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2, +[AC_EGREP_HEADER(getmntent, sys/mnttab.h, +fu_cv_sys_mounted_getmntent2=yes, +fu_cv_sys_mounted_getmntent2=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2) +if test $fu_cv_sys_mounted_getmntent2 = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTENT2) +fi +fi + +if test -z "$list_mounted_fs"; then +AC_MSG_ERROR([could not determine how to read list of mounted filesystems]) +fi + +fi + +if test -z "$list_mounted_fs"; then +# DEC Alpha running OSF/1. +AC_MSG_CHECKING([for getfsstat function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getsstat, +[AC_TRY_LINK([ +#include +#include +#include ], +[struct statfs *stats; +int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ], +fu_cv_sys_mounted_getsstat=yes, +fu_cv_sys_mounted_getsstat=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getsstat) +if test $fu_cv_sys_mounted_getsstat = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETFSSTAT) +fi +fi + +if test -z "$list_mounted_fs"; then +# AIX. +AC_MSG_CHECKING([for mntctl function and struct vmount]) +AC_CACHE_VAL(fu_cv_sys_mounted_vmount, +[AC_TRY_CPP([#include ], +fu_cv_sys_mounted_vmount=yes, +fu_cv_sys_mounted_vmount=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_vmount) +if test $fu_cv_sys_mounted_vmount = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_VMOUNT) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR3 +AC_MSG_CHECKING([for FIXME existence of three headers]) +AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp, +[AC_TRY_CPP([ +#include +#include +#include ], +fu_cv_sys_mounted_fread_fstyp=yes, +fu_cv_sys_mounted_fread_fstyp=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp) +if test $fu_cv_sys_mounted_fread_fstyp = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_FREAD_FSTYP) +fi +fi + +if test -z "$list_mounted_fs"; then +# 4.4BSD and DEC OSF/1. +AC_MSG_CHECKING([for getmntinfo function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo, +[ +ok= +if test $ac_cv_func_getmntinfo = yes; then +AC_EGREP_HEADER(f_type;, sys/mount.h, +ok=yes) +fi +test -n "$ok" \ +&& fu_cv_sys_mounted_getmntinfo=yes \ +|| fu_cv_sys_mounted_getmntinfo=no +]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo) +if test $fu_cv_sys_mounted_getmntinfo = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTINFO) +fi +fi + +# FIXME: add a test for netbsd-1.1 here + +if test -z "$list_mounted_fs"; then +# Ultrix +AC_MSG_CHECKING([for getmnt function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmnt, +[AC_TRY_CPP([ +#include +#include ], +fu_cv_sys_mounted_getmnt=yes, +fu_cv_sys_mounted_getmnt=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmnt) +if test $fu_cv_sys_mounted_getmnt = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNT) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR2 +AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab]) +AC_CACHE_VAL(fu_cv_sys_mounted_fread, +[AC_TRY_CPP([#include ], +fu_cv_sys_mounted_fread=yes, +fu_cv_sys_mounted_fread=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_fread) +if test $fu_cv_sys_mounted_fread = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_FREAD) +fi +fi + +if test -z "$list_mounted_fs"; then +AC_MSG_ERROR([could not determine how to read list of mounted filesystems]) +# FIXME -- no need to abort building the whole package +# Can't build mountlist.c or anything that needs its functions +fi + +AC_CHECKING(how to get filesystem space usage) +space=no + +# Perform only the link test since it seems there are no variants of the +# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs) +# because that got a false positive on SCO OSR5. Adding the declaration +# of a `struct statvfs' causes this test to fail (as it should) on such +# systems. That system is reported to work fine with STAT_STATFS4 which +# is what it gets when this test fails. +if test $space = no; then +# SVR4 +AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs, +[AC_TRY_LINK([#include +#include ], +[struct statvfs fsd; statvfs (0, &fsd);], +fu_cv_sys_stat_statvfs=yes, +fu_cv_sys_stat_statvfs=no)]) +if test $fu_cv_sys_stat_statvfs = yes; then +space=yes +AC_DEFINE(STAT_STATVFS) +fi +fi + +if test $space = no; then +# DEC Alpha running OSF/1 +AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1, +[AC_TRY_RUN([ +#include +#include +#include +main () +{ +struct statfs fsd; +fsd.f_fsize = 0; +exit (statfs (".", &fsd, sizeof (struct statfs))); +}], +fu_cv_sys_stat_statfs3_osf1=yes, +fu_cv_sys_stat_statfs3_osf1=no, +fu_cv_sys_stat_statfs3_osf1=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1) +if test $fu_cv_sys_stat_statfs3_osf1 = yes; then +space=yes +AC_DEFINE(STAT_STATFS3_OSF1) +fi +fi + +if test $space = no; then +# AIX +AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl +member (AIX, 4.3BSD)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize, +[AC_TRY_RUN([ +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif +main () +{ +struct statfs fsd; +fsd.f_bsize = 0; +exit (statfs (".", &fsd)); +}], +fu_cv_sys_stat_statfs2_bsize=yes, +fu_cv_sys_stat_statfs2_bsize=no, +fu_cv_sys_stat_statfs2_bsize=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize) +if test $fu_cv_sys_stat_statfs2_bsize = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_BSIZE) +fi +fi + +if test $space = no; then +# SVR3 +AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs4, +[AC_TRY_RUN([#include +#include +main () +{ +struct statfs fsd; +exit (statfs (".", &fsd, sizeof fsd, 0)); +}], +fu_cv_sys_stat_statfs4=yes, +fu_cv_sys_stat_statfs4=no, +fu_cv_sys_stat_statfs4=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs4) +if test $fu_cv_sys_stat_statfs4 = yes; then +space=yes +AC_DEFINE(STAT_STATFS4) +fi +fi + +if test $space = no; then +# 4.4BSD and NetBSD +AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl +member (4.4BSD and NetBSD)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize, +[AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +main () +{ +struct statfs fsd; +fsd.f_fsize = 0; +exit (statfs (".", &fsd)); +}], +fu_cv_sys_stat_statfs2_fsize=yes, +fu_cv_sys_stat_statfs2_fsize=no, +fu_cv_sys_stat_statfs2_fsize=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize) +if test $fu_cv_sys_stat_statfs2_fsize = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_FSIZE) +fi +fi + +if test $space = no; then +# Ultrix +AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) +AC_CACHE_VAL(fu_cv_sys_stat_fs_data, +[AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_FS_TYPES_H +#include +#endif +main () +{ +struct fs_data fsd; +/* Ultrix's statfs returns 1 for success, +0 for not mounted, -1 for failure. */ +exit (statfs (".", &fsd) != 1); +}], +fu_cv_sys_stat_fs_data=yes, +fu_cv_sys_stat_fs_data=no, +fu_cv_sys_stat_fs_data=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_fs_data) +if test $fu_cv_sys_stat_fs_data = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_FS_DATA) +fi +fi + +if test $space = no; then +# SVR2 +AC_TRY_CPP([#include ], +AC_DEFINE(STAT_READ_FILSYS) space=yes) +fi + +if test -n "$list_mounted_fs" && test $space != no; then +DF_PROG="df" +# LIBOBJS="$LIBOBJS fsusage.o" +# LIBOBJS="$LIBOBJS mountlist.o" +fi + +# Check for SunOS statfs brokenness wrt partitions 2GB and larger. +# If exists and struct statfs has a member named f_spare, +# enable the work-around code in fsusage.c. +AC_MSG_CHECKING([for statfs that truncates block counts]) +AC_CACHE_VAL(fu_cv_sys_truncating_statfs, +[AC_TRY_COMPILE([ +#if !defined(sun) && !defined(__sun) +choke -- this is a workaround for a Sun-specific problem +#endif +#include +#include ], +[struct statfs t; long c = *(t.f_spare);], +fu_cv_sys_truncating_statfs=yes, +fu_cv_sys_truncating_statfs=no, +)]) +if test $fu_cv_sys_truncating_statfs = yes; then +AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS) +fi +AC_MSG_RESULT($fu_cv_sys_truncating_statfs) + +AC_CHECKING(for AFS) +test -d /afs && AC_DEFINE(AFS) +]) +dnl GNOME_X_CHECKS +dnl +dnl Basic X11 related checks for X11. At the end, the following will be +dnl defined/changed: +dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK +dnl CPPFLAGS Will include $X_CFLAGS +dnl GNOME_HAVE_SM `true' or `false' depending on whether session +dnl management is available. It is available if +dnl both -lSM and X11/SM/SMlib.h exist. (Some +dnl Solaris boxes have the library but not the header) +dnl XPM_LIBS -lXpm if Xpm library is present, otherwise "" +dnl +dnl The following configure cache variables are defined (but not used): +dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS} +dnl +AC_DEFUN([GNOME_X_CHECKS], +[ + AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path)) + dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could + dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes" + dnl + dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses + dnl CPPFLAGS, not CFLAGS + CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" + + saved_ldflags="$LDFLAGS" + LDFLAGS="$LDFLAGS $GTK_LIBS" + + gnome_cv_passdown_x_libs="$GTK_LIBS" + gnome_cv_passdown_X_LIBS="$GTK_LIBS" + gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS" + gnome_cv_passdown_GTK_LIBS="$GTK_LIBS" + + LDFLAGS="$saved_ldflags $GTK_LIBS" + +dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow. + USE_DEVGTK=true + +dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x]) +dnl AC_EGREP_CPP(answer_affirmatively, +dnl [#include +dnl #ifdef GTK_HAVE_FEATURES_1_1_0 +dnl answer_affirmatively +dnl #endif +dnl ], dev_gtk=yes, dev_gtk=no) +dnl if test "$dev_gtk" = "yes"; then +dnl USE_DEVGTK=true +dnl fi +dnl AC_MSG_RESULT("$dev_gtk") + + GNOME_HAVE_SM=true + case "$GTK_LIBS" in + *-lSM*) + dnl Already found it. + ;; + *) + dnl Assume that if we have -lSM then we also have -lICE. + AC_CHECK_LIB(SM, SmcSaveYourselfDone, + [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false, + $x_libs -lICE) + ;; + esac + + if test "$GNOME_HAVE_SM" = true; then + AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false) + fi + + if test "$GNOME_HAVE_SM" = true; then + AC_DEFINE(HAVE_LIBSM) + fi + + XPM_LIBS="" + AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs) + AC_SUBST(XPM_LIBS) + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + LDFLAGS="$saved_ldflags" + + AC_PROVIDE([GNOME_X_CHECKS]) +]) +AC_DEFUN([GNOME_GHTTP_CHECK],[ + AC_REQUIRE([GNOME_INIT_HOOK]) + GHTTP_LIB= + AC_CHECK_FUNC(connect,,[ + AC_CHECK_LIB(socket,connect, + GHTTP_LIB="-lsocket $GHTTP_LIB",,$GHTTP_LIB)]) + AC_CHECK_FUNC(gethostbyname,,[ + AC_CHECK_LIB(nsl,gethostbyname, + GHTTP_LIB="-lnsl $GHTTP_LIB",,$GHTTP_LIB)]) + AC_CHECK_LIB(ghttp, ghttp_request_new, + GHTTP_LIB="-lghttp $GHTTP_LIB",GHTTP_LIB="",-L$gnome_prefix $GHTTP_LIB) + AC_SUBST(GHTTP_LIB) + AC_PROVIDE([GNOME_GHTTP_CHECK]) +]) +dnl +dnl GNOME_XML_HOOK (script-if-xml-found, failflag) +dnl +dnl If failflag is "failure", script aborts due to lack of XML +dnl +dnl Check for availability of the libxml library +dnl the XML parser uses libz if available too +dnl + +AC_DEFUN([GNOME_XML_HOOK],[ + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = no; then + if test x$2 = xfailure; then + AC_MSG_ERROR(Could not find gnome-config) + fi + fi + AC_CHECK_LIB(xml, xmlNewDoc, [ + $1 + GNOME_XML_LIB=`$GNOME_CONFIG --libs xml` + ], [ + if test x$2 = xfailure; then + AC_MSG_ERROR(Could not link sample xml program) + fi + ], `$GNOME_CONFIG --libs xml`) + AC_SUBST(GNOME_XML_LIB) +]) + +AC_DEFUN([GNOME_XML_CHECK], [ + GNOME_XML_HOOK([],failure) +]) +dnl +dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag) +dnl +dnl if failflag is "failure" it aborts if gnorba is not found. +dnl + +AC_DEFUN([GNOME_GNORBA_HOOK],[ + GNOME_ORBIT_HOOK([],$2) + AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[ + gnome_cv_gnorba_found=no + if test x$gnome_cv_orbit_found = xyes; then + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + if test -n "$GNORBA_LIBS"; then + gnome_cv_gnorba_found=yes + fi + fi + ]) + AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + AC_SUBST(GNORBA_CFLAGS) + AC_SUBST(GNORBA_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(gnorba library not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_GNORBA_CHECK], [ + GNOME_GNORBA_HOOK([],failure) +]) +dnl +dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits]) +dnl +dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh +dnl is not found. +dnl + +AC_DEFUN([GNOME_INIT_HOOK],[ + AC_SUBST(GNOME_LIBS) + AC_SUBST(GNOMEUI_LIBS) + AC_SUBST(GNOMEGNORBA_LIBS) + AC_SUBST(GTKXMHTML_LIBS) + AC_SUBST(ZVT_LIBS) + AC_SUBST(GNOME_LIBDIR) + AC_SUBST(GNOME_INCLUDEDIR) + + AC_ARG_WITH(gnome-includes, + [ --with-gnome-includes Specify location of GNOME headers],[ + CFLAGS="$CFLAGS -I$withval" + ]) + + AC_ARG_WITH(gnome-libs, + [ --with-gnome-libs Specify location of GNOME libs],[ + LDFLAGS="$LDFLAGS -L$withval" + gnome_prefix=$withval + ]) + + AC_ARG_WITH(gnome, + [ --with-gnome Specify prefix for GNOME files], + if test x$withval = xyes; then + want_gnome=yes + dnl Note that an empty true branch is not + dnl valid sh syntax. + ifelse([$1], [], :, [$1]) + else + if test "x$withval" = xno; then + want_gnome=no + else + want_gnome=yes + LDFLAGS="$LDFLAGS -L$withval/lib" + CFLAGS="$CFLAGS -I$withval/include" + gnome_prefix=$withval/lib + fi + fi, + want_gnome=yes) + + if test "x$want_gnome" = xyes; then + + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = "no"; then + no_gnome_config="yes" + else + AC_MSG_CHECKING(if $GNOME_CONFIG works) + if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then + AC_MSG_RESULT(yes) + GNOME_GNORBA_HOOK([],$2) + GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" + GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" + GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" + GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" + ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" + GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" + GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" + $1 + else + AC_MSG_RESULT(no) + no_gnome_config="yes" + fi + fi + + if test x$exec_prefix = xNONE; then + if test x$prefix = xNONE; then + gnome_prefix=$ac_default_prefix/lib + else + gnome_prefix=$prefix/lib + fi + else + gnome_prefix=`eval echo \`echo $libdir\`` + fi + + if test "$no_gnome_config" = "yes"; then + AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix) + if test -f $gnome_prefix/gnomeConf.sh; then + AC_MSG_RESULT(found) + echo "loading gnome configuration from" \ + "$gnome_prefix/gnomeConf.sh" + . $gnome_prefix/gnomeConf.sh + $1 + else + AC_MSG_RESULT(not found) + if test x$2 = xfail; then + AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install) + fi + fi + fi + fi + + if test -n "$3"; then + n="$3" + for i in $n; do + AC_MSG_CHECKING(extra library \"$i\") + case $i in + applets) + AC_SUBST(GNOME_APPLETS_LIBS) + GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` + AC_MSG_RESULT($GNOME_APPLETS_LIBS);; + docklets) + AC_SUBST(GNOME_DOCKLETS_LIBS) + GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets` + AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);; + capplet) + AC_SUBST(GNOME_CAPPLET_LIBS) + GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` + AC_MSG_RESULT($GNOME_CAPPLET_LIBS);; + *) + AC_MSG_RESULT(unknown library) + esac + done + fi +]) + +dnl +dnl GNOME_INIT ([additional-inits]) +dnl + +AC_DEFUN([GNOME_INIT],[ + GNOME_INIT_HOOK([],fail,$1) +]) +dnl +dnl GNOME_CHECK_GUILE (failflag) +dnl +dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found. +dnl + +AC_DEFUN([GNOME_CHECK_GUILE], +[ + saved_ldflags="$LDFLAGS" + saved_cppflags="$CPPFLAGS" + LDFLAGS="$LDFLAGS $GNOME_LIBDIR" + + AC_CHECK_LIB(qthreads,qt_null,[ + QTTHREADS_LIB="-lqthreads" + ],[ + AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt") + ],$LIBS) + AC_SUBST(QTTHREADS_LIB) + + AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap") + AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB) + + AC_SUBST(TERMCAP_LIB) + AC_SUBST(READLINE_LIB) + + if test "x$cross_compiling" = "xyes" ; then + name_build_guile="$target_alias-guile-config" + else + name_build_guile="guile-config" + fi + + AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(whether $name_build_guile works) + if test x`$name_build_guile --version >/dev/null 2>&1 || \ + echo no` = xno; then + BUILD_GUILE=no + fi + AC_MSG_RESULT($BUILD_GUILE) + else + + if test "x$cross_compiling" = "xyes" ; then + name_build_guile="$target_alias-build-guile" + else + name_build_guile="build-guile" + fi + + AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(whether $name_build_guile works) + if test x`$name_build_guile --version >/dev/null 2>&1 || \ + echo no` = xno; then + BUILD_GUILE=no + fi + AC_MSG_RESULT($BUILD_GUILE) + fi + fi + + AC_CHECK_LIB(m, sin) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(for guile libraries) + GUILE_LIBS="`$name_build_guile link`" + AC_MSG_RESULT($GUILE_LIBS) + AC_MSG_CHECKING(for guile headers) + GUILE_INCS="`$name_build_guile compile`" + AC_MSG_RESULT($GUILE_INCS) + else + GUILE_LIBS="$GNOME_LIBDIR" + GUILE_INCS="$GNOME_INCLUDEDIR" + AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS") + AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS") + AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS") + AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl") + AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket") + GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB" + fi + + AC_SUBST(GUILE_LIBS) + AC_SUBST(GUILE_INCS) + + saved_LIBS="$LIBS" + LIBS="$LIBS $GUILE_LIBS" + CPPFLAGS="$saved_cppflags $GUILE_INCS" + + AC_MSG_CHECKING(whether guile works) + AC_TRY_LINK([ + #include + #include + ],[ + gh_eval_str("(newline)"); + scm_boot_guile(0,NULL,NULL,NULL); + ],[ + ac_cv_guile_found=yes + AC_DEFINE(HAVE_GUILE) + ],[ + ac_cv_guile_found=no + ]) + AC_MSG_RESULT($ac_cv_guile_found) + + if test x$ac_cv_guile_found = xno ; then + if test x$1 = xfail ; then + AC_MSG_ERROR(Can not find Guile on this system) + else + AC_MSG_WARN(Can not find Guile on this system) + fi + ac_cv_guile_found=no + GUILE_LIBS= GUILE_INCS= + fi + + LIBS="$saved_LIBS" + LDFLAGS="$saved_ldflags" + CPPFLAGS="$saved_cppflags" + + AC_SUBST(GUILE_LIBS) + AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes) +]) +dnl +dnl AC_PROG_GPERF (MINIMUM-VERSION) +dnl +dnl Check for availability of gperf. +dnl Abort if not found or if current version is not up to par. +dnl + +AC_DEFUN([AC_PROG_GPERF],[ + AC_PATH_PROG(GPERF, gperf, no) + if test "$GPERF" = no; then + AC_MSG_ERROR(Could not find gperf) + fi + min_gperf_version=ifelse([$1], ,2.7,$1) + AC_MSG_CHECKING(for gperf - version >= $min_gperf_version) + gperf_major_version=`$GPERF --version | \ + sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\1/'` + gperf_minor_version=`$GPERF --version | \ + sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\2/'` + no_gperf="" +dnl +dnl Now check if the installed gperf is sufficiently new. +dnl + AC_TRY_RUN([ +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int +main () +{ + char *tmp_version; + + int major; + int minor; + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_gperf_version"); + if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) { + printf ("%s, bad version string\n", "$min_gperf_version"); + exit (1); + } + + if (($gperf_major_version > major) || + (($gperf_major_version == major) && ($gperf_minor_version >= minor))) { + return 0; + } else { + printf ("\n"); + printf ("*** An old version of gperf ($gperf_major_version.$gperf_minor_version) was found.\n"); + printf ("*** You need a version of gperf newer than %d.%d.%d. The latest version of\n", + major, minor); + printf ("*** gperf is always available from ftp://ftp.gnu.org.\n"); + printf ("***\n"); + return 1; + } +} +],,no_gperf=yes,[/bin/true]) + if test "x$no_gperf" = x ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + +]) +dnl +dnl LIBGTOP_CHECK_TYPE +dnl +dnl Improved version of AC_CHECK_TYPE which takes into account +dnl that we need to #include some other header files on some +dnl systems to get some types. + +dnl AC_LIBGTOP_CHECK_TYPE(TYPE, DEFAULT) +AC_DEFUN(AC_LIBGTOP_CHECK_TYPE, +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(ac_cv_type_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [#include +#if STDC_HEADERS +#include +#include +#endif + +/* For Tru64 */ +#ifdef HAVE_SYS_BITYPES_H +#include +#endif +], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl +AC_MSG_RESULT($ac_cv_type_$1) +if test $ac_cv_type_$1 = no; then + AC_DEFINE($1, $2) +fi +]) + +dnl +dnl GNOME_LIBGTOP_TYPES +dnl +dnl some typechecks for libgtop. +dnl + +AC_DEFUN([GNOME_LIBGTOP_TYPES], +[ + AC_CHECK_HEADERS(sys/bitypes.h) + AC_LIBGTOP_CHECK_TYPE(u_int64_t, unsigned long long int) + AC_LIBGTOP_CHECK_TYPE(int64_t, signed long long int) +]) + +dnl +dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag) +dnl +dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop +dnl is not found. +dnl + +AC_DEFUN([GNOME_LIBGTOP_HOOK], +[ + AC_REQUIRE([GNOME_LIBGTOP_TYPES]) + + AC_SUBST(LIBGTOP_LIBDIR) + AC_SUBST(LIBGTOP_INCLUDEDIR) + AC_SUBST(LIBGTOP_EXTRA_LIBS) + AC_SUBST(LIBGTOP_LIBS) + AC_SUBST(LIBGTOP_INCS) + AC_SUBST(LIBGTOP_NAMES_LIBS) + AC_SUBST(LIBGTOP_NAMES_INCS) + AC_SUBST(LIBGTOP_MAJOR_VERSION) + AC_SUBST(LIBGTOP_MINOR_VERSION) + AC_SUBST(LIBGTOP_MICRO_VERSION) + AC_SUBST(LIBGTOP_VERSION) + AC_SUBST(LIBGTOP_VERSION_CODE) + AC_SUBST(LIBGTOP_SERVER_VERSION) + AC_SUBST(LIBGTOP_INTERFACE_AGE) + AC_SUBST(LIBGTOP_BINARY_AGE) + AC_SUBST(LIBGTOP_BINDIR) + AC_SUBST(LIBGTOP_SERVER) + + dnl Get the cflags and libraries from the libgtop-config script + dnl + AC_ARG_WITH(libgtop, + [ --with-libgtop=PFX Prefix where LIBGTOP is installed (optional)], + libgtop_config_prefix="$withval", libgtop_config_prefix="") + AC_ARG_WITH(libgtop-exec, + [ --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)], + libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="") + + if test x$libgtop_config_exec_prefix != x ; then + libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix" + if test x${LIBGTOP_CONFIG+set} != xset ; then + LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config + fi + fi + if test x$libgtop_config_prefix != x ; then + libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix" + if test x${LIBGTOP_CONFIG+set} != xset ; then + LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config + fi + fi + + AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no) + dnl IMPORTANT NOTICE: + dnl If you increase this number here, this means that *ALL* + dnl modules will require the new version, even if they explicitly + dnl give a lower number in their `configure.in' !!! + real_min_libgtop_version=1.0.0 + min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1) + dnl I know, the following code looks really ugly, but if you want + dnl to make changes, please test it with a brain-dead /bin/sh and + dnl with a brain-dead /bin/test (not all shells/tests support the + dnl `<' operator to compare strings, that's why I convert everything + dnl into numbers and test them). + min_libgtop_major=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + min_libgtop_minor=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + min_libgtop_micro=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + test x$min_libgtop_micro = x && min_libgtop_micro=0 + real_min_libgtop_major=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + real_min_libgtop_minor=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + real_min_libgtop_micro=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0 + dnl You cannot require a version less then $real_min_libgtop_version, + dnl so you don't need to update each `configure.in' when it's increased. + if test $real_min_libgtop_major -gt $min_libgtop_major ; then + min_libgtop_major=$real_min_libgtop_major + min_libgtop_minor=$real_min_libgtop_minor + min_libgtop_micro=$real_min_libgtop_micro + elif test $real_min_libgtop_major = $min_libgtop_major ; then + if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then + min_libgtop_minor=$real_min_libgtop_minor + min_libgtop_micro=$real_min_libgtop_micro + elif test $real_min_libgtop_minor = $min_libgtop_minor ; then + if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then + min_libgtop_micro=$real_min_libgtop_micro + fi + fi + fi + min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro" + AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version) + no_libgtop="" + if test "$LIBGTOP_CONFIG" = "no" ; then + no_libgtop=yes + else + configfile=`$LIBGTOP_CONFIG --config` + libgtop_major_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + libgtop_minor_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + libgtop_micro_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test $libgtop_major_version != $min_libgtop_major ; then + no_libgtop=mismatch + else + test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes + if test $libgtop_minor_version = $min_libgtop_minor ; then + test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes + fi + fi + . $configfile + fi + if test x$no_libgtop = x ; then + AC_DEFINE(HAVE_LIBGTOP) + AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION") + AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE) + AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION) + AC_MSG_RESULT(yes) + dnl Note that an empty true branch is not valid sh syntax. + ifelse([$2], [], :, [$2]) + else + AC_MSG_RESULT(no) + if test "$no_libgtop"x = mismatchx; then + AC_MSG_ERROR(LibGTop major version mismatch $libgtop_major_version != $min_libgtop_major) + fi + if test "x$3" = "xfail"; then + AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found) + else + AC_MSG_WARN(LibGTop >= $min_libgtop_version not found) + fi + fi + + AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes) +]) + +AC_DEFUN([GNOME_INIT_LIBGTOP],[ + GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2) +]) + +dnl +dnl GNOME_LIBGTOP_DOCU +dnl +dnl checks whether the documentation of LibGTop is installed +dnl + +AC_DEFUN([GNOME_LIBGTOP_DOCU], +[ + AC_REQUIRE([GNOME_LIBGTOP_HOOK]) + + helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop" + + AC_MSG_CHECKING(whether you have the LibGTop Documentation) + + if test -f "$helpdir/C/topic.dat" ; then + have_libgtop_docu=yes + AC_DEFINE(HAVE_LIBGTOP_DOCU) + else + have_libgtop_docu=no + fi + + AC_MSG_RESULT($have_libgtop_docu) + + AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes) +]) + +dnl +dnl Check for struct linger +dnl +AC_DEFUN(AC_STRUCT_LINGER, [ +av_struct_linger=no +AC_MSG_CHECKING(struct linger is available) +AC_TRY_RUN([ +#include +#include + +struct linger li; + +main () +{ + li.l_onoff = 1; + li.l_linger = 120; + exit (0); +} +],[ +AC_DEFINE(HAVE_STRUCT_LINGER) +av_struct_linger=yes +],[ +av_struct_linger=no +],[ +av_struct_linger=no +]) +AC_MSG_RESULT($av_struct_linger) +]) +AC_DEFUN([GNOME_CHECK_OBJC], +[ +dnl Look for an ObjC compiler. +dnl FIXME: extend list of possible names of ObjC compilers. + AC_CHECK_PROGS(OBJC, $OBJC egcs, "") + if test "x$OBJC" = "x" ; then + AC_CHECK_PROGS(OBJC, $OBJC egcc, "") + if test "x$OBJC" = "x" ; then + AC_CHECK_PROGS(OBJC, $OBJC gcc, "") + fi + fi + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + + OBJC_LIBS="-lobjc $PTHREAD_LIB" + AC_CHECK_FUNC(sched_yield,,[ + AC_CHECK_LIB(rt,sched_yield, + OBJC_LIBS="$OBJC_LIBS -lrt",[ + AC_CHECK_LIB(posix4,sched_yield, + OBJC_LIBS="$OBJC_LIBS -lposix4",, + $OBJC_LIBS)], + $OBJC_LIBS)]) + AC_SUBST(OBJC_LIBS) + + AC_CACHE_CHECK([if Objective C compiler ($OBJC) works], + ac_cv_prog_objc_works, [ + if test -n "$OBJC"; then + cat > conftest.m < +@interface myRandomObj : Object +{ +} +@end +@implementation myRandomObj +@end +int main () { + /* No, you are not seeing double. Remember that square brackets + are the autoconf m4 quotes. */ + id myid = [[myRandomObj alloc]]; + [[myid free]]; + return 0; +} +EOF + + $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1 + result=$? + rm -f conftest* + + if test $result -eq 0; then + ac_cv_prog_objc_works=yes + fi + else + ac_cv_prog_objc_works=no + fi + ]) + + AM_CONDITIONAL(OBJECTIVE_C, test x$ac_cv_prog_objc_works = xyes) + dnl Also set the shell variable OBJECTIVE_C to "yes" or "no". + OBJECTIVE_C=$ac_cv_prog_objc_works +]) + +AC_DEFUN([GNOME_INIT_OBJC], +[ + AC_MSG_CHECKING(for an obGnomeConf.sh) + my_gnome_libdir=`$GNOME_CONFIG --libdir` + if test -f $my_gnome_libdir/obGnomeConf.sh; then + . $my_gnome_libdir/obGnomeConf.sh + AC_MSG_RESULT(found $my_gnome_libdir) + ac_cv_have_gnome_objc=yes + else + AC_MSG_RESULT(not found) + AC_MSG_WARN(Could not find the obGnomeConf.sh file that is generated by gnome-objc install) + ac_cv_have_gnome_objc=no + fi + + dnl Add a conditional on whether or not we have gnome-objc + AM_CONDITIONAL(HAVE_GNOME_OBJC, test x$ac_cv_have_gnome_objc = xyes) + HAVE_GNOME_OBJC=$ac_cv_have_gnome_objc + + AC_SUBST(OBGNOME_INCLUDEDIR) + AC_SUBST(OBGNOME_LIBS) + AC_SUBST(OBGTK_LIBS) +]) +dnl See whether we need a declaration for a function. +dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES]) +AC_DEFUN(GCC_NEED_DECLARATION, +[AC_MSG_CHECKING([whether $1 must be declared]) +AC_CACHE_VAL(gcc_cv_decl_needed_$1, +[AC_TRY_COMPILE([ +#include +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +$2], +[char *(*pfn) = (char *(*)) $1], +eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")]) +if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then + AC_MSG_RESULT(yes) + gcc_need_declarations="$gcc_need_declarations $1" + gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($gcc_tr_decl) +else + AC_MSG_RESULT(no) +fi +])dnl + +dnl Check multiple functions to see whether each needs a declaration. +dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES]) +AC_DEFUN(GCC_NEED_DECLARATIONS, +[for ac_func in $1 +do +GCC_NEED_DECLARATION($ac_func, $2) +done +] +) +dnl +dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag) +dnl +dnl if failflag is "failure" it aborts if orbit is not found. +dnl + +AC_DEFUN([GNOME_ORBIT_HOOK],[ + AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no) + AC_PATH_PROG(ORBIT_IDL,orbit-idl,no) + AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[ + if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then + gnome_cv_orbit_found=no + else + gnome_cv_orbit_found=yes + fi + ]) + AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + ORBIT_CFLAGS=`orbit-config --cflags client server` + ORBIT_LIBS=`orbit-config --use-service=name --libs client server` + AC_SUBST(ORBIT_CFLAGS) + AC_SUBST(ORBIT_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(ORBit not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_ORBIT_CHECK], [ + GNOME_ORBIT_HOOK([],failure) +]) +# Configure paths for GTK-- +# Erik Andersen 30 May 1998 +# Modified by Tero Pulkkinen (added the compiler checks... I hope they work..) +# Modified by Thomas Langen 16 Jan 2000 (corrected CXXFLAGS) + +dnl Test for GTKMM, and define GTKMM_CFLAGS and GTKMM_LIBS +dnl to be used as follows: +dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl +AC_DEFUN(AM_PATH_GTKMM, +[dnl +dnl Get the cflags and libraries from the gtkmm-config script +dnl +AC_ARG_WITH(gtkmm-prefix,[ --with-gtkmm-prefix=PREFIX + Prefix where GTK-- is installed (optional)], + gtkmm_config_prefix="$withval", gtkmm_config_prefix="") +AC_ARG_WITH(gtkmm-exec-prefix,[ --with-gtkmm-exec-prefix=PREFIX + Exec prefix where GTK-- is installed (optional)], + gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="") +AC_ARG_ENABLE(gtkmmtest, [ --disable-gtkmmtest Do not try to compile and run a test GTK-- program], + , enable_gtkmmtest=yes) + + if test x$gtkmm_config_exec_prefix != x ; then + gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix" + if test x${GTKMM_CONFIG+set} != xset ; then + GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config + fi + fi + if test x$gtkmm_config_prefix != x ; then + gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix" + if test x${GTKMM_CONFIG+set} != xset ; then + GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config + fi + fi + + AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no) + min_gtkmm_version=ifelse([$1], ,0.10.0,$1) + + AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version) + no_gtkmm="" + if test "$GTKMM_CONFIG" = "no" ; then + no_gtkmm=yes + else + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + GTKMM_CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags` + GTKMM_LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs` + gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gtkmmtest" = "xyes" ; then + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS" + LIBS="$LIBS $GTKMM_LIBS" +dnl +dnl Now check if the installed GTK-- is sufficiently new. (Also sanity +dnl checks the results of gtkmm-config to some extent +dnl + rm -f conf.gtkmmtest + AC_TRY_RUN([ +#include +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gtkmmtest"); + + /* HP/UX 0 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtkmm_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtkmm_version"); + exit(1); + } + + if ((gtkmm_major_version != $gtkmm_config_major_version) || + (gtkmm_minor_version != $gtkmm_config_minor_version) || + (gtkmm_micro_version != $gtkmm_config_micro_version)) + { + printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", + $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version, + gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); + printf ("*** was found! If gtkmm-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n"); + printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } +/* GTK-- does not have the GTKMM_*_VERSION constants */ +/* + else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) || + (gtkmm_minor_version != GTKMM_MINOR_VERSION) || + (gtkmm_micro_version != GTKMM_MICRO_VERSION)) + { + printf("*** GTK-- header files (version %d.%d.%d) do not match\n", + GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); + } +*/ + else + { + if ((gtkmm_major_version > major) || + ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) || + ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n", + gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); + printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n"); + printf("*** correct copy of gtkmm-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtkmm" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GTKMM_CONFIG" = "no" ; then + echo "*** The gtkmm-config script installed by GTK-- could not be found" + echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTKMM_CONFIG environment variable to the" + echo "*** full path to gtkmm-config." + echo "*** The gtkmm-config script was not available in GTK-- versions" + echo "*** prior to 0.9.12. Perhaps you need to update your installed" + echo "*** version to 0.9.12 or later" + else + if test -f conf.gtkmmtest ; then + : + else + echo "*** Could not run GTK-- test program, checking why..." + CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS" + LIBS="$LIBS $GTKMM_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK-- or finding the wrong" + echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK-- was incorrectly installed" + echo "*** or that you have moved GTK-- since it was installed. In the latter case, you" + echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ]) + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTKMM_CFLAGS="" + GTKMM_LIBS="" + ifelse([$3], , :, [$3]) + AC_LANG_RESTORE + fi + AC_SUBST(GTKMM_CFLAGS) + AC_SUBST(GTKMM_LIBS) + rm -f conf.gtkmmtest +]) + +# Configure paths for GNOME-- +# Modified from GTK--.m4 + +dnl Test for GNOMEMM, and define GNOMEMM_INCLUDEDIR, GNOMEMM_LIBDIR, GNOMEMM_LIBS +dnl to be used as follows: +dnl AM_PATH_GNOMEMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl +AC_DEFUN(AM_PATH_GNOMEMM, +[ +dnl +dnl Get the cflags and libraries from the gtkmm-config script +dnl +AC_ARG_WITH(gnomemm-config-path,[ --with-gnomemm-config-path=PREFIX + Path to GNOME-- configuration file gnomemmConf.sh (optional)], + gnomemm_config_prefix="$withval", gnome_config_prefix="") + + AC_MSG_CHECKING(for GNOME-- gnomemmConf.sh) + + if test x$gnomemm_config_prefix != x; then + if test -r $gnomemm_config_prefix; then + source $gnomemm_config_prefix + else + no_gnomemm=yes + fi + else + if test -r /usr/lib/gnomemmConf.sh ; then + source /usr/lib/gnomemmConf.sh + elif test -r /opt/gnome/lib/gnomemmConf.sh ; then + source /opt/gnome/lib/gnomemmConf.sh + elif test -r /usr/local/lib/gnomemmConf.sh ; then + source /usr/local/lib/gnomemmConf.sh + else + no_gnomemm=yes + fi + fi + + if test "x$no_gnomemm" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Cannot find GNOME-- configuration file gnomemmConf.sh) + fi + + AC_SUBST(GNOMEMM_INCLUDEDIR) + AC_SUBST(GNOMEMM_LIBDIR) + AC_SUBST(GNOMEMM_LIBS) +]) + diff --git a/autogen.sh b/autogen.sh index efce8d6b60..a55167fac0 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,7 +24,7 @@ fi echo -n "Generate acinclude.m4... " rm -f acinclude.m4 sigc++/acinclude.m4 touch acinclude.m4 -for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 config/sigc++.m4 config/kde.m4; do +for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 config/sigc++.m4 config/kde.m4 config/gnome/aclocal-include.m4 config/gnome/gnome-print-check.m4 config/gnome/compiler-flags.m4 config/gnome/gnome-pthread-check.m4 config/gnome/curses.m4 config/gnome/gnome-support.m4 config/gnome/gnome-bonobo-check.m4 config/gnome/gnome-undelfs.m4 config/gnome/gnome-common.m4 config/gnome/gnome-vfs.m4 config/gnome/gnome-fileutils.m4 config/gnome/gnome-x-checks.m4 config/gnome/gnome-ghttp-check.m4 config/gnome/gnome-xml-check.m4 config/gnome/gnome-gnorba-check.m4 config/gnome/gnome.m4 config/gnome/gnome-guile-checks.m4 config/gnome/gperf-check.m4 config/gnome/gnome-libgtop-check.m4 config/gnome/linger.m4 config/gnome/gnome-objc-checks.m4 config/gnome/need-declaration.m4 config/gnome/gnome-orbit-check.m4 config/gnome/gtk--.m4 config/gnome/gnome--.m4 ; do cat $fil >> acinclude.m4 done touch sigc++/acinclude.m4 diff --git a/config/gnome/aclocal-include.m4 b/config/gnome/aclocal-include.m4 new file mode 100644 index 0000000000..abf6533fe4 --- /dev/null +++ b/config/gnome/aclocal-include.m4 @@ -0,0 +1,16 @@ +# aclocal-include.m4 +# +# This macro adds the name macrodir to the set of directories +# that `aclocal' searches for macros. + +# serial 1 + +dnl AM_ACLOCAL_INCLUDE(macrodir) +AC_DEFUN([AM_ACLOCAL_INCLUDE], +[ + AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y) + + test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done +]) diff --git a/config/gnome/compiler-flags.m4 b/config/gnome/compiler-flags.m4 new file mode 100644 index 0000000000..63f8e2e6ac --- /dev/null +++ b/config/gnome/compiler-flags.m4 @@ -0,0 +1,109 @@ +dnl GNOME_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([GNOME_COMPILE_WARNINGS],[ + AC_ARG_ENABLE(compile-warnings, + [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + if test "x$enable_compile_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCFLAGS="-Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compile_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations" + fi + fi + fi + AC_MSG_RESULT($warnCFLAGS) + + AC_ARG_ENABLE(iso-c, + [ --enable-iso-c Try to warn if code is not ISO C ],, + enable_iso_c=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCFLAGS) + if test "x$cflags_set" != "xyes"; then + CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" + cflags_set=yes + AC_SUBST(cflags_set) + fi +]) + +dnl For C++, do basically the same thing. + +AC_DEFUN([GNOME_CXX_WARNINGS],[ + AC_ARG_ENABLE(cxx-warnings, + [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C++ compiler) + warnCXXFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + if test "x$enable_cxx_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCXXFLAGS="-Wall -Wno-unused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_cxx_warnings" = "xyes"; then + warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual" + fi + fi + fi + AC_MSG_RESULT($warnCXXFLAGS) + + AC_ARG_ENABLE(iso-cxx, + [ --enable-iso-cxx Try to warn if code is not ISO C++ ],, + enable_iso_cxx=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler) + complCXXFLAGS= + if test "x$enable_iso_cxx" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -ansi" ;; + esac + + case " $CXXFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCXXFLAGS) + if test "x$cxxflags_set" != "xyes"; then + CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" + cxxflags_set=yes + AC_SUBST(cxxflags_set) + fi +]) diff --git a/config/gnome/curses.m4 b/config/gnome/curses.m4 new file mode 100644 index 0000000000..3dd4ffaa4c --- /dev/null +++ b/config/gnome/curses.m4 @@ -0,0 +1,318 @@ +dnl Curses detection: Munged from Midnight Commander's configure.in +dnl +dnl What it does: +dnl ============= +dnl +dnl - Determine which version of curses is installed on your system +dnl and set the -I/-L/-l compiler entries and add a few preprocessor +dnl symbols +dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that +dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in +dnl Makefile.in's +dnl - Modify the following configure variables (these are the only +dnl curses.m4 variables you can access from within configure.in) +dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if +dnl an ncurses.h that's been renamed to curses.h +dnl is found. +dnl CURSES_LIBS - sets -L and -l's appropriately +dnl CFLAGS - if --with-sco, add -D_SVID3 +dnl has_curses - exports result of tests to rest of configure +dnl +dnl Usage: +dnl ====== +dnl 1) Add lines indicated below to acconfig.h +dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in +dnl 3) Instead of #include you should use the following to +dnl properly locate ncurses or curses header file +dnl +dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +dnl #include +dnl #else +dnl #include +dnl #endif +dnl +dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags +dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS +dnl +dnl Notes with automake: +dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from +dnl configure.in +dnl - your Makefile.am can look something like this +dnl ----------------------------------------------- +dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR) +dnl if HAS_CURSES +dnl CURSES_TARGETS=name_of_curses_prog +dnl endif +dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS) +dnl other_programs_SOURCES = blah blah blah +dnl name_of_curses_prog_SOURCES = blah blah blah +dnl other_programs_LDADD = blah +dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS) +dnl ----------------------------------------------- +dnl +dnl +dnl The following lines should be added to acconfig.h: +dnl ================================================== +dnl +dnl /*=== Curses version detection defines ===*/ +dnl /* Found some version of curses that we're going to use */ +dnl #undef HAS_CURSES +dnl +dnl /* Use SunOS SysV curses? */ +dnl #undef USE_SUNOS_CURSES +dnl +dnl /* Use old BSD curses - not used right now */ +dnl #undef USE_BSD_CURSES +dnl +dnl /* Use SystemV curses? */ +dnl #undef USE_SYSV_CURSES +dnl +dnl /* Use Ncurses? */ +dnl #undef USE_NCURSES +dnl +dnl /* If you Curses does not have color define this one */ +dnl #undef NO_COLOR_CURSES +dnl +dnl /* Define if you want to turn on SCO-specific code */ +dnl #undef SCO_FLAVOR +dnl +dnl /* Set to reflect version of ncurses * +dnl * 0 = version 1.* +dnl * 1 = version 1.9.9g +dnl * 2 = version 4.0/4.1 */ +dnl #undef NCURSES_970530 +dnl +dnl /*=== End new stuff for acconfig.h ===*/ +dnl + + +AC_DEFUN(AC_CHECK_CURSES,[ + search_ncurses=true + screen_manager="" + has_curses=false + + CFLAGS=${CFLAGS--O} + + AC_SUBST(CURSES_LIBS) + AC_SUBST(CURSES_INCLUDEDIR) + + AC_ARG_WITH(sco, + [ --with-sco Use this to turn on SCO-specific code],[ + if test x$withval = xyes; then + AC_DEFINE(SCO_FLAVOR) + CFLAGS="$CFLAGS -D_SVID3" + fi + ]) + + AC_ARG_WITH(sunos-curses, + [ --with-sunos-curses Used to force SunOS 4.x curses],[ + if test x$withval = xyes; then + AC_USE_SUNOS_CURSES + fi + ]) + + AC_ARG_WITH(osf1-curses, + [ --with-osf1-curses Used to force OSF/1 curses],[ + if test x$withval = xyes; then + AC_USE_OSF1_CURSES + fi + ]) + + AC_ARG_WITH(vcurses, + [ --with-vcurses[=incdir] Used to force SysV curses], + if test x$withval != xyes; then + CURSES_INCLUDEDIR="-I$withval" + fi + AC_USE_SYSV_CURSES + ) + + AC_ARG_WITH(ncurses, + [ --with-ncurses[=dir] Compile with ncurses/locate base dir], + if test x$withval = xno ; then + search_ncurses=false + elif test x$withval != xyes ; then + CURSES_LIBS="$LIBS -L$withval/lib -lncurses" + CURSES_INCLUDEDIR="-I$withval/include" + search_ncurses=false + screen_manager="ncurses" + AC_DEFINE(USE_NCURSES) + AC_DEFINE(HAS_CURSES) + has_curses=true + fi + ) + + if $search_ncurses + then + AC_SEARCH_NCURSES() + fi + + +]) + + +AC_DEFUN(AC_USE_SUNOS_CURSES, [ + search_ncurses=false + screen_manager="SunOS 4.x /usr/5include curses" + AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses) + AC_DEFINE(USE_SUNOS_CURSES) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES) + AC_DEFINE(USE_SYSV_CURSES) + CURSES_INCLUDEDIR="-I/usr/5include" + CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a" + AC_MSG_RESULT(Please note that some screen refreshs may fail) +]) + +AC_DEFUN(AC_USE_OSF1_CURSES, [ + AC_MSG_RESULT(Using OSF1 curses) + search_ncurses=false + screen_manager="OSF1 curses" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES) + AC_DEFINE(USE_SYSV_CURSES) + CURSES_LIBS="-lcurses" +]) + +AC_DEFUN(AC_USE_SYSV_CURSES, [ + AC_MSG_RESULT(Using SysV curses) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_SYSV_CURSES) + search_ncurses=false + screen_manager="SysV/curses" + CURSES_LIBS="-lcurses" +]) + +dnl AC_ARG_WITH(bsd-curses, +dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy], +dnl search_ncurses=false +dnl screen_manager="Ultrix/cursesX" +dnl if test $system = ULTRIX +dnl then +dnl THIS_CURSES=cursesX +dnl else +dnl THIS_CURSES=curses +dnl fi +dnl +dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap" +dnl AC_DEFINE(HAS_CURSES) +dnl has_curses=true +dnl AC_DEFINE(USE_BSD_CURSES) +dnl AC_MSG_RESULT(Please note that some screen refreshs may fail) +dnl AC_WARN(Use of the bsdcurses extension has some) +dnl AC_WARN(display/input problems.) +dnl AC_WARN(Reconsider using xcurses) +dnl) + + +dnl +dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename +dnl +AC_DEFUN(AC_NCURSES, [ + if $search_ncurses + then + if test -f $1/$2 + then + AC_MSG_RESULT(Found ncurses on $1/$2) + CURSES_LIBS="$3" + CURSES_INCLUDEDIR="$4" + search_ncurses=false + screen_manager=$5 + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + fi + fi +]) + +AC_DEFUN(AC_SEARCH_NCURSES, [ + AC_CHECKING("location of ncurses.h file") + + AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include") + AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses") + AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local") + 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") + + 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") + + AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses") + + dnl + dnl We couldn't find ncurses, try SysV curses + dnl + if $search_ncurses + then + AC_EGREP_HEADER(init_color, /usr/include/curses.h, + AC_USE_SYSV_CURSES) + AC_EGREP_CPP(USE_NCURSES,[ +#include +#ifdef __NCURSES_H +#undef USE_NCURSES +USE_NCURSES +#endif +],[ + CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + search_ncurses=false + screen_manager="ncurses installed as curses" +]) + fi + + dnl + dnl Try SunOS 4.x /usr/5{lib,include} ncurses + dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES + dnl should be replaced by a more fine grained selection routine + dnl + if $search_ncurses + then + if test -f /usr/5include/curses.h + then + AC_USE_SUNOS_CURSES + fi + else + # check for ncurses version, to properly ifdef mouse-fix + AC_MSG_CHECKING(for ncurses version) + ncurses_version=unknown +cat > conftest.$ac_ext < +#else +#include +#endif +#undef VERSION +VERSION:NCURSES_VERSION +EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | + egrep "VERSION:" >conftest.out 2>&1; then +changequote(,)dnl + ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'` +changequote([,])dnl + fi + rm -rf conftest* + AC_MSG_RESULT($ncurses_version) + case "$ncurses_version" in +changequote(,)dnl + 4.[01]) +changequote([,])dnl + AC_DEFINE(NCURSES_970530,2) + ;; + 1.9.9g) + AC_DEFINE(NCURSES_970530,1) + ;; + 1*) + AC_DEFINE(NCURSES_970530,0) + ;; + esac + fi +]) + + + + + diff --git a/config/gnome/gnome--.m4 b/config/gnome/gnome--.m4 new file mode 100644 index 0000000000..9e13a24fe5 --- /dev/null +++ b/config/gnome/gnome--.m4 @@ -0,0 +1,49 @@ +# Configure paths for GNOME-- +# Modified from GTK--.m4 + +dnl Test for GNOMEMM, and define GNOMEMM_INCLUDEDIR, GNOMEMM_LIBDIR, GNOMEMM_LIBS +dnl to be used as follows: +dnl AM_PATH_GNOMEMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl +AC_DEFUN(AM_PATH_GNOMEMM, +[ +dnl +dnl Get the cflags and libraries from the gtkmm-config script +dnl +AC_ARG_WITH(gnomemm-config-path,[ --with-gnomemm-config-path=PREFIX + Path to GNOME-- configuration file gnomemmConf.sh (optional)], + gnomemm_config_prefix="$withval", gnome_config_prefix="") + + AC_MSG_CHECKING(for GNOME-- gnomemmConf.sh) + + if test x$gnomemm_config_prefix != x; then + if test -r $gnomemm_config_prefix; then + source $gnomemm_config_prefix + else + no_gnomemm=yes + fi + else + if test -r /usr/lib/gnomemmConf.sh ; then + source /usr/lib/gnomemmConf.sh + elif test -r /opt/gnome/lib/gnomemmConf.sh ; then + source /opt/gnome/lib/gnomemmConf.sh + elif test -r /usr/local/lib/gnomemmConf.sh ; then + source /usr/local/lib/gnomemmConf.sh + else + no_gnomemm=yes + fi + fi + + if test "x$no_gnomemm" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Cannot find GNOME-- configuration file gnomemmConf.sh) + fi + + AC_SUBST(GNOMEMM_INCLUDEDIR) + AC_SUBST(GNOMEMM_LIBDIR) + AC_SUBST(GNOMEMM_LIBS) +]) + diff --git a/config/gnome/gnome-bonobo-check.m4 b/config/gnome/gnome-bonobo-check.m4 new file mode 100644 index 0000000000..7eb2b2653d --- /dev/null +++ b/config/gnome/gnome-bonobo-check.m4 @@ -0,0 +1,150 @@ +# Configure paths for Bonobo +# Miguel de Icaza, 99-04-12 +# Stolen from Chris Lahey 99-2-5 +# stolen from Manish Singh again +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_BONOBO ([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for Bonobo, and define BONOBO_CFLAGS and BONOBO_LIBS +dnl +AC_DEFUN([AM_PATH_BONOBO], +[ +dnl +dnl Get the cflags and libraries from the gnome-config script +dnl +AC_ARG_WITH(bonobo-prefix,[ --with-bonobo-prefix=PFX Prefix where Bonobo is installed (optional)], + bonobo_prefix="$withval", bonobo_prefix="") +AC_ARG_WITH(bonobo-exec-prefix,[ --with-bonobo-exec-prefix=PFX Exec prefix where Bonobo is installed (optional)], + bonobo_exec_prefix="$withval", bonobo_exec_prefix="") +AC_ARG_ENABLE(bonobotest, [ --disable-bonobotest Do not try to compile and run a test Bonobo program], + , enable_bonobotest=yes) + + if test x$bonobo_exec_prefix != x ; then + bonobo_args="$bonobo_args --exec-prefix=$bonobo_exec_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$bonobo_exec_prefix/bin/gnome-config + fi + fi + if test x$bonobo_prefix != x ; then + bonobo_args="$bonobo_args --prefix=$bonobo_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$bonobo_prefix/bin/gnome-config + fi + fi + + AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) + min_bonobo_version=ifelse([$1], ,0.1.0,$1) + AC_MSG_CHECKING(for BONOBO - version >= $min_bonobo_version) + no_bonobo="" + if test "$GNOME_CONFIG" = "no" ; then + no_bonobo=yes + else + BONOBO_CFLAGS=`$GNOME_CONFIG $bonoboconf_args --cflags bonobo` + BONOBO_LIBS=`$GNOME_CONFIG $bonoboconf_args --libs bonobo` + + bonobo_major_version=`$GNOME_CONFIG $bonobo_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + bonobo_minor_version=`$GNOME_CONFIG $bonobo_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + bonobo_micro_version=`$GNOME_CONFIG $bonobo_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_bonobotest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $BONOBO_CFLAGS" + LIBS="$LIBS $BONOBO_LIBS" +dnl +dnl Now check if the installed BONOBO is sufficiently new. (Also sanity +dnl checks the results of gnome-config to some extent +dnl + rm -f conf.bonobotest + AC_TRY_RUN([ +#include +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.bonobotest"); + bonobo_object_get_type (); + return 0; +} + +],, no_bonobo=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_bonobo" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GNOME_CONFIG" = "no" ; then + echo "*** The gnome-config script installed by GNOME-LIBS could not be found" + echo "*** If BONOBO was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GNOME_CONFIG environment variable to the" + echo "*** full path to gnome-config." + else + if test -f conf.bonobotest ; then + : + else + echo "*** Could not run BONOBO test program, checking why..." + CFLAGS="$CFLAGS $BONOBO_CFLAGS" + LIBS="$LIBS $BONOBO_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding BONOBO or finding the wrong" + echo "*** version of BONOBO. If it is not finding BONOBO, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means BONOBO was incorrectly installed" + echo "*** or that you have moved BONOBO since it was installed. In the latter case, you" + echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + BONOBO_CFLAGS="" + BONOBO_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(BONOBO_CFLAGS) + AC_SUBST(BONOBO_LIBS) + rm -f conf.bonobotest +]) + +AC_DEFUN([BONOBO_CHECK], [ + AM_PATH_BONOBO(0.1.0,,[AC_MSG_ERROR(BONOBO not found)]) +]) + diff --git a/config/gnome/gnome-common.m4 b/config/gnome/gnome-common.m4 new file mode 100644 index 0000000000..b72382970b --- /dev/null +++ b/config/gnome/gnome-common.m4 @@ -0,0 +1,14 @@ +# gnome-common.m4 +# +# This only for packages that are not in the GNOME CVS tree. + +dnl GNOME_COMMON_INIT + +AC_DEFUN([GNOME_COMMON_INIT], +[ + GNOME_ACLOCAL_DIR=`$ACLOCAL --print-ac-dir`/gnome + AC_SUBST(GNOME_ACLOCAL_DIR) + + ACLOCAL="$ACLOCAL -I $GNOME_ACLOCAL_DIR" +]) + diff --git a/config/gnome/gnome-fileutils.m4 b/config/gnome/gnome-fileutils.m4 new file mode 100644 index 0000000000..7c11a785aa --- /dev/null +++ b/config/gnome/gnome-fileutils.m4 @@ -0,0 +1,414 @@ +dnl +dnl GNOME_FILEUTILS_CHECKS +dnl +dnl checks that are needed for the diskusage applet. +dnl + +AC_DEFUN([GNOME_FILEUTILS_CHECKS], +[ +AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \ +mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \ +sys/filsys.h sys/fs_types.h sys/fs/s5param.h) + +AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \ +getcwd getmntinfo gettimeofday isascii lchown \ +listmntent memcpy mkfifo strchr strerror strrchr vprintf) + +dnl Set some defaults when cross-compiling + +if test x$cross_compiling = xyes ; then + case "$host_os" in + linux*) + fu_cv_sys_mounted_getmntent1=yes + fu_cv_sys_stat_statfs2_bsize=yes + ;; + sunos*) + fu_cv_sys_stat_statfs4=yes + ;; + freebsd*) + fu_cv_sys_stat_statfs2_bsize=yes + ;; + osf*) + fu_cv_sys_stat_statfs3_osf1=yes + ;; + esac +fi + +# Determine how to get the list of mounted filesystems. +list_mounted_fs= + +# If the getmntent function is available but not in the standard library, +# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX). +AC_FUNC_GETMNTENT + +# This test must precede the ones for getmntent because Unicos-9 is +# reported to have the getmntent function, but its support is incompatible +# with other getmntent implementations. + +# NOTE: Normally, I wouldn't use a check for system type as I've done for +# `CRAY' below since that goes against the whole autoconf philosophy. But +# I think there is too great a chance that some non-Cray system has a +# function named listmntent to risk the false positive. + +if test -z "$list_mounted_fs"; then +# Cray UNICOS 9 +AC_MSG_CHECKING([for listmntent of Cray/Unicos-9]) +AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent, +[fu_cv_sys_mounted_cray_listmntent=no +AC_EGREP_CPP(yes, +[#ifdef _CRAY +yes +#endif +], [test $ac_cv_func_listmntent = yes \ +&& fu_cv_sys_mounted_cray_listmntent=yes] +) +] +) +AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent) +if test $fu_cv_sys_mounted_cray_listmntent = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_LISTMNTENT) +fi +fi + +if test $ac_cv_func_getmntent = yes; then + +# This system has the getmntent function. +# Determine whether it's the one-argument variant or the two-argument one. + +if test -z "$list_mounted_fs"; then +# 4.3BSD, SunOS, HP-UX, Dynix, Irix +AC_MSG_CHECKING([for one-argument getmntent function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1, +[test $ac_cv_header_mntent_h = yes \ +&& fu_cv_sys_mounted_getmntent1=yes \ +|| fu_cv_sys_mounted_getmntent1=no]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1) +if test $fu_cv_sys_mounted_getmntent1 = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTENT1) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR4 +AC_MSG_CHECKING([for two-argument getmntent function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2, +[AC_EGREP_HEADER(getmntent, sys/mnttab.h, +fu_cv_sys_mounted_getmntent2=yes, +fu_cv_sys_mounted_getmntent2=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2) +if test $fu_cv_sys_mounted_getmntent2 = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTENT2) +fi +fi + +if test -z "$list_mounted_fs"; then +AC_MSG_ERROR([could not determine how to read list of mounted filesystems]) +fi + +fi + +if test -z "$list_mounted_fs"; then +# DEC Alpha running OSF/1. +AC_MSG_CHECKING([for getfsstat function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getsstat, +[AC_TRY_LINK([ +#include +#include +#include ], +[struct statfs *stats; +int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ], +fu_cv_sys_mounted_getsstat=yes, +fu_cv_sys_mounted_getsstat=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getsstat) +if test $fu_cv_sys_mounted_getsstat = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETFSSTAT) +fi +fi + +if test -z "$list_mounted_fs"; then +# AIX. +AC_MSG_CHECKING([for mntctl function and struct vmount]) +AC_CACHE_VAL(fu_cv_sys_mounted_vmount, +[AC_TRY_CPP([#include ], +fu_cv_sys_mounted_vmount=yes, +fu_cv_sys_mounted_vmount=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_vmount) +if test $fu_cv_sys_mounted_vmount = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_VMOUNT) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR3 +AC_MSG_CHECKING([for FIXME existence of three headers]) +AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp, +[AC_TRY_CPP([ +#include +#include +#include ], +fu_cv_sys_mounted_fread_fstyp=yes, +fu_cv_sys_mounted_fread_fstyp=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp) +if test $fu_cv_sys_mounted_fread_fstyp = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_FREAD_FSTYP) +fi +fi + +if test -z "$list_mounted_fs"; then +# 4.4BSD and DEC OSF/1. +AC_MSG_CHECKING([for getmntinfo function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo, +[ +ok= +if test $ac_cv_func_getmntinfo = yes; then +AC_EGREP_HEADER(f_type;, sys/mount.h, +ok=yes) +fi +test -n "$ok" \ +&& fu_cv_sys_mounted_getmntinfo=yes \ +|| fu_cv_sys_mounted_getmntinfo=no +]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo) +if test $fu_cv_sys_mounted_getmntinfo = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTINFO) +fi +fi + +# FIXME: add a test for netbsd-1.1 here + +if test -z "$list_mounted_fs"; then +# Ultrix +AC_MSG_CHECKING([for getmnt function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmnt, +[AC_TRY_CPP([ +#include +#include ], +fu_cv_sys_mounted_getmnt=yes, +fu_cv_sys_mounted_getmnt=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmnt) +if test $fu_cv_sys_mounted_getmnt = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNT) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR2 +AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab]) +AC_CACHE_VAL(fu_cv_sys_mounted_fread, +[AC_TRY_CPP([#include ], +fu_cv_sys_mounted_fread=yes, +fu_cv_sys_mounted_fread=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_fread) +if test $fu_cv_sys_mounted_fread = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_FREAD) +fi +fi + +if test -z "$list_mounted_fs"; then +AC_MSG_ERROR([could not determine how to read list of mounted filesystems]) +# FIXME -- no need to abort building the whole package +# Can't build mountlist.c or anything that needs its functions +fi + +AC_CHECKING(how to get filesystem space usage) +space=no + +# Perform only the link test since it seems there are no variants of the +# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs) +# because that got a false positive on SCO OSR5. Adding the declaration +# of a `struct statvfs' causes this test to fail (as it should) on such +# systems. That system is reported to work fine with STAT_STATFS4 which +# is what it gets when this test fails. +if test $space = no; then +# SVR4 +AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs, +[AC_TRY_LINK([#include +#include ], +[struct statvfs fsd; statvfs (0, &fsd);], +fu_cv_sys_stat_statvfs=yes, +fu_cv_sys_stat_statvfs=no)]) +if test $fu_cv_sys_stat_statvfs = yes; then +space=yes +AC_DEFINE(STAT_STATVFS) +fi +fi + +if test $space = no; then +# DEC Alpha running OSF/1 +AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1, +[AC_TRY_RUN([ +#include +#include +#include +main () +{ +struct statfs fsd; +fsd.f_fsize = 0; +exit (statfs (".", &fsd, sizeof (struct statfs))); +}], +fu_cv_sys_stat_statfs3_osf1=yes, +fu_cv_sys_stat_statfs3_osf1=no, +fu_cv_sys_stat_statfs3_osf1=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1) +if test $fu_cv_sys_stat_statfs3_osf1 = yes; then +space=yes +AC_DEFINE(STAT_STATFS3_OSF1) +fi +fi + +if test $space = no; then +# AIX +AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl +member (AIX, 4.3BSD)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize, +[AC_TRY_RUN([ +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif +main () +{ +struct statfs fsd; +fsd.f_bsize = 0; +exit (statfs (".", &fsd)); +}], +fu_cv_sys_stat_statfs2_bsize=yes, +fu_cv_sys_stat_statfs2_bsize=no, +fu_cv_sys_stat_statfs2_bsize=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize) +if test $fu_cv_sys_stat_statfs2_bsize = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_BSIZE) +fi +fi + +if test $space = no; then +# SVR3 +AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs4, +[AC_TRY_RUN([#include +#include +main () +{ +struct statfs fsd; +exit (statfs (".", &fsd, sizeof fsd, 0)); +}], +fu_cv_sys_stat_statfs4=yes, +fu_cv_sys_stat_statfs4=no, +fu_cv_sys_stat_statfs4=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs4) +if test $fu_cv_sys_stat_statfs4 = yes; then +space=yes +AC_DEFINE(STAT_STATFS4) +fi +fi + +if test $space = no; then +# 4.4BSD and NetBSD +AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl +member (4.4BSD and NetBSD)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize, +[AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +main () +{ +struct statfs fsd; +fsd.f_fsize = 0; +exit (statfs (".", &fsd)); +}], +fu_cv_sys_stat_statfs2_fsize=yes, +fu_cv_sys_stat_statfs2_fsize=no, +fu_cv_sys_stat_statfs2_fsize=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize) +if test $fu_cv_sys_stat_statfs2_fsize = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_FSIZE) +fi +fi + +if test $space = no; then +# Ultrix +AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) +AC_CACHE_VAL(fu_cv_sys_stat_fs_data, +[AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_FS_TYPES_H +#include +#endif +main () +{ +struct fs_data fsd; +/* Ultrix's statfs returns 1 for success, +0 for not mounted, -1 for failure. */ +exit (statfs (".", &fsd) != 1); +}], +fu_cv_sys_stat_fs_data=yes, +fu_cv_sys_stat_fs_data=no, +fu_cv_sys_stat_fs_data=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_fs_data) +if test $fu_cv_sys_stat_fs_data = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_FS_DATA) +fi +fi + +if test $space = no; then +# SVR2 +AC_TRY_CPP([#include ], +AC_DEFINE(STAT_READ_FILSYS) space=yes) +fi + +if test -n "$list_mounted_fs" && test $space != no; then +DF_PROG="df" +# LIBOBJS="$LIBOBJS fsusage.o" +# LIBOBJS="$LIBOBJS mountlist.o" +fi + +# Check for SunOS statfs brokenness wrt partitions 2GB and larger. +# If exists and struct statfs has a member named f_spare, +# enable the work-around code in fsusage.c. +AC_MSG_CHECKING([for statfs that truncates block counts]) +AC_CACHE_VAL(fu_cv_sys_truncating_statfs, +[AC_TRY_COMPILE([ +#if !defined(sun) && !defined(__sun) +choke -- this is a workaround for a Sun-specific problem +#endif +#include +#include ], +[struct statfs t; long c = *(t.f_spare);], +fu_cv_sys_truncating_statfs=yes, +fu_cv_sys_truncating_statfs=no, +)]) +if test $fu_cv_sys_truncating_statfs = yes; then +AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS) +fi +AC_MSG_RESULT($fu_cv_sys_truncating_statfs) + +AC_CHECKING(for AFS) +test -d /afs && AC_DEFINE(AFS) +]) diff --git a/config/gnome/gnome-ghttp-check.m4 b/config/gnome/gnome-ghttp-check.m4 new file mode 100644 index 0000000000..0ecacaaf05 --- /dev/null +++ b/config/gnome/gnome-ghttp-check.m4 @@ -0,0 +1,14 @@ +AC_DEFUN([GNOME_GHTTP_CHECK],[ + AC_REQUIRE([GNOME_INIT_HOOK]) + GHTTP_LIB= + AC_CHECK_FUNC(connect,,[ + AC_CHECK_LIB(socket,connect, + GHTTP_LIB="-lsocket $GHTTP_LIB",,$GHTTP_LIB)]) + AC_CHECK_FUNC(gethostbyname,,[ + AC_CHECK_LIB(nsl,gethostbyname, + GHTTP_LIB="-lnsl $GHTTP_LIB",,$GHTTP_LIB)]) + AC_CHECK_LIB(ghttp, ghttp_request_new, + GHTTP_LIB="-lghttp $GHTTP_LIB",GHTTP_LIB="",-L$gnome_prefix $GHTTP_LIB) + AC_SUBST(GHTTP_LIB) + AC_PROVIDE([GNOME_GHTTP_CHECK]) +]) diff --git a/config/gnome/gnome-gnorba-check.m4 b/config/gnome/gnome-gnorba-check.m4 new file mode 100644 index 0000000000..dbac0a6cf7 --- /dev/null +++ b/config/gnome/gnome-gnorba-check.m4 @@ -0,0 +1,35 @@ +dnl +dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag) +dnl +dnl if failflag is "failure" it aborts if gnorba is not found. +dnl + +AC_DEFUN([GNOME_GNORBA_HOOK],[ + GNOME_ORBIT_HOOK([],$2) + AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[ + gnome_cv_gnorba_found=no + if test x$gnome_cv_orbit_found = xyes; then + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + if test -n "$GNORBA_LIBS"; then + gnome_cv_gnorba_found=yes + fi + fi + ]) + AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + AC_SUBST(GNORBA_CFLAGS) + AC_SUBST(GNORBA_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(gnorba library not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_GNORBA_CHECK], [ + GNOME_GNORBA_HOOK([],failure) +]) diff --git a/config/gnome/gnome-guile-checks.m4 b/config/gnome/gnome-guile-checks.m4 new file mode 100644 index 0000000000..1086d30a4e --- /dev/null +++ b/config/gnome/gnome-guile-checks.m4 @@ -0,0 +1,119 @@ +dnl +dnl GNOME_CHECK_GUILE (failflag) +dnl +dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found. +dnl + +AC_DEFUN([GNOME_CHECK_GUILE], +[ + saved_ldflags="$LDFLAGS" + saved_cppflags="$CPPFLAGS" + LDFLAGS="$LDFLAGS $GNOME_LIBDIR" + + AC_CHECK_LIB(qthreads,qt_null,[ + QTTHREADS_LIB="-lqthreads" + ],[ + AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt") + ],$LIBS) + AC_SUBST(QTTHREADS_LIB) + + AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap") + AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB) + + AC_SUBST(TERMCAP_LIB) + AC_SUBST(READLINE_LIB) + + if test "x$cross_compiling" = "xyes" ; then + name_build_guile="$target_alias-guile-config" + else + name_build_guile="guile-config" + fi + + AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(whether $name_build_guile works) + if test x`$name_build_guile --version >/dev/null 2>&1 || \ + echo no` = xno; then + BUILD_GUILE=no + fi + AC_MSG_RESULT($BUILD_GUILE) + else + + if test "x$cross_compiling" = "xyes" ; then + name_build_guile="$target_alias-build-guile" + else + name_build_guile="build-guile" + fi + + AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(whether $name_build_guile works) + if test x`$name_build_guile --version >/dev/null 2>&1 || \ + echo no` = xno; then + BUILD_GUILE=no + fi + AC_MSG_RESULT($BUILD_GUILE) + fi + fi + + AC_CHECK_LIB(m, sin) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(for guile libraries) + GUILE_LIBS="`$name_build_guile link`" + AC_MSG_RESULT($GUILE_LIBS) + AC_MSG_CHECKING(for guile headers) + GUILE_INCS="`$name_build_guile compile`" + AC_MSG_RESULT($GUILE_INCS) + else + GUILE_LIBS="$GNOME_LIBDIR" + GUILE_INCS="$GNOME_INCLUDEDIR" + AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS") + AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS") + AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS") + AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl") + AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket") + GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB" + fi + + AC_SUBST(GUILE_LIBS) + AC_SUBST(GUILE_INCS) + + saved_LIBS="$LIBS" + LIBS="$LIBS $GUILE_LIBS" + CPPFLAGS="$saved_cppflags $GUILE_INCS" + + AC_MSG_CHECKING(whether guile works) + AC_TRY_LINK([ + #include + #include + ],[ + gh_eval_str("(newline)"); + scm_boot_guile(0,NULL,NULL,NULL); + ],[ + ac_cv_guile_found=yes + AC_DEFINE(HAVE_GUILE) + ],[ + ac_cv_guile_found=no + ]) + AC_MSG_RESULT($ac_cv_guile_found) + + if test x$ac_cv_guile_found = xno ; then + if test x$1 = xfail ; then + AC_MSG_ERROR(Can not find Guile on this system) + else + AC_MSG_WARN(Can not find Guile on this system) + fi + ac_cv_guile_found=no + GUILE_LIBS= GUILE_INCS= + fi + + LIBS="$saved_LIBS" + LDFLAGS="$saved_ldflags" + CPPFLAGS="$saved_cppflags" + + AC_SUBST(GUILE_LIBS) + AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes) +]) diff --git a/config/gnome/gnome-libgtop-check.m4 b/config/gnome/gnome-libgtop-check.m4 new file mode 100644 index 0000000000..0ce6f6f612 --- /dev/null +++ b/config/gnome/gnome-libgtop-check.m4 @@ -0,0 +1,217 @@ +dnl +dnl LIBGTOP_CHECK_TYPE +dnl +dnl Improved version of AC_CHECK_TYPE which takes into account +dnl that we need to #include some other header files on some +dnl systems to get some types. + +dnl AC_LIBGTOP_CHECK_TYPE(TYPE, DEFAULT) +AC_DEFUN(AC_LIBGTOP_CHECK_TYPE, +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(ac_cv_type_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [#include +#if STDC_HEADERS +#include +#include +#endif + +/* For Tru64 */ +#ifdef HAVE_SYS_BITYPES_H +#include +#endif +], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl +AC_MSG_RESULT($ac_cv_type_$1) +if test $ac_cv_type_$1 = no; then + AC_DEFINE($1, $2) +fi +]) + +dnl +dnl GNOME_LIBGTOP_TYPES +dnl +dnl some typechecks for libgtop. +dnl + +AC_DEFUN([GNOME_LIBGTOP_TYPES], +[ + AC_CHECK_HEADERS(sys/bitypes.h) + AC_LIBGTOP_CHECK_TYPE(u_int64_t, unsigned long long int) + AC_LIBGTOP_CHECK_TYPE(int64_t, signed long long int) +]) + +dnl +dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag) +dnl +dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop +dnl is not found. +dnl + +AC_DEFUN([GNOME_LIBGTOP_HOOK], +[ + AC_REQUIRE([GNOME_LIBGTOP_TYPES]) + + AC_SUBST(LIBGTOP_LIBDIR) + AC_SUBST(LIBGTOP_INCLUDEDIR) + AC_SUBST(LIBGTOP_EXTRA_LIBS) + AC_SUBST(LIBGTOP_LIBS) + AC_SUBST(LIBGTOP_INCS) + AC_SUBST(LIBGTOP_NAMES_LIBS) + AC_SUBST(LIBGTOP_NAMES_INCS) + AC_SUBST(LIBGTOP_MAJOR_VERSION) + AC_SUBST(LIBGTOP_MINOR_VERSION) + AC_SUBST(LIBGTOP_MICRO_VERSION) + AC_SUBST(LIBGTOP_VERSION) + AC_SUBST(LIBGTOP_VERSION_CODE) + AC_SUBST(LIBGTOP_SERVER_VERSION) + AC_SUBST(LIBGTOP_INTERFACE_AGE) + AC_SUBST(LIBGTOP_BINARY_AGE) + AC_SUBST(LIBGTOP_BINDIR) + AC_SUBST(LIBGTOP_SERVER) + + dnl Get the cflags and libraries from the libgtop-config script + dnl + AC_ARG_WITH(libgtop, + [ --with-libgtop=PFX Prefix where LIBGTOP is installed (optional)], + libgtop_config_prefix="$withval", libgtop_config_prefix="") + AC_ARG_WITH(libgtop-exec, + [ --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)], + libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="") + + if test x$libgtop_config_exec_prefix != x ; then + libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix" + if test x${LIBGTOP_CONFIG+set} != xset ; then + LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config + fi + fi + if test x$libgtop_config_prefix != x ; then + libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix" + if test x${LIBGTOP_CONFIG+set} != xset ; then + LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config + fi + fi + + AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no) + dnl IMPORTANT NOTICE: + dnl If you increase this number here, this means that *ALL* + dnl modules will require the new version, even if they explicitly + dnl give a lower number in their `configure.in' !!! + real_min_libgtop_version=1.0.0 + min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1) + dnl I know, the following code looks really ugly, but if you want + dnl to make changes, please test it with a brain-dead /bin/sh and + dnl with a brain-dead /bin/test (not all shells/tests support the + dnl `<' operator to compare strings, that's why I convert everything + dnl into numbers and test them). + min_libgtop_major=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + min_libgtop_minor=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + min_libgtop_micro=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + test x$min_libgtop_micro = x && min_libgtop_micro=0 + real_min_libgtop_major=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + real_min_libgtop_minor=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + real_min_libgtop_micro=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0 + dnl You cannot require a version less then $real_min_libgtop_version, + dnl so you don't need to update each `configure.in' when it's increased. + if test $real_min_libgtop_major -gt $min_libgtop_major ; then + min_libgtop_major=$real_min_libgtop_major + min_libgtop_minor=$real_min_libgtop_minor + min_libgtop_micro=$real_min_libgtop_micro + elif test $real_min_libgtop_major = $min_libgtop_major ; then + if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then + min_libgtop_minor=$real_min_libgtop_minor + min_libgtop_micro=$real_min_libgtop_micro + elif test $real_min_libgtop_minor = $min_libgtop_minor ; then + if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then + min_libgtop_micro=$real_min_libgtop_micro + fi + fi + fi + min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro" + AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version) + no_libgtop="" + if test "$LIBGTOP_CONFIG" = "no" ; then + no_libgtop=yes + else + configfile=`$LIBGTOP_CONFIG --config` + libgtop_major_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + libgtop_minor_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + libgtop_micro_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test $libgtop_major_version != $min_libgtop_major ; then + no_libgtop=mismatch + else + test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes + if test $libgtop_minor_version = $min_libgtop_minor ; then + test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes + fi + fi + . $configfile + fi + if test x$no_libgtop = x ; then + AC_DEFINE(HAVE_LIBGTOP) + AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION") + AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE) + AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION) + AC_MSG_RESULT(yes) + dnl Note that an empty true branch is not valid sh syntax. + ifelse([$2], [], :, [$2]) + else + AC_MSG_RESULT(no) + if test "$no_libgtop"x = mismatchx; then + AC_MSG_ERROR(LibGTop major version mismatch $libgtop_major_version != $min_libgtop_major) + fi + if test "x$3" = "xfail"; then + AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found) + else + AC_MSG_WARN(LibGTop >= $min_libgtop_version not found) + fi + fi + + AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes) +]) + +AC_DEFUN([GNOME_INIT_LIBGTOP],[ + GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2) +]) + +dnl +dnl GNOME_LIBGTOP_DOCU +dnl +dnl checks whether the documentation of LibGTop is installed +dnl + +AC_DEFUN([GNOME_LIBGTOP_DOCU], +[ + AC_REQUIRE([GNOME_LIBGTOP_HOOK]) + + helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop" + + AC_MSG_CHECKING(whether you have the LibGTop Documentation) + + if test -f "$helpdir/C/topic.dat" ; then + have_libgtop_docu=yes + AC_DEFINE(HAVE_LIBGTOP_DOCU) + else + have_libgtop_docu=no + fi + + AC_MSG_RESULT($have_libgtop_docu) + + AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes) +]) + diff --git a/config/gnome/gnome-objc-checks.m4 b/config/gnome/gnome-objc-checks.m4 new file mode 100644 index 0000000000..c69acb077e --- /dev/null +++ b/config/gnome/gnome-objc-checks.m4 @@ -0,0 +1,83 @@ +AC_DEFUN([GNOME_CHECK_OBJC], +[ +dnl Look for an ObjC compiler. +dnl FIXME: extend list of possible names of ObjC compilers. + AC_CHECK_PROGS(OBJC, $OBJC egcs, "") + if test "x$OBJC" = "x" ; then + AC_CHECK_PROGS(OBJC, $OBJC egcc, "") + if test "x$OBJC" = "x" ; then + AC_CHECK_PROGS(OBJC, $OBJC gcc, "") + fi + fi + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + + OBJC_LIBS="-lobjc $PTHREAD_LIB" + AC_CHECK_FUNC(sched_yield,,[ + AC_CHECK_LIB(rt,sched_yield, + OBJC_LIBS="$OBJC_LIBS -lrt",[ + AC_CHECK_LIB(posix4,sched_yield, + OBJC_LIBS="$OBJC_LIBS -lposix4",, + $OBJC_LIBS)], + $OBJC_LIBS)]) + AC_SUBST(OBJC_LIBS) + + AC_CACHE_CHECK([if Objective C compiler ($OBJC) works], + ac_cv_prog_objc_works, [ + if test -n "$OBJC"; then + cat > conftest.m < +@interface myRandomObj : Object +{ +} +@end +@implementation myRandomObj +@end +int main () { + /* No, you are not seeing double. Remember that square brackets + are the autoconf m4 quotes. */ + id myid = [[myRandomObj alloc]]; + [[myid free]]; + return 0; +} +EOF + + $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1 + result=$? + rm -f conftest* + + if test $result -eq 0; then + ac_cv_prog_objc_works=yes + fi + else + ac_cv_prog_objc_works=no + fi + ]) + + AM_CONDITIONAL(OBJECTIVE_C, test x$ac_cv_prog_objc_works = xyes) + dnl Also set the shell variable OBJECTIVE_C to "yes" or "no". + OBJECTIVE_C=$ac_cv_prog_objc_works +]) + +AC_DEFUN([GNOME_INIT_OBJC], +[ + AC_MSG_CHECKING(for an obGnomeConf.sh) + my_gnome_libdir=`$GNOME_CONFIG --libdir` + if test -f $my_gnome_libdir/obGnomeConf.sh; then + . $my_gnome_libdir/obGnomeConf.sh + AC_MSG_RESULT(found $my_gnome_libdir) + ac_cv_have_gnome_objc=yes + else + AC_MSG_RESULT(not found) + AC_MSG_WARN(Could not find the obGnomeConf.sh file that is generated by gnome-objc install) + ac_cv_have_gnome_objc=no + fi + + dnl Add a conditional on whether or not we have gnome-objc + AM_CONDITIONAL(HAVE_GNOME_OBJC, test x$ac_cv_have_gnome_objc = xyes) + HAVE_GNOME_OBJC=$ac_cv_have_gnome_objc + + AC_SUBST(OBGNOME_INCLUDEDIR) + AC_SUBST(OBGNOME_LIBS) + AC_SUBST(OBGTK_LIBS) +]) diff --git a/config/gnome/gnome-orbit-check.m4 b/config/gnome/gnome-orbit-check.m4 new file mode 100644 index 0000000000..54bf33aa4b --- /dev/null +++ b/config/gnome/gnome-orbit-check.m4 @@ -0,0 +1,33 @@ +dnl +dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag) +dnl +dnl if failflag is "failure" it aborts if orbit is not found. +dnl + +AC_DEFUN([GNOME_ORBIT_HOOK],[ + AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no) + AC_PATH_PROG(ORBIT_IDL,orbit-idl,no) + AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[ + if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then + gnome_cv_orbit_found=no + else + gnome_cv_orbit_found=yes + fi + ]) + AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + ORBIT_CFLAGS=`orbit-config --cflags client server` + ORBIT_LIBS=`orbit-config --use-service=name --libs client server` + AC_SUBST(ORBIT_CFLAGS) + AC_SUBST(ORBIT_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(ORBit not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_ORBIT_CHECK], [ + GNOME_ORBIT_HOOK([],failure) +]) diff --git a/config/gnome/gnome-print-check.m4 b/config/gnome/gnome-print-check.m4 new file mode 100644 index 0000000000..7d98281d9c --- /dev/null +++ b/config/gnome/gnome-print-check.m4 @@ -0,0 +1,171 @@ +# Configure paths for GNOME-PRINT +# Chris Lahey 99-2-5 +# stolen from Manish Singh again +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_GNOME_PRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GNOME-PRINT, and define GNOME_PRINT_CFLAGS and GNOME_PRINT_LIBS +dnl +AC_DEFUN(AM_PATH_GNOME_PRINT, +[dnl +dnl Get the cflags and libraries from the gnome-config script +dnl +AC_ARG_WITH(gnome-print-prefix,[ --with-gnome-print-prefix=PFX Prefix where GNOME-PRINT is installed (optional)], + gnome_print_prefix="$withval", gnome_print_prefix="") +AC_ARG_WITH(gnome-print-exec-prefix,[ --with-gnome-print-exec-prefix=PFX Exec prefix where GNOME-PRINT is installed (optional)], + gnome_print_exec_prefix="$withval", gnome_print_exec_prefix="") +AC_ARG_ENABLE(gnome-printtest, [ --disable-gnome-printtest Do not try to compile and run a test GNOME-PRINT program], + , enable_gnome_printtest=yes) + + if test x$gnome_print_exec_prefix != x ; then + gnome_print_args="$gnome_print_args --exec-prefix=$gnome_print_exec_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$gnome_print_exec_prefix/bin/gnome-config + fi + fi + if test x$gnome_print_prefix != x ; then + gnome_print_args="$gnome_print_args --prefix=$gnome_print_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$gnome_print_prefix/bin/gnome-config + fi + fi + + AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) + min_gnome_print_version=ifelse([$1], ,0.1.0,$1) + AC_MSG_CHECKING(for GNOME-PRINT - version >= $min_gnome_print_version) + no_gnome_print="" + if test "$GNOME_CONFIG" = "no" ; then + no_gnome_print=yes + else + GNOME_PRINT_CFLAGS=`$GNOME_CONFIG $gnome_printconf_args --cflags print` + GNOME_PRINT_LIBS=`$GNOME_CONFIG $gnome_printconf_args --libs print` + + gnome_print_major_version=`$GNOME_CONFIG $gnome_print_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gnome_print_minor_version=`$GNOME_CONFIG $gnome_print_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gnome_print_micro_version=`$GNOME_CONFIG $gnome_print_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gnome_printtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS" + LIBS="$LIBS $GNOME_PRINT_LIBS" +dnl +dnl Now check if the installed GNOME-PRINT is sufficiently new. (Also sanity +dnl checks the results of gnome-config to some extent +dnl + rm -f conf.gnome_printtest + AC_TRY_RUN([ +#include +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gnome_printtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_gnome_print_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gnome_print_version"); + exit(1); + } + return 0; +#if 0 + if (($gnome_print_major_version > major) || + (($gnome_print_major_version == major) && ($gnome_print_minor_version > minor)) || + (($gnome_print_major_version == major) && ($gnome_print_minor_version == minor) && ($gnome_print_micro_version >= micro))) + { + return 0; + } + else + { + 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); + printf("*** of GNOME-PRINT required is %d.%d.%d. If gnome-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If gnome-config was wrong, set the environment variable GNOME_CONFIG\n"); + printf("*** to point to the correct copy of gnome-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +#endif +} + +],, no_gnome_print=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gnome_print" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GNOME_CONFIG" = "no" ; then + echo "*** The gnome-config script installed by GNOME-LIBS could not be found" + echo "*** If GNOME-PRINT was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GNOME_CONFIG environment variable to the" + echo "*** full path to gnome-config." + else + if test -f conf.gnome_printtest ; then + : + else + echo "*** Could not run GNOME-PRINT test program, checking why..." + CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS" + LIBS="$LIBS $GNOME_PRINT_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GNOME-PRINT or finding the wrong" + echo "*** version of GNOME-PRINT. If it is not finding GNOME-PRINT, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GNOME-PRINT was incorrectly installed" + echo "*** or that you have moved GNOME-PRINT since it was installed. In the latter case, you" + echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GNOME_PRINT_CFLAGS="" + GNOME_PRINT_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GNOME_PRINT_CFLAGS) + AC_SUBST(GNOME_PRINT_LIBS) + rm -f conf.gnome_printtest +]) + +AC_DEFUN([GNOME_PRINT_CHECK], [ + AM_PATH_GNOME_PRINT(0.1.0,,[AC_MSG_ERROR(GNOME-PRINT not found)]) +]) diff --git a/config/gnome/gnome-pthread-check.m4 b/config/gnome/gnome-pthread-check.m4 new file mode 100644 index 0000000000..a4eb3b4890 --- /dev/null +++ b/config/gnome/gnome-pthread-check.m4 @@ -0,0 +1,16 @@ +dnl +dnl And better, use gthreads instead... +dnl + +AC_DEFUN([GNOME_PTHREAD_CHECK],[ + PTHREAD_LIB="" + AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread", + [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads", + [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r", + [AC_CHECK_FUNC(pthread_create)] + )] + )] + ) + AC_SUBST(PTHREAD_LIB) + AC_PROVIDE([GNOME_PTHREAD_CHECK]) +]) diff --git a/config/gnome/gnome-support.m4 b/config/gnome/gnome-support.m4 new file mode 100644 index 0000000000..2c1d049842 --- /dev/null +++ b/config/gnome/gnome-support.m4 @@ -0,0 +1,68 @@ +dnl GNOME_SUPPORT_CHECKS +dnl Check for various support functions needed by the standard +dnl Gnome libraries. Sets LIBOBJS, might define some macros. +dnl This should only be used when building the Gnome libs; +dnl Gnome clients should not need this macro. +AC_DEFUN([GNOME_SUPPORT_CHECKS],[ + # we need an `awk' to build `gnomesupport.h' + AC_REQUIRE([AC_PROG_AWK]) + + # this should go away soon + need_gnome_support=yes + + save_LIBOBJS="$LIBOBJS" + LIBOBJS= + + AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o") + + # for `scandir' + AC_HEADER_DIRENT + + # copied from `configure.in' of `libiberty' + vars="program_invocation_short_name program_invocation_name sys_errlist" + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(gnome_cv_var_$v, + [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;], + [eval "gnome_cv_var_$v=yes"], + [eval "gnome_cv_var_$v=no"])]) + if eval "test \"`echo '$gnome_cv_var_'$v`\" = yes"; then + AC_MSG_RESULT(yes) + n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + else + AC_MSG_RESULT(no) + fi + done + + AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen) + AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf) + + AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o") + + # to include `error.c' error.c has some HAVE_* checks + AC_CHECK_FUNCS(vprintf doprnt strerror_r) + AM_FUNC_ERROR_AT_LINE + + # This is required if we declare setreuid () and setregid (). + AC_TYPE_UID_T + + # see if we need to declare some functions. Solaris is notorious for + # putting functions into the `libc' but not listing them in the headers + AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h dirent.h) + GCC_NEED_DECLARATIONS(gethostname setreuid setregid getpagesize) + GCC_NEED_DECLARATION(scandir,[ +#ifdef HAVE_DIRENT_H +#include +#endif +]) + + # Turn our LIBOBJS into libtool objects. This is gross, but it + # requires changes to autoconf before it goes away. + LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'` + AC_SUBST(need_gnome_support) + AC_SUBST(LTLIBOBJS) + + LIBOBJS="$save_LIBOBJS" + AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes) +]) diff --git a/config/gnome/gnome-undelfs.m4 b/config/gnome/gnome-undelfs.m4 new file mode 100644 index 0000000000..c8ea6f4bac --- /dev/null +++ b/config/gnome/gnome-undelfs.m4 @@ -0,0 +1,20 @@ +dnl GNOME_UNDELFS_CHECKS +dnl Check for ext2fs undel support. +dnl Set shell variable ext2fs_undel to "yes" if we have it, +dnl "no" otherwise. May define USE_EXT2FSLIB for cpp. +dnl Will set EXT2FS_UNDEL_LIBS to required libraries. + +AC_DEFUN([GNOME_UNDELFS_CHECKS], [ + AC_CHECK_HEADERS(ext2fs/ext2fs.h linux/ext2_fs.h) + ext2fs_undel=no + EXT2FS_UNDEL_LIBS= + if test x$ac_cv_header_ext2fs_ext2fs_h = xyes + then + if test x$ac_cv_header_linux_ext2_fs_h = xyes + then + AC_DEFINE(USE_EXT2FSLIB) + ext2fs_undel=yes + EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err" + fi + fi +]) diff --git a/config/gnome/gnome-vfs.m4 b/config/gnome/gnome-vfs.m4 new file mode 100644 index 0000000000..137a39dd3c --- /dev/null +++ b/config/gnome/gnome-vfs.m4 @@ -0,0 +1,120 @@ +dnl GNOME_VFS_CHECKS +dnl Check for various functions needed by libvfs. +dnl This has various effects: +dnl Sets GNOME_VFS_LIBS to libraries required +dnl Sets termnet to true or false depending on whether it is required. +dnl If yes, defines USE_TERMNET. +dnl Sets vfs_flags to "pretty" list of vfs implementations we include. +dnl Sets shell variable use_vfs to yes (default, --with-vfs) or +dnl "no" (--without-vfs). +dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv". + +dnl Private define +AC_DEFUN([GNOME_WITH_VFS],[ + dnl FIXME: network checks should probably be in their own macro. + AC_CHECK_LIB(nsl, t_accept) + AC_CHECK_LIB(socket, socket) + + have_socket=no + AC_CHECK_FUNCS(socket, have_socket=yes) + if test $have_socket = no; then + # socket is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, socket, [ + LIBS="$LIBS -l$lib" + have_socket=yes + AC_DEFINE(HAVE_SOCKET) + break]) + done + fi + + have_gethostbyname=no + AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes) + if test $have_gethostbyname = no; then + # gethostbyname is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break]) + done + fi + + vfs_flags="tarfs" + use_net_code=false + if test $have_socket = yes; then + AC_STRUCT_LINGER + AC_CHECK_FUNCS(pmap_set, , [ + AC_CHECK_LIB(rpc, pmap_set, [ + LIBS="-lrpc $LIBS" + AC_DEFINE(HAVE_PMAP_SET) + ])]) + AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport) + dnl add for source routing support setsockopt + AC_CHECK_HEADERS(rpc/pmap_clnt.h) + vfs_flags="$vfs_flags, mcfs, ftpfs, fish" + use_net_code=true + fi + + dnl + dnl Samba support + dnl + smbfs="" + SAMBAFILES="" + AC_ARG_WITH(samba, + [--with-samba Support smb virtual file system],[ + if test "x$withval != xno"; then + AC_DEFINE(WITH_SMBFS) + vfs_flags="$vfs_flags, smbfs" + smbfs="smbfs.o" + SAMBAFILES="\$(SAMBAFILES)" + fi + ]) + AC_SUBST(smbfs) + AC_SUBST(SAMBAFILES) + + dnl + dnl The termnet support + dnl + termnet=false + AC_ARG_WITH(termnet, + [--with-termnet If you want a termified net support],[ + if test x$withval = xyes; then + AC_DEFINE(USE_TERMNET) + termnet=true + fi + ]) + + TERMNET="" + AC_DEFINE(USE_VFS) + if $use_net_code; then + AC_DEFINE(USE_NETCODE) + fi + mcserv= + if test $have_socket = yes; then + mcserv="mcserv" + if $termnet; then + TERMNET="-ltermnet" + fi + fi + + AC_SUBST(TERMNET) + AC_SUBST(mcserv) + +dnl FIXME: +dnl GNOME_VFS_LIBS= + +]) + +AC_DEFUN([GNOME_VFS_CHECKS],[ + use_vfs=yes + AC_ARG_WITH(vfs, + [--with-vfs Compile with the VFS code], + use_vfs=$withval + ) + case $use_vfs in + yes) GNOME_WITH_VFS;; + no) use_vfs=no;; + *) use_vfs=no;; + dnl Should we issue a warning? + esac +]) + + diff --git a/config/gnome/gnome-x-checks.m4 b/config/gnome/gnome-x-checks.m4 new file mode 100644 index 0000000000..1e397ef8e3 --- /dev/null +++ b/config/gnome/gnome-x-checks.m4 @@ -0,0 +1,80 @@ +dnl GNOME_X_CHECKS +dnl +dnl Basic X11 related checks for X11. At the end, the following will be +dnl defined/changed: +dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK +dnl CPPFLAGS Will include $X_CFLAGS +dnl GNOME_HAVE_SM `true' or `false' depending on whether session +dnl management is available. It is available if +dnl both -lSM and X11/SM/SMlib.h exist. (Some +dnl Solaris boxes have the library but not the header) +dnl XPM_LIBS -lXpm if Xpm library is present, otherwise "" +dnl +dnl The following configure cache variables are defined (but not used): +dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS} +dnl +AC_DEFUN([GNOME_X_CHECKS], +[ + AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path)) + dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could + dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes" + dnl + dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses + dnl CPPFLAGS, not CFLAGS + CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" + + saved_ldflags="$LDFLAGS" + LDFLAGS="$LDFLAGS $GTK_LIBS" + + gnome_cv_passdown_x_libs="$GTK_LIBS" + gnome_cv_passdown_X_LIBS="$GTK_LIBS" + gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS" + gnome_cv_passdown_GTK_LIBS="$GTK_LIBS" + + LDFLAGS="$saved_ldflags $GTK_LIBS" + +dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow. + USE_DEVGTK=true + +dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x]) +dnl AC_EGREP_CPP(answer_affirmatively, +dnl [#include +dnl #ifdef GTK_HAVE_FEATURES_1_1_0 +dnl answer_affirmatively +dnl #endif +dnl ], dev_gtk=yes, dev_gtk=no) +dnl if test "$dev_gtk" = "yes"; then +dnl USE_DEVGTK=true +dnl fi +dnl AC_MSG_RESULT("$dev_gtk") + + GNOME_HAVE_SM=true + case "$GTK_LIBS" in + *-lSM*) + dnl Already found it. + ;; + *) + dnl Assume that if we have -lSM then we also have -lICE. + AC_CHECK_LIB(SM, SmcSaveYourselfDone, + [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false, + $x_libs -lICE) + ;; + esac + + if test "$GNOME_HAVE_SM" = true; then + AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false) + fi + + if test "$GNOME_HAVE_SM" = true; then + AC_DEFINE(HAVE_LIBSM) + fi + + XPM_LIBS="" + AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs) + AC_SUBST(XPM_LIBS) + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + LDFLAGS="$saved_ldflags" + + AC_PROVIDE([GNOME_X_CHECKS]) +]) diff --git a/config/gnome/gnome-xml-check.m4 b/config/gnome/gnome-xml-check.m4 new file mode 100644 index 0000000000..4bc91d124d --- /dev/null +++ b/config/gnome/gnome-xml-check.m4 @@ -0,0 +1,30 @@ +dnl +dnl GNOME_XML_HOOK (script-if-xml-found, failflag) +dnl +dnl If failflag is "failure", script aborts due to lack of XML +dnl +dnl Check for availability of the libxml library +dnl the XML parser uses libz if available too +dnl + +AC_DEFUN([GNOME_XML_HOOK],[ + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = no; then + if test x$2 = xfailure; then + AC_MSG_ERROR(Could not find gnome-config) + fi + fi + AC_CHECK_LIB(xml, xmlNewDoc, [ + $1 + GNOME_XML_LIB=`$GNOME_CONFIG --libs xml` + ], [ + if test x$2 = xfailure; then + AC_MSG_ERROR(Could not link sample xml program) + fi + ], `$GNOME_CONFIG --libs xml`) + AC_SUBST(GNOME_XML_LIB) +]) + +AC_DEFUN([GNOME_XML_CHECK], [ + GNOME_XML_HOOK([],failure) +]) diff --git a/config/gnome/gnome.m4 b/config/gnome/gnome.m4 new file mode 100644 index 0000000000..659c22c494 --- /dev/null +++ b/config/gnome/gnome.m4 @@ -0,0 +1,128 @@ +dnl +dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits]) +dnl +dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh +dnl is not found. +dnl + +AC_DEFUN([GNOME_INIT_HOOK],[ + AC_SUBST(GNOME_LIBS) + AC_SUBST(GNOMEUI_LIBS) + AC_SUBST(GNOMEGNORBA_LIBS) + AC_SUBST(GTKXMHTML_LIBS) + AC_SUBST(ZVT_LIBS) + AC_SUBST(GNOME_LIBDIR) + AC_SUBST(GNOME_INCLUDEDIR) + + AC_ARG_WITH(gnome-includes, + [ --with-gnome-includes Specify location of GNOME headers],[ + CFLAGS="$CFLAGS -I$withval" + ]) + + AC_ARG_WITH(gnome-libs, + [ --with-gnome-libs Specify location of GNOME libs],[ + LDFLAGS="$LDFLAGS -L$withval" + gnome_prefix=$withval + ]) + + AC_ARG_WITH(gnome, + [ --with-gnome Specify prefix for GNOME files], + if test x$withval = xyes; then + want_gnome=yes + dnl Note that an empty true branch is not + dnl valid sh syntax. + ifelse([$1], [], :, [$1]) + else + if test "x$withval" = xno; then + want_gnome=no + else + want_gnome=yes + LDFLAGS="$LDFLAGS -L$withval/lib" + CFLAGS="$CFLAGS -I$withval/include" + gnome_prefix=$withval/lib + fi + fi, + want_gnome=yes) + + if test "x$want_gnome" = xyes; then + + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = "no"; then + no_gnome_config="yes" + else + AC_MSG_CHECKING(if $GNOME_CONFIG works) + if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then + AC_MSG_RESULT(yes) + GNOME_GNORBA_HOOK([],$2) + GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" + GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" + GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" + GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" + ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" + GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" + GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" + $1 + else + AC_MSG_RESULT(no) + no_gnome_config="yes" + fi + fi + + if test x$exec_prefix = xNONE; then + if test x$prefix = xNONE; then + gnome_prefix=$ac_default_prefix/lib + else + gnome_prefix=$prefix/lib + fi + else + gnome_prefix=`eval echo \`echo $libdir\`` + fi + + if test "$no_gnome_config" = "yes"; then + AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix) + if test -f $gnome_prefix/gnomeConf.sh; then + AC_MSG_RESULT(found) + echo "loading gnome configuration from" \ + "$gnome_prefix/gnomeConf.sh" + . $gnome_prefix/gnomeConf.sh + $1 + else + AC_MSG_RESULT(not found) + if test x$2 = xfail; then + AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install) + fi + fi + fi + fi + + if test -n "$3"; then + n="$3" + for i in $n; do + AC_MSG_CHECKING(extra library \"$i\") + case $i in + applets) + AC_SUBST(GNOME_APPLETS_LIBS) + GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` + AC_MSG_RESULT($GNOME_APPLETS_LIBS);; + docklets) + AC_SUBST(GNOME_DOCKLETS_LIBS) + GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets` + AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);; + capplet) + AC_SUBST(GNOME_CAPPLET_LIBS) + GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` + AC_MSG_RESULT($GNOME_CAPPLET_LIBS);; + *) + AC_MSG_RESULT(unknown library) + esac + done + fi +]) + +dnl +dnl GNOME_INIT ([additional-inits]) +dnl + +AC_DEFUN([GNOME_INIT],[ + GNOME_INIT_HOOK([],fail,$1) +]) diff --git a/config/gnome/gperf-check.m4 b/config/gnome/gperf-check.m4 new file mode 100644 index 0000000000..1b73d3f19d --- /dev/null +++ b/config/gnome/gperf-check.m4 @@ -0,0 +1,79 @@ +dnl +dnl AC_PROG_GPERF (MINIMUM-VERSION) +dnl +dnl Check for availability of gperf. +dnl Abort if not found or if current version is not up to par. +dnl + +AC_DEFUN([AC_PROG_GPERF],[ + AC_PATH_PROG(GPERF, gperf, no) + if test "$GPERF" = no; then + AC_MSG_ERROR(Could not find gperf) + fi + min_gperf_version=ifelse([$1], ,2.7,$1) + AC_MSG_CHECKING(for gperf - version >= $min_gperf_version) + gperf_major_version=`$GPERF --version | \ + sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\1/'` + gperf_minor_version=`$GPERF --version | \ + sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\2/'` + no_gperf="" +dnl +dnl Now check if the installed gperf is sufficiently new. +dnl + AC_TRY_RUN([ +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int +main () +{ + char *tmp_version; + + int major; + int minor; + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_gperf_version"); + if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) { + printf ("%s, bad version string\n", "$min_gperf_version"); + exit (1); + } + + if (($gperf_major_version > major) || + (($gperf_major_version == major) && ($gperf_minor_version >= minor))) { + return 0; + } else { + printf ("\n"); + printf ("*** An old version of gperf ($gperf_major_version.$gperf_minor_version) was found.\n"); + printf ("*** You need a version of gperf newer than %d.%d.%d. The latest version of\n", + major, minor); + printf ("*** gperf is always available from ftp://ftp.gnu.org.\n"); + printf ("***\n"); + return 1; + } +} +],,no_gperf=yes,[/bin/true]) + if test "x$no_gperf" = x ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + +]) diff --git a/config/gnome/gtk--.m4 b/config/gnome/gtk--.m4 new file mode 100644 index 0000000000..16f4cf2d60 --- /dev/null +++ b/config/gnome/gtk--.m4 @@ -0,0 +1,195 @@ +# Configure paths for GTK-- +# Erik Andersen 30 May 1998 +# Modified by Tero Pulkkinen (added the compiler checks... I hope they work..) +# Modified by Thomas Langen 16 Jan 2000 (corrected CXXFLAGS) + +dnl Test for GTKMM, and define GTKMM_CFLAGS and GTKMM_LIBS +dnl to be used as follows: +dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl +AC_DEFUN(AM_PATH_GTKMM, +[dnl +dnl Get the cflags and libraries from the gtkmm-config script +dnl +AC_ARG_WITH(gtkmm-prefix,[ --with-gtkmm-prefix=PREFIX + Prefix where GTK-- is installed (optional)], + gtkmm_config_prefix="$withval", gtkmm_config_prefix="") +AC_ARG_WITH(gtkmm-exec-prefix,[ --with-gtkmm-exec-prefix=PREFIX + Exec prefix where GTK-- is installed (optional)], + gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="") +AC_ARG_ENABLE(gtkmmtest, [ --disable-gtkmmtest Do not try to compile and run a test GTK-- program], + , enable_gtkmmtest=yes) + + if test x$gtkmm_config_exec_prefix != x ; then + gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix" + if test x${GTKMM_CONFIG+set} != xset ; then + GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config + fi + fi + if test x$gtkmm_config_prefix != x ; then + gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix" + if test x${GTKMM_CONFIG+set} != xset ; then + GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config + fi + fi + + AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no) + min_gtkmm_version=ifelse([$1], ,0.10.0,$1) + + AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version) + no_gtkmm="" + if test "$GTKMM_CONFIG" = "no" ; then + no_gtkmm=yes + else + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + GTKMM_CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags` + GTKMM_LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs` + gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gtkmmtest" = "xyes" ; then + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS" + LIBS="$LIBS $GTKMM_LIBS" +dnl +dnl Now check if the installed GTK-- is sufficiently new. (Also sanity +dnl checks the results of gtkmm-config to some extent +dnl + rm -f conf.gtkmmtest + AC_TRY_RUN([ +#include +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gtkmmtest"); + + /* HP/UX 0 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtkmm_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtkmm_version"); + exit(1); + } + + if ((gtkmm_major_version != $gtkmm_config_major_version) || + (gtkmm_minor_version != $gtkmm_config_minor_version) || + (gtkmm_micro_version != $gtkmm_config_micro_version)) + { + printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", + $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version, + gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); + printf ("*** was found! If gtkmm-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n"); + printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } +/* GTK-- does not have the GTKMM_*_VERSION constants */ +/* + else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) || + (gtkmm_minor_version != GTKMM_MINOR_VERSION) || + (gtkmm_micro_version != GTKMM_MICRO_VERSION)) + { + printf("*** GTK-- header files (version %d.%d.%d) do not match\n", + GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); + } +*/ + else + { + if ((gtkmm_major_version > major) || + ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) || + ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n", + gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); + printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n"); + printf("*** correct copy of gtkmm-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtkmm" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GTKMM_CONFIG" = "no" ; then + echo "*** The gtkmm-config script installed by GTK-- could not be found" + echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTKMM_CONFIG environment variable to the" + echo "*** full path to gtkmm-config." + echo "*** The gtkmm-config script was not available in GTK-- versions" + echo "*** prior to 0.9.12. Perhaps you need to update your installed" + echo "*** version to 0.9.12 or later" + else + if test -f conf.gtkmmtest ; then + : + else + echo "*** Could not run GTK-- test program, checking why..." + CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS" + LIBS="$LIBS $GTKMM_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK-- or finding the wrong" + echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK-- was incorrectly installed" + echo "*** or that you have moved GTK-- since it was installed. In the latter case, you" + echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ]) + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTKMM_CFLAGS="" + GTKMM_LIBS="" + ifelse([$3], , :, [$3]) + AC_LANG_RESTORE + fi + AC_SUBST(GTKMM_CFLAGS) + AC_SUBST(GTKMM_LIBS) + rm -f conf.gtkmmtest +]) + diff --git a/config/gnome/linger.m4 b/config/gnome/linger.m4 new file mode 100644 index 0000000000..dfa7c8aea0 --- /dev/null +++ b/config/gnome/linger.m4 @@ -0,0 +1,28 @@ +dnl +dnl Check for struct linger +dnl +AC_DEFUN(AC_STRUCT_LINGER, [ +av_struct_linger=no +AC_MSG_CHECKING(struct linger is available) +AC_TRY_RUN([ +#include +#include + +struct linger li; + +main () +{ + li.l_onoff = 1; + li.l_linger = 120; + exit (0); +} +],[ +AC_DEFINE(HAVE_STRUCT_LINGER) +av_struct_linger=yes +],[ +av_struct_linger=no +],[ +av_struct_linger=no +]) +AC_MSG_RESULT($av_struct_linger) +]) diff --git a/config/gnome/need-declaration.m4 b/config/gnome/need-declaration.m4 new file mode 100644 index 0000000000..d5b7bc66d5 --- /dev/null +++ b/config/gnome/need-declaration.m4 @@ -0,0 +1,42 @@ +dnl See whether we need a declaration for a function. +dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES]) +AC_DEFUN(GCC_NEED_DECLARATION, +[AC_MSG_CHECKING([whether $1 must be declared]) +AC_CACHE_VAL(gcc_cv_decl_needed_$1, +[AC_TRY_COMPILE([ +#include +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +$2], +[char *(*pfn) = (char *(*)) $1], +eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")]) +if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then + AC_MSG_RESULT(yes) + gcc_need_declarations="$gcc_need_declarations $1" + gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($gcc_tr_decl) +else + AC_MSG_RESULT(no) +fi +])dnl + +dnl Check multiple functions to see whether each needs a declaration. +dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES]) +AC_DEFUN(GCC_NEED_DECLARATIONS, +[for ac_func in $1 +do +GCC_NEED_DECLARATION($ac_func, $2) +done +] +) diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index 904faff771..5a8e43f73c 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -906,7 +906,7 @@ AC_DEFUN(LYX_USE_FRONTEND, [AC_MSG_CHECKING(what frontend should be used as main GUI) AC_ARG_WITH(frontend, [ --with-frontend[=value] Use THIS frontend as main GUI: - Possible values: xforms,kde], + Possible values: xforms,kde,gtk], [lyx_use_frontend="$withval"], [lyx_use_frontend="xforms"]) AC_MSG_RESULT($lyx_use_frontend) lyx_flags="$lyx_flags frontend-$lyx_use_frontend" diff --git a/configure.in b/configure.in index 92d552f288..138610e4f5 100644 --- a/configure.in +++ b/configure.in @@ -62,7 +62,7 @@ LYX_SCO AC_EXEEXT ### Check for a C++ compiler -AC_LANG_CPLUSPLUS +#AC_LANG_CPLUSPLUS LYX_PROG_CXX AC_PROG_CXXCPP AC_DISABLE_SHARED @@ -159,6 +159,21 @@ case "$lyx_use_frontend" in xforms) FRONTEND="xforms" FRONTEND_GUILIB="\${top_builddir}/src/frontends/xforms/libxforms.la";; + gtk) + GNOME_INIT + GNOME_COMPILE_WARNINGS + GNOME_X_CHECKS + + AM_PATH_GTKMM(1.2.1,, + AC_MSG_ERROR(Cannot find GTK--: Please install Version 1.2.1+)) + AM_PATH_GNOMEMM + + FRONTEND="gtk" + FRONTEND_GUILIB="\${top_builddir}/src/frontends/gtk/libgtk.la" + FRONTEND_LDFLAGS="\$(GNOMEMM_LIBDIR) \$(GNOME_LIBDIR)" + FRONTEND_INCLUDES="\$(GNOMEMM_INCLUDEDIR) \$(GTKMM_CFLAGS) \$(GNOME_INCLUDEDIR) \$(GTK_CFLAGS)" + FRONTEND_LIBS="\$(GNOMEMM_LIBS) \$(GTKMM_LIBS) \$(GNOME_LIBS) \$(GTK_LIBS)" + AC_DEFINE(GTKGUI);; *) LYX_ERROR(Unknown frontend $lyx_use_frontend);; esac @@ -267,6 +282,7 @@ AC_OUTPUT([Makefile \ src/frontends/Makefile \ src/frontends/xforms/Makefile \ src/frontends/kde/Makefile \ + src/frontends/gtk/Makefile \ ], [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile]) diff --git a/src/frontends/gtk/.cvsignore b/src/frontends/gtk/.cvsignore new file mode 100644 index 0000000000..70845e08eb --- /dev/null +++ b/src/frontends/gtk/.cvsignore @@ -0,0 +1 @@ +Makefile.in diff --git a/src/frontends/gtk/Dialogs.C b/src/frontends/gtk/Dialogs.C new file mode 100644 index 0000000000..077143cdf0 --- /dev/null +++ b/src/frontends/gtk/Dialogs.C @@ -0,0 +1,101 @@ +#include +#include "Dialogs.h" +#include "FormCopyright.h" + + +Dialogs::Dialogs(LyXView * lv) +{ + dialogs_.push_back(new FormCopyright(lv, this)); + //dialogs_.push_back(new FormPrint(lv, this)); + //dialogs_.push_back(new FormPreferences(lv, this)); + + // reduce the number of connections needed in + // dialogs by a simple connection here. + hideAll.connect(hideBufferDependent.slot()); +} + +Dialogs::~Dialogs() +{ + for (vector::iterator iter = dialogs_.begin(); + iter != dialogs_.end(); + ++iter) { + delete *iter; + } +} + + +/***************************************************************************** + +Q. WHY does Dialogs::Dialogs pass `this' to dialog constructors? + +A. To avoid a segfault. + The dialog constructors need to connect to their + respective showSomeDialog signal(*) but in order to do + that they need to get the address of the Dialogs instance + from LyXView::getDialogs(). However, since the Dialogs + instance is still being constructed at that time + LyXView::getDialogs() will *not* return the correct + address because it hasn't finished being constructed. + A Catch-22 situation (or is that the chicken and the egg...). + So to get around the problem we pass the address of + the newly created Dialogs instance using `this'. + +(*) -- I'm using signals exclusively to guarantee that the gui code + remains hidden from the rest of the system. In fact the only + header related to dialogs that anything in the non-gui-specific + code gets to see is Dialogs.h! Even Dialogs.h doesn't know what a + FormCopyright class looks like or that its even going to be used! + + No other gui dialog headers are seen outside of the gui-specific + directories! This ensures that the gui is completely separate from + the rest of LyX. All this through the use of a few simple signals. + BUT, the price is that during construction we need to connect the + implementations show() method to the showSomeDialog signal and this + requires that we have an instance of Dialogs and the problem mentioned + above. + + Almost all other dialogs should be able to operate using the same style + of signalling used for Copyright. Exceptions should be handled + by adding a specific show or update signal. For example, spellchecker + needs to set the next suspect word and its options/replacements so we + need a: + Signal0 updateSpellChecker; + + Since we would have to have a + Signal0 showSpellChecker; + + in order to just see the spellchecker and let the user push the [Start] + button then the updateSpellChecker signal will make the SpellChecker + dialog get the new word and replacements list from LyX. If you really, + really wanted to you could define a signal that would pass the new + word and replacements: + Signal2 > updateSpellChecker; + + (or something similar) but, why bother when the spellchecker can get + it anyway with a LyXFunc call or two. Besides if someone extends + what a dialog does then they also have to change code in the rest of + LyX to pass more parameters or get the extra info via a function + call anyway. Thus reducing the independence of the two code bases. + + We don't need a separate update signal for each dialog because most of + them will be changed only when the buffer is changed (either by closing + the current open buffer or switching to another buffer in the current + LyXView -- different BufferView same LyXView or same BufferView same + LyXView). + + So we minimise signals but maximise independence and programming + simplicity, understandability and maintainability. It's also + extremely easy to add support for Qt or gtk-- because they use + signals already. Guis that use callbacks, like xforms, must have their + code wrapped up like that in the form_copyright.[Ch] which is awkward + but will at least allow multiple instances of the same dialog. + + Signals will also be a great help in controlling the splashscreen -- + once signalled to hide it can disconnect from the signal and remove + itself from memory. + + LyXFuncs will be used for requesting/setting LyX internal info. This + will ensure that scripts or LyXServer-connected applications can all + have access to the same calls as the internal user-interface. + +******************************************************************************/ diff --git a/src/frontends/gtk/FormCopyright.C b/src/frontends/gtk/FormCopyright.C new file mode 100644 index 0000000000..c795301b5f --- /dev/null +++ b/src/frontends/gtk/FormCopyright.C @@ -0,0 +1,71 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== */ + +/* FormCopyright.C + * FormCopyright Interface Class Implementation + */ + +#include +#include "Dialogs.h" +#include "FormCopyright.h" + +FormCopyright::FormCopyright(LyXView * lv, Dialogs * d) + : dialog_(NULL), lv_(lv), d_(d), h_(0) +{ + // let the dialog be shown + // This is a permanent connection so we won't bother + // storing a copy because we won't be disconnecting. + d->showCopyright.connect(slot(this, &FormCopyright::show)); +} + + +FormCopyright::~FormCopyright() +{ + if (dialog_!=NULL) hide(); +} + + +void FormCopyright::show() +{ + if(dialog_!=NULL) { // "About" box hasn't been closed, so just raise it + Gdk_Window dialog_win(dialog_->get_window()); + dialog_win.show(); + dialog_win.raise(); + } + else { // create new "About" dialog box + vector authors; //null. Authors are not listed in LyX copyright dialogbox. + + dialog_ = new Gnome::About(PACKAGE, VERSION, + "(C) 1995 by Matthias Ettrich, \n1995-2000 LyX Team", + authors, + "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\nLyX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.", + NULL); + + // it should be disconnected before deleting dialog_ in FormCopyright::hide() + destroy_ = dialog_->destroy.connect(slot(this, &FormCopyright::hide)); + + dialog_->show(); + + h_ = d_->hideAll.connect(slot(this, &FormCopyright::hide)); + } +} + + +void FormCopyright::hide() +{ + if (dialog_!=NULL) { + dialog_->hide(); + + h_.disconnect(); + destroy_.disconnect(); + + delete dialog_; + dialog_ = NULL; + } +} diff --git a/src/frontends/gtk/FormCopyright.h b/src/frontends/gtk/FormCopyright.h new file mode 100644 index 0000000000..6d807f7c0f --- /dev/null +++ b/src/frontends/gtk/FormCopyright.h @@ -0,0 +1,71 @@ +// -*- C++ -*- +/* FormCopyright.h + * FormCopyright Interface Class + * This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== + */ + +#ifndef FORMCOPYRIGHT_H +#define FORMCOPYRIGHT_H + +#include "DialogBase.h" +#include + +class Dialogs; +// same arguement as in Dialogs.h s/LyX/UI/ +class LyXView; + +/** This class provides an GTK-- implementation of the FormCopyright Dialog. + */ +class FormCopyright : public DialogBase { +public: + /**@name Constructors and Destructors */ + //@{ + /// #FormCopyright x(LyXFunc ..., Dialogs ...);# + FormCopyright(LyXView *, Dialogs *); + /// + ~FormCopyright(); + //@} + +private: + FormCopyright() {} + FormCopyright(FormCopyright &) : DialogBase() {} + + /**@name Slot Methods */ + //@{ + /// Create the dialog if necessary, update it and display it. + void show(); + /// Hide the dialog. + void hide(); + /// Not used but we've got to implement it. + void update() {} + //@} + + //@{ + /// Real GUI implementation. + Gnome::About * dialog_; + /** Which LyXFunc do we use? + We could modify Dialogs to have a visible LyXFunc* instead and + save a couple of bytes per dialog. + */ + LyXView * lv_; + /** Which Dialogs do we belong to? + Used so we can get at the signals we have to connect to. + */ + Dialogs * d_; + /// Hide connection. + Connection h_; + /// Destroy connection. + Connection destroy_; + //@} +}; + +#endif + + diff --git a/src/frontends/gtk/Makefile.am b/src/frontends/gtk/Makefile.am new file mode 100644 index 0000000000..dc7a832ad5 --- /dev/null +++ b/src/frontends/gtk/Makefile.am @@ -0,0 +1,36 @@ +AUTOMAKE_OPTIONS = foreign 1.4 +DISTCLEANFILES= *.orig *.rej *~ *.bak core +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in +noinst_LTLIBRARIES = libgtk.la +INCLUDES = ${FRONTEND_INCLUDES} -I${top_srcdir}/src/ \ + -I${top_srcdir}/src/frontends/ \ + ${SIGC_CFLAGS} +LIBS= +LDFLAGS= +LYXDATADIRS = +ETAGS_ARGS = --lang=c++ +libgtk_la_SOURCES = \ + Dialogs.C \ + FormCopyright.C \ + FormCopyright.h + +# These still have to be added. Sooner or later. ARRae-20000411 +# GUI_defaults.C \ +# GUI_initialize.C \ +# GUI_postlyxrc.C \ +# GUI_runtime.C \ +# GUI_applymenu.C + +# just copied from old lyx repository +dist-hook: + for subdir in $(LYXDATADIRS) ; do \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + list=`(cd $(srcdir)/$$subdir && ls -1 | grep -v CVS)`; \ + echo $$list ; \ + for fil in $$list ; do \ + cp -p $(srcdir)/$$subdir/$$fil $(distdir)/$$subdir ; \ + done ; \ + done diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 11cc651738..e33d6a5f37 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -19,6 +19,10 @@ # include #endif +#ifdef GTKGUI +# include +#endif + #include #include "lyx_gui.h" #include FORMS_H_LOCATION @@ -590,6 +594,10 @@ void LyXGUI::runTime() #ifdef KDEGUI kapp->processEvents(); #endif +#ifdef GTKGUI + Gnome::Main::instance()->iteration(FALSE); +#endif + if (fl_check_forms() == FL_EVENT) { lyxerr << "LyX: This shouldn't happen..." << endl; fl_XNextEvent(&ev); diff --git a/src/main.C b/src/main.C index 10785c5ffa..6fb3a47c4e 100644 --- a/src/main.C +++ b/src/main.C @@ -14,6 +14,10 @@ #ifdef KDEGUI # include #endif +#ifdef GTKGUI +# include +#endif + #include FORMS_H_LOCATION #include "lyx_main.h" @@ -21,6 +25,7 @@ #include "LString.h" #include "support/filetools.h" + // I keep these here so that it will be processed as early in // the compilation process as possible. #if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0 @@ -64,7 +69,10 @@ int main(int argc, char * argv[]) #ifdef KDEGUI KApplication a( argc, argv ); #endif - +#ifdef GTKGUI + Gnome::Main a(PACKAGE,VERSION,argc, argv ); +#endif + // lyx_localedir is used by gettext_init() is we have // i18n support built-in string lyx_localedir = GetEnvPath("LYX_LOCALEDIR");