Fix build error with GCC6
[profile/ivi/log4cxx.git] / configure.in
1 AC_INIT(src/main/cpp/logger.cpp)
2
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements.  See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License.  You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # autoconf 2.50 or higher to rebuild aclocal.m4, because the
19 # AC_CREATE_PREFIX_CONFIG_H macro needs the AS_DIRNAME macro.
20 AC_PREREQ(2.50)
21
22 AC_CANONICAL_HOST
23 AC_CANONICAL_TARGET
24
25 #
26 # +1 : ? : +1  == new interface that does not break old one
27 # +1 : ? : 0   == new interface that breaks old one
28 #  ? : ? : 0   == no new interfaces, but breaks apps
29 #  ? :+1 : ?   == just some internal changes, nothing breaks but might work
30 #                 better
31 # CURRENT : REVISION : AGE
32 LT_VERSION=10:0:0
33
34 AC_SUBST(LT_VERSION)
35
36 AH_VERBATIM([HAVE_NO_EXPLICIT_EXPORTS],
37 [/* no explicit exports */
38 #define LOG4CXX_EXPORT])
39
40 AM_INIT_AUTOMAKE(log4cxx, 0.10.0)
41
42 # Checks for programs
43 # ----------------------------------------------------------------------------
44
45 AM_PROG_LIBTOOL
46 AC_PROG_INSTALL
47 AC_PROG_MAKE_SET
48
49 AC_PROG_CXX([g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC QCC])
50
51 AC_PROG_CXXCPP
52 AC_LANG(C++)
53
54 # CXX fine tuning
55 case "$host" in
56     *-dec-osf*)
57         CXXFLAGS="$CXXFLAGS -std strict_ansi_errors"
58         ;;
59     *)
60         ;;
61 esac
62
63 # Doxygen
64
65 AC_ARG_ENABLE(doxygen,
66         AC_HELP_STRING(--enable-doxygen,
67                 [enable documentation generation with doxygen (auto)]))
68
69 AC_ARG_ENABLE(dot,
70         AC_HELP_STRING(--enable-dot,
71                 [use 'dot' to generate graphs in doxygen (auto)]))
72
73 AC_ARG_ENABLE(html-docs,
74         AC_HELP_STRING(--enable-html-docs,
75                 [enable HTML generation with doxygen (yes)]),
76         [],
77         [enable_html_docs=yes])
78
79 AC_ARG_ENABLE(latex-docs,
80         AC_HELP_STRING(--enable-latex-docs,
81                 [enable LaTeX documentation generation with doxygen (no)]),
82         [],
83         [enable_latex_docs=no])
84
85 if test "x$enable_doxygen" = xno; then
86         enable_doc=no
87 else
88         AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
89         if test "x$DOXYGEN" = x; then
90                         if test "x$enable_doxygen" = xyes; then
91                                         AC_MSG_ERROR([could not find doxygen])
92                         fi
93                         enable_doc=no
94         else
95                         enable_doc=yes
96                         AC_PATH_PROG(DOT, dot, , $PATH)
97         fi
98 fi
99 AM_CONDITIONAL(DOC, test x$enable_doc = xyes)
100 AM_CONDITIONAL(LATEX_DOC, test x$enable_latex_docs = xyes)
101
102 if test x$DOT = x; then
103         if test "x$enable_dot" = xyes; then
104                 AC_MSG_ERROR([could not find dot])
105         fi
106         enable_dot=no
107 else
108         enable_dot=yes
109 fi
110
111 manual_dest="manual"
112 base_dir=`(cd $srcdir && pwd)`
113
114 AC_SUBST(enable_dot)
115 AC_SUBST(enable_html_docs)
116 AC_SUBST(enable_latex_docs)
117 AC_SUBST(manual_dest)
118 AC_SUBST(base_dir)
119
120
121
122
123 # Checks header files
124 # ----------------------------------------------------------------------------
125 APR_FIND_APR( , , 1, 1)
126 if test "$apr_found" = "no"; then
127   AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.)
128 fi
129
130 CPPFLAGS="$CPPFLAGS `$apr_config --cppflags` `$apr_config --includes`"
131 APR_LIBS="`$apr_config --link-ld --libs`"
132 AC_SUBST(APR_LIBS)
133 LDFLAGS="$LDFLAGS $APR_LIBS"
134
135 APR_FIND_APU( , , 1, 1)
136 if test "$apu_found" = "no"; then
137  AC_MSG_ERROR(APR-util could not be located. Please use the --with-apr-util option.)
138 fi
139
140 CPPFLAGS="$CPPFLAGS `$apu_config --includes`"
141 APU_LIBS="`$apu_config --link-ld --libs`"
142 AC_SUBST(APU_LIBS)
143 LDFLAGS="$LDFLAGS $APU_LIBS"
144
145 # Checks local idioms
146 # ----------------------------------------------------------------------------
147
148 # for local syslog() function for SyslogAppender
149 AC_CHECK_FUNCS(mbsrtowcs, [have_mbsrtowcs=yes], [have_mbsrtowcs=no])
150 if test "$have_mbsrtowcs" = "yes"
151 then
152  AC_SUBST(HAS_MBSRTOWCS, 1)
153 else
154  AC_SUBST(HAS_MBSRTOWCS, 0)
155 fi
156
157 AC_CHECK_FUNCS(wcstombs, [have_wcstombs=yes], [have_wcstombs=no])
158 if test "$have_wcstombs" = "yes"
159 then
160  AC_SUBST(HAS_WCSTOMBS, 1)
161 else
162  AC_SUBST(HAS_WCSTOMBS, 0)
163 fi
164
165 # for local syslog() function for SyslogAppender
166 AC_CHECK_FUNCS(syslog, [have_syslog=yes], [have_syslog=no])
167 if test "$have_syslog" = "yes"
168 then
169  AC_SUBST(HAS_SYSLOG, 1)
170 else
171  AC_SUBST(HAS_SYSLOG, 0)
172 fi
173
174 AC_CHECK_HEADER([locale],have_locale=yes,have_locale=no)
175 if test "$have_locale" = "yes"
176 then
177  AC_SUBST(HAS_STD_LOCALE, 1)
178 else
179  AC_SUBST(HAS_STD_LOCALE, 0)
180 fi
181
182 AC_MSG_CHECKING([for wchar_t])
183 AC_COMPILE_IFELSE(AC_LANG_SOURCE([[
184                    #include <string>
185                    std::wstring w;]]), [have_wchar_t=yes], [have_wchar_t=no])
186 AC_MSG_RESULT($have_wchar_t)
187 if test "$have_wchar_t" = "yes"
188 then
189  AC_SUBST(HAS_WCHAR_T, 1)
190 else
191  AC_SUBST(HAS_WCHAR_T, 0)
192 fi
193
194 AC_CHECK_FUNCS(fwide, [have_fwide=yes], [have_fwide=no])
195 if test "$have_fwide" = "yes"
196 then
197  AC_SUBST(HAS_FWIDE, 1)
198 else
199  AC_SUBST(HAS_FWIDE, 0)
200 fi
201
202
203 # Checks for libraries
204 # ----------------------------------------------------------------------------
205
206 AC_PROG_RANLIB
207
208
209 #for ODBCAppender
210 AC_MSG_CHECKING(for ODBC support)
211 AC_ARG_WITH(ODBC,
212         AC_HELP_STRING(--with-ODBC, [ODBC support. Accepted arguments :
213                 unixODBC, iODBC, Microsoft, no (default=no)]),
214         [ac_with_odbc=$withval],
215         [ac_with_odbc=no])
216 case "$ac_with_odbc" in
217     Microsoft)
218         AC_SUBST(HAS_ODBC, 1, ODBC support)
219         AC_MSG_RESULT(Microsoft)
220         LIBS_ODBC="-lodbc32"
221         ;;
222     unixODBC)
223         AC_MSG_RESULT(unixODBC)
224         AC_CHECK_HEADER(sqlext.h,, AC_MSG_ERROR(unixODBC not found !))
225         AC_SUBST(HAS_ODBC, 1, ODBC support)
226         LIBS_ODBC="-lodbc"
227         ;;
228     iODBC)
229         AC_MSG_RESULT(iODBC)
230         AC_CHECK_PROG(IODBC_CONFIG, iodbc-config, yes, no)
231         if test "x$IODBC_CONFIG" = "xyes"
232         then
233                 AC_SUBST(HAS_ODBC, 1, ODBC support)
234                 LIBS_ODBC="`iodbc-config --libs`"
235                 CPPFLAGS_ODBC="`iodbc-config --cflags`"
236         else
237                 AC_MSG_ERROR(iODBC not found !)
238         fi
239         ;;
240         no)
241         AC_SUBST(HAS_ODBC, 0, No ODBC support)
242         AC_MSG_RESULT(no)
243         ;;
244     *)
245         AC_MSG_RESULT(???)
246         AC_MSG_ERROR(Unknown option : $ac_with_odbc)
247         ;;
248 esac
249 AC_SUBST(LIBS_ODBC)
250 AC_SUBST(CPPFLAGS_ODBC)
251
252
253 #for SMTPAppender
254 AC_MSG_CHECKING(for SMTP support)
255 AC_ARG_WITH(SMTP,
256         AC_HELP_STRING(--with-SMTP, [SMTP support. Accepted arguments :
257                 libesmtp, no (default=no)]),
258         [ac_with_smtp=$withval],
259         [ac_with_smtp=no])
260 case "$ac_with_smtp" in
261     libesmtp)
262         AC_MSG_RESULT(libesmtp)
263         AC_CHECK_LIB([esmtp], [smtp_create_session],,
264                 AC_MSG_ERROR(libesmtp library not found !),
265                 -lesmtp)
266         AC_SUBST(HAS_LIBESMTP, 1, SMTP support through libesmtp library.)
267         LIBS="-lesmtp $LIBS"
268         ;;
269         no)
270         AC_MSG_RESULT(no)
271         AC_SUBST(HAS_LIBESMTP, 0, SMTP support through libesmtp library.)
272         ;;
273     *)
274         AC_MSG_RESULT(???)
275         AC_MSG_ERROR(Unknown option : $ac_with_smtp)
276         ;;
277 esac
278
279 #for char api
280 AC_ARG_ENABLE(char,
281         AC_HELP_STRING(--enable-char,
282                 [enable char API (yes)]))
283 if test "x$enable_char" = xno; then
284         have_char_api=no
285 else
286         have_char_api=yes
287 fi
288
289 if test "$have_char_api" = "yes"
290 then
291     AC_SUBST(CHAR_API, 1)
292 else
293     AC_SUBST(CHAR_API, 0)
294 fi
295
296 #for wchar_t api
297 AC_ARG_ENABLE(wchar_t,
298         AC_HELP_STRING(--enable-wchar_t,
299                 [enable wchar_t API (yes if wchar_t available)]))
300 if test "x$enable_wchar_t" = xno; then
301         have_wchar_t_api=no
302 else
303     if test "$have_wchar_t" = "yes"
304     then
305         have_wchar_t_api=yes
306     else
307         have_wchar_t_api=no
308     fi
309 fi
310
311 if test "$have_wchar_t_api" = "yes"
312 then
313     AC_SUBST(WCHAR_T_API, 1)
314 else
315     AC_SUBST(WCHAR_T_API, 0)
316 fi
317
318 #for unichar api
319 AC_ARG_ENABLE(unichar,
320         AC_HELP_STRING(--enable-unichar,
321                 [enable unichar API (no)]))
322 if test "x$enable_unichar" = "yes"
323 then
324     AC_SUBST(UNICHAR_API, 1)
325 else
326     AC_SUBST(UNICHAR_API, 0)
327 fi
328
329 #for cfstring api
330 AC_ARG_ENABLE(cfstring,
331         AC_HELP_STRING(--enable-cfstring,
332                 [enable cfstring API (no)]))
333 if test "x$enable_cfstring" = xyes; then
334         AC_MSG_CHECKING([for cfstring])
335         CPPFLAGS="$CPPFLAGS -framework CoreFoundation"
336         AC_COMPILE_IFELSE(AC_LANG_SOURCE([[
337                    #include <CoreFoundation/CFString.h>
338                    CFStringRef x = CFSTR("Hello");]]), [have_cfstring_api=yes], [have_cfstring_api=no])
339         AC_MSG_RESULT($have_cfstring_api)
340 else
341         have_cfstring_api=no
342 fi
343
344 if test "$have_cfstring_api" = "yes"
345 then
346     AC_SUBST(CFSTRING_API, 1)
347 else
348     AC_SUBST(CFSTRING_API, 0)
349 fi
350
351 #determine charset type
352 AC_MSG_CHECKING([charset type])
353 AC_ARG_WITH(charset,
354         AC_HELP_STRING(--with-charset=TYPE, [locale charset.
355                 Accepted TYPE variants: auto, utf-8, iso-8859-1, usascii, ebcdic (default=auto)]),
356         [ac_with_charset=$withval],
357         [ac_with_charset=auto])
358
359 case "$ac_with_charset" in
360     utf-8)
361         AC_MSG_RESULT(utf-8)
362         AC_SUBST(CHARSET_UTF8, 1)
363         AC_SUBST(CHARSET_ISO88591, 0)
364         AC_SUBST(CHARSET_USASCII, 0)
365         AC_SUBST(CHARSET_EBCDIC, 0)
366         ;;
367
368     iso-8859-1)
369         AC_MSG_RESULT(iso-8859-1)
370         AC_SUBST(CHARSET_UTF8, 0)
371         AC_SUBST(CHARSET_ISO88591, 1)
372         AC_SUBST(CHARSET_USASCII, 0)
373         AC_SUBST(CHARSET_EBCDIC, 0)
374         ;;
375
376     usascii)
377         AC_MSG_RESULT(usascii)
378         AC_SUBST(CHARSET_UTF8, 0)
379         AC_SUBST(CHARSET_ISO88591, 0)
380         AC_SUBST(CHARSET_USASCII, 1)
381         AC_SUBST(CHARSET_EBCDIC, 0)
382         ;;
383
384     ebcdic)
385         AC_MSG_RESULT(usascii)
386         AC_SUBST(CHARSET_UTF8, 0)
387         AC_SUBST(CHARSET_ISO88591, 0)
388         AC_SUBST(CHARSET_USASCII, 0)
389         AC_SUBST(CHARSET_EBCDIC, 1)
390         ;;
391
392     auto)
393         AC_MSG_RESULT(auto)
394         AC_SUBST(CHARSET_UTF8, 0)
395         AC_SUBST(CHARSET_ISO88591, 0)
396         AC_SUBST(CHARSET_USASCII, 0)
397         AC_SUBST(CHARSET_EBCDIC, 0)
398         ;;
399
400     *)
401         AC_MSG_RESULT(???)
402         AC_MSG_ERROR(Invalid charset type: $ac_with_charset)
403         ;;
404 esac
405
406
407
408 #determine logchar type
409 AC_MSG_CHECKING([logchar type])
410 AC_ARG_WITH(logchar,
411         AC_HELP_STRING(--with-logchar=TYPE, [type for logchar.
412                 Accepted TYPE variants: utf-8, wchar_t, unichar (default=utf-8)]),
413         [ac_with_logchar=$withval],
414         [ac_with_logchar=utf-8])
415
416 case "$ac_with_logchar" in
417     utf-8)
418         AC_MSG_RESULT(utf-8)
419         AC_SUBST(LOGCHAR_IS_UTF8, 1)
420         AC_SUBST(LOGCHAR_IS_WCHAR, 0)
421         AC_SUBST(LOGCHAR_IS_UNICHAR, 0)
422         ;;
423
424     wchar_t)
425         AC_MSG_RESULT(wchar_t)
426         AC_SUBST(LOGCHAR_IS_UTF8, 0)
427         AC_SUBST(LOGCHAR_IS_WCHAR, 1)
428         AC_SUBST(LOGCHAR_IS_UNICHAR, 0)
429         ;;
430
431     unichar)
432         AC_MSG_RESULT(unichar)
433         AC_SUBST(LOGCHAR_IS_UTF8, 0)
434         AC_SUBST(LOGCHAR_IS_WCHAR, 0)
435         AC_SUBST(LOGCHAR_IS_UNICHAR, 1)
436         ;;
437
438     *)
439         AC_MSG_RESULT(???)
440         AC_MSG_ERROR(Invalid logchar type: $ac_with_logchar)
441         ;;
442 esac
443
444
445
446 # Create files
447 # ----------------------------------------------------------------------------
448
449 AC_CONFIG_FILES([
450 Makefile
451 liblog4cxx.pc
452 src/Makefile
453 src/main/Makefile
454 src/main/cpp/Makefile
455 src/main/include/Makefile
456 src/main/include/log4cxx/log4cxx.h
457 src/main/include/log4cxx/private/log4cxx_private.h
458 src/main/include/log4cxx/private/Makefile
459 src/main/include/log4cxx/Makefile
460 src/main/include/log4cxx/helpers/Makefile
461 src/main/include/log4cxx/net/Makefile
462 src/main/include/log4cxx/nt/Makefile
463 src/main/include/log4cxx/spi/Makefile
464 src/main/include/log4cxx/spi/location/Makefile
465 src/main/include/log4cxx/varia/Makefile
466 src/main/include/log4cxx/xml/Makefile
467 src/main/include/log4cxx/config/Makefile
468 src/main/include/log4cxx/db/Makefile
469 src/main/include/log4cxx/rolling/Makefile
470 src/main/include/log4cxx/pattern/Makefile
471 src/main/include/log4cxx/filter/Makefile
472 src/site/Makefile
473 src/site/doxy/Makefile
474 src/site/doxy/Doxyfile
475 src/test/Makefile
476 src/test/resources/Makefile
477 src/test/resources/input/Makefile
478 src/test/resources/input/ndc/Makefile
479 src/test/resources/input/rolling/Makefile
480 src/test/resources/input/xml/Makefile
481 src/test/cpp/Makefile
482 src/test/resources/witness/Makefile
483 src/test/resources/witness/encoding/Makefile
484 src/test/resources/witness/ndc/Makefile
485 src/test/resources/witness/rolling/Makefile
486 src/examples/Makefile
487 src/examples/cpp/Makefile
488 ])
489 AC_OUTPUT