forked from osamu0329nakamura/log4cxx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
489 lines (423 loc) · 12.7 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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
AC_INIT(src/main/cpp/logger.cpp)
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# autoconf 2.50 or higher to rebuild aclocal.m4, because the
# AC_CREATE_PREFIX_CONFIG_H macro needs the AS_DIRNAME macro.
AC_PREREQ(2.50)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
#
# +1 : ? : +1 == new interface that does not break old one
# +1 : ? : 0 == new interface 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=10:0:0
AC_SUBST(LT_VERSION)
AH_VERBATIM([HAVE_NO_EXPLICIT_EXPORTS],
[/* no explicit exports */
#define LOG4CXX_EXPORT])
AM_INIT_AUTOMAKE(log4cxx, 0.10.0)
# Checks for programs
# ----------------------------------------------------------------------------
AM_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_CXX([g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC QCC])
AC_PROG_CXXCPP
AC_LANG(C++)
# CXX fine tuning
case "$host" in
*-dec-osf*)
CXXFLAGS="$CXXFLAGS -std strict_ansi_errors"
;;
*)
;;
esac
# Doxygen
AC_ARG_ENABLE(doxygen,
AC_HELP_STRING(--enable-doxygen,
[enable documentation generation with doxygen (auto)]))
AC_ARG_ENABLE(dot,
AC_HELP_STRING(--enable-dot,
[use 'dot' to generate graphs in doxygen (auto)]))
AC_ARG_ENABLE(html-docs,
AC_HELP_STRING(--enable-html-docs,
[enable HTML generation with doxygen (yes)]),
[],
[enable_html_docs=yes])
AC_ARG_ENABLE(latex-docs,
AC_HELP_STRING(--enable-latex-docs,
[enable LaTeX documentation generation with doxygen (no)]),
[],
[enable_latex_docs=no])
if test "x$enable_doxygen" = xno; then
enable_doc=no
else
AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
if test "x$DOXYGEN" = x; then
if test "x$enable_doxygen" = xyes; then
AC_MSG_ERROR([could not find doxygen])
fi
enable_doc=no
else
enable_doc=yes
AC_PATH_PROG(DOT, dot, , $PATH)
fi
fi
AM_CONDITIONAL(DOC, test x$enable_doc = xyes)
AM_CONDITIONAL(LATEX_DOC, test x$enable_latex_docs = xyes)
if test x$DOT = x; then
if test "x$enable_dot" = xyes; then
AC_MSG_ERROR([could not find dot])
fi
enable_dot=no
else
enable_dot=yes
fi
manual_dest="manual"
base_dir=`(cd $srcdir && pwd)`
AC_SUBST(enable_dot)
AC_SUBST(enable_html_docs)
AC_SUBST(enable_latex_docs)
AC_SUBST(manual_dest)
AC_SUBST(base_dir)
# Checks header files
# ----------------------------------------------------------------------------
APR_FIND_APR( , , 1, 1)
if test "$apr_found" = "no"; then
AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.)
fi
CPPFLAGS="$CPPFLAGS `$apr_config --cppflags` `$apr_config --includes`"
APR_LIBS="`$apr_config --link-ld --libs`"
AC_SUBST(APR_LIBS)
LDFLAGS="$LDFLAGS $APR_LIBS"
APR_FIND_APU( , , 1, 1)
if test "$apu_found" = "no"; then
AC_MSG_ERROR(APR-util could not be located. Please use the --with-apr-util option.)
fi
CPPFLAGS="$CPPFLAGS `$apu_config --includes`"
APU_LIBS="`$apu_config --link-ld --libs`"
AC_SUBST(APU_LIBS)
LDFLAGS="$LDFLAGS $APU_LIBS"
# Checks local idioms
# ----------------------------------------------------------------------------
# for local syslog() function for SyslogAppender
AC_CHECK_FUNCS(mbsrtowcs, [have_mbsrtowcs=yes], [have_mbsrtowcs=no])
if test "$have_mbsrtowcs" = "yes"
then
AC_SUBST(HAS_MBSRTOWCS, 1)
else
AC_SUBST(HAS_MBSRTOWCS, 0)
fi
AC_CHECK_FUNCS(wcstombs, [have_wcstombs=yes], [have_wcstombs=no])
if test "$have_wcstombs" = "yes"
then
AC_SUBST(HAS_WCSTOMBS, 1)
else
AC_SUBST(HAS_WCSTOMBS, 0)
fi
# for local syslog() function for SyslogAppender
AC_CHECK_FUNCS(syslog, [have_syslog=yes], [have_syslog=no])
if test "$have_syslog" = "yes"
then
AC_SUBST(HAS_SYSLOG, 1)
else
AC_SUBST(HAS_SYSLOG, 0)
fi
AC_CHECK_HEADER([locale],have_locale=yes,have_locale=no)
if test "$have_locale" = "yes"
then
AC_SUBST(HAS_STD_LOCALE, 1)
else
AC_SUBST(HAS_STD_LOCALE, 0)
fi
AC_MSG_CHECKING([for wchar_t])
AC_COMPILE_IFELSE(AC_LANG_SOURCE([[
#include <string>
std::wstring w;]]), [have_wchar_t=yes], [have_wchar_t=no])
AC_MSG_RESULT($have_wchar_t)
if test "$have_wchar_t" = "yes"
then
AC_SUBST(HAS_WCHAR_T, 1)
else
AC_SUBST(HAS_WCHAR_T, 0)
fi
AC_CHECK_FUNCS(fwide, [have_fwide=yes], [have_fwide=no])
if test "$have_fwide" = "yes"
then
AC_SUBST(HAS_FWIDE, 1)
else
AC_SUBST(HAS_FWIDE, 0)
fi
# Checks for libraries
# ----------------------------------------------------------------------------
AC_PROG_RANLIB
#for ODBCAppender
AC_MSG_CHECKING(for ODBC support)
AC_ARG_WITH(ODBC,
AC_HELP_STRING(--with-ODBC, [ODBC support. Accepted arguments :
unixODBC, iODBC, Microsoft, no (default=no)]),
[ac_with_odbc=$withval],
[ac_with_odbc=no])
case "$ac_with_odbc" in
Microsoft)
AC_SUBST(HAS_ODBC, 1, ODBC support)
AC_MSG_RESULT(Microsoft)
LIBS_ODBC="-lodbc32"
;;
unixODBC)
AC_MSG_RESULT(unixODBC)
AC_CHECK_HEADER(sqlext.h,, AC_MSG_ERROR(unixODBC not found !))
AC_SUBST(HAS_ODBC, 1, ODBC support)
LIBS_ODBC="-lodbc"
;;
iODBC)
AC_MSG_RESULT(iODBC)
AC_CHECK_PROG(IODBC_CONFIG, iodbc-config, yes, no)
if test "x$IODBC_CONFIG" = "xyes"
then
AC_SUBST(HAS_ODBC, 1, ODBC support)
LIBS_ODBC="`iodbc-config --libs`"
CPPFLAGS_ODBC="`iodbc-config --cflags`"
else
AC_MSG_ERROR(iODBC not found !)
fi
;;
no)
AC_SUBST(HAS_ODBC, 0, No ODBC support)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(???)
AC_MSG_ERROR(Unknown option : $ac_with_odbc)
;;
esac
AC_SUBST(LIBS_ODBC)
AC_SUBST(CPPFLAGS_ODBC)
#for SMTPAppender
AC_MSG_CHECKING(for SMTP support)
AC_ARG_WITH(SMTP,
AC_HELP_STRING(--with-SMTP, [SMTP support. Accepted arguments :
libesmtp, no (default=no)]),
[ac_with_smtp=$withval],
[ac_with_smtp=no])
case "$ac_with_smtp" in
libesmtp)
AC_MSG_RESULT(libesmtp)
AC_CHECK_LIB([esmtp], [smtp_create_session],,
AC_MSG_ERROR(libesmtp library not found !),
-lesmtp)
AC_SUBST(HAS_LIBESMTP, 1, SMTP support through libesmtp library.)
LIBS="-lesmtp $LIBS"
;;
no)
AC_MSG_RESULT(no)
AC_SUBST(HAS_LIBESMTP, 0, SMTP support through libesmtp library.)
;;
*)
AC_MSG_RESULT(???)
AC_MSG_ERROR(Unknown option : $ac_with_smtp)
;;
esac
#for char api
AC_ARG_ENABLE(char,
AC_HELP_STRING(--enable-char,
[enable char API (yes)]))
if test "x$enable_char" = xno; then
have_char_api=no
else
have_char_api=yes
fi
if test "$have_char_api" = "yes"
then
AC_SUBST(CHAR_API, 1)
else
AC_SUBST(CHAR_API, 0)
fi
#for wchar_t api
AC_ARG_ENABLE(wchar_t,
AC_HELP_STRING(--enable-wchar_t,
[enable wchar_t API (yes if wchar_t available)]))
if test "x$enable_wchar_t" = xno; then
have_wchar_t_api=no
else
if test "$have_wchar_t" = "yes"
then
have_wchar_t_api=yes
else
have_wchar_t_api=no
fi
fi
if test "$have_wchar_t_api" = "yes"
then
AC_SUBST(WCHAR_T_API, 1)
else
AC_SUBST(WCHAR_T_API, 0)
fi
#for unichar api
AC_ARG_ENABLE(unichar,
AC_HELP_STRING(--enable-unichar,
[enable unichar API (no)]))
if test "x$enable_unichar" = "yes"
then
AC_SUBST(UNICHAR_API, 1)
else
AC_SUBST(UNICHAR_API, 0)
fi
#for cfstring api
AC_ARG_ENABLE(cfstring,
AC_HELP_STRING(--enable-cfstring,
[enable cfstring API (no)]))
if test "x$enable_cfstring" = xyes; then
AC_MSG_CHECKING([for cfstring])
CPPFLAGS="$CPPFLAGS -framework CoreFoundation"
AC_COMPILE_IFELSE(AC_LANG_SOURCE([[
#include <CoreFoundation/CFString.h>
CFStringRef x = CFSTR("Hello");]]), [have_cfstring_api=yes], [have_cfstring_api=no])
AC_MSG_RESULT($have_cfstring_api)
else
have_cfstring_api=no
fi
if test "$have_cfstring_api" = "yes"
then
AC_SUBST(CFSTRING_API, 1)
else
AC_SUBST(CFSTRING_API, 0)
fi
#determine charset type
AC_MSG_CHECKING([charset type])
AC_ARG_WITH(charset,
AC_HELP_STRING(--with-charset=TYPE, [locale charset.
Accepted TYPE variants: auto, utf-8, iso-8859-1, usascii, ebcdic (default=auto)]),
[ac_with_charset=$withval],
[ac_with_charset=auto])
case "$ac_with_charset" in
utf-8)
AC_MSG_RESULT(utf-8)
AC_SUBST(CHARSET_UTF8, 1)
AC_SUBST(CHARSET_ISO88591, 0)
AC_SUBST(CHARSET_USASCII, 0)
AC_SUBST(CHARSET_EBCDIC, 0)
;;
iso-8859-1)
AC_MSG_RESULT(iso-8859-1)
AC_SUBST(CHARSET_UTF8, 0)
AC_SUBST(CHARSET_ISO88591, 1)
AC_SUBST(CHARSET_USASCII, 0)
AC_SUBST(CHARSET_EBCDIC, 0)
;;
usascii)
AC_MSG_RESULT(usascii)
AC_SUBST(CHARSET_UTF8, 0)
AC_SUBST(CHARSET_ISO88591, 0)
AC_SUBST(CHARSET_USASCII, 1)
AC_SUBST(CHARSET_EBCDIC, 0)
;;
ebcdic)
AC_MSG_RESULT(usascii)
AC_SUBST(CHARSET_UTF8, 0)
AC_SUBST(CHARSET_ISO88591, 0)
AC_SUBST(CHARSET_USASCII, 0)
AC_SUBST(CHARSET_EBCDIC, 1)
;;
auto)
AC_MSG_RESULT(auto)
AC_SUBST(CHARSET_UTF8, 0)
AC_SUBST(CHARSET_ISO88591, 0)
AC_SUBST(CHARSET_USASCII, 0)
AC_SUBST(CHARSET_EBCDIC, 0)
;;
*)
AC_MSG_RESULT(???)
AC_MSG_ERROR(Invalid charset type: $ac_with_charset)
;;
esac
#determine logchar type
AC_MSG_CHECKING([logchar type])
AC_ARG_WITH(logchar,
AC_HELP_STRING(--with-logchar=TYPE, [type for logchar.
Accepted TYPE variants: utf-8, wchar_t, unichar (default=utf-8)]),
[ac_with_logchar=$withval],
[ac_with_logchar=utf-8])
case "$ac_with_logchar" in
utf-8)
AC_MSG_RESULT(utf-8)
AC_SUBST(LOGCHAR_IS_UTF8, 1)
AC_SUBST(LOGCHAR_IS_WCHAR, 0)
AC_SUBST(LOGCHAR_IS_UNICHAR, 0)
;;
wchar_t)
AC_MSG_RESULT(wchar_t)
AC_SUBST(LOGCHAR_IS_UTF8, 0)
AC_SUBST(LOGCHAR_IS_WCHAR, 1)
AC_SUBST(LOGCHAR_IS_UNICHAR, 0)
;;
unichar)
AC_MSG_RESULT(unichar)
AC_SUBST(LOGCHAR_IS_UTF8, 0)
AC_SUBST(LOGCHAR_IS_WCHAR, 0)
AC_SUBST(LOGCHAR_IS_UNICHAR, 1)
;;
*)
AC_MSG_RESULT(???)
AC_MSG_ERROR(Invalid logchar type: $ac_with_logchar)
;;
esac
# Create files
# ----------------------------------------------------------------------------
AC_CONFIG_FILES([
Makefile
liblog4cxx.pc
src/Makefile
src/main/Makefile
src/main/cpp/Makefile
src/main/include/Makefile
src/main/include/log4cxx/log4cxx.h
src/main/include/log4cxx/private/log4cxx_private.h
src/main/include/log4cxx/private/Makefile
src/main/include/log4cxx/Makefile
src/main/include/log4cxx/helpers/Makefile
src/main/include/log4cxx/net/Makefile
src/main/include/log4cxx/nt/Makefile
src/main/include/log4cxx/spi/Makefile
src/main/include/log4cxx/spi/location/Makefile
src/main/include/log4cxx/varia/Makefile
src/main/include/log4cxx/xml/Makefile
src/main/include/log4cxx/config/Makefile
src/main/include/log4cxx/db/Makefile
src/main/include/log4cxx/rolling/Makefile
src/main/include/log4cxx/pattern/Makefile
src/main/include/log4cxx/filter/Makefile
src/site/Makefile
src/site/doxy/Makefile
src/site/doxy/Doxyfile
src/test/Makefile
src/test/resources/Makefile
src/test/resources/input/Makefile
src/test/resources/input/ndc/Makefile
src/test/resources/input/rolling/Makefile
src/test/resources/input/xml/Makefile
src/test/cpp/Makefile
src/test/resources/witness/Makefile
src/test/resources/witness/encoding/Makefile
src/test/resources/witness/ndc/Makefile
src/test/resources/witness/rolling/Makefile
src/examples/Makefile
src/examples/cpp/Makefile
])
AC_OUTPUT