Since commit 2c14587b88aaa8efa744b15af242e8de9193ca8c, the sample
[elinks.git] / configure.in
blob5aab22e882d171b24432d1a6da0c9f363c245368
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.13.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(wchar.h 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 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
230 AC_SYS_LARGEFILE
231 AC_TYPE_SIZE_T
232 AC_TYPE_OFF_T
233 EL_CHECK_TYPE(ssize_t, int)
234 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
235 EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
236 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
237 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
238 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
240 AC_CHECK_SIZEOF(char, 1)
241 AC_CHECK_SIZEOF(short, 2)
242 AC_CHECK_SIZEOF(int, 4)
243 AC_CHECK_SIZEOF(long, 4)
244 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
245 test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
247 # Check for variadic macros
248 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
249                 [#include <stdio.h>
250                  #define a(b,c...) printf(b,##c)],
251                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
253 # ===================================================================
254 # Checks for library functions.
255 # ===================================================================
257 AC_PROG_GCC_TRADITIONAL
258 AC_FUNC_MEMCMP
259 AC_FUNC_MMAP
260 AC_FUNC_STRFTIME
261 AC_CHECK_FUNCS(atoll gethostbyaddr herror strerror)
262 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
263 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
264 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
265 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
266 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
267 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
268 AC_CHECK_FUNCS(gettimeofday clock_gettime)
270 AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
272 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
273 AC_CHECK_FUNCS(unsetenv)
274 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
275 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
277 AC_CHECK_FUNCS(wcwidth, HAVE_WCWIDTH=yes)
279 # These aren't probably needed now, as they are commented in links.h.
280 # I've no idea about their historical background, but I keep them here
281 # just in the case they will help later. --pasky
282 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
283 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
284 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
285 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
287 if test x"$HAVE_RAISE" = x; then
288         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
289                 AC_MSG_ERROR([Unable to emulate raise()])
290         fi
293 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
294 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
295 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],[el_cv_HAVE_VA_COPY=yes],[el_cv_HAVE_VA_COPY=no])])
296 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
297         EL_DEFINE(HAVE_VA_COPY, __va_copy)
300 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
301 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
302 ]], [[int page_size = sysconf(_SC_PAGE_SIZE);]])],[el_cv_HAVE_SC_PAGE_SIZE=yes],[el_cv_HAVE_SC_PAGE_SIZE=no])])
303 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
304         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
307 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
308 AC_RUN_IFELSE([AC_LANG_SOURCE([[
309 #include <stdio.h>
310 #include <stdarg.h>
311 #include <stdlib.h>
312 #include <string.h>
314 char buf[8];
316 int bar(char *buf, const char *format, va_list ap)
318        return vsnprintf(buf, 0, format, ap);
321 void foo(const char *format, ...) {
322        va_list ap;
323        int len;
325        va_start(ap, format);
326        len = bar(buf, format, ap);
327        va_end(ap);
328        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
330        va_start(ap, format);
331        len = bar(buf, format, ap);
332        va_end(ap);
333        if ((len != 6) && (len != 7)) exit(1);
335        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
337        exit(0);
339 main() { foo("hello\n"); }
340 ]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
341 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
342         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
345 # OpenSSL and Lua frequently need dlopen
346 AC_CHECK_LIB(dl, dlopen)
348 # ===================================================================
349 # Checks for libraries.
350 # ===================================================================
352 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
353 if test "$cf_result" = no; then
354         AC_CHECK_LIB(socket, socket)
357 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
358 if test "$cf_result" = no; then
359         AC_CHECK_LIB(socket, setsockopt)
362 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
363 if test "$cf_result" = no; then
364         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
365         if test "$cf_result" = no; then
366                 AC_CHECK_LIB(nsl, gethostbyname)
367         else
368                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
369         fi
372 # ===================================================================
373 # Checks for packaging specific options.
374 # ===================================================================
376 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
377             [ if test "$withval" != no && test "$withval" != yes; then
378                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
379               fi ])
381 # ===================================================================
382 # Checks for a libraries, optional even if installed.
383 # ===================================================================
385 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
386 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
388         AC_MSG_CHECKING([for $2 support])
390         if test "[$]$1" != no; then
391                 AC_MSG_RESULT(yes)
392                 EL_SAVE_FLAGS
393                 if test -n "$withval" && test -d "$withval"; then
394                         # Be a little more careful when setting
395                         # include and lib directories. This way
396                         # $withval will work when includes are
397                         # there but the library is in the common
398                         # /usr/lib ... Does the right thing when
399                         # looking for gc on Debian.
400                         if test -d "$withval/include"; then
401                                 CFLAGS="$CFLAGS -I$withval/include"
402                                 CPPFLAGS="$CPPFLAGS -I$withval/include"
403                         else
404                                 CFLAGS="$CFLAGS -I$withval"
405                                 CPPFLAGS="$CPPFLAGS -I$withval"
406                         fi
407                         if test -d "$withval/lib"; then
408                                 LDFLAGS="$LDFLAGS -L$withval/lib"
409                         fi
410                 fi
412                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
413                 if test "[$]$1" = yes; then
414                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
415                 fi
417                 if test "[$]$1" = yes; then
418                         EL_CONFIG([$1], [$2])
419                         LIBS="$LIBS -l$4"
420                 else
421                         if test -n "[$]WITHVAL_$1" &&
422                            test "[$]WITHVAL_$1" != xno; then
423                                 AC_MSG_ERROR([$2 not found])
424                         fi
425                         EL_RESTORE_FLAGS
426                 fi
427         else
428                 AC_MSG_RESULT(disabled)
429         fi
432 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
433 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
435         $1=yes
436         WITHVAL_$1=
438         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
439         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
441         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
443         EL_LOG_CONFIG([$1], [$2], [])
446 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
447         [  --without-gpm           disable gpm (mouse) support])
449 # ELinks calls deflateInit2 with windowBits = MAX_WBITS | 32, to
450 # enable automatic decoding of both zlib and gzip headers.  This
451 # feature was added in zlib 1.2.0.2; earlier versions return an error.
452 # The gzclearerr function was also added in zlib 1.2.0.2, so check for
453 # that, even though ELinks does not actually call gzclearerr.
454 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
455         [  --without-zlib          disable zlib support])
457 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
458         [  --without-bzlib         disable bzlib support])
460 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
461         [  --without-idn           disable international domain names support])
463 if test "x{with_gc}" != xno; then
464         EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
465                 [  --with-gc               enable Boehm's garbage collector])
468 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
469         [  --without-lzma          disable lzma encoding support])
471 # ===================================================================
472 # Check for GSSAPI, optional even if installed.
473 # ===================================================================
475 enable_gssapi="no";
477 AC_ARG_WITH(gssapi, [  --with-gssapi           enable GSSAPI support],
478             [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
480 AC_MSG_CHECKING([for GSSAPI])
482 if test "$enable_gssapi" = "yes"; then
483         AC_MSG_RESULT(yes)
484         GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
485         GSSAPI_LIBS=`krb5-config --libs gssapi`
486         CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
487         LIBS="$GSSAPI_LIBS $LIBS"
488         EL_CONFIG(CONFIG_GSSAPI, [GssApi])
489 else
490         AC_MSG_RESULT(no)
493 AC_SUBST(CONFIG_GSSAPI)
495 # ===================================================================
496 # Bookmark and XBEL support
497 # ===================================================================
499 EL_SAVE_FLAGS
501 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
502               [  --disable-bookmarks     disable bookmark support])
504 # Check whether --enable-xbel or --disable-xbel was given.
505 if test "x${enable_xbel}" != xno; then
506         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
508         if test "$HAVE_LIBEXPAT" = yes; then
509                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
510                 if test "$HAVE_LIBEXPAT" = yes; then
511                         LIBS="$LIBS -lexpat"
512                 fi
513         fi
517 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
518               [XBEL bookmarks],
519               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
521 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
522         EL_RESTORE_FLAGS
525 # ===================================================================
526 # Checks for BSD sysmouse
527 # ===================================================================
529 HAVE_SYSMOUSE_HEADER="no"
531 # Either of these header files provides the (same) sysmouse interface
532 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
534 # ===================================================================
535 # Checks for OS/2
536 # ===================================================================
538 if test "$CONFIG_OS_OS2" = yes; then
539         EL_CONFIG_OS_OS2
542 # ===================================================================
543 # Checks for Win32
544 # ===================================================================
546 if test "$CONFIG_OS_WIN32" = yes; then
547         EL_CONFIG_OS_WIN32
550 # ===================================================================
551 # Check for SEE (Simple Ecmascript Engine)
552 # ===================================================================
553 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
554             [ if test "x$withval" != xno; then enable_see=yes; fi ])
556 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
557 # SEE_FLAGS but I really don't want to require people to have Guile in order
558 # to compile CVS. Also, the macro seems to be really stupid regarding searching
559 # for Guile in $PATH etc. --pasky
561 CONFIG_ECMASCRIPT_SEE=no
563 if test "$enable_see" = "yes"; then
564         if test -d "$withval"; then
565                 SEE_PATH="$withval:$PATH"
566         else
567                 SEE_PATH="$PATH"
568         fi
570         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
571         AC_MSG_CHECKING([for SEE (2.0.1131 or later)])
572         if test "$SEE_CONFIG" != no; then
573                 EL_SAVE_FLAGS
574                 SEE_LIBS="`$SEE_CONFIG --libs`"
575                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
576                 CPPFLAGS="$SEE_CFLAGS $CPPFLAGS"
577                 LIBS="$SEE_LIBS $LIBS_X"
578                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <see/see.h>]], [[#if SEE_VERSION_API_MAJOR < 2
579                         #error SEE too old
580                         #endif
581                 ]])],[cf_result=yes],[cf_result=no])
582                 EL_RESTORE_FLAGS
583                 if test "$cf_result" = yes; then
584                         LIBS="$SEE_LIBS $LIBS"
585                         EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
586                         AC_SUBST(SEE_CFLAGS)
587                 fi
588                 AC_MSG_RESULT($cf_result)
589         else
590                 if test -n "$withval" && test "x$withval" != xno; then
591                         AC_MSG_ERROR([SEE not found])
592                 else
593                         AC_MSG_WARN([SEE support disabled])
594                 fi
595         fi
598 # ===================================================================
599 # Check for SpiderMonkey, optional even if installed.
600 # ===================================================================
602 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
603             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
604 AC_MSG_CHECKING([for SpiderMonkey (1.5 RC3a or later)])
606 EL_SAVE_FLAGS
607 cf_result=no
609 if test -z "$disable_spidermonkey"; then
610         if test ! -d "$withval"; then
611                 withval="";
612         fi
613         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
614                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
615                         for spidermonkeylib in js smjs mozjs; do
616                                 if test "$cf_result" = no &&
617                                    test -f "$spidermonkeydir$spidermonkeyinclude/jsapi.h"; then
618                                         SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib -l$spidermonkeylib"
619                                         SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
621                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
622                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
623                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
625                                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
626                                                      #include <jsapi.h>]], [[JS_GetReservedSlot(NULL, NULL, 0, NULL)]])],[cf_result=yes],[cf_result=no])
627                                 fi
628                         done
629                 done
630         done
633 AC_MSG_RESULT($cf_result)
634 CONFIG_SPIDERMONKEY="$cf_result"
635 if test "$cf_result" = "yes"; then
636         AC_CHECK_FUNCS([[JS_ReportAllocationOverflow]])
638 EL_RESTORE_FLAGS
640 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
641    test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
642         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
643 else
644         CONFIG_ECMASCRIPT_SMJS=no
647 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
648 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
649 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
652 # ===================================================================
653 # Optional Spidermonkey-based ECMAScript browser scripting
654 # ===================================================================
656 AC_ARG_ENABLE(sm-scripting,
657               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
658               [if test "$enableval" != no; then enableval="yes"; fi
659                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
661 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
662    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
663         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
664 else
665         CONFIG_SCRIPTING_SPIDERMONKEY=no
668 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
669    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
670         LIBS="$LIBS $SPIDERMONKEY_LIBS"
671         AC_SUBST(SPIDERMONKEY_LIBS)
672         AC_SUBST(SPIDERMONKEY_CFLAGS)
673         AC_SUBST(CONFIG_SPIDERMONKEY)
676 # ===================================================================
677 # Check for Guile, optional even if installed.
678 # ===================================================================
680 enable_guile="no";
682 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
683             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
685 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
686 # GUILE_FLAGS but I really don't want to require people to have Guile in order
687 # to compile CVS. Also, the macro seems to be really stupid regarding searching
688 # for Guile in $PATH etc. --pasky
690 AC_MSG_CHECKING([for Guile])
692 if test "$enable_guile" = "yes"; then
693         AC_MSG_RESULT(yes);
694         ## Based on the GUILE_FLAGS macro.
696         if test -d "$withval"; then
697                 GUILE_PATH="$withval:$PATH"
698         else
699                 GUILE_PATH="$PATH"
700         fi
702         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
704         ## First, let's just see if we can find Guile at all.
705         if test "$GUILE_CONFIG" != no; then
706                 cf_result="yes";
708                 GUILE_LIBS="`guile-config link`"
709                 GUILE_CFLAGS="`guile-config compile`"
710                 LIBS="$GUILE_LIBS $LIBS"
711                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
712                 AC_SUBST(GUILE_CFLAGS)
713                 cat <<EOF
714 ***********************************************************************
715 The Guile support is incomplete and not so well integrated to ELinks
716 yet. That means, e.g., that you have no Guile console and there might
717 not be all the necessary hooks. Also, the Guile interface is not too
718 well tested (success stories heartily welcomed!).  See
719 src/scripting/guile/README for further details and hints.
720 ***********************************************************************
722         else
723                 if test -n "$withval" && test "x$withval" != xno; then
724                         AC_MSG_ERROR([Guile not found])
725                 else
726                         AC_MSG_WARN([Guile support disabled])
727                 fi
728         fi
729 else
730         AC_MSG_RESULT(no);
733 # ===================================================================
734 # Check for Perl
735 # ===================================================================
736 enable_perl="no";
738 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
739             [
740 if test "$withval" = yes; then
741         # FIXME: If withval is a valid directory append it to PATH
742         # so that you can specify one of several perl installations.
743         withval="";
744         enable_perl=yes;
746             ])
748 AC_MSG_CHECKING([for Perl])
750 cf_result=no
752 EL_SAVE_FLAGS
754 if test "$enable_perl" = "yes"; then
755         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
756         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
757         LIBS="$PERL_LIBS $LIBS"
758         CFLAGS="$PERL_CFLAGS $CFLAGS"
759         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
760         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
761 #include <EXTERN.h>
762 #include <perl.h>
763 #include <perlapi.h>
764 ]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
767 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
769 AC_MSG_CHECKING([whether POPpx works without an n_a variable])
770 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
771 #include <EXTERN.h>
772 #include <perl.h>
773 extern PerlInterpreter *my_perl;
774 ]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
775 AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
776                 [Define if using Perl 5.8.8 or later, where the "POPpx" macro
777 no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
779 if test "$cf_result" != "yes"; then
780         EL_RESTORE_FLAGS
781 else
782         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
784         CFLAGS="$CFLAGS_X"
785         CPPFLAGS="$CPPFLAGS_X"
786         AC_SUBST(PERL_LIBS)
787         AC_SUBST(PERL_CFLAGS)
790 # ===================================================================
791 # Check for Python
792 # ===================================================================
793 enable_python="no";
795 AC_ARG_WITH(python, [[  --with-python[=DIR]     enable Python support]],
796             [ if test "x$withval" != xno; then enable_python=yes; fi ])
798 EL_SAVE_FLAGS
799 cf_result=no
801 AC_MSG_CHECKING([for Python])
803 if test "$enable_python" = "yes"; then
804         AC_MSG_RESULT(yes);
806         if test -d "$withval"; then
807                 PYTHON_PATH="$withval:$PATH"
808         else
809                 PYTHON_PATH="$PATH"
810         fi
812         AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
814         if test "$PYTHON" != no; then
815                 cf_result="yes";
817                 PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; print "-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True))'`"
818                 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"))'`"
819                 LIBS="$PYTHON_LIBS $LIBS"
820                 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
821                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
823                 if test "$cf_result" != "yes"; then
824                         EL_RESTORE_FLAGS
825                 else
826                         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
827                         AC_SUBST(PYTHON_LIBS)
828                         AC_SUBST(PYTHON_CFLAGS)
829                         CPPFLAGS="$CPPFLAGS_X"
830                         cat <<EOF
831 ***********************************************************************
832 The Python support is incomplete and not so well integrated to ELinks
833 yet. That means, e.g., that you have no Python console and there might
834 not be all the necessary hooks. Also, the Python interface is not too
835 well tested (success stories heartily welcomed!).
836 ***********************************************************************
838                 fi
839         else
840                 if test -n "$withval" && test "x$withval" != xno; then
841                         AC_MSG_ERROR([Python not found])
842                 else
843                         AC_MSG_WARN([Python support disabled])
844                 fi
845         fi
846 else
847         AC_MSG_RESULT(no);
851 # ===================================================================
852 # Check for Lua, optional even if installed.
853 # ===================================================================
855 # Do this the long way, as FreeBSD reportedly needs -L<dir> for
856 # anything other than /usr/lib, and Lua is very often in /usr/local/lib.
858 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
859             [if test "$withval" = no; then disable_lua=yes; fi])
860 AC_MSG_CHECKING([for Lua])
862 EL_SAVE_FLAGS
863 cf_result=no
865 if test -z "$disable_lua"; then
866         if test ! -d "$withval"; then
867                 withval="";
868         fi
869         for luadir in "$withval" "" /usr /usr/local; do
870                 for suffix in "" 50; do
871                         if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
872                            test -f "$luadir/include/lua$suffix/lua.h" ) ; then
873                                 LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm"
874                                 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
876                                 LIBS="$LUA_LIBS $LIBS_X"
877                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
878                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
880                                 # Check that it is a compatible Lua version
881                                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[      #include <lua.h>
882                                                 #include <lualib.h>]], [[       lua_State *L = lua_open();
883                                                 luaopen_base(L);
884                                                 luaopen_table(L);
885                                                 luaopen_io(L);
886                                                 luaopen_string(L);
887                                                 luaopen_math(L);
888                                                 lua_pushboolean(L, 1);
889                                                 lua_close(L);]])],[cf_result=yes],[cf_result=no])
890                         fi
891                 done
892         done
895 AC_MSG_RESULT($cf_result)
897 if test "$cf_result" != yes; then
898         EL_RESTORE_FLAGS
899 else
900         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
901         AC_CHECK_HEADERS(lauxlib.h)
903         CFLAGS="$CFLAGS_X"
904         CPPFLAGS="$CPPFLAGS_X"
905         AC_SUBST(LUA_LIBS)
906         AC_SUBST(LUA_CFLAGS)
909 # ===================================================================
910 # Check for TRE library
911 # ===================================================================
913 AC_MSG_CHECKING([[for TRE in pkg-config]])
914 if pkg-config tre; then
915         TRE_CFLAGS=`pkg-config --cflags tre`
916         TRE_LIBS=`pkg-config --libs tre`
917         AC_MSG_RESULT([[yes]])
918 else
919         # <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513055>
920         # "libtre-dev: /usr/lib/pkgconfig/tre.pc missing"
921         # so we look for the library even if pkg-config doesn't know about it.
922         TRE_CFLAGS=
923         TRE_LIBS=-ltre
924         AC_MSG_RESULT([[no, but let's try defaults]])
927 AC_MSG_CHECKING([[for TRE header and library]])
928 EL_SAVE_FLAGS
929 CFLAGS="$TRE_CFLAGS $CFLAGS"
930 LIBS="$TRE_LIBS $LIBS"
931 AC_TRY_LINK([#include <tre/regex.h>],
932             [regex_t re;
933              regmatch_t match[1];
934              regwcomp(&re, L"zap", REG_ICASE);
935              regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
936             [AC_MSG_RESULT([[yes]])
937              AC_DEFINE([HAVE_TRE_REGEX_H], [1],
938                        [Define to 1 if you have the <tre/regex.h> header file.])
939              # TRE_CFLAGS will be used only where needed.
940              # TRE_LIBS will be kept in LIBS and used everywhere.
941              EL_RESTORE_FLAGS
942              LIBS="$TRE_LIBS $LIBS"],
943             [AC_MSG_RESULT([[no]])
944              TRE_CFLAGS=
945              TRE_LIBS=
946              EL_RESTORE_FLAGS])
947 AC_SUBST(TRE_CFLAGS)
948 AC_SUBST(TRE_LIBS)
950 AC_CHECK_SIZEOF([wchar_t], [4], [[#include <wchar.h>]])
952 # ===================================================================
953 # Check for Ruby, optional even if installed.
954 # ===================================================================
956 EL_CONFIG_SCRIPTING_RUBY
958 # ===================================================================
959 # Setup global scripting
960 # ===================================================================
962 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])
963 AC_SUBST(CONFIG_SCRIPTING_GUILE)
964 AC_SUBST(CONFIG_SCRIPTING_LUA)
965 AC_SUBST(CONFIG_SCRIPTING_PERL)
966 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
967 AC_SUBST(CONFIG_SCRIPTING_RUBY)
968 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
969 AC_SUBST(CONFIG_SCRIPTING)
972 # ===================================================================
973 # Check for SSL support.
974 # ===================================================================
976 # We by default use OpenSSL, and we always prefer it. However, when GNUTLS
977 # is enabled, we won't try to use OpenSSL anymore.
979 # For wiping SSL hooks..
980 #ifdef CONFIG_SSL
982 disable_openssl=""
983 disable_gnutls=""
984 enable_gnutls=""
986 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
987             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
988 AC_ARG_WITH(gnutls, [[  --with-gnutls[=DIR]     enable GNUTLS SSL support]],
989             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
990 gnutls_withval="$withval"
992 if test "$enable_gnutls" = yes; then
993         disable_openssl=yes;
994         with_nss_compat_ossl=no;
997 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
998             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
999 AC_ARG_WITH(openssl, [[  --with-openssl[=DIR]    enable OpenSSL support (default)]])
1000 openssl_withval="$withval"
1002 AC_ARG_WITH(nss_compat_ossl, [[  --with-nss_compat_ossl[=DIR]
1003                           NSS compatibility SSL libraries/include files]])
1005 # nss_compat_ossl
1006 if test -n "$with_nss_compat_ossl" && test "$with_nss_compat_ossl" != "no"; then
1007         EL_SAVE_FLAGS
1008         if test "$with_nss_compat_ossl" = yes; then
1009                 if pkg-config nss; then
1010                         CFLAGS="$CFLAGS_X `pkg-config --cflags nss`"
1011                         LIBS="$LIBS_X `pkg-config --libs nss`"
1012                 else
1013                         with_nss_compat_ossl=no
1014                 fi
1015         else
1016                 # Without pkg-config, we'll kludge in some defaults
1017                 CFLAGS="$CFLAGS_X -I$with_nss_compat_ossl/include -I/usr/include/nss3 -I/usr/include/nspr4"
1018                 LIBS="$LIBS_X -L$with_nss_compat_ossl/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
1019         fi
1020         AC_CHECK_HEADERS(nss_compat_ossl/nss_compat_ossl.h,, [with_nss_compat_ossl=no], [#define NSS_COMPAT_OSSL_H])
1021         AC_CHECK_LIB(nss_compat_ossl, X509_free,, [with_nss_compat_ossl=no])
1023         if test "$with_nss_compat_ossl" = "no"; then
1024                 EL_RESTORE_FLAGS
1025         else
1026                 LIBS="$LIBS -lnss_compat_ossl"
1027                 EL_CONFIG(CONFIG_NSS_COMPAT_OSSL, [nss_compat_ossl])
1028                 disable_openssl="yes"
1029                 disable_gnutls="yes"
1030         fi
1033 # ---- OpenSSL
1035 AC_MSG_CHECKING([for OpenSSL])
1037 EL_SAVE_FLAGS
1038 cf_result="no"
1040 if test "$disable_openssl" = yes; then
1041         cf_result="not used"
1042 else
1043         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
1044                          /usr/lib/openssl /usr/local/ssl \
1045                          /usr/local/www /usr/lib/ssl /usr/local \
1046                          /usr/pkg /opt /opt/openssl; do
1047                 if test "$cf_result" = no; then
1048                         if test -d "$ssldir"; then
1049                                 OPENSSL_CFLAGS="-I$ssldir/include"
1050                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
1051                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
1052                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
1053 #                               # FIXME: This created serious portability problems. --pasky
1054 #                               if test "$CC" == "gcc"; then
1055 #                                       # I'm not sure about compatibility here. --pasky
1056 #                                       LIBS="$LIBS -R$ssldir/lib"
1057 #                               fi
1058                         else
1059                                 LIBS="-lssl -lcrypto $LIBS_X"
1060                         fi
1061                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[OpenSSL_add_all_algorithms()]])],[cf_result=yes],[cf_result=no])
1062                         if test "$cf_result" != yes; then
1063                                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[SSLeay_add_ssl_algorithms()]])],[cf_result=yes],[cf_result=no])
1064                         fi
1065                 fi
1066         done
1068         if test "$cf_result" != yes; then
1069                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
1070                         AC_MSG_ERROR([OpenSSL not found])
1071                 fi
1072                 EL_RESTORE_FLAGS
1073         else
1074                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
1076                 CFLAGS="$CFLAGS_X"
1077                 AC_SUBST(OPENSSL_CFLAGS)
1078         fi
1081 AC_MSG_RESULT($cf_result)
1083 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1084 # ---- GNU TLS
1085 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
1086 dnl it looks ugly then.
1088 if test "$cf_result" = yes; then
1089         cf_result="not used"
1091 else
1092         EL_SAVE_FLAGS
1093         cf_result="no"
1095         if test -z "$disable_gnutls"; then
1096                 # Sure, we maybe _could_ use their macro, but how to ensure
1097                 # that the ./configure script won't fail if the macro won't be
1098                 # found..? :( --pasky
1100                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
1102                 if test -d "$gnutls_withval"; then
1103                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
1104                 fi
1106                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1108                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1109                         cf_result=no
1110                 else
1111                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1112                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1114                         LIBS="$GNUTLS_LIBS $LIBS_X"
1115                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1116                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1118                         # Verify if it's really usable.  gnutls_session was
1119                         # renamed to gnutls_session_t before GNU TLS 1.2.0
1120                         # (on 2004-06-13); ELinks now requires this.
1121                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]], [[gnutls_session_t dummy;
1122                                      gnutls_check_version(NULL)]])],[cf_result=yes],[cf_result=no])
1123                 fi
1125                 if test "$cf_result" = yes; then
1126                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1128                         CFLAGS="$CFLAGS_X"
1129                         AC_SUBST(GNUTLS_CFLAGS)
1131                         # GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
1132                         # to GPLv3+.  Don't link that with the GPLv2 ELinks.
1133                         # ELinks will use its internal MD5 code instead.
1134                         CONFIG_GNUTLS_OPENSSL_COMPAT=no
1135                 else
1136                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1137                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1138                         fi
1139                         EL_RESTORE_FLAGS
1140                 fi
1141         fi
1144 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1145 AC_MSG_RESULT($cf_result)
1147 # Final SSL setup
1149 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS CONFIG_NSS_COMPAT_OSSL], [SSL])
1150 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1151 AC_SUBST(CONFIG_OPENSSL)
1152 AC_SUBST(CONFIG_GNUTLS)
1153 AC_SUBST(CONFIG_NSS_COMPAT_OSSL)
1155 #endif
1157 AC_MSG_CHECKING([whether to be or not to be])
1158 AC_MSG_RESULT([needs to be determined experimentally])
1160 # ===================================================================
1161 # Check for IPv6 support and related functions.
1162 # ===================================================================
1164 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1165 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1166 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1168 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1169 if test "$HAVE_GETADDRINFO" != yes; then
1170         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1171         if test "$HAVE_GETADDRINFO" = yes; then
1172                 LIBS="$LIBS -linet6"
1173         fi
1177 # ===================================================================
1178 # Checking for X11 (window title restoring).
1179 # ===================================================================
1181 AC_PATH_X
1182 if test x"$no_x" != xyes; then
1183         EL_SAVE_FLAGS
1184         if test -n "$x_includes"; then
1185                 X_CFLAGS="-I$x_includes"
1186                 CPPFLAGS="$CPPLAGS $X_CFLAGS"
1187                 CFLAGS="$CFLAGS $X_CFLAGS"
1188         fi
1189         if test -n "$x_libraries"; then
1190                 LDFLAGS="$LDFLAGS -L$x_libraries"
1191         fi
1192         LIBS="-lX11 $LIBS"
1193         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize()]])],[cf_result=yes],[cf_result=no])
1194         EL_RESTORE_FLAGS
1195         if test "$cf_result" = yes; then
1196                 if test -n "$x_libraries"; then
1197                         LDFLAGS="$LDFLAGS -L$x_libraries"
1198                 fi
1199                 LIBS="-lX11 $LIBS"
1200                 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1201                 AC_SUBST(X_CFLAGS)
1202         fi
1206 # ===================================================================
1207 # Backtraces displaying support.
1208 # ===================================================================
1210 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1211 # possible checks for other system-specific means go here
1214 # ===================================================================
1215 # Gettext grey zone. Beware.
1216 # ===================================================================
1218 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"
1220 AM_GNU_GETTEXT
1222 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1223 dnl # f33r d4 l33t... I hope it's portable. :)
1224 dnl cf_result=$((48#z - 48#a + 1));
1225 dnl AC_MSG_RESULT($cf_result)
1228 # ===================================================================
1229 # Compile-time features control
1230 # ===================================================================
1232 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1233               [  --disable-cookies       disable cookie support])
1235 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1236               [  --disable-formhist      disable form history support])
1238 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1239               [  --disable-globhist      disable global history support])
1242 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1243               [  --disable-mailcap       disable mailcap support])
1245 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1246               [  --disable-mimetypes     disable mimetypes files support])
1249 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1250               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1251               [IPv6],
1252               [  --disable-ipv6          disable IPv6 support])
1254 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1255               [  --enable-bittorrent     enable BitTorrent protocol support])
1257 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1258               [  --disable-data          disable data protocol support])
1260 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1261               [  --disable-uri-rewrite   disable URI rewrite support])
1263 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1264               [  --enable-cgi            enable local CGI support])
1266 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1267               [  --enable-finger         enable finger protocol support])
1269 # ===================================================================
1270 # FSP protocol
1271 # ===================================================================
1272 EL_SAVE_FLAGS
1274 if test "x${enable_fsp}" != xno; then
1275         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1277         if test "$HAVE_FSPLIB" = yes; then
1278                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1279                 if test "$HAVE_FSPLIB" = yes; then
1280                         LIBS="$LIBS -lfsplib"
1281                 else
1282                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1283                         if test "$HAVE_FSPLIB" = yes; then
1284                                 LIBS="$LIBS -lfsp"
1285                         fi
1286                 fi
1287         fi
1290 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1291               [  --enable-fsp            enable FSP protocol support])
1293 if test "x$CONFIG_FSP" = xno; then
1294         EL_RESTORE_FLAGS
1297 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1298               [  --disable-ftp           disable ftp protocol support])
1300 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1301               [  --enable-gopher         enable gopher protocol support])
1303 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1304               [  --enable-nntp           enable nntp protocol support])
1306 # ===================================================================
1307 # SMB protocol support.
1308 # ===================================================================
1309 EL_SAVE_FLAGS
1311 if test "x${enable_smb}" != xno; then
1312         AC_CHECK_HEADERS(libsmbclient.h, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1314         if test "$HAVE_SMBCLIENT" = yes; then
1315                 AC_CHECK_LIB(smbclient, smbc_init, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1316                 if test "$HAVE_SMBCLIENT" = yes; then
1317                         LIBS="$LIBS -lsmbclient"
1318                 fi
1319         fi
1322 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [Samba protocol],
1323               [  --enable-smb            enable Samba protocol support])
1325 if test "x$CONFIG_SMB" = xno; then
1326         EL_RESTORE_FLAGS
1330 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1331               [  --disable-mouse         disable mouse support])
1333 # GPM mouse is Linux specific, so ...
1334 CONFIG_SYSMOUSE=yes
1335 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1336               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1337               [BSD sysmouse],
1338               [  --disable-sysmouse      disable BSD sysmouse support])
1340 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1341               [  --enable-88-colors      enable 88 color support])
1343 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1344               [  --enable-256-colors     enable 256 color support])
1346 EL_ARG_ENABLE(CONFIG_TRUE_COLOR, true-color, [true color],
1347               [  --enable-true-color     enable true color support])
1349 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1350               [  --enable-exmode         enable exmode (CLI) interface])
1352 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1353               [  --disable-leds          disable LEDs support])
1355 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1356               [  --disable-marks         disable document marks support])
1359 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1360               [  --disable-css           disable Cascading Style Sheet support])
1362 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1363               [  --enable-html-highlight HTML highlighting using DOM engine])
1365 # Everything in the tree already uses CONFIG_DOM
1366 # so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1367 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1369 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1370               [  --disable-backtrace     disable backtrace support])
1372 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1373               [  --enable-no-root        enable prevention of usage by root])
1376 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1377               [  --enable-debug          enable leak debug and internal error checking])
1379 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1380               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1382 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1383               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1385 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1386               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1388 EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
1389               [  --disable-utf-8         disable UTF-8 support])
1391 EL_ARG_DEPEND(CONFIG_COMBINE, combining, [CONFIG_UTF8:yes HAVE_WCWIDTH:yes], [Combining characters],
1392               [  --enable-combining      support Unicode combining characters (experimental)])
1395 AC_ARG_ENABLE(weehoofooboomookerchoo,
1396               [
1397     Also check out the features.conf file for more information about features!
1398               ],
1399               [AC_MSG_ERROR(Are you strange, or what?)])
1402 # ===================================================================
1403 # Further LDFLAGS tweaks
1404 # ===================================================================
1406 # == EMX hack
1408 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1409 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1412 # Check for -rdynamic
1414 # gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
1415 # the executable to its dynamic symbol table.  ELinks uses this for
1416 # two purposes:
1418 # 1. If ELinks detects a bug, it can try to display a backtrace by
1419 #    calling backtrace_symbols_fd() in the GNU libc.  The glibc-2.3.6
1420 #    manual states users of GNU ld must pass -rdynamic to make the
1421 #    symbols available to the program.
1423 # 2. It would eventually be nice to dynamically load shared
1424 #    libraries as plugins (bug 73).  The plugins must be able to
1425 #    call ELinks functions.  This can be implemented either by
1426 #    registering all callable functions in ELinks-specific data
1427 #    structures, or by letting the dynamic linker handle them.
1428 #    The latter way requires something equivalent to -rdynamic.
1430 # Because backtraces are not needed for correct operation, and bug
1431 # 73 is not yet being fixed, the configure script and makefiles
1432 # should not complain to the user if they find that -rdynamic does
1433 # not work.  Besides, it was reported at elinks-users on 2006-09-12
1434 # that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
1435 # Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
1436 # -rdynamic but does something equivalent automatically.  (This was
1437 # tested with "nm -D elinks | grep redraw_from_window".)
1439 # With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
1440 # -dynamic"; then, cc proceeds anyway, but the option can prevent the
1441 # linker from finding the libraries listed in -l operands.  So this
1442 # -rdynamic check needs to happen after the libraries have already
1443 # been added to $LDFLAGS.
1444 AC_MSG_CHECKING([for -rdynamic])
1445 LDFLAGS_X="$LDFLAGS"
1446 LDFLAGS="-rdynamic $LDFLAGS"
1447 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
1448 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
1449 AC_MSG_RESULT($have_rdynamic)
1451 # ===================================================================
1452 # Export directory paths
1453 # ===================================================================
1455 # Set up the ``entry points'' if they were not supplied by builder
1456 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1457 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1459 # Create CONFDIR #define for config.h
1461 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1462 # it's autoconf fault to force us to do such hacks ;p.
1463 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1464   # sysconfdir is set to its default value... fine, let's append /elinks/
1465   # XXX: We can't modify listing of the default in ./configure --help :-(
1466   sysconfdir_n=`eval echo "$sysconfdir"`
1467   sysconfdir=$sysconfdir_n
1468   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1469         sysconfdir="$sysconfdir/elinks"
1472 CONFDIR=$sysconfdir
1473 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1474 AC_SUBST(CONFDIR)
1476 # Create LOCALEDIR #define for config.h
1477 LOCALEDIR=`eval echo "$datadir/locale"`
1478 while echo "$LOCALEDIR" | grep "\\$"
1480         LOCALEDIR=`eval echo "$LOCALEDIR"`
1481 done > /dev/null 2> /dev/null
1482 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1483 AC_SUBST(LOCALEDIR)
1485 # Create LIBDIR #define for config.h
1486 LIBDIR=`eval echo "$libdir"`
1487 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1488 AC_SUBST(LIBDIR)
1490 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1491 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1494 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
1495 ]], [[#if !defined(__TINYC__) || !defined(alloca)
1496         #error not tcc
1497         #endif ]])],[cf_result=yes],[cf_result=no])
1499 if test "$cf_result" = "yes"; then
1500         AC_DEFINE([HAVE_ALLOCA])
1501         AC_DEFINE([_ALLOCA_H], [1], [Define as 1 if you are using Tiny C Compiler
1502                 with the GNU C Library, and <alloca.h> of glibc would otherwise
1503                 override the alloca macro defined in <stddef.h> of TCC.
1504                 If <alloca.h> of glibc sees the _ALLOCA_H macro, it assumes
1505                 it has already been included, and does not redefine alloca.
1506                 This might not work in future glibc versions though, because
1507                 the names of the #include guard macros are not documented.
1508                 The incompatibility has been reported to the tinycc-devel
1509                 mailing list on 2008-07-14.  If a future version of TCC provides
1510                 an <alloca.h> of its own, this hack won't be needed.])
1512 # ===================================================================
1513 # A little fine tuning of gcc specific options (continued)
1514 # ===================================================================
1516 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
1517   if test "$CONFIG_DEBUG" = "yes"; then
1518     # We want to see all warnings and live with none (in debug mode).
1519     CFLAGS="$CFLAGS -Werror"
1520   fi
1522   case "`$CC -dumpversion`" in
1523     3.0|3.1|3.2)
1524       # These should be ok using -Werror
1525       ;;
1526     3.*)
1527       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1528       # "dereferencing type-punned pointer will break strict-aliasing rules"
1529       # warnings. Disable them by not doing any strict-aliasing. The
1530       # alternative is just too ugly. Thanks gcc guys!! ;)
1531       CFLAGS="$CFLAGS -fno-strict-aliasing"
1532       ;;
1533     4.*)
1534       # Do not show warnings related to (char * | unsigned char *) type
1535       # difference.
1536       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1537       ;;
1538     *)
1539       # These should be ok using -Werror
1540       ;;
1541   esac
1543   # GCC 4.2.1 warns if we use the address of an object in Boolean context:
1544   # warning: the address of `builtin_modules' will always evaluate as `true'
1545   # This hits the object_lock and foreach_module macros in particular.
1546   # It would be okay to put something in the macros to avoid the warning,
1547   # but currently this seems to require defining parallel macros that skip
1548   # the NULL check, and that's too ugly.  So we instead disable the warning.
1549   # GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
1550   # GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
1551   for warning_flag in -Wno-address -Wno-always-true; do
1552     AC_MSG_CHECKING([whether $CC accepts $warning_flag])
1553     EL_SAVE_FLAGS
1554     CFLAGS="$CFLAGS $warning_flag"
1555     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1556       [AC_MSG_RESULT([yes])
1557        break],
1558       [AC_MSG_RESULT([no])])
1559     EL_RESTORE_FLAGS
1560   done
1562   # Bug 1012: Some parts of ELinks do arithmetic with signed integers
1563   # in such a way that an overflow is possible.  GCC 4.2.1 warns
1564   # "warning: assuming signed overflow does not occur when assuming
1565   # that (X + c) > X is always true", which may be an incorrect
1566   # optimization (although allowed by the standard), and breaks the
1567   # build with -Werror.
1568   #
1569   # All of the following tests included -S -Wall -Wextra:
1570   #
1571   # GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
1572   # * gcc-4.0 -O0: OK, compares the values
1573   # * gcc-4.0 -O2: assumes no overflow, does not warn
1574   # * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
1575   # * gcc-4.0 -O0 -fwrapv: OK, compares the values
1576   # * gcc-4.0 -O2 -fwrapv: OK, compares the values
1577   # * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
1578   # * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
1579   # * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1580   # * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
1581   #
1582   # GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
1583   # * gcc-4.1 -O0: assumes no overflow, does not warn
1584   # * gcc-4.1 -O2: assumes no overflow, does not warn
1585   # * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
1586   # * gcc-4.1 -O0 -fwrapv: OK, compares the values
1587   # * gcc-4.1 -O2 -fwrapv: OK, compares the values
1588   # * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
1589   # * gcc-4.1 -O2 -ftrapv: compares the values
1590   # * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1591   # * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
1592   #
1593   # GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
1594   # * gcc-4.2 -O0: OK, compares the values
1595   # * gcc-4.2 -O2: assumes no overflow, warns about it
1596   # * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
1597   # * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
1598   # * gcc-4.2 -O0 -fwrapv: OK, compares the values
1599   # * gcc-4.2 -O2 -fwrapv: OK, compares the values
1600   # * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
1601   # * gcc-4.2 -O2 -ftrapv: compares the values
1602   # * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1603   # * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
1604   #
1605   # Apparently, -ftrapv does not work reliably at all.
1606   for overflow_flag in -fno-strict-overflow -fwrapv; do
1607     AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
1608     EL_SAVE_FLAGS
1609     CFLAGS="$CFLAGS $overflow_flag"
1610     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1611       [AC_MSG_RESULT([yes])
1612        break],
1613       [AC_MSG_RESULT([no])])
1614     EL_RESTORE_FLAGS
1615   done
1618 EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
1619 EL_LOG_CONFIG(CPPFLAGS, [Preprocessor flags (CPPFLAGS)], [])
1620 EL_LOG_CONFIG(LDFLAGS, [Linker flags (LDFLAGS)], [])
1621 EL_LOG_CONFIG(LIBS, [Library flags (LIBS)], [])
1623 # ===================================================================
1624 # Colored make output
1625 # ===================================================================
1627 if test $(`which tput` colors) -ge 4; then
1628         MAKE_COLOR=1
1629         AC_SUBST(MAKE_COLOR)
1632 # ===================================================================
1633 # Generated files
1634 # ===================================================================
1636 AC_CONFIG_FILES([ \
1637  Makefile.config \
1638  contrib/elinks.spec \
1639  contrib/lua/hooks.lua \
1640  contrib/conv/w3m2links.awk \
1641  doc/Doxyfile \
1642  doc/man/man1/elinks.1 \
1643  src/intl/gettext/ref-add.sed \
1644  src/intl/gettext/ref-del.sed
1646 AC_OUTPUT
1648 abs_srcdir="$(cd "$srcdir" && pwd)"
1649 # builddir is always absolute!
1650 if test "$abs_srcdir" != "$builddir"; then
1651         # Bootstrap the Makefile creation
1652         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1653         "$MAKE" "SRC=$abs_srcdir" init
1655         # Make cg-status ignore this build directory
1656         echo "*" > "$builddir/.gitignore"
1659 # ===================================================================
1660 # Configuration summary
1661 # ===================================================================
1663 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1664 cat features.log