NSCA-ng 0.3
[nsca-ng.git] / configure.ac
blobafc926e4256b1e59a1f7d5431460cb24d2b27697
1 # Process this file with autoconf(1) to produce a configure script.
3 # Copyright (c) 2013 Holger Weiss <holger@weiss.in-berlin.de>
4 # All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
9 # 1. Redistributions of source code must retain the above copyright notice, this
10 #    list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright notice,
13 #    this list of conditions and the following disclaimer in the documentation
14 #    and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 # DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 # Autotools initialization.
28 AC_PREREQ([2.60]) dnl But Autoconf 2.63 is required for AC_INIT's URL parameter.
29 AC_INIT([NSCA-ng],
30   [0.3],
31   [developers@nsca-ng.org],
32   [nsca-ng],
33   [http://www.nsca-ng.org/])
34 AC_CONFIG_SRCDIR([src/server/nsca-ng.c])
35 AC_CONFIG_LIBOBJ_DIR([lib])
36 AC_CONFIG_AUX_DIR([build-aux])
37 AC_CONFIG_TESTDIR([tests], [tests:src/client:src/server])
38 AM_INIT_AUTOMAKE([1.10 -Wall -Werror check-news])
40 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) dnl Automake 1.11 added this.
42 # Set the release date.
43 RELEASE_DATE='February 25, 2013'
45 AC_SUBST([RELEASE_DATE])
47 # Check whether to build the client.
48 AC_ARG_ENABLE([client],
49   [AS_HELP_STRING([--enable-client],
50     [build the NSCA-ng client [default: yes]])],
51   [nsca_enable_client=$enable_client],
52   [nsca_enable_client=yes])
53 AC_MSG_CHECKING([whether the NSCA-ng client should be built])
54 AS_IF([test "x$nsca_enable_client" = xyes],
55   [AC_MSG_RESULT([yes])],
56   [AC_MSG_RESULT([no])])
58 # Check whether to build the server.
59 AC_ARG_ENABLE([server],
60   [AS_HELP_STRING([--enable-server],
61     [build the NSCA-ng server [default: no]])],
62   [nsca_enable_server=$enable_server],
63   [nsca_enable_server=no])
64 AC_MSG_CHECKING([whether the NSCA-ng server should be built])
65 AS_IF([test "x$nsca_enable_server" = xyes],
66   [AC_MSG_RESULT([yes])],
67   [AC_MSG_RESULT([no])])
69 # Check whether to use the POSIX AIO API.
70 AC_ARG_ENABLE([posix-aio],
71   [AS_HELP_STRING([--disable-posix-aio],
72     [do not use the POSIX AIO API [default: auto-detect]])],
73   [nsca_enable_posix_aio=$enable_posix_aio],
74   [nsca_enable_posix_aio=yes])
76 # Bail out if neither the client nor the server should be built.
77 AS_IF([test "x$nsca_enable_client" = xno && test "x$nsca_enable_server" = xno],
78   [AC_MSG_ERROR([Please specify --enable-client and/or --enable-server])])
80 # Tell Automake whether to build the client and/or server.
81 AM_CONDITIONAL([BUILD_CLIENT], [test "x$nsca_enable_client" = xyes])
82 AM_CONDITIONAL([BUILD_SERVER], [test "x$nsca_enable_server" = xyes])
84 # Check for programs.
85 AC_USE_SYSTEM_EXTENSIONS
86 AC_PROG_CC
87 AM_PROG_CC_C_O
88 AC_PROG_CC_STDC
89 AC_PROG_INSTALL
90 AC_PROG_MKDIR_P
91 AC_PROG_RANLIB
93 m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl Automake 1.11.2 added this.
95 AM_CONDITIONAL([GCC], [test "x$GCC" = xyes])
97 # Check for libraries.
98 NSCA_LIB_NETWORKING
99 NSCA_LIB_EV
100 NSCA_LIB_OPENSSL
101 AS_IF([test "x$nsca_enable_server" = xyes],
102   [NSCA_LIB_CONFUSE
103    NSCA_LIB_PIDFILE
104    AS_IF([test "x$nsca_enable_posix_aio" = xyes],
105      [NSCA_LIB_AIO])])
107 # Tell Automake about some of our check results.
108 AM_CONDITIONAL([USE_EMBEDDED_EV],
109   [test "x$nsca_lib_ev_embedded" = xyes])
110 AM_CONDITIONAL([USE_EMBEDDED_PIDFILE],
111   [test "x$nsca_lib_pidfile_embedded" = xyes])
112 AM_CONDITIONAL([HAVE_FLOCK],
113   [test "x$nsca_func_flock" = xyes])
115 # Check for header files.
116 AC_HEADER_STDBOOL
117 AC_CHECK_HEADERS([inttypes.h])
119 # Check for typedefs, structures, and compiler characteristics.
120 AC_C_INLINE
121 AC_C_RESTRICT
122 AC_TYPE_SIZE_T
123 AS_IF([test "x$nsca_enable_server" = xyes],
124   [AC_TYPE_SSIZE_T
125    AC_TYPE_INTMAX_T
126    AC_TYPE_PID_T])
128 # Check for library functions.
129 HW_FUNC_VSNPRINTF
130 HW_FUNC_SNPRINTF
131 HW_FUNC_VASPRINTF
132 HW_FUNC_ASPRINTF
133 NSCA_FUNC_PROGNAME
134 AC_REPLACE_FUNCS([strdup strcasecmp strncasecmp])
135 AS_IF([test "x$nsca_enable_client" = xyes],
136   [AC_CHECK_FUNCS([nanosleep])])
137 AS_IF([test "x$nsca_enable_server" = xyes],
138   [NSCA_FUNC_DAEMON])
140 # Communicate the PIPE_BUF value to Autotest.
141 AC_COMPUTE_INT([nsca_pipe_buf], [PIPE_BUF], [[#include <limits.h>]],
142   [nsca_pipe_buf=unknown])
143 AC_SUBST([nsca_pipe_buf])
145 # Spit out the results.
146 AC_CONFIG_HEADERS([config.h])
147 AC_CONFIG_FILES([
148   Makefile
149   build-aux/Makefile
150   contrib/Makefile
151   etc/Makefile
152   lib/Makefile
153   lib/ev/Makefile
154   lib/pidfile/Makefile
155   man/Makefile
156   src/Makefile
157   src/client/Makefile
158   src/common/Makefile
159   src/server/Makefile
160   tests/Makefile
161   tests/atlocal])
163 AC_OUTPUT
165 AC_MSG_NOTICE([summary of build options:
167   Build NSCA-ng client: $nsca_enable_client
168   Build NSCA-ng server: $nsca_enable_server
169   Use embedded libev:   $nsca_lib_ev_embedded
170   Compiler:             $CC
173 dnl vim:set joinspaces textwidth=80 filetype=m4: