Copiousoutput final stage. I doubt that /dev/fd/%d is portable. It works
[elinks.git] / configure.in
blobccc888f86cf65d24626e3aff43bbcf675aab07a1
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.13)
4 AC_INIT(src/main/main.c)
5 AC_CONFIG_AUX_DIR(config)
7 PACKAGE=elinks
8 VERSION=0.12.GIT
9 AC_SUBST(PACKAGE)
10 AC_SUBST(VERSION)
11 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
12 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
13 AC_CONFIG_HEADERS(config.h)
15 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
16 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
17 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
19 MAKE=
21 for make in gnumake gmake make false; do
22         if test "x$MAKE" = x; then
23                 AC_PATH_PROGS(MAKE, "$make")
24         fi
25 done
27 builddir="`pwd`"
29 # Cleanup if we are configuring with a previous build in the tree
30 if test -e Makefile.config; then
31         AC_MSG_CHECKING([for previous build to clean])
32         "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
33         AC_MSG_RESULT(done)
36 dnl ===================================================================
37 dnl Load feature configuration file and start logging features.
38 dnl ===================================================================
40 features="features.conf"
41 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
42 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
43 echo "Feature summary:" > features.log
45 dnl ===================================================================
46 dnl Checks for programs.
47 dnl ===================================================================
49 AC_PROG_CC
50 AC_PROG_AWK
51 AC_PATH_PROGS(AWK, "$AWK")
52 AC_PROG_RANLIB
53 AC_PROG_INSTALL
55 AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id")
56 AC_PATH_PROGS(SPARSE, "sparse")
58 CONFIG_ASCIIDOC="no"
59 CONFIG_POD2HTML="no"
60 CONFIG_XMLTO="no"
61 CONFIG_JW="no"
63 if test "x$CONFIG_DOC" != xno; then
64         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
65         if test "x$ASCIIDOC" != "x"; then
66                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
67                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
68                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
70                 echo > config.asciidoc-unsafe.txt
71                 if "$ASCIIDOC" --unsafe config.asciidoc-unsafe.txt >/dev/null 2>/dev/null; then
72                         ASCIIDOC_FLAGS=--unsafe
73                 fi
74                 rm config.asciidoc-unsafe.*
75         fi
77         AC_PATH_PROGS(XMLTO, "xmlto")
78         if test "x$XMLTO" != "x"; then
79                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
80                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
81                 EL_CONFIG(MAN_XMLTO, [man (groff)])
82         fi
84         AC_PATH_PROGS(JW, "jw")
85         if test "x$JW" != "x"; then
86                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
87                 EL_CONFIG(MANUAL_JW, [PDF])
88         fi
90         AC_PATH_PROGS(POD2HTML, "pod2html")
91         if test "x$POD2HTML" != "x"; then
92                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
93         fi
96 AC_SUBST(ASCIIDOC_FLAGS)
97 AC_SUBST(CONFIG_ASCIIDOC)
98 AC_SUBST(CONFIG_POD2HTML)
99 AC_SUBST(CONFIG_XMLTO)
100 AC_SUBST(CONFIG_JW)
102 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
103 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
104 EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
106 dnl gcc specific options (to be continued at the bottom of configure)
107 if test "x$ac_cv_prog_gcc" = "xyes"; then
108   dnl We want to see all warnings and live with none.
109   dnl We can't set up -Werror here as there may be some warnings in test
110   dnl suite of configure, and we don't want to fail them.
111   CFLAGS="$CFLAGS -Wall"
114 dnl ===================================================================
115 dnl Checks for special OSes.
116 dnl ===================================================================
118 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
119 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
121         AC_MSG_CHECKING([for $2])
123         for flag in $3; do
124                 AC_TRY_COMPILE(, [#ifndef $flag
125 kill me!
126 #endif ], $1=yes, $1=no)
127                 if test "[$]$1" = yes; then
128                         EL_CONFIG([$1], [$2])
129                         break
130                 fi
131         done
133         AC_MSG_RESULT([$]$1)
136 EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
137 AC_SUBST(CONFIG_OS_BEOS)
139 EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
140 AC_SUBST(CONFIG_OS_RISCOS)
142 EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
143 AC_SUBST(CONFIG_OS_WIN32)
145 EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
146 AC_SUBST(CONFIG_OS_OS2)
147 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
149 AC_MSG_CHECKING([for UNIX])
150 dnl FIXME: some depend kind of mechanism
151 if test "$CONFIG_OS_BEOS" = no && \
152    test "$CONFIG_OS_RISCOS" = no && \
153    test "$CONFIG_OS_WIN32" = no && \
154    test "$CONFIG_OS_OS2" = no; then
155         EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
156 else
157         CONFIG_OS_UNIX=no
159 AC_MSG_RESULT($CONFIG_OS_UNIX)
160 AC_SUBST(CONFIG_OS_UNIX)
162 dnl ===================================================================
163 dnl Checks for header files.
164 dnl ===================================================================
166 AC_HEADER_DIRENT
167 AC_HEADER_STDC
168 AC_HEADER_SYS_WAIT
169 AC_HEADER_TIME
171 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
172 AC_CHECK_HEADERS(sigaction.h)
173 AC_CHECK_HEADERS(arpa/inet.h)
174 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
175 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
176 AC_CHECK_HEADERS(ifaddrs.h)
177 AC_CHECK_HEADERS(sys/cygwin.h io.h)
178 AC_CHECK_HEADERS(sys/fmutex.h)
179 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
180 AC_CHECK_HEADERS(sys/resource.h)
181 AC_CHECK_HEADERS(sys/select.h)
182 AC_CHECK_HEADERS(sys/signal.h)
183 AC_CHECK_HEADERS(sys/socket.h)
184 AC_CHECK_HEADERS(sys/time.h)
185 AC_CHECK_HEADERS(sys/utsname.h)
186 AC_CHECK_HEADERS(stdint.h inttypes.h)
187 AC_CHECK_HEADERS(locale.h pwd.h)
188 AC_CHECK_HEADERS(termios.h)
191 AC_CHECK_HEADERS(sys/un.h,
192         [CONFIG_INTERLINK=yes
193          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
194         [CONFIG_INTERLINK=no])
195 AC_SUBST(CONFIG_INTERLINK)
197 dnl ===================================================================
198 dnl Checks for typedefs, structures, and compiler characteristics.
199 dnl ===================================================================
201 AC_STRUCT_TM
202 AC_C_CONST
203 AC_C_INLINE
204 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
206 AC_SYS_LARGEFILE
207 AC_TYPE_SIZE_T
208 AC_TYPE_OFF_T
209 EL_CHECK_TYPE(ssize_t, int)
210 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
211 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
212 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
213 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
215 AC_CHECK_SIZEOF(char, 1)
216 AC_CHECK_SIZEOF(short, 2)
217 AC_CHECK_SIZEOF(int, 4)
218 AC_CHECK_SIZEOF(long, 4)
219 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
221 dnl Check for variadic macros
222 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
223                 [#include <stdio.h>
224                  #define a(b,c...) printf(b,##c)],
225                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
227 dnl Check for -rdynamic
228 dnl FIXME: This check doesn't work. Something to do with the compiler
229 dnl happily ignoring it and stderr not being checked for error messages.
230 AC_MSG_CHECKING([for -rdynamic])
231 LDFLAGS_X="$LDFLAGS"
232 LDFLAGS="$LDFLAGS -rdynamic"
233 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
234 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
235 AC_MSG_RESULT($have_rdynamic)
237 dnl ===================================================================
238 dnl Check for POSIX <regex.h>
239 dnl ===================================================================
241 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
243 dnl ===================================================================
244 dnl Checks for library functions.
245 dnl ===================================================================
247 AC_PROG_GCC_TRADITIONAL
248 AC_FUNC_MEMCMP
249 AC_FUNC_MMAP
250 AC_FUNC_STRFTIME
251 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
252 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
253 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
254 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
255 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
256 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
257 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
258 AC_CHECK_FUNCS(gettimeofday clock_gettime)
260 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
262 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
263 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
264 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
266 dnl These aren't probably needed now, as they are commented in links.h.
267 dnl I've no idea about their historical background, but I keep them here
268 dnl just in the case they will help later. --pasky
269 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
270 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
271 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
272 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
274 if test x"$HAVE_RAISE" = x; then
275         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
276                 AC_ERROR([Unable to emulate raise()])
277         fi
280 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
281 AC_TRY_LINK([#include <stdarg.h>
282 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
283 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
284 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
285         EL_DEFINE(HAVE_VA_COPY, __va_copy)
288 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
289 AC_TRY_LINK([#include <unistd.h>
290 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
291 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
292 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
293         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
296 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
297 AC_TRY_RUN([
298 #include <stdio.h>
299 #include <stdarg.h>
300 #include <stdlib.h>
301 #include <string.h>
303 char buf[8];
305 int bar(char *buf, const char *format, va_list ap)
307        return vsnprintf(buf, 0, format, ap);
310 void foo(const char *format, ...) {
311        va_list ap;
312        int len;
314        va_start(ap, format);
315        len = bar(buf, format, ap);
316        va_end(ap);
317        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
319        va_start(ap, format);
320        len = bar(buf, format, ap);
321        va_end(ap);
322        if ((len != 6) && (len != 7)) exit(1);
324        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
326        exit(0);
328 main() { foo("hello\n"); }
330 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
331 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
332         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
335 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
337 dnl ===================================================================
338 dnl Checks for libraries.
339 dnl ===================================================================
341 dnl Replace `main' with a function in -lsocket:
342 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
343 if test "$cf_result" = no; then
344         AC_CHECK_LIB(socket, socket)
347 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
348 if test "$cf_result" = no; then
349         AC_CHECK_LIB(socket, setsockopt)
352 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
353 if test "$cf_result" = no; then
354         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
355         if test "$cf_result" = no; then
356                 AC_CHECK_LIB(nsl, gethostbyname)
357         else
358                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
359         fi
362 dnl ===================================================================
363 dnl Checks for packaging specific options.
364 dnl ===================================================================
366 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
367             [ if test "$withval" != no && test "$withval" != yes; then
368                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
369               fi ])
371 dnl ===================================================================
372 dnl Checks for a libraries, optional even if installed.
373 dnl ===================================================================
375 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
376 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
378         AC_MSG_CHECKING([for $2 support])
380         if test "[$]$1" != no; then
381                 AC_MSG_RESULT(yes)
382                 EL_SAVE_FLAGS
383                 if test -n "$withval" && test -d "$withval"; then
384                         # Be a little more careful when setting
385                         # include and lib directories. This way
386                         # $withval will work when includes are
387                         # there but the library is in the common
388                         # /usr/lib ... Does the right thing when
389                         # looking for gc on Debian.
390                         if test -d "$withval/include"; then
391                                 CFLAGS="$CFLAGS -I$withval/include"
392                                 CPPFLAGS="$CPPFLAGS -I$withval/include"
393                         else
394                                 CFLAGS="$CFLAGS -I$withval"
395                                 CPPFLAGS="$CPPFLAGS -I$withval"
396                         fi
397                         if test -d "$withval/lib"; then
398                                 LDFLAGS="$LDFLAGS -L$withval/lib"
399                         fi
400                 fi
402                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
403                 if test "[$]$1" = yes; then
404                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
405                 fi
407                 if test "[$]$1" = yes; then
408                         EL_CONFIG([$1], [$2])
409                         LIBS="$LIBS -l$4"
410                 else
411                         if test -n "[$]WITHVAL_$1" &&
412                            test "[$]WITHVAL_$1" != xno; then
413                                 AC_MSG_ERROR([$2 not found])
414                         fi
415                         EL_RESTORE_FLAGS
416                 fi
417         else
418                 AC_MSG_RESULT(disabled)
419         fi
422 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
423 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
425         $1=yes
426         WITHVAL_$1=
428         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
429         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
431         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
433         EL_LOG_CONFIG([$1], [$2], [])
436 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
437         [  --without-gpm           disable gpm (mouse) support])
439 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
440         [  --without-zlib          disable zlib support])
442 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
443         [  --without-bzlib         disable bzlib support])
445 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
446         [  --without-idn           disable international domain names support])
448 if test "x{with_gc}" != xno; then
449         EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
450                 [  --with-gc            enable Boehm's garbage collector])
453 EL_ARG_ENABLE(CONFIG_LZMA, lzma, [lzma],
454               [  --enable-lzma          enable lzma encoding support])
455 dnl ===================================================================
456 dnl Bookmark and XBEL support
457 dnl ===================================================================
459 EL_SAVE_FLAGS
461 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
462               [  --disable-bookmarks     disable bookmark support])
464 # Check whether --enable-xbel or --disable-xbel was given.
465 if test "x${enable_xbel}" != xno; then
466         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
468         if test "$HAVE_LIBEXPAT" = yes; then
469                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
470                 if test "$HAVE_LIBEXPAT" = yes; then
471                         LIBS="$LIBS -lexpat"
472                 fi
473         fi
477 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
478               [XBEL bookmarks],
479               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
481 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
482         EL_RESTORE_FLAGS
485 dnl ===================================================================
486 dnl Checks for BSD sysmouse
487 dnl ===================================================================
489 HAVE_SYSMOUSE_HEADER="no"
491 # Either of these header files provides the (same) sysmouse interface
492 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
494 dnl ===================================================================
495 dnl Checks for OS/2
496 dnl ===================================================================
498 if test "$CONFIG_OS_OS2" = yes; then
499         EL_CONFIG_OS_OS2
502 dnl ===================================================================
503 dnl Checks for Win32
504 dnl ===================================================================
506 if test "$CONFIG_OS_WIN32" = yes; then
507         EL_CONFIG_OS_WIN32
510 dnl ===================================================================
511 dnl Check for SEE (Simple Ecmascript Engine)
512 dnl ===================================================================
513 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
514             [ if test "x$withval" != xno; then enable_see=yes; fi ])
516 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
517 # SEE_FLAGS but I really don't want to require people to have Guile in order
518 # to compile CVS. Also, the macro seems to be really stupid regarding searching
519 # for Guile in $PATH etc. --pasky
521 AC_MSG_CHECKING([for SEE])
523 CONFIG_ECMASCRIPT_SEE=no
525 if test "$enable_see" = "yes"; then
526         AC_MSG_RESULT(yes);
527         ## Based on the SEE_FLAGS macro.
529         if test -d "$withval"; then
530                 SEE_PATH="$withval:$PATH"
531         else
532                 SEE_PATH="$PATH"
533         fi
535         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
537         ## First, let's just see if we can find Guile at all.
538         if test "$SEE_CONFIG" != no; then
539                 cf_result="yes";
541                 SEE_LIBS="`$SEE_CONFIG --libs`"
542                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
543                 LIBS="$SEE_LIBS $LIBS"
544                 CPPFLAGS="$CPPFLAGS $SEE_CFLAGS"
545                 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
546                 AC_SUBST(SEE_CFLAGS)
547         else
548                 if test -n "$withval" && test "x$withval" != xno; then
549                         AC_MSG_ERROR([SEE not found])
550                 else
551                         AC_MSG_WARN([SEE support disabled])
552                 fi
553         fi
554 else
555         AC_MSG_RESULT(no);
559 dnl ===================================================================
560 dnl Check for SpiderMonkey, optional even if installed.
561 dnl ===================================================================
563 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
564             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
565 AC_MSG_CHECKING([for SpiderMonkey])
567 EL_SAVE_FLAGS
568 cf_result=no
570 if test -z "$disable_spidermonkey"; then
571         if test ! -d "$withval"; then
572                 withval="";
573         fi
574         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
575                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
576                         for spidermonkeylib in js smjs mozjs; do
577                                 if test "$cf_result" = no; then
578                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
580                                         if test ! -z "$spidermonkeydir"; then
581                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
582                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
583                                         fi
585                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
586                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
587                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
589                                         AC_TRY_LINK([#define XP_UNIX
590                                                      #include <jsapi.h>],
591                                                      [JS_GetImplementationVersion()],
592                                                      cf_result=yes, cf_result=no)
593                                 fi
594                         done
595                 done
596         done
599 AC_MSG_RESULT($cf_result)
600 CONFIG_SPIDERMONKEY="$cf_result"
601 EL_RESTORE_FLAGS
603 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
604    test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
605         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
606 else
607         CONFIG_ECMASCRIPT_SMJS=no
610 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
611 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
612 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
615 dnl ===================================================================
616 dnl Optional Spidermonkey-based ECMAScript browser scripting
617 dnl ===================================================================
619 AC_ARG_ENABLE(sm-scripting,
620               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
621               [if test "$enableval" != no; then enableval="yes"; fi
622                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
624 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
625    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
626         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
627 else
628         CONFIG_SCRIPTING_SPIDERMONKEY=no
631 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
632    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
633         LIBS="$LIBS $SPIDERMONKEY_LIBS"
634         AC_SUBST(SPIDERMONKEY_LIBS)
635         AC_SUBST(SPIDERMONKEY_CFLAGS)
636         AC_SUBST(CONFIG_SPIDERMONKEY)
639 dnl ===================================================================
640 dnl Check for Guile, optional even if installed.
641 dnl ===================================================================
643 enable_guile="no";
645 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
646             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
648 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
649 # GUILE_FLAGS but I really don't want to require people to have Guile in order
650 # to compile CVS. Also, the macro seems to be really stupid regarding searching
651 # for Guile in $PATH etc. --pasky
653 AC_MSG_CHECKING([for Guile])
655 if test "$enable_guile" = "yes"; then
656         AC_MSG_RESULT(yes);
657         ## Based on the GUILE_FLAGS macro.
659         if test -d "$withval"; then
660                 GUILE_PATH="$withval:$PATH"
661         else
662                 GUILE_PATH="$PATH"
663         fi
665         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
667         ## First, let's just see if we can find Guile at all.
668         if test "$GUILE_CONFIG" != no; then
669                 cf_result="yes";
671                 GUILE_LIBS="`guile-config link`"
672                 GUILE_CFLAGS="`guile-config compile`"
673                 LIBS="$GUILE_LIBS $LIBS"
674                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
675                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
676                 AC_SUBST(GUILE_CFLAGS)
677                 cat <<EOF
678 ***********************************************************************
679 The Guile support is incomplete and not so well integrated to ELinks
680 yet. That means, e.g., that you have no Guile console and there might
681 not be all the necessary hooks. Also, the Guile interface is not too
682 well tested (success stories heartily welcomed!).  See
683 src/scripting/guile/README for further details and hints.
684 ***********************************************************************
686         else
687                 if test -n "$withval" && test "x$withval" != xno; then
688                         AC_MSG_ERROR([Guile not found])
689                 else
690                         AC_MSG_WARN([Guile support disabled])
691                 fi
692         fi
693 else
694         AC_MSG_RESULT(no);
697 dnl ===================================================================
698 dnl Check for Perl
699 dnl ===================================================================
700 enable_perl="no";
702 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
703             [
704 if test "$withval" = yes; then
705         # FIXME: If withval is a valid directory append it to PATH
706         # so that you can specify one of several perl installations.
707         withval="";
708         enable_perl=yes;
710             ])
712 AC_MSG_CHECKING([for Perl])
714 cf_result=no
716 EL_SAVE_FLAGS
718 if test "$enable_perl" = "yes"; then
719         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
720         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
721         LIBS="$PERL_LIBS $LIBS"
722         CFLAGS="$PERL_CFLAGS $CFLAGS"
723         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
724         AC_TRY_LINK([
725 #include <EXTERN.h>
726 #include <perl.h>
727 #include <perlapi.h>
729                     [PerlInterpreter *my_perl = perl_alloc();],
730                     cf_result=yes, cf_result=no)
733 if test "$cf_result" != "yes"; then
734         EL_RESTORE_FLAGS
735 else
736         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
738         CFLAGS="$CFLAGS_X"
739         AC_SUBST(PERL_LIBS)
740         AC_SUBST(PERL_CFLAGS)
743 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
744 dnl ===================================================================
745 dnl Check for Python
746 dnl ===================================================================
747 enable_python="no";
749 AC_ARG_WITH(python, [  --with-python=[prefix]       enable Python support],
750             [
751 if test "$withval" != no; then
752         # FIXME: If withval is a valid directory append it to PATH
753         # so that you can specify one of several Python installations.
754         if test "$withval" != yes; then
755                 python_prefix="$withval"
756         else
757                 python_prefix=""
758         fi
759         enable_python=yes
760         cat <<EOF
761 ***********************************************************************
762 The Python support is incomplete and not so well integrated to ELinks
763 yet. That means, e.g.., that you have no Python console and there might
764 not be all the necessary hooks. Also, the Python interface is not too
765 well tested (success stories heartily welcomed!).
766 ***********************************************************************
769             ])
772 cf_result=no
774 EL_SAVE_FLAGS
776 if test "$enable_python" = "yes"; then
777         if test -n "$python_prefix" && test -d "$python_prefix/bin"; then
778                 PYTHON_PATH="$python_prefix/bin:$PATH"
779         else
780                 PYTHON_PATH="$PATH"
781         fi
782         AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
783         if test "$PYTHON" = "no" ; then
784                 cf_result=no
785         else
786                 PYTHON_CFLAGS="-I`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
787                 if test -n "$python_prefix" && test -d "$python_prefix/lib"; then
788                         PYTHON_LIBS="-L$python_prefix/lib -lpython"
789                 else
790                         PYTHON_LIBS="-lpython"
791                 fi
792                 LIBS="$PYTHON_LIBS $LIBS"
793                 CFLAGS="$PYTHON_CFLAGS $CFLAGS"
794                 AC_TRY_LINK([#include <Python.h>],
795                     [Py_Initialize();],
796                     cf_result=yes, cf_result=no)
798                 if test "$cf_result" != "yes"; then
799                         EL_RESTORE_FLAGS
800                 else
801                         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
803                         CFLAGS="$CFLAGS_X"
804                         AC_SUBST(PYTHON_LIBS)
805                         AC_SUBST(PYTHON_CFLAGS)
806                 fi
807         fi
810 AC_MSG_CHECKING([for Python])
811 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
814 dnl ===================================================================
815 dnl Check for Lua, optional even if installed.
816 dnl ===================================================================
818 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
819 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
821 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
822             [if test "$withval" = no; then disable_lua=yes; fi])
823 AC_MSG_CHECKING([for Lua])
825 EL_SAVE_FLAGS
826 cf_result=no
828 if test -z "$disable_lua"; then
829         if test ! -d "$withval"; then
830                 withval="";
831         fi
832         for luadir in "$withval" "" /usr /usr/local; do
833                 for suffix in "" 50 51; do
834                         if test "$cf_result" = no; then
835                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
837                                 if test ! -z "$luadir"; then
838                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
839                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
840                                 fi
842                                 LIBS="$LUA_LIBS $LIBS_X"
843                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
844                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
846                                 # Check that it is a compatible Lua version
847                                 AC_TRY_LINK([   #include <lua.h>
848                                                 #include <lualib.h>],
849                                             [   lua_State *L = lua_open();
850                                                 luaopen_base(L);
851                                                 luaopen_table(L);
852                                                 luaopen_io(L);
853                                                 luaopen_string(L);
854                                                 luaopen_math(L);
855                                                 lua_pushboolean(L, 1);
856                                                 lua_close(L);],
857                                             cf_result=yes, cf_result=no)
858                         fi
859                 done
860         done
863 AC_MSG_RESULT($cf_result)
865 if test "$cf_result" != yes; then
866         EL_RESTORE_FLAGS
867 else
868         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
869         AC_CHECK_HEADERS(lauxlib.h)
871         CFLAGS="$CFLAGS_X"
872         AC_SUBST(LUA_LIBS)
873         AC_SUBST(LUA_CFLAGS)
877 dnl ===================================================================
878 dnl Check for Ruby, optional even if installed.
879 dnl ===================================================================
881 EL_CONFIG_SCRIPTING_RUBY
883 dnl ===================================================================
884 dnl Setup global scripting
885 dnl ===================================================================
887 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])
888 AC_SUBST(CONFIG_SCRIPTING_GUILE)
889 AC_SUBST(CONFIG_SCRIPTING_LUA)
890 AC_SUBST(CONFIG_SCRIPTING_PERL)
891 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
892 AC_SUBST(CONFIG_SCRIPTING_RUBY)
893 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
894 AC_SUBST(CONFIG_SCRIPTING)
897 dnl ===================================================================
898 dnl Check for SSL support.
899 dnl ===================================================================
901 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
902 dnl is enabled, we won't try to use OpenSSL anymore.
904 dnl For wiping SSL hooks..
905 #ifdef CONFIG_SSL
907 disable_openssl=""
908 disable_gnutls=""
909 enable_gnutls=""
911 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
912             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
913 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
914             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
915 gnutls_withval="$withval"
917 if test "$enable_gnutls" = yes; then
918         disable_openssl=yes;
921 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
922             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
923 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
924 openssl_withval="$withval"
926 dnl ---- OpenSSL
928 AC_MSG_CHECKING([for OpenSSL])
930 EL_SAVE_FLAGS
931 cf_result="no"
933 if test "$disable_openssl" = yes; then
934         cf_result="not used"
935 else
936         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
937                          /usr/lib/openssl /usr/local/ssl \
938                          /usr/local/www /usr/lib/ssl /usr/local \
939                          /usr/pkg /opt /opt/openssl; do
940                 if test "$cf_result" = no; then
941                         if test -d "$ssldir"; then
942                                 OPENSSL_CFLAGS="-I$ssldir/include"
943                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
944                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
945                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
946 #                               # FIXME: This created serious portability problems. --pasky
947 #                               if test "$CC" == "gcc"; then
948 #                                       # I'm not sure about compatibility here. --pasky
949 #                                       LIBS="$LIBS -R$ssldir/lib"
950 #                               fi
951                         else
952                                 LIBS="-lssl -lcrypto $LIBS_X"
953                         fi
954                         AC_TRY_LINK([#include <openssl/ssl.h>],
955                                     [OpenSSL_add_all_algorithms()],
956                                     cf_result=yes, cf_result=no)
957                         if test "$cf_result" != yes; then
958                                 AC_TRY_LINK([#include <openssl/ssl.h>],
959                                             [SSLeay_add_ssl_algorithms()],
960                                             cf_result=yes, cf_result=no)
961                         fi
962                 fi
963         done
965         if test "$cf_result" != yes; then
966                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
967                         AC_MSG_ERROR([OpenSSL not found])
968                 fi
969                 EL_RESTORE_FLAGS
970         else
971                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
973                 CFLAGS="$CFLAGS_X"
974                 AC_SUBST(OPENSSL_CFLAGS)
975         fi
978 AC_MSG_RESULT($cf_result)
980 CONFIG_GNUTLS_OPENSSL_COMPAT=no
981 dnl ---- GNU TLS
982 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
983 dnl it looks ugly then.
985 if test "$cf_result" = yes; then
986         cf_result="not used"
988 else
989         EL_SAVE_FLAGS
990         cf_result="no"
992         if test -z "$disable_gnutls"; then
993                 # Sure, we maybe _could_ use their macro, but how to ensure
994                 # that the ./configure script won't fail if the macro won't be
995                 # found..? :( --pasky
997                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
999                 if test -d "$gnutls_withval"; then
1000                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
1001                 fi
1003                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1005                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1006                         cf_result=no
1007                 else
1008                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1009                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1011                         LIBS="$GNUTLS_LIBS $LIBS_X"
1012                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1013                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1015                         # Verify if it's really usable.  gnutls_session was
1016                         # renamed to gnutls_session_t before GNU TLS 1.2.0
1017                         # (on 2004-06-13); ELinks now requires this.
1018                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
1019                                     [gnutls_session_t dummy;
1020                                      gnutls_check_version(NULL)],
1021                                     cf_result=yes, cf_result=no)
1022                 fi
1024                 if test "$cf_result" = yes; then
1025                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1027                         CFLAGS="$CFLAGS_X"
1028                         AC_SUBST(GNUTLS_CFLAGS)
1030                         # Verify if the MD5 compatibility layer is usable.
1031                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
1032                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
1033                                                   [GNU TLS OpenSSL compatibility],
1034                                                   gnutls/openssl.h, gnutls-openssl,
1035                                                   MD5_Init)
1036                 else
1037                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1038                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1039                         fi
1040                         EL_RESTORE_FLAGS
1041                 fi
1042         fi
1045 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1046 AC_MSG_RESULT($cf_result)
1048 dnl Final SSL setup
1050 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1051 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1052 AC_SUBST(CONFIG_OPENSSL)
1053 AC_SUBST(CONFIG_GNUTLS)
1055 #endif
1057 AC_MSG_CHECKING([whether to be or not to be])
1058 AC_MSG_RESULT([needs to be determined experimentally])
1060 dnl ===================================================================
1061 dnl Check for IPv6 support and related functions.
1062 dnl ===================================================================
1064 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1065 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1066 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1068 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1069 if test "$HAVE_GETADDRINFO" != yes; then
1070         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1071         if test "$HAVE_GETADDRINFO" = yes; then
1072                 LIBS="$LIBS -linet6"
1073         fi
1077 dnl ===================================================================
1078 dnl Checking for X11 (window title restoring).
1079 dnl ===================================================================
1081 AC_PATH_X
1082 if test x"$no_x" != xyes; then
1083         if test -n "$x_includes"; then
1084                 X_CFLAGS="-I$x_includes"
1085                 CPPFLAGS="$CPPFLAGS -I$x_includes"
1086         fi
1087         if test -n "$x_libraries"; then
1088                 LDFLAGS="$LDFLAGS -L$x_libraries"
1089         fi
1090         LIBS="-lX11 $LIBS"
1091         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1092         AC_SUBST(X_CFLAGS)
1096 dnl ===================================================================
1097 dnl Backtraces displaying support.
1098 dnl ===================================================================
1100 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1101 # possible checks for other system-specific means go here
1104 dnl ===================================================================
1105 dnl SMB protocol support.
1106 dnl ===================================================================
1108 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1111 dnl ===================================================================
1112 dnl Gettext grey zone. Beware.
1113 dnl ===================================================================
1115 ALL_LINGUAS="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"
1117 AM_GNU_GETTEXT
1119 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1120 dnl # f33r d4 l33t... I hope it's portable. :)
1121 dnl cf_result=$((48#z - 48#a + 1));
1122 dnl AC_MSG_RESULT($cf_result)
1125 dnl ===================================================================
1126 dnl Compile-time features control
1127 dnl ===================================================================
1129 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1130               [  --disable-cookies       disable cookie support])
1132 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1133               [  --disable-formhist      disable form history support])
1135 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1136               [  --disable-globhist      disable global history support])
1139 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1140               [  --disable-mailcap       disable mailcap support])
1142 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1143               [  --disable-mimetypes     disable mimetypes files support])
1146 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1147               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1148               [IPv6],
1149               [  --disable-ipv6          disable IPv6 support])
1151 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1152               [  --enable-bittorrent     enable BitTorrent protocol support])
1154 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1155               [  --disable-data          disable data protocol support])
1157 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1158               [  --disable-uri-rewrite   disable URI rewrite support])
1160 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1161               [  --enable-cgi            enable local CGI support])
1163 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1164               [  --enable-finger         enable finger protocol support])
1166 dnl ===================================================================
1167 dnl FSP protocol
1168 dnl ===================================================================
1169 EL_SAVE_FLAGS
1171 if test "x${enable_fsp}" != xno; then
1172         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1174         if test "$HAVE_FSPLIB" = yes; then
1175                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1176                 if test "$HAVE_FSPLIB" = yes; then
1177                         LIBS="$LIBS -lfsplib"
1178                 else
1179                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1180                         if test "$HAVE_FSPLIB" = yes; then
1181                                 LIBS="$LIBS -lfsp"
1182                         fi
1183                 fi
1184         fi
1187 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1188               [  --enable-fsp            enable FSP protocol support])
1190 if test "x$CONFIG_FSP" = xno; then
1191         EL_RESTORE_FLAGS
1194 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1195               [  --disable-ftp           disable ftp protocol support])
1197 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1198               [  --enable-gopher         enable gopher protocol support])
1200 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1201               [  --enable-nntp           enable nntp protocol support])
1203 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1204               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1207 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1208               [  --disable-mouse         disable mouse support])
1210 # GPM mouse is Linux specific, so ...
1211 CONFIG_SYSMOUSE=yes
1212 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1213               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1214               [BSD sysmouse],
1215               [  --disable-sysmouse      disable BSD sysmouse support])
1217 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1218               [  --enable-88-colors      enable 88 color support])
1220 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1221               [  --enable-256-colors     enable 256 color support])
1224 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1225               [  --enable-exmode         enable exmode (CLI) interface])
1227 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1228               [  --disable-leds          disable LEDs support])
1230 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1231               [  --disable-marks         disable document marks support])
1234 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1235               [  --disable-css           disable Cascading Style Sheet support])
1237 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1238               [  --enable-html-highlight HTML highlighting using DOM engine])
1240 dnl Everything in the tree already uses CONFIG_DOM
1241 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1242 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1244 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1245               [  --disable-backtrace     disable backtrace support])
1247 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1248               [  --enable-no-root        enable prevention of usage by root])
1251 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1252               [  --enable-debug          enable leak debug and internal error checking])
1254 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1255               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1257 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1258               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1260 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1261               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1263 AC_ARG_ENABLE(weehoofooboomookerchoo,
1264               [
1265     Also check out the features.conf file for more information about features!
1266               ],
1267               [AC_MSG_ERROR(Are you strange, or what?)])
1270 dnl == EMX hack
1272 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1273 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1276 dnl ===================================================================
1277 dnl Export directory paths
1278 dnl ===================================================================
1280 # Set up the ``entry points'' if they were not supplied by builder
1281 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1282 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1284 # Create CONFDIR #define for config.h
1286 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1287 # it's autoconf fault to force us to do such hacks ;p.
1288 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1289   # sysconfdir is set to its default value... fine, let's append /elinks/
1290   # XXX: We can't modify listing of the default in ./configure --help :-(
1291   sysconfdir_n=`eval echo "$sysconfdir"`
1292   sysconfdir=$sysconfdir_n
1293   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1294         sysconfdir="$sysconfdir/elinks"
1297 CONFDIR=$sysconfdir
1298 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1299 AC_SUBST(CONFDIR)
1301 # Create LOCALEDIR #define for config.h
1302 LOCALEDIR=`eval echo "$datadir/locale"`
1303 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1304 AC_SUBST(LOCALEDIR)
1306 # Create LIBDIR #define for config.h
1307 LIBDIR=`eval echo "$libdir"`
1308 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1309 AC_SUBST(LIBDIR)
1311 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1312 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1314 dnl ===================================================================
1315 dnl A little fine tuning of gcc specific options (continued)
1316 dnl ===================================================================
1318 if test "x$ac_cv_prog_gcc" = "xyes"; then
1319   if test "$CONFIG_DEBUG" = "yes"; then
1320     dnl We want to see all warnings and live with none (in debug mode).
1321     CFLAGS="$CFLAGS -Werror"
1322   fi
1324   case "`$CC -dumpversion`" in
1325     3.0|3.1|3.2)
1326       # These should be ok using -Werror
1327       ;;
1328     3.*)
1329       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1330       # "dereferencing type-punned pointer will break strict-aliasing rules"
1331       # warnings. Disable them by not doing any strict-aliasing. The
1332       # alternative is just too ugly. Thanks gcc guys!! ;)
1333       CFLAGS="$CFLAGS -fno-strict-aliasing"
1334       ;;
1335     4.*)
1336       # Do not show warnings related to (char * | unsigned char *) type
1337       # difference.
1338       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1339       ;;
1340     *)
1341       # These should be ok using -Werror
1342       ;;
1343   esac
1346 # CFLAGS doesn't contain all compile flags. Some will be added only when
1347 # needed in the respective source directory. To get all compile flags
1348 # easily just add CPPFLAGS.
1349 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1351 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1352 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1354 dnl ===================================================================
1355 dnl Colored make output
1356 dnl ===================================================================
1358 if test $(`which tput` colors) -ge 4; then
1359         MAKE_COLOR=1
1360         AC_SUBST(MAKE_COLOR)
1363 dnl ===================================================================
1364 dnl Generated files
1365 dnl ===================================================================
1367 AC_OUTPUT([ \
1368  Makefile.config \
1369  contrib/elinks.spec \
1370  contrib/lua/hooks.lua \
1371  contrib/conv/w3m2links.awk \
1372  doc/man/man1/elinks.1 \
1373  src/intl/gettext/ref-add.sed \
1374  src/intl/gettext/ref-del.sed
1377 abs_srcdir="$(cd "$srcdir" && pwd)"
1378 # builddir is always absolute!
1379 if test "$abs_srcdir" != "$builddir"; then
1380         # Bootstrap the Makefile creation
1381         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1382         "$MAKE" "SRC=$abs_srcdir" init
1384         # Make cg-status ignore this build directory
1385         echo "*" > "$builddir/.gitignore"
1388 dnl ===================================================================
1389 dnl Configuration summary
1390 dnl ===================================================================
1392 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1393 cat features.log