Debian Codegraph @

configure.in

raw ◀ ▶
Source reconstructed at patch state 0 of 6 — not the installed (fully patched) source.
6 Debian patches touch this file
1 dnl /* ====================================================================
2 dnl * The Kannel Software License, Version 1.0
3 dnl *
4 dnl * Copyright (c) 2001-2018 Kannel Group
5 dnl * Copyright (c) 1998-2001 WapIT Ltd.
6 dnl * All rights reserved.
7 dnl *
8 dnl * Redistribution and use in source and binary forms, with or without
9 dnl * modification, are permitted provided that the following conditions
10 dnl * are met:
11 dnl *
12 dnl * 1. Redistributions of source code must retain the above copyright
13 dnl * notice, this list of conditions and the following disclaimer.
14 dnl *
15 dnl * 2. Redistributions in binary form must reproduce the above copyright
16 dnl * notice, this list of conditions and the following disclaimer in
17 dnl * the documentation and/or other materials provided with the
18 dnl * distribution.
19 dnl *
20 dnl * 3. The end-user documentation included with the redistribution,
21 dnl * if any, must include the following acknowledgment:
22 dnl * "This product includes software developed by the
23 dnl * Kannel Group (http://www.kannel.org/)."
24 dnl * Alternately, this acknowledgment may appear in the software itself,
25 dnl * if and wherever such third-party acknowledgments normally appear.
26 dnl *
27 dnl * 4. The names "Kannel" and "Kannel Group" must not be used to
28 dnl * endorse or promote products derived from this software without
29 dnl * prior written permission. For written permission, please
30 dnl * contact [email protected].
31 dnl *
32 dnl * 5. Products derived from this software may not be called "Kannel",
33 dnl * nor may "Kannel" appear in their name, without prior written
34 dnl * permission of the Kannel Group.
35 dnl *
36 dnl * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37 dnl * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38 dnl * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39 dnl * DISCLAIMED. IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS
40 dnl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
41 dnl * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
42 dnl * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43 dnl * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44 dnl * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
45 dnl * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46 dnl * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47 dnl * ====================================================================
48 dnl *
49 dnl * This software consists of voluntary contributions made by many
50 dnl * individuals on behalf of the Kannel Group. For more information on
51 dnl * the Kannel Group, please see <http://www.kannel.org/>.
52 dnl *
53 dnl * Portions of this software are based upon software originally written at
54 dnl * WapIT Ltd., Helsinki, Finland for the Kannel project.
55 dnl */
56
57 dnl
58 dnl configure.in -- main autoconf macro definition file
59 dnl
60 dnl Process this file with autoconf to produce a configure script.
61 dnl
62
63 dnl initialization
64
65 AC_PREREQ(2.5)
66
67 AC_INIT(gw/alt_charsets.h)
68 AC_CONFIG_HEADER(gw-config.h)
69 AC_SUBST(SHELL)
70 AC_CONFIG_AUX_DIR(.)
71 AC_SET_TERMINAL_SEQUENCES()
72 AC_CONFIG_NICE(config.nice)
73
74 dnl Check gateway version number.
75 VERSION=`head -n 1 VERSION`
76 if test "x$VERSION" = "xsvn"; then
77 AC_MSG_CHECKING([svn checkout revision])
78 AC_SVN_REVISION(SVN_REVISION)
79 AC_MSG_RESULT([$SVN_REVISION])
80 VERSION="$VERSION-r$SVN_REVISION"
81 fi
82 AC_DEFINE_UNQUOTED(GW_NAME, "Kannel")
83 AC_DEFINE_UNQUOTED(GW_VERSION, "$VERSION")
84 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
85 AC_SUBST(GW_VERSION)
86 AC_SUBST(VERSION)
87 AC_CONFIG_SECTION([Configuring for Kannel gateway version $VERSION])
88
89 AM_INIT_AUTOMAKE(Kannel,$VERSION)
90 AC_LANG_C
91 AC_DISABLE_STATIC
92 AC_PROG_LIBTOOL
93 dnl AC_SUBST(LIBTOOL_DEPS)
94
95 dnl Solaris pkgadd support definitions
96 PKGADD_PKG="KANNELgateway"
97 PKGADD_NAME="Kannel - WAP and SMS gateway"
98 PKGADD_VENDOR="www.kannel.org"
99 AC_SUBST(PKGADD_PKG)
100 AC_SUBST(PKGADD_NAME)
101 AC_SUBST(PKGADD_VENDOR)
102
103 dnl Target installation directory for documentation
104 AC_SUBST(docdir)
105 docdir='${prefix}/share/doc/kannel'
106
107 dnl Checks system type.
108 AC_CONFIG_SECTION([Running system checks])
109 AC_CANONICAL_HOST
110
111 dnl Checks for programs.
112
113 AC_PROG_CC
114 AC_PROG_CC_C99
115 if test "$ac_cv_prog_cc_c99" = "no"; then
116 AC_MSG_ERROR(["Kannel requires a C compiler that supports ISO C99."])
117 fi
118 AC_PROG_INSTALL
119 AC_PROG_RANLIB
120 AC_PROG_YACC
121 AC_PROG_LEX
122 AC_CHECK_TOOL(AR, ar)
123 AC_PATH_PROG(CONVERT, convert)
124 AC_PATH_PROG(PERL, perl)
125
126 dnl Apply system specific rules.
127 dnl Executable extension for systems that need one, i.e. Cygwin
128 dnl Set the LIBTOOL to be used to create libs
129 EXE_EXT=""
130 OLD_LIBTOOL="$AR rc"
131 case "$host" in
132 *-sun-solaris*)
133 CFLAGS="$CFLAGS -DSunOS=1"
134 ;;
135 *-cygwin*)
136 EXE_EXT=".exe"
137 LDFLAGS="$LDFLAGS -Wl,--enable-auto-import"
138 ;;
139 *apple-darwin*)
140 # MacOS X
141 # Lets try to find the newest installed SDK for compilation
142 # so we know how to link against it.
143 # If we find a SDK, we use that rather then the standard /usr
144 # location libs and includes.
145 found=0
146 SDK=""
147 for loc in "MacOSX10.7.sdk" "MacOSX10.6.sdk" "MacOSX10.5.sdk" "MacOSX10.4u.sdk" "MacOSX10.4.0.sdk" "MacOSX10.3.9.sdk" \
148 "MacOSX10.3.0.sdk" "MacOSX10.2.8.sdk" "MacOSX10.1.5.sdk"
149 do
150 if test "$found" = "0" ; then
151 if test -d "/Developer/SDKs/${E}" ; then
152 found="1"
153 SDK="${loc}"
154 fi
155 fi
156 done
157 if test "$SDK" != "" ; then
158 CFLAGS="$CFLAGS -DDARWIN=1 -L/Developer/SDKs/${SDK}/usr/lib -I/Developer/SDKs/${SDK}/usr/include"
159 else
160 CFLAGS="$CFLAGS -DDARWIN=1"
161 fi
162 OLD_LIBTOOL="libtool -static -o"
163 ;;
164 *-linux-*)
165 CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
166 LDFLAGS="$LDFLAGS -rdynamic"
167 ;;
168 *-*-openbsd* | *-*-freebsd*)
169 CFLAGS="$CFLAGS -pthread"
170 AC_CHECK_LIB(pthread, pthread_exit, [LIBS="$LIBS -lpthread"; pthread="yes"],
171 [AC_CHECK_LIB(c_r, pthread_exit, [LIBS="$LIBS -lc_r"; pthread="yes"])]
172 )
173 ;;
174 *-interix3*)
175 INSTALL="./install-sh"
176 ;;
177 esac
178 AC_SUBST(EXE_EXT)
179 AC_SUBST(OLD_LIBTOOL)
180
181 AC_ARG_WITH(cflags,
182 [ --with-cflags=FLAGS use FLAGS for CFLAGS],
183 CFLAGS="$CFLAGS $withval")
184
185 AC_ARG_WITH(libs,
186 [ --with-libs=FLAGS use FLAGS for extra libraries],
187 LIBS="$LIBS $withval")
188
189 dnl Check whether compiler supports inline
190 AC_C_INLINE
191
192 dnl Check for how to do large files
193
194 AC_SYS_LARGEFILE(CFLAGS)
195 if test "${ac_cv_sys_file_offset_bits}" != no ; then
196 CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=${ac_cv_sys_file_offset_bits}"
197 fi
198 if test "${ac_cv_sys_large_files}" != no ; then
199 CFLAGS="$CFLAGS -D_LARGE_FILES=${ac_cv_sys_large_files}"
200 fi
201
202 dnl Check for word sizes.
203
204 AC_CHECK_SIZEOF(short, 2)
205 AC_CHECK_SIZEOF(int, 4)
206 AC_CHECK_SIZEOF(long, 4)
207 AC_CHECK_SIZEOF(long long, 8)
208 SIZEOF_SHORT=$ac_cv_sizeof_short
209 SIZEOF_INT=$ac_cv_sizeof_int
210 SIZEOF_LONG=$ac_cv_sizeof_long
211 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
212 AC_SUBST(SIZEOF_SHORT)
213 AC_SUBST(SIZEOF_INT)
214 AC_SUBST(SIZEOF_LONG)
215 AC_SUBST(SIZEOF_LONG_LONG)
216
217 dnl Checks for libraries.
218
219 AC_CHECK_LIB(m, log)
220 AC_CHECK_LIB(socket, accept)
221 AC_CHECK_LIB(nsl, inet_ntoa)
222 AC_CHECK_LIB(resolv, inet_ntop)
223 AC_CHECK_LIB(bind, inet_ntop)
224 if test -z "$pthread"; then
225 AC_CHECK_LIB(pthread, pthread_exit, [LIBS="$LIBS -lpthread"])
226 fi
227 AC_CHECK_LIB(iconv, libiconv, [LIBS="$LIBS -liconv"])
228
229 dnl Checks for header files.
230
231 AC_HEADER_STDC
232 AC_CHECK_HEADERS(sys/ioctl.h sys/time.h sys/types.h unistd.h sys/poll.h)
233 AC_CHECK_HEADERS(pthread.h getopt.h syslog.h zlib.h execinfo.h stdlib.h)
234 AC_CHECK_HEADERS([sys/socket.h sys/sockio.h netinet/in.h])
235 AC_CHECK_HEADERS([net/if.h], [], [],
236 [#include <stdio.h>
237 #if STDC_HEADERS
238 # include <stdlib.h>
239 # include <stddef.h>
240 #else
241 #if HAVE_STDLIB_H
242 # include <stdlib.h>
243 # endif
244 #endif
245 #if HAVE_SYS_SOCKET_H
246 # include <sys/socket.h>
247 #endif
248 ])
249 AC_CHECK_HEADERS([sys/ucontext.h], [AC_DEFINE(HAVE_UCONTEXT)],
250 [AC_MSG_WARN(System lacks ucontext.h - user context support)]
251 )
252
253 dnl Checks for typedefs, structures, and compiler characteristics.
254
255 AC_TRY_COMPILE(, [char *func = __FUNCTION__;],
256 AC_DEFINE(HAVE___FUNCTION__))
257 AC_TRY_COMPILE(, [char *func = __func__;],
258 AC_DEFINE(HAVE___FUNC__))
259
260 dnl check for iconv
261 AM_ICONV
262
263 dnl Checks for library functions.
264
265 AC_CHECK_FUNCS(gettimeofday select socket strdup getopt_long localtime_r gmtime_r backtrace srandom initgroups strtoll strtoq)
266 AC_CHECK_FUNC(getopt, [], [AC_LIBOBJ([utils/attgetopt])])
267
268 dnl Check if we have reentrant gethostbyname and which one
269 AC_CHECK_FUNC(gethostbyname_r, [ AC_FUNC_WHICH_GETHOSTBYNAME_R ], [
270 AC_CHECK_FUNC(gethostbyname,[], [
271 AC_MSG_ERROR([Couldnot find gethostbyname_r nor gethostbyname functions])])]
272 )
273
274 dnl Extra feature checks
275
276 dnl GW_HAVE_TYPE_FROM(HDRNAME, TYPE, HAVENAME, DESCRIPTION)
277 AC_DEFUN([GW_HAVE_TYPE_FROM], [
278 AC_CACHE_CHECK([for $2 in <$1>], gw_cv_type_$3,
279 AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
280 #include <sys/types.h>
281 #endif
282 #include <$1>
283 ], [$2 foo;],
284 gw_cv_type_$3=yes, gw_cv_type_$3=no))
285 if test $gw_cv_type_$3 = yes; then
286 AC_DEFINE($3, 1, $4)
287 fi
288 ])
289
290 dnl GW_HAVE_FUNC_FROM(HDRNAME, FUNC, HAVENAME, DESCRIPTION)
291 AC_DEFUN([GW_HAVE_FUNC_FROM], [
292 AC_CACHE_CHECK([for $2 in <$1>], gw_cv_func_$3,
293 AC_TRY_COMPILE([#include <$1>], [void *foo = $2;],
294 gw_cv_func_$3=yes, gw_cv_func_$3=no))
295 if test $gw_cv_func_$3 = yes; then
296 AC_DEFINE($3, 1, $4)
297 fi
298 ])
299
300 GW_HAVE_TYPE_FROM(sys/socket.h,
301 socklen_t,
302 HAVE_SOCKLEN_T,
303 [Defined if there is a socklen_t in <sys/socket.h>])
304
305 GW_HAVE_FUNC_FROM(stdio.h, getopt, HAVE_GETOPT_IN_STDIO_H,
306 [Does <stdio.h> declare getopt()?])
307 GW_HAVE_FUNC_FROM(unistd.h, getopt, HAVE_GETOPT_IN_UNISTD_H,
308 [Does <unistd.h> declare getopt()?])
309
310 dnl POSIX nftw()
311
312 AC_CHECK_HEADERS(ftw.h, [
313 AC_CHECK_FUNC(nftw, [
314 AC_DEFINE(HAVE_NFTW)
315 ])
316 ])
317
318
319 dnl POSIX regular expression check
320
321 AC_CHECK_HEADERS(regex.h, [
322 AC_CHECK_FUNC(regcomp, [
323 AC_DEFINE(HAVE_REGEX)
324 has_posix_regex=1
325 ])
326 ])
327
328
329 dnl Misc feature checks
330
331 AC_CONFIG_SECTION([Checking for POSIX threads support])
332
333 AC_MSG_CHECKING(for working pthreads)
334 AC_TRY_RUN([#include <pthread.h>
335 #include <unistd.h>
336 int pid;
337 void testpid(void* foo);
338 int main(void){
339 pthread_t child;
340 pid=getpid();
341 pthread_create(&child,NULL,(void*)testpid,NULL);
342 pthread_join(child,NULL);
343 return 0;
344 }
345 void testpid(void* foo){
346 int mypid=getpid();
347 if(mypid!=pid){
348 /* Pthreads states that all threads should have the same PID
349 * we dont!
350 */
351 exit(1);
352 }else{
353 exit(0);
354 }
355 }
356 ],echo yes , echo no ;CFLAGS="$CFLAGS -DBROKEN_PTHREADS=1", echo Cross compiling - assuming they work)
357
358 dnl
359 dnl Checking pthread_spin support
360 dnl
361 AC_MSG_CHECKING([for pthread_spinlock support])
362 AC_TRY_COMPILE([#include <pthread.h>], [
363 #ifdef __INTERIX
364 /*
365 * interix has experimental spinlock support and this doesn't work very well
366 * therefore disable it for now
367 */
368 pthread_spinlock_t_failed lock;
369 #else
370 pthread_spinlock_t lock;
371 #endif
372 pthread_spin_init(&lock, 0);
373 pthread_spin_lock(&lock);
374 pthread_spin_unlock(&lock);
375 pthread_spin_destroy(&lock);
376 ], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PTHREAD_SPINLOCK_T)], AC_MSG_RESULT(no))
377
378 dnl checking pthread_rwlock support
379 AC_MSG_CHECKING([for pthread_rwlock support])
380 AC_TRY_COMPILE([#include <pthread.h>], [
381 pthread_rwlock_t lock;
382 pthread_rwlock_init(&lock, NULL);
383 pthread_rwlock_rdlock(&lock);
384 pthread_rwlock_unlock(&lock);
385 pthread_rwlock_wrlock(&lock);
386 pthread_rwlock_unlock(&lock);
387 pthread_rwlock_destroy(&lock);
388 ], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PTHREAD_RWLOCK)], AC_MSG_RESULT(no), [
389 AC_MSG_RESULT(Cross compiling - assuming suuported) ; AC_DEFINE(HAVE_PTHREAD_RWLOCK)])
390
391 dnl checking for native semaphore support
392 dnl Solaris & HP-UX needs librt.
393 AC_CHECK_LIB(rt, sem_init)
394 AC_MSG_CHECKING([for semaphore support])
395 AC_TRY_RUN([#include <semaphore.h>
396 int main(void) {
397 sem_t s;
398 int val;
399 /* DARWNIN doesn't implement native sem_init */
400 if (sem_init(&s, 0, 1) != 0)
401 return 1;
402 sem_wait(&s);
403 sem_post(&s);
404 sem_getvalue(&s, &val);
405 sem_destroy(&s);
406 return 0;
407 }
408 ], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SEMAPHORE)], AC_MSG_RESULT(no), [
409 AC_MSG_RESULT(Cross compiling - assuming suuported) ; AC_DEFINE(HAVE_SEMAPHORE)])
410
411 dnl Check if we have libxml2 installed and which version it is.
412 dnl Kannel requires currently at least version 2.6.0 of libxml2.
413
414 AC_CONFIG_SECTION([Checking for libxml2 support])
415 xml_ver_required="2.6.0"
416 AC_PATH_PROGS(XML_CONFIG, xml2-config xml-config, no)
417 if test "$XML_CONFIG" = "no"; then
418 AC_MSG_ERROR([You MUST have the libxml2 (aka gnome-xml) library installed])
419 else
420 AC_MSG_CHECKING([libxml version])
421 xml_version=`$XML_CONFIG --version`
422 AC_MSG_RESULT([$xml_version])
423 AC_CHECK_VERSION($xml_version, $xml_ver_required,
424 [ LIBS="$LIBS `$XML_CONFIG --libs`"
425 CFLAGS="$CFLAGS `$XML_CONFIG --cflags`"
426 ],[
427 AC_MSG_ERROR([libxml2 version $xml_version is too old. You need at least $xml_ver_required])
428 ])
429 fi
430
431
432 dnl Implement the --enable-pcre option. This will set HAVE_PCRE in gw-config.h
433 dnl accordingly and enable the usage of Perl compatible regular expressions.
434 dnl As POSIX regex is a subset of PCRE, we map the posixpcre API calls, so
435 dnl HAVE_REGEX has to be undefined.
436
437 AC_CONFIG_SECTION([Configuring for PCRE support])
438 AC_MSG_CHECKING([whether to compile with PCRE support])
439 AC_ARG_ENABLE(pcre,
440 [ --enable-pcre enable PCRE regex support @<:@disabled@:>@], [
441 if test "$enableval" != yes; then
442 AC_MSG_RESULT(disabled)
443 else
444 AC_MSG_RESULT(searching)
445 AC_PATH_PROGS(PCRE_CONFIG, pcre-config, no)
446 if test "$PCRE_CONFIG" = "no"; then
447 AC_MSG_ERROR(Unable to find pcre-config in path for PCRE support)
448 else
449 AC_MSG_CHECKING([PCRE version])
450 pcre_version=`$PCRE_CONFIG --version`
451 AC_MSG_RESULT([$pcre_version])
452 LIBS="$LIBS `$PCRE_CONFIG --libs-posix`"
453 CFLAGS="$CFLAGS `$PCRE_CONFIG --cflags-posix`"
454 AC_MSG_CHECKING([for POSIX regex provider])
455 AC_MSG_RESULT([PCRE library])
456 AC_CHECK_HEADERS(pcreposix.h)
457 AC_CHECK_LIB(pcreposix, regcomp)
458 AC_CHECK_HEADERS(pcre.h)
459 AC_CHECK_FUNCS(pcre_compile)
460 AC_DEFINE(HAVE_PCRE)
461 AC_DEFINE_UNQUOTED(LIBPCRE_VERSION, "$pcre_version")
462 PCRE="yes"
463 fi
464 fi
465 ],[
466 AC_MSG_RESULT(disabled)
467 ])
468
469
470 dnl DocBook stuff
471
472 AC_CONFIG_SECTION([Configuring DocBook support])
473 AC_CHECK_PROGS(JADE, [jade openjade], no)
474 AC_CHECK_PROG(JADETEX, jadetex, jadetex, no)
475 AC_CHECK_PROG(PDFJADETEX, pdfjadetex, pdfjadetex, no)
476 AC_CHECK_PROG(DVIPS, dvips, dvips, no)
477 AC_CHECK_PROG(FIG2DEV, fig2dev, fig2dev, no)
478 AC_CHECK_PROG(CONVERT, convert, convert, no)
479 AC_SUBST(HTML_DSL)
480 found=""
481 for loc in /usr /usr/local /sw /opt/local; do
482 if test "x$found" = "x" ; then
483 for file in ${loc}/lib/sgml/stylesheet/dsssl/docbook/nwalsh/html/docbook.dsl \
484 ${loc}/lib/sgml/stylesheets/nwalsh-modular/html/docbook.dsl \
485 ${loc}/share/sgml/docbook/dsssl-stylesheets-1.*/html/docbook.dsl \
486 ${loc}/share/sgml/docbook/dsssl-stylesheets/html/docbook.dsl \
487 ${loc}/share/sgml/docbook/stylesheet/dsssl/modular/html/docbook.dsl \
488 ${loc}/share/sgml/docbook/dsssl/modular/html/docbook.dsl \
489 ${loc}/share/sgml/dsssl/docbook-dsssl-nwalsh/html/docbook.dsl \
490 ${loc}/share/dsssl/docbook-dsssl/html/docbook.dsl ; do
491 if test "x$found" = "x" ; then
492 AC_CHECK_FILE($file,HTML_DSL=$file; found=1)
493 fi
494 done
495 fi
496 done
497 AC_SUBST(TEX_DSL)
498 found=""
499 for loc in /usr /usr/local /sw /opt/local; do
500 if test "x$found" = "x" ; then
501 for file in ${loc}/lib/sgml/stylesheet/dsssl/docbook/nwalsh/print/docbook.dsl \
502 ${loc}/lib/sgml/stylesheets/nwalsh-modular/print/docbook.dsl \
503 ${loc}/share/sgml/docbook/dsssl-stylesheets-1.*/print/docbook.dsl \
504 ${loc}/share/sgml/docbook/dsssl-stylesheets/print/docbook.dsl \
505 ${loc}/share/sgml/docbook/stylesheet/dsssl/modular/print/docbook.dsl \
506 ${loc}/share/sgml/docbook/dsssl/modular/print/docbook.dsl \
507 ${loc}/share/sgml/dsssl/docbook-dsssl-nwalsh/print/docbook.dsl \
508 ${loc}/share/dsssl/docbook-dsssl/print/docbook.dsl ; do
509 if test "x$found" = "x" ; then
510 AC_CHECK_FILE($file,TEX_DSL=$file; found=1)
511 fi
512 done
513 fi
514 done
515 AC_SUBST(XML_DCL)
516 found=""
517 for loc in /usr /usr/local /sw /opt/local; do
518 if test "x$found" = "x" ; then
519 for file in ${loc}/lib/sgml/stylesheet/dsssl/docbook/nwalsh/dtds/decls/xml.dcl \
520 ${loc}/lib/sgml/stylesheets/nwalsh-modular/dtds/decls/xml.dcl \
521 ${loc}/share/sgml/docbook/dsssl-stylesheets-1.*/dtds/decls/xml.dcl \
522 ${loc}/share/sgml/docbook/dsssl-stylesheets/dtds/decls/xml.dcl \
523 ${loc}/share/sgml/docbook/stylesheet/dsssl/modular/dtds/decls/xml.dcl \
524 ${loc}/share/sgml/docbook/dsssl/modular/dtds/decls/xml.dcl \
525 ${loc}/share/sgml/declaration/xml.dcl \
526 ${loc}/share/sgml/dsssl/docbook-dsssl-nwalsh/dtds/decls/xml.dcl \
527 ${loc}/share/dsssl/docbook-dsssl/dtds/decls/xml.dcl ; do
528 if test "x$found" = "x" ; then
529 AC_CHECK_FILE($file,XML_DCL=$file; found=1)
530 fi
531 done
532 fi
533 done
534
535 dnl Implement --enable-warnings option.
536
537 AC_ARG_ENABLE(warnings,
538 [ --enable-warnings enable compilation warnings @<:@disabled@:>@], [
539 echo enabling compilation warnings
540 if test -n "$GCC"; then
541 CFLAGS="$CFLAGS -Wall"
542 CFLAGS="$CFLAGS -Wmissing-prototypes"
543 CFLAGS="$CFLAGS -Wmissing-declarations"
544 CFLAGS="$CFLAGS -Wnested-externs"
545 CFLAGS="$CFLAGS -Winline"
546 CFLAGS="$CFLAGS -Wformat -Wformat-security -Wmissing-format-attribute"
547 #CFLAGS="$CFLAGS -Wstrict-prototypes"
548 #CFLAGS="$CFLAGS -Wredundant-decls"
549 #CFLAGS="$CFLAGS -Wconversion"
550 fi
551 ])
552
553 dnl Implement --enable-docs option.
554
555 AC_SUBST(DOCSTARGET)
556
557 AC_ARG_ENABLE(docs,
558 [ --enable-docs enable building of documentation @<:@enabled@:>@], [
559 if test "$enableval" = "yes"
560 then
561 DOCSTARGET="docs"
562 else
563 DOCSTARGET="no-docs"
564 fi
565 ])
566
567 if test "x$HTML_DSL" = "x" -o "x$TEX_DSL" = "x" \
568 || test "$JADE" = "no" \
569 || test "$JADETEX" = "no" \
570 || test "$PDFJADETEX" = "no" \
571 || test "$DVIPS" = "no" \
572 || test "$FIG2DEV" = "no" \
573 || test "$CONVERT" = "no" \
574 || test "$DOCSTARGET" = "no-docs"
575 then
576 DOCSTARGET="no-docs"
577 else
578 DOCSTARGET="docs"
579 fi
580
581 case "$DOCSTARGET" in
582 no-docs) AC_MSG_RESULT(Not building documentation.) ;;
583 docs) AC_MSG_RESULT(Documentation will be built as well.) ;;
584 esac
585
586 dnl Implement --enable-drafts option.
587
588 AC_SUBST(DOCDRAFTS)
589 DOCDRAFTS="IGNORE"
590
591 AC_ARG_ENABLE(drafts,
592 [ --enable-drafts enable building of documentation drafts @<:@disabled@:>@], [
593 if test "$enableval" = "yes"
594 then
595 DOCDRAFTS="INCLUDE"
596 else
597 DOCDRAFTS="IGNORE"
598 fi
599 ])
600 if test "x$DOCSTARGET" = "xdocs"
601 then
602 case "$DOCDRAFTS" in
603 INCLUDE) AC_MSG_RESULT(Documentation will include drafts.) ;;
604 esac
605 fi
606
607
608 AC_CONFIG_SECTION([Configuring parameters])
609
610 dnl Implement --with-suffix=version option.
611
612 SUFFIX=""
613
614 AC_ARG_WITH(suffix,
615 [ --with-suffix=VERSION set suffix for binaries @<:@foobox-VERSION@:>@], [
616 if test "x$withval" != "x" ; then
617 SUFFIX=$withval
618 fi
619 ])
620
621 dnl Implement --enable-suffix option.
622
623 AC_ARG_ENABLE(suffix,
624 [ --enable-suffix enable suffix for binaries @<:@disabled@:>@], [
625 if test "$enableval" = "yes" ; then
626 SUFFIX="-$VERSION"
627 else
628 SUFFIX=""
629 fi
630 ])
631
632 if test "x$SUFFIX" != "x" ; then
633 AC_MSG_CHECKING(whether to append suffix to binary)
634 AC_MSG_RESULT($SUFFIX)
635 fi
636
637 AC_DEFINE_UNQUOTED(SUFFIX, "$SUFFIX")
638 AC_SUBST(SUFFIX)
639
640
641 dnl Implement --with-defaults=speed/debug option.
642
643 AC_ARG_WITH(defaults,
644 [ --with-defaults=OPTION set default configure options: speed/debug @<:@speed@:>@
645 this will set assertion checking and malloc wrapper accordingly
646 speed = native malloc + no assertions
647 debug = checking malloc + assertions], [
648 case "$withval" in
649 speed) assertiondefault=no
650 mallocdefault=native
651 ;;
652 debug) assertiondefault=yes
653 mallocdefault=check
654 ;;
655 *) echo "unknown --with-defaults parameter $withval"
656 exit 1
657 ;;
658 esac
659 ], [
660 dnl defaults to native malloc but with assertions
661 assertiondefault=yes
662 mallocdefault=native
663 ])
664
665
666 dnl Implement --with-malloc=[native|check|slow] option.
667
668 AC_MSG_CHECKING(which malloc to use)
669 AC_ARG_WITH(malloc,
670 [ --with-malloc=OPTION select malloc wrapper to use: native/check/slow @<:@native@:>@], [
671 case "$withval" in
672 native) AC_DEFINE(USE_GWMEM_NATIVE)
673 AC_MSG_RESULT(native malloc)
674 ;;
675 check) AC_DEFINE(USE_GWMEM_CHECK)
676 AC_MSG_RESULT(checking malloc)
677 ;;
678 slow) AC_DEFINE(USE_GWMEM_SLOW)
679 AC_MSG_RESULT(slow malloc)
680 ;;
681 *) echo "Unknown malloc wrapper $withval. Oops."; exit 1 ;;
682 esac
683 ], [
684 case "$mallocdefault" in
685 check) AC_DEFINE(USE_GWMEM_CHECK)
686 AC_MSG_RESULT(checking malloc)
687 ;;
688 slow) AC_DEFINE(USE_GWMEM_SLOW)
689 AC_MSG_RESULT(slow malloc)
690 ;;
691 *) AC_DEFINE(USE_GWMEM_NATIVE)
692 AC_MSG_RESULT(native malloc)
693 ;;
694 esac
695 ])
696
697
698 dnl Implement --disable-assertions option.
699
700 AC_ARG_ENABLE(assertions,
701 [ --disable-assertions turn off assertion checking], [
702 if test "$enableval" = "no"
703 then
704 echo disabling assertion checking
705 AC_DEFINE(NO_GWASSERT)
706 fi
707 ], [
708 if test "$assertiondefault" = "no"
709 then
710 echo disabling assertion checking
711 AC_DEFINE(NO_GWASSERT)
712 fi
713 ])
714
715
716 dnl Implement the --enable-pam option.
717
718 AC_ARG_ENABLE(pam,
719 [ --enable-pam enable PAM authentication @<:@disabled@:>@], [
720 if test "$enableval" = "yes"
721 then
722 AC_CHECK_LIB(pam, pam_end)
723 AC_CHECK_LIB(dl,main)
724 AC_CHECK_HEADERS(security/pam_appl.h)
725 PAMTARGET="pam"
726 else
727 PAMTARGET="no-pam"
728 fi
729 ])
730 case "$PAMTARGET" in
731 no-pam) echo PAM authentication is disabled. ;;
732 pam) echo PAM authentication is enabled. ;;
733 esac
734
735
736 dnl Implement --enable-debug option.
737
738 AC_ARG_ENABLE(debug,
739 [ --enable-debug enable non-reentrant debugging for wmls compiler @<:@disabled@:>@], [
740 echo enabling WMLScript compiler debugging
741 if test -n "$GCC"; then
742 CFLAGS="$CFLAGS -Wall"
743 fi
744 AC_DEFINE(WS_DEBUG)
745 ])
746
747
748 dnl Implement --enable-localtime option.
749
750 AC_ARG_ENABLE(localtime,
751 [ --enable-localtime log file time stamps in local time, not GMT @<:@enabled@:>@], [
752 if test "$enableval" = yes; then
753 echo enabling local time
754 AC_DEFINE(LOG_TIMESTAMP_LOCALTIME)
755 fi
756 ],[
757 echo enabling local time
758 AC_DEFINE(LOG_TIMESTAMP_LOCALTIME)
759 ])
760
761
762 dnl --enable-mutex-stats option.
763
764 AC_ARG_ENABLE(mutex-stats,
765 [ --enable-mutex-stats produce information about lock contention], [
766 if test "$enableval" = yes; then
767 AC_DEFINE(MUTEX_STATS)
768 fi
769 ])
770
771
772 dnl --disable-cookies option.
773
774 AC_ARG_ENABLE(cookies,
775 [ --disable-cookies disable cookie support for WSP @<:@enabled@:>@], [
776 if test "$enableval" = yes; then
777 echo enabling cookies
778 AC_DEFINE(ENABLE_COOKIES)
779 else
780 echo disabling cookies
781 fi
782 ],[
783 echo enabling cookies
784 AC_DEFINE(ENABLE_COOKIES)
785 ])
786
787
788 dnl --disable-keepalive option.
789
790 AC_ARG_ENABLE(keepalive,
791 [ --disable-keepalive disable HTTP/1.1 keep-alive support @<:@enabled@:>@], [
792 if test "$enableval" = yes; then
793 echo enabling HTTP/1.1 keep-alive
794 AC_DEFINE(USE_KEEPALIVE)
795 else
796 echo disabling HTTP/1.1 keep-alive
797 fi
798 ],[
799 echo enabling HTTP/1.1 keep-alive
800 AC_DEFINE(USE_KEEPALIVE)
801 ])
802
803
804 dnl --enable-start-stop-daemon option.
805
806 AC_MSG_CHECKING([whether to compile start-stop-daemon])
807 AC_ARG_ENABLE(start-stop-daemon,
808 [ --enable-start-stop-daemon compile/install the start-stop-daemon program @<:@disabled@:>@], [
809 case "${enableval}" in
810 yes)
811 buildbin=true
812 AC_MSG_RESULT(enabled)
813 ;;
814 no)
815 buildbin=false
816 AC_MSG_RESULT(disabled)
817 ;;
818 *) AC_MSG_ERROR(bad value ${enableval} for --enable-start-stop-daemon) ;;
819 esac
820 ],[ buildbin=false ; AC_MSG_RESULT(disabled)])
821 AM_CONDITIONAL(BUILD_STARTSTOPDAEMON, test x$buildbin = xtrue)
822
823
824 dnl Implement --disable-wap and --disable-sms options.
825
826 AC_ARG_ENABLE(wap,
827 [ --disable-wap disables WAP gateway parts in bearerbox], [
828 if test "$enableval" = "no"
829 then
830 echo disabling WAP gateway parts in bearerbox
831 AC_DEFINE(NO_WAP)
832 fi
833 ])
834
835 AC_ARG_ENABLE(sms,
836 [ --disable-sms disables SMS gateway parts in bearerbox], [
837 if test "$enableval" = "no"
838 then
839 echo disabling SMS gateway parts in bearerbox
840 AC_DEFINE(NO_SMS)
841 fi
842 ])
843
844
845 dnl Implement the --with-ssl option.
846
847 AC_CONFIG_SECTION([Configuring OpenSSL support])
848 AC_ARG_WITH(ssl,
849 [ --with-ssl[=DIR] where to look for OpenSSL libs and header files
850 DIR points to the installation @<:@/usr/local/ssl@:>@],
851 [ if test -d "$withval"; then
852 ssllib="$withval/lib";
853 sslinc="$withval/include"
854 else
855 AC_MSG_ERROR(Unable to find OpenSSL libs and/or directories at $withval)
856 fi
857 ])
858
859
860 dnl Implement --enable-ssl option.
861
862 AC_MSG_CHECKING([whether to compile with SSL support])
863 AC_ARG_ENABLE(ssl,
864 [ --enable-ssl enable SSL client and server support @<:@enabled@:>@], [
865 if test "$enableval" = no ; then
866 AC_MSG_RESULT(disabled)
867 ssl=no
868 else
869 ssl=yes
870 fi
871 ],[
872 ssl=yes
873 ])
874
875 if test "$ssl" = "yes" ; then
876 dnl test only if --with-ssl has not been used
877 if test "x$ssllib" = "x" && test "x$sslinc" = "x"; then
878 for loc in /usr/lib /usr/lib64 /usr/local/ssl/lib /usr/local/openssl/lib; do
879 if test -f "$loc/libssl.a" -o -f "$loc/libssl.so" -o -f "$loc/libssl.dylib" ; then
880 ssllib="$loc"
881 fi
882 done
883 if test "x$sslib" = "x" && test -n "$GCC"; then
884 for lib in libssl.a libssl.so libssl.dylib; do
885 name=`$CC -print-file-name=$lib`
886 if test -f "$name"; then
887 ssllib=`dirname $name`
888 fi
889 done
890 fi
891 for loc in /usr/include/ssl /usr/include/openssl /usr/local/ssl/include \
892 /usr/local/openssl/include; do
893 if test -d "$loc"; then
894 sslinc="$loc"
895 fi
896 done
897 fi
898 AC_MSG_RESULT(trying $ssllib $sslinc)
899 fi
900
901
902 dnl Implement the SSL library checking routine.
903 dnl This will define HAVE_LIBSSL in gw-config.h
904
905 if test "x$ssllib" != "x" && test "x$sslinc" != "x"; then
906 CFLAGS="$CFLAGS -I$sslinc"
907 LIBS="$LIBS -L$ssllib"
908
909 AC_PATH_PROG(OPENSSL, openssl, no)
910 if test "$OPENSSL" != "no"; then
911 AC_MSG_CHECKING([openssl version])
912 openssl_version=`$OPENSSL version | awk '{print $2}'`
913 openssl_ver=`echo $openssl_version | sed 's/[[a-zA-Z]]//g'`
914 AC_MSG_RESULT([$openssl_version])
915 fi
916 AC_CHECK_VERSION($openssl_ver, "1.1.0",
917 [ CRYPTO_CHECK=HMAC_Update
918 SSL_CHECK=OPENSSL_init_ssl
919 ],[
920 CRYPTO_CHECK=CRYPTO_lock
921 SSL_CHECK=SSL_library_init
922 ])
923 AC_CHECK_LIB(crypto, $CRYPTO_CHECK,
924 [ LIBS="$LIBS -lcrypto"
925 AC_CHECK_LIB(ssl, $SSL_CHECK,
926 [ AC_CHECK_LIB(ssl, SSL_connect)
927 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
928 openssl/pem.h openssl/ssl.h openssl/err.h \
929 openssl/hmac.h)
930 AC_MSG_CHECKING(whether the OpenSSL library is multithread-enabled)
931 AC_TRY_RUN([
932 #define OPENSSL_THREAD_DEFINES
933 #include <openssl/opensslconf.h>
934 int main(void) {
935 #if defined(THREADS)
936 exit(0);
937 #elif defined(OPENSSL_THREADS)
938 exit(0);
939 #else
940 exit(1);
941 #endif
942 }
943 ], [
944 AC_MSG_RESULT(yes)
945 AC_DEFINE(HAVE_LIBSSL)
946 LIBS="$LIBS -lssl"
947 AC_MSG_CHECKING([whether to compile with SSL support])
948 AC_MSG_RESULT(yes)
949 ], [
950 AC_ARG_ENABLE(ssl-thread-test,
951 [ --disable-ssl-thread-test disable the multithread test for the OpenSSL library
952 this will force to continue even if the test fails],
953 [ if test "$enableval" = no ; then
954 AC_MSG_RESULT([no, continue forced])
955 fi
956 ], [
957 AC_MSG_RESULT(no)
958 AC_MSG_ERROR(Either get a multithread-enabled SSL or configure with --disable-ssl)
959 ])
960 ], echo "Cross-compiling; make sure your SSL library is multithread-enabled"
961 )
962 ])
963 ])
964 fi
965
966
967 AC_CONFIG_SECTION([Configuring DB support])
968
969
970 dnl Implement the --with-mysql option. This will set HAVE_MYSQL in gw-config.h
971 dnl accordingly and enable the usage of the libmysqlclient routines.
972
973 AC_MSG_CHECKING([whether to compile with MySQL support])
974 AC_ARG_WITH(mysql,
975 [ --with-mysql enable MySQL storage @<:@disabled@:>@], [
976 if test "$withval" != yes ; then
977 AC_MSG_RESULT(disabled)
978 else
979 dnl Implement the --with-mysql-dir option.
980 AC_ARG_WITH(mysql-dir,
981 [ --with-mysql-dir=DIR where to look for MySQL libs and header files
982 DIR points to the installation @<:@/usr/local/mysql@:>@],
983 [
984 mysqlloc=""
985 if test -d "$withval" ; then
986 mysqlloc="$withval"
987 fi
988 ])
989
990 AC_MSG_RESULT(searching)
991 AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no, [$PATH:$mysqlloc/bin:$mysqlloc])
992 dnl check for MySQL 4.x style mysql_config information
993 if test "$MYSQL_CONFIG" = "no"; then
994 found=""
995 for loc in $mysqlloc /usr /usr/local ; do
996 if test "x$found" = "x" ; then
997 AC_MSG_CHECKING([for MySQL client support in])
998 AC_MSG_RESULT($loc)
999 AC_CHECK_FILE("$loc/include/mysql/mysql.h",
1000 [CFLAGS="$CFLAGS -I$loc/include/mysql"; LIBS="$LIBS -L$loc/lib/mysql -lmysqlclient"]; found=1,
1001 [AC_CHECK_FILE("$loc/include/mysql.h",
1002 [CFLAGS="$CFLAGS -I$loc/include"; LIBS="$LIBS -L$loc/lib -lmysqlclient"]; found=1
1003 )]
1004 )
1005 fi
1006 done
1007 if test "x$found" != "x1" ; then
1008 AC_MSG_ERROR([Unable to find mysql.h, please provide a --with-mysql-dir=<dir> location])
1009 fi
1010 else
1011 dnl mysql_config found
1012 AC_MSG_CHECKING([mysql version])
1013 mysql_version=`$MYSQL_CONFIG --version`
1014 AC_MSG_RESULT([$mysql_version])
1015 dnl mysql-4.x style
1016 MYSQL_LIBS=""
1017 if $MYSQL_CONFIG --libs_r &>/dev/null ; then
1018 MYSQL_LIBS=`$MYSQL_CONFIG --libs_r`
1019 AC_MSG_CHECKING([mysql reentrant libs])
1020 AC_MSG_RESULT([$MYSQL_LIBS])
1021 AC_CHECK_LIB(mysqlclient_r, mysql_init, [ LIBS="$LIBS $MYSQL_LIBS" ],
1022 [ MYSQL_LIBS="" ], [ $MYSQL_LIBS ])
1023 fi
1024 if test -z "$MYSQL_LIBS" ; then
1025 MYSQL_LIBS=`$MYSQL_CONFIG --libs`
1026 AC_MSG_CHECKING([mysql libs])
1027 AC_MSG_RESULT([$MYSQL_LIBS])
1028 AC_CHECK_LIB(mysqlclient, mysql_init, [ LIBS="$LIBS $MYSQL_LIBS" ],
1029 [AC_MSG_ERROR([Unable to find MySQL client libraries])], [ $MYSQL_LIBS ])
1030 fi
1031 AC_MSG_CHECKING([mysql includes])
1032 dnl mysql-4.x style
1033 if $MYSQL_CONFIG --include &>/dev/null ; then
1034 MYSQL_CFLAGS=`$MYSQL_CONFIG --include`
1035 else
1036 MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
1037 fi
1038 CFLAGS="$CFLAGS $MYSQL_CFLAGS"
1039 AC_MSG_RESULT([$MYSQL_CFLAGS])
1040 fi
1041 AC_CHECK_HEADERS(mysql/mysql.h mysql/mysql_version.h)
1042 AC_CHECK_LIB(mysqlclient_r, mysql_stmt_init, [],
1043 AC_CHECK_LIB(mysqlclient, mysql_stmt_init, [], [AC_MSG_ERROR([Unable to find MySQL client libraries version >= 4.1])])
1044 )
1045 AC_DEFINE(HAVE_MYSQL)
1046 AC_MSG_CHECKING([whether to compile with MySQL support])
1047 AC_MSG_RESULT(yes)
1048 MYSQL="yes"
1049 fi
1050 ],[
1051 AC_MSG_RESULT(disabled)
1052 ])
1053
1054
1055 dnl Implement the --with-sdb option. This will set HAVE_SDB in gw-config.h
1056 dnl accordingly and enable the usage of the libsdb routines.
1057
1058 AC_MSG_CHECKING([whether to compile with LibSDB support])
1059 AC_ARG_WITH(sdb,
1060 [ --with-sdb enable LibSDB storage @<:@disabled@:>@], [
1061 if test "$withval" != yes; then
1062 AC_MSG_RESULT(disabled)
1063 else
1064 AC_MSG_RESULT(searching)
1065 AC_PATH_PROGS(SDB_CONFIG, sdb-config, no)
1066 if test "$SDB_CONFIG" = "no"; then
1067 AC_MSG_ERROR(Unable to find sdb-config in path for SDB support)
1068 else
1069 AC_MSG_CHECKING([sdb version])
1070 sdb_version=`$SDB_CONFIG --version`
1071 AC_MSG_RESULT([$sdb_version])
1072 CFLAGS="$CFLAGS `$SDB_CONFIG --cflags`"
1073 AC_CHECK_HEADERS(sdb.h)
1074 LIBS="$LIBS `$SDB_CONFIG --libs`"
1075 AC_CHECK_LIB(sdb, sdb_init,
1076 [LIBS="$LIBS -lsdb"
1077 AC_DEFINE(HAVE_SDB)
1078 AC_DEFINE_UNQUOTED(LIBSDB_VERSION, "$sdb_version")
1079 SDB="yes"],
1080 [AC_MSG_ERROR([Unable to find libSDB client libraries])]
1081 )
1082 fi
1083 fi
1084 ],[
1085 AC_MSG_RESULT(disabled)
1086 ])
1087
1088
1089 dnl Implement the --with-sqlite2 option. This will set HAVE_SQLITE in gw-config.h
1090 dnl accordingly and enable the usage of the libsqlite routines.
1091
1092 AC_MSG_CHECKING([whether to compile with SQLite2 support])
1093 AC_ARG_WITH(sqlite2,
1094 [ --with-sqlite2 enable SQLite2 storage @<:@disabled@:>@], [
1095 if test "$withval" != yes; then
1096 AC_MSG_RESULT(disabled)
1097 else
1098 AC_MSG_RESULT(searching)
1099 AC_CHECK_HEADERS(sqlite.h)
1100 LIBS="$LIBS -L/usr/local/lib"
1101 AC_CHECK_LIB(sqlite, sqlite_open,
1102 [LIBS="$LIBS -lsqlite"
1103 AC_DEFINE(HAVE_SQLITE)
1104 SQLITE="yes"],
1105 [AC_MSG_ERROR([Unable to find SQLite2 client libraries])]
1106 )
1107 AC_PATH_PROGS(SQLITE, sqlite, no)
1108 if test "$SQLITE" = "no"; then
1109 AC_MSG_WARN([Unable to find sqlite in path for SQLite2 support])
1110 else
1111 AC_MSG_CHECKING([sqlite version])
1112 sqlite_version=`$SQLITE -version`
1113 AC_MSG_RESULT([$sqlite_version])
1114 fi
1115 fi
1116 ],[
1117 AC_MSG_RESULT(disabled)
1118 ])
1119
1120
1121 dnl Implement the --with-sqlite3 option. This will set HAVE_SQLITE3 in gw-config.h
1122 dnl accordingly and enable the usage of the libsqlite3 routines.
1123
1124 AC_MSG_CHECKING([whether to compile with SQLite3 support])
1125 AC_ARG_WITH(sqlite3,
1126 [ --with-sqlite3 enable SQLite3 storage @<:@disabled@:>@], [
1127 if test "$withval" != yes; then
1128 AC_MSG_RESULT(disabled)
1129 else
1130 AC_MSG_RESULT(searching)
1131 AC_CHECK_HEADERS(sqlite3.h)
1132 LIBS="$LIBS -L/usr/local/lib"
1133 AC_CHECK_LIB(sqlite3, sqlite3_open,
1134 [LIBS="$LIBS -lsqlite3"
1135 AC_DEFINE(HAVE_SQLITE3)
1136 SQLITE3="yes"],
1137 [AC_MSG_ERROR([Unable to find SQLite3 client libraries])]
1138 )
1139 AC_PATH_PROGS(SQLITE3, sqlite3, no)
1140 if test "$SQLITE3" = "no"; then
1141 AC_MSG_WARN([Unable to find sqlite3 in path for SQLite3 support])
1142 else
1143 AC_MSG_CHECKING([sqlite3 version])
1144 sqlite3_version=`$SQLITE3 -version | awk '{print $1}'`
1145 AC_MSG_RESULT([$sqlite3_version])
1146 fi
1147 fi
1148 ],[
1149 AC_MSG_RESULT(disabled)
1150 ])
1151
1152
1153 dnl Implement the --with-oracle option. This will set HAVE_ORACLE in gw-config.h
1154 dnl accordingly and enable the usage of the OCI routines.
1155
1156 AC_MSG_CHECKING([whether to compile with Oracle support])
1157 AC_ARG_WITH(oracle,
1158 [ --with-oracle enable ORACLE storage @<:@disabled@:>@],
1159 [
1160 if test "$withval" != yes ; then
1161 AC_MSG_RESULT(disabled)
1162 else
1163 AC_MSG_RESULT(searching)
1164 AC_ARG_WITH(
1165 oracle-includes,
1166 [ --with-oracle-includes=DIR adds oracle include paths],
1167 [ ORACLE_INCLUDE_PATH="$withval" ],
1168 [ ORACLE_INCLUDE_PATH="$ORACLE_HOME/rdbms/demo $ORACLE_HOME/rdbms/public" ]
1169 )
1170 for a in $ORACLE_INCLUDE_PATH
1171 do
1172 CPPFLAGS="$CPPFLAGS -I$a"
1173 done
1174 AC_MSG_CHECKING([for oci.h ])
1175 AC_TRY_CPP([#include <oci.h>],AC_MSG_RESULT(yes), AC_MSG_ERROR([oci.h not found]))
1176 CFLAGS="$CFLAGS $CPPFLAGS"
1177
1178 AC_ARG_WITH(
1179 oracle-libs,
1180 [ --with-oracle-libs=DIR adds oracle library path],
1181 [ ORACLE_LIB_PATH="$withval" ],
1182 [ ORACLE_LIB_PATH="$ORACLE_HOME/lib" ]
1183 )
1184 for a in $ORACLE_LIB_PATH
1185 do
1186 LIBS="$LIBS -L$a"
1187 done
1188
1189 dnl Check for Oracle 10g instant client
1190 AC_CHECK_LIB(clntsh,OCIEnvCreate,[ LIBS="$LIBS -lclntsh" ],
1191 AC_CHECK_LIB(clntsh,OCIEnvCreate,[ LIBS="$LIBS -lclntsh -lnnz10" ],exit)
1192 )
1193
1194 dnl Beware that Oracle 10g doesn't use anymore the libwtcX.so libs,
1195 dnl so we don't break hard in case they are not present.
1196 AC_CHECK_LIB(wtc8,wtcstu,[ LIBS="$LIBS -lwtc8" ],
1197 AC_CHECK_LIB(wtc9,wtcstu,[ LIBS="$LIBS -lwtc9" ], true)
1198 )
1199
1200 AC_CHECK_FUNC(OCIPing, [AC_DEFINE(HAVE_OCIPING, 1, [Do we have OCIPing])])
1201
1202 AC_DEFINE(HAVE_ORACLE, 1, [Do we have Oracle])
1203 AC_MSG_CHECKING([whether to compile with Oracle support])
1204 AC_MSG_RESULT(yes)
1205 fi
1206 ],
1207 [AC_MSG_RESULT(disabled)])
1208
1209
1210 dnl Implement the --with-pgsql option. This will set HAVE_PGSQL in gw-config.h
1211 dnl accordingly and enable the usage of the libpq routines.
1212
1213 AC_MSG_CHECKING([whether to compile with PostgresSQL support])
1214 AC_ARG_WITH(pgsql,
1215 [ --with-pgsql enable PostgreSQL storage @<:@disabled@:>@], [
1216 if test "$withval" != yes ; then
1217 AC_MSG_RESULT(disabled)
1218 else
1219 dnl Implement the --with-pgsql-dir option.
1220 AC_ARG_WITH(pgsql-dir,
1221 [ --with-pgsql-dir=DIR where to look for PostgreSQL libs and header files
1222 DIR points to the installation @<:@/usr/local/pgsql@:>@],
1223 [
1224 pgsqlloc=""
1225 if test -d "$withval" ; then
1226 pgsqlloc="$withval"
1227 fi
1228 ])
1229
1230 AC_MSG_RESULT(searching)
1231 AC_PATH_PROG(PGSQL_CONFIG, pg_config, no, [$PATH:$pgsqlloc/bin:$pgsqlloc:/usr/lib/postgresql/bin])
1232 dnl check for PgSQL >= 7.2 style pg_config information
1233 if test "$PGSQL_CONFIG" = "no"; then
1234 found=""
1235 for loc in $pgsqlloc /usr /usr/local ; do
1236 if test "x$found" = "x" ; then
1237 AC_MSG_CHECKING([for PostgresSQL include files in])
1238 AC_MSG_RESULT($loc)
1239 AC_CHECK_FILE("$loc/include/postgresql/libpq-fe.h",
1240 [CFLAGS="$CFLAGS -I$loc/include/postgresql"; LIBS="$LIBS -L$loc/lib/postgresql -lpq"]; found=1,
1241 [AC_CHECK_FILE("$loc/include/pgsql/libpq-fe.h",
1242 [CFLAGS="$CFLAGS -I$loc/include/pgsql"; LIBS="$LIBS -L$loc/lib/pgsql -lpq"]; found=1,
1243 [AC_CHECK_FILE("$loc/pgsql/include/libpq-fe.h",
1244 [CFLAGS="$CFLAGS -I$loc/pgsql/include"; LIBS="$LIBS -L$loc/pgsql/lib -lpq"]; found=1,
1245 )]
1246 )])
1247 fi
1248 done
1249 if test "x$found" != "x1" ; then
1250 AC_MSG_ERROR([Unable to find libpq-fe.h, please provide a --with-pgsql-dir=<dir> location])
1251 fi
1252 else
1253 dnl pg_config found
1254 AC_MSG_CHECKING([PostgreSQL version])
1255 pgsql_version=`$PGSQL_CONFIG --version | awk '{print $2}'`
1256 AC_MSG_RESULT([$pgsql_version])
1257 AC_MSG_CHECKING([PostgreSQL libdir])
1258 if $PGSQL_CONFIG --libdir &>/dev/null ; then
1259 LIBS="$LIBS -L`$PGSQL_CONFIG --libdir`"
1260 pg_libdir=`$PGSQL_CONFIG --libdir`
1261 AC_MSG_RESULT([$pg_libdir])
1262 fi
1263 AC_MSG_CHECKING([PostgreSQL includes])
1264 if $PGSQL_CONFIG --includedir &>/dev/null ; then
1265 CFLAGS="$CFLAGS -I`$PGSQL_CONFIG --includedir`"
1266 CPPFLAGS="$CPPFLAGS -I`$PGSQL_CONFIG --includedir`"
1267 pg_incdir=`$PGSQL_CONFIG --includedir`
1268 AC_MSG_RESULT([$pg_incdir])
1269 fi
1270 fi
1271
1272 AC_CHECK_HEADERS(libpq-fe.h)
1273 AC_CHECK_LIB(pq, PQconnectdb, [])
1274 AC_DEFINE(HAVE_PGSQL)
1275 AC_MSG_CHECKING([whether to compile with PostgreSQL support])
1276 AC_MSG_RESULT(yes)
1277 PGSQL="yes"
1278 fi
1279 ],[
1280 AC_MSG_RESULT(disabled)
1281 ])
1282
1283
1284 dnl Implement the --with-redis option. This will set HAVE_REDIS in gw-config.h
1285 dnl accordingly and enable the usage of the hiredis routines.
1286
1287 AC_MSG_CHECKING([whether to compile with Redis support])
1288 AC_ARG_WITH(redis,
1289 [ --with-redis enable Redis storage @<:@disabled@:>@], [
1290 if test "$withval" != yes ; then
1291 AC_MSG_RESULT(disabled)
1292 else
1293 dnl Implement the --with-redis-dir option.
1294 AC_ARG_WITH(redis-dir,
1295 [ --with-redis-dir=DIR where to look for Redis libs and header files
1296 DIR points to the installation @<:@/usr/local/redis@:>@],
1297 [
1298 redisloc=""
1299 if test -d "$withval" ; then
1300 redisloc="$withval"
1301 fi
1302 ])
1303
1304 AC_MSG_RESULT(searching)
1305 AC_PATH_PROG(REDIS_CONFIG, redis_config, no, [$PATH:$redisloc/bin:$redisloc])
1306 if test "$REDIS_CONFIG" = "no"; then
1307 found=""
1308 for loc in $redisloc /usr /usr/local ; do
1309 if test "x$found" = "x" ; then
1310 AC_MSG_CHECKING([for Redis include files in])
1311 AC_MSG_RESULT($loc)
1312 AC_CHECK_FILE("$loc/hiredis.h",
1313 [CFLAGS="$CFLAGS -I$loc"; LIBS="$LIBS -L$loc -lhiredis"]; found=1,
1314 [AC_CHECK_FILE("$loc/include/hiredis/hiredis.h",
1315 [CFLAGS="$CFLAGS -I$loc/include/hiredis"; LIBS="$LIBS -L$loc/lib -lhiredis"]; found=1
1316 )]
1317 )
1318 fi
1319 done
1320 if test "x$found" != "x1" ; then
1321 AC_MSG_ERROR([Unable to find hiredis.h, please provide a --with-redis-dir=<dir> location])
1322 fi
1323 else
1324 dnl redis_config found
1325 REDIS_LIBS=""
1326 if test -z "$REDIS_LIBS" ; then
1327 REDIS_LIBS=`$REDIS_CONFIG --libs`
1328 AC_MSG_CHECKING([redis libs])
1329 AC_MSG_RESULT([$REDIS_LIBS])
1330 AC_CHECK_LIB(hiredis, [ LIBS="$LIBS $REDIS_LIBS" ],
1331 [AC_MSG_ERROR([Unable to find Redis client libraries])], [ $REDIS_LIBS ])
1332 fi
1333 AC_MSG_CHECKING([redis includes])
1334 if $REDIS_CONFIG --include &>/dev/null ; then
1335 REDIS_CFLAGS=`$REDIS_CONFIG --include`
1336 else
1337 REDIS_CFLAGS=`$REDIS_CONFIG --cflags`
1338 fi
1339 CFLAGS="$CFLAGS $REDIS_CFLAGS"
1340 AC_MSG_RESULT([$REDIS_CFLAGS])
1341 fi
1342 AC_CHECK_HEADERS(hiredis/hiredis.h)
1343 AC_DEFINE(HAVE_REDIS)
1344 AC_MSG_CHECKING([whether to compile with Redis support])
1345 AC_MSG_RESULT(yes)
1346 REDIS="yes"
1347 fi
1348 ],[
1349 AC_MSG_RESULT(disabled)
1350 ])
1351
1352 dnl Checking for FreeTDS Ct-Lib support
1353 AC_MSG_CHECKING([whether to compile with FreeTDS Ct-Lib support])
1354 AC_ARG_WITH(mssql,
1355 [ --with-mssql[=DIR] enable FreeTDS Ct-Lib storage support @<:@disabled@:>@
1356 DIR points to the installation @<:@/usr/local@:>@], [
1357 if test "$withval" = "yes"; then
1358 withval=/usr/local
1359 fi
1360
1361 if test "$withval" != "no"; then
1362 if test -f $withval/include/ctpublic.h; then
1363 MSSQL_INCDIR=$withval/include
1364 MSSQL_LIBDIR=$withval/lib
1365 else
1366 if test -f $withval/include/freetds/ctpublic.h; then
1367 MSSQL_INCDIR=$withval/include/freetds
1368 MSSQL_LIBDIR=$withval/lib
1369 else
1370 AC_MSG_RESULT(no)
1371 AC_MSG_ERROR(Invalid FreeTDS directory - unable to find ctpublic.h)
1372 fi
1373 fi
1374 LIBS="$LIBS -L$MSSQL_LIBDIR -lct"
1375 CFLAGS="$CFLAGS -I$MSSQL_INCDIR"
1376 AC_DEFINE(HAVE_MSSQL, 1, [Defined to 1])
1377 AC_MSG_RESULT(yes)
1378 MSSQL="yes"
1379 dnl AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen, MSSQL_LFLAGS="$MSSQL_LFLAGS -ldl"))
1380 fi
1381 ],[
1382 AC_MSG_RESULT(disabled)
1383 ])
1384
1385 dnl Implement the --with-cassandra option. This will set HAVE_CASS in gw-config.h
1386
1387 AC_MSG_CHECKING([whether to compile with Cassandra support])
1388 AC_ARG_WITH(cassandra,
1389 [ --with-cassandra enable Cassandra storage @<:@disabled@:>@], [
1390 if test "$withval" != yes ; then
1391 AC_MSG_RESULT(disabled)
1392 else
1393 dnl Implement the --with-cassandra-dir option.
1394 AC_ARG_WITH(cassandra-dir,
1395 [ --with-cassandra-dir=DIR where to look for Cassandra libs and header files
1396 DIR points to the installation @<:@/usr/local@:>@],
1397 [
1398 cassloc=""
1399 if test -d "$withval" ; then
1400 cassloc="$withval"
1401 fi
1402 ])
1403
1404 AC_MSG_RESULT(searching)
1405 found=""
1406 for loc in $cassloc /usr /usr/local ; do
1407 if test "x$found" = "x" ; then
1408 AC_MSG_CHECKING([for Cassandra include files in])
1409 AC_MSG_RESULT($loc)
1410 AC_CHECK_FILE("$loc/include/cassandra.h",
1411 [CFLAGS="$CFLAGS -I$loc/include"; LIBS="$LIBS -L$loc/lib -lcassandra"]; found=1
1412 )
1413 fi
1414 done
1415 if test "x$found" != "x1" ; then
1416 AC_MSG_ERROR([Unable to find cassandra.h, please provide a --with-cassandra-dir=<dir> location])
1417 fi
1418 AC_CHECK_HEADERS(cassandra.h)
1419 AC_DEFINE(HAVE_CASS)
1420 AC_MSG_CHECKING([whether to compile with Cassandra support])
1421 AC_MSG_RESULT(yes)
1422 CASS="yes"
1423 fi
1424 ],[
1425 AC_MSG_RESULT(disabled)
1426 ])
1427
1428
1429 dnl Implement the --with-wtls option.
1430 dnl Check to see if we should include WTLS support, and which library to use.
1431
1432 AC_ARG_WITH(wtls,
1433 [ --with-wtls@<:@=TYPE@:>@ select WTLS version to use: @<:@openssl|baltimore@:>@],
1434 [ AC_CONFIG_SECTION([Configuring WTLS support])
1435 AC_MSG_CHECKING([for WTLS library])
1436 AC_MSG_RESULT($withval)
1437 case "$withval" in
1438 openssl)
1439 AC_CHECK_LIB(crypto, RSA_new,
1440 [ AC_CHECK_HEADERS(openssl/objects.h openssl/rc5.h,
1441 AC_DEFINE(HAVE_WTLS_OPENSSL),
1442 AC_MSG_WARN(OpenSSL installation seems to lack RC5 algorithm!)
1443 )
1444 ])
1445 ;;
1446 baltimore)
1447 AC_MSG_ERROR(This WTLS library is yet not supported!)
1448 ;;
1449 *)
1450 AC_MSG_ERROR(Unknown WTLS libary support!)
1451 exit 1
1452 ;;
1453 esac
1454 ])
1455
1456
1457 AC_CONFIG_SECTION([Configuring for gSOAP support])
1458 AC_MSG_CHECKING([whether to compile with SOAP support])
1459 AC_ARG_WITH(gsoap,
1460 [ --with-gsoap@<:@=DIR@:>@ enable gSOAP web services SMSC module support @<:@disabled@:>@
1461 DIR points to the gSOAP share directory @<:@/usr/share/gsoap@:>@], [
1462 if test "x$withval" = "xyes"; then
1463 for loc in /usr/share/gsoap /usr/local/share/gsoap; do
1464 if test -d "$loc/import" && test -d "$loc/plugin"; then
1465 GSOAP_SHARE=$loc
1466 AC_MSG_RESULT($GSOAP_SHARE)
1467 fi
1468 done
1469 if test "x$GSOAP_SHARE" = "x"; then
1470 AC_MSG_RESULT(not found)
1471 AC_MSG_ERROR(Unable to find gSOAP's import and/or plugin directory)
1472 fi
1473 else
1474 if test -d "$withval/import" && test -d "$withval/plugin"; then
1475 GSOAP_SHARE="$withval"
1476 AC_MSG_RESULT($withval)
1477 else
1478 AC_MSG_RESULT(not found)
1479 AC_MSG_ERROR(Unable to find gSOAP's import at $withval/import and/or plugin at $withval/plugin)
1480 fi
1481 fi
1482 gsoap_ver_required="2.8.4"
1483
1484 AC_PATH_PROGS(WSDL2H, wsdl2h, no)
1485 if test "$WSDL2H" = "no"; then
1486 AC_MSG_ERROR([Unable to find gSOAP's wsdl2h in path for SOAP support])
1487 fi
1488 AC_PATH_PROGS(SOAPCPP, soapcpp2, no)
1489 if test "$SOAPCPP" = "no"; then
1490 AC_MSG_ERROR([Unable to find gSOAP's soapcpp2 in path for SOAP support])
1491 fi
1492
1493 AC_MSG_CHECKING([gSOAP version])
1494 gsoap_version=`$SOAPCPP -v &> /tmp/gsoap.tmp && cat /tmp/gsoap.tmp | grep "C and C++" | awk '{print $NF}'`
1495 AC_MSG_RESULT([$gsoap_version])
1496 gsoap_version_str=`echo $gsoap_version | grep -e "^[[0-9]]*\.[[0-9]]*\.[[0-9]]*$"`
1497 if test "$gsoap_version_str" = ""; then
1498 AC_MSG_WARN([gSOAP version $gsoap_version contains alphanumeric characters. Version MAYBE too old!])
1499 else
1500 AC_CHECK_VERSION($gsoap_version, $gsoap_ver_required, [],
1501 [
1502 AC_MSG_ERROR([gSOAP version $gsoap_version is too old. You MUST have at least $gsoap_ver_required])
1503 ])
1504 fi
1505
1506 SOAP_INCLUDE="include soap/Makefile"
1507 AC_DEFINE(HAVE_GSOAP)
1508 AC_SUBST(WSDL2H)
1509 AC_SUBST(SOAPCPP)
1510 AC_SUBST(SOAP_INCLUDE)
1511 AC_SUBST(GSOAP_SHARE)
1512 ],[
1513 AC_MSG_RESULT(disabled)
1514 ])
1515
1516
1517 dnl Final Output
1518
1519 AC_CONFIG_SECTION([Generating output files])
1520 AC_OUTPUT([
1521 gwlib/gw_uuid_types.h
1522 Makefile
1523 soap/Makefile
1524 utils/Makefile
1525 ])
1526
1527
1528 dnl LICENSE notice
1529
1530 AC_CONFIG_SECTION([License information])
1531 cat <<X
1532 +--------------------------------------------------------------------+
1533 | License: |
1534 | This software is subject to the Kannel Software License, available |
1535 | in this distribution in the file LICENSE. By continuing this |
1536 | installation process, you are bound by the terms of this license |
1537 | agreement. If you do not agree with the terms of this license, you |
1538 | must abort the installation process at this point. |
1539 | |
1540 | The Kannel Group <http://www.kannel.org/> |
1541 +--------------------------------------------------------------------+
1542
1543 Thank you for using Kannel.
1544 X