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 [developers@nsca-ng.org],
33 [http://www.nsca-ng.org/])
34 AC_CONFIG_SRCDIR([src/server/nsca-ng.c])
35 AC_CONFIG_MACRO_DIR([m4])
36 AC_CONFIG_LIBOBJ_DIR([lib])
37 AC_CONFIG_AUX_DIR([build-aux])
38 AC_CONFIG_TESTDIR([tests], [tests:src/client:src/server])
39 AM_INIT_AUTOMAKE([1.10 -Wall -Werror check-news])
40 AM_MAINTAINER_MODE([enable])
42 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) dnl Automake 1.11 added this.
44 # Set the release date.
45 RELEASE_DATE='November 15, 2016'
47 AC_SUBST([RELEASE_DATE])
49 # Check whether to build the client.
50 AC_ARG_ENABLE([client],
51 [AS_HELP_STRING([--enable-client],
52 [build the NSCA-ng client [default: yes]])],
53 [nsca_enable_client=$enable_client],
54 [nsca_enable_client=yes])
55 AC_MSG_CHECKING([whether the NSCA-ng client should be built])
56 AS_IF([test "x$nsca_enable_client" = xyes],
57 [AC_MSG_RESULT([yes])],
58 [AC_MSG_RESULT([no])])
60 # Check whether to build the server.
61 AC_ARG_ENABLE([server],
62 [AS_HELP_STRING([--enable-server],
63 [build the NSCA-ng server [default: no]])],
64 [nsca_enable_server=$enable_server],
65 [nsca_enable_server=no])
66 AC_MSG_CHECKING([whether the NSCA-ng server should be built])
67 AS_IF([test "x$nsca_enable_server" = xyes],
68 [AC_MSG_RESULT([yes])],
69 [AC_MSG_RESULT([no])])
71 # Check whether to use the POSIX AIO API.
72 AC_ARG_ENABLE([posix-aio],
73 [AS_HELP_STRING([--disable-posix-aio],
74 [do not use the POSIX AIO API [default: auto-detect]])],
75 [nsca_enable_posix_aio=$enable_posix_aio],
76 [nsca_enable_posix_aio=yes])
78 # Bail out if neither the client nor the server should be built.
79 AS_IF([test "x$nsca_enable_client" = xno && test "x$nsca_enable_server" = xno],
80 [AC_MSG_ERROR([Please specify --enable-client and/or --enable-server])])
82 # Tell Automake whether to build the client and/or server.
83 AM_CONDITIONAL([BUILD_CLIENT], [test "x$nsca_enable_client" = xyes])
84 AM_CONDITIONAL([BUILD_SERVER], [test "x$nsca_enable_server" = xyes])
87 AC_USE_SYSTEM_EXTENSIONS
95 m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl Automake 1.11.2 added this.
97 AM_CONDITIONAL([GCC], [test "x$GCC" = xyes])
99 # Check for libraries.
103 AS_IF([test "x$nsca_enable_server" = xyes],
107 AS_IF([test "x$nsca_enable_posix_aio" = xyes],
110 # Tell Automake about some of our check results.
111 AM_CONDITIONAL([USE_EMBEDDED_EV],
112 [test "x$nsca_lib_ev_embedded" = xyes])
113 AM_CONDITIONAL([USE_EMBEDDED_PIDFILE],
114 [test "x$nsca_lib_pidfile_embedded" = xyes])
115 AM_CONDITIONAL([HAVE_FLOCK],
116 [test "x$nsca_func_flock" = xyes])
118 # Check for header files.
120 AC_CHECK_HEADERS([inttypes.h])
122 # Check for typedefs, structures, and compiler characteristics.
126 AS_IF([test "x$nsca_enable_server" = xyes],
131 # Check for library functions.
137 AC_REPLACE_FUNCS([strdup strcasecmp strncasecmp])
138 AS_IF([test "x$nsca_enable_client" = xyes],
139 [AC_CHECK_FUNCS([nanosleep])])
140 AS_IF([test "x$nsca_enable_server" = xyes],
141 [AC_CHECK_FUNCS([closefrom])
144 # Communicate the PIPE_BUF value to Autotest.
145 AC_COMPUTE_INT([nsca_pipe_buf], [PIPE_BUF], [[#include <limits.h>]],
147 AC_SUBST([nsca_pipe_buf])
149 # Spit out the results.
150 AC_CONFIG_HEADERS([config.h])
171 AC_MSG_NOTICE([summary of build options:
173 Build NSCA-ng client: $nsca_enable_client
174 Build NSCA-ng server: $nsca_enable_server
175 Use embedded libev: $nsca_lib_ev_embedded
179 dnl vim:set joinspaces textwidth=80 filetype=m4: