Bug 1071: Document get_dom_node_value return values
[elinks/kon.git] / configure.in
blob631b605961d0bcfe8403e34edd01e6041e8c4bb2
1 dnl Process this file with autoconf to produce a configure script.
3 dnl There are two types of comments in this file.
4 dnl Comments that refer to Autoconf macros begin with "dnl", and m4
5 dnl discards them.  Other comments begin with "#", and they get copied
6 dnl to the configure script, hopefully making it easier to read.
8 dnl Autoconf 2.13 generates an incomplete config.h.in; see ELinks bug 936.
9 dnl Autoconf 2.59 is installed in the computer that generates our nightly
10 dnl snapshots, so we need to be compatible with that.
11 AC_PREREQ(2.59)
12 AC_INIT
13 AC_CONFIG_SRCDIR([src/main/main.c])
14 AC_CONFIG_AUX_DIR(config)
16 PACKAGE=elinks
17 VERSION=0.12pre3.GIT
18 AC_SUBST(PACKAGE)
19 AC_SUBST(VERSION)
20 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
21 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
22 AC_CONFIG_HEADERS(config.h)
24 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
25 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
26 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
28 MAKE=
30 for make in gnumake gmake make false; do
31         if test "x$MAKE" = x; then
32                 AC_PATH_PROGS(MAKE, "$make")
33         fi
34 done
36 builddir="`pwd`"
38 # Cleanup if we are configuring with a previous build in the tree
39 if test -e Makefile.config; then
40         AC_MSG_CHECKING([for previous build to clean])
41         "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
42         AC_MSG_RESULT(done)
45 # ===================================================================
46 # Load feature configuration file and start logging features.
47 # ===================================================================
49 features="features.conf"
50 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
51 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
52 echo "Feature summary:" > features.log
54 # ===================================================================
55 # Checks for programs.
56 # ===================================================================
58 AC_PROG_CC
59 AC_PROG_AWK
60 AC_PATH_PROGS(AWK, "$AWK")
61 AC_PROG_RANLIB
62 AC_PROG_INSTALL
64 AC_PATH_PROGS(GIT, "git")
65 AC_PATH_PROGS(SPARSE, "sparse")
67 CONFIG_ASCIIDOC="no"
68 CONFIG_POD2HTML="no"
69 CONFIG_XMLTO="no"
70 CONFIG_JW="no"
72 if test "x$CONFIG_DOC" != xno; then
73         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
74         if test "x$ASCIIDOC" != "x"; then
75                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
76                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
77                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
79                 echo > config.asciidoc-unsafe.txt
80                 if "$ASCIIDOC" --unsafe config.asciidoc-unsafe.txt >/dev/null 2>/dev/null; then
81                         ASCIIDOC_FLAGS=--unsafe
82                 fi
83                 rm config.asciidoc-unsafe.*
84         fi
86         AC_PATH_PROGS(XMLTO, "xmlto")
87         if test "x$XMLTO" != "x"; then
88                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
89                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
90                 EL_CONFIG(MAN_XMLTO, [man (groff)])
91         fi
93         AC_PATH_PROGS(JW, "jw")
94         if test "x$JW" != "x"; then
95                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
96                 EL_CONFIG(MANUAL_JW, [PDF])
97         fi
99         AC_PATH_PROGS(POD2HTML, "pod2html")
100         if test "x$POD2HTML" != "x"; then
101                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
102         fi
104         AC_PATH_PROGS(DOXYGEN, "doxygen")
105         if test "x$DOXYGEN" != "x"; then
106                 EL_CONFIG(CONFIG_DOXYGEN, [Doxygen])
107                 api_srcdir="$(cd "$srcdir" && pwd)/src"
108                 AC_SUBST(api_srcdir)
109         fi
112 AC_SUBST(ASCIIDOC_FLAGS)
113 AC_SUBST(CONFIG_ASCIIDOC)
114 AC_SUBST(CONFIG_DOXYGEN)
115 AC_SUBST(CONFIG_POD2HTML)
116 AC_SUBST(CONFIG_XMLTO)
117 AC_SUBST(CONFIG_JW)
119 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
120 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
121 EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
122 EL_CONFIG_DEPENDS(CONFIG_APIDOCS, [CONFIG_DOXYGEN], [API Documentation])
124 # gcc specific options (to be continued at the bottom of configure)
125 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
126   # We want to see all warnings and live with none.
127   # We can't set up -Werror here as there may be some warnings in test
128   # suite of configure, and we don't want to fail them.
129   CFLAGS="$CFLAGS -Wall"
132 # ===================================================================
133 # Checks for special OSes.
134 # ===================================================================
136 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
137 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
139         AC_MSG_CHECKING([for $2])
141         for flag in $3; do
142                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef $flag
143 kill me!
144 #endif ]])],[$1=yes],[$1=no])
145                 if test "[$]$1" = yes; then
146                         EL_CONFIG([$1], [$2])
147                         break
148                 fi
149         done
151         AC_MSG_RESULT([$]$1)
154 EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
155 AC_SUBST(CONFIG_OS_BEOS)
157 EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
158 AC_SUBST(CONFIG_OS_RISCOS)
160 EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
161 AC_SUBST(CONFIG_OS_WIN32)
163 EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
164 AC_SUBST(CONFIG_OS_OS2)
165 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
167 AC_MSG_CHECKING([for UNIX])
168 dnl FIXME: some depend kind of mechanism
169 if test "$CONFIG_OS_BEOS" = no && \
170    test "$CONFIG_OS_RISCOS" = no && \
171    test "$CONFIG_OS_WIN32" = no && \
172    test "$CONFIG_OS_OS2" = no; then
173         EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
174 else
175         CONFIG_OS_UNIX=no
177 AC_MSG_RESULT($CONFIG_OS_UNIX)
178 AC_SUBST(CONFIG_OS_UNIX)
180 # ===================================================================
181 # Checks for header files.
182 # ===================================================================
184 AC_HEADER_DIRENT
185 AC_HEADER_STDC
186 AC_HEADER_SYS_WAIT
187 AC_HEADER_TIME
189 AC_CHECK_HEADERS(wctype.h)
190 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
191 AC_CHECK_HEADERS(sigaction.h)
192 AC_CHECK_HEADERS(arpa/inet.h)
193 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
194 AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/in6_var.h)
195 AC_CHECK_HEADERS(ifaddrs.h)
196 AC_CHECK_HEADERS(sys/cygwin.h io.h)
197 AC_CHECK_HEADERS(sys/fmutex.h)
198 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
199 AC_CHECK_HEADERS(sys/resource.h)
200 AC_CHECK_HEADERS(sys/select.h)
201 AC_CHECK_HEADERS(sys/signal.h)
202 AC_CHECK_HEADERS(sys/socket.h)
203 AC_CHECK_HEADERS(sys/time.h)
204 AC_CHECK_HEADERS(sys/utsname.h)
205 AC_CHECK_HEADERS([net/if.h], [], [],
206 [[#ifdef HAVE_SYS_SOCKET_H
207 # include <sys/socket.h> /* <net/if.h> on Mac OS X 10.5.4 needs this */
208 #endif
210 AC_CHECK_HEADERS(stdint.h inttypes.h)
211 AC_CHECK_HEADERS(locale.h pwd.h)
212 AC_CHECK_HEADERS(termios.h)
215 AC_CHECK_HEADERS(sys/un.h,
216         [CONFIG_INTERLINK=yes
217          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
218         [CONFIG_INTERLINK=no])
219 AC_SUBST(CONFIG_INTERLINK)
221 # ===================================================================
222 # Checks for typedefs, structures, and compiler characteristics.
223 # ===================================================================
225 AC_STRUCT_TM
226 AC_C_CONST
227 AC_C_INLINE
228 AC_MSG_CHECKING([[C99-conforming inline]])
229 AC_COMPILE_IFELSE([[
230         int add(int x);
232         static int sum;
234         inline int
235         add(int change)
236         {
237                 sum += change;
238                 return sum;
239         }
241         int
242         sub(int change)
243         {
244                 return add(-change);
245         }]],
246         [AC_MSG_RESULT([[yes]])
247          AC_DEFINE([NONSTATIC_INLINE], [inline],
248                 [Define as inline if the compiler lets you declare a function without inline, then define it with inline, and have that definition refer to identifiers with internal linkage.  This is allowed by C99 6.7.4p6 and 6.7.4p3 together.  Otherwise define as nothing.])],
249         [AC_MSG_RESULT([[no]])
250          AC_DEFINE([NONSTATIC_INLINE], [])])
251 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
253 AC_SYS_LARGEFILE
254 AC_TYPE_SIZE_T
255 AC_TYPE_OFF_T
256 EL_CHECK_TYPE(ssize_t, int)
257 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
258 EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
259 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
260 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
261 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
263 AC_CHECK_SIZEOF(char, 1)
264 AC_CHECK_SIZEOF(short, 2)
265 AC_CHECK_SIZEOF(int, 4)
266 AC_CHECK_SIZEOF(long, 4)
267 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
268 test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
270 # Check for variadic macros
271 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
272                 [#include <stdio.h>
273                  #define a(b,c...) printf(b,##c)],
274                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
276 # ===================================================================
277 # Checks for library functions.
278 # ===================================================================
280 AC_PROG_GCC_TRADITIONAL
281 AC_FUNC_MEMCMP
282 AC_FUNC_MMAP
283 AC_FUNC_STRFTIME
284 AC_CHECK_FUNCS(atoll gethostbyaddr herror strerror)
285 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
286 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
287 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
288 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
289 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
290 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
291 AC_CHECK_FUNCS(gettimeofday clock_gettime)
293 AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
295 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
296 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
297 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
299 # These aren't probably needed now, as they are commented in links.h.
300 # I've no idea about their historical background, but I keep them here
301 # just in the case they will help later. --pasky
302 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
303 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
304 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
305 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
307 if test x"$HAVE_RAISE" = x; then
308         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
309                 AC_MSG_ERROR([Unable to emulate raise()])
310         fi
313 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
314 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
315 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],[el_cv_HAVE_VA_COPY=yes],[el_cv_HAVE_VA_COPY=no])])
316 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
317         EL_DEFINE(HAVE_VA_COPY, __va_copy)
320 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
321 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
322 ]], [[int page_size = sysconf(_SC_PAGE_SIZE);]])],[el_cv_HAVE_SC_PAGE_SIZE=yes],[el_cv_HAVE_SC_PAGE_SIZE=no])])
323 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
324         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
327 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
328 AC_RUN_IFELSE([AC_LANG_SOURCE([[
329 #include <stdio.h>
330 #include <stdarg.h>
331 #include <stdlib.h>
332 #include <string.h>
334 char buf[8];
336 int bar(char *buf, const char *format, va_list ap)
338        return vsnprintf(buf, 0, format, ap);
341 void foo(const char *format, ...) {
342        va_list ap;
343        int len;
345        va_start(ap, format);
346        len = bar(buf, format, ap);
347        va_end(ap);
348        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
350        va_start(ap, format);
351        len = bar(buf, format, ap);
352        va_end(ap);
353        if ((len != 6) && (len != 7)) exit(1);
355        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
357        exit(0);
359 main() { foo("hello\n"); }
360 ]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
361 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
362         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
365 # OpenSSL and Lua frequently need dlopen
366 AC_CHECK_LIB(dl, dlopen)
368 # ===================================================================
369 # Checks for libraries.
370 # ===================================================================
372 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
373 if test "$cf_result" = no; then
374         AC_CHECK_LIB(socket, socket)
377 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
378 if test "$cf_result" = no; then
379         AC_CHECK_LIB(socket, setsockopt)
382 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
383 if test "$cf_result" = no; then
384         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
385         if test "$cf_result" = no; then
386                 AC_CHECK_LIB(nsl, gethostbyname)
387         else
388                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
389         fi
392 # ===================================================================
393 # Checks for packaging specific options.
394 # ===================================================================
396 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
397             [ if test "$withval" != no && test "$withval" != yes; then
398                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
399               fi ])
401 # ===================================================================
402 # Checks for a libraries, optional even if installed.
403 # ===================================================================
405 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
406 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
408         AC_MSG_CHECKING([for $2 support])
410         if test "[$]$1" != no; then
411                 AC_MSG_RESULT(yes)
412                 EL_SAVE_FLAGS
413                 if test -n "$withval" && test -d "$withval"; then
414                         # Be a little more careful when setting
415                         # include and lib directories. This way
416                         # $withval will work when includes are
417                         # there but the library is in the common
418                         # /usr/lib ... Does the right thing when
419                         # looking for gc on Debian.
420                         if test -d "$withval/include"; then
421                                 CFLAGS="$CFLAGS -I$withval/include"
422                                 CPPFLAGS="$CPPFLAGS -I$withval/include"
423                         else
424                                 CFLAGS="$CFLAGS -I$withval"
425                                 CPPFLAGS="$CPPFLAGS -I$withval"
426                         fi
427                         if test -d "$withval/lib"; then
428                                 LDFLAGS="$LDFLAGS -L$withval/lib"
429                         fi
430                 fi
432                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
433                 if test "[$]$1" = yes; then
434                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
435                 fi
437                 if test "[$]$1" = yes; then
438                         EL_CONFIG([$1], [$2])
439                         LIBS="$LIBS -l$4"
440                 else
441                         if test -n "[$]WITHVAL_$1" &&
442                            test "[$]WITHVAL_$1" != xno; then
443                                 AC_MSG_ERROR([$2 not found])
444                         fi
445                         EL_RESTORE_FLAGS
446                 fi
447         else
448                 AC_MSG_RESULT(disabled)
449         fi
452 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
453 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
455         if test "x[$]$1" != xno; then $1=yes; fi
456         WITHVAL_$1=
458         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
459         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
460         if test "x[$]WITHVAL_$1" = xyes; then $1=yes; fi
462         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
464         EL_LOG_CONFIG([$1], [$2], [])
467 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
468         [  --without-gpm           disable gpm (mouse) support])
470 # ELinks calls deflateInit2 with windowBits = MAX_WBITS | 32, to
471 # enable automatic decoding of both zlib and gzip headers.  This
472 # feature was added in zlib 1.2.0.2; earlier versions return an error.
473 # The gzclearerr function was also added in zlib 1.2.0.2, so check for
474 # that, even though ELinks does not actually call gzclearerr.
475 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
476         [  --without-zlib          disable zlib support])
478 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
479         [  --without-bzlib         disable bzlib support])
481 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
482         [  --without-idn           disable international domain names support])
484 if test "x${with_gc}" != xno; then
485         EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
486                 [  --with-gc               enable Boehm's garbage collector])
489 # LZMA disabled by default, because of little usability and compilation problems
490 # with new xz
491 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
492         [  --with-lzma             enable lzma encoding support])
494 # ===================================================================
495 # Check for GSSAPI, optional even if installed.
496 # ===================================================================
498 enable_gssapi="no";
500 AC_ARG_WITH(gssapi, [  --with-gssapi           enable GSSAPI support],
501             [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
503 AC_MSG_CHECKING([for GSSAPI])
505 if test "$enable_gssapi" = "yes"; then
506         AC_MSG_RESULT(yes)
507         GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
508         GSSAPI_LIBS=`krb5-config --libs gssapi`
509         CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
510         LIBS="$GSSAPI_LIBS $LIBS"
511         EL_CONFIG(CONFIG_GSSAPI, [GssApi])
512 else
513         AC_MSG_RESULT(no)
516 AC_SUBST(CONFIG_GSSAPI)
518 # ===================================================================
519 # Bookmark and XBEL support
520 # ===================================================================
522 EL_SAVE_FLAGS
524 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
525               [  --disable-bookmarks     disable bookmark support])
527 # Check whether --enable-xbel or --disable-xbel was given.
528 if test "x${enable_xbel}" != xno; then
529         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
531         if test "$HAVE_LIBEXPAT" = yes; then
532                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
533                 if test "$HAVE_LIBEXPAT" = yes; then
534                         LIBS="$LIBS -lexpat"
535                 fi
536         fi
540 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
541               [XBEL bookmarks],
542               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
544 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
545         EL_RESTORE_FLAGS
548 # ===================================================================
549 # Checks for BSD sysmouse
550 # ===================================================================
552 HAVE_SYSMOUSE_HEADER="no"
554 # Either of these header files provides the (same) sysmouse interface
555 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
557 # ===================================================================
558 # Checks for OS/2
559 # ===================================================================
561 if test "$CONFIG_OS_OS2" = yes; then
562         EL_CONFIG_OS_OS2
565 # ===================================================================
566 # Checks for Win32
567 # ===================================================================
569 if test "$CONFIG_OS_WIN32" = yes; then
570         EL_CONFIG_OS_WIN32
573 # ===================================================================
574 # Check for SEE (Simple Ecmascript Engine)
575 # ===================================================================
576 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
577             [ if test "x$withval" != xno; then enable_see=yes; fi ])
579 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
580 # GUILE_FLAGS but I really don't want to require people to have Guile in order
581 # to compile CVS. Also, the macro seems to be really stupid regarding searching
582 # for Guile in $PATH etc. --pasky
584 CONFIG_ECMASCRIPT_SEE=no
586 if test "$enable_see" = "yes"; then
587         if test -d "$withval"; then
588                 SEE_PATH="$withval:$PATH"
589         else
590                 SEE_PATH="$PATH"
591         fi
593         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
594         AC_MSG_CHECKING([for SEE (2.0.1131 or later)])
595         if test "$SEE_CONFIG" != no; then
596                 EL_SAVE_FLAGS
597                 SEE_LIBS="`$SEE_CONFIG --libs`"
598                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
599                 CPPFLAGS="$SEE_CFLAGS $CPPFLAGS"
600                 LIBS="$SEE_LIBS $LIBS_X"
601                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <see/see.h>]], [[#if SEE_VERSION_API_MAJOR < 2
602                         #error SEE too old
603                         #endif
604                 ]])],[cf_result=yes],[cf_result=no])
605                 EL_RESTORE_FLAGS
606                 if test "$cf_result" = yes; then
607                         LIBS="$SEE_LIBS $LIBS"
608                         EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
609                         AC_SUBST(SEE_CFLAGS)
610                 fi
611                 AC_MSG_RESULT($cf_result)
612         else
613                 if test -n "$withval" && test "x$withval" != xno; then
614                         AC_MSG_ERROR([SEE not found])
615                 else
616                         AC_MSG_WARN([SEE support disabled])
617                 fi
618         fi
621 # ===================================================================
622 # Check for SpiderMonkey, optional even if installed.
623 # ===================================================================
625 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
626             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
627 AC_MSG_CHECKING([for SpiderMonkey (1.5 RC3a or later)])
629 EL_SAVE_FLAGS
630 cf_result=no
632 if test -z "$disable_spidermonkey"; then
633         if test ! -d "$withval"; then
634                 withval="";
635         fi
636         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
637                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
638                         for spidermonkeylib in js smjs mozjs; do
639                                 if test "$cf_result" = no &&
640                                    test -f "$spidermonkeydir$spidermonkeyinclude/jsapi.h"; then
641                                         SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib -l$spidermonkeylib"
642                                         SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
644                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
645                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
646                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
648                                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
649                                                      #include <jsapi.h>]], [[JS_GetReservedSlot(NULL, NULL, 0, NULL)]])],[cf_result=yes],[cf_result=no])
650                                 fi
651                         done
652                 done
653         done
656 AC_MSG_RESULT($cf_result)
657 CONFIG_SPIDERMONKEY="$cf_result"
658 if test "$cf_result" = "yes"; then
659         AC_CHECK_FUNCS([[JS_ReportAllocationOverflow]])
661 EL_RESTORE_FLAGS
663 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
664    test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
665         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
666 else
667         CONFIG_ECMASCRIPT_SMJS=no
670 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
671 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
672 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
675 # ===================================================================
676 # Optional Spidermonkey-based ECMAScript browser scripting
677 # ===================================================================
679 AC_ARG_ENABLE(sm-scripting,
680               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
681               [if test "$enableval" != no; then enableval="yes"; fi
682                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
684 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
685    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
686         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
687 else
688         CONFIG_SCRIPTING_SPIDERMONKEY=no
691 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
692    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
693         LIBS="$LIBS $SPIDERMONKEY_LIBS"
694         AC_SUBST(SPIDERMONKEY_LIBS)
695         AC_SUBST(SPIDERMONKEY_CFLAGS)
696         AC_SUBST(CONFIG_SPIDERMONKEY)
699 # ===================================================================
700 # Check for Guile, optional even if installed.
701 # ===================================================================
703 enable_guile="no";
705 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
706             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
708 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
709 # GUILE_FLAGS but I really don't want to require people to have Guile in order
710 # to compile CVS. Also, the macro seems to be really stupid regarding searching
711 # for Guile in $PATH etc. --pasky
713 AC_MSG_CHECKING([for Guile])
715 if test "$enable_guile" = "yes"; then
716         AC_MSG_RESULT(yes);
717         ## Based on the GUILE_FLAGS macro.
719         if test -d "$withval"; then
720                 GUILE_PATH="$withval:$PATH"
721         else
722                 GUILE_PATH="$PATH"
723         fi
725         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
727         ## First, let's just see if we can find Guile at all.
728         if test "$GUILE_CONFIG" != no; then
729                 cf_result="yes";
731                 GUILE_LIBS="`guile-config link`"
732                 GUILE_CFLAGS="`guile-config compile`"
733                 LIBS="$GUILE_LIBS $LIBS"
734                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
735                 AC_SUBST(GUILE_CFLAGS)
736                 cat <<EOF
737 ***********************************************************************
738 The Guile support is incomplete and not so well integrated to ELinks
739 yet. That means, e.g., that you have no Guile console and there might
740 not be all the necessary hooks. Also, the Guile interface is not too
741 well tested (success stories heartily welcomed!).  See
742 src/scripting/guile/README for further details and hints.
743 ***********************************************************************
745         else
746                 if test -n "$withval" && test "x$withval" != xno; then
747                         AC_MSG_ERROR([Guile not found])
748                 else
749                         AC_MSG_WARN([Guile support disabled])
750                 fi
751         fi
752 else
753         AC_MSG_RESULT(no);
756 # ===================================================================
757 # Check for Perl
758 # ===================================================================
759 enable_perl="no";
761 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
762             [
763 if test "$withval" = yes; then
764         # FIXME: If withval is a valid directory append it to PATH
765         # so that you can specify one of several perl installations.
766         withval="";
767         enable_perl=yes;
769             ])
771 AC_MSG_CHECKING([for Perl])
773 cf_result=no
775 EL_SAVE_FLAGS
777 if test "$enable_perl" = "yes"; then
778         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
779         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
780         LIBS="$PERL_LIBS $LIBS"
781         CFLAGS="$PERL_CFLAGS $CFLAGS"
782         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
783         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
784 #include <EXTERN.h>
785 #include <perl.h>
786 #include <perlapi.h>
787 ]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
790 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
792 AC_MSG_CHECKING([whether POPpx works without an n_a variable])
793 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
794 #include <EXTERN.h>
795 #include <perl.h>
796 extern PerlInterpreter *my_perl;
797 ]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
798 AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
799                 [Define if using Perl 5.8.8 or later, where the "POPpx" macro
800 no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
802 if test "$cf_result" != "yes"; then
803         EL_RESTORE_FLAGS
804 else
805         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
807         CFLAGS="$CFLAGS_X"
808         CPPFLAGS="$CPPFLAGS_X"
809         AC_SUBST(PERL_LIBS)
810         AC_SUBST(PERL_CFLAGS)
813 # ===================================================================
814 # Check for Python
815 # ===================================================================
816 enable_python="no";
818 AC_ARG_WITH(python, [[  --with-python[=DIR]     enable Python support]],
819             [ if test "x$withval" != xno; then enable_python=yes; fi ])
821 EL_SAVE_FLAGS
822 cf_result=no
824 AC_MSG_CHECKING([for Python])
826 if test "$enable_python" = "yes"; then
827         AC_MSG_RESULT(yes);
829         if test -d "$withval"; then
830                 PYTHON_PATH="$withval:$PATH"
831         else
832                 PYTHON_PATH="$PATH"
833         fi
835         AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
837         if test "$PYTHON" != no; then
838                 cf_result="yes";
840                 PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; print "-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True))'`"
841                 PYTHON_LIBS="`$PYTHON -c 'from distutils import sysconfig; var = sysconfig.get_config_var; print "%s %s %s -L%s -lpython%s" % (var("LINKFORSHARED"), var("LIBS"), var("SYSLIBS"), var("LIBPL"), var("VERSION"))'`"
842                 LIBS="$PYTHON_LIBS $LIBS"
843                 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
844                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
846                 if test "$cf_result" != "yes"; then
847                         EL_RESTORE_FLAGS
848                 else
849                         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
850                         AC_SUBST(PYTHON_LIBS)
851                         AC_SUBST(PYTHON_CFLAGS)
852                         CPPFLAGS="$CPPFLAGS_X"
853                         cat <<EOF
854 ***********************************************************************
855 The Python support is incomplete and not so well integrated to ELinks
856 yet. That means, e.g., that you have no Python console and there might
857 not be all the necessary hooks. Also, the Python interface is not too
858 well tested (success stories heartily welcomed!).
859 ***********************************************************************
861                 fi
862         else
863                 if test -n "$withval" && test "x$withval" != xno; then
864                         AC_MSG_ERROR([Python not found])
865                 else
866                         AC_MSG_WARN([Python support disabled])
867                 fi
868         fi
869 else
870         AC_MSG_RESULT(no);
874 # ===================================================================
875 # Check for Lua, optional even if installed.
876 # ===================================================================
878 # Do this the long way, as FreeBSD reportedly needs -L<dir> for
879 # anything other than /usr/lib, and Lua is very often in /usr/local/lib.
881 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
882             [if test "$withval" = no; then disable_lua=yes; fi])
883 AC_MSG_CHECKING([for Lua])
885 EL_SAVE_FLAGS
886 cf_result=no
888 if test -z "$disable_lua"; then
889         if test ! -d "$withval"; then
890                 withval="";
891         fi
892         for luadir in "$withval" "" /usr /usr/local; do
893                 for suffix in "" 50; do
894                         if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
895                            test -f "$luadir/include/lua$suffix/lua.h" ) ; then
896                                 LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm"
897                                 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
899                                 LIBS="$LUA_LIBS $LIBS_X"
900                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
901                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
903                                 # Check that it is a compatible Lua version
904                                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[      #include <lua.h>
905                                                 #include <lualib.h>]], [[       lua_State *L = lua_open();
906                                                 luaopen_base(L);
907                                                 luaopen_table(L);
908                                                 luaopen_io(L);
909                                                 luaopen_string(L);
910                                                 luaopen_math(L);
911                                                 lua_pushboolean(L, 1);
912                                                 lua_close(L);]])],[cf_result=yes],[cf_result=no])
913                         fi
914                 done
915         done
918 AC_MSG_RESULT($cf_result)
920 if test "$cf_result" != yes; then
921         EL_RESTORE_FLAGS
922 else
923         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
924         AC_CHECK_HEADERS(lauxlib.h)
926         CFLAGS="$CFLAGS_X"
927         CPPFLAGS="$CPPFLAGS_X"
928         AC_SUBST(LUA_LIBS)
929         AC_SUBST(LUA_CFLAGS)
932 # ===================================================================
933 # Check for TRE library
934 # ===================================================================
936 AC_MSG_CHECKING([[for TRE in pkg-config]])
937 if pkg-config tre; then
938         TRE_CFLAGS=`pkg-config --cflags tre`
939         TRE_LIBS=`pkg-config --libs tre`
940         AC_MSG_RESULT([[yes]])
941 else
942         # <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513055>
943         # "libtre-dev: /usr/lib/pkgconfig/tre.pc missing"
944         # so we look for the library even if pkg-config doesn't know about it.
945         TRE_CFLAGS=
946         TRE_LIBS=-ltre
947         AC_MSG_RESULT([[no, but let's try defaults]])
950 AC_MSG_CHECKING([[for TRE header and library]])
951 EL_SAVE_FLAGS
952 CFLAGS="$TRE_CFLAGS $CFLAGS"
953 LIBS="$TRE_LIBS $LIBS"
954 AC_TRY_LINK([#include <tre/regex.h>],
955             [regex_t re;
956              regmatch_t match[1];
957              regwcomp(&re, L"zap", REG_ICASE);
958              regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
959             [AC_MSG_RESULT([[yes]])
960              AC_DEFINE([HAVE_TRE_REGEX_H], [1],
961                        [Define to 1 if you have the <tre/regex.h> header file.])
962              # TRE_CFLAGS will be used only where needed.
963              # TRE_LIBS will be kept in LIBS and used everywhere.
964              EL_RESTORE_FLAGS
965              LIBS="$TRE_LIBS $LIBS"],
966             [AC_MSG_RESULT([[no]])
967              TRE_CFLAGS=
968              TRE_LIBS=
969              EL_RESTORE_FLAGS])
970 AC_SUBST(TRE_CFLAGS)
971 AC_SUBST(TRE_LIBS)
973 AC_CHECK_SIZEOF([wchar_t], [4], [[#include <wchar.h>]])
975 # ===================================================================
976 # Check for Ruby, optional even if installed.
977 # ===================================================================
979 EL_CONFIG_SCRIPTING_RUBY
981 # ===================================================================
982 # Setup global scripting
983 # ===================================================================
985 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_SCRIPTING_GUILE CONFIG_SCRIPTING_LUA CONFIG_SCRIPTING_PERL CONFIG_SCRIPTING_PYTHON CONFIG_SCRIPTING_RUBY CONFIG_SCRIPTING_SPIDERMONKEY], [Browser scripting])
986 AC_SUBST(CONFIG_SCRIPTING_GUILE)
987 AC_SUBST(CONFIG_SCRIPTING_LUA)
988 AC_SUBST(CONFIG_SCRIPTING_PERL)
989 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
990 AC_SUBST(CONFIG_SCRIPTING_RUBY)
991 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
992 AC_SUBST(CONFIG_SCRIPTING)
995 # ===================================================================
996 # Check for SSL support.
997 # ===================================================================
999 # We by default use OpenSSL, and we always prefer it. However, when GNUTLS
1000 # is enabled, we won't try to use OpenSSL anymore.
1002 # For wiping SSL hooks..
1003 #ifdef CONFIG_SSL
1005 disable_openssl=""
1006 disable_gnutls=""
1007 enable_gnutls=""
1009 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
1010             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
1011 AC_ARG_WITH(gnutls, [[  --with-gnutls[=DIR]     enable GNUTLS SSL support]],
1012             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
1013 gnutls_withval="$withval"
1015 if test "$enable_gnutls" = yes; then
1016         disable_openssl=yes;
1019 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
1020             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
1021 AC_ARG_WITH(openssl, [[  --with-openssl[=DIR]    enable OpenSSL support (default)]])
1022 openssl_withval="$withval"
1024 # ---- OpenSSL
1026 AC_MSG_CHECKING([for OpenSSL])
1028 EL_SAVE_FLAGS
1029 cf_result="no"
1031 if test "$disable_openssl" = yes; then
1032         cf_result="not used"
1033 else
1034         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
1035                          /usr/lib/openssl /usr/local/ssl \
1036                          /usr/local/www /usr/lib/ssl /usr/local \
1037                          /usr/pkg /opt /opt/openssl; do
1038                 if test "$cf_result" = no; then
1039                         if test -d "$ssldir"; then
1040                                 OPENSSL_CFLAGS="-I$ssldir/include"
1041                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
1042                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
1043                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
1044 #                               # FIXME: This created serious portability problems. --pasky
1045 #                               if test "$CC" == "gcc"; then
1046 #                                       # I'm not sure about compatibility here. --pasky
1047 #                                       LIBS="$LIBS -R$ssldir/lib"
1048 #                               fi
1049                         else
1050                                 LIBS="-lssl -lcrypto $LIBS_X"
1051                         fi
1052                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[OpenSSL_add_all_algorithms()]])],[cf_result=yes],[cf_result=no])
1053                         if test "$cf_result" != yes; then
1054                                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[SSLeay_add_ssl_algorithms()]])],[cf_result=yes],[cf_result=no])
1055                         fi
1056                 fi
1057         done
1059         if test "$cf_result" != yes; then
1060                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
1061                         AC_MSG_ERROR([OpenSSL not found])
1062                 fi
1063                 EL_RESTORE_FLAGS
1064         else
1065                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
1067                 CFLAGS="$CFLAGS_X"
1068                 AC_SUBST(OPENSSL_CFLAGS)
1069         fi
1072 AC_MSG_RESULT($cf_result)
1074 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1075 # ---- GNU TLS
1076 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
1077 dnl it looks ugly then.
1079 if test "$cf_result" = yes; then
1080         cf_result="not used"
1082 else
1083         EL_SAVE_FLAGS
1084         cf_result="no"
1086         if test -z "$disable_gnutls"; then
1087                 # Sure, we maybe _could_ use their macro, but how to ensure
1088                 # that the ./configure script won't fail if the macro won't be
1089                 # found..? :( --pasky
1091                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
1093                 if test -d "$gnutls_withval"; then
1094                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
1095                 fi
1097                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1099                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1100                         cf_result=no
1101                 else
1102                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1103                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1105                         LIBS="$GNUTLS_LIBS $LIBS_X"
1106                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1107                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1109                         # Verify if it's really usable.  gnutls_session was
1110                         # renamed to gnutls_session_t before GNU TLS 1.2.0
1111                         # (on 2004-06-13); ELinks now requires this.
1112                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]], [[gnutls_session_t dummy;
1113                                      gnutls_check_version(NULL)]])],[cf_result=yes],[cf_result=no])
1114                 fi
1116                 if test "$cf_result" = yes; then
1117                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1119                         CFLAGS="$CFLAGS_X"
1120                         AC_SUBST(GNUTLS_CFLAGS)
1122                         # GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
1123                         # to GPLv3+.  Don't link that with the GPLv2 ELinks.
1124                         # ELinks will use its internal MD5 code instead.
1125                         CONFIG_GNUTLS_OPENSSL_COMPAT=no
1126                 else
1127                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1128                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1129                         fi
1130                         EL_RESTORE_FLAGS
1131                 fi
1132         fi
1135 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1136 AC_MSG_RESULT($cf_result)
1138 # Final SSL setup
1140 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1141 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1142 AC_SUBST(CONFIG_OPENSSL)
1143 AC_SUBST(CONFIG_GNUTLS)
1145 #endif
1147 AC_MSG_CHECKING([whether to be or not to be])
1148 AC_MSG_RESULT([needs to be determined experimentally])
1150 # ===================================================================
1151 # Check for IPv6 support and related functions.
1152 # ===================================================================
1154 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1155 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1156 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1158 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1159 if test "$HAVE_GETADDRINFO" != yes; then
1160         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1161         if test "$HAVE_GETADDRINFO" = yes; then
1162                 LIBS="$LIBS -linet6"
1163         fi
1167 # ===================================================================
1168 # Checking for X11 (window title restoring).
1169 # ===================================================================
1171 AC_PATH_X
1172 if test x"$no_x" != xyes; then
1173         EL_SAVE_FLAGS
1174         if test -n "$x_includes"; then
1175                 X_CFLAGS="-I$x_includes"
1176                 CPPFLAGS="$CPPLAGS $X_CFLAGS"
1177                 CFLAGS="$CFLAGS $X_CFLAGS"
1178         fi
1179         if test -n "$x_libraries"; then
1180                 LDFLAGS="$LDFLAGS -L$x_libraries"
1181         fi
1182         LIBS="-lX11 $LIBS"
1183         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize()]])],[cf_result=yes],[cf_result=no])
1184         EL_RESTORE_FLAGS
1185         if test "$cf_result" = yes; then
1186                 if test -n "$x_libraries"; then
1187                         LDFLAGS="$LDFLAGS -L$x_libraries"
1188                 fi
1189                 LIBS="-lX11 $LIBS"
1190                 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1191                 AC_SUBST(X_CFLAGS)
1192         fi
1196 # ===================================================================
1197 # Backtraces displaying support.
1198 # ===================================================================
1200 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1201 # possible checks for other system-specific means go here
1204 # ===================================================================
1205 # Gettext grey zone. Beware.
1206 # ===================================================================
1208 ALL_LINGUAS="af be bg ca cs da de el es et fi fr gl hr hu id is it lt nl nb pl pt pt_BR ro ru sk sr sv tr uk"
1210 AM_GNU_GETTEXT
1212 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1213 dnl # f33r d4 l33t... I hope it's portable. :)
1214 dnl cf_result=$((48#z - 48#a + 1));
1215 dnl AC_MSG_RESULT($cf_result)
1218 # ===================================================================
1219 # Compile-time features control
1220 # ===================================================================
1222 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1223               [  --disable-cookies       disable cookie support])
1225 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1226               [  --disable-formhist      disable form history support])
1228 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1229               [  --disable-globhist      disable global history support])
1232 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1233               [  --disable-mailcap       disable mailcap support])
1235 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1236               [  --disable-mimetypes     disable mimetypes files support])
1239 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1240               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1241               [IPv6],
1242               [  --disable-ipv6          disable IPv6 support])
1244 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1245               [  --enable-bittorrent     enable BitTorrent protocol support])
1247 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1248               [  --disable-data          disable data protocol support])
1250 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1251               [  --disable-uri-rewrite   disable URI rewrite support])
1253 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1254               [  --enable-cgi            enable local CGI support])
1256 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1257               [  --enable-finger         enable finger protocol support])
1259 # ===================================================================
1260 # FSP protocol
1261 # ===================================================================
1262 EL_SAVE_FLAGS
1264 if test "x${enable_fsp}" != xno; then
1265         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1267         if test "$HAVE_FSPLIB" = yes; then
1268                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1269                 if test "$HAVE_FSPLIB" = yes; then
1270                         LIBS="$LIBS -lfsplib"
1271                 else
1272                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1273                         if test "$HAVE_FSPLIB" = yes; then
1274                                 LIBS="$LIBS -lfsp"
1275                         fi
1276                 fi
1277         fi
1280 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1281               [  --enable-fsp            enable FSP protocol support])
1283 if test "x$CONFIG_FSP" = xno; then
1284         EL_RESTORE_FLAGS
1287 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1288               [  --disable-ftp           disable ftp protocol support])
1290 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1291               [  --enable-gopher         enable gopher protocol support])
1293 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1294               [  --enable-nntp           enable nntp protocol support])
1296 # ===================================================================
1297 # SMB protocol support.
1298 # ===================================================================
1299 EL_SAVE_FLAGS
1301 if test "x${enable_smb}" != xno; then
1302         AC_CHECK_HEADERS(libsmbclient.h, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1304         if test "$HAVE_SMBCLIENT" = yes; then
1305                 AC_CHECK_LIB(smbclient, smbc_init, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1306                 if test "$HAVE_SMBCLIENT" = yes; then
1307                         LIBS="$LIBS -lsmbclient"
1308                 fi
1309         fi
1312 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [Samba protocol],
1313               [  --enable-smb            enable Samba protocol support])
1315 if test "x$CONFIG_SMB" = xno; then
1316         EL_RESTORE_FLAGS
1320 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1321               [  --disable-mouse         disable mouse support])
1323 # GPM mouse is Linux specific, so ...
1324 CONFIG_SYSMOUSE=yes
1325 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1326               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1327               [BSD sysmouse],
1328               [  --disable-sysmouse      disable BSD sysmouse support])
1330 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1331               [  --enable-88-colors      enable 88 color support])
1333 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1334               [  --enable-256-colors     enable 256 color support])
1336 EL_ARG_ENABLE(CONFIG_TRUE_COLOR, true-color, [true color],
1337               [  --enable-true-color     enable true color support])
1339 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1340               [  --enable-exmode         enable exmode (CLI) interface])
1342 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1343               [  --disable-leds          disable LEDs support])
1345 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1346               [  --disable-marks         disable document marks support])
1349 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1350               [  --disable-css           disable Cascading Style Sheet support])
1352 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1353               [  --enable-html-highlight HTML highlighting using DOM engine])
1355 # Everything in the tree already uses CONFIG_DOM
1356 # so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1357 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1359 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1360               [  --disable-backtrace     disable backtrace support])
1362 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1363               [  --enable-no-root        enable prevention of usage by root])
1366 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1367               [  --enable-debug          enable leak debug and internal error checking])
1369 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1370               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1372 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1373               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1375 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1376               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1378 EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
1379               [  --disable-utf-8         disable UTF-8 support])
1382 AC_ARG_ENABLE(weehoofooboomookerchoo,
1383               [
1384     Also check out the features.conf file for more information about features!
1385               ],
1386               [AC_MSG_ERROR(Are you strange, or what?)])
1389 # ===================================================================
1390 # Further LDFLAGS tweaks
1391 # ===================================================================
1393 # == EMX hack
1395 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1396 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1399 # Check for -rdynamic
1401 # gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
1402 # the executable to its dynamic symbol table.  ELinks uses this for
1403 # two purposes:
1405 # 1. If ELinks detects a bug, it can try to display a backtrace by
1406 #    calling backtrace_symbols_fd() in the GNU libc.  The glibc-2.3.6
1407 #    manual states users of GNU ld must pass -rdynamic to make the
1408 #    symbols available to the program.
1410 # 2. It would eventually be nice to dynamically load shared
1411 #    libraries as plugins (bug 73).  The plugins must be able to
1412 #    call ELinks functions.  This can be implemented either by
1413 #    registering all callable functions in ELinks-specific data
1414 #    structures, or by letting the dynamic linker handle them.
1415 #    The latter way requires something equivalent to -rdynamic.
1417 # Because backtraces are not needed for correct operation, and bug
1418 # 73 is not yet being fixed, the configure script and makefiles
1419 # should not complain to the user if they find that -rdynamic does
1420 # not work.  Besides, it was reported at elinks-users on 2006-09-12
1421 # that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
1422 # Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
1423 # -rdynamic but does something equivalent automatically.  (This was
1424 # tested with "nm -D elinks | grep redraw_from_window".)
1426 # With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
1427 # -dynamic"; then, cc proceeds anyway, but the option can prevent the
1428 # linker from finding the libraries listed in -l operands.  So this
1429 # -rdynamic check needs to happen after the libraries have already
1430 # been added to $LDFLAGS.
1431 AC_MSG_CHECKING([for -rdynamic])
1432 LDFLAGS_X="$LDFLAGS"
1433 LDFLAGS="-rdynamic $LDFLAGS"
1434 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
1435 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
1436 AC_MSG_RESULT($have_rdynamic)
1438 # ===================================================================
1439 # Export directory paths
1440 # ===================================================================
1442 # Set up the ``entry points'' if they were not supplied by builder
1443 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1444 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1446 # Create CONFDIR #define for config.h
1448 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1449 # it's autoconf fault to force us to do such hacks ;p.
1450 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1451   # sysconfdir is set to its default value... fine, let's append /elinks/
1452   # XXX: We can't modify listing of the default in ./configure --help :-(
1453   sysconfdir_n=`eval echo "$sysconfdir"`
1454   sysconfdir=$sysconfdir_n
1455   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1456         sysconfdir="$sysconfdir/elinks"
1459 CONFDIR=$sysconfdir
1460 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1461 AC_SUBST(CONFDIR)
1463 # Create LOCALEDIR #define for config.h
1464 LOCALEDIR=`eval echo "$datadir/locale"`
1465 while echo "$LOCALEDIR" | grep "\\$"
1467         LOCALEDIR=`eval echo "$LOCALEDIR"`
1468 done > /dev/null 2> /dev/null
1469 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1470 AC_SUBST(LOCALEDIR)
1472 # Create LIBDIR #define for config.h
1473 LIBDIR=`eval echo "$libdir"`
1474 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1475 AC_SUBST(LIBDIR)
1477 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1478 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1481 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
1482 ]], [[#if !defined(__TINYC__) || !defined(alloca)
1483         #error not tcc
1484         #endif ]])],[cf_result=yes],[cf_result=no])
1486 if test "$cf_result" = "yes"; then
1487         AC_DEFINE([HAVE_ALLOCA])
1488         AC_DEFINE([_ALLOCA_H], [1], [Define as 1 if you are using Tiny C Compiler
1489                 with the GNU C Library, and <alloca.h> of glibc would otherwise
1490                 override the alloca macro defined in <stddef.h> of TCC.
1491                 If <alloca.h> of glibc sees the _ALLOCA_H macro, it assumes
1492                 it has already been included, and does not redefine alloca.
1493                 This might not work in future glibc versions though, because
1494                 the names of the #include guard macros are not documented.
1495                 The incompatibility has been reported to the tinycc-devel
1496                 mailing list on 2008-07-14.  If a future version of TCC provides
1497                 an <alloca.h> of its own, this hack won't be needed.])
1499 # ===================================================================
1500 # A little fine tuning of gcc specific options (continued)
1501 # ===================================================================
1503 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
1504   if test "$CONFIG_DEBUG" = "yes"; then
1505     # We want to see all warnings and live with none (in debug mode).
1506     CFLAGS="$CFLAGS -Werror"
1507   fi
1509   case "`$CC -dumpversion`" in
1510     3.0|3.1|3.2)
1511       # These should be ok using -Werror
1512       ;;
1513     3.*)
1514       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1515       # "dereferencing type-punned pointer will break strict-aliasing rules"
1516       # warnings. Disable them by not doing any strict-aliasing. The
1517       # alternative is just too ugly. Thanks gcc guys!! ;)
1518       CFLAGS="$CFLAGS -fno-strict-aliasing"
1519       ;;
1520     4.*)
1521       # Do not show warnings related to (char * | unsigned char *) type
1522       # difference.
1523       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1524       ;;
1525     *)
1526       # These should be ok using -Werror
1527       ;;
1528   esac
1530   # GCC 4.2.1 warns if we use the address of an object in Boolean context:
1531   # warning: the address of `builtin_modules' will always evaluate as `true'
1532   # This hits the object_lock and foreach_module macros in particular.
1533   # It would be okay to put something in the macros to avoid the warning,
1534   # but currently this seems to require defining parallel macros that skip
1535   # the NULL check, and that's too ugly.  So we instead disable the warning.
1536   # GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
1537   # GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
1538   for warning_flag in -Wno-address -Wno-always-true; do
1539     AC_MSG_CHECKING([whether $CC accepts $warning_flag])
1540     EL_SAVE_FLAGS
1541     CFLAGS="$CFLAGS $warning_flag"
1542     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1543       [AC_MSG_RESULT([yes])
1544        break],
1545       [AC_MSG_RESULT([no])])
1546     EL_RESTORE_FLAGS
1547   done
1549   # Bug 1012: Some parts of ELinks do arithmetic with signed integers
1550   # in such a way that an overflow is possible.  GCC 4.2.1 warns
1551   # "warning: assuming signed overflow does not occur when assuming
1552   # that (X + c) > X is always true", which may be an incorrect
1553   # optimization (although allowed by the standard), and breaks the
1554   # build with -Werror.
1555   #
1556   # All of the following tests included -S -Wall -Wextra:
1557   #
1558   # GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
1559   # * gcc-4.0 -O0: OK, compares the values
1560   # * gcc-4.0 -O2: assumes no overflow, does not warn
1561   # * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
1562   # * gcc-4.0 -O0 -fwrapv: OK, compares the values
1563   # * gcc-4.0 -O2 -fwrapv: OK, compares the values
1564   # * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
1565   # * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
1566   # * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1567   # * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
1568   #
1569   # GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
1570   # * gcc-4.1 -O0: assumes no overflow, does not warn
1571   # * gcc-4.1 -O2: assumes no overflow, does not warn
1572   # * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
1573   # * gcc-4.1 -O0 -fwrapv: OK, compares the values
1574   # * gcc-4.1 -O2 -fwrapv: OK, compares the values
1575   # * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
1576   # * gcc-4.1 -O2 -ftrapv: compares the values
1577   # * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1578   # * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
1579   #
1580   # GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
1581   # * gcc-4.2 -O0: OK, compares the values
1582   # * gcc-4.2 -O2: assumes no overflow, warns about it
1583   # * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
1584   # * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
1585   # * gcc-4.2 -O0 -fwrapv: OK, compares the values
1586   # * gcc-4.2 -O2 -fwrapv: OK, compares the values
1587   # * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
1588   # * gcc-4.2 -O2 -ftrapv: compares the values
1589   # * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1590   # * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
1591   #
1592   # Apparently, -ftrapv does not work reliably at all.
1593   for overflow_flag in -fno-strict-overflow -fwrapv; do
1594     AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
1595     EL_SAVE_FLAGS
1596     CFLAGS="$CFLAGS $overflow_flag"
1597     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1598       [AC_MSG_RESULT([yes])
1599        break],
1600       [AC_MSG_RESULT([no])])
1601     EL_RESTORE_FLAGS
1602   done
1605 EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
1606 EL_LOG_CONFIG(CPPFLAGS, [Preprocessor flags (CPPFLAGS)], [])
1607 EL_LOG_CONFIG(LDFLAGS, [Linker flags (LDFLAGS)], [])
1608 EL_LOG_CONFIG(LIBS, [Library flags (LIBS)], [])
1610 # ===================================================================
1611 # Colored make output
1612 # ===================================================================
1614 if test $(`which tput` colors) -ge 4; then
1615         MAKE_COLOR=1
1616         AC_SUBST(MAKE_COLOR)
1619 # ===================================================================
1620 # Generated files
1621 # ===================================================================
1623 AC_CONFIG_FILES([ \
1624  Makefile.config \
1625  contrib/elinks.spec \
1626  contrib/lua/hooks.lua \
1627  contrib/conv/w3m2links.awk \
1628  doc/Doxyfile \
1629  doc/man/man1/elinks.1 \
1630  src/intl/gettext/ref-add.sed \
1631  src/intl/gettext/ref-del.sed
1633 AC_OUTPUT
1635 abs_srcdir="$(cd "$srcdir" && pwd)"
1636 # builddir is always absolute!
1637 if test "$abs_srcdir" != "$builddir"; then
1638         # Bootstrap the Makefile creation
1639         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1640         "$MAKE" "SRC=$abs_srcdir" init
1642         # Make cg-status ignore this build directory
1643         echo "*" > "$builddir/.gitignore"
1646 # ===================================================================
1647 # Configuration summary
1648 # ===================================================================
1650 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1651 cat features.log