forked from jbreams/nagmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
143 lines (125 loc) · 3.85 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
AC_PREREQ([2.60])
AC_INIT([nagmq], [1.4], [[email protected]])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_SRCDIR([mods/nagmq_pub.c])
AC_CONFIG_HEADERS([mods/config.h dnxmq/config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_ARG_WITH([pcre-config],
[AC_HELP_STRING([--with-pcre-config],
[Path to PCRE configuration for mqexec filtering])],
[pcre_config_prog=$withval])
AC_PATH_PROG(PCRE_CONFIG, [pcre-config], $pcre_config_prog)
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
#AM_PROG_AR
LT_INIT
AC_CHECK_LIB([zmq], [zmq_socket], [],
[AC_MSG_FAILURE([Could not find usable ZMQ library])], [])
AC_HEADER_STDC
AC_CHECK_HEADERS([ctype.h fcntl.h float.h pthread.h signal.h stdarg.h \
sys/types.h syslog.h time.h zmq.h ev.h libev/ev.h])
AC_SEARCH_LIBS([ev_sleep], [ev])
AC_CHECK_HEADER([jansson.h], [], AC_MSG_FAILURE([jansson.h not found]), [])
AC_SEARCH_LIBS([json_loads], [jansson])
AC_SEARCH_LIBS([pthread_create], [pthread])
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([malloc realloc memset free strdup])
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRTOD
if test "x$PCRE_CONFIG" != "x"; then
CFLAGS_SAVE=$CFLAGS
LIBS_SAVE=$LIBS
CFLAGS="$CFLAGS $($PCRE_CONFIG --cflags)"
LIBS="$LIBS $($PCRE_CONFIG --libs)"
AC_CHECK_HEADER([pcre.h], [],
AC_MSG_FAILURE([PCRE was enabled but headers weren't found]), [])
AC_CHECK_LIB([pcre], [pcre_compile], [],
AC_MSG_FAILURE([PCRE was enabled but libraries weren't found]), [])
CFLAGS=$CFLAGS_SAVE
LIBS=$LIBS_SAVE
AC_SUBST([PCRE_HEADERS], $($PCRE_CONFIG --cflags))
AC_SUBST([PCRE_LIBS], $($PCRE_CONFIG --libs))
AC_DEFINE([HAVE_PCRE], [], [PCRE Libraries are installed])
fi
WITHHEADERS="no"
AC_ARG_WITH([icinga-headers],
[AC_HELP_STRING([--with-icinga-headers=DIR],
[Path to header files for Icinga])],
[
WITHHEADERS="-I$withval"
AC_DEFINE([HAVE_ICINGA], [], [Compiling against Icinga])
],
[
AC_CHECK_HEADER([icinga.h],
[AC_DEFINE([HAVE_ICINGA], [], [Compiling against Icinga])])
]
)
AC_ARG_WITH([nagios3-headers],
[AC_HELP_STRING([--with-nagios3-headers=DIR],
[Path to header files for Nagios])],
[
WITHEADERS="-I$withval"
AC_DEFINE([HAVE_NAGIOS3], [], [Compiling against Nagios 3])
]
)
AC_ARG_WITH([nagios4-src],
[AC_HELP_STRING([--with-nagios4-src=DIR],
[Path to source files for Nagios 4])],
[
WITHHEADERS="-I$withval/include -I$withval"
AC_DEFINE([HAVE_NAGIOS4], [], [Compiling against Nagios 4])
],
[
AC_CHECK_HEADERS([nagios/nagios.h nagios/lib/libnagios.h],
[
WITHHEADERS="-I/usr/include/nagios"
AC_DEFINE([HAVE_NAGIOS4], [], [Compiling against Nagios 4])
])
]
)
AC_ARG_WITH([naemon-src],
[AC_HELP_STRING([--with-naemon-src=DIR],
[Path to source files for Naemon])],
[
WITHHEADERS="-I$withval"
# For right now these are one and the same
AC_DEFINE([HAVE_NAGIOS4], [], [Compiling against Nagios 4.x])
AC_DEFINE([HAVE_NAEMON], [], [Compiling against Naemon])
]
)
CFLAGS_BAK=$CFLAGS
if test "$WITHHEADERS" = "no"; then
WITHHEADERS="-I./naginclude"
CFLAGS="$CFLAGS $WITHHEADERS"
fi
AC_SUBST([WITHHEADERS])
AC_CHECK_DECL([add_check_result_to_list(check_result **, check_result *)],
AC_DEFINE([HAVE_ADD_CHECK_RESULT_TWO], [], [Two parameter add_check_result_to_list]),
[], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_ICINGA
#include <icinga.h>
#else
#include <nagios.h>
#endif
#define __cplusplus])
AC_CHECK_DECL([add_check_result_to_list(check_result *)],
AC_DEFINE([HAVE_ADD_CHECK_RESULT_ONE], [], [One parameter add_check_result_to_list]),
[], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_ICINGA
#include <icinga.h>
#else
#include <nagios.h>
#endif
#define __cplusplus])
AC_CHECK_DECL([delete_downtime_by_hostname_service_description_start_time_comment],
AC_DEFINE([HAVE_DELETE_DOWNTIME_LONGNAME], [], [Have the really really long function name for deleting downtimes]),
[], [#include <downtime.h>])
CFLAGS=$CFLAGS_BAK
AC_CONFIG_FILES([Makefile mods/Makefile dnxmq/Makefile])
AC_OUTPUT