Clarify error message
[geda-gaf.git] / m4 / geda-fam.m4
blob56c4061c449637fb0b627f7f7411ed1fc814c3f2
1 # geda-fam.m4                                         -*-Autoconf-*-
2 # serial 1.0
4 dnl MIME & desktop icon directories, and MIME database update options
5 dnl Copyright (C) 2009  Peter Brett <peter@peter-b.co.uk>
6 dnl
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.
11 dnl
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.
16 dnl
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
22 # available.
23 AC_DEFUN([AX_OPTION_FAM],
25   AC_PREREQ([2.69])dnl
26   AC_MSG_CHECKING([whether to use libfam])
28   # Check what the user wants
29   AC_ARG_WITH([libfam],
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
35         libfam_use=no
36       else
37         libfam_use=yes
38         if test "X$with_libfam" != "Xyes"; then
39           libfam_prefix=$with_libfam
40         fi
41       fi
42       AC_MSG_RESULT([$libfam_use]) ],
43     [ AC_MSG_RESULT([yes])
44   ])
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
50     # flags.
51     if test "X$libfam_use" = "X"; then
52       LIBFAM_LDFLAGS="-L$libfam_prefix/lib"
53       LIBFAM_CFLAGS="-I$libfam_prefix/include"
54     fi
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"
62     HAVE_LIBFAM=yes
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 libgamin nor libfam development files could
73 be found.  Please ensure that the development files for either libgamin
74 or libfam are installed.
76 If you want to continue without File Alteration Monitor support, use
77 the configuration option `--without-libfam'.])
78     fi
79   fi
81   # If we don't have libfam, clear its flags variables
82   if test "X$HAVE_LIBFAM" != "Xyes"; then
83     LIBFAM_LDFLAGS=""
84     LIBFAM_CFLAGS=""
85   else
86     AC_DEFINE([HAVE_LIBFAM], [1],
87       [Define to 1 if libfam is available])
88   fi
90   AC_SUBST([LIBFAM_CPPFLAGS])
91   AC_SUBST([LIBFAM_LDFLAGS])
93 ])dnl AX_OPTION_FAM