-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.in
284 lines (234 loc) · 9.41 KB
/
configure.in
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
dnl Process this file with autoconf to produce a configure script.
dnl This version of log4cplus requires the follwing autotools versions:
dnl autoconf-2.69
dnl automake-1.12
dnl libtool-2.4.2
AC_INIT([log4cplus],[1.0.4.1])
AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR([src/logger.cxx])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.12 no-define nostdinc gnu -Wall])
AM_PROG_AR
#
# +1 : ? : +1 == new interface that does not break old one
# +1 : ? : 0 == new interfac that breaks old one
# ? : ? : 0 == no new interfaces, but breaks apps
# ? :+1 : ? == just some internal changes, nothing breaks but might work
# better
# CURRENT : REVISION : AGE
LT_VERSION=4:0:0
AC_SUBST([LT_VERSION])
dnl Sane locale?
AH_TEMPLATE([LOG4CPLUS_WORKING_LOCALE],
[Define for compilers/standard libraries that support more than
just the "C" locale.])
AC_ARG_WITH([working-locale],
[AS_HELP_STRING([--with-working-locale],
[Use std::locale for char->wchar_t conversion.])],
[],
[with_working_locale=no])
AS_IF([test "x$with_working_locale" = "xyes"],
[AC_DEFINE([LOG4CPLUS_WORKING_LOCALE], [1])],
[])
dnl Debugging or release build?
AC_ARG_ENABLE([debugging],
[AS_HELP_STRING([--enable-debugging],
[Turns off optimization and adds switches that generate debugging
information.])],
[],
[enable_debugging=no])
AH_TEMPLATE([LOG4CPLUS_DEBUGGING],
[Defined for --enable-debugging builds.])
AS_IF([test "x$enable_debugging" = "xyes"],
[AC_DEFINE([LOG4CPLUS_DEBUGGING])
LOG4CPLUS_NDEBUG=-UNDEBUG],
[LOG4CPLUS_NDEBUG=-DNDEBUG])
AC_SUBST([LOG4CPLUS_NDEBUG])
dnl Turn warnings on/off?
AC_ARG_ENABLE([warnings],
[AC_HELP_STRING([--enable-warnings],
[Use compiler warnings option, e.g. -Wall. Enabled by default.])],
[],
[enable_warnings=yes])
dnl first check for c/c++ compilers
AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG([C++])
AS_CASE(["$target_os"],
[mingw*],
[dnl Undefining __STRICT_ANSI__ is a workaround for MinGW
dnl compilation problem. C++ <cwchar> header does not compile in
dnl GCC 4.4.0 because some functions like swprintf() are not
dnl visible.
CPPFLAGS="${CPPFLAGS} -U__STRICT_ANSI__"
CPPFLAGS="${CPPFLAGS} -DWIN32 -D_WIN32"
use_winsock_sockets=yes])
AM_CONDITIONAL([WINSOCK_SOCKETS], [test "x$use_winsock_sockets" = "xyes"])
dnl Check for compiler specifics.
AX_COMPILER_VENDOR
AS_IF([test "x$enable_warnings" = "xyes"],
[AS_CASE([$ax_cv_cxx_compiler_vendor],
dnl Skip all warnings detection for Solaris Studio compilers. It
dnl adds the -v option and that breaks PIC support detection.
[sun], [],
[AX_CXXFLAGS_WARN_ALL])])
AS_CASE([$ax_cv_cxx_compiler_vendor],
[gnu|clang],
[AS_IF([test "x$enable_warnings" = "xyes"],
[AX_CXXFLAGS_GCC_OPTION([-Wextra])
dnl The -ansi flag removes declarations of some useful functions
dnl from headers.
dnl AX_CXXFLAGS_GCC_OPTION([-ansi])
AX_CXXFLAGS_GCC_OPTION([-pedantic])
AX_CXXFLAGS_GCC_OPTION([-Wstrict-aliasing])
AX_CXXFLAGS_GCC_OPTION([-Wstrict-overflow])
dnl AX_CXXFLAGS_GCC_OPTION([-Weffc++])
AX_CXXFLAGS_GCC_OPTION([-Woverloaded-virtual])
AX_CXXFLAGS_GCC_OPTION([-Wold-style-cast])
dnl AX_CXXFLAGS_GCC_OPTION([-Wabi])
AX_CXXFLAGS_GCC_OPTION([-Wc++0x-compat])
dnl AX_CXXFLAGS_GCC_OPTION([-Wconversion])
AX_CXXFLAGS_GCC_OPTION([-Wundef])
AX_CXXFLAGS_GCC_OPTION([-Wshadow])
AX_CXXFLAGS_GCC_OPTION([-Wno-variadic-macros])])
AS_IF([test "x$enable_debugging" = "xyes"],
[AX_CXXFLAGS_GCC_OPTION([-g3])
AX_CXXFLAGS_GCC_OPTION([-fkeep-inline-functions])],
[AX_CXXFLAGS_GCC_OPTION([-O2])])
dnl The --enable-auto-import and --enable-runtime-pseudo-reloc
dnl options are required for log4cplus to work when compiled with
dnl Cygwin's GCC 4.3.x.
AS_CASE(["$target_os"],
[cygwin*|mingw*],
[LDFLAGS="${LDFLAGS} -Wl,--enable-auto-import"
LDFLAGS="${LDFLAGS} -Wl,--enable-runtime-pseudo-reloc"])],
[sun],
[AS_IF([test "x$enable_warnings" = "xyes"],
[dnl This test is disabled. See comment before
dnl AX_CXXFLAGS_WARN_ALL invocation.
dnl AX_CXXFLAGS_SUN_OPTION([-v])
AX_CXXFLAGS_SUN_OPTION([+w])]
)
AX_CXXFLAGS_SUN_OPTION([-library=stlport4])
AX_CXXFLAGS_SUN_OPTION([-library=Crun])])
AX_DECLSPEC([LOG4CPLUS_DECLSPEC])
AS_IF([test "x$ac_cv_declspec" = "xyes" || test "x$ac_cv__attribute__visibility" = "xyes"],
[AS_CASE([$ax_cv_cxx_compiler_vendor],
[gnu|clang],
[AS_IF([test "x$ac_cv_declspec" = "xyes" || test "x$ac_cv__attribute__visibility" = "xyes"],
[AX_CXXFLAGS_GCC_OPTION([-fvisibility=hidden])])])])
dnl Checks for libraries.
AC_SEARCH_LIBS([strerror], [cposix])
AC_SEARCH_LIBS([nanosleep], [rt])
AC_SEARCH_LIBS([clock_gettime], [rt posix4])
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([setsockopt], [socket])
dnl Windows/MinGW specific.
AC_LANG_PUSH([C])
AC_HAVE_LIBRARY([kernel32])
AC_HAVE_LIBRARY([advapi32])
AC_HAVE_LIBRARY([ws2_32])
AC_LANG_POP([C])
dnl Checks for header files.
AC_HEADER_STDC
LOG4CPLUS_CHECK_HEADER([sys/types.h], [LOG4CPLUS_HAVE_SYS_TYPES_H])
LOG4CPLUS_CHECK_HEADER([sys/socket.h], [LOG4CPLUS_HAVE_SYS_SOCKET_H])
LOG4CPLUS_CHECK_HEADER([sys/time.h], [LOG4CPLUS_HAVE_SYS_TIME_H])
LOG4CPLUS_CHECK_HEADER([sys/timeb.h], [LOG4CPLUS_HAVE_SYS_TIMEB_H])
LOG4CPLUS_CHECK_HEADER([sys/stat.h], [LOG4CPLUS_HAVE_SYS_STAT_H])
LOG4CPLUS_CHECK_HEADER([syslog.h], [LOG4CPLUS_HAVE_SYSLOG_H])
LOG4CPLUS_CHECK_HEADER([netinet/in.h], [LOG4CPLUS_HAVE_NETINET_IN_H])
LOG4CPLUS_CHECK_HEADER([netdb.h], [LOG4CPLUS_HAVE_NETDB_H])
LOG4CPLUS_CHECK_HEADER([unistd.h], [LOG4CPLUS_HAVE_UNISTD_H])
LOG4CPLUS_CHECK_HEADER([stdio.h], [LOG4CPLUS_HAVE_STDIO_H])
LOG4CPLUS_CHECK_HEADER([wchar.h], [LOG4CPLUS_HAVE_WCHAR_H])
LOG4CPLUS_CHECK_HEADER([stdarg.h], [LOG4CPLUS_HAVE_STDARG_H])
LOG4CPLUS_CHECK_HEADER([time.h], [LOG4CPLUS_HAVE_TIME_H])
LOG4CPLUS_CHECK_HEADER([errno.h], [LOG4CPLUS_HAVE_ERRNO_H])
dnl Checks for library functions.
LOG4CPLUS_CHECK_FUNCS([gmtime_r], [LOG4CPLUS_HAVE_GMTIME_R])
LOG4CPLUS_CHECK_FUNCS([localtime_r], [LOG4CPLUS_HAVE_LOCALTIME_R])
LOG4CPLUS_CHECK_FUNCS([gettimeofday], [LOG4CPLUS_HAVE_GETTIMEOFDAY])
LOG4CPLUS_CHECK_FUNCS([clock_gettime], [LOG4CPLUS_HAVE_CLOCK_GETTIME])
LOG4CPLUS_CHECK_FUNCS([getpid], [LOG4CPLUS_HAVE_GETPID])
LOG4CPLUS_CHECK_FUNCS([ftime], [LOG4CPLUS_HAVE_FTIME])
LOG4CPLUS_CHECK_FUNCS([stat], [LOG4CPLUS_HAVE_STAT])
LOG4CPLUS_CHECK_FUNCS([lstat], [LOG4CPLUS_HAVE_LSTAT])
LOG4CPLUS_CHECK_FUNCS([htons], [LOG4CPLUS_HAVE_HTONS])
LOG4CPLUS_CHECK_FUNCS([ntohs], [LOG4CPLUS_HAVE_NTOHS])
LOG4CPLUS_CHECK_FUNCS([htonl], [LOG4CPLUS_HAVE_HTONL])
LOG4CPLUS_CHECK_FUNCS([ntohl], [LOG4CPLUS_HAVE_NTOHL])
AH_TEMPLATE([LOG4CPLUS_HAVE_ENAMETOOLONG])
AC_CACHE_CHECK([for ENAMETOOLONG], [ax_cv_have_enametoolong],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <errno.h>], [int value = ENAMETOOLONG;])],
[ax_cv_have_enametoolong=yes],
[ax_cv_have_enametoolong=no])])
AS_IF([test "x$ax_cv_have_enametoolong" = "xyes"],
[AC_DEFINE([LOG4CPLUS_HAVE_ENAMETOOLONG])])
AH_TEMPLATE([LOG4CPLUS_HAVE_GETADDRINFO])
AX_GETADDRINFO
AS_IF([test "x$ax_cv_have_getaddrinfo" = "xyes"],
[AC_DEFINE([LOG4CPLUS_HAVE_GETADDRINFO])])
AH_TEMPLATE([LOG4CPLUS_HAVE_GETHOSTBYNAME_R])
AX_GETHOSTBYNAME_R
AS_IF([test "x$ax_cv_have_gethostbyname_r" = "xyes"],
[AC_DEFINE([LOG4CPLUS_HAVE_GETHOSTBYNAME_R])])
dnl Check for the existance of type socklen_t.
AX_TYPE_SOCKLEN_T
dnl Check for single-threaded compilation
AH_TEMPLATE([LOG4CPLUS_USE_PTHREADS])
AC_ARG_ENABLE([threads],
[AS_HELP_STRING([--enable-threads=yes/no],
[Use this option to create a singled-threaded version of this library])],
[AS_CASE(["${enableval}"],
[yes], [],
[no], [],
[AC_MSG_ERROR([bad value ${enableval} for --enable-threads])])],
[enable_threads=yes])
AS_IF([test x$enable_threads = xyes],
[AC_MSG_NOTICE([Creating a multi-threaded library.])
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
AS_CASE(["$target_os"],
[mingw*], [],
[ACX_PTHREAD([],
[AC_MSG_ERROR([Requested threads support but no threads were found.])])])
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"],
[AC_MSG_NOTICE([Creating a single-threaded library])
AC_DEFINE([LOG4CPLUS_SINGLE_THREADED], [1],
[Define if this is a single-threaded library.])])
AM_CONDITIONAL([MULTI_THREADED], [test x$enable_threads = xyes])
dnl Libtool setup.
dnl Must be latest to catch rpath compiled in by changes made during
dnl checks before.
LT_PREREQ([2.4.2])
LT_INIT([win32-dll])
AH_TOP([#ifndef LOG4CPLUS_CONFIG_H])
AH_TOP([#define LOG4CPLUS_CONFIG_H])
AH_BOTTOM([#endif // LOG4CPLUS_CONFIG_H])
AC_CONFIG_HEADERS([include/log4cplus/config.h])
AC_CONFIG_HEADERS([include/log4cplus/config/defines.hxx])
AC_CONFIG_FILES([Makefile
include/Makefile
src/Makefile
loggingserver/Makefile
tests/Makefile
tests/appender_test/Makefile
tests/configandwatch_test/Makefile
tests/customloglevel_test/Makefile
tests/fileappender_test/Makefile
tests/filter_test/Makefile
tests/hierarchy_test/Makefile
tests/loglog_test/Makefile
tests/ndc_test/Makefile
tests/ostream_test/Makefile
tests/patternlayout_test/Makefile
tests/performance_test/Makefile
tests/priority_test/Makefile
tests/propertyconfig_test/Makefile
tests/socket_test/Makefile
tests/thread_test/Makefile
tests/timeformat_test/Makefile])
AC_OUTPUT