1 # geda-stroke.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 libstroke, and if so if libraries are
23 AC_DEFUN([AX_OPTION_STROKE],
26 AC_MSG_CHECKING([whether to use libstroke])
28 # Check what the user wants
29 AC_ARG_WITH([libstroke],
30 AS_HELP_STRING([--with-libstroke[[[=DIR]]]],
31 [use libstroke (search in [[DIR]])]),
32 [ if test "X$with_libstroke" = "Xno"; then
36 if test "X$with_libstroke" != "Xyes"; then
37 libstroke_prefix=$with_libstroke
40 AC_MSG_RESULT([$libstroke_use]) ],
41 [ AC_MSG_RESULT([if present])
44 # Check if libstroke is actually available!
45 if test "X$libstroke_use" != "Xno"; then
47 # If a prefix to search was specified, then add the appropriate
49 if test "X$libstroke_use" = "X"; then
50 LIBSTROKE_LDFLAGS="-L$libstroke_prefix/lib"
51 LIBSTROKE_CFLAGS="-I$libstroke_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 $LIBSTROKE_CFLAGS"
59 LDFLAGS="$LDFLAGS $LIBSTROKE_LDFLAGS"
61 AC_CHECK_LIB([stroke], [stroke_init], [], [HAVE_LIBSTROKE=no])
62 AC_CHECK_HEADER([stroke.h], [], [HAVE_LIBSTROKE=no
63 CPPFLAGS="$save_CPPDFLAGS"
64 LDFLAGS="$save_LDFLAGS"
66 LIBSTROKE_LDFLAGS="$LIBSTROKE_LDFLAGS -lstroke"])
68 # If --with-libstroke was specified, then we *must* have a usable
70 if test "X$libstroke_use" = "Xyes" -a "X$HAVE_LIBSTROKE" = "Xno"; then
71 AC_MSG_ERROR([You specified that libstroke should be used, but libstroke could not
72 be found. Ensure that all libstroke development files are installed,
73 or configure without --with-libstroke.])
77 # If we don't have libstroke, clear its flags variables
78 if test "X$HAVE_LIBSTROKE" != "Xyes"; then
82 AC_DEFINE([HAVE_LIBSTROKE], [test "X$HAVE_LIBSTROKE" = "Xyes"],
83 [Define to 1 if libstroke is available])
86 AC_SUBST([LIBSTROKE_CPPFLAGS])
87 AC_SUBST([LIBSTROKE_LDFLAGS])
89 ])dnl AX_OPTION_STROKE