plugins/example3: Minor typo in man page.
[nbdkit/ericb.git] / configure.ac
blob65ee705761d0dfa0eee6d23cd4df854de9b0e220
1 # nbdkit
2 # Copyright (C) 2013 Red Hat Inc.
3 # All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # * Neither the name of Red Hat nor the names of its contributors may be
17 # used to endorse or promote products derived from this software without
18 # specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
21 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
24 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 # SUCH DAMAGE.
33 AC_INIT([nbdkit], [1.0.0])
34 AC_CONFIG_MACRO_DIR([m4])
35 AC_USE_SYSTEM_EXTENSIONS
36 AC_SYS_LARGEFILE
38 AM_INIT_AUTOMAKE(foreign) dnl NB: Do not [quote] this parameter.
39 LT_INIT
41 dnl Check for basic C environment.
42 AC_PROG_CC_STDC
43 AC_PROG_INSTALL
44 AC_PROG_CPP
46 AC_C_PROTOTYPES
47 test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
49 AM_PROG_CC_C_O
51 AC_ARG_ENABLE([gcc-warnings],
52     [AS_HELP_STRING([--enable-gcc-warnings],
53                     [turn on lots of GCC warnings (for developers)])],
54      [case $enableval in
55       yes|no) ;;
56       *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
57       esac
58       gcc_warnings=$enableval],
59       [gcc_warnings=no]
61 if test "x$gcc_warnings" = "xyes"; then
62     WARNINGS_CFLAGS="-Wall -Werror"
63     AC_SUBST([WARNINGS_CFLAGS])
66 dnl Check if libc has program_invocation_short_name.
67 AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
69 dnl Check if __attribute__((cleanup(...))) works.
70 dnl XXX It would be nice to use AC_COMPILE_IFELSE here, but gcc just
71 dnl emits a warning for attributes that it doesn't understand.
72 AC_MSG_CHECKING([if __attribute__((cleanup(...))) works with this compiler])
73 AC_RUN_IFELSE([
74 AC_LANG_SOURCE([[
75 #include <stdio.h>
76 #include <stdlib.h>
78 void
79 freep (void *ptr)
81   exit (EXIT_SUCCESS);
84 void
85 test (void)
87   __attribute__((cleanup(freep))) char *ptr = malloc (100);
90 int
91 main (int argc, char *argv[])
93   test ();
94   exit (EXIT_FAILURE);
96 ]])
97     ],[
98     AC_MSG_RESULT([yes])
99     AC_DEFINE([HAVE_ATTRIBUTE_CLEANUP],[1],[Define to 1 if '__attribute__((cleanup(...)))' works with this compiler.])
100     ],[
101     AC_MSG_WARN(
102 ['__attribute__((cleanup(...)))' does not work.
104 You may not be using a sufficiently recent version of GCC or CLANG, or
105 you may be using a C compiler which does not support this attribute,
106 or the configure test may be wrong.
108 The code will still compile, but is likely to leak memory and other
109 resources when it runs.])])
111 dnl Check for Perl POD.
112 AC_CHECK_PROG([POD2MAN], [pod2man], [pod2man], [no])
113 AM_CONDITIONAL([HAVE_POD2MAN], [test "x$POD2MAN" != "xno"])
115 dnl Check for libvirt (only if you want to compile the libvirt plugin).
116 AC_ARG_WITH([libvirt],[
117     AS_HELP_STRING([--without-libvirt],
118                    [disable libvirt plugin @<:@default=check@:>@])],
119     [],
120     [with_libvirt=check])
121 AS_IF([test "$with_libvirt" != "no"],[
122     PKG_CHECK_MODULES([LIBVIRT], [libvirt],[
123         AC_SUBST([LIBVIRT_CFLAGS])
124         AC_SUBST([LIBVIRT_LIBS])
125         AC_DEFINE([HAVE_LIBVIRT],[1],[libvirt found at compile time.])
126     ],
127     [AC_MSG_WARN([libvirt not found, libvirt plugin will be disabled])])
129 AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"])
131 dnl Check for zlib (only if you want to compile the gzip plugin).
132 AC_ARG_WITH([zlib],[
133     AS_HELP_STRING([--without-zlib],
134                    [disable gzip plugin @<:@default=check@:>@])],
135     [],
136     [with_zlib=check])
137 AS_IF([test "$with_zlib" != "no"],[
138     PKG_CHECK_MODULES([ZLIB], [zlib],[
139         AC_SUBST([ZLIB_CFLAGS])
140         AC_SUBST([ZLIB_LIBS])
141         AC_DEFINE([HAVE_ZLIB],[1],[zlib found at compile time.])
142     ],
143     [AC_MSG_WARN([zlib not found, gzip plugin will be disabled])])
145 AM_CONDITIONAL([HAVE_ZLIB],[test "x$ZLIB_LIBS" != "x"])
147 dnl Check for liblzma (only if you want to compile the xz plugin).
148 AC_ARG_WITH([liblzma],[
149     AS_HELP_STRING([--without-liblzma],
150                    [disable xz plugin @<:@default=check@:>@])],
151     [],
152     [with_liblzma=check])
153 AS_IF([test "$with_liblzma" != "no"],[
154     PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
155         AC_SUBST([LIBLZMA_CFLAGS])
156         AC_SUBST([LIBLZMA_LIBS])
157         AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
158     ],
159     [AC_MSG_WARN([liblzma not found, xz plugin will be disabled])])
161 AM_CONDITIONAL([HAVE_LIBLZMA],[test "x$LIBLZMA_LIBS" != "x"])
163 dnl Produce output files.
164 AC_CONFIG_HEADERS([config.h])
165 AC_CONFIG_FILES([Makefile
166                  docs/Makefile
167                  include/Makefile
168                  plugins/Makefile
169                  plugins/example1/Makefile
170                  plugins/example2/Makefile
171                  plugins/example3/Makefile
172                  plugins/file/Makefile
173                  plugins/gzip/Makefile
174                  plugins/libvirt/Makefile
175                  plugins/xz/Makefile
176                  src/Makefile])
178 AC_OUTPUT