1 # geda-fam.m4 -*-Autoconf-*-
4 dnl MIME & desktop icon directories, and MIME database update options
5 dnl Copyright (C) 2009 Peter Brett <peter@peter-b.co.uk>
7 dnl This program is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 2 of the License, or
10 dnl (at your option) any later version.
12 dnl This program is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 dnl GNU General Public License for more details.
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program; if not, write to the Free Software
19 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 # Check whether we should use libfam, and if so if libraries are
23 AC_DEFUN([AX_OPTION_FAM],
26 AC_MSG_CHECKING([whether to use libfam])
28 # Check what the user wants
30 [AS_HELP_STRING([--with-libfam@<:@=DIR@:>@],
31 [use libfam/libgamin (search in DIR)])
32 AS_HELP_STRING([--without-libfam],
33 [don't use libfam/libgamin])],
34 [ if test "X$with_libfam" = "Xno"; then
38 if test "X$with_libfam" != "Xyes"; then
39 libfam_prefix=$with_libfam
42 AC_MSG_RESULT([$libfam_use]) ],
43 [ AC_MSG_RESULT([yes])
46 # Check if libfam is actually available!
47 if test "X$libfam_use" != "Xno"; then
49 # If a prefix to search was specified, then add the appropriate
51 if test "X$libfam_use" = "X"; then
52 LIBFAM_LDFLAGS="-L$libfam_prefix/lib"
53 LIBFAM_CFLAGS="-I$libfam_prefix/include"
56 # Check that the library and header file are available. Save and
57 # restore CPPFLAGS and LDFLAGS variables.
58 save_CPPFLAGS="$CPPFLAGS"
59 save_LDFLAS="$LDFLAGS"
60 CPPFLAGS="$CPPFLAGS $LIBFAM_CFLAGS"
61 LDFLAGS="$LDFLAGS $LIBFAM_LDFLAGS"
63 AC_CHECK_LIB([fam], [FAMOpen2], [], [HAVE_LIBFAM=no])
64 AC_CHECK_HEADER([fam.h], [], [HAVE_LIBFAM=no
65 CPPFLAGS="$save_CPPDFLAGS"
66 LDFLAGS="$save_LDFLAGS"
68 LIBFAM_LDFLAGS="$LIBFAM_LDFLAGS -lfam"])
70 # Only continue without libfam if --without-libfam was specified.
71 if test "X$HAVE_LIBFAM" = "Xno"; then
72 AC_MSG_ERROR([Neither libfam nor libgamin development files could
73 be found. Please ensure that the development files for either library
76 If you want to continue without File Alteration Monitor support, use
77 the configuration option `--without-libfam'.])
81 # If we don't have libfam, clear its flags variables
82 if test "X$HAVE_LIBFAM" != "Xyes"; then
86 AC_DEFINE([HAVE_LIBFAM], [1],
87 [Define to 1 if libfam is available])
90 AC_SUBST([LIBFAM_CPPFLAGS])
91 AC_SUBST([LIBFAM_LDFLAGS])