1 # Process this file with autoconf(1) to produce a configure script.
3 # Copyright (c) 2013 Holger Weiss <holger@weiss.in-berlin.de>
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.
31 [holger@weiss.in-berlin.de],
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 8, 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])
85 AC_USE_SYSTEM_EXTENSIONS
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.
101 AS_IF([test "x$nsca_enable_server" = xyes],
104 AS_IF([test "x$nsca_enable_posix_aio" = xyes],
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.
117 AC_CHECK_HEADERS([inttypes.h])
119 # Check for typedefs, structures, and compiler characteristics.
123 AS_IF([test "x$nsca_enable_server" = xyes],
128 # Check for library functions.
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],
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])
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
173 dnl vim:set joinspaces textwidth=80 filetype=m4: