PennMUSH Community

root/1.8.3/tags/p2rc2/aclocal.m4

Revision 790, 27.1 kB (checked in by shawnw, 2 years ago)

#6887: Merged autoconf branch into devel branch.

Line 
1 # DO NOT RUN ACLOCAL TO GENERATE THIS FILE!
2 # Some of the macros have been changed from the stock versions.
3 # Namely, CHECK_SSL.
4
5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
6 # 2005  Free Software Foundation, Inc.
7 # This file is free software; the Free Software Foundation
8 # gives unlimited permission to copy and/or distribute it,
9 # with or without modifications, as long as this notice is preserved.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 # PARTICULAR PURPOSE.
15
16 #
17 # SYNOPSIS
18 #
19 #   AX_LIB_MYSQL([MINIMUM-VERSION])
20 #
21 # DESCRIPTION
22 #
23 #   This macro provides tests of availability of MySQL client library
24 #   of particular version or newer.
25 #
26 #   AX_LIB_MYSQL macro takes only one argument which is optional. If
27 #   there is no required version passed, then macro does not run
28 #   version test.
29 #
30 #   The --with-mysql option takes one of three possible values:
31 #
32 #   no - do not check for MySQL client library
33 #
34 #   yes - do check for MySQL library in standard locations
35 #   (mysql_config should be in the PATH)
36 #
37 #   path - complete path to mysql_config utility, use this option if
38 #   mysql_config can't be found in the PATH
39 #
40 #   This macro calls:
41 #
42 #     AC_SUBST(MYSQL_CFLAGS)
43 #     AC_SUBST(MYSQL_LDFLAGS)
44 #     AC_SUBST(MYSQL_VERSION)
45 #
46 #   And sets:
47 #
48 #     HAVE_MYSQL
49 #
50 # LAST MODIFICATION
51 #
52 #   2006-07-16
53 #
54 # COPYLEFT
55 #
56 #   Copyright (c) 2006 Mateusz Loskot <mateusz@loskot.net>
57 #
58 #   Copying and distribution of this file, with or without
59 #   modification, are permitted in any medium without royalty provided
60 #   the copyright notice and this notice are preserved.
61
62 AC_DEFUN([AX_LIB_MYSQL],
63 [
64     AC_ARG_WITH([mysql],
65         AC_HELP_STRING([--with-mysql=@<:@ARG@:>@],
66             [use MySQL client library @<:@default=yes@:>@, optionally specify path to mysql_config]
67         ),
68         [
69         if test "$withval" = "no"; then
70             want_mysql="no"
71         elif test "$withval" = "yes"; then
72             want_mysql="yes"
73         else
74             want_mysql="yes"
75             MYSQL_CONFIG="$withval"
76         fi
77         ],
78         [want_mysql="yes"]
79     )
80
81     MYSQL_CFLAGS=""
82     MYSQL_LDFLAGS=""
83     MYSQL_VERSION=""
84
85     dnl
86     dnl Check MySQL libraries (libpq)
87     dnl
88
89     if test "$want_mysql" = "yes"; then
90
91         if test -z "$MYSQL_CONFIG" -o test; then
92             AC_PATH_PROG([MYSQL_CONFIG], [mysql_config], [no])
93         fi
94
95         if test "$MYSQL_CONFIG" != "no"; then
96             AC_MSG_CHECKING([for MySQL libraries])
97
98             MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`"
99             MYSQL_LDFLAGS="`$MYSQL_CONFIG --libs`"
100
101             MYSQL_VERSION=`$MYSQL_CONFIG --version`
102
103             AC_DEFINE([HAVE_MYSQL], [1],
104                 [Define to 1 if MySQL libraries are available])
105
106             found_mysql="yes"
107             AC_MSG_RESULT([yes])
108         else
109             found_mysql="no"
110             AC_MSG_RESULT([no])
111         fi
112     fi
113
114     dnl
115     dnl Check if required version of MySQL is available
116     dnl
117
118
119     mysql_version_req=ifelse([$1], [], [], [$1])
120
121     if test "$found_mysql" = "yes" -a -n "$mysql_version_req"; then
122
123         AC_MSG_CHECKING([if MySQL version is >= $mysql_version_req])
124
125         dnl Decompose required version string of MySQL
126         dnl and calculate its number representation
127         mysql_version_req_major=`expr $mysql_version_req : '\([[0-9]]*\)'`
128         mysql_version_req_minor=`expr $mysql_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
129         mysql_version_req_micro=`expr $mysql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
130         if test "x$mysql_version_req_micro" = "x"; then
131             mysql_version_req_micro="0"
132         fi
133
134         mysql_version_req_number=`expr $mysql_version_req_major \* 1000000 \
135                                    \+ $mysql_version_req_minor \* 1000 \
136                                    \+ $mysql_version_req_micro`
137
138         dnl Decompose version string of installed MySQL
139         dnl and calculate its number representation
140         mysql_version_major=`expr $MYSQL_VERSION : '\([[0-9]]*\)'`
141         mysql_version_minor=`expr $MYSQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'`
142         mysql_version_micro=`expr $MYSQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
143         if test "x$mysql_version_micro" = "x"; then
144             mysql_version_micro="0"
145         fi
146
147         mysql_version_number=`expr $mysql_version_major \* 1000000 \
148                                    \+ $mysql_version_minor \* 1000 \
149                                    \+ $mysql_version_micro`
150
151         mysql_version_check=`expr $mysql_version_number \>\= $mysql_version_req_number`
152         if test "$mysql_version_check" = "1"; then
153             AC_MSG_RESULT([yes])
154         else
155             AC_MSG_RESULT([no])
156         fi
157     fi
158
159     AC_SUBST([MYSQL_VERSION])
160     AC_SUBST([MYSQL_CFLAGS])
161     AC_SUBST([MYSQL_LDFLAGS])
162 ])
163
164 #
165 # SYNOPSIS
166 #
167 #   CHECK_SSL
168 #
169 # DESCRIPTION
170 #
171 #   This macro will check various standard spots for OpenSSL including
172 #   a user-supplied directory. The user uses '--with-ssl' or
173 #   '--with-ssl=/path/to/ssl' as arguments to configure.
174 #
175 #   If OpenSSL is found the include directory gets added to CFLAGS and
176 #   CXXFLAGS as well as '-DHAVE_SSL', '-lssl' & '-lcrypto' get added to
177 #   LIBS, and the libraries location gets added to LDFLAGS. Finally
178 #   'HAVE_SSL' gets set to 'yes' for use in your Makefile.in I use it
179 #   like so (valid for gmake):
180 #
181 #       HAVE_SSL = @HAVE_SSL@
182 #       ifeq ($(HAVE_SSL),yes)
183 #           SRCS+= @srcdir@/my_file_that_needs_ssl.c
184 #       endif
185 #
186 #   For bsd 'bmake' use:
187 #
188 #       .if ${HAVE_SSL} == "yes"
189 #           SRCS+= @srcdir@/my_file_that_needs_ssl.c
190 #       .endif
191 #
192 # LAST MODIFICATION
193 #
194 #   2003-01-28
195 #
196 # COPYLEFT
197 #
198 #   Copyright (c) 2003 Mark Ethan Trostler <trostler@juniper.net>
199 #
200 #   Copying and distribution of this file, with or without
201 #   modification, are permitted in any medium without royalty provided
202 #   the copyright notice and this notice are preserved.
203
204 AC_DEFUN([CHECK_SSL],
205 [AC_MSG_CHECKING(if ssl is wanted)
206 AC_ARG_WITH(ssl,
207 [  --with-ssl enable ssl [will check /usr/local/ssl
208                             /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr ]
209 ],
210 [   AC_MSG_RESULT(yes)
211     for dir in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
212         ssldir="$dir"
213         if test -f "$dir/include/openssl/ssl.h"; then
214             found_ssl="yes";
215             CFLAGS="$CFLAGS -I$ssldir/include/";
216             CXXFLAGS="$CXXFLAGS -I$ssldir/include/";
217             break;
218         fi
219         if test -f "$dir/include/ssl.h"; then
220             found_ssl="yes";
221             CFLAGS="$CFLAGS -I$ssldir/include/";
222             CXXFLAGS="$CXXFLAGS -I$ssldir/include/";
223             break
224         fi
225     done
226     if test x_$found_ssl != x_yes; then
227         AC_MSG_ERROR(Cannot find ssl libraries)
228     else
229         printf "OpenSSL found in $ssldir\n";
230         LIBS="$LIBS -lssl -lcrypto";
231         LDFLAGS="$LDFLAGS -L$ssldir/lib";
232         HAVE_SSL=yes
233     fi
234     AC_SUBST(HAVE_SSL)
235 ],
236 [
237     AC_MSG_RESULT(no)
238 ])
239 ])dnl
240
241 ##### http://autoconf-archive.cryp.to/type_socklen_t.html
242 #
243 # SYNOPSIS
244 #
245 #   TYPE_SOCKLEN_T
246 #
247 # DESCRIPTION
248 #
249 #   Check whether sys/socket.h defines type socklen_t. Please note that
250 #   some systems require sys/types.h to be included before sys/socket.h
251 #   can be compiled.
252 #
253 # LAST MODIFICATION
254 #
255 #   2005-01-11
256 #
257 # COPYLEFT
258 #
259 #   Copyright (c) 2005 Lars Brinkhoff <lars@nocrew.org>
260 #
261 #   This program is free software; you can redistribute it and/or
262 #   modify it under the terms of the GNU General Public License as
263 #   published by the Free Software Foundation; either version 2 of the
264 #   License, or (at your option) any later version.
265 #
266 #   This program is distributed in the hope that it will be useful, but
267 #   WITHOUT ANY WARRANTY; without even the implied warranty of
268 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
269 #   General Public License for more details.
270 #
271 #   You should have received a copy of the GNU General Public License
272 #   along with this program; if not, write to the Free Software
273 #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
274 #   02111-1307, USA.
275 #
276 #   As a special exception, the respective Autoconf Macro's copyright
277 #   owner gives unlimited permission to copy, distribute and modify the
278 #   configure scripts that are the output of Autoconf when processing
279 #   the Macro. You need not follow the terms of the GNU General Public
280 #   License when using or distributing such scripts, even though
281 #   portions of the text of the Macro appear in them. The GNU General
282 #   Public License (GPL) does govern all other use of the material that
283 #   constitutes the Autoconf Macro.
284 #
285 #   This special exception to the GPL applies to versions of the
286 #   Autoconf Macro released by the Autoconf Macro Archive. When you
287 #   make and distribute a modified version of the Autoconf Macro, you
288 #   may extend this special exception to the GPL to apply to your
289 #   modified version as well.
290
291 AC_DEFUN([TYPE_SOCKLEN_T],
292 [AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
293 [
294   AC_TRY_COMPILE(
295   [#include <sys/types.h>
296    #include <sys/socket.h>],
297   [socklen_t len = 42; return 0;],
298   ac_cv_type_socklen_t=yes,
299   ac_cv_type_socklen_t=no)
300 ])
301   if test $ac_cv_type_socklen_t != yes; then
302     AC_DEFINE(socklen_t, int, [Substitute for socklen_t])
303   fi
304 ])
305
306
307 ##### http://autoconf-archive.cryp.to/lib_socket_nsl.html
308 #
309 # SYNOPSIS
310 #
311 #   LIB_SOCKET_NSL
312 #
313 # DESCRIPTION
314 #
315 #   This macro figures out what libraries are required on this platform
316 #   to link sockets programs.
317 #
318 #   The common cases are not to need any extra libraries, or to need
319 #   -lsocket and -lnsl. We need to avoid linking with libnsl unless we
320 #   need it, though, since on some OSes where it isn't necessary it
321 #   will totally break networking. Unisys also includes gethostbyname()
322 #   in libsocket but needs libnsl for socket().
323 #
324 # LAST MODIFICATION
325 #
326 #   2005-09-06
327 #
328 # COPYLEFT
329 #
330 #   Copyright (c) 2005 Russ Allbery <rra@stanford.edu>
331 #   Copyright (c) 2005 Stepan Kasal <kasal@ucw.cz>
332 #   Copyright (c) 2005 Warren Young <warren@etr-usa.com>
333 #
334 #   Copying and distribution of this file, with or without
335 #   modification, are permitted in any medium without royalty provided
336 #   the copyright notice and this notice are preserved.
337
338 AC_DEFUN([LIB_SOCKET_NSL],
339 [
340     AC_SEARCH_LIBS([gethostbyname], [nsl])
341     AC_SEARCH_LIBS([socket], [socket], [], [
342         AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
343         [], [-lnsl])])
344 ])
345
346 ##### http://autoconf-archive.cryp.to/ac_func_snprintf.html
347 #
348 # SYNOPSIS
349 #
350 #   AC_FUNC_SNPRINTF
351 #
352 # DESCRIPTION
353 #
354 #   Checks for a fully C99 compliant snprintf, in particular checks
355 #   whether it does bounds checking and returns the correct string
356 #   length; does the same check for vsnprintf. If no working snprintf
357 #   or vsnprintf is found, request a replacement and warn the user
358 #   about it. Note: the mentioned replacement is freely available and
359 #   may be used in any project regardless of it's license.
360 #
361 # LAST MODIFICATION
362 #
363 #   2006-10-18
364 #
365 # COPYLEFT
366 #
367 #   Copyright (c) 2006 RĂ¼diger Kuhlmann <info@ruediger-kuhlmann.de>
368 #
369 #   Copying and distribution of this file, with or without
370 #   modification, are permitted in any medium without royalty provided
371 #   the copyright notice and this notice are preserved.
372
373 AC_DEFUN([AC_FUNC_SNPRINTF],
374 [AC_CHECK_FUNCS(snprintf vsnprintf)
375 AC_MSG_CHECKING(for working snprintf)
376 AC_CACHE_VAL(ac_cv_have_working_snprintf,
377 [AC_TRY_RUN(
378 [#include <stdio.h>
379
380 int main(void)
381 {
382     char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
383     char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
384     int i;
385     i = snprintf (bufs, 2, "%s", "111");
386     if (strcmp (bufs, "1")) exit (1);
387     if (i != 3) exit (1);
388     i = snprintf (bufd, 2, "%d", 111);
389     if (strcmp (bufd, "1")) exit (1);
390     if (i != 3) exit (1);
391     exit(0);
392 }], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
393 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
394 AC_MSG_CHECKING(for working vsnprintf)
395 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
396 [AC_TRY_RUN(
397 [#include <stdio.h>
398 #include <stdarg.h>
399
400 int my_vsnprintf (char *buf, const char *tmpl, ...)
401 {
402     int i;
403     va_list args;
404     va_start (args, tmpl);
405     i = vsnprintf (buf, 2, tmpl, args);
406     va_end (args);
407     return i;
408 }
409
410 int main(void)
411 {
412     char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
413     char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
414     int i;
415     i = my_vsnprintf (bufs, "%s", "111");
416     if (strcmp (bufs, "1")) exit (1);
417     if (i != 3) exit (1);
418     i = my_vsnprintf (bufd, "%d", 111);
419     if (strcmp (bufd, "1")) exit (1);
420     if (i != 3) exit (1);
421     exit(0);
422 }], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
423 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
424 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
425   AC_LIBOBJ(snprintf)
426   AC_MSG_WARN([Replacing missing/broken (v)snprintf() with version from http://www.ijs.si/software/snprintf/.])
427   AC_DEFINE(PREFER_PORTABLE_SNPRINTF, 1, "enable replacement (v)snprintf if system (v)snprintf is broken")
428 fi])
429 ##### http://autoconf-archive.cryp.to/ax_lib_postgresql.html
430 #
431 # SYNOPSIS
432 #
433 #   AX_LIB_POSTGRESQL([MINIMUM-VERSION])
434 #
435 # DESCRIPTION
436 #
437 #   This macro provides tests of availability of PostgreSQL 'libpq'
438 #   library of particular version or newer.
439 #
440 #   AX_LIB_POSTGRESQL macro takes only one argument which is optional.
441 #   If there is no required version passed, then macro does not run
442 #   version test.
443 #
444 #   The --with-postgresql option takes one of three possible values:
445 #
446 #   no - do not check for PostgreSQL client library
447 #
448 #   yes - do check for PostgreSQL library in standard locations
449 #   (pg_config should be in the PATH)
450 #
451 #   path - complete path to pg_config utility, use this option if
452 #   pg_config can't be found in the PATH
453 #
454 #   This macro calls:
455 #
456 #     AC_SUBST(POSTGRESQL_CFLAGS)
457 #     AC_SUBST(POSTGRESQL_LDFLAGS)
458 #     AC_SUBST(POSTGRESQL_VERSION)
459 #
460 #   And sets:
461 #
462 #     HAVE_POSTGRESQL
463 #
464 # LAST MODIFICATION
465 #
466 #   2006-07-16
467 #
468 # COPYLEFT
469 #
470 #   Copyright (c) 2006 Mateusz Loskot <mateusz@loskot.net>
471 #
472 #   Copying and distribution of this file, with or without
473 #   modification, are permitted in any medium without royalty provided
474 #   the copyright notice and this notice are preserved.
475
476 AC_DEFUN([AX_LIB_POSTGRESQL],
477 [
478     AC_ARG_WITH([postgresql],
479         AC_HELP_STRING([--with-postgresql=@<:@ARG@:>@],
480             [use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config]
481         ),
482         [
483         if test "$withval" = "no"; then
484             want_postgresql="no"
485         elif test "$withval" = "yes"; then
486             want_postgresql="yes"
487         else
488             want_postgresql="yes"
489             PG_CONFIG="$withval"
490         fi
491         ],
492         [want_postgresql="yes"]
493     )
494
495     POSTGRESQL_CFLAGS=""
496     POSTGRESQL_LDFLAGS=""
497     POSTGRESQL_POSTGRESQL=""
498
499     dnl
500     dnl Check PostgreSQL libraries (libpq)
501     dnl
502
503     if test "$want_postgresql" = "yes"; then
504
505         if test -z "$PG_CONFIG" -o test; then
506             AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
507         fi
508
509         AC_MSG_CHECKING([for PostgreSQL libraries])
510         if test "$PG_CONFIG" != "no"; then
511
512             POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
513             POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
514
515             POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`
516
517             AC_DEFINE([HAVE_POSTGRESQL], [1],
518                 [Define to 1 if PostgreSQL libraries are available])
519
520             found_postgresql="yes"
521             AC_MSG_RESULT([yes])
522         else
523             found_postgresql="no"
524             AC_MSG_RESULT([no])
525         fi
526     fi
527
528     dnl
529     dnl Check if required version of PostgreSQL is available
530     dnl
531
532
533     postgresql_version_req=ifelse([$1], [], [], [$1])
534
535     if test "$found_postgresql" = "yes" -a -n "$postgresql_version_req"; then
536
537         AC_MSG_CHECKING([if PostgreSQL version is >= $postgresql_version_req])
538
539         dnl Decompose required version string of PostgreSQL
540         dnl and calculate its number representation
541         postgresql_version_req_major=`expr $postgresql_version_req : '\([[0-9]]*\)'`
542         postgresql_version_req_minor=`expr $postgresql_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
543         postgresql_version_req_micro=`expr $postgresql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
544         if test "x$postgresql_version_req_micro" = "x"; then
545             postgresql_version_req_micro="0"
546         fi
547
548         postgresql_version_req_number=`expr $postgresql_version_req_major \* 1000000 \
549                                    \+ $postgresql_version_req_minor \* 1000 \
550                                    \+ $postgresql_version_req_micro`
551
552         dnl Decompose version string of installed PostgreSQL
553         dnl and calculate its number representation
554         postgresql_version_major=`expr $POSTGRESQL_VERSION : '\([[0-9]]*\)'`
555         postgresql_version_minor=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'`
556         postgresql_version_micro=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
557         if test "x$postgresql_version_micro" = "x"; then
558             postgresql_version_micro="0"
559         fi
560
561         postgresql_version_number=`expr $postgresql_version_major \* 1000000 \
562                                    \+ $postgresql_version_minor \* 1000 \
563                                    \+ $postgresql_version_micro`
564
565         postgresql_version_check=`expr $postgresql_version_number \>\= $postgresql_version_req_number`
566         if test "$postgresql_version_check" = "1"; then
567             AC_MSG_RESULT([yes])
568         else
569             AC_MSG_RESULT([no])
570         fi
571     fi
572
573     AC_SUBST([POSTGRESQL_VERSION])
574     AC_SUBST([POSTGRESQL_CFLAGS])
575     AC_SUBST([POSTGRESQL_LDFLAGS])
576 ])
577 ##### http://autoconf-archive.cryp.to/ax_lib_sqlite3.html
578 #
579 # SYNOPSIS
580 #
581 #   AX_LIB_SQLITE3([MINIMUM-VERSION])
582 #
583 # DESCRIPTION
584 #
585 #   Test for the SQLite 3 library of a particular version (or newer)
586 #
587 #   This macro takes only one optional argument, required version of
588 #   SQLite 3 library. If required version is not passed, 3.0.0 is used
589 #   in the test of existance of SQLite 3.
590 #
591 #   If no intallation prefix to the installed SQLite library is given
592 #   the macro searches under /usr, /usr/local, and /opt.
593 #
594 #   This macro calls:
595 #
596 #     AC_SUBST(SQLITE3_CFLAGS)
597 #     AC_SUBST(SQLITE3_LDFLAGS)
598 #     AC_SUBST(SQLITE3_VERSION)
599 #
600 #   And sets:
601 #
602 #     HAVE_SQLITE3
603 #
604 # LAST MODIFICATION
605 #
606 #   2006-07-15
607 #
608 # COPYLEFT
609 #
610 #   Copyright (c) 2006 Mateusz Loskot <mateusz@loskot.net>
611 #
612 #   Copying and distribution of this file, with or without
613 #   modification, are permitted in any medium without royalty provided
614 #   the copyright notice and this notice are preserved.
615
616 AC_DEFUN([AX_LIB_SQLITE3],
617 [
618     AC_ARG_WITH([sqlite3],
619         AC_HELP_STRING(
620             [--with-sqlite3=@<:@ARG@:>@],
621             [use SQLite 3 library @<:@default=yes@:>@, optionally specify the prefix for sqlite3 library]
622         ),
623         [
624         if test "$withval" = "no"; then
625             WANT_SQLITE3="no"
626         elif test "$withval" = "yes"; then
627             WANT_SQLITE3="yes"
628             ac_sqlite3_path=""
629         else
630             WANT_SQLITE3="yes"
631             ac_sqlite3_path="$withval"
632         fi
633         ],
634         [WANT_SQLITE3="yes"]
635     )
636
637     SQLITE3_CFLAGS=""
638     SQLITE3_LDFLAGS=""
639     SQLITE3_VERSION=""
640
641     if test "x$WANT_SQLITE3" = "xyes"; then
642
643         ac_sqlite3_header="sqlite3.h"
644
645         sqlite3_version_req=ifelse([$1], [], [3.0.0], [$1])
646         sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
647         sqlite3_version_req_major=`expr $sqlite3_version_req : '\([[0-9]]*\)'`
648         sqlite3_version_req_minor=`expr $sqlite3_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
649         sqlite3_version_req_micro=`expr $sqlite3_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
650         if test "x$sqlite3_version_req_micro" = "x" ; then
651             sqlite3_version_req_micro="0"
652         fi
653
654         sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \
655                                    \+ $sqlite3_version_req_minor \* 1000 \
656                                    \+ $sqlite3_version_req_micro`
657
658         AC_MSG_CHECKING([for SQLite3 library >= $sqlite3_version_req])
659
660         if test "$ac_sqlite3_path" != ""; then
661             ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib"
662             ac_sqlite3_cppflags="-I$ac_sqlite3_path/include"
663         else
664             for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do
665                 if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \
666                     && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then
667                     ac_sqlite3_path=$ac_sqlite3_path_tmp
668                     ac_sqlite3_cppflags="-I$ac_sqlite3_path_tmp/include"
669                     ac_sqlite3_ldflags="-L$ac_sqlite3_path_tmp/lib"
670                     break;
671                 fi
672             done
673         fi
674
675         ac_sqlite3_ldflags="$ac_sqlite3_ldflags -lsqlite3"
676
677         saved_CPPFLAGS="$CPPFLAGS"
678         CPPFLAGS="$CPPFLAGS $ac_sqlite3_cppflags"
679
680         AC_LANG_PUSH(C++)
681         AC_COMPILE_IFELSE(
682             [
683             AC_LANG_PROGRAM([[@%:@include <sqlite3.h>]],
684                 [[
685 #if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number)
686 // Everything is okay
687 #else
688 #  error SQLite version is too old
689 #endif
690                 ]]
691             )
692             ],
693             [
694             AC_MSG_RESULT([yes])
695             success="yes"
696             ],
697             [
698             AC_MSG_RESULT([not found])
699             succees="no"
700             ]
701         )
702         AC_LANG_POP([C++])
703
704         CPPFLAGS="$saved_CPPFLAGS"
705
706         if test "$success" = "yes"; then
707
708             SQLITE3_CFLAGS="$ac_sqlite3_cppflags"
709             SQLITE3_LDFLAGS="$ac_sqlite3_ldflags"
710
711             ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header"
712
713             dnl Retrieve SQLite release version
714             if test "x$ac_sqlite3_header_path" != "x"; then
715                 ac_sqlite3_version=`cat $ac_sqlite3_header_path \
716                     | grep '#define.*SQLITE_VERSION.*\"' | sed -e 's/.* "//' \
717                         | sed -e 's/"//'`
718                 if test $ac_sqlite3_version != ""; then
719                     SQLITE3_VERSION=$ac_sqlite3_version
720                 else
721                     AC_MSG_WARN([Can not find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!])
722                 fi
723             fi
724
725             AC_SUBST(SQLITE3_CFLAGS)
726             AC_SUBST(SQLITE3_LDFLAGS)
727             AC_SUBST(SQLITE3_VERSION)
728             AC_DEFINE(HAVE_SQLITE3)
729         fi
730     fi
731 ])
732 ##### http://autoconf-archive.cryp.to/ax_c___attribute__.html
733 #
734 # SYNOPSIS
735 #
736 #   AX_C___ATTRIBUTE__
737 #
738 # DESCRIPTION
739 #
740 #   Provides a test for the compiler support of __attribute__
741 #   extensions. defines HAVE___ATTRIBUTE__ if it is found.
742 #
743 #   Originating from the 'pork' package by Ryan McCabe <ryan@numb.org>
744 #
745 # LAST MODIFICATION
746 #
747 #   2005-01-21
748 #
749 # COPYLEFT
750 #
751 #   Copyright (c) 2005 Christian Haggstrom <chm@c00.info>
752 #
753 #   This program is free software; you can redistribute it and/or
754 #   modify it under the terms of the GNU General Public License as
755 #   published by the Free Software Foundation; either version 2 of the
756 #   License, or (at your option) any later version.
757 #
758 #   This program is distributed in the hope that it will be useful, but
759 #   WITHOUT ANY WARRANTY; without even the implied warranty of
760 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
761 #   General Public License for more details.
762 #
763 #   You should have received a copy of the GNU General Public License
764 #   along with this program; if not, write to the Free Software
765 #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
766 #   02111-1307, USA.
767 #
768 #   As a special exception, the respective Autoconf Macro's copyright
769 #   owner gives unlimited permission to copy, distribute and modify the
770 #   configure scripts that are the output of Autoconf when processing
771 #   the Macro. You need not follow the terms of the GNU General Public
772 #   License when using or distributing such scripts, even though
773 #   portions of the text of the Macro appear in them. The GNU General
774 #   Public License (GPL) does govern all other use of the material that
775 #   constitutes the Autoconf Macro.
776 #
777 #   This special exception to the GPL applies to versions of the
778 #   Autoconf Macro released by the Autoconf Macro Archive. When you
779 #   make and distribute a modified version of the Autoconf Macro, you
780 #   may extend this special exception to the GPL to apply to your
781 #   modified version as well.
782
783 AC_DEFUN([AX_C___ATTRIBUTE__],
784   [AC_MSG_CHECKING(for __attribute__)
785   AC_CACHE_VAL(ac_cv___attribute__, [
786     AC_TRY_COMPILE(
787       [#include <stdlib.h>
788       static void foo(void) __attribute__ ((unused));
789       static void
790       foo(void) {
791           exit(1);
792       }],,
793       ac_cv___attribute__=yes,
794       ac_cv___attribute__=no
795     )])
796   if test "$ac_cv___attribute__" = "yes"; then
797     AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
798   fi
799   AC_MSG_RESULT($ac_cv___attribute__)
800 ])
801 ##### http://autoconf-archive.cryp.to/ax_gcc_malloc_call.html
802 #
803 # SYNOPSIS
804 #
805 #   AX_GCC_MALLOC_CALL
806 #
807 # DESCRIPTION
808 #
809 #   The macro will compile a test program to see whether the compiler
810 #   does understand the per-function postfix pragma.
811 #
812 # LAST MODIFICATION
813 #
814 #   2006-08-10
815 #
816 # COPYLEFT
817 #
818 #   Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
819 #
820 #   This program is free software; you can redistribute it and/or
821 #   modify it under the terms of the GNU General Public License as
822 #   published by the Free Software Foundation; either version 2 of the
823 #   License, or (at your option) any later version.
824 #
825 #   This program is distributed in the hope that it will be useful, but
826 #   WITHOUT ANY WARRANTY; without even the implied warranty of
827 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
828 #   General Public License for more details.
829 #
830 #   You should have received a copy of the GNU General Public License
831 #   along with this program; if not, write to the Free Software
832 #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
833 #   02111-1307, USA.
834 #
835 #   As a special exception, the respective Autoconf Macro's copyright
836 #   owner gives unlimited permission to copy, distribute and modify the
837 #   configure scripts that are the output of Autoconf when processing
838 #   the Macro. You need not follow the terms of the GNU General Public
839 #   License when using or distributing such scripts, even though
840 #   portions of the text of the Macro appear in them. The GNU General
841 #   Public License (GPL) does govern all other use of the material that
842 #   constitutes the Autoconf Macro.
843 #
844 #   This special exception to the GPL applies to versions of the
845 #   Autoconf Macro released by the Autoconf Macro Archive. When you
846 #   make and distribute a modified version of the Autoconf Macro,