forked from rsyslog/liblognorm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
162 lines (144 loc) · 4.86 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
-*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT([liblognorm], [1.1.2.master], [[email protected]])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_SRCDIR([src/lognorm.c])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CC_C99
if test "$GCC" = "yes"
then CFLAGS="$CFLAGS -W -Wall -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute -g"
fi
AC_PROG_LIBTOOL
# Checks for libraries.
save_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS(clock_gettime, rt)
LIBS=$save_LIBS
# Checks for header files.
AC_HEADER_STDC
#AC_CHECK_HEADERS([])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
#AC_HEADER_TIME
#AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
#AC_CHECK_FUNCS([])
LIBLOGNORM_CFLAGS="-I\$(top_srcdir)/src"
LIBLOGNORM_LIBS="\$(top_builddir)/src/liblognorm.la"
AC_SUBST(LIBLOGNORM_CFLAGS)
AC_SUBST(LIBLOGNORM_LIBS)
# modules we require
PKG_CHECK_MODULES(LIBESTR, libestr >= 0.0.0)
PKG_CHECK_MODULES(JSON_C, json-c,, [PKG_CHECK_MODULES(JSON_C, json)])
CFLAGS_BEFORE="$CFLAGS"
LIBS_BEFORE="$LIBS"
CFLAGS="$CFLAGS $JSON_C_CFLAGS"
LIBS="$LIBS $JSON_C_LIBS"
AC_CHECK_FUNCS(json_object_object_get_ex,,)
AC_CHECK_FUNCS(json_object_get_string_len,,)
AC_CHECK_TYPES(json_bool,,,[#include <json.h>])
AC_CHECK_FUNCS(json_object_get_int64,,)
AC_CHECK_FUNCS(json_object_new_int64,,)
AC_CHECK_MEMBERS([json_object_iter.key],,,[#include <json.h>])
LIBS="$LIBS_BEFORE"
CFLAGS="$CFLAGS_BEFORE"
# Regular expressions
AC_ARG_ENABLE(regexp,
[AS_HELP_STRING([--enable-regexp],[Enable regular expressions support @<:@default=no@:>@])],
[case "${enableval}" in
yes) enable_regexp="yes" ;;
no) enable_regexp="no" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-regexp) ;;
esac],
[enable_regexp="no"]
)
AM_CONDITIONAL(ENABLE_REGEXP, test x$enable_regexp = xyes)
if test "$enable_regexp" = "yes"; then
PKG_CHECK_MODULES(PCRE, libpcre)
AC_DEFINE(FEATURE_REGEXP, 1, [Regular expressions support enabled.])
FEATURE_REGEXP=1
else
FEATURE_REGEXP=0
fi
AC_SUBST(FEATURE_REGEXP)
# debug mode settings
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],[Enable debug mode @<:@default=no@:>@])],
[case "${enableval}" in
yes) enable_debug="yes" ;;
no) enable_debug="no" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],
[enable_debug="no"]
)
if test "$enable_debug" = "yes"; then
AC_DEFINE(DEBUG, 1, [Defined if debug mode is enabled.])
fi
if test "$enable_debug" = "no"; then
AC_DEFINE(NDEBUG, 1, [Defined if debug mode is disabled.])
fi
# docs (html) build settings
AC_ARG_ENABLE(docs,
[AS_HELP_STRING([--enable-docs],[Enable building HTML docs (requires Sphinx) @<:@default=no@:>@])],
[case "${enableval}" in
yes) enable_docs="yes" ;;
no) enable_docs="no" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-docs) ;;
esac],
[enable_docs="no"]
)
if test "$enable_docs" = "yes"; then
AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build3 sphinx-build2], [no])
if test "$SPHINXBUILD" = "no"; then
AC_MSG_ERROR([sphinx-build is required to build documentation, install it or try --disable-docs])
fi
fi
AM_CONDITIONAL([ENABLE_DOCS], [test "$enable_docs" = "yes"])
AC_ARG_ENABLE(testbench,
[AS_HELP_STRING([--enable-testbench],[testbench enabled @<:@default=no@:>@])],
[case "${enableval}" in
yes) enable_testbench="yes" ;;
no) enable_testbench="no" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-testbench) ;;
esac],
[enable_testbench=no]
)
AM_CONDITIONAL(ENABLE_TESTBENCH, test x$enable_testbench = xyes)
AC_ARG_ENABLE(valgrind,
[AS_HELP_STRING([--enable-valgrind],[valgrind enabled @<:@default=no@:>@])],
[case "${enableval}" in
yes) enable_valgrind="yes" ;;
no) enable_valgrind=="no" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;;
esac],
[enable_valgrind=no]
)
AM_CONDITIONAL(ENABLE_VALGRIND, test x$enable_valgrind = xyes)
VALGRIND="$enable_valgrind"
AC_SUBST(VALGRIND)
AC_CONFIG_FILES([Makefile \
lognorm.pc \
doc/Makefile \
src/Makefile \
src/lognorm-features.h \
tests/Makefile \
tests/options.sh])
AC_OUTPUT
AC_CONFIG_MACRO_DIR([m4])
echo "*****************************************************"
echo "liblognorm will be compiled with the following settings:"
echo
echo "Regex enabled: $enable_regexp"
echo "Testbench enabled: $enable_testbench"
echo "Valgrind enabled: $enable_valgrind"
echo "Debug mode enabled: $enable_debug"
echo "Docs enabled: $enable_docs"