Add developer information to the README file.
[nbdkit/ericb.git] / configure.ac
blob76b7273b144062cb261f37d1032164324acc3554
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], [0.1.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 Produce output files.
116 AC_CONFIG_HEADERS([config.h])
117 AC_CONFIG_FILES([Makefile
118                  docs/Makefile
119                  include/Makefile
120                  plugins/Makefile
121                  plugins/example1/Makefile
122                  plugins/example2/Makefile
123                  plugins/example3/Makefile
124                  src/Makefile])
126 AC_OUTPUT