elinks-0.11.4rc0
[elinks.git] / configure.in
blob2ea1a49c84c2c47fa264b01165a859c890038354
1 dnl Process this file with autoconf to produce a configure script.
3 dnl Autoconf 2.13 generates an incomplete config.h.in; see ELinks bug 936.
4 dnl Autoconf 2.59 is installed in the computer that generates our nightly
5 dnl snapshots, so we need to be compatible with that.
6 AC_PREREQ(2.59)
7 AC_INIT(src/main/main.c)
8 AC_CONFIG_AUX_DIR(config)
10 PACKAGE=elinks
11 VERSION=0.11.4rc0
12 AC_SUBST(PACKAGE)
13 AC_SUBST(VERSION)
14 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
15 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
16 AC_CONFIG_HEADERS(config.h)
18 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
19 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
20 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
22 MAKE=
24 for make in gnumake gmake make false; do
25         if test "x$MAKE" = x; then
26                 AC_PATH_PROGS(MAKE, "$make")
27         fi
28 done
30 builddir="`pwd`"
32 # Cleanup if we are configuring with a previous build in the tree
33 if test -e Makefile.config; then
34         AC_MSG_CHECKING([for previous build to clean])
35         "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
36         AC_MSG_RESULT(done)
39 dnl ===================================================================
40 dnl Load feature configuration file and start logging features.
41 dnl ===================================================================
43 features="features.conf"
44 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
45 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
46 echo "Feature summary:" > features.log
48 dnl ===================================================================
49 dnl Checks for programs.
50 dnl ===================================================================
52 AC_PROG_CC
53 AC_PROG_AWK
54 AC_PATH_PROGS(AWK, "$AWK")
55 AC_PROG_RANLIB
56 AC_PROG_INSTALL
58 AC_PATH_PROGS(GIT, "git")
59 AC_PATH_PROGS(SPARSE, "sparse")
61 CONFIG_ASCIIDOC="no"
62 CONFIG_POD2HTML="no"
63 CONFIG_XMLTO="no"
64 CONFIG_JW="no"
66 if test "x$CONFIG_DOC" != xno; then
67         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
68         if test "x$ASCIIDOC" != "x"; then
69                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
70                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
71                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
73                 echo > config.asciidoc-unsafe.txt
74                 if "$ASCIIDOC" --unsafe config.asciidoc-unsafe.txt >/dev/null 2>/dev/null; then
75                         ASCIIDOC_FLAGS=--unsafe
76                 fi
77                 rm config.asciidoc-unsafe.*
78         fi
80         AC_PATH_PROGS(XMLTO, "xmlto")
81         if test "x$XMLTO" != "x"; then
82                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
83                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
84                 EL_CONFIG(MAN_XMLTO, [man (groff)])
85         fi
87         AC_PATH_PROGS(JW, "jw")
88         if test "x$JW" != "x"; then
89                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
90                 EL_CONFIG(MANUAL_JW, [PDF])
91         fi
93         AC_PATH_PROGS(POD2HTML, "pod2html")
94         if test "x$POD2HTML" != "x"; then
95                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
96         fi
99 AC_SUBST(ASCIIDOC_FLAGS)
100 AC_SUBST(CONFIG_ASCIIDOC)
101 AC_SUBST(CONFIG_POD2HTML)
102 AC_SUBST(CONFIG_XMLTO)
103 AC_SUBST(CONFIG_JW)
105 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
106 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
107 EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
109 dnl gcc specific options (to be continued at the bottom of configure)
110 if test "x$ac_cv_prog_gcc" = "xyes"; then
111   dnl We want to see all warnings and live with none.
112   dnl We can't set up -Werror here as there may be some warnings in test
113   dnl suite of configure, and we don't want to fail them.
114   CFLAGS="$CFLAGS -Wall"
117 dnl ===================================================================
118 dnl Checks for special OSes.
119 dnl ===================================================================
121 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
122 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
124         AC_MSG_CHECKING([for $2])
126         for flag in $3; do
127                 AC_TRY_COMPILE(, [#ifndef $flag
128 kill me!
129 #endif ], $1=yes, $1=no)
130                 if test "[$]$1" = yes; then
131                         EL_CONFIG([$1], [$2])
132                         break
133                 fi
134         done
136         AC_MSG_RESULT([$]$1)
139 EL_CHECK_COMPILER_MACROS(CONFIG_BEOS, [BEOS], [__BEOS__])
140 AC_SUBST(CONFIG_BEOS)
142 EL_CHECK_COMPILER_MACROS(CONFIG_RISCOS, [RISCOS], [__riscos__])
143 AC_SUBST(CONFIG_RISCOS)
145 EL_CHECK_COMPILER_MACROS(CONFIG_WIN32, [WIN32], [_WIN32 __WIN32__])
146 AC_SUBST(CONFIG_WIN32)
148 EL_CHECK_COMPILER_MACROS(CONFIG_OS2, [EMX], [__EMX__])
149 AC_SUBST(CONFIG_OS2)
150 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
152 AC_MSG_CHECKING([for UNIX])
153 dnl FIXME: some depend kind of mechanism
154 if test "$CONFIG_BEOS" = no && \
155    test "$CONFIG_RISCOS" = no && \
156    test "$CONFIG_WIN32" = no && \
157    test "$CONFIG_OS2" = no; then
158         EL_CONFIG(CONFIG_UNIX, [UNIX])
159 else
160         CONFIG_UNIX=no
162 AC_MSG_RESULT($CONFIG_UNIX)
163 AC_SUBST(CONFIG_UNIX)
165 dnl ===================================================================
166 dnl Checks for header files.
167 dnl ===================================================================
169 AC_HEADER_DIRENT
170 AC_HEADER_STDC
171 AC_HEADER_SYS_WAIT
172 AC_HEADER_TIME
174 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
175 AC_CHECK_HEADERS(sigaction.h)
176 AC_CHECK_HEADERS(arpa/inet.h)
177 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
178 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
179 AC_CHECK_HEADERS(ifaddrs.h)
180 AC_CHECK_HEADERS(sys/cygwin.h io.h)
181 AC_CHECK_HEADERS(sys/fmutex.h)
182 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
183 AC_CHECK_HEADERS(sys/resource.h)
184 AC_CHECK_HEADERS(sys/select.h)
185 AC_CHECK_HEADERS(sys/signal.h)
186 AC_CHECK_HEADERS(sys/socket.h)
187 AC_CHECK_HEADERS(sys/time.h)
188 AC_CHECK_HEADERS(sys/utsname.h)
189 AC_CHECK_HEADERS(stdint.h inttypes.h)
190 AC_CHECK_HEADERS(locale.h pwd.h)
191 AC_CHECK_HEADERS(termios.h)
194 AC_CHECK_HEADERS(sys/un.h,
195         [CONFIG_INTERLINK=yes
196          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
197         [CONFIG_INTERLINK=no])
198 AC_SUBST(CONFIG_INTERLINK)
200 dnl ===================================================================
201 dnl Checks for typedefs, structures, and compiler characteristics.
202 dnl ===================================================================
204 AC_STRUCT_TM
205 AC_C_CONST
206 AC_C_INLINE
207 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
209 AC_SYS_LARGEFILE
210 AC_TYPE_SIZE_T
211 AC_TYPE_OFF_T
212 EL_CHECK_TYPE(ssize_t, int)
213 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
214 EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
215 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
216 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
217 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
219 AC_CHECK_SIZEOF(char, 1)
220 AC_CHECK_SIZEOF(short, 2)
221 AC_CHECK_SIZEOF(int, 4)
222 AC_CHECK_SIZEOF(long, 4)
223 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
224 test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
226 dnl Check for variadic macros
227 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
228                 [#include <stdio.h>
229                  #define a(b,c...) printf(b,##c)],
230                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
232 dnl Check for -rdynamic
233 dnl FIXME: This check doesn't work. Something to do with the compiler
234 dnl happily ignoring it and stderr not being checked for error messages.
235 AC_MSG_CHECKING([for -rdynamic])
236 LDFLAGS_X="$LDFLAGS"
237 LDFLAGS="$LDFLAGS -rdynamic"
238 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
239 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
240 AC_MSG_RESULT($have_rdynamic)
242 dnl ===================================================================
243 dnl Check for POSIX <regex.h>
244 dnl ===================================================================
246 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
248 dnl ===================================================================
249 dnl Checks for library functions.
250 dnl ===================================================================
252 AC_PROG_GCC_TRADITIONAL
253 AC_FUNC_MEMCMP
254 AC_FUNC_MMAP
255 AC_FUNC_STRFTIME
256 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
257 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
258 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
259 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
260 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
261 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
262 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
263 AC_CHECK_FUNCS(gettimeofday clock_gettime)
265 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
267 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
268 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
269 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
271 dnl These aren't probably needed now, as they are commented in links.h.
272 dnl I've no idea about their historical background, but I keep them here
273 dnl just in the case they will help later. --pasky
274 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
275 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
276 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
277 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
279 if test x"$HAVE_RAISE" = x; then
280         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
281                 AC_ERROR([Unable to emulate raise()])
282         fi
285 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
286 AC_TRY_LINK([#include <stdarg.h>
287 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
288 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
289 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
290         EL_DEFINE(HAVE_VA_COPY, __va_copy)
293 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
294 AC_TRY_LINK([#include <unistd.h>
295 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
296 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
297 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
298         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
301 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
302 AC_TRY_RUN([
303 #include <stdio.h>
304 #include <stdarg.h>
305 #include <stdlib.h>
306 #include <string.h>
308 char buf[8];
310 int bar(char *buf, const char *format, va_list ap)
312        return vsnprintf(buf, 0, format, ap);
315 void foo(const char *format, ...) {
316        va_list ap;
317        int len;
319        va_start(ap, format);
320        len = bar(buf, format, ap);
321        va_end(ap);
322        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
324        va_start(ap, format);
325        len = bar(buf, format, ap);
326        va_end(ap);
327        if ((len != 6) && (len != 7)) exit(1);
329        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
331        exit(0);
333 main() { foo("hello\n"); }
335 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
336 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
337         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
340 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
342 dnl ===================================================================
343 dnl Checks for libraries.
344 dnl ===================================================================
346 dnl Replace `main' with a function in -lsocket:
347 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
348 if test "$cf_result" = no; then
349         AC_CHECK_LIB(socket, socket)
352 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
353 if test "$cf_result" = no; then
354         AC_CHECK_LIB(socket, setsockopt)
357 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
358 if test "$cf_result" = no; then
359         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
360         if test "$cf_result" = no; then
361                 AC_CHECK_LIB(nsl, gethostbyname)
362         else
363                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
364         fi
367 dnl ===================================================================
368 dnl Checks for packaging specific options.
369 dnl ===================================================================
371 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
372             [ if test "$withval" != no && test "$withval" != yes; then
373                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
374               fi ])
376 dnl ===================================================================
377 dnl Checks for a libraries, optional even if installed.
378 dnl ===================================================================
380 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
381 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
383         AC_MSG_CHECKING([for $2 support])
385         if test "[$]$1" != no; then
386                 AC_MSG_RESULT(yes)
387                 EL_SAVE_FLAGS
388                 if test -n "$withval" && test -d "$withval"; then
389                         CFLAGS="$CFLAGS -I$withval/include";
390                         CPPFLAGS="$CPPFLAGS -I$withval/include";
391                         LDFLAGS="$LDFLAGS -L$withval/lib";
392                 fi
394                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
395                 if test "[$]$1" = yes; then
396                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
397                 fi
399                 if test "[$]$1" = yes; then
400                         EL_CONFIG([$1], [$2])
401                         LIBS="$LIBS -l$4"
402                 else
403                         if test -n "[$]WITHVAL_$1" &&
404                            test "[$]WITHVAL_$1" != xno; then
405                                 AC_MSG_ERROR([$2 not found])
406                         fi
407                         EL_RESTORE_FLAGS
408                 fi
409         else
410                 AC_MSG_RESULT(disabled)
411         fi
414 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
415 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
417         $1=yes
418         WITHVAL_$1=
420         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
421         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
423         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
425         EL_LOG_CONFIG([$1], [$2], [])
428 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
429         [  --without-gpm           disable gpm (mouse) support])
431 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
432         [  --without-zlib          disable zlib support])
434 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
435         [  --without-bzlib         disable bzlib support])
437 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
438         [  --without-idn           disable international domain names support])
440 dnl ===================================================================
441 dnl Bookmark and XBEL support
442 dnl ===================================================================
444 EL_SAVE_FLAGS
446 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
447               [  --disable-bookmarks     disable bookmark support])
449 # Check whether --enable-xbel or --disable-xbel was given.
450 if test "x${enable_xbel}" != xno; then
451         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
453         if test "$HAVE_LIBEXPAT" = yes; then
454                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
455                 if test "$HAVE_LIBEXPAT" = yes; then
456                         LIBS="$LIBS -lexpat"
457                 fi
458         fi
462 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
463               [XBEL bookmarks],
464               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
466 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
467         EL_RESTORE_FLAGS
470 dnl ===================================================================
471 dnl Checks for BSD sysmouse
472 dnl ===================================================================
474 HAVE_SYSMOUSE_HEADER="no"
476 # Either of these header files provides the (same) sysmouse interface
477 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
479 dnl ===================================================================
480 dnl Checks for OS/2
481 dnl ===================================================================
483 if test "$CONFIG_OS2" = yes; then
484         EL_CONFIG_OS2
487 dnl ===================================================================
488 dnl Checks for Win32
489 dnl ===================================================================
491 if test "$CONFIG_WIN32" = yes; then
492         EL_CONFIG_WIN32
495 dnl ===================================================================
496 dnl Check for SpiderMonkey, optional even if installed.
497 dnl ===================================================================
499 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
500             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
501 AC_MSG_CHECKING([for SpiderMonkey])
503 EL_SAVE_FLAGS
504 cf_result=no
506 if test -z "$disable_spidermonkey"; then
507         if test ! -d "$withval"; then
508                 withval="";
509         fi
510         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
511                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
512                         for spidermonkeylib in js smjs mozjs; do
513                                 if test "$cf_result" = no; then
514                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
516                                         if test ! -z "$spidermonkeydir"; then
517                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
518                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
519                                         fi
521                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
522                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
523                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
525                                         AC_TRY_LINK([#define XP_UNIX
526                                                      #include <jsapi.h>],
527                                                      [JS_GetImplementationVersion()],
528                                                      cf_result=yes, cf_result=no)
529                                 fi
530                         done
531                 done
532         done
535 AC_MSG_RESULT($cf_result)
537 if test "$cf_result" != yes; then
538         EL_RESTORE_FLAGS
539 else
540         EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
542         CFLAGS="$CFLAGS_X"
543         AC_SUBST(SPIDERMONKEY_LIBS)
544         AC_SUBST(SPIDERMONKEY_CFLAGS)
547 AC_SUBST(CONFIG_SPIDERMONKEY)
549 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
552 dnl ===================================================================
553 dnl Check for Guile, optional even if installed.
554 dnl ===================================================================
556 enable_guile="no";
558 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
559             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
561 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
562 # GUILE_FLAGS but I really don't want to require people to have Guile in order
563 # to compile CVS. Also, the macro seems to be really stupid regarding searching
564 # for Guile in $PATH etc. --pasky
566 AC_MSG_CHECKING([for Guile])
568 if test "$enable_guile" = "yes"; then
569         AC_MSG_RESULT(yes);
570         ## Based on the GUILE_FLAGS macro.
572         if test -d "$withval"; then
573                 GUILE_PATH="$withval:$PATH"
574         else
575                 GUILE_PATH="$PATH"
576         fi
578         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
580         ## First, let's just see if we can find Guile at all.
581         if test "$GUILE_CONFIG" != no; then
582                 cf_result="yes";
584                 GUILE_LIBS="`guile-config link`"
585                 GUILE_CFLAGS="`guile-config compile`"
586                 LIBS="$GUILE_LIBS $LIBS"
587                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
588                 EL_CONFIG(CONFIG_GUILE, [Guile])
589                 AC_SUBST(GUILE_CFLAGS)
590                 cat <<EOF
591 ***********************************************************************
592 The Guile support is incomplete and not so well integrated to ELinks
593 yet. That means, e.g., that you have no Guile console and there might
594 not be all the necessary hooks. Also, the Guile interface is not too
595 well tested (success stories heartily welcomed!).  See
596 src/scripting/guile/README for further details and hints.
597 ***********************************************************************
599         else
600                 if test -n "$withval" && test "x$withval" != xno; then
601                         AC_MSG_ERROR([Guile not found])
602                 else
603                         AC_MSG_WARN([Guile support disabled])
604                 fi
605         fi
606 else
607         AC_MSG_RESULT(no);
610 dnl ===================================================================
611 dnl Check for Perl
612 dnl ===================================================================
613 enable_perl="no";
615 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
616             [
617 if test "$withval" = yes; then
618         # FIXME: If withval is a valid directory append it to PATH
619         # so that you can specify one of several perl installations.
620         withval="";
621         enable_perl=yes;
623             ])
625 AC_MSG_CHECKING([for Perl])
627 cf_result=no
629 EL_SAVE_FLAGS
631 if test "$enable_perl" = "yes"; then
632         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
633         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
634         LIBS="$PERL_LIBS $LIBS"
635         CFLAGS="$PERL_CFLAGS $CFLAGS"
636         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
637         AC_TRY_LINK([
638 #include <EXTERN.h>
639 #include <perl.h>
640 #include <perlapi.h>
642                     [PerlInterpreter *my_perl = perl_alloc();],
643                     cf_result=yes, cf_result=no)
646 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
648 AC_MSG_CHECKING([whether POPpx works without an n_a variable])
649 AC_TRY_COMPILE([
650 #include <EXTERN.h>
651 #include <perl.h>
652 extern PerlInterpreter *my_perl;
654         [dSP; (void) POPpx;],
655         [AC_MSG_RESULT([yes])
656 AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
657                 [Define if using Perl 5.8.8 or later, where the "POPpx" macro
658 no longer needs an "n_a" variable like it did in 5.8.7])],
659         [AC_MSG_RESULT([no])])
661 if test "$cf_result" != "yes"; then
662         EL_RESTORE_FLAGS
663 else
664         EL_CONFIG(CONFIG_PERL, [Perl])
666         CFLAGS="$CFLAGS_X"
667         AC_SUBST(PERL_LIBS)
668         AC_SUBST(PERL_CFLAGS)
671 dnl ===================================================================
672 dnl Check for Python
673 dnl ===================================================================
674 enable_python="no";
676 AC_ARG_WITH(python, [  --with-python           enable Python support],
677             [
678 if test "$withval" = yes; then
679         # FIXME: If withval is a valid directory append it to PATH
680         # so that you can specify one of several Python installations.
681         withval="";
682         enable_python=yes;
683         cat <<EOF
684 ***********************************************************************
685 The Python support is incomplete and not so well integrated to ELinks
686 yet. That means, e.g.., that you have no Python console and there might
687 not be all the necessary hooks. Also, the Python interface is not too
688 well tested (success stories heartily welcomed!).
689 ***********************************************************************
692             ])
694 AC_MSG_CHECKING([for Python])
696 cf_result=no
698 EL_SAVE_FLAGS
700 if test "$enable_python" = "yes"; then
701         PYTHON_LIBS="-lpython`python -c 'from distutils import sysconfig; print sysconfig.get_config_var("VERSION")' 2> /dev/null`"
702         PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
703         LIBS="$PYTHON_LIBS $LIBS"
704         CFLAGS="$PYTHON_CFLAGS $CFLAGS"
705         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
706         AC_TRY_LINK([
707 #include <Python.h>
709                     [Py_Initialize();],
710                     cf_result=yes, cf_result=no)
713 if test "$cf_result" != "yes"; then
714         EL_RESTORE_FLAGS
715 else
716         EL_CONFIG(CONFIG_PYTHON, [Python])
718         CFLAGS="$CFLAGS_X"
719         AC_SUBST(PYTHON_LIBS)
720         AC_SUBST(PYTHON_CFLAGS)
723 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
726 dnl ===================================================================
727 dnl Check for Lua, optional even if installed.
728 dnl ===================================================================
730 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
731 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
733 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
734             [if test "$withval" = no; then disable_lua=yes; fi])
735 AC_MSG_CHECKING([for Lua])
737 EL_SAVE_FLAGS
738 cf_result=no
740 if test -z "$disable_lua"; then
741         if test ! -d "$withval"; then
742                 withval="";
743         fi
744         for luadir in "$withval" "" /usr /usr/local; do
745                 for suffix in "" 50 51; do
746                         if test "$cf_result" = no; then
747                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
749                                 if test ! -z "$luadir"; then
750                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
751                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
752                                 fi
754                                 LIBS="$LUA_LIBS $LIBS_X"
755                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
756                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
758                                 # Check that it is a compatible Lua version
759                                 AC_TRY_LINK([   #include <lua.h>
760                                                 #include <lualib.h>],
761                                             [   lua_State *L = lua_open();
762                                                 luaopen_base(L);
763                                                 luaopen_table(L);
764                                                 luaopen_io(L);
765                                                 luaopen_string(L);
766                                                 luaopen_math(L);
767                                                 lua_pushboolean(L, 1);
768                                                 lua_close(L);],
769                                             cf_result=yes, cf_result=no)
770                         fi
771                 done
772         done
775 AC_MSG_RESULT($cf_result)
777 if test "$cf_result" != yes; then
778         EL_RESTORE_FLAGS
779 else
780         EL_CONFIG(CONFIG_LUA, [Lua])
781         AC_CHECK_HEADERS(lauxlib.h)
783         CFLAGS="$CFLAGS_X"
784         AC_SUBST(LUA_LIBS)
785         AC_SUBST(LUA_CFLAGS)
789 dnl ===================================================================
790 dnl Check for Ruby, optional even if installed.
791 dnl ===================================================================
793 EL_CONFIG_RUBY
795 dnl ===================================================================
796 dnl Optional Spidermonkey-based ECMAScript browser scripting
797 dnl ===================================================================
799 AC_ARG_ENABLE(sm-scripting,
800               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
801               [if test "$enableval" != no; then enableval="yes"; fi
802                CONFIG_SM_SCRIPTING="$enableval";])
804 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
805    test "x$CONFIG_SM_SCRIPTING" = xyes; then
806         EL_CONFIG(CONFIG_SM_SCRIPTING, [SpiderMonkey])
807 else
808         CONFIG_SM_SCRIPTING=no
811 dnl ===================================================================
812 dnl Setup global scripting
813 dnl ===================================================================
815 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY CONFIG_SM_SCRIPTING], [Browser scripting])
816 AC_SUBST(CONFIG_GUILE)
817 AC_SUBST(CONFIG_LUA)
818 AC_SUBST(CONFIG_PERL)
819 AC_SUBST(CONFIG_PYTHON)
820 AC_SUBST(CONFIG_RUBY)
821 AC_SUBST(CONFIG_SM_SCRIPTING)
822 AC_SUBST(CONFIG_SCRIPTING)
825 dnl ===================================================================
826 dnl Check for SSL support.
827 dnl ===================================================================
829 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
830 dnl is enabled, we won't try to use OpenSSL anymore.
832 dnl For wiping SSL hooks..
833 #ifdef CONFIG_SSL
835 disable_openssl=""
836 disable_gnutls=""
837 enable_gnutls=""
839 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
840             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
841 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
842             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
843 gnutls_withval="$withval"
845 if test "$enable_gnutls" = yes; then
846         disable_openssl=yes;
849 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
850             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
851 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
852 openssl_withval="$withval"
854 dnl ---- OpenSSL
856 AC_MSG_CHECKING([for OpenSSL])
858 EL_SAVE_FLAGS
859 cf_result="no"
861 if test "$disable_openssl" = yes; then
862         cf_result="not used"
863 else
864         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
865                          /usr/lib/openssl /usr/local/ssl \
866                          /usr/local/www /usr/lib/ssl /usr/local \
867                          /usr/pkg /opt /opt/openssl; do
868                 if test "$cf_result" = no; then
869                         if test -d "$ssldir"; then
870                                 OPENSSL_CFLAGS="-I$ssldir/include"
871                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
872                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
873                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
874 #                               # FIXME: This created serious portability problems. --pasky
875 #                               if test "$CC" == "gcc"; then
876 #                                       # I'm not sure about compatibility here. --pasky
877 #                                       LIBS="$LIBS -R$ssldir/lib"
878 #                               fi
879                         else
880                                 LIBS="-lssl -lcrypto $LIBS_X"
881                         fi
882                         AC_TRY_LINK([#include <openssl/ssl.h>],
883                                     [OpenSSL_add_all_algorithms()],
884                                     cf_result=yes, cf_result=no)
885                         if test "$cf_result" != yes; then
886                                 AC_TRY_LINK([#include <openssl/ssl.h>],
887                                             [SSLeay_add_ssl_algorithms()],
888                                             cf_result=yes, cf_result=no)
889                         fi
890                 fi
891         done
893         if test "$cf_result" != yes; then
894                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
895                         AC_MSG_ERROR([OpenSSL not found])
896                 fi
897                 EL_RESTORE_FLAGS
898         else
899                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
901                 CFLAGS="$CFLAGS_X"
902                 AC_SUBST(OPENSSL_CFLAGS)
903         fi
906 AC_MSG_RESULT($cf_result)
908 CONFIG_GNUTLS_OPENSSL_COMPAT=no
909 dnl ---- GNU TLS
910 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
911 dnl it looks ugly then.
913 if test "$cf_result" = yes; then
914         cf_result="not used"
916 else
917         EL_SAVE_FLAGS
918         cf_result="no"
920         if test -z "$disable_gnutls"; then
921                 # Sure, we maybe _could_ use their macro, but how to ensure
922                 # that the ./configure script won't fail if the macro won't be
923                 # found..? :( --pasky
925                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
927                 if test -d "$gnutls_withval"; then
928                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
929                 fi
931                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
933                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
934                         cf_result=no
935                 else
936                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
937                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
939                         LIBS="$GNUTLS_LIBS $LIBS_X"
940                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
941                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
943                         # Verify if it's really usable.  gnutls_session was
944                         # renamed to gnutls_session_t before GNU TLS 1.2.0
945                         # (on 2004-06-13); ELinks now requires this.
946                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
947                                     [gnutls_session_t dummy;
948                                      gnutls_check_version(NULL)],
949                                     cf_result=yes, cf_result=no)
950                 fi
952                 if test "$cf_result" = yes; then
953                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
955                         CFLAGS="$CFLAGS_X"
956                         AC_SUBST(GNUTLS_CFLAGS)
958                         # Verify if the MD5 compatibility layer is usable.
959                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
960                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
961                                                   [GNU TLS OpenSSL compatibility],
962                                                   gnutls/openssl.h, gnutls-openssl,
963                                                   MD5_Init)
964                 else
965                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
966                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
967                         fi
968                         EL_RESTORE_FLAGS
969                 fi
970         fi
973 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
974 AC_MSG_RESULT($cf_result)
976 dnl Final SSL setup
978 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
979 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
980 AC_SUBST(CONFIG_OPENSSL)
981 AC_SUBST(CONFIG_GNUTLS)
983 #endif
985 AC_MSG_CHECKING([whether to be or not to be])
986 AC_MSG_RESULT([needs to be determined experimentally])
988 dnl ===================================================================
989 dnl Check for IPv6 support and related functions.
990 dnl ===================================================================
992 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
993 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
994 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
996 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
997 if test "$HAVE_GETADDRINFO" != yes; then
998         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
999         if test "$HAVE_GETADDRINFO" = yes; then
1000                 LIBS="$LIBS -linet6"
1001         fi
1005 dnl ===================================================================
1006 dnl Checking for X11 (window title restoring).
1007 dnl ===================================================================
1009 AC_PATH_X
1010 if test x"$no_x" != xyes; then
1011         EL_SAVE_FLAGS
1012         if test -n "$x_includes"; then
1013                 X_CFLAGS="-I$x_includes"
1014                 CPPFLAGS="$CPPFLAGS -I$x_includes"
1015         fi
1016         if test -n "$x_libraries"; then
1017                 LDFLAGS="$LDFLAGS -L$x_libraries"
1018         fi
1019         LIBS="-lX11 $LIBS"
1020         AC_TRY_LINK([#include <X11/Xlib.h>],[XrmInitialize()],
1021                 cf_result=yes, cf_result=no)
1022         EL_RESTORE_FLAGS
1023         if test "$cf_result" = yes; then
1024                 if test -n "$x_libraries"; then
1025                         LDFLAGS="$LDFLAGS -L$x_libraries"
1026                 fi
1027                 LIBS="-lX11 $LIBS"
1028                 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1029                 AC_SUBST(X_CFLAGS)
1030         fi
1034 dnl ===================================================================
1035 dnl Backtraces displaying support.
1036 dnl ===================================================================
1038 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1039 # possible checks for other system-specific means go here
1042 dnl ===================================================================
1043 dnl SMB protocol support.
1044 dnl ===================================================================
1046 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1049 dnl ===================================================================
1050 dnl Gettext grey zone. Beware.
1051 dnl ===================================================================
1053 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"
1055 AM_GNU_GETTEXT
1057 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1058 dnl # f33r d4 l33t... I hope it's portable. :)
1059 dnl cf_result=$((48#z - 48#a + 1));
1060 dnl AC_MSG_RESULT($cf_result)
1063 dnl ===================================================================
1064 dnl Compile-time features control
1065 dnl ===================================================================
1067 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1068               [  --disable-cookies       disable cookie support])
1070 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1071               [  --disable-formhist      disable form history support])
1073 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1074               [  --disable-globhist      disable global history support])
1077 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1078               [  --disable-mailcap       disable mailcap support])
1080 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1081               [  --disable-mimetypes     disable mimetypes files support])
1084 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1085               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1086               [IPv6],
1087               [  --disable-ipv6          disable IPv6 support])
1089 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1090               [  --enable-bittorrent     enable BitTorrent protocol support])
1092 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1093               [  --disable-data          disable data protocol support])
1095 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1096               [  --disable-uri-rewrite   disable URI rewrite support])
1098 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1099               [  --enable-cgi            enable local CGI support])
1101 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1102               [  --enable-finger         enable finger protocol support])
1104 dnl ===================================================================
1105 dnl FSP protocol
1106 dnl ===================================================================
1107 EL_SAVE_FLAGS
1109 if test "x${enable_fsp}" != xno; then
1110         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1112         if test "$HAVE_FSPLIB" = yes; then
1113                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1114                 if test "$HAVE_FSPLIB" = yes; then
1115                         LIBS="$LIBS -lfsplib"
1116                 else
1117                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1118                         if test "$HAVE_FSPLIB" = yes; then
1119                                 LIBS="$LIBS -lfsp"
1120                         fi
1121                 fi
1122         fi
1125 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1126               [  --enable-fsp            enable FSP protocol support])
1128 if test "x$CONFIG_FSP" = xno; then
1129         EL_RESTORE_FLAGS
1132 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1133               [  --disable-ftp           disable ftp protocol support])
1135 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1136               [  --enable-gopher         enable gopher protocol support])
1138 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1139               [  --enable-nntp           enable nntp protocol support])
1141 dnl Force disable SMB before EL_ARG_DEPEND so that it logs the correct value.
1142 if test "${enable_smb-no}" != no || test "${CONFIG_SMB-no}" != no; then
1143   AC_MSG_WARN([Forcing --disable-smb because of vulnerability CVE-2006-5925.
1144 If you want to use SMB, please wait for ELinks 0.12.0 or see bug 844.])
1146 enable_smb=no
1147 CONFIG_SMB=no
1148 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1149               [  --enable-smb            not currently allowed])
1150 dnl EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1151 dnl           [  --disable-smb           disable SMB protocol support (requires smbclient)])
1154 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1155               [  --disable-mouse         disable mouse support])
1157 # GPM mouse is Linux specific, so ...
1158 CONFIG_SYSMOUSE=yes
1159 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1160               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1161               [BSD sysmouse],
1162               [  --disable-sysmouse      disable BSD sysmouse support])
1164 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1165               [  --enable-88-colors      enable 88 color support])
1167 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1168               [  --enable-256-colors     enable 256 color support])
1171 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1172               [  --enable-exmode         enable exmode (CLI) interface])
1174 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1175               [  --disable-leds          disable LEDs support])
1177 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1178               [  --disable-marks         disable document marks support])
1181 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1182               [  --disable-css           disable Cascading Style Sheet support])
1184 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1185               [  --enable-html-highlight HTML highlighting using DOM engine])
1187 dnl Everything in the tree already uses CONFIG_DOM
1188 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1189 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1191 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1192               [  --disable-backtrace     disable backtrace support])
1194 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1195               [  --enable-no-root        enable prevention of usage by root])
1198 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1199               [  --enable-debug          enable leak debug and internal error checking])
1201 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1202               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1204 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1205               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1207 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1208               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1210 if test "$CONFIG_OPENSSL" != yes &&
1211    test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1212    test "$CONFIG_OWN_LIBC" = yes;
1213 then
1214         AC_MSG_CHECKING(for built-in MD5 support)
1215         AC_MSG_RESULT(yes)
1216         EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1219 AC_SUBST(CONFIG_MD5)
1221 if test "$CONFIG_BITTORRENT" = yes; then
1222         if test "$CONFIG_OPENSSL" != yes ||
1223            test "$CONFIG_OWN_LIBC" = yes;
1224         then
1225                 AC_MSG_CHECKING(for built-in SHA1 support)
1226                 AC_MSG_RESULT(yes)
1227                 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1228         fi
1231 AC_SUBST(CONFIG_SHA1)
1233 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1234 then
1235         EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1237 AC_SUBST(CONFIG_SCANNER)
1239 AC_ARG_ENABLE(weehoofooboomookerchoo,
1240               [
1241     Also check out the features.conf file for more information about features!
1242               ],
1243               [AC_MSG_ERROR(Are you strange, or what?)])
1246 dnl == EMX hack
1248 test "$CONFIG_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1249 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1252 dnl ===================================================================
1253 dnl Export directory paths
1254 dnl ===================================================================
1256 # Set up the ``entry points'' if they were not supplied by builder
1257 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1258 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1260 # Create CONFDIR #define for config.h
1262 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1263 # it's autoconf fault to force us to do such hacks ;p.
1264 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1265   # sysconfdir is set to its default value... fine, let's append /elinks/
1266   # XXX: We can't modify listing of the default in ./configure --help :-(
1267   sysconfdir_n=`eval echo "$sysconfdir"`
1268   sysconfdir=$sysconfdir_n
1269   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1270         sysconfdir="$sysconfdir/elinks"
1273 CONFDIR=$sysconfdir
1274 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1275 AC_SUBST(CONFDIR)
1277 # Create LOCALEDIR #define for config.h
1278 LOCALEDIR=`eval echo "$datadir/locale"`
1279 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1280 AC_SUBST(LOCALEDIR)
1282 # Create LIBDIR #define for config.h
1283 LIBDIR=`eval echo "$libdir"`
1284 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1285 AC_SUBST(LIBDIR)
1287 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1288 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1290 dnl ===================================================================
1291 dnl A little fine tuning of gcc specific options (continued)
1292 dnl ===================================================================
1294 if test "x$ac_cv_prog_gcc" = "xyes"; then
1295   if test "$CONFIG_DEBUG" = "yes"; then
1296     dnl We want to see all warnings and live with none (in debug mode).
1297     CFLAGS="$CFLAGS -Werror"
1298   fi
1300   case "`$CC -dumpversion`" in
1301     3.0|3.1|3.2)
1302       # These should be ok using -Werror
1303       ;;
1304     3.*)
1305       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1306       # "dereferencing type-punned pointer will break strict-aliasing rules"
1307       # warnings. Disable them by not doing any strict-aliasing. The
1308       # alternative is just too ugly. Thanks gcc guys!! ;)
1309       CFLAGS="$CFLAGS -fno-strict-aliasing"
1310       ;;
1311     4.*)
1312       # Do not show warnings related to (char * | unsigned char *) type
1313       # difference.
1314       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1315       ;;
1316     *)
1317       # These should be ok using -Werror
1318       ;;
1319   esac
1321   # GCC 4.2.1 warns if we use the address of an object in Boolean context:
1322   # warning: the address of `builtin_modules' will always evaluate as `true'
1323   # This hits the object_lock and foreach_module macros in particular.
1324   # It would be okay to put something in the macros to avoid the warning,
1325   # but currently this seems to require defining parallel macros that skip
1326   # the NULL check, and that's too ugly.  So we instead disable the warning.
1327   # GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
1328   # GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
1329   for warning_flag in -Wno-address -Wno-always-true; do
1330     AC_MSG_CHECKING([whether $CC accepts $warning_flag])
1331     EL_SAVE_FLAGS
1332     CFLAGS="$CFLAGS $warning_flag"
1333     AC_TRY_COMPILE([], [],
1334       [AC_MSG_RESULT([yes])
1335        break],
1336       [AC_MSG_RESULT([no])])
1337     EL_RESTORE_FLAGS
1338   done
1341 # CFLAGS doesn't contain all compile flags. Some will be added only when
1342 # needed in the respective source directory. To get all compile flags
1343 # easily just add CPPFLAGS.
1344 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1346 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1347 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1349 dnl ===================================================================
1350 dnl Colored make output
1351 dnl ===================================================================
1353 if test $(`which tput` colors) -ge 4; then
1354         MAKE_COLOR=1
1355         AC_SUBST(MAKE_COLOR)
1358 dnl ===================================================================
1359 dnl Generated files
1360 dnl ===================================================================
1362 AC_OUTPUT([ \
1363  Makefile.config \
1364  contrib/elinks.spec \
1365  contrib/lua/hooks.lua \
1366  contrib/conv/w3m2links.awk \
1367  doc/man/man1/elinks.1 \
1368  src/intl/gettext/ref-add.sed \
1369  src/intl/gettext/ref-del.sed
1372 abs_srcdir="$(cd "$srcdir" && pwd)"
1373 # builddir is always absolute!
1374 if test "$abs_srcdir" != "$builddir"; then
1375         # Bootstrap the Makefile creation
1376         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1377         "$MAKE" "SRC=$abs_srcdir" init
1378         # Make cg-status ignore this build directory
1379         echo "*" > "$builddir/.gitignore"
1383 dnl ===================================================================
1384 dnl Configuration summary
1385 dnl ===================================================================
1387 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1388 cat features.log