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 (search in [[DIR]])]),
32 [ if test "X$with_libfam" = "Xno"; then
36 if test "X$with_libfam" != "Xyes"; then
37 libfam_prefix=$with_libfam
40 AC_MSG_RESULT([$libfam_use]) ],
41 [ AC_MSG_RESULT([if present])
44 # Check if libfam is actually available!
45 if test "X$libfam_use" != "Xno"; then
47 # If a prefix to search was specified, then add the appropriate
49 if test "X$libfam_use" = "X"; then
50 LIBFAM_LDFLAGS="-L$libfam_prefix/lib"
51 LIBFAM_CFLAGS="-I$libfam_prefix/include"
54 # Check that the library and header file are available. Save and
55 # restore CPPFLAGS and LDFLAGS variables.
56 save_CPPFLAGS="$CPPFLAGS"
57 save_LDFLAS="$LDFLAGS"
58 CPPFLAGS="$CPPFLAGS $LIBFAM_CFLAGS"
59 LDFLAGS="$LDFLAGS $LIBFAM_LDFLAGS"
61 AC_CHECK_LIB([fam], [FAMOpen2], [], [HAVE_LIBFAM=no])
62 AC_CHECK_HEADER([fam.h], [], [HAVE_LIBFAM=no
63 CPPFLAGS="$save_CPPDFLAGS"
64 LDFLAGS="$save_LDFLAGS"
66 LIBFAM_LDFLAGS="$LIBFAM_LDFLAGS -lfam"])
68 # If --with-libfam was specified, then we *must* have a usable
70 if test "X$libfam_use" = "Xyes" -a "X$HAVE_LIBFAM" = "Xno"; then
71 AC_MSG_ERROR([You specified that libfam should be used, but libfam could not
72 be found. Ensure that all libfam development files are installed,
73 or configure without --with-libfam.])
77 # If we don't have libfam, clear its flags variables
78 if test "X$HAVE_LIBFAM" != "Xyes"; then
82 AC_DEFINE([HAVE_LIBFAM], [1],
83 [Define to 1 if libfam is available])
86 AC_SUBST([LIBFAM_CPPFLAGS])
87 AC_SUBST([LIBFAM_LDFLAGS])