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.
13 AC_CONFIG_SRCDIR([src/main/main.c])
14 AC_CONFIG_AUX_DIR(config)
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])
30 for make in gnumake gmake make false; do
31 if test "x$MAKE" = x; then
32 AC_PATH_PROGS(MAKE, "$make")
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
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 # ===================================================================
60 AC_PATH_PROGS(AWK, "$AWK")
64 AC_PATH_PROGS(GIT, "git")
65 AC_PATH_PROGS(SPARSE, "sparse")
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
83 rm config.asciidoc-unsafe.*
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)])
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])
99 AC_PATH_PROGS(POD2HTML, "pod2html")
100 if test "x$POD2HTML" != "x"; then
101 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
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"
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)
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])
142 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef $flag
144 #endif ]])],[$1=yes],[$1=no])
145 if test "[$]$1" = yes; then
146 EL_CONFIG([$1], [$2])
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])
177 AC_MSG_RESULT($CONFIG_OS_UNIX)
178 AC_SUBST(CONFIG_OS_UNIX)
180 # ===================================================================
181 # Checks for header files.
182 # ===================================================================
189 AC_CHECK_HEADERS(wctype.h)
190 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
191 AC_CHECK_HEADERS(sigaction.h)
192 AC_CHECK_HEADERS(arpa/inet.h)
193 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
194 AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/in6_var.h)
195 AC_CHECK_HEADERS(ifaddrs.h)
196 AC_CHECK_HEADERS(sys/cygwin.h io.h)
197 AC_CHECK_HEADERS(sys/fmutex.h)
198 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
199 AC_CHECK_HEADERS(sys/resource.h)
200 AC_CHECK_HEADERS(sys/select.h)
201 AC_CHECK_HEADERS(sys/signal.h)
202 AC_CHECK_HEADERS(sys/socket.h)
203 AC_CHECK_HEADERS(sys/time.h)
204 AC_CHECK_HEADERS(sys/utsname.h)
205 AC_CHECK_HEADERS([net/if.h], [], [],
206 [[#ifdef HAVE_SYS_SOCKET_H
207 # include <sys/socket.h> /* <net/if.h> on Mac OS X 10.5.4 needs this */
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 # ===================================================================
228 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
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,
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
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(getuid, HAVE_GETUID=yes)
274 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
276 # These aren't probably needed now, as they are commented in links.h.
277 # I've no idea about their historical background, but I keep them here
278 # just in the case they will help later. --pasky
279 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
280 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
281 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
282 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
284 if test x"$HAVE_RAISE" = x; then
285 if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
286 AC_MSG_ERROR([Unable to emulate raise()])
290 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
291 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
292 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],[el_cv_HAVE_VA_COPY=yes],[el_cv_HAVE_VA_COPY=no])])
293 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
294 EL_DEFINE(HAVE_VA_COPY, __va_copy)
297 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
298 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
299 ]], [[int page_size = sysconf(_SC_PAGE_SIZE);]])],[el_cv_HAVE_SC_PAGE_SIZE=yes],[el_cv_HAVE_SC_PAGE_SIZE=no])])
300 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
301 EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
304 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
305 AC_RUN_IFELSE([AC_LANG_SOURCE([[
313 int bar(char *buf, const char *format, va_list ap)
315 return vsnprintf(buf, 0, format, ap);
318 void foo(const char *format, ...) {
322 va_start(ap, format);
323 len = bar(buf, format, ap);
325 if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
327 va_start(ap, format);
328 len = bar(buf, format, ap);
330 if ((len != 6) && (len != 7)) exit(1);
332 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
336 main() { foo("hello\n"); }
337 ]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
338 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
339 EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
342 # OpenSSL and Lua frequently need dlopen
343 AC_CHECK_LIB(dl, dlopen)
345 # ===================================================================
346 # Checks for libraries.
347 # ===================================================================
349 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
350 if test "$cf_result" = no; then
351 AC_CHECK_LIB(socket, socket)
354 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
355 if test "$cf_result" = no; then
356 AC_CHECK_LIB(socket, setsockopt)
359 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
360 if test "$cf_result" = no; then
361 AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
362 if test "$cf_result" = no; then
363 AC_CHECK_LIB(nsl, gethostbyname)
365 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
369 # ===================================================================
370 # Checks for packaging specific options.
371 # ===================================================================
373 AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
374 [ if test "$withval" != no && test "$withval" != yes; then
375 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
378 # ===================================================================
379 # Checks for a libraries, optional even if installed.
380 # ===================================================================
382 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
383 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
385 AC_MSG_CHECKING([for $2 support])
387 if test "[$]$1" != no; then
390 if test -n "$withval" && test -d "$withval"; then
391 # Be a little more careful when setting
392 # include and lib directories. This way
393 # $withval will work when includes are
394 # there but the library is in the common
395 # /usr/lib ... Does the right thing when
396 # looking for gc on Debian.
397 if test -d "$withval/include"; then
398 CFLAGS="$CFLAGS -I$withval/include"
399 CPPFLAGS="$CPPFLAGS -I$withval/include"
401 CFLAGS="$CFLAGS -I$withval"
402 CPPFLAGS="$CPPFLAGS -I$withval"
404 if test -d "$withval/lib"; then
405 LDFLAGS="$LDFLAGS -L$withval/lib"
409 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
410 if test "[$]$1" = yes; then
411 AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
414 if test "[$]$1" = yes; then
415 EL_CONFIG([$1], [$2])
418 if test -n "[$]WITHVAL_$1" &&
419 test "[$]WITHVAL_$1" != xno; then
420 AC_MSG_ERROR([$2 not found])
425 AC_MSG_RESULT(disabled)
429 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
430 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
435 AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
436 if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
438 EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
440 EL_LOG_CONFIG([$1], [$2], [])
443 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
444 [ --without-gpm disable gpm (mouse) support])
446 # ELinks calls deflateInit2 with windowBits = MAX_WBITS | 32, to
447 # enable automatic decoding of both zlib and gzip headers. This
448 # feature was added in zlib 1.2.0.2; earlier versions return an error.
449 # The gzclearerr function was also added in zlib 1.2.0.2, so check for
450 # that, even though ELinks does not actually call gzclearerr.
451 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
452 [ --without-zlib disable zlib support])
454 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
455 [ --without-bzlib disable bzlib support])
457 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
458 [ --without-idn disable international domain names support])
460 if test "x{with_gc}" != xno; then
461 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
462 [ --with-gc enable Boehm's garbage collector])
465 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
466 [ --without-lzma disable lzma encoding support])
468 # ===================================================================
469 # Check for GSSAPI, optional even if installed.
470 # ===================================================================
474 AC_ARG_WITH(gssapi, [ --with-gssapi enable GSSAPI support],
475 [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
477 AC_MSG_CHECKING([for GSSAPI])
479 if test "$enable_gssapi" = "yes"; then
481 GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
482 GSSAPI_LIBS=`krb5-config --libs gssapi`
483 CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
484 LIBS="$GSSAPI_LIBS $LIBS"
485 EL_CONFIG(CONFIG_GSSAPI, [GssApi])
490 AC_SUBST(CONFIG_GSSAPI)
492 # ===================================================================
493 # Bookmark and XBEL support
494 # ===================================================================
498 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
499 [ --disable-bookmarks disable bookmark support])
501 # Check whether --enable-xbel or --disable-xbel was given.
502 if test "x${enable_xbel}" != xno; then
503 AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
505 if test "$HAVE_LIBEXPAT" = yes; then
506 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
507 if test "$HAVE_LIBEXPAT" = yes; then
514 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
516 [ --disable-xbel disable XBEL bookmark support (requires expat)])
518 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
522 # ===================================================================
523 # Checks for BSD sysmouse
524 # ===================================================================
526 HAVE_SYSMOUSE_HEADER="no"
528 # Either of these header files provides the (same) sysmouse interface
529 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
531 # ===================================================================
533 # ===================================================================
535 if test "$CONFIG_OS_OS2" = yes; then
539 # ===================================================================
541 # ===================================================================
543 if test "$CONFIG_OS_WIN32" = yes; then
547 # ===================================================================
548 # Check for SEE (Simple Ecmascript Engine)
549 # ===================================================================
550 AC_ARG_WITH(see, [ --with-see enable Simple Ecmascript Engine (SEE) support],
551 [ if test "x$withval" != xno; then enable_see=yes; fi ])
553 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
554 # SEE_FLAGS but I really don't want to require people to have Guile in order
555 # to compile CVS. Also, the macro seems to be really stupid regarding searching
556 # for Guile in $PATH etc. --pasky
558 CONFIG_ECMASCRIPT_SEE=no
560 if test "$enable_see" = "yes"; then
561 if test -d "$withval"; then
562 SEE_PATH="$withval:$PATH"
567 AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
568 AC_MSG_CHECKING([for SEE (2.0.1131 or later)])
569 if test "$SEE_CONFIG" != no; then
571 SEE_LIBS="`$SEE_CONFIG --libs`"
572 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
573 CPPFLAGS="$SEE_CFLAGS $CPPFLAGS"
574 LIBS="$SEE_LIBS $LIBS_X"
575 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <see/see.h>]], [[#if SEE_VERSION_API_MAJOR < 2
578 ]])],[cf_result=yes],[cf_result=no])
580 if test "$cf_result" = yes; then
581 LIBS="$SEE_LIBS $LIBS"
582 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
585 AC_MSG_RESULT($cf_result)
587 if test -n "$withval" && test "x$withval" != xno; then
588 AC_MSG_ERROR([SEE not found])
590 AC_MSG_WARN([SEE support disabled])
595 # ===================================================================
596 # Check for SpiderMonkey, optional even if installed.
597 # ===================================================================
599 AC_ARG_WITH(spidermonkey, [ --without-spidermonkey disable SpiderMonkey Mozilla JavaScript engine support],
600 [if test "$withval" = no; then disable_spidermonkey=yes; fi])
601 AC_MSG_CHECKING([for SpiderMonkey (1.5 RC3a or later)])
606 if test -z "$disable_spidermonkey"; then
607 if test ! -d "$withval"; then
610 for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
611 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
612 for spidermonkeylib in js smjs mozjs; do
613 if test "$cf_result" = no &&
614 test -f "$spidermonkeydir$spidermonkeyinclude/jsapi.h"; then
615 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib -l$spidermonkeylib"
616 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
618 LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
619 CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
620 CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
622 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
623 #include <jsapi.h>]], [[JS_GetReservedSlot(NULL, NULL, 0, NULL)]])],[cf_result=yes],[cf_result=no])
630 AC_MSG_RESULT($cf_result)
631 CONFIG_SPIDERMONKEY="$cf_result"
632 if test "$cf_result" = "yes"; then
633 AC_CHECK_FUNCS([[JS_ReportAllocationOverflow]])
637 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
638 test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
639 EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
641 CONFIG_ECMASCRIPT_SMJS=no
644 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
645 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
646 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
649 # ===================================================================
650 # Optional Spidermonkey-based ECMAScript browser scripting
651 # ===================================================================
653 AC_ARG_ENABLE(sm-scripting,
654 [ --disable-sm-scripting ECMAScript browser scripting (requires Spidermonkey)],
655 [if test "$enableval" != no; then enableval="yes"; fi
656 CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
658 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
659 test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
660 EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
662 CONFIG_SCRIPTING_SPIDERMONKEY=no
665 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
666 test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
667 LIBS="$LIBS $SPIDERMONKEY_LIBS"
668 AC_SUBST(SPIDERMONKEY_LIBS)
669 AC_SUBST(SPIDERMONKEY_CFLAGS)
670 AC_SUBST(CONFIG_SPIDERMONKEY)
673 # ===================================================================
674 # Check for Guile, optional even if installed.
675 # ===================================================================
679 AC_ARG_WITH(guile, [ --with-guile enable Guile support],
680 [ if test "x$withval" != xno; then enable_guile=yes; fi ])
682 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
683 # GUILE_FLAGS but I really don't want to require people to have Guile in order
684 # to compile CVS. Also, the macro seems to be really stupid regarding searching
685 # for Guile in $PATH etc. --pasky
687 AC_MSG_CHECKING([for Guile])
689 if test "$enable_guile" = "yes"; then
691 ## Based on the GUILE_FLAGS macro.
693 if test -d "$withval"; then
694 GUILE_PATH="$withval:$PATH"
699 AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
701 ## First, let's just see if we can find Guile at all.
702 if test "$GUILE_CONFIG" != no; then
705 GUILE_LIBS="`guile-config link`"
706 GUILE_CFLAGS="`guile-config compile`"
707 LIBS="$GUILE_LIBS $LIBS"
708 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
709 AC_SUBST(GUILE_CFLAGS)
711 ***********************************************************************
712 The Guile support is incomplete and not so well integrated to ELinks
713 yet. That means, e.g., that you have no Guile console and there might
714 not be all the necessary hooks. Also, the Guile interface is not too
715 well tested (success stories heartily welcomed!). See
716 src/scripting/guile/README for further details and hints.
717 ***********************************************************************
720 if test -n "$withval" && test "x$withval" != xno; then
721 AC_MSG_ERROR([Guile not found])
723 AC_MSG_WARN([Guile support disabled])
730 # ===================================================================
732 # ===================================================================
735 AC_ARG_WITH(perl, [ --with-perl enable Perl support],
737 if test "$withval" = yes; then
738 # FIXME: If withval is a valid directory append it to PATH
739 # so that you can specify one of several perl installations.
745 AC_MSG_CHECKING([for Perl])
751 if test "$enable_perl" = "yes"; then
752 PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
753 PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
754 LIBS="$PERL_LIBS $LIBS"
755 CFLAGS="$PERL_CFLAGS $CFLAGS"
756 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
757 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
761 ]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
764 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
766 AC_MSG_CHECKING([whether POPpx works without an n_a variable])
767 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
770 extern PerlInterpreter *my_perl;
771 ]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
772 AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
773 [Define if using Perl 5.8.8 or later, where the "POPpx" macro
774 no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
776 if test "$cf_result" != "yes"; then
779 EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
782 CPPFLAGS="$CPPFLAGS_X"
784 AC_SUBST(PERL_CFLAGS)
787 # ===================================================================
789 # ===================================================================
792 AC_ARG_WITH(python, [[ --with-python[=DIR] enable Python support]],
793 [ if test "x$withval" != xno; then enable_python=yes; fi ])
798 AC_MSG_CHECKING([for Python])
800 if test "$enable_python" = "yes"; then
803 if test -d "$withval"; then
804 PYTHON_PATH="$withval:$PATH"
809 AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
811 if test "$PYTHON" != no; then
814 PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; print "-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True))'`"
815 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"))'`"
816 LIBS="$PYTHON_LIBS $LIBS"
817 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
818 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
820 if test "$cf_result" != "yes"; then
823 EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
824 AC_SUBST(PYTHON_LIBS)
825 AC_SUBST(PYTHON_CFLAGS)
826 CPPFLAGS="$CPPFLAGS_X"
828 ***********************************************************************
829 The Python support is incomplete and not so well integrated to ELinks
830 yet. That means, e.g., that you have no Python console and there might
831 not be all the necessary hooks. Also, the Python interface is not too
832 well tested (success stories heartily welcomed!).
833 ***********************************************************************
837 if test -n "$withval" && test "x$withval" != xno; then
838 AC_MSG_ERROR([Python not found])
840 AC_MSG_WARN([Python support disabled])
848 # ===================================================================
849 # Check for Lua, optional even if installed.
850 # ===================================================================
852 # Do this the long way, as FreeBSD reportedly needs -L<dir> for
853 # anything other than /usr/lib, and Lua is very often in /usr/local/lib.
855 AC_ARG_WITH(lua, [ --without-lua disable Lua support],
856 [if test "$withval" = no; then disable_lua=yes; fi])
857 AC_MSG_CHECKING([for Lua])
862 if test -z "$disable_lua"; then
863 if test ! -d "$withval"; then
866 for luadir in "$withval" "" /usr /usr/local; do
867 for suffix in "" 50; do
868 if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
869 test -f "$luadir/include/lua$suffix/lua.h" ) ; then
870 LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm"
871 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
873 LIBS="$LUA_LIBS $LIBS_X"
874 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
875 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
877 # Check that it is a compatible Lua version
878 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lua.h>
879 #include <lualib.h>]], [[ lua_State *L = lua_open();
885 lua_pushboolean(L, 1);
886 lua_close(L);]])],[cf_result=yes],[cf_result=no])
892 AC_MSG_RESULT($cf_result)
894 if test "$cf_result" != yes; then
897 EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
898 AC_CHECK_HEADERS(lauxlib.h)
901 CPPFLAGS="$CPPFLAGS_X"
906 # ===================================================================
907 # Check for TRE library
908 # ===================================================================
910 AC_MSG_CHECKING([[for TRE in pkg-config]])
911 if pkg-config tre; then
912 TRE_CFLAGS=`pkg-config --cflags tre`
913 TRE_LIBS=`pkg-config --libs tre`
914 AC_MSG_RESULT([[yes]])
916 # <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513055>
917 # "libtre-dev: /usr/lib/pkgconfig/tre.pc missing"
918 # so we look for the library even if pkg-config doesn't know about it.
921 AC_MSG_RESULT([[no, but let's try defaults]])
924 AC_MSG_CHECKING([[for TRE header and library]])
926 CFLAGS="$TRE_CFLAGS $CFLAGS"
927 LIBS="$TRE_LIBS $LIBS"
928 AC_TRY_LINK([#include <tre/regex.h>],
931 regwcomp(&re, L"zap", REG_ICASE);
932 regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
933 [AC_MSG_RESULT([[yes]])
934 AC_DEFINE([HAVE_TRE_REGEX_H], [1],
935 [Define to 1 if you have the <tre/regex.h> header file.])
936 # TRE_CFLAGS will be used only where needed.
937 # TRE_LIBS will be kept in LIBS and used everywhere.
939 LIBS="$TRE_LIBS $LIBS"],
940 [AC_MSG_RESULT([[no]])
947 AC_CHECK_SIZEOF([wchar_t], [4], [[#include <wchar.h>]])
949 # ===================================================================
950 # Check for Ruby, optional even if installed.
951 # ===================================================================
953 EL_CONFIG_SCRIPTING_RUBY
955 # ===================================================================
956 # Setup global scripting
957 # ===================================================================
959 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])
960 AC_SUBST(CONFIG_SCRIPTING_GUILE)
961 AC_SUBST(CONFIG_SCRIPTING_LUA)
962 AC_SUBST(CONFIG_SCRIPTING_PERL)
963 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
964 AC_SUBST(CONFIG_SCRIPTING_RUBY)
965 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
966 AC_SUBST(CONFIG_SCRIPTING)
969 # ===================================================================
970 # Check for SSL support.
971 # ===================================================================
973 # We by default use OpenSSL, and we always prefer it. However, when GNUTLS
974 # is enabled, we won't try to use OpenSSL anymore.
976 # For wiping SSL hooks..
983 AC_ARG_WITH(gnutls, [ --without-gnutls disable GNUTLS SSL support],
984 [if test "$with_gnutls" = no; then disable_gnutls=yes; fi])
985 AC_ARG_WITH(gnutls, [[ --with-gnutls[=DIR] enable GNUTLS SSL support]],
986 [if test "$with_gnutls" != no; then enable_gnutls=yes; fi])
987 gnutls_withval="$withval"
989 if test "$enable_gnutls" = yes; then
993 AC_ARG_WITH(openssl, [ --without-openssl disable OpenSSL support],
994 [if test "$with_openssl" = no; then disable_openssl=yes; fi])
995 AC_ARG_WITH(openssl, [[ --with-openssl[=DIR] enable OpenSSL support (default)]])
996 openssl_withval="$withval"
1000 AC_MSG_CHECKING([for OpenSSL])
1005 if test "$disable_openssl" = yes; then
1006 cf_result="not used"
1008 for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
1009 /usr/lib/openssl /usr/local/ssl \
1010 /usr/local/www /usr/lib/ssl /usr/local \
1011 /usr/pkg /opt /opt/openssl; do
1012 if test "$cf_result" = no; then
1013 if test -d "$ssldir"; then
1014 OPENSSL_CFLAGS="-I$ssldir/include"
1015 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
1016 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
1017 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
1018 # # FIXME: This created serious portability problems. --pasky
1019 # if test "$CC" == "gcc"; then
1020 # # I'm not sure about compatibility here. --pasky
1021 # LIBS="$LIBS -R$ssldir/lib"
1024 LIBS="-lssl -lcrypto $LIBS_X"
1026 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[OpenSSL_add_all_algorithms()]])],[cf_result=yes],[cf_result=no])
1027 if test "$cf_result" != yes; then
1028 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[SSLeay_add_ssl_algorithms()]])],[cf_result=yes],[cf_result=no])
1033 if test "$cf_result" != yes; then
1034 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
1035 AC_MSG_ERROR([OpenSSL not found])
1039 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
1042 AC_SUBST(OPENSSL_CFLAGS)
1046 AC_MSG_RESULT($cf_result)
1048 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1050 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
1051 dnl it looks ugly then.
1053 if test "$cf_result" = yes; then
1054 cf_result="not used"
1060 if test -z "$disable_gnutls"; then
1061 # Sure, we maybe _could_ use their macro, but how to ensure
1062 # that the ./configure script won't fail if the macro won't be
1063 # found..? :( --pasky
1065 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
1067 if test -d "$gnutls_withval"; then
1068 GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
1071 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1073 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1076 GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1077 GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1079 LIBS="$GNUTLS_LIBS $LIBS_X"
1080 CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1081 CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1083 # Verify if it's really usable. gnutls_session was
1084 # renamed to gnutls_session_t before GNU TLS 1.2.0
1085 # (on 2004-06-13); ELinks now requires this.
1086 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]], [[gnutls_session_t dummy;
1087 gnutls_check_version(NULL)]])],[cf_result=yes],[cf_result=no])
1090 if test "$cf_result" = yes; then
1091 EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1094 AC_SUBST(GNUTLS_CFLAGS)
1096 # GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
1097 # to GPLv3+. Don't link that with the GPLv2 ELinks.
1098 # ELinks will use its internal MD5 code instead.
1099 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1101 if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1102 AC_MSG_ERROR([GNUTLS (1.2 or later) not found. ELinks no longer supports GNUTLS 1.1.])
1109 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1110 AC_MSG_RESULT($cf_result)
1114 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1115 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1116 AC_SUBST(CONFIG_OPENSSL)
1117 AC_SUBST(CONFIG_GNUTLS)
1121 AC_MSG_CHECKING([whether to be or not to be])
1122 AC_MSG_RESULT([needs to be determined experimentally])
1124 # ===================================================================
1125 # Check for IPv6 support and related functions.
1126 # ===================================================================
1128 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1129 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1130 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1132 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1133 if test "$HAVE_GETADDRINFO" != yes; then
1134 AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1135 if test "$HAVE_GETADDRINFO" = yes; then
1136 LIBS="$LIBS -linet6"
1141 # ===================================================================
1142 # Checking for X11 (window title restoring).
1143 # ===================================================================
1146 if test x"$no_x" != xyes; then
1148 if test -n "$x_includes"; then
1149 X_CFLAGS="-I$x_includes"
1150 CPPFLAGS="$CPPLAGS $X_CFLAGS"
1151 CFLAGS="$CFLAGS $X_CFLAGS"
1153 if test -n "$x_libraries"; then
1154 LDFLAGS="$LDFLAGS -L$x_libraries"
1157 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize()]])],[cf_result=yes],[cf_result=no])
1159 if test "$cf_result" = yes; then
1160 if test -n "$x_libraries"; then
1161 LDFLAGS="$LDFLAGS -L$x_libraries"
1164 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1170 # ===================================================================
1171 # Backtraces displaying support.
1172 # ===================================================================
1174 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1175 # possible checks for other system-specific means go here
1178 # ===================================================================
1179 # Gettext grey zone. Beware.
1180 # ===================================================================
1182 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"
1186 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1187 dnl # f33r d4 l33t... I hope it's portable. :)
1188 dnl cf_result=$((48#z - 48#a + 1));
1189 dnl AC_MSG_RESULT($cf_result)
1192 # ===================================================================
1193 # Compile-time features control
1194 # ===================================================================
1196 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1197 [ --disable-cookies disable cookie support])
1199 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1200 [ --disable-formhist disable form history support])
1202 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1203 [ --disable-globhist disable global history support])
1206 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1207 [ --disable-mailcap disable mailcap support])
1209 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1210 [ --disable-mimetypes disable mimetypes files support])
1213 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1214 [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1216 [ --disable-ipv6 disable IPv6 support])
1218 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1219 [ --enable-bittorrent enable BitTorrent protocol support])
1221 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1222 [ --disable-data disable data protocol support])
1224 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1225 [ --disable-uri-rewrite disable URI rewrite support])
1227 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1228 [ --enable-cgi enable local CGI support])
1230 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1231 [ --enable-finger enable finger protocol support])
1233 # ===================================================================
1235 # ===================================================================
1238 if test "x${enable_fsp}" != xno; then
1239 AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1241 if test "$HAVE_FSPLIB" = yes; then
1242 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1243 if test "$HAVE_FSPLIB" = yes; then
1244 LIBS="$LIBS -lfsplib"
1246 AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1247 if test "$HAVE_FSPLIB" = yes; then
1254 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1255 [ --enable-fsp enable FSP protocol support])
1257 if test "x$CONFIG_FSP" = xno; then
1261 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1262 [ --disable-ftp disable ftp protocol support])
1264 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1265 [ --enable-gopher enable gopher protocol support])
1267 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1268 [ --enable-nntp enable nntp protocol support])
1270 # ===================================================================
1271 # SMB protocol support.
1272 # ===================================================================
1275 if test "x${enable_smb}" != xno; then
1276 AC_CHECK_HEADERS(libsmbclient.h, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1278 if test "$HAVE_SMBCLIENT" = yes; then
1279 AC_CHECK_LIB(smbclient, smbc_init, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1280 if test "$HAVE_SMBCLIENT" = yes; then
1281 LIBS="$LIBS -lsmbclient"
1286 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [Samba protocol],
1287 [ --enable-smb enable Samba protocol support])
1289 if test "x$CONFIG_SMB" = xno; then
1294 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1295 [ --disable-mouse disable mouse support])
1297 # GPM mouse is Linux specific, so ...
1299 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1300 [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1302 [ --disable-sysmouse disable BSD sysmouse support])
1304 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1305 [ --enable-88-colors enable 88 color support])
1307 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1308 [ --enable-256-colors enable 256 color support])
1310 EL_ARG_ENABLE(CONFIG_TRUE_COLOR, true-color, [true color],
1311 [ --enable-true-color enable true color support])
1313 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1314 [ --enable-exmode enable exmode (CLI) interface])
1316 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1317 [ --disable-leds disable LEDs support])
1319 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1320 [ --disable-marks disable document marks support])
1323 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1324 [ --disable-css disable Cascading Style Sheet support])
1326 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1327 [ --enable-html-highlight HTML highlighting using DOM engine])
1329 # Everything in the tree already uses CONFIG_DOM
1330 # so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1331 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1333 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1334 [ --disable-backtrace disable backtrace support])
1336 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1337 [ --enable-no-root enable prevention of usage by root])
1340 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1341 [ --enable-debug enable leak debug and internal error checking])
1343 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1344 [ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
1346 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1347 [ --enable-own-libc force use of internal functions instead of those of system libc])
1349 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1350 [ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1352 EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
1353 [ --disable-utf-8 disable UTF-8 support])
1356 AC_ARG_ENABLE(weehoofooboomookerchoo,
1358 Also check out the features.conf file for more information about features!
1360 [AC_MSG_ERROR(Are you strange, or what?)])
1363 # ===================================================================
1364 # Further LDFLAGS tweaks
1365 # ===================================================================
1369 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1370 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1373 # Check for -rdynamic
1375 # gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
1376 # the executable to its dynamic symbol table. ELinks uses this for
1379 # 1. If ELinks detects a bug, it can try to display a backtrace by
1380 # calling backtrace_symbols_fd() in the GNU libc. The glibc-2.3.6
1381 # manual states users of GNU ld must pass -rdynamic to make the
1382 # symbols available to the program.
1384 # 2. It would eventually be nice to dynamically load shared
1385 # libraries as plugins (bug 73). The plugins must be able to
1386 # call ELinks functions. This can be implemented either by
1387 # registering all callable functions in ELinks-specific data
1388 # structures, or by letting the dynamic linker handle them.
1389 # The latter way requires something equivalent to -rdynamic.
1391 # Because backtraces are not needed for correct operation, and bug
1392 # 73 is not yet being fixed, the configure script and makefiles
1393 # should not complain to the user if they find that -rdynamic does
1394 # not work. Besides, it was reported at elinks-users on 2006-09-12
1395 # that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
1396 # Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
1397 # -rdynamic but does something equivalent automatically. (This was
1398 # tested with "nm -D elinks | grep redraw_from_window".)
1400 # With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
1401 # -dynamic"; then, cc proceeds anyway, but the option can prevent the
1402 # linker from finding the libraries listed in -l operands. So this
1403 # -rdynamic check needs to happen after the libraries have already
1404 # been added to $LDFLAGS.
1405 AC_MSG_CHECKING([for -rdynamic])
1406 LDFLAGS_X="$LDFLAGS"
1407 LDFLAGS="-rdynamic $LDFLAGS"
1408 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
1409 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
1410 AC_MSG_RESULT($have_rdynamic)
1412 # ===================================================================
1413 # Export directory paths
1414 # ===================================================================
1416 # Set up the ``entry points'' if they were not supplied by builder
1417 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1418 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1420 # Create CONFDIR #define for config.h
1422 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1423 # it's autoconf fault to force us to do such hacks ;p.
1424 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1425 # sysconfdir is set to its default value... fine, let's append /elinks/
1426 # XXX: We can't modify listing of the default in ./configure --help :-(
1427 sysconfdir_n=`eval echo "$sysconfdir"`
1428 sysconfdir=$sysconfdir_n
1429 (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1430 sysconfdir="$sysconfdir/elinks"
1434 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1437 # Create LOCALEDIR #define for config.h
1438 LOCALEDIR=`eval echo "$datadir/locale"`
1439 while echo "$LOCALEDIR" | grep "\\$"
1441 LOCALEDIR=`eval echo "$LOCALEDIR"`
1442 done > /dev/null 2> /dev/null
1443 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1446 # Create LIBDIR #define for config.h
1447 LIBDIR=`eval echo "$libdir"`
1448 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1451 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1452 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1455 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
1456 ]], [[#if !defined(__TINYC__) || !defined(alloca)
1458 #endif ]])],[cf_result=yes],[cf_result=no])
1460 if test "$cf_result" = "yes"; then
1461 AC_DEFINE([HAVE_ALLOCA])
1462 AC_DEFINE([_ALLOCA_H], [1], [Define as 1 if you are using Tiny C Compiler
1463 with the GNU C Library, and <alloca.h> of glibc would otherwise
1464 override the alloca macro defined in <stddef.h> of TCC.
1465 If <alloca.h> of glibc sees the _ALLOCA_H macro, it assumes
1466 it has already been included, and does not redefine alloca.
1467 This might not work in future glibc versions though, because
1468 the names of the #include guard macros are not documented.
1469 The incompatibility has been reported to the tinycc-devel
1470 mailing list on 2008-07-14. If a future version of TCC provides
1471 an <alloca.h> of its own, this hack won't be needed.])
1473 # ===================================================================
1474 # A little fine tuning of gcc specific options (continued)
1475 # ===================================================================
1477 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
1478 if test "$CONFIG_DEBUG" = "yes"; then
1479 # We want to see all warnings and live with none (in debug mode).
1480 CFLAGS="$CFLAGS -Werror"
1483 case "`$CC -dumpversion`" in
1485 # These should be ok using -Werror
1488 # If gcc is version 3.3 (or higher?) it emits lots of false positive
1489 # "dereferencing type-punned pointer will break strict-aliasing rules"
1490 # warnings. Disable them by not doing any strict-aliasing. The
1491 # alternative is just too ugly. Thanks gcc guys!! ;)
1492 CFLAGS="$CFLAGS -fno-strict-aliasing"
1495 # Do not show warnings related to (char * | unsigned char *) type
1497 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1500 # These should be ok using -Werror
1504 # GCC 4.2.1 warns if we use the address of an object in Boolean context:
1505 # warning: the address of `builtin_modules' will always evaluate as `true'
1506 # This hits the object_lock and foreach_module macros in particular.
1507 # It would be okay to put something in the macros to avoid the warning,
1508 # but currently this seems to require defining parallel macros that skip
1509 # the NULL check, and that's too ugly. So we instead disable the warning.
1510 # GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
1511 # GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
1512 for warning_flag in -Wno-address -Wno-always-true; do
1513 AC_MSG_CHECKING([whether $CC accepts $warning_flag])
1515 CFLAGS="$CFLAGS $warning_flag"
1516 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1517 [AC_MSG_RESULT([yes])
1519 [AC_MSG_RESULT([no])])
1523 # Bug 1012: Some parts of ELinks do arithmetic with signed integers
1524 # in such a way that an overflow is possible. GCC 4.2.1 warns
1525 # "warning: assuming signed overflow does not occur when assuming
1526 # that (X + c) > X is always true", which may be an incorrect
1527 # optimization (although allowed by the standard), and breaks the
1528 # build with -Werror.
1530 # All of the following tests included -S -Wall -Wextra:
1532 # GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
1533 # * gcc-4.0 -O0: OK, compares the values
1534 # * gcc-4.0 -O2: assumes no overflow, does not warn
1535 # * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
1536 # * gcc-4.0 -O0 -fwrapv: OK, compares the values
1537 # * gcc-4.0 -O2 -fwrapv: OK, compares the values
1538 # * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
1539 # * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
1540 # * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1541 # * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
1543 # GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
1544 # * gcc-4.1 -O0: assumes no overflow, does not warn
1545 # * gcc-4.1 -O2: assumes no overflow, does not warn
1546 # * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
1547 # * gcc-4.1 -O0 -fwrapv: OK, compares the values
1548 # * gcc-4.1 -O2 -fwrapv: OK, compares the values
1549 # * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
1550 # * gcc-4.1 -O2 -ftrapv: compares the values
1551 # * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1552 # * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
1554 # GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
1555 # * gcc-4.2 -O0: OK, compares the values
1556 # * gcc-4.2 -O2: assumes no overflow, warns about it
1557 # * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
1558 # * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
1559 # * gcc-4.2 -O0 -fwrapv: OK, compares the values
1560 # * gcc-4.2 -O2 -fwrapv: OK, compares the values
1561 # * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
1562 # * gcc-4.2 -O2 -ftrapv: compares the values
1563 # * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1564 # * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
1566 # Apparently, -ftrapv does not work reliably at all.
1567 for overflow_flag in -fno-strict-overflow -fwrapv; do
1568 AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
1570 CFLAGS="$CFLAGS $overflow_flag"
1571 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1572 [AC_MSG_RESULT([yes])
1574 [AC_MSG_RESULT([no])])
1579 EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
1580 EL_LOG_CONFIG(CPPFLAGS, [Preprocessor flags (CPPFLAGS)], [])
1581 EL_LOG_CONFIG(LDFLAGS, [Linker flags (LDFLAGS)], [])
1582 EL_LOG_CONFIG(LIBS, [Library flags (LIBS)], [])
1584 # ===================================================================
1585 # Colored make output
1586 # ===================================================================
1588 if test $(`which tput` colors) -ge 4; then
1590 AC_SUBST(MAKE_COLOR)
1593 # ===================================================================
1595 # ===================================================================
1599 contrib/elinks.spec \
1600 contrib/lua/hooks.lua \
1601 contrib/conv/w3m2links.awk \
1603 doc/man/man1/elinks.1 \
1604 src/intl/gettext/ref-add.sed \
1605 src/intl/gettext/ref-del.sed
1609 abs_srcdir="$(cd "$srcdir" && pwd)"
1610 # builddir is always absolute!
1611 if test "$abs_srcdir" != "$builddir"; then
1612 # Bootstrap the Makefile creation
1613 echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1614 "$MAKE" "SRC=$abs_srcdir" init
1616 # Make cg-status ignore this build directory
1617 echo "*" > "$builddir/.gitignore"
1620 # ===================================================================
1621 # Configuration summary
1622 # ===================================================================
1624 AC_MSG_RESULT(The following feature summary has been saved to features.log)