Removed *.html and fixed typos
[elinks.git] / configure.in
blobb87f00a74017bf77ab26b3a114b8904626f280d6
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; 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 dnl ===================================================================
454 dnl Bookmark and XBEL support
455 dnl ===================================================================
457 EL_SAVE_FLAGS
459 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
460               [  --disable-bookmarks     disable bookmark support])
462 # Check whether --enable-xbel or --disable-xbel was given.
463 if test "x${enable_xbel}" != xno; then
464         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
466         if test "$HAVE_LIBEXPAT" = yes; then
467                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
468                 if test "$HAVE_LIBEXPAT" = yes; then
469                         LIBS="$LIBS -lexpat"
470                 fi
471         fi
475 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
476               [XBEL bookmarks],
477               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
479 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
480         EL_RESTORE_FLAGS
483 dnl ===================================================================
484 dnl Checks for BSD sysmouse
485 dnl ===================================================================
487 HAVE_SYSMOUSE_HEADER="no"
489 # Either of these header files provides the (same) sysmouse interface
490 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
492 dnl ===================================================================
493 dnl Checks for OS/2
494 dnl ===================================================================
496 if test "$CONFIG_OS_OS2" = yes; then
497         EL_CONFIG_OS_OS2
500 dnl ===================================================================
501 dnl Checks for Win32
502 dnl ===================================================================
504 if test "$CONFIG_OS_WIN32" = yes; then
505         EL_CONFIG_OS_WIN32
508 dnl ===================================================================
509 dnl Check for SEE (Simple Ecmascript Engine)
510 dnl ===================================================================
511 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
512             [ if test "x$withval" != xno; then enable_see=yes; fi ])
514 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
515 # SEE_FLAGS but I really don't want to require people to have Guile in order
516 # to compile CVS. Also, the macro seems to be really stupid regarding searching
517 # for Guile in $PATH etc. --pasky
519 AC_MSG_CHECKING([for SEE])
521 CONFIG_ECMASCRIPT_SEE=no
523 if test "$enable_see" = "yes"; then
524         AC_MSG_RESULT(yes);
525         ## Based on the SEE_FLAGS macro.
527         if test -d "$withval"; then
528                 SEE_PATH="$withval:$PATH"
529         else
530                 SEE_PATH="$PATH"
531         fi
533         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
535         ## First, let's just see if we can find Guile at all.
536         if test "$SEE_CONFIG" != no; then
537                 cf_result="yes";
539                 SEE_LIBS="`$SEE_CONFIG --libs`"
540                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
541                 LIBS="$SEE_LIBS $LIBS"
542                 CPPFLAGS="$CPPFLAGS $SEE_CFLAGS"
543                 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
544                 AC_SUBST(SEE_CFLAGS)
545         else
546                 if test -n "$withval" && test "x$withval" != xno; then
547                         AC_MSG_ERROR([SEE not found])
548                 else
549                         AC_MSG_WARN([SEE support disabled])
550                 fi
551         fi
552 else
553         AC_MSG_RESULT(no);
557 dnl ===================================================================
558 dnl Check for SpiderMonkey, optional even if installed.
559 dnl ===================================================================
561 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
562             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
563 AC_MSG_CHECKING([for SpiderMonkey])
565 EL_SAVE_FLAGS
566 cf_result=no
568 if test -z "$disable_spidermonkey"; then
569         if test ! -d "$withval"; then
570                 withval="";
571         fi
572         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
573                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
574                         for spidermonkeylib in js smjs; do
575                                 if test "$cf_result" = no; then
576                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
578                                         if test ! -z "$spidermonkeydir"; then
579                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
580                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
581                                         fi
583                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
584                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
585                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
587                                         AC_TRY_LINK([#define XP_UNIX
588                                                      #include <jsapi.h>],
589                                                      [JS_GetImplementationVersion()],
590                                                      cf_result=yes, cf_result=no)
591                                 fi
592                         done
593                 done
594         done
597 AC_MSG_RESULT($cf_result)
598 CONFIG_SPIDERMONKEY="$cf_result"
599 EL_RESTORE_FLAGS
601 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
602    test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
603         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
604 else
605         CONFIG_ECMASCRIPT_SMJS=no
608 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
609 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
610 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
613 dnl ===================================================================
614 dnl Optional Spidermonkey-based ECMAScript browser scripting
615 dnl ===================================================================
617 AC_ARG_ENABLE(sm-scripting,
618               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
619               [if test "$enableval" != no; then enableval="yes"; fi
620                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
622 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
623    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
624         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
625 else
626         CONFIG_SCRIPTING_SPIDERMONKEY=no
629 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
630    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
631         LIBS="$LIBS $SPIDERMONKEY_LIBS"
632         AC_SUBST(SPIDERMONKEY_LIBS)
633         AC_SUBST(SPIDERMONKEY_CFLAGS)
634         AC_SUBST(CONFIG_SPIDERMONKEY)
637 dnl ===================================================================
638 dnl Check for Guile, optional even if installed.
639 dnl ===================================================================
641 enable_guile="no";
643 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
644             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
646 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
647 # GUILE_FLAGS but I really don't want to require people to have Guile in order
648 # to compile CVS. Also, the macro seems to be really stupid regarding searching
649 # for Guile in $PATH etc. --pasky
651 AC_MSG_CHECKING([for Guile])
653 if test "$enable_guile" = "yes"; then
654         AC_MSG_RESULT(yes);
655         ## Based on the GUILE_FLAGS macro.
657         if test -d "$withval"; then
658                 GUILE_PATH="$withval:$PATH"
659         else
660                 GUILE_PATH="$PATH"
661         fi
663         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
665         ## First, let's just see if we can find Guile at all.
666         if test "$GUILE_CONFIG" != no; then
667                 cf_result="yes";
669                 GUILE_LIBS="`guile-config link`"
670                 GUILE_CFLAGS="`guile-config compile`"
671                 LIBS="$GUILE_LIBS $LIBS"
672                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
673                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
674                 AC_SUBST(GUILE_CFLAGS)
675                 cat <<EOF
676 ***********************************************************************
677 The Guile support is incomplete and not so well integrated to ELinks
678 yet. That means, e.g., that you have no Guile console and there might
679 not be all the necessary hooks. Also, the Guile interface is not too
680 well tested (success stories heartily welcomed!).  See
681 src/scripting/guile/README for further details and hints.
682 ***********************************************************************
684         else
685                 if test -n "$withval" && test "x$withval" != xno; then
686                         AC_MSG_ERROR([Guile not found])
687                 else
688                         AC_MSG_WARN([Guile support disabled])
689                 fi
690         fi
691 else
692         AC_MSG_RESULT(no);
695 dnl ===================================================================
696 dnl Check for Perl
697 dnl ===================================================================
698 enable_perl="no";
700 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
701             [
702 if test "$withval" = yes; then
703         # FIXME: If withval is a valid directory append it to PATH
704         # so that you can specify one of several perl installations.
705         withval="";
706         enable_perl=yes;
708             ])
710 AC_MSG_CHECKING([for Perl])
712 cf_result=no
714 EL_SAVE_FLAGS
716 if test "$enable_perl" = "yes"; then
717         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
718         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
719         LIBS="$PERL_LIBS $LIBS"
720         CFLAGS="$PERL_CFLAGS $CFLAGS"
721         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
722         AC_TRY_LINK([
723 #include <EXTERN.h>
724 #include <perl.h>
725 #include <perlapi.h>
727                     [PerlInterpreter *my_perl = perl_alloc();],
728                     cf_result=yes, cf_result=no)
731 if test "$cf_result" != "yes"; then
732         EL_RESTORE_FLAGS
733 else
734         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
736         CFLAGS="$CFLAGS_X"
737         AC_SUBST(PERL_LIBS)
738         AC_SUBST(PERL_CFLAGS)
741 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
742 dnl ===================================================================
743 dnl Check for Python
744 dnl ===================================================================
745 enable_python="no";
747 AC_ARG_WITH(python, [  --with-python=[prefix]       enable Python support],
748             [
749 if test "$withval" != no; then
750         # FIXME: If withval is a valid directory append it to PATH
751         # so that you can specify one of several Python installations.
752         if test "$withval" != yes; then
753                 python_prefix="$withval"
754         else
755                 python_prefix=""
756         fi
757         enable_python=yes
758         cat <<EOF
759 ***********************************************************************
760 The Python support is incomplete and not so well integrated to ELinks
761 yet. That means, e.g.., that you have no Python console and there might
762 not be all the necessary hooks. Also, the Python interface is not too
763 well tested (success stories heartily welcomed!).
764 ***********************************************************************
767             ])
770 cf_result=no
772 EL_SAVE_FLAGS
774 if test "$enable_python" = "yes"; then
775         if test -n "$python_prefix" && test -d "$python_prefix/bin"; then
776                 PYTHON_PATH="$python_prefix/bin:$PATH"
777         else
778                 PYTHON_PATH="$PATH"
779         fi
780         AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
781         if test "$PYTHON" = "no" ; then
782                 cf_result=no
783         else
784                 PYTHON_CFLAGS="-I`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
785                 if test -n "$python_prefix" && test -d "$python_prefix/lib"; then
786                         PYTHON_LIBS="-L$python_prefix/lib -lpython"
787                 else
788                         PYTHON_LIBS="-lpython"
789                 fi
790                 LIBS="$PYTHON_LIBS $LIBS"
791                 CFLAGS="$PYTHON_CFLAGS $CFLAGS"
792                 AC_TRY_LINK([#include <Python.h>],
793                     [Py_Initialize();],
794                     cf_result=yes, cf_result=no)
796                 if test "$cf_result" != "yes"; then
797                         EL_RESTORE_FLAGS
798                 else
799                         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
801                         CFLAGS="$CFLAGS_X"
802                         AC_SUBST(PYTHON_LIBS)
803                         AC_SUBST(PYTHON_CFLAGS)
804                 fi
805         fi
808 AC_MSG_CHECKING([for Python])
809 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
812 dnl ===================================================================
813 dnl Check for Lua, optional even if installed.
814 dnl ===================================================================
816 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
817 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
819 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
820             [if test "$withval" = no; then disable_lua=yes; fi])
821 AC_MSG_CHECKING([for Lua])
823 EL_SAVE_FLAGS
824 cf_result=no
826 if test -z "$disable_lua"; then
827         if test ! -d "$withval"; then
828                 withval="";
829         fi
830         for luadir in "$withval" "" /usr /usr/local; do
831                 for suffix in "" 50 51; do
832                         if test "$cf_result" = no; then
833                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
835                                 if test ! -z "$luadir"; then
836                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
837                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
838                                 fi
840                                 LIBS="$LUA_LIBS $LIBS_X"
841                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
842                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
844                                 # Check that it is a compatible Lua version
845                                 AC_TRY_LINK([   #include <lua.h>
846                                                 #include <lualib.h>],
847                                             [   lua_State *L = lua_open();
848                                                 lua_baselibopen(L);
849                                                 lua_mathlibopen(L);
850                                                 lua_strlibopen(L);
851                                                 lua_tablibopen(L);
852                                                 lua_pushboolean(L, 1);
853                                                 lua_close(L);],
854                                             cf_result=yes, cf_result=no)
855                         fi
856                 done
857         done
860 AC_MSG_RESULT($cf_result)
862 if test "$cf_result" != yes; then
863         EL_RESTORE_FLAGS
864 else
865         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
866         AC_CHECK_HEADERS(lauxlib.h)
868         CFLAGS="$CFLAGS_X"
869         AC_SUBST(LUA_LIBS)
870         AC_SUBST(LUA_CFLAGS)
874 dnl ===================================================================
875 dnl Check for Ruby, optional even if installed.
876 dnl ===================================================================
878 EL_CONFIG_SCRIPTING_RUBY
880 dnl ===================================================================
881 dnl Setup global scripting
882 dnl ===================================================================
884 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])
885 AC_SUBST(CONFIG_SCRIPTING_GUILE)
886 AC_SUBST(CONFIG_SCRIPTING_LUA)
887 AC_SUBST(CONFIG_SCRIPTING_PERL)
888 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
889 AC_SUBST(CONFIG_SCRIPTING_RUBY)
890 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
891 AC_SUBST(CONFIG_SCRIPTING)
894 dnl ===================================================================
895 dnl Check for SSL support.
896 dnl ===================================================================
898 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
899 dnl is enabled, we won't try to use OpenSSL anymore.
901 dnl For wiping SSL hooks..
902 #ifdef CONFIG_SSL
904 disable_openssl=""
905 disable_gnutls=""
906 enable_gnutls=""
908 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
909             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
910 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
911             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
912 gnutls_withval="$withval"
914 if test "$enable_gnutls" = yes; then
915         disable_openssl=yes;
918 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
919             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
920 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
921 openssl_withval="$withval"
923 dnl ---- OpenSSL
925 AC_MSG_CHECKING([for OpenSSL])
927 EL_SAVE_FLAGS
928 cf_result="no"
930 if test "$disable_openssl" = yes; then
931         cf_result="not used"
932 else
933         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
934                          /usr/lib/openssl /usr/local/ssl \
935                          /usr/local/www /usr/lib/ssl /usr/local \
936                          /usr/pkg /opt /opt/openssl; do
937                 if test "$cf_result" = no; then
938                         if test -d "$ssldir"; then
939                                 OPENSSL_CFLAGS="-I$ssldir/include"
940                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
941                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
942                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
943 #                               # FIXME: This created serious portability problems. --pasky
944 #                               if test "$CC" == "gcc"; then
945 #                                       # I'm not sure about compatibility here. --pasky
946 #                                       LIBS="$LIBS -R$ssldir/lib"
947 #                               fi
948                         else
949                                 LIBS="-lssl -lcrypto $LIBS_X"
950                         fi
951                         AC_TRY_LINK([#include <openssl/ssl.h>],
952                                     [OpenSSL_add_all_algorithms()],
953                                     cf_result=yes, cf_result=no)
954                         if test "$cf_result" != yes; then
955                                 AC_TRY_LINK([#include <openssl/ssl.h>],
956                                             [SSLeay_add_ssl_algorithms()],
957                                             cf_result=yes, cf_result=no)
958                         fi
959                 fi
960         done
962         if test "$cf_result" != yes; then
963                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
964                         AC_MSG_ERROR([OpenSSL not found])
965                 fi
966                 EL_RESTORE_FLAGS
967         else
968                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
970                 CFLAGS="$CFLAGS_X"
971                 AC_SUBST(OPENSSL_CFLAGS)
972         fi
975 AC_MSG_RESULT($cf_result)
977 CONFIG_GNUTLS_OPENSSL_COMPAT=no
978 dnl ---- GNU TLS
979 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
980 dnl it looks ugly then.
982 if test "$cf_result" = yes; then
983         cf_result="not used"
985 else
986         EL_SAVE_FLAGS
987         cf_result="no"
989         if test -z "$disable_gnutls"; then
990                 # Sure, we maybe _could_ use their macro, but how to ensure
991                 # that the ./configure script won't fail if the macro won't be
992                 # found..? :( --pasky
994                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
996                 if test -d "$gnutls_withval"; then
997                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
998                 fi
1000                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1002                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1003                         cf_result=no
1004                 else
1005                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1006                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1008                         LIBS="$GNUTLS_LIBS $LIBS_X"
1009                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1010                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1012                         # Verify if it's really usable.  gnutls_session was
1013                         # renamed to gnutls_session_t before GNU TLS 1.2.0
1014                         # (on 2004-06-13); ELinks now requires this.
1015                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
1016                                     [gnutls_session_t dummy;
1017                                      gnutls_check_version(NULL)],
1018                                     cf_result=yes, cf_result=no)
1019                 fi
1021                 if test "$cf_result" = yes; then
1022                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1024                         CFLAGS="$CFLAGS_X"
1025                         AC_SUBST(GNUTLS_CFLAGS)
1027                         # Verify if the MD5 compatibility layer is usable.
1028                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
1029                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
1030                                                   [GNU TLS OpenSSL compatibility],
1031                                                   gnutls/openssl.h, gnutls-openssl,
1032                                                   MD5_Init)
1033                 else
1034                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1035                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1036                         fi
1037                         EL_RESTORE_FLAGS
1038                 fi
1039         fi
1042 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1043 AC_MSG_RESULT($cf_result)
1045 dnl Final SSL setup
1047 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1048 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1049 AC_SUBST(CONFIG_OPENSSL)
1050 AC_SUBST(CONFIG_GNUTLS)
1052 #endif
1054 AC_MSG_CHECKING([whether to be or not to be])
1055 AC_MSG_RESULT([needs to be determined experimentally])
1057 dnl ===================================================================
1058 dnl Check for IPv6 support and related functions.
1059 dnl ===================================================================
1061 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1062 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1063 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1065 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1066 if test "$HAVE_GETADDRINFO" != yes; then
1067         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1068         if test "$HAVE_GETADDRINFO" = yes; then
1069                 LIBS="$LIBS -linet6"
1070         fi
1074 dnl ===================================================================
1075 dnl Checking for X11 (window title restoring).
1076 dnl ===================================================================
1078 AC_PATH_X
1079 if test x"$no_x" != xyes; then
1080         if test -n "$x_includes"; then
1081                 X_CFLAGS="-I$x_includes"
1082                 CPPFLAGS="$CPPFLAGS -I$x_includes"
1083         fi
1084         if test -n "$x_libraries"; then
1085                 LDFLAGS="$LDFLAGS -L$x_libraries"
1086         fi
1087         LIBS="-lX11 $LIBS"
1088         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1089         AC_SUBST(X_CFLAGS)
1093 dnl ===================================================================
1094 dnl Backtraces displaying support.
1095 dnl ===================================================================
1097 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1098 # possible checks for other system-specific means go here
1101 dnl ===================================================================
1102 dnl SMB protocol support.
1103 dnl ===================================================================
1105 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1108 dnl ===================================================================
1109 dnl Gettext grey zone. Beware.
1110 dnl ===================================================================
1112 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"
1114 AM_GNU_GETTEXT
1116 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1117 dnl # f33r d4 l33t... I hope it's portable. :)
1118 dnl cf_result=$((48#z - 48#a + 1));
1119 dnl AC_MSG_RESULT($cf_result)
1122 dnl ===================================================================
1123 dnl Compile-time features control
1124 dnl ===================================================================
1126 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1127               [  --disable-cookies       disable cookie support])
1129 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1130               [  --disable-formhist      disable form history support])
1132 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1133               [  --disable-globhist      disable global history support])
1136 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1137               [  --disable-mailcap       disable mailcap support])
1139 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1140               [  --disable-mimetypes     disable mimetypes files support])
1143 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1144               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1145               [IPv6],
1146               [  --disable-ipv6          disable IPv6 support])
1148 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1149               [  --enable-bittorrent     enable BitTorrent protocol support])
1151 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1152               [  --disable-data          disable data protocol support])
1154 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1155               [  --disable-uri-rewrite   disable URI rewrite support])
1157 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1158               [  --enable-cgi            enable local CGI support])
1160 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1161               [  --enable-finger         enable finger protocol support])
1163 dnl ===================================================================
1164 dnl FSP protocol
1165 dnl ===================================================================
1166 EL_SAVE_FLAGS
1168 if test "x${enable_fsp}" != xno; then
1169         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1171         if test "$HAVE_FSPLIB" = yes; then
1172                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1173                 if test "$HAVE_FSPLIB" = yes; then
1174                         LIBS="$LIBS -lfsplib"
1175                 else
1176                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1177                         if test "$HAVE_FSPLIB" = yes; then
1178                                 LIBS="$LIBS -lfsp"
1179                         fi
1180                 fi
1181         fi
1184 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1185               [  --enable-fsp            enable FSP protocol support])
1187 if test "x$CONFIG_FSP" = xno; then
1188         EL_RESTORE_FLAGS
1191 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1192               [  --disable-ftp           disable ftp protocol support])
1194 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1195               [  --enable-gopher         enable gopher protocol support])
1197 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1198               [  --enable-nntp           enable nntp protocol support])
1200 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1201               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1204 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1205               [  --disable-mouse         disable mouse support])
1207 # GPM mouse is Linux specific, so ...
1208 CONFIG_SYSMOUSE=yes
1209 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1210               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1211               [BSD sysmouse],
1212               [  --disable-sysmouse      disable BSD sysmouse support])
1214 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1215               [  --enable-88-colors      enable 88 color support])
1217 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1218               [  --enable-256-colors     enable 256 color support])
1221 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1222               [  --enable-exmode         enable exmode (CLI) interface])
1224 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1225               [  --disable-leds          disable LEDs support])
1227 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1228               [  --disable-marks         disable document marks support])
1231 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1232               [  --disable-css           disable Cascading Style Sheet support])
1234 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1235               [  --enable-html-highlight HTML highlighting using DOM engine])
1237 dnl Everything in the tree already uses CONFIG_DOM
1238 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1239 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1241 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1242               [  --disable-backtrace     disable backtrace support])
1244 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1245               [  --enable-no-root        enable prevention of usage by root])
1248 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1249               [  --enable-debug          enable leak debug and internal error checking])
1251 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1252               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1254 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1255               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1257 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1258               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1260 AC_ARG_ENABLE(weehoofooboomookerchoo,
1261               [
1262     Also check out the features.conf file for more information about features!
1263               ],
1264               [AC_MSG_ERROR(Are you strange, or what?)])
1267 dnl == EMX hack
1269 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1270 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1273 dnl ===================================================================
1274 dnl Export directory paths
1275 dnl ===================================================================
1277 # Set up the ``entry points'' if they were not supplied by builder
1278 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1279 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1281 # Create CONFDIR #define for config.h
1283 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1284 # it's autoconf fault to force us to do such hacks ;p.
1285 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1286   # sysconfdir is set to its default value... fine, let's append /elinks/
1287   # XXX: We can't modify listing of the default in ./configure --help :-(
1288   sysconfdir_n=`eval echo "$sysconfdir"`
1289   sysconfdir=$sysconfdir_n
1290   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1291         sysconfdir="$sysconfdir/elinks"
1294 CONFDIR=$sysconfdir
1295 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1296 AC_SUBST(CONFDIR)
1298 # Create LOCALEDIR #define for config.h
1299 LOCALEDIR=`eval echo "$datadir/locale"`
1300 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1301 AC_SUBST(LOCALEDIR)
1303 # Create LIBDIR #define for config.h
1304 LIBDIR=`eval echo "$libdir"`
1305 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1306 AC_SUBST(LIBDIR)
1308 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1309 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1311 dnl ===================================================================
1312 dnl A little fine tuning of gcc specific options (continued)
1313 dnl ===================================================================
1315 if test "x$ac_cv_prog_gcc" = "xyes"; then
1316   if test "$CONFIG_DEBUG" = "yes"; then
1317     dnl We want to see all warnings and live with none (in debug mode).
1318     CFLAGS="$CFLAGS -Werror"
1319   fi
1321   case "`$CC -dumpversion`" in
1322     3.0|3.1|3.2)
1323       # These should be ok using -Werror
1324       ;;
1325     3.*)
1326       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1327       # "dereferencing type-punned pointer will break strict-aliasing rules"
1328       # warnings. Disable them by not doing any strict-aliasing. The
1329       # alternative is just too ugly. Thanks gcc guys!! ;)
1330       CFLAGS="$CFLAGS -fno-strict-aliasing"
1331       ;;
1332     4.*)
1333       # Do not show warnings related to (char * | unsigned char *) type
1334       # difference.
1335       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1336       ;;
1337     *)
1338       # These should be ok using -Werror
1339       ;;
1340   esac
1343 # CFLAGS doesn't contain all compile flags. Some will be added only when
1344 # needed in the respective source directory. To get all compile flags
1345 # easily just add CPPFLAGS.
1346 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1348 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1349 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1351 dnl ===================================================================
1352 dnl Colored make output
1353 dnl ===================================================================
1355 if test $(`which tput` colors) -ge 4; then
1356         MAKE_COLOR=1
1357         AC_SUBST(MAKE_COLOR)
1360 dnl ===================================================================
1361 dnl Generated files
1362 dnl ===================================================================
1364 AC_OUTPUT([ \
1365  Makefile.config \
1366  contrib/elinks.spec \
1367  contrib/lua/hooks.lua \
1368  contrib/conv/w3m2links.awk \
1369  doc/man/man1/elinks.1 \
1370  src/intl/gettext/ref-add.sed \
1371  src/intl/gettext/ref-del.sed
1374 abs_srcdir="$(cd "$srcdir" && pwd)"
1375 # builddir is always absolute!
1376 if test "$abs_srcdir" != "$builddir"; then
1377         # Bootstrap the Makefile creation
1378         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1379         "$MAKE" "SRC=$abs_srcdir" init
1381         # Make cg-status ignore this build directory
1382         echo "*" > "$builddir/.gitignore"
1385 dnl ===================================================================
1386 dnl Configuration summary
1387 dnl ===================================================================
1389 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1390 cat features.log