Update code to work with OpenSSL 1.1
[nsca-ng.git] / configure.ac
blob00501266fbc190a379eefb4407fc0a1e91248014
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   [1.4],
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_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='October 14, 2014'
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])
86 # Check for programs.
87 AC_USE_SYSTEM_EXTENSIONS
88 AC_PROG_CC
89 AM_PROG_CC_C_O
90 AC_PROG_CC_STDC
91 AC_PROG_INSTALL
92 AC_PROG_MKDIR_P
93 AC_PROG_RANLIB
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.
100 NSCA_LIB_NETWORKING
101 NSCA_LIB_EV
102 NSCA_LIB_OPENSSL
103 AS_IF([test "x$nsca_enable_server" = xyes],
104   [NSCA_LIB_CONFUSE
105    NSCA_LIB_SYSTEMD
106    NSCA_LIB_PIDFILE
107    AS_IF([test "x$nsca_enable_posix_aio" = xyes],
108      [NSCA_LIB_AIO])])
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.
119 AC_HEADER_STDBOOL
120 AC_CHECK_HEADERS([inttypes.h])
122 # Check for typedefs, structures, and compiler characteristics.
123 AC_C_INLINE
124 AC_C_RESTRICT
125 AC_TYPE_SIZE_T
126 AS_IF([test "x$nsca_enable_server" = xyes],
127   [AC_TYPE_SSIZE_T
128    AC_TYPE_INTMAX_T
129    AC_TYPE_PID_T])
131 # Check for library functions.
132 HW_FUNC_VSNPRINTF
133 HW_FUNC_SNPRINTF
134 HW_FUNC_VASPRINTF
135 HW_FUNC_ASPRINTF
136 NSCA_FUNC_PROGNAME
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])
142    NSCA_FUNC_DAEMON])
144 # Communicate the PIPE_BUF value to Autotest.
145 AC_COMPUTE_INT([nsca_pipe_buf], [PIPE_BUF], [[#include <limits.h>]],
146   [nsca_pipe_buf=512])
147 AC_SUBST([nsca_pipe_buf])
149 # Spit out the results.
150 AC_CONFIG_HEADERS([config.h])
151 AC_CONFIG_FILES([
152   Makefile
153   build-aux/Makefile
154   contrib/Makefile
155   etc/Makefile
156   lib/Makefile
157   lib/ev/Makefile
158   lib/pidfile/Makefile
159   man/Makefile
160   python/Makefile
161   src/Makefile
162   src/client/Makefile
163   src/common/Makefile
164   src/server/Makefile
165   tests/Makefile
166   tests/atlocal])
168 AC_OUTPUT
170 AC_MSG_NOTICE([summary of build options:
172   Build NSCA-ng client: $nsca_enable_client
173   Build NSCA-ng server: $nsca_enable_server
174   Use embedded libev:   $nsca_lib_ev_embedded
175   Compiler:             $CC
178 dnl vim:set joinspaces textwidth=80 filetype=m4: