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(wchar.h wctype.h)
190 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
191 AC_CHECK_HEADERS(sigaction.h)
192 AC_CHECK_HEADERS(arpa/inet.h)
193 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
194 AC_CHECK_HEADERS(net/if.h 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(stdint.h inttypes.h)
206 AC_CHECK_HEADERS(locale.h pwd.h)
207 AC_CHECK_HEADERS(termios.h)
210 AC_CHECK_HEADERS(sys/un.h,
211 [CONFIG_INTERLINK=yes
212 EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
213 [CONFIG_INTERLINK=no])
214 AC_SUBST(CONFIG_INTERLINK)
216 # ===================================================================
217 # Checks for typedefs, structures, and compiler characteristics.
218 # ===================================================================
223 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
228 EL_CHECK_TYPE(ssize_t, int)
229 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
230 EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
231 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
232 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
233 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
235 AC_CHECK_SIZEOF(char, 1)
236 AC_CHECK_SIZEOF(short, 2)
237 AC_CHECK_SIZEOF(int, 4)
238 AC_CHECK_SIZEOF(long, 4)
239 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
240 test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
242 # Check for variadic macros
243 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
245 #define a(b,c...) printf(b,##c)],
246 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
248 # Check for -rdynamic
250 # gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
251 # the executable to its dynamic symbol table. ELinks uses this for
254 # 1. If ELinks detects a bug, it can try to display a backtrace by
255 # calling backtrace_symbols_fd() in the GNU libc. The glibc-2.3.6
256 # manual states users of GNU ld must pass -rdynamic to make the
257 # symbols available to the program.
259 # 2. It would eventually be nice to dynamically load shared
260 # libraries as plugins (bug 73). The plugins must be able to
261 # call ELinks functions. This can be implemented either by
262 # registering all callable functions in ELinks-specific data
263 # structures, or by letting the dynamic linker handle them.
264 # The latter way requires something equivalent to -rdynamic.
266 # Because backtraces are not needed for correct operation, and bug
267 # 73 is not yet being fixed, the configure script and makefiles
268 # should not complain to the user if they find that -rdynamic does
269 # not work. Besides, it was reported at elinks-users on 2006-09-12
270 # that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
271 # Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
272 # -rdynamic but does something equivalent automatically. (This was
273 # tested with "nm -D elinks | grep redraw_from_window".)
275 # FIXME: This check doesn't work. Something to do with the compiler
276 # happily ignoring it and stderr not being checked for error messages.
277 AC_MSG_CHECKING([for -rdynamic])
279 LDFLAGS="$LDFLAGS -rdynamic"
280 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
281 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
282 AC_MSG_RESULT($have_rdynamic)
284 # ===================================================================
285 # Check for POSIX <regex.h>
286 # ===================================================================
288 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
290 # ===================================================================
291 # Checks for library functions.
292 # ===================================================================
294 AC_PROG_GCC_TRADITIONAL
298 AC_CHECK_FUNCS(atoll gethostbyaddr herror strerror)
299 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
300 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
301 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
302 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
303 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
304 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
305 AC_CHECK_FUNCS(gettimeofday clock_gettime)
307 AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
309 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
310 AC_CHECK_FUNCS(unsetenv)
311 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
312 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
314 AC_CHECK_FUNCS(wcwidth, HAVE_WCWIDTH=yes)
316 # These aren't probably needed now, as they are commented in links.h.
317 # I've no idea about their historical background, but I keep them here
318 # just in the case they will help later. --pasky
319 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
320 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
321 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
322 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
324 if test x"$HAVE_RAISE" = x; then
325 if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
326 AC_MSG_ERROR([Unable to emulate raise()])
330 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
331 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
332 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],[el_cv_HAVE_VA_COPY=yes],[el_cv_HAVE_VA_COPY=no])])
333 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
334 EL_DEFINE(HAVE_VA_COPY, __va_copy)
337 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
338 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
339 ]], [[int page_size = sysconf(_SC_PAGE_SIZE);]])],[el_cv_HAVE_SC_PAGE_SIZE=yes],[el_cv_HAVE_SC_PAGE_SIZE=no])])
340 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
341 EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
344 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
345 AC_RUN_IFELSE([AC_LANG_SOURCE([[
353 int bar(char *buf, const char *format, va_list ap)
355 return vsnprintf(buf, 0, format, ap);
358 void foo(const char *format, ...) {
362 va_start(ap, format);
363 len = bar(buf, format, ap);
365 if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
367 va_start(ap, format);
368 len = bar(buf, format, ap);
370 if ((len != 6) && (len != 7)) exit(1);
372 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
376 main() { foo("hello\n"); }
377 ]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
378 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
379 EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
382 # OpenSSL and Lua frequently need dlopen
383 AC_CHECK_LIB(dl, dlopen)
385 # ===================================================================
386 # Checks for libraries.
387 # ===================================================================
389 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
390 if test "$cf_result" = no; then
391 AC_CHECK_LIB(socket, socket)
394 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
395 if test "$cf_result" = no; then
396 AC_CHECK_LIB(socket, setsockopt)
399 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
400 if test "$cf_result" = no; then
401 AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
402 if test "$cf_result" = no; then
403 AC_CHECK_LIB(nsl, gethostbyname)
405 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
409 # ===================================================================
410 # Checks for packaging specific options.
411 # ===================================================================
413 AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
414 [ if test "$withval" != no && test "$withval" != yes; then
415 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
418 # ===================================================================
419 # Checks for a libraries, optional even if installed.
420 # ===================================================================
422 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
423 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
425 AC_MSG_CHECKING([for $2 support])
427 if test "[$]$1" != no; then
430 if test -n "$withval" && test -d "$withval"; then
431 # Be a little more careful when setting
432 # include and lib directories. This way
433 # $withval will work when includes are
434 # there but the library is in the common
435 # /usr/lib ... Does the right thing when
436 # looking for gc on Debian.
437 if test -d "$withval/include"; then
438 CFLAGS="$CFLAGS -I$withval/include"
439 CPPFLAGS="$CPPFLAGS -I$withval/include"
441 CFLAGS="$CFLAGS -I$withval"
442 CPPFLAGS="$CPPFLAGS -I$withval"
444 if test -d "$withval/lib"; then
445 LDFLAGS="$LDFLAGS -L$withval/lib"
449 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
450 if test "[$]$1" = yes; then
451 AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
454 if test "[$]$1" = yes; then
455 EL_CONFIG([$1], [$2])
458 if test -n "[$]WITHVAL_$1" &&
459 test "[$]WITHVAL_$1" != xno; then
460 AC_MSG_ERROR([$2 not found])
465 AC_MSG_RESULT(disabled)
469 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
470 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
475 AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
476 if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
478 EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
480 EL_LOG_CONFIG([$1], [$2], [])
483 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
484 [ --without-gpm disable gpm (mouse) support])
486 # ELinks calls deflateInit2 with windowBits = MAX_WBITS | 32, to
487 # enable automatic decoding of both zlib and gzip headers. This
488 # feature was added in zlib 1.2.0.2; earlier versions return an error.
489 # The gzclearerr function was also added in zlib 1.2.0.2, so check for
490 # that, even though ELinks does not actually call gzclearerr.
491 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
492 [ --without-zlib disable zlib support])
494 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
495 [ --without-bzlib disable bzlib support])
497 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
498 [ --without-idn disable international domain names support])
500 if test "x{with_gc}" != xno; then
501 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
502 [ --with-gc enable Boehm's garbage collector])
505 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
506 [ --without-lzma disable lzma encoding support])
508 # ===================================================================
509 # Check for GSSAPI, optional even if installed.
510 # ===================================================================
514 AC_ARG_WITH(gssapi, [ --with-gssapi enable GSSAPI support],
515 [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
517 AC_MSG_CHECKING([for GSSAPI])
519 if test "$enable_gssapi" = "yes"; then
521 GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
522 GSSAPI_LIBS=`krb5-config --libs gssapi`
523 CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
524 LIBS="$GSSAPI_LIBS $LIBS"
525 EL_CONFIG(CONFIG_GSSAPI, [GssApi])
530 AC_SUBST(CONFIG_GSSAPI)
532 # ===================================================================
533 # Bookmark and XBEL support
534 # ===================================================================
538 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
539 [ --disable-bookmarks disable bookmark support])
541 # Check whether --enable-xbel or --disable-xbel was given.
542 if test "x${enable_xbel}" != xno; then
543 AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
545 if test "$HAVE_LIBEXPAT" = yes; then
546 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
547 if test "$HAVE_LIBEXPAT" = yes; then
554 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
556 [ --disable-xbel disable XBEL bookmark support (requires expat)])
558 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
562 # ===================================================================
563 # Checks for BSD sysmouse
564 # ===================================================================
566 HAVE_SYSMOUSE_HEADER="no"
568 # Either of these header files provides the (same) sysmouse interface
569 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
571 # ===================================================================
573 # ===================================================================
575 if test "$CONFIG_OS_OS2" = yes; then
579 # ===================================================================
581 # ===================================================================
583 if test "$CONFIG_OS_WIN32" = yes; then
587 # ===================================================================
588 # Check for SEE (Simple Ecmascript Engine)
589 # ===================================================================
590 AC_ARG_WITH(see, [ --with-see enable Simple Ecmascript Engine (SEE) support],
591 [ if test "x$withval" != xno; then enable_see=yes; fi ])
593 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
594 # SEE_FLAGS but I really don't want to require people to have Guile in order
595 # to compile CVS. Also, the macro seems to be really stupid regarding searching
596 # for Guile in $PATH etc. --pasky
598 CONFIG_ECMASCRIPT_SEE=no
600 if test "$enable_see" = "yes"; then
601 if test -d "$withval"; then
602 SEE_PATH="$withval:$PATH"
607 AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
608 AC_MSG_CHECKING([for SEE (2.0.1131 or later)])
609 if test "$SEE_CONFIG" != no; then
611 SEE_LIBS="`$SEE_CONFIG --libs`"
612 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
613 CPPFLAGS="$SEE_CFLAGS $CPPFLAGS"
614 LIBS="$SEE_LIBS $LIBS_X"
615 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <see/see.h>]], [[#if SEE_VERSION_API_MAJOR < 2
618 ]])],[cf_result=yes],[cf_result=no])
620 if test "$cf_result" = yes; then
621 LIBS="$SEE_LIBS $LIBS"
622 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
625 AC_MSG_RESULT($cf_result)
627 if test -n "$withval" && test "x$withval" != xno; then
628 AC_MSG_ERROR([SEE not found])
630 AC_MSG_WARN([SEE support disabled])
635 # ===================================================================
636 # Check for SpiderMonkey, optional even if installed.
637 # ===================================================================
639 AC_ARG_WITH(spidermonkey, [ --without-spidermonkey disable SpiderMonkey Mozilla JavaScript engine support],
640 [if test "$withval" = no; then disable_spidermonkey=yes; fi])
641 AC_MSG_CHECKING([for SpiderMonkey (1.5 RC3a or later)])
646 if test -z "$disable_spidermonkey"; then
647 if test ! -d "$withval"; then
650 for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
651 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
652 for spidermonkeylib in js smjs mozjs; do
653 if test "$cf_result" = no &&
654 test -f "$spidermonkeydir$spidermonkeyinclude/jsapi.h"; then
655 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib -l$spidermonkeylib"
656 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
658 LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
659 CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
660 CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
662 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
663 #include <jsapi.h>]], [[JS_GetReservedSlot(NULL, NULL, 0, NULL)]])],[cf_result=yes],[cf_result=no])
670 AC_MSG_RESULT($cf_result)
671 CONFIG_SPIDERMONKEY="$cf_result"
674 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
675 test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
676 EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
678 CONFIG_ECMASCRIPT_SMJS=no
681 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
682 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
683 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
686 # ===================================================================
687 # Optional Spidermonkey-based ECMAScript browser scripting
688 # ===================================================================
690 AC_ARG_ENABLE(sm-scripting,
691 [ --disable-sm-scripting ECMAScript browser scripting (requires Spidermonkey)],
692 [if test "$enableval" != no; then enableval="yes"; fi
693 CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
695 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
696 test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
697 EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
699 CONFIG_SCRIPTING_SPIDERMONKEY=no
702 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
703 test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
704 LIBS="$LIBS $SPIDERMONKEY_LIBS"
705 AC_SUBST(SPIDERMONKEY_LIBS)
706 AC_SUBST(SPIDERMONKEY_CFLAGS)
707 AC_SUBST(CONFIG_SPIDERMONKEY)
710 # ===================================================================
711 # Check for Guile, optional even if installed.
712 # ===================================================================
716 AC_ARG_WITH(guile, [ --with-guile enable Guile support],
717 [ if test "x$withval" != xno; then enable_guile=yes; fi ])
719 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
720 # GUILE_FLAGS but I really don't want to require people to have Guile in order
721 # to compile CVS. Also, the macro seems to be really stupid regarding searching
722 # for Guile in $PATH etc. --pasky
724 AC_MSG_CHECKING([for Guile])
726 if test "$enable_guile" = "yes"; then
728 ## Based on the GUILE_FLAGS macro.
730 if test -d "$withval"; then
731 GUILE_PATH="$withval:$PATH"
736 AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
738 ## First, let's just see if we can find Guile at all.
739 if test "$GUILE_CONFIG" != no; then
742 GUILE_LIBS="`guile-config link`"
743 GUILE_CFLAGS="`guile-config compile`"
744 LIBS="$GUILE_LIBS $LIBS"
745 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
746 AC_SUBST(GUILE_CFLAGS)
748 ***********************************************************************
749 The Guile support is incomplete and not so well integrated to ELinks
750 yet. That means, e.g., that you have no Guile console and there might
751 not be all the necessary hooks. Also, the Guile interface is not too
752 well tested (success stories heartily welcomed!). See
753 src/scripting/guile/README for further details and hints.
754 ***********************************************************************
757 if test -n "$withval" && test "x$withval" != xno; then
758 AC_MSG_ERROR([Guile not found])
760 AC_MSG_WARN([Guile support disabled])
767 # ===================================================================
769 # ===================================================================
772 AC_ARG_WITH(perl, [ --with-perl enable Perl support],
774 if test "$withval" = yes; then
775 # FIXME: If withval is a valid directory append it to PATH
776 # so that you can specify one of several perl installations.
782 AC_MSG_CHECKING([for Perl])
788 if test "$enable_perl" = "yes"; then
789 PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
790 PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
791 LIBS="$PERL_LIBS $LIBS"
792 CFLAGS="$PERL_CFLAGS $CFLAGS"
793 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
794 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
798 ]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
801 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
803 AC_MSG_CHECKING([whether POPpx works without an n_a variable])
804 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
807 extern PerlInterpreter *my_perl;
808 ]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
809 AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
810 [Define if using Perl 5.8.8 or later, where the "POPpx" macro
811 no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
813 if test "$cf_result" != "yes"; then
816 EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
819 CPPFLAGS="$CPPFLAGS_X"
821 AC_SUBST(PERL_CFLAGS)
824 # ===================================================================
826 # ===================================================================
829 AC_ARG_WITH(python, [ --with-python=[DIR] enable Python support],
830 [ if test "x$withval" != xno; then enable_python=yes; fi ])
835 AC_MSG_CHECKING([for Python])
837 if test "$enable_python" = "yes"; then
840 if test -d "$withval"; then
841 PYTHON_PATH="$withval:$PATH"
846 AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
848 if test "$PYTHON" != no; then
851 PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; print "-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True))'`"
852 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"))'`"
853 LIBS="$PYTHON_LIBS $LIBS"
854 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
855 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
857 if test "$cf_result" != "yes"; then
860 EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
861 AC_SUBST(PYTHON_LIBS)
862 AC_SUBST(PYTHON_CFLAGS)
863 CPPFLAGS="$CPPFLAGS_X"
865 ***********************************************************************
866 The Python support is incomplete and not so well integrated to ELinks
867 yet. That means, e.g., that you have no Python console and there might
868 not be all the necessary hooks. Also, the Python interface is not too
869 well tested (success stories heartily welcomed!).
870 ***********************************************************************
874 if test -n "$withval" && test "x$withval" != xno; then
875 AC_MSG_ERROR([Python not found])
877 AC_MSG_WARN([Python support disabled])
885 # ===================================================================
886 # Check for Lua, optional even if installed.
887 # ===================================================================
889 # Do this the long way, as FreeBSD reportedly needs -L<dir> for
890 # anything other than /usr/lib, and Lua is very often in /usr/local/lib.
892 AC_ARG_WITH(lua, [ --without-lua disable Lua support],
893 [if test "$withval" = no; then disable_lua=yes; fi])
894 AC_MSG_CHECKING([for Lua])
899 if test -z "$disable_lua"; then
900 if test ! -d "$withval"; then
903 for luadir in "$withval" "" /usr /usr/local; do
904 for suffix in "" 50; do
905 if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
906 test -f "$luadir/include/lua$suffix/lua.h" ) ; then
907 LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm"
908 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
910 LIBS="$LUA_LIBS $LIBS_X"
911 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
912 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
914 # Check that it is a compatible Lua version
915 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lua.h>
916 #include <lualib.h>]], [[ lua_State *L = lua_open();
922 lua_pushboolean(L, 1);
923 lua_close(L);]])],[cf_result=yes],[cf_result=no])
929 AC_MSG_RESULT($cf_result)
931 if test "$cf_result" != yes; then
934 EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
935 AC_CHECK_HEADERS(lauxlib.h)
938 CPPFLAGS="$CPPFLAGS_X"
944 # ===================================================================
945 # Check for Ruby, optional even if installed.
946 # ===================================================================
948 EL_CONFIG_SCRIPTING_RUBY
950 # ===================================================================
951 # Setup global scripting
952 # ===================================================================
954 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])
955 AC_SUBST(CONFIG_SCRIPTING_GUILE)
956 AC_SUBST(CONFIG_SCRIPTING_LUA)
957 AC_SUBST(CONFIG_SCRIPTING_PERL)
958 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
959 AC_SUBST(CONFIG_SCRIPTING_RUBY)
960 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
961 AC_SUBST(CONFIG_SCRIPTING)
964 # ===================================================================
965 # Check for SSL support.
966 # ===================================================================
968 # We by default use OpenSSL, and we always prefer it. However, when GNUTLS
969 # is enabled, we won't try to use OpenSSL anymore.
971 # For wiping SSL hooks..
978 AC_ARG_WITH(gnutls, [ --without-gnutls disable GNUTLS SSL support],
979 [if test "$with_gnutls" = no; then disable_gnutls=yes; fi])
980 AC_ARG_WITH(gnutls, [ --with-gnutls[=DIR] enable GNUTLS SSL support],
981 [if test "$with_gnutls" != no; then enable_gnutls=yes; fi])
982 gnutls_withval="$withval"
984 if test "$enable_gnutls" = yes; then
988 AC_ARG_WITH(openssl, [ --without-openssl disable OpenSSL support],
989 [if test "$with_openssl" = no; then disable_openssl=yes; fi])
990 AC_ARG_WITH(openssl, [ --with-openssl[=DIR] enable OpenSSL support (default)])
991 openssl_withval="$withval"
995 AC_MSG_CHECKING([for OpenSSL])
1000 if test "$disable_openssl" = yes; then
1001 cf_result="not used"
1003 for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
1004 /usr/lib/openssl /usr/local/ssl \
1005 /usr/local/www /usr/lib/ssl /usr/local \
1006 /usr/pkg /opt /opt/openssl; do
1007 if test "$cf_result" = no; then
1008 if test -d "$ssldir"; then
1009 OPENSSL_CFLAGS="-I$ssldir/include"
1010 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
1011 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
1012 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
1013 # # FIXME: This created serious portability problems. --pasky
1014 # if test "$CC" == "gcc"; then
1015 # # I'm not sure about compatibility here. --pasky
1016 # LIBS="$LIBS -R$ssldir/lib"
1019 LIBS="-lssl -lcrypto $LIBS_X"
1021 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[OpenSSL_add_all_algorithms()]])],[cf_result=yes],[cf_result=no])
1022 if test "$cf_result" != yes; then
1023 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[SSLeay_add_ssl_algorithms()]])],[cf_result=yes],[cf_result=no])
1028 if test "$cf_result" != yes; then
1029 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
1030 AC_MSG_ERROR([OpenSSL not found])
1034 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
1037 AC_SUBST(OPENSSL_CFLAGS)
1041 AC_MSG_RESULT($cf_result)
1043 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1045 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
1046 dnl it looks ugly then.
1048 if test "$cf_result" = yes; then
1049 cf_result="not used"
1055 if test -z "$disable_gnutls"; then
1056 # Sure, we maybe _could_ use their macro, but how to ensure
1057 # that the ./configure script won't fail if the macro won't be
1058 # found..? :( --pasky
1060 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
1062 if test -d "$gnutls_withval"; then
1063 GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
1066 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1068 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1071 GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1072 GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1074 LIBS="$GNUTLS_LIBS $LIBS_X"
1075 CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1076 CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1078 # Verify if it's really usable. gnutls_session was
1079 # renamed to gnutls_session_t before GNU TLS 1.2.0
1080 # (on 2004-06-13); ELinks now requires this.
1081 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]], [[gnutls_session_t dummy;
1082 gnutls_check_version(NULL)]])],[cf_result=yes],[cf_result=no])
1085 if test "$cf_result" = yes; then
1086 EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1089 AC_SUBST(GNUTLS_CFLAGS)
1091 # Verify if the MD5 compatibility layer is usable.
1092 CONFIG_GNUTLS_OPENSSL_COMPAT=yes
1093 EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
1094 [GNU TLS OpenSSL compatibility],
1095 gnutls/openssl.h, gnutls-openssl,
1098 if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1099 AC_MSG_ERROR([GNUTLS (1.2 or later) not found. ELinks no longer supports GNUTLS 1.1.])
1106 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1107 AC_MSG_RESULT($cf_result)
1111 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1112 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1113 AC_SUBST(CONFIG_OPENSSL)
1114 AC_SUBST(CONFIG_GNUTLS)
1118 AC_MSG_CHECKING([whether to be or not to be])
1119 AC_MSG_RESULT([needs to be determined experimentally])
1121 # ===================================================================
1122 # Check for IPv6 support and related functions.
1123 # ===================================================================
1125 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1126 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1127 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1129 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1130 if test "$HAVE_GETADDRINFO" != yes; then
1131 AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1132 if test "$HAVE_GETADDRINFO" = yes; then
1133 LIBS="$LIBS -linet6"
1138 # ===================================================================
1139 # Checking for X11 (window title restoring).
1140 # ===================================================================
1143 if test x"$no_x" != xyes; then
1145 if test -n "$x_includes"; then
1146 X_CFLAGS="-I$x_includes"
1147 CPPFLAGS="$CPPLAGS $X_CFLAGS"
1148 CFLAGS="$CFLAGS $X_CFLAGS"
1150 if test -n "$x_libraries"; then
1151 LDFLAGS="$LDFLAGS -L$x_libraries"
1154 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize()]])],[cf_result=yes],[cf_result=no])
1156 if test "$cf_result" = yes; then
1157 if test -n "$x_libraries"; then
1158 LDFLAGS="$LDFLAGS -L$x_libraries"
1161 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1167 # ===================================================================
1168 # Backtraces displaying support.
1169 # ===================================================================
1171 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1172 # possible checks for other system-specific means go here
1175 # ===================================================================
1176 # Gettext grey zone. Beware.
1177 # ===================================================================
1179 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"
1183 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1184 dnl # f33r d4 l33t... I hope it's portable. :)
1185 dnl cf_result=$((48#z - 48#a + 1));
1186 dnl AC_MSG_RESULT($cf_result)
1189 # ===================================================================
1190 # Compile-time features control
1191 # ===================================================================
1193 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1194 [ --disable-cookies disable cookie support])
1196 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1197 [ --disable-formhist disable form history support])
1199 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1200 [ --disable-globhist disable global history support])
1203 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1204 [ --disable-mailcap disable mailcap support])
1206 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1207 [ --disable-mimetypes disable mimetypes files support])
1210 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1211 [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1213 [ --disable-ipv6 disable IPv6 support])
1215 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1216 [ --enable-bittorrent enable BitTorrent protocol support])
1218 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1219 [ --disable-data disable data protocol support])
1221 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1222 [ --disable-uri-rewrite disable URI rewrite support])
1224 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1225 [ --enable-cgi enable local CGI support])
1227 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1228 [ --enable-finger enable finger protocol support])
1230 # ===================================================================
1232 # ===================================================================
1235 if test "x${enable_fsp}" != xno; then
1236 AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1238 if test "$HAVE_FSPLIB" = yes; then
1239 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1240 if test "$HAVE_FSPLIB" = yes; then
1241 LIBS="$LIBS -lfsplib"
1243 AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1244 if test "$HAVE_FSPLIB" = yes; then
1251 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1252 [ --enable-fsp enable FSP protocol support])
1254 if test "x$CONFIG_FSP" = xno; then
1258 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1259 [ --disable-ftp disable ftp protocol support])
1261 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1262 [ --enable-gopher enable gopher protocol support])
1264 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1265 [ --enable-nntp enable nntp protocol support])
1267 # ===================================================================
1268 # SMB protocol support.
1269 # ===================================================================
1272 if test "x${enable_smb}" != xno; then
1273 AC_CHECK_HEADERS(libsmbclient.h, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1275 if test "$HAVE_SMBCLIENT" = yes; then
1276 AC_CHECK_LIB(smbclient, smbc_init, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1277 if test "$HAVE_SMBCLIENT" = yes; then
1278 LIBS="$LIBS -lsmbclient"
1283 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [Samba protocol],
1284 [ --enable-smb enable Samba protocol support])
1286 if test "x$CONFIG_SMB" = xno; then
1291 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1292 [ --disable-mouse disable mouse support])
1294 # GPM mouse is Linux specific, so ...
1296 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1297 [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1299 [ --disable-sysmouse disable BSD sysmouse support])
1301 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1302 [ --enable-88-colors enable 88 color support])
1304 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1305 [ --enable-256-colors enable 256 color support])
1307 EL_ARG_ENABLE(CONFIG_TRUE_COLOR, true-color, [true color],
1308 [ --enable-true-color enable true color support])
1310 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1311 [ --enable-exmode enable exmode (CLI) interface])
1313 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1314 [ --disable-leds disable LEDs support])
1316 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1317 [ --disable-marks disable document marks support])
1320 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1321 [ --disable-css disable Cascading Style Sheet support])
1323 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1324 [ --enable-html-highlight HTML highlighting using DOM engine])
1326 # Everything in the tree already uses CONFIG_DOM
1327 # so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1328 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1330 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1331 [ --disable-backtrace disable backtrace support])
1333 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1334 [ --enable-no-root enable prevention of usage by root])
1337 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1338 [ --enable-debug enable leak debug and internal error checking])
1340 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1341 [ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
1343 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1344 [ --enable-own-libc force use of internal functions instead of those of system libc])
1346 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1347 [ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1349 EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
1350 [ --disable-utf-8 disable UTF-8 support])
1352 EL_ARG_DEPEND(CONFIG_COMBINE, combining, [CONFIG_UTF8:yes HAVE_WCWIDTH:yes], [Combining characters],
1353 [ --enable-combining support Unicode combining characters (experimental)])
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?)])
1365 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1366 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1369 # ===================================================================
1370 # Export directory paths
1371 # ===================================================================
1373 # Set up the ``entry points'' if they were not supplied by builder
1374 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1375 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1377 # Create CONFDIR #define for config.h
1379 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1380 # it's autoconf fault to force us to do such hacks ;p.
1381 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1382 # sysconfdir is set to its default value... fine, let's append /elinks/
1383 # XXX: We can't modify listing of the default in ./configure --help :-(
1384 sysconfdir_n=`eval echo "$sysconfdir"`
1385 sysconfdir=$sysconfdir_n
1386 (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1387 sysconfdir="$sysconfdir/elinks"
1391 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1394 # Create LOCALEDIR #define for config.h
1395 LOCALEDIR=`eval echo "$datadir/locale"`
1396 while echo "$LOCALEDIR" | grep "\\$"
1398 LOCALEDIR=`eval echo "$LOCALEDIR"`
1399 done > /dev/null 2> /dev/null
1400 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1403 # Create LIBDIR #define for config.h
1404 LIBDIR=`eval echo "$libdir"`
1405 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1408 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1409 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1411 # ===================================================================
1412 # A little fine tuning of gcc specific options (continued)
1413 # ===================================================================
1415 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
1416 if test "$CONFIG_DEBUG" = "yes"; then
1417 # We want to see all warnings and live with none (in debug mode).
1418 CFLAGS="$CFLAGS -Werror"
1421 case "`$CC -dumpversion`" in
1423 # These should be ok using -Werror
1426 # If gcc is version 3.3 (or higher?) it emits lots of false positive
1427 # "dereferencing type-punned pointer will break strict-aliasing rules"
1428 # warnings. Disable them by not doing any strict-aliasing. The
1429 # alternative is just too ugly. Thanks gcc guys!! ;)
1430 CFLAGS="$CFLAGS -fno-strict-aliasing"
1433 # Do not show warnings related to (char * | unsigned char *) type
1435 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1438 # These should be ok using -Werror
1442 # GCC 4.2.1 warns if we use the address of an object in Boolean context:
1443 # warning: the address of `builtin_modules' will always evaluate as `true'
1444 # This hits the object_lock and foreach_module macros in particular.
1445 # It would be okay to put something in the macros to avoid the warning,
1446 # but currently this seems to require defining parallel macros that skip
1447 # the NULL check, and that's too ugly. So we instead disable the warning.
1448 # GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
1449 # GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
1450 for warning_flag in -Wno-address -Wno-always-true; do
1451 AC_MSG_CHECKING([whether $CC accepts $warning_flag])
1453 CFLAGS="$CFLAGS $warning_flag"
1454 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1455 [AC_MSG_RESULT([yes])
1457 [AC_MSG_RESULT([no])])
1461 # Bug 1012: Some parts of ELinks do arithmetic with signed integers
1462 # in such a way that an overflow is possible. GCC 4.2.1 warns
1463 # "warning: assuming signed overflow does not occur when assuming
1464 # that (X + c) > X is always true", which may be an incorrect
1465 # optimization (although allowed by the standard), and breaks the
1466 # build with -Werror.
1468 # All of the following tests included -S -Wall -Wextra:
1470 # GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
1471 # * gcc-4.0 -O0: OK, compares the values
1472 # * gcc-4.0 -O2: assumes no overflow, does not warn
1473 # * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
1474 # * gcc-4.0 -O0 -fwrapv: OK, compares the values
1475 # * gcc-4.0 -O2 -fwrapv: OK, compares the values
1476 # * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
1477 # * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
1478 # * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1479 # * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
1481 # GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
1482 # * gcc-4.1 -O0: assumes no overflow, does not warn
1483 # * gcc-4.1 -O2: assumes no overflow, does not warn
1484 # * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
1485 # * gcc-4.1 -O0 -fwrapv: OK, compares the values
1486 # * gcc-4.1 -O2 -fwrapv: OK, compares the values
1487 # * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
1488 # * gcc-4.1 -O2 -ftrapv: compares the values
1489 # * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1490 # * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
1492 # GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
1493 # * gcc-4.2 -O0: OK, compares the values
1494 # * gcc-4.2 -O2: assumes no overflow, warns about it
1495 # * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
1496 # * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
1497 # * gcc-4.2 -O0 -fwrapv: OK, compares the values
1498 # * gcc-4.2 -O2 -fwrapv: OK, compares the values
1499 # * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
1500 # * gcc-4.2 -O2 -ftrapv: compares the values
1501 # * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1502 # * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
1504 # Apparently, -ftrapv does not work reliably at all.
1505 for overflow_flag in -fno-strict-overflow -fwrapv; do
1506 AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
1508 CFLAGS="$CFLAGS $overflow_flag"
1509 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1510 [AC_MSG_RESULT([yes])
1512 [AC_MSG_RESULT([no])])
1517 EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
1518 EL_LOG_CONFIG(CPPFLAGS, [Preprocessor flags (CPPFLAGS)], [])
1519 EL_LOG_CONFIG(LDFLAGS, [Linker flags (LDFLAGS)], [])
1520 EL_LOG_CONFIG(LIBS, [Library flags (LIBS)], [])
1522 # ===================================================================
1523 # Colored make output
1524 # ===================================================================
1526 if test $(`which tput` colors) -ge 4; then
1528 AC_SUBST(MAKE_COLOR)
1531 # ===================================================================
1533 # ===================================================================
1537 contrib/elinks.spec \
1538 contrib/lua/hooks.lua \
1539 contrib/conv/w3m2links.awk \
1541 doc/man/man1/elinks.1 \
1542 src/intl/gettext/ref-add.sed \
1543 src/intl/gettext/ref-del.sed
1547 abs_srcdir="$(cd "$srcdir" && pwd)"
1548 # builddir is always absolute!
1549 if test "$abs_srcdir" != "$builddir"; then
1550 # Bootstrap the Makefile creation
1551 echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1552 "$MAKE" "SRC=$abs_srcdir" init
1554 # Make cg-status ignore this build directory
1555 echo "*" > "$builddir/.gitignore"
1558 # ===================================================================
1559 # Configuration summary
1560 # ===================================================================
1562 AC_MSG_RESULT(The following feature summary has been saved to features.log)