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.61 is installed in the computer that generates our nightly
10 dnl snapshots, so we need to be compatible with that. (Also, some files
11 dnl in Autoconf 2.62 and 2.63 sources are not GPLv2 compatible.)
14 AC_CONFIG_SRCDIR([src/main/main.c])
15 AC_CONFIG_AUX_DIR(config)
21 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
22 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
23 AC_CONFIG_HEADERS(config.h)
25 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
26 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
27 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
31 for make in gnumake gmake make false; do
32 if test "x$MAKE" = x; then
33 AC_PATH_PROGS(MAKE, "$make")
39 # Cleanup if we are configuring with a previous build in the tree
40 if test -e Makefile.config; then
41 AC_MSG_CHECKING([for previous build to clean])
42 "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
46 # ===================================================================
47 # Load feature configuration file and start logging features.
48 # ===================================================================
50 features="features.conf"
51 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
52 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
53 echo "Feature summary:" > features.log
55 # ===================================================================
56 # Checks for programs.
57 # ===================================================================
61 AC_PATH_PROGS(AWK, "$AWK")
65 AC_PATH_PROGS(GIT, "git")
66 AC_PATH_PROGS(SPARSE, "sparse")
73 if test "x$CONFIG_DOC" != xno; then
74 AC_PATH_PROGS(PYTHON, "python")
75 if test "x$PYTHON" != "x"; then
76 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
77 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
78 EL_CONFIG(MAN_ASCIIDOC, [HTML])
81 AC_PATH_PROGS(XMLTO, "xmlto")
82 if test "x$XMLTO" != "x"; then
83 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
84 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
85 EL_CONFIG(MAN_XMLTO, [man (groff)])
88 AC_PATH_PROGS(JW, "jw")
89 if test "x$JW" != "x"; then
90 EL_CONFIG(CONFIG_JW, [JadeWrapper])
91 EL_CONFIG(MANUAL_JW, [PDF])
94 AC_PATH_PROGS(POD2HTML, "pod2html")
95 if test "x$POD2HTML" != "x"; then
96 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
99 AC_PATH_PROGS(DOXYGEN, "doxygen")
100 if test "x$DOXYGEN" != "x"; then
101 EL_CONFIG(CONFIG_DOXYGEN, [Doxygen])
102 api_srcdir="$(cd "$srcdir" && pwd)/src"
107 AC_SUBST(CONFIG_ASCIIDOC)
108 AC_SUBST(CONFIG_DOXYGEN)
109 AC_SUBST(CONFIG_POD2HTML)
110 AC_SUBST(CONFIG_XMLTO)
113 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
114 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
115 EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
116 EL_CONFIG_DEPENDS(CONFIG_APIDOCS, [CONFIG_DOXYGEN], [API Documentation])
118 # gcc specific options (to be continued at the bottom of configure)
119 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
120 # We want to see all warnings and live with none.
121 # We can't set up -Werror here as there may be some warnings in test
122 # suite of configure, and we don't want to fail them.
123 CFLAGS="$CFLAGS -Wall"
126 # ===================================================================
127 # Checks for special OSes.
128 # ===================================================================
130 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
131 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
133 AC_MSG_CHECKING([for $2])
136 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef $flag
138 #endif ]])],[$1=yes],[$1=no])
139 if test "[$]$1" = yes; then
140 EL_CONFIG([$1], [$2])
148 EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
149 AC_SUBST(CONFIG_OS_BEOS)
151 EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
152 AC_SUBST(CONFIG_OS_RISCOS)
154 EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
155 AC_SUBST(CONFIG_OS_WIN32)
157 EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
158 AC_SUBST(CONFIG_OS_OS2)
159 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
161 AC_MSG_CHECKING([for UNIX])
162 dnl FIXME: some depend kind of mechanism
163 if test "$CONFIG_OS_BEOS" = no && \
164 test "$CONFIG_OS_RISCOS" = no && \
165 test "$CONFIG_OS_WIN32" = no && \
166 test "$CONFIG_OS_OS2" = no; then
167 EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
171 AC_MSG_RESULT($CONFIG_OS_UNIX)
172 AC_SUBST(CONFIG_OS_UNIX)
174 # ===================================================================
175 # Checks for header files.
176 # ===================================================================
183 AC_CHECK_HEADERS(wctype.h)
184 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
185 AC_CHECK_HEADERS(sigaction.h)
186 AC_CHECK_HEADERS(arpa/inet.h)
187 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
188 AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/in6_var.h)
189 AC_CHECK_HEADERS(ifaddrs.h)
190 AC_CHECK_HEADERS(sys/cygwin.h io.h)
191 AC_CHECK_HEADERS(sys/fmutex.h)
192 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
193 AC_CHECK_HEADERS(sys/resource.h)
194 AC_CHECK_HEADERS(sys/select.h)
195 AC_CHECK_HEADERS(sys/signal.h)
196 AC_CHECK_HEADERS(sys/socket.h)
197 AC_CHECK_HEADERS(sys/time.h)
198 AC_CHECK_HEADERS(sys/utsname.h)
199 AC_CHECK_HEADERS([net/if.h], [], [],
200 [[#ifdef HAVE_SYS_SOCKET_H
201 # include <sys/socket.h> /* <net/if.h> on Mac OS X 10.5.4 needs this */
204 AC_CHECK_HEADERS(stdint.h inttypes.h)
205 AC_CHECK_HEADERS(locale.h pwd.h)
206 AC_CHECK_HEADERS(termios.h)
209 AC_CHECK_HEADERS(sys/un.h,
210 [CONFIG_INTERLINK=yes
211 EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
212 [CONFIG_INTERLINK=no])
213 AC_SUBST(CONFIG_INTERLINK)
215 # ===================================================================
216 # Checks for typedefs, structures, and compiler characteristics.
217 # ===================================================================
222 AC_MSG_CHECKING([[for C99-conforming inline]])
240 [AC_MSG_RESULT([[yes]])
241 AC_DEFINE([NONSTATIC_INLINE], [inline],
242 [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.])],
243 [AC_MSG_RESULT([[no]])
244 AC_DEFINE([NONSTATIC_INLINE], [])])
245 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
250 EL_CHECK_TYPE(ssize_t, int)
251 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
252 EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
253 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
254 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
255 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
257 AC_CHECK_SIZEOF(char, 1)
258 AC_CHECK_SIZEOF(short, 2)
259 AC_CHECK_SIZEOF(int, 4)
260 AC_CHECK_SIZEOF(long, 4)
261 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
262 test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
264 # Check for variadic macros
265 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
267 #define a(b,c...) printf(b,##c)],
268 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
270 # ===================================================================
271 # Checks for library functions.
272 # ===================================================================
274 AC_PROG_GCC_TRADITIONAL
278 AC_CHECK_FUNCS(atoll gethostbyaddr herror strerror)
279 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
280 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
281 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
282 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
283 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
284 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
285 AC_CHECK_FUNCS(gettimeofday clock_gettime)
287 AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
289 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
290 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
291 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
293 # These aren't probably needed now, as they are commented in links.h.
294 # I've no idea about their historical background, but I keep them here
295 # just in the case they will help later. --pasky
296 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
297 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
298 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
299 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
301 if test x"$HAVE_RAISE" = x; then
302 if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
303 AC_MSG_ERROR([Unable to emulate raise()])
307 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
308 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
309 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],[el_cv_HAVE_VA_COPY=yes],[el_cv_HAVE_VA_COPY=no])])
310 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
311 EL_DEFINE(HAVE_VA_COPY, __va_copy)
314 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
315 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
316 ]], [[int page_size = sysconf(_SC_PAGE_SIZE);]])],[el_cv_HAVE_SC_PAGE_SIZE=yes],[el_cv_HAVE_SC_PAGE_SIZE=no])])
317 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
318 EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
321 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
322 AC_RUN_IFELSE([AC_LANG_SOURCE([[
330 int bar(char *buf, const char *format, va_list ap)
332 return vsnprintf(buf, 0, format, ap);
335 void foo(const char *format, ...) {
339 va_start(ap, format);
340 len = bar(buf, format, ap);
342 if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
344 va_start(ap, format);
345 len = bar(buf, format, ap);
347 if ((len != 6) && (len != 7)) exit(1);
349 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
353 main() { foo("hello\n"); }
354 ]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
355 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
356 EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
359 # OpenSSL and Lua frequently need dlopen
360 AC_CHECK_LIB(dl, dlopen)
362 # ===================================================================
363 # Checks for libraries.
364 # ===================================================================
366 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
367 if test "$cf_result" = no; then
368 AC_CHECK_LIB(socket, socket)
371 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
372 if test "$cf_result" = no; then
373 AC_CHECK_LIB(socket, setsockopt)
376 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
377 if test "$cf_result" = no; then
378 AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
379 if test "$cf_result" = no; then
380 AC_CHECK_LIB(nsl, gethostbyname)
382 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
386 # ===================================================================
387 # Checks for packaging specific options.
388 # ===================================================================
390 AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
391 [ if test "$withval" != no && test "$withval" != yes; then
392 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
395 # ===================================================================
396 # Checks for a libraries, optional even if installed.
397 # ===================================================================
399 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
400 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
402 AC_MSG_CHECKING([for $2 support])
404 if test "[$]$1" != no; then
407 if test -n "$withval" && test -d "$withval"; then
408 # Be a little more careful when setting
409 # include and lib directories. This way
410 # $withval will work when includes are
411 # there but the library is in the common
412 # /usr/lib ... Does the right thing when
413 # looking for gc on Debian.
414 if test -d "$withval/include"; then
415 CFLAGS="$CFLAGS -I$withval/include"
416 CPPFLAGS="$CPPFLAGS -I$withval/include"
418 CFLAGS="$CFLAGS -I$withval"
419 CPPFLAGS="$CPPFLAGS -I$withval"
421 if test -d "$withval/lib"; then
422 LDFLAGS="$LDFLAGS -L$withval/lib"
426 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
427 if test "[$]$1" = yes; then
428 AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
431 if test "[$]$1" = yes; then
432 EL_CONFIG([$1], [$2])
435 if test -n "[$]WITHVAL_$1" &&
436 test "[$]WITHVAL_$1" != xno; then
437 AC_MSG_ERROR([$2 not found])
442 AC_MSG_RESULT(disabled)
446 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
447 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
449 if test "x[$]$1" != xno; then $1=yes; fi
452 AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
453 if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
454 if test "x[$]WITHVAL_$1" = xyes; then $1=yes; fi
456 EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
458 EL_LOG_CONFIG([$1], [$2], [])
461 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
462 [ --without-gpm disable gpm (mouse) support])
464 # ELinks calls deflateInit2 with windowBits = MAX_WBITS | 32, to
465 # enable automatic decoding of both zlib and gzip headers. This
466 # feature was added in zlib 1.2.0.2; earlier versions return an error.
467 # The gzclearerr function was also added in zlib 1.2.0.2, so check for
468 # that, even though ELinks does not actually call gzclearerr.
469 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
470 [ --without-zlib disable zlib support])
472 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
473 [ --without-bzlib disable bzlib support])
475 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
476 [ --without-idn disable international domain names support])
478 if test "x${with_gc}" != xno; then
479 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
480 [ --with-gc enable Boehm's garbage collector])
483 # LZMA disabled by default, because of little usability and compilation problems
485 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
486 [ --with-lzma enable lzma encoding support])
488 # ===================================================================
489 # Check for GSSAPI, optional even if installed.
490 # ===================================================================
494 AC_ARG_WITH(gssapi, [ --with-gssapi enable GSSAPI support],
495 [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
497 AC_MSG_CHECKING([for GSSAPI])
499 if test "$enable_gssapi" = "yes"; then
501 GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
502 GSSAPI_LIBS=`krb5-config --libs gssapi`
503 CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
504 LIBS="$GSSAPI_LIBS $LIBS"
505 EL_CONFIG(CONFIG_GSSAPI, [GssApi])
510 AC_SUBST(CONFIG_GSSAPI)
512 # ===================================================================
513 # Bookmark and XBEL support
514 # ===================================================================
518 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
519 [ --disable-bookmarks disable bookmark support])
521 # Check whether --enable-xbel or --disable-xbel was given.
522 if test "x${enable_xbel}" != xno; then
523 AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
525 if test "$HAVE_LIBEXPAT" = yes; then
526 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
527 if test "$HAVE_LIBEXPAT" = yes; then
534 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
536 [ --disable-xbel disable XBEL bookmark support (requires expat)])
538 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
542 # ===================================================================
543 # Checks for BSD sysmouse
544 # ===================================================================
546 HAVE_SYSMOUSE_HEADER="no"
548 # Either of these header files provides the (same) sysmouse interface
549 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
551 # ===================================================================
553 # ===================================================================
555 if test "$CONFIG_OS_OS2" = yes; then
559 # ===================================================================
561 # ===================================================================
563 if test "$CONFIG_OS_WIN32" = yes; then
567 # ===================================================================
568 # Check for SEE (Simple Ecmascript Engine)
569 # ===================================================================
570 AC_ARG_WITH(see, [ --with-see enable Simple Ecmascript Engine (SEE) support],
571 [ if test "x$withval" != xno; then enable_see=yes; fi ])
573 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
574 # GUILE_FLAGS but I really don't want to require people to have Guile in order
575 # to compile CVS. Also, the macro seems to be really stupid regarding searching
576 # for Guile in $PATH etc. --pasky
578 CONFIG_ECMASCRIPT_SEE=no
580 if test "$enable_see" = "yes"; then
581 if test -d "$withval"; then
582 SEE_PATH="$withval:$PATH"
587 AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
588 AC_MSG_CHECKING([for SEE (2.0.1131 or later)])
589 if test "$SEE_CONFIG" != no; then
591 SEE_LIBS="`$SEE_CONFIG --libs`"
592 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
593 CPPFLAGS="$SEE_CFLAGS $CPPFLAGS"
594 LIBS="$SEE_LIBS $LIBS_X"
595 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <see/see.h>]], [[#if SEE_VERSION_API_MAJOR < 2
598 ]])],[cf_result=yes],[cf_result=no])
600 if test "$cf_result" = yes; then
601 LIBS="$SEE_LIBS $LIBS"
602 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
605 AC_MSG_RESULT($cf_result)
607 if test -n "$withval" && test "x$withval" != xno; then
608 AC_MSG_ERROR([SEE not found])
610 AC_MSG_WARN([SEE support disabled])
615 # ===================================================================
616 # Check for SpiderMonkey, optional even if installed.
617 # ===================================================================
619 AC_ARG_WITH(spidermonkey, [ --without-spidermonkey disable SpiderMonkey Mozilla JavaScript engine support],
620 [if test "$withval" = no; then disable_spidermonkey=yes; fi])
621 AC_MSG_CHECKING([for SpiderMonkey (1.5 RC3a or later)])
626 if test -z "$disable_spidermonkey"; then
627 if test ! -d "$withval"; then
630 for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
631 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
632 for spidermonkeylib in js smjs mozjs; do
633 if test "$cf_result" = no &&
634 test -f "$spidermonkeydir$spidermonkeyinclude/jsapi.h"; then
635 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib -l$spidermonkeylib"
636 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
638 LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
639 CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
640 CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
642 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
643 #include <jsapi.h>]], [[JS_GetReservedSlot(NULL, NULL, 0, NULL)]])],[cf_result=yes],[cf_result=no])
650 AC_MSG_RESULT($cf_result)
651 CONFIG_SPIDERMONKEY="$cf_result"
652 if test "$cf_result" = "yes"; then
653 AC_CHECK_FUNCS([[JS_ReportAllocationOverflow]])
657 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
658 test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
659 EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
661 CONFIG_ECMASCRIPT_SMJS=no
664 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
665 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
666 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
669 # ===================================================================
670 # Optional Spidermonkey-based ECMAScript browser scripting
671 # ===================================================================
673 AC_ARG_ENABLE(sm-scripting,
674 [ --disable-sm-scripting ECMAScript browser scripting (requires Spidermonkey)],
675 [if test "$enableval" != no; then enableval="yes"; fi
676 CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
678 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
679 test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
680 EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
682 CONFIG_SCRIPTING_SPIDERMONKEY=no
685 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
686 test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
687 LIBS="$LIBS $SPIDERMONKEY_LIBS"
688 AC_SUBST(SPIDERMONKEY_LIBS)
689 AC_SUBST(SPIDERMONKEY_CFLAGS)
690 AC_SUBST(CONFIG_SPIDERMONKEY)
693 # ===================================================================
694 # Check for Guile, optional even if installed.
695 # ===================================================================
699 AC_ARG_WITH(guile, [ --with-guile enable Guile support],
700 [ if test "x$withval" != xno; then enable_guile=yes; fi ])
702 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
703 # GUILE_FLAGS but I really don't want to require people to have Guile in order
704 # to compile CVS. Also, the macro seems to be really stupid regarding searching
705 # for Guile in $PATH etc. --pasky
707 AC_MSG_CHECKING([for Guile])
709 if test "$enable_guile" = "yes"; then
711 ## Based on the GUILE_FLAGS macro.
713 if test -d "$withval"; then
714 GUILE_PATH="$withval:$PATH"
719 AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
721 ## First, let's just see if we can find Guile at all.
722 if test "$GUILE_CONFIG" != no; then
725 GUILE_LIBS="`guile-config link`"
726 GUILE_CFLAGS="`guile-config compile`"
727 LIBS="$GUILE_LIBS $LIBS"
728 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
729 AC_SUBST(GUILE_CFLAGS)
731 ***********************************************************************
732 The Guile support is incomplete and not so well integrated to ELinks
733 yet. That means, e.g., that you have no Guile console and there might
734 not be all the necessary hooks. Also, the Guile interface is not too
735 well tested (success stories heartily welcomed!). See
736 src/scripting/guile/README for further details and hints.
737 ***********************************************************************
740 if test -n "$withval" && test "x$withval" != xno; then
741 AC_MSG_ERROR([Guile not found])
743 AC_MSG_WARN([Guile support disabled])
750 # ===================================================================
752 # ===================================================================
755 AC_ARG_WITH(perl, [ --with-perl enable Perl support],
757 if test "$withval" = yes; then
758 # FIXME: If withval is a valid directory append it to PATH
759 # so that you can specify one of several perl installations.
765 AC_MSG_CHECKING([for Perl])
771 if test "$enable_perl" = "yes"; then
772 PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
773 PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
774 LIBS="$PERL_LIBS $LIBS"
775 CFLAGS="$PERL_CFLAGS $CFLAGS"
776 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
777 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
781 ]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
784 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
786 AC_MSG_CHECKING([whether POPpx works without an n_a variable])
787 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
790 extern PerlInterpreter *my_perl;
791 ]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
792 AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
793 [Define if using Perl 5.8.8 or later, where the "POPpx" macro
794 no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
796 if test "$cf_result" != "yes"; then
799 EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
802 CPPFLAGS="$CPPFLAGS_X"
804 AC_SUBST(PERL_CFLAGS)
807 # ===================================================================
809 # ===================================================================
812 AC_ARG_WITH(python, [[ --with-python[=DIR] enable Python support]],
813 [ if test "x$withval" != xno; then enable_python=yes; fi ])
818 AC_MSG_CHECKING([for Python])
820 if test "$enable_python" = "yes"; then
823 if test -d "$withval"; then
824 PYTHON_PATH="$withval:$PATH"
829 AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
831 if test "$PYTHON" != no; then
834 PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; print "-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True))'`"
835 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"))'`"
836 LIBS="$PYTHON_LIBS $LIBS"
837 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
838 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
840 if test "$cf_result" != "yes"; then
843 EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
844 AC_SUBST(PYTHON_LIBS)
845 AC_SUBST(PYTHON_CFLAGS)
846 CPPFLAGS="$CPPFLAGS_X"
848 ***********************************************************************
849 The Python support is incomplete and not so well integrated to ELinks
850 yet. That means, e.g., that you have no Python console and there might
851 not be all the necessary hooks. Also, the Python interface is not too
852 well tested (success stories heartily welcomed!).
853 ***********************************************************************
857 if test -n "$withval" && test "x$withval" != xno; then
858 AC_MSG_ERROR([Python not found])
860 AC_MSG_WARN([Python support disabled])
868 # ===================================================================
869 # Check for Lua, optional even if installed.
870 # ===================================================================
872 # Do this the long way, as FreeBSD reportedly needs -L<dir> for
873 # anything other than /usr/lib, and Lua is very often in /usr/local/lib.
875 AC_ARG_WITH(lua, [ --without-lua disable Lua support],
876 [if test "$withval" = no; then disable_lua=yes; fi])
877 AC_MSG_CHECKING([for Lua])
882 if test -z "$disable_lua"; then
883 if test ! -d "$withval"; then
886 for luadir in "$withval" "" /usr /usr/local; do
887 for suffix in "" 50; do
888 if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
889 test -f "$luadir/include/lua$suffix/lua.h" ) ; then
890 LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm"
891 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
893 LIBS="$LUA_LIBS $LIBS_X"
894 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
895 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
897 # Check that it is a compatible Lua version
898 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lua.h>
899 #include <lualib.h>]], [[ lua_State *L = lua_open();
905 lua_pushboolean(L, 1);
906 lua_close(L);]])],[cf_result=yes],[cf_result=no])
912 AC_MSG_RESULT($cf_result)
914 if test "$cf_result" != yes; then
917 EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
918 AC_CHECK_HEADERS(lauxlib.h)
921 CPPFLAGS="$CPPFLAGS_X"
926 # ===================================================================
927 # Check for TRE library
928 # ===================================================================
930 # This section only checks that --without-tre is not given and the
931 # library seems to work, and sets TRE_CFLAGS, TRE_LIBS, and
932 # tre_log. It does not define CONFIG_TRE, and always resets
933 # LIBS and CFLAGS back to their original values.
935 # After any --enable-utf-8 and --disable-utf-8 options have been
936 # handled, a separate section decides whether to actually use TRE.
938 AC_ARG_WITH([[tre]], [[ --without-tre disable TRE regex search support]])
939 if test "$with_tre" = no; then
940 AC_MSG_CHECKING([[for TRE]])
941 AC_MSG_RESULT([[disabled]])
942 tre_log="no (explicitly disabled)"
944 AC_MSG_CHECKING([[for TRE in pkg-config]])
945 if pkg-config tre; then
946 TRE_CFLAGS=`pkg-config --cflags tre`
947 TRE_LIBS=`pkg-config --libs tre`
948 AC_MSG_RESULT([[yes]])
950 # <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513055>
951 # "libtre-dev: /usr/lib/pkgconfig/tre.pc missing"
952 # so we look for the library even if pkg-config doesn't know about it.
955 AC_MSG_RESULT([[no, but let's try defaults]])
958 AC_MSG_CHECKING([[for TRE header and library]])
960 CFLAGS="$TRE_CFLAGS $CFLAGS"
961 LIBS="$TRE_LIBS $LIBS" # must be first, because of regfree conflict
962 AC_TRY_LINK([#include <tre/regex.h>],
965 regwcomp(&re, L"zap", REG_ICASE);
966 regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
967 [AC_MSG_RESULT([[yes]])
968 tre_log="available"],
969 [AC_MSG_RESULT([[no]])
970 tre_log="no (TRE not found)"])
974 # ===================================================================
975 # Check for Ruby, optional even if installed.
976 # ===================================================================
978 EL_CONFIG_SCRIPTING_RUBY
980 # ===================================================================
981 # Setup global scripting
982 # ===================================================================
984 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])
985 AC_SUBST(CONFIG_SCRIPTING_GUILE)
986 AC_SUBST(CONFIG_SCRIPTING_LUA)
987 AC_SUBST(CONFIG_SCRIPTING_PERL)
988 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
989 AC_SUBST(CONFIG_SCRIPTING_RUBY)
990 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
991 AC_SUBST(CONFIG_SCRIPTING)
994 # ===================================================================
995 # Check for SSL support.
996 # ===================================================================
998 # We by default use OpenSSL, and we always prefer it. However, when GNUTLS
999 # is enabled, we won't try to use OpenSSL anymore.
1001 # For wiping SSL hooks..
1004 chosen_ssl_library=""
1006 AC_ARG_WITH(gnutls, [[ --without-gnutls disable GNUTLS SSL support]])
1007 AC_ARG_WITH(gnutls, [[ --with-gnutls enable GNUTLS SSL support]],
1008 [case "$with_gnutls" in
1010 "yes") chosen_ssl_library="GNUTLS" ;;
1011 *) chosen_ssl_library="GNUTLS"
1012 AC_MSG_WARN([[Support for --with-gnutls=DIR has been removed.
1013 You may have to set the PKG_CONFIG_PATH environment variable instead.]]) ;;
1016 AC_ARG_WITH(openssl, [[ --without-openssl disable OpenSSL support]])
1017 AC_ARG_WITH(openssl, [[ --with-openssl[=DIR] enable OpenSSL support (default)]],
1018 [case "$with_openssl" in
1020 *) chosen_ssl_library="OpenSSL" ;;
1025 AC_MSG_CHECKING([for OpenSSL])
1029 if test "$with_openssl" = no; then
1030 cf_result="explicitly disabled"
1032 elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "OpenSSL"; then
1033 cf_result="not used, because $chosen_ssl_library was chosen"
1037 for ssldir in "$with_openssl" "" /usr /usr/local/openssl \
1038 /usr/lib/openssl /usr/local/ssl \
1039 /usr/local/www /usr/lib/ssl /usr/local \
1040 /usr/pkg /opt /opt/openssl; do
1041 if test "$cf_result" = no; then
1042 if test -d "$ssldir"; then
1043 OPENSSL_CFLAGS="-I$ssldir/include"
1044 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
1045 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
1046 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
1047 # # FIXME: This created serious portability problems. --pasky
1048 # if test "$CC" == "gcc"; then
1049 # # I'm not sure about compatibility here. --pasky
1050 # LIBS="$LIBS -R$ssldir/lib"
1053 LIBS="-lssl -lcrypto $LIBS_X"
1055 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[OpenSSL_add_all_algorithms()]])],[cf_result=yes],[cf_result=no])
1056 if test "$cf_result" != yes; then
1057 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[SSLeay_add_ssl_algorithms()]])],[cf_result=yes],[cf_result=no])
1062 if test "$cf_result" != yes; then
1063 if test "${with_openssl-no}" != "no"; then
1064 AC_MSG_ERROR([OpenSSL not found])
1068 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
1069 chosen_ssl_library="OpenSSL"
1072 AC_SUBST(OPENSSL_CFLAGS)
1076 AC_MSG_RESULT($cf_result)
1080 # GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
1081 # to GPLv3+. Don't link that with the GPLv2 ELinks.
1082 # ELinks will use its internal MD5 code instead.
1083 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1085 if test "$with_gnutls" = no; then
1086 AC_MSG_CHECKING([[for GNUTLS]])
1087 AC_MSG_RESULT([[explicitly disabled]])
1089 elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "GNUTLS"; then
1090 AC_MSG_CHECKING([[for GNUTLS]])
1091 AC_MSG_RESULT([[not used, because $chosen_ssl_library was chosen]])
1095 AC_MSG_CHECKING([[for GNUTLS (1.2 or later) in pkg-config]])
1096 if pkg-config --atleast-version=1.2 gnutls; then
1097 GNUTLS_CFLAGS=`pkg-config --cflags gnutls`
1098 GNUTLS_LIBS=`pkg-config --libs gnutls`
1099 AC_MSG_RESULT([[yes: $GNUTLS_CFLAGS $GNUTLS_LIBS]])
1102 LIBS="$GNUTLS_LIBS $LIBS"
1103 CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
1104 CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
1106 # Verify if it's really usable. gnutls_session was
1107 # renamed to gnutls_session_t before GNU TLS 1.2.0
1108 # (on 2004-06-13); ELinks now requires this.
1109 AC_MSG_CHECKING([[whether GNUTLS can be linked with]])
1110 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]],
1111 [[gnutls_session_t dummy;
1112 gnutls_check_version(NULL)]])],
1115 AC_MSG_RESULT([[$cf_result]])
1117 if test "$cf_result" = yes; then
1118 # According to gnutls/NEWS, the function was originally
1119 # added as gnutls_set_default_priority2 in GNUTLS 2.1.4
1120 # (released 2007-10-27) and then renamed to
1121 # gnutls_priority_set_direct in GNUTLS 2.1.7 (released
1123 AC_CHECK_FUNCS([gnutls_priority_set_direct])
1128 AC_MSG_RESULT([[$cf_result]])
1131 if test "$cf_result" = yes; then
1132 EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1133 chosen_ssl_library="GNUTLS"
1135 LIBS="$GNUTLS_LIBS $LIBS"
1136 AC_SUBST(GNUTLS_CFLAGS)
1138 elif test "${with_gnutls-no}" != "no"; then
1139 AC_MSG_ERROR([[GNUTLS (1.2 or later) not found. ELinks no longer supports GNUTLS 1.1.]])
1145 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1146 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1147 AC_SUBST(CONFIG_OPENSSL)
1148 AC_SUBST(CONFIG_GNUTLS)
1152 AC_MSG_CHECKING([whether to be or not to be])
1153 AC_MSG_RESULT([needs to be determined experimentally])
1155 # ===================================================================
1156 # Check for IPv6 support and related functions.
1157 # ===================================================================
1159 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1160 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1161 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1163 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1164 if test "$HAVE_GETADDRINFO" != yes; then
1165 AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1166 if test "$HAVE_GETADDRINFO" = yes; then
1167 LIBS="$LIBS -linet6"
1172 # ===================================================================
1173 # Checking for X11 (window title restoring).
1174 # ===================================================================
1177 if test x"$no_x" != xyes; then
1179 if test -n "$x_includes"; then
1180 X_CFLAGS="-I$x_includes"
1181 CPPFLAGS="$CPPLAGS $X_CFLAGS"
1182 CFLAGS="$CFLAGS $X_CFLAGS"
1184 if test -n "$x_libraries"; then
1185 LDFLAGS="$LDFLAGS -L$x_libraries"
1188 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize()]])],[cf_result=yes],[cf_result=no])
1190 if test "$cf_result" = yes; then
1191 if test -n "$x_libraries"; then
1192 LDFLAGS="$LDFLAGS -L$x_libraries"
1195 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1201 # ===================================================================
1202 # Backtraces displaying support.
1203 # ===================================================================
1205 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1206 # possible checks for other system-specific means go here
1209 # ===================================================================
1210 # Gettext grey zone. Beware.
1211 # ===================================================================
1213 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"
1217 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1218 dnl # f33r d4 l33t... I hope it's portable. :)
1219 dnl cf_result=$((48#z - 48#a + 1));
1220 dnl AC_MSG_RESULT($cf_result)
1223 # ===================================================================
1224 # Compile-time features control
1225 # ===================================================================
1227 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1228 [ --disable-cookies disable cookie support])
1230 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1231 [ --disable-formhist disable form history support])
1233 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1234 [ --disable-globhist disable global history support])
1237 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1238 [ --disable-mailcap disable mailcap support])
1240 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1241 [ --disable-mimetypes disable mimetypes files support])
1244 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1245 [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1247 [ --disable-ipv6 disable IPv6 support])
1249 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1250 [ --enable-bittorrent enable BitTorrent protocol support])
1252 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1253 [ --disable-data disable data protocol support])
1255 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1256 [ --disable-uri-rewrite disable URI rewrite support])
1258 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1259 [ --enable-cgi enable local CGI support])
1261 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1262 [ --enable-finger enable finger protocol support])
1264 # ===================================================================
1266 # ===================================================================
1269 if test "x${enable_fsp}" != xno; then
1270 AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1272 if test "$HAVE_FSPLIB" = yes; then
1273 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1274 if test "$HAVE_FSPLIB" = yes; then
1275 LIBS="$LIBS -lfsplib"
1277 AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1278 if test "$HAVE_FSPLIB" = yes; then
1285 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1286 [ --enable-fsp enable FSP protocol support])
1288 if test "x$CONFIG_FSP" = xno; then
1292 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1293 [ --disable-ftp disable ftp protocol support])
1295 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1296 [ --enable-gopher enable gopher protocol support])
1298 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1299 [ --enable-nntp enable nntp protocol support])
1301 # ===================================================================
1302 # SMB protocol support.
1303 # ===================================================================
1306 if test "x${enable_smb}" != xno; then
1307 AC_CHECK_HEADERS(libsmbclient.h, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1309 if test "$HAVE_SMBCLIENT" = yes; then
1310 AC_CHECK_LIB(smbclient, smbc_init, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1311 if test "$HAVE_SMBCLIENT" = yes; then
1312 LIBS="$LIBS -lsmbclient"
1317 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [Samba protocol],
1318 [ --enable-smb enable Samba protocol support])
1320 if test "x$CONFIG_SMB" = xno; then
1325 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1326 [ --disable-mouse disable mouse support])
1328 # GPM mouse is Linux specific, so ...
1330 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1331 [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1333 [ --disable-sysmouse disable BSD sysmouse support])
1335 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1336 [ --enable-88-colors enable 88 color support])
1338 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1339 [ --enable-256-colors enable 256 color support])
1341 EL_ARG_ENABLE(CONFIG_TRUE_COLOR, true-color, [true color],
1342 [ --enable-true-color enable true color support])
1344 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1345 [ --enable-exmode enable exmode (CLI) interface])
1347 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1348 [ --disable-leds disable LEDs support])
1350 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1351 [ --disable-marks disable document marks support])
1354 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1355 [ --disable-css disable Cascading Style Sheet support])
1357 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1358 [ --enable-html-highlight HTML highlighting using DOM engine])
1360 # Everything in the tree already uses CONFIG_DOM
1361 # so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1362 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1364 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1365 [ --disable-backtrace disable backtrace support])
1367 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1368 [ --enable-no-root enable prevention of usage by root])
1371 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1372 [ --enable-debug enable leak debug and internal error checking])
1374 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1375 [ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
1377 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1378 [ --enable-own-libc force use of internal functions instead of those of system libc])
1380 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1381 [ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1383 EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
1384 [ --disable-utf-8 disable UTF-8 support])
1387 AC_ARG_ENABLE(weehoofooboomookerchoo,
1389 Also check out the features.conf file for more information about features!
1391 [AC_MSG_ERROR(Are you strange, or what?)])
1394 # ===================================================================
1395 # Decide whether to use TRE
1396 # ===================================================================
1398 # This must be done after the CONFIG_UTF8 check above.
1399 # The first part of the TRE check is separate, to get
1400 # the configure --help output in a sensible order.
1402 # After this section, nothing else must be added to the
1403 # beginning of $LIBS.
1405 if test "$tre_log" = "available"; then
1406 if test "$CONFIG_UTF8" = "yes"; then
1407 # When CONFIG_UTF8 and CONFIG_TRE are both defined,
1408 # src/viewer/text/search.c makes a string of
1409 # unicode_val_T and gives it to regwexec(), which
1410 # expects a string of wchar_t. If the unicode_val_T
1411 # and wchar_t types are too different, this won't
1412 # work, so try to detect that and disable regexp
1413 # operations entirely in that case.
1415 # Currently, this code only compares the sizes of the
1416 # types. src/intl/charsets.h defines unicode_val_T as
1417 # uint32_t, so we check whether wchar_t has exactly 32
1418 # bits. But don't use AC_CHECK_SIZEOF for this, because
1419 # there doesn't seem to be a documented way to get the
1420 # result of that for use in the configure script.
1422 # C99 says the implementation can define
1423 # __STDC_ISO_10646__ if wchar_t values match ISO 10646
1424 # (or Unicode) numbers in all locales. Do not check
1425 # that macro here, because it is too restrictive: it
1426 # should be enough for ELinks if the values match in
1427 # the locales where ELinks is actually run.
1428 AC_MSG_CHECKING([[whether wchar_t is exactly 32-bit]])
1429 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1432 int dummy[(sizeof(wchar_t) * CHAR_BIT == 32) ? 1 : -1];]], [])],
1433 [AC_MSG_RESULT([[yes]])
1435 [AC_MSG_RESULT([[no]])
1436 tre_log="no (unsuitable wchar_t)"])
1438 # If UTF-8 is not used, then wchar_t doesn't matter.
1443 if test "$tre_log" = "TRE"; then
1444 AC_DEFINE([CONFIG_TRE], [1],
1445 [Define as 1 to use the TRE library for regular expression searching. This requires the <tre/regex.h> header file. If you define CONFIG_UTF8 too, then wchar_t must be exactly 32-bit so that it matches unicode_val_T.])
1446 # TRE_CFLAGS will be used only where needed.
1448 # Bug 1081: If both TRE and libc define the regfree function,
1449 # ELinks needs to use the version defined by TRE because
1450 # that's the one compatible with regex_t initialized by the
1451 # regwcomp function of TRE. Therefore put $TRE_LIBS at the
1452 # very beginning of $LIBS so that the linker hopefully finds
1453 # regfree there before it examines libc. In particular,
1454 # $PERL_LIBS appears to often include "-lc".
1456 # This scheme still risks a crash if ELinks is linked with
1457 # some static library that uses GNU <regex.h> extensions that
1458 # TRE does not implement. For example, the library might call
1459 # re_compile_pattern, which is found in GNU libc, and then
1460 # regfree, which is found in TRE and probably crashes with the
1461 # GNU-initialized regex_t. Ways to avoid such crashes:
1463 # - Change TRE so it defines only tre_... functions and does
1464 # not attempt to override the POSIX names by default.
1466 # - Change ELinks to access TRE only via dlopen and dlsym.
1467 # The problem then is how to find the correct file name.
1468 # There might be libtre.so.4 and libtre.so.5 with different
1469 # ABI. How can this configure script detect which of them
1470 # matches the <tre/regex.h> in the include path?
1472 # - Replace the static library with a shared library. At
1473 # least on GNU/Linux, when the shared library is built, the
1474 # linker should note that e.g. regfree is defined in libc
1475 # and has the GLIBC_2.0 version there, and write that
1476 # version string to the shared library as well; because TRE
1477 # does not provide regfree with that version, any regfree
1478 # calls at run time should then get resolved to libc.
1479 LIBS="$TRE_LIBS $LIBS"
1484 AC_SUBST(TRE_CFLAGS)
1486 EL_LOG_CONFIG([CONFIG_TRE], [[Regexp searching]], [[$tre_log]])
1489 # ===================================================================
1490 # Further LDFLAGS tweaks
1491 # ===================================================================
1495 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1496 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1499 # Check for -rdynamic
1501 # gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
1502 # the executable to its dynamic symbol table. ELinks uses this for
1505 # 1. If ELinks detects a bug, it can try to display a backtrace by
1506 # calling backtrace_symbols_fd() in the GNU libc. The glibc-2.3.6
1507 # manual states users of GNU ld must pass -rdynamic to make the
1508 # symbols available to the program.
1510 # 2. It would eventually be nice to dynamically load shared
1511 # libraries as plugins (bug 73). The plugins must be able to
1512 # call ELinks functions. This can be implemented either by
1513 # registering all callable functions in ELinks-specific data
1514 # structures, or by letting the dynamic linker handle them.
1515 # The latter way requires something equivalent to -rdynamic.
1517 # Because backtraces are not needed for correct operation, and bug
1518 # 73 is not yet being fixed, the configure script and makefiles
1519 # should not complain to the user if they find that -rdynamic does
1520 # not work. Besides, it was reported at elinks-users on 2006-09-12
1521 # that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
1522 # Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
1523 # -rdynamic but does something equivalent automatically. (This was
1524 # tested with "nm -D elinks | grep redraw_from_window".)
1526 # With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
1527 # -dynamic"; then, cc proceeds anyway, but the option can prevent the
1528 # linker from finding the libraries listed in -l operands. So this
1529 # -rdynamic check needs to happen after the libraries have already
1530 # been added to $LDFLAGS.
1531 AC_MSG_CHECKING([for -rdynamic])
1532 LDFLAGS_X="$LDFLAGS"
1533 LDFLAGS="-rdynamic $LDFLAGS"
1534 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
1535 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
1536 AC_MSG_RESULT($have_rdynamic)
1538 # ===================================================================
1539 # Export directory paths
1540 # ===================================================================
1542 # Set up the ``entry points'' if they were not supplied by builder
1543 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1544 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1546 # Create CONFDIR #define for config.h
1548 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1549 # it's autoconf fault to force us to do such hacks ;p.
1550 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1551 # sysconfdir is set to its default value... fine, let's append /elinks/
1552 # XXX: We can't modify listing of the default in ./configure --help :-(
1553 sysconfdir_n=`eval echo "$sysconfdir"`
1554 sysconfdir=$sysconfdir_n
1555 (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1556 sysconfdir="$sysconfdir/elinks"
1560 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1563 # Create LOCALEDIR #define for config.h
1564 LOCALEDIR=`eval echo "$datadir/locale"`
1565 while echo "$LOCALEDIR" | grep "\\$"
1567 LOCALEDIR=`eval echo "$LOCALEDIR"`
1568 done > /dev/null 2> /dev/null
1569 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1572 # Create LIBDIR #define for config.h
1573 LIBDIR=`eval echo "$libdir"`
1574 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1577 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1578 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1581 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
1582 ]], [[#if !defined(__TINYC__) || !defined(alloca)
1584 #endif ]])],[cf_result=yes],[cf_result=no])
1586 if test "$cf_result" = "yes"; then
1587 AC_DEFINE([HAVE_ALLOCA])
1588 AC_DEFINE([_ALLOCA_H], [1], [Define as 1 if you are using Tiny C Compiler
1589 with the GNU C Library, and <alloca.h> of glibc would otherwise
1590 override the alloca macro defined in <stddef.h> of TCC.
1591 If <alloca.h> of glibc sees the _ALLOCA_H macro, it assumes
1592 it has already been included, and does not redefine alloca.
1593 This might not work in future glibc versions though, because
1594 the names of the #include guard macros are not documented.
1595 The incompatibility has been reported to the tinycc-devel
1596 mailing list on 2008-07-14. If a future version of TCC provides
1597 an <alloca.h> of its own, this hack won't be needed.])
1599 # ===================================================================
1600 # A little fine tuning of gcc specific options (continued)
1601 # ===================================================================
1603 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
1604 if test "$CONFIG_DEBUG" = "yes"; then
1605 # We want to see all warnings and live with none (in debug mode).
1606 CFLAGS="$CFLAGS -Werror"
1609 case "`$CC -dumpversion`" in
1611 # These should be ok using -Werror
1614 # If gcc is version 3.3 (or higher?) it emits lots of false positive
1615 # "dereferencing type-punned pointer will break strict-aliasing rules"
1616 # warnings. Disable them by not doing any strict-aliasing. The
1617 # alternative is just too ugly. Thanks gcc guys!! ;)
1618 CFLAGS="$CFLAGS -fno-strict-aliasing"
1621 # Do not show warnings related to (char * | unsigned char *) type
1623 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1626 # These should be ok using -Werror
1630 # GCC 4.2.1 warns if we use the address of an object in Boolean context:
1631 # warning: the address of `builtin_modules' will always evaluate as `true'
1632 # This hits the object_lock and foreach_module macros in particular.
1633 # It would be okay to put something in the macros to avoid the warning,
1634 # but currently this seems to require defining parallel macros that skip
1635 # the NULL check, and that's too ugly. So we instead disable the warning.
1636 # GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
1637 # GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
1638 for warning_flag in -Wno-address -Wno-always-true; do
1639 AC_MSG_CHECKING([whether $CC accepts $warning_flag])
1641 CFLAGS="$CFLAGS $warning_flag"
1642 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1643 [AC_MSG_RESULT([yes])
1645 [AC_MSG_RESULT([no])])
1649 # Bug 1012: Some parts of ELinks do arithmetic with signed integers
1650 # in such a way that an overflow is possible. GCC 4.2.1 warns
1651 # "warning: assuming signed overflow does not occur when assuming
1652 # that (X + c) > X is always true", which may be an incorrect
1653 # optimization (although allowed by the standard), and breaks the
1654 # build with -Werror.
1656 # All of the following tests included -S -Wall -Wextra:
1658 # GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
1659 # * gcc-4.0 -O0: OK, compares the values
1660 # * gcc-4.0 -O2: assumes no overflow, does not warn
1661 # * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
1662 # * gcc-4.0 -O0 -fwrapv: OK, compares the values
1663 # * gcc-4.0 -O2 -fwrapv: OK, compares the values
1664 # * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
1665 # * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
1666 # * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1667 # * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
1669 # GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
1670 # * gcc-4.1 -O0: assumes no overflow, does not warn
1671 # * gcc-4.1 -O2: assumes no overflow, does not warn
1672 # * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
1673 # * gcc-4.1 -O0 -fwrapv: OK, compares the values
1674 # * gcc-4.1 -O2 -fwrapv: OK, compares the values
1675 # * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
1676 # * gcc-4.1 -O2 -ftrapv: compares the values
1677 # * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1678 # * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
1680 # GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
1681 # * gcc-4.2 -O0: OK, compares the values
1682 # * gcc-4.2 -O2: assumes no overflow, warns about it
1683 # * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
1684 # * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
1685 # * gcc-4.2 -O0 -fwrapv: OK, compares the values
1686 # * gcc-4.2 -O2 -fwrapv: OK, compares the values
1687 # * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
1688 # * gcc-4.2 -O2 -ftrapv: compares the values
1689 # * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1690 # * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
1692 # Apparently, -ftrapv does not work reliably at all.
1693 for overflow_flag in -fno-strict-overflow -fwrapv; do
1694 AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
1696 CFLAGS="$CFLAGS $overflow_flag"
1697 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1698 [AC_MSG_RESULT([yes])
1700 [AC_MSG_RESULT([no])])
1705 EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
1706 EL_LOG_CONFIG(CPPFLAGS, [Preprocessor flags (CPPFLAGS)], [])
1707 EL_LOG_CONFIG(LDFLAGS, [Linker flags (LDFLAGS)], [])
1708 EL_LOG_CONFIG(LIBS, [Library flags (LIBS)], [])
1710 # ===================================================================
1711 # Colored make output
1712 # ===================================================================
1714 if test $(`which tput` colors) -ge 4; then
1716 AC_SUBST(MAKE_COLOR)
1719 # ===================================================================
1721 # ===================================================================
1725 contrib/elinks.spec \
1726 contrib/lua/hooks.lua \
1727 contrib/conv/w3m2links.awk \
1729 doc/man/man1/elinks.1 \
1730 src/intl/gettext/ref-add.sed \
1731 src/intl/gettext/ref-del.sed
1735 abs_srcdir="$(cd "$srcdir" && pwd)"
1736 # builddir is always absolute!
1737 if test "$abs_srcdir" != "$builddir"; then
1738 # Bootstrap the Makefile creation
1739 echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1740 "$MAKE" "SRC=$abs_srcdir" init
1742 # Make cg-status ignore this build directory
1743 echo "*" > "$builddir/.gitignore"
1746 # ===================================================================
1747 # Configuration summary
1748 # ===================================================================
1750 AC_MSG_RESULT(The following feature summary has been saved to features.log)