daemon: use gnulib
[libguestfs.git] / daemon / configure.ac
1 # libguestfs-daemon
2 # Copyright (C) 2009 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 AC_INIT([libguestfs-daemon],[1.0.0])
19 AC_CONFIG_AUX_DIR([build-aux])
20 AM_INIT_AUTOMAKE([foreign])
21
22 AC_CONFIG_MACRO_DIR([m4])
23
24 dnl If the user specified --enable-32bit, then force the C compiler
25 dnl to build 32 bit binaries (gcc -m32).
26 AC_ARG_ENABLE([32bit],
27   [AS_HELP_STRING([--enable-32bit], [build 32 bit binaries (gcc -m32)])],
28   [export CC="gcc -m32"],
29   [enable_32bit=no])
30
31 dnl Enable 'debug' command.
32 AC_ARG_ENABLE([debug-command],
33   [AS_HELP_STRING([--enable-debug-command], [enable the 'debug' command])],
34   [AC_DEFINE_UNQUOTED([ENABLE_DEBUG_COMMAND],[1],[Enable the 'debug' command])],
35   [])
36
37 dnl For strchrnul(3), asprintf(3), futimens(2) and getline(3).
38 AC_GNU_SOURCE
39
40 dnl Check for basic C environment.
41 AC_PROG_CC
42 AC_PROG_INSTALL
43 AC_PROG_CPP
44
45 gl_EARLY
46 gl_INIT
47
48 AC_C_PROTOTYPES
49 test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
50
51 AM_PROG_CC_C_O
52
53 dnl Check for Augeas (now optional).
54 AC_CHECK_LIB([augeas],[aug_match],[
55         LIBS="-laugeas $LIBS"
56         have_augeas=yes
57         dnl Check for functions not available in earlier versions of Augeas.
58         AC_CHECK_FUNCS([aug_load aug_defvar aug_defnode])
59         ],[have_augeas=no])
60 if test "x$have_augeas" = "xyes"; then
61         AC_DEFINE([HAVE_AUGEAS],[1],[Define to 1 if you have Augeas])
62 fi
63
64 dnl Check for XDR library.
65 AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[
66         AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl])
67         ])
68
69 dnl Functions which may not be available in older distributions.
70 AC_CHECK_FUNCS([futimens listxattr llistxattr getxattr lgetxattr setxattr lsetxattr removexattr lremovexattr])
71
72 dnl For modified printf, we need glibc either (old-style)
73 dnl register_printf_function or (new-style) register_printf_specifier.
74 AC_CHECK_FUNC([register_printf_specifier],[
75         AC_DEFINE([HAVE_REGISTER_PRINTF_SPECIFIER],[1],
76                 [Define to 1 if you have new-style register_printf_specifier])
77         ],[
78         AC_CHECK_FUNC([register_printf_function],[
79                 AC_DEFINE([HAVE_REGISTER_PRINTF_FUNCTION],[1],
80                         [Define to 1 if you have old-style register_printf_function])
81                 ],[
82                 AC_MSG_FAILURE(
83 [No support for glibc-style extended printf formatters.
84
85 This means you either have a very old glibc (pre-2.0) or you
86 are using some other libc where this is not supported.])])])
87
88 dnl Headers.
89 AC_CHECK_HEADERS([attr/xattr.h sys/xattr.h])
90
91 dnl Produce output files.
92 AC_CONFIG_HEADERS([config.h])
93 AC_CONFIG_FILES([Makefile lib/Makefile tests/Makefile])
94 AC_OUTPUT