NEWS: mention Debian bug 380347
[elinks.git] / configure.in
blob835656c5f59e3cbd44d2f0dab9518f3e99024c15
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.11.3.GIT
9 AC_SUBST(PACKAGE)
10 AC_SUBST(VERSION)
11 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
12 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
13 AC_CONFIG_HEADERS(config.h)
15 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
16 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
17 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
19 MAKE=
21 for make in gnumake gmake make false; do
22         if test "x$MAKE" = x; then
23                 AC_PATH_PROGS(MAKE, "$make")
24         fi
25 done
27 builddir="`pwd`"
29 # Cleanup if we are configuring with a previous build in the tree
30 if test -e Makefile.config; then
31         AC_MSG_CHECKING([for previous build to clean])
32         "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
33         AC_MSG_RESULT(done)
36 dnl ===================================================================
37 dnl Load feature configuration file and start logging features.
38 dnl ===================================================================
40 features="features.conf"
41 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
42 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
43 echo "Feature summary:" > features.log
45 dnl ===================================================================
46 dnl Checks for programs.
47 dnl ===================================================================
49 AC_PROG_CC
50 AC_PROG_AWK
51 AC_PATH_PROGS(AWK, "$AWK")
52 AC_PROG_RANLIB
53 AC_PROG_INSTALL
55 AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id")
56 AC_PATH_PROGS(SPARSE, "sparse")
58 CONFIG_ASCIIDOC="no"
59 CONFIG_POD2HTML="no"
60 CONFIG_XMLTO="no"
61 CONFIG_JW="no"
63 if test "x$CONFIG_DOC" != xno; then
64         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
65         if test "x$ASCIIDOC" != "x"; then
66                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
67                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
68                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
70                 echo > config.asciidoc-unsafe.txt
71                 if "$ASCIIDOC" --unsafe config.asciidoc-unsafe.txt >/dev/null 2>/dev/null; then
72                         ASCIIDOC_FLAGS=--unsafe
73                 fi
74                 rm config.asciidoc-unsafe.*
75         fi
77         AC_PATH_PROGS(XMLTO, "xmlto")
78         if test "x$XMLTO" != "x"; then
79                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
80                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
81                 EL_CONFIG(MAN_XMLTO, [man (groff)])
82         fi
84         AC_PATH_PROGS(JW, "jw")
85         if test "x$JW" != "x"; then
86                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
87                 EL_CONFIG(MANUAL_JW, [PDF])
88         fi
90         AC_PATH_PROGS(POD2HTML, "pod2html")
91         if test "x$POD2HTML" != "x"; then
92                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
93         fi
96 AC_SUBST(ASCIIDOC_FLAGS)
97 AC_SUBST(CONFIG_ASCIIDOC)
98 AC_SUBST(CONFIG_POD2HTML)
99 AC_SUBST(CONFIG_XMLTO)
100 AC_SUBST(CONFIG_JW)
102 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
103 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
104 EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
106 dnl gcc specific options (to be continued at the bottom of configure)
107 if test "x$ac_cv_prog_gcc" = "xyes"; then
108   dnl We want to see all warnings and live with none.
109   dnl We can't set up -Werror here as there may be some warnings in test
110   dnl suite of configure, and we don't want to fail them.
111   CFLAGS="$CFLAGS -Wall"
114 dnl ===================================================================
115 dnl Checks for special OSes.
116 dnl ===================================================================
118 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
119 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
121         AC_MSG_CHECKING([for $2])
123         for flag in $3; do
124                 AC_TRY_COMPILE(, [#ifndef $flag
125 kill me!
126 #endif ], $1=yes, $1=no)
127                 if test "[$]$1" = yes; then
128                         EL_CONFIG([$1], [$2])
129                         break
130                 fi
131         done
133         AC_MSG_RESULT([$]$1)
136 EL_CHECK_COMPILER_MACROS(CONFIG_BEOS, [BEOS], [__BEOS__])
137 AC_SUBST(CONFIG_BEOS)
139 EL_CHECK_COMPILER_MACROS(CONFIG_RISCOS, [RISCOS], [__riscos__])
140 AC_SUBST(CONFIG_RISCOS)
142 EL_CHECK_COMPILER_MACROS(CONFIG_WIN32, [WIN32], [_WIN32 __WIN32__])
143 AC_SUBST(CONFIG_WIN32)
145 EL_CHECK_COMPILER_MACROS(CONFIG_OS2, [EMX], [__EMX__])
146 AC_SUBST(CONFIG_OS2)
147 test "$CONFIG_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_BEOS" = no && \
152    test "$CONFIG_RISCOS" = no && \
153    test "$CONFIG_WIN32" = no && \
154    test "$CONFIG_OS2" = no; then
155         EL_CONFIG(CONFIG_UNIX, [UNIX])
156 else
157         CONFIG_UNIX=no
159 AC_MSG_RESULT($CONFIG_UNIX)
160 AC_SUBST(CONFIG_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_SYS_TYPE(off_t, HAVE_OFF_T, [])
212 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
213 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
214 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
216 AC_CHECK_SIZEOF(char, 1)
217 AC_CHECK_SIZEOF(short, 2)
218 AC_CHECK_SIZEOF(int, 4)
219 AC_CHECK_SIZEOF(long, 4)
220 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
221 test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
223 dnl Check for variadic macros
224 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
225                 [#include <stdio.h>
226                  #define a(b,c...) printf(b,##c)],
227                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
229 dnl Check for -rdynamic
230 dnl FIXME: This check doesn't work. Something to do with the compiler
231 dnl happily ignoring it and stderr not being checked for error messages.
232 AC_MSG_CHECKING([for -rdynamic])
233 LDFLAGS_X="$LDFLAGS"
234 LDFLAGS="$LDFLAGS -rdynamic"
235 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
236 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
237 AC_MSG_RESULT($have_rdynamic)
239 dnl ===================================================================
240 dnl Check for POSIX <regex.h>
241 dnl ===================================================================
243 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
245 dnl ===================================================================
246 dnl Checks for library functions.
247 dnl ===================================================================
249 AC_PROG_GCC_TRADITIONAL
250 AC_FUNC_MEMCMP
251 AC_FUNC_MMAP
252 AC_FUNC_STRFTIME
253 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
254 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
255 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
256 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
257 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
258 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
259 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
260 AC_CHECK_FUNCS(gettimeofday clock_gettime)
262 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
264 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
265 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
266 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
268 dnl These aren't probably needed now, as they are commented in links.h.
269 dnl I've no idea about their historical background, but I keep them here
270 dnl just in the case they will help later. --pasky
271 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
272 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
273 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
274 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
276 if test x"$HAVE_RAISE" = x; then
277         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
278                 AC_ERROR([Unable to emulate raise()])
279         fi
282 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
283 AC_TRY_LINK([#include <stdarg.h>
284 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
285 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
286 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
287         EL_DEFINE(HAVE_VA_COPY, __va_copy)
290 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
291 AC_TRY_LINK([#include <unistd.h>
292 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
293 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
294 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
295         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
298 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
299 AC_TRY_RUN([
300 #include <stdio.h>
301 #include <stdarg.h>
302 #include <stdlib.h>
303 #include <string.h>
305 char buf[8];
307 int bar(char *buf, const char *format, va_list ap)
309        return vsnprintf(buf, 0, format, ap);
312 void foo(const char *format, ...) {
313        va_list ap;
314        int len;
316        va_start(ap, format);
317        len = bar(buf, format, ap);
318        va_end(ap);
319        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
321        va_start(ap, format);
322        len = bar(buf, format, ap);
323        va_end(ap);
324        if ((len != 6) && (len != 7)) exit(1);
326        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
328        exit(0);
330 main() { foo("hello\n"); }
332 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
333 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
334         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
337 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
339 dnl ===================================================================
340 dnl Checks for libraries.
341 dnl ===================================================================
343 dnl Replace `main' with a function in -lsocket:
344 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
345 if test "$cf_result" = no; then
346         AC_CHECK_LIB(socket, socket)
349 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
350 if test "$cf_result" = no; then
351         AC_CHECK_LIB(socket, setsockopt)
354 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
355 if test "$cf_result" = no; then
356         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
357         if test "$cf_result" = no; then
358                 AC_CHECK_LIB(nsl, gethostbyname)
359         else
360                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
361         fi
364 dnl ===================================================================
365 dnl Checks for packaging specific options.
366 dnl ===================================================================
368 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
369             [ if test "$withval" != no && test "$withval" != yes; then
370                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
371               fi ])
373 dnl ===================================================================
374 dnl Checks for a libraries, optional even if installed.
375 dnl ===================================================================
377 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
378 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
380         AC_MSG_CHECKING([for $2 support])
382         if test "[$]$1" != no; then
383                 AC_MSG_RESULT(yes)
384                 EL_SAVE_FLAGS
385                 if test -n "$withval" && test -d "$withval"; then
386                         CFLAGS="$CFLAGS -I$withval/include";
387                         CPPFLAGS="$CPPFLAGS -I$withval/include";
388                         LDFLAGS="$LDFLAGS -L$withval/lib";
389                 fi
391                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
392                 if test "[$]$1" = yes; then
393                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
394                 fi
396                 if test "[$]$1" = yes; then
397                         EL_CONFIG([$1], [$2])
398                         LIBS="$LIBS -l$4"
399                 else
400                         if test -n "[$]WITHVAL_$1" &&
401                            test "[$]WITHVAL_$1" != xno; then
402                                 AC_MSG_ERROR([$2 not found])
403                         fi
404                         EL_RESTORE_FLAGS
405                 fi
406         else
407                 AC_MSG_RESULT(disabled)
408         fi
411 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
412 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
414         $1=yes
415         WITHVAL_$1=
417         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
418         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
420         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
422         EL_LOG_CONFIG([$1], [$2], [])
425 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
426         [  --without-gpm           disable gpm (mouse) support])
428 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
429         [  --without-zlib          disable zlib support])
431 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
432         [  --without-bzlib         disable bzlib support])
434 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
435         [  --without-idn           disable international domain names support])
437 dnl ===================================================================
438 dnl Bookmark and XBEL support
439 dnl ===================================================================
441 EL_SAVE_FLAGS
443 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
444               [  --disable-bookmarks     disable bookmark support])
446 # Check whether --enable-xbel or --disable-xbel was given.
447 if test "x${enable_xbel}" != xno; then
448         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
450         if test "$HAVE_LIBEXPAT" = yes; then
451                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
452                 if test "$HAVE_LIBEXPAT" = yes; then
453                         LIBS="$LIBS -lexpat"
454                 fi
455         fi
459 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
460               [XBEL bookmarks],
461               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
463 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
464         EL_RESTORE_FLAGS
467 dnl ===================================================================
468 dnl Checks for BSD sysmouse
469 dnl ===================================================================
471 HAVE_SYSMOUSE_HEADER="no"
473 # Either of these header files provides the (same) sysmouse interface
474 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
476 dnl ===================================================================
477 dnl Checks for OS/2
478 dnl ===================================================================
480 if test "$CONFIG_OS2" = yes; then
481         EL_CONFIG_OS2
484 dnl ===================================================================
485 dnl Checks for Win32
486 dnl ===================================================================
488 if test "$CONFIG_WIN32" = yes; then
489         EL_CONFIG_WIN32
492 dnl ===================================================================
493 dnl Check for SpiderMonkey, optional even if installed.
494 dnl ===================================================================
496 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
497             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
498 AC_MSG_CHECKING([for SpiderMonkey])
500 EL_SAVE_FLAGS
501 cf_result=no
503 if test -z "$disable_spidermonkey"; then
504         if test ! -d "$withval"; then
505                 withval="";
506         fi
507         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
508                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
509                         for spidermonkeylib in js smjs; do
510                                 if test "$cf_result" = no; then
511                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
513                                         if test ! -z "$spidermonkeydir"; then
514                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
515                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
516                                         fi
518                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
519                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
520                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
522                                         AC_TRY_LINK([#define XP_UNIX
523                                                      #include <jsapi.h>],
524                                                      [JS_GetImplementationVersion()],
525                                                      cf_result=yes, cf_result=no)
526                                 fi
527                         done
528                 done
529         done
532 AC_MSG_RESULT($cf_result)
534 if test "$cf_result" != yes; then
535         EL_RESTORE_FLAGS
536 else
537         EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
539         CFLAGS="$CFLAGS_X"
540         AC_SUBST(SPIDERMONKEY_LIBS)
541         AC_SUBST(SPIDERMONKEY_CFLAGS)
544 AC_SUBST(CONFIG_SPIDERMONKEY)
546 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
549 dnl ===================================================================
550 dnl Check for Guile, optional even if installed.
551 dnl ===================================================================
553 enable_guile="no";
555 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
556             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
558 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
559 # GUILE_FLAGS but I really don't want to require people to have Guile in order
560 # to compile CVS. Also, the macro seems to be really stupid regarding searching
561 # for Guile in $PATH etc. --pasky
563 AC_MSG_CHECKING([for Guile])
565 if test "$enable_guile" = "yes"; then
566         AC_MSG_RESULT(yes);
567         ## Based on the GUILE_FLAGS macro.
569         if test -d "$withval"; then
570                 GUILE_PATH="$withval:$PATH"
571         else
572                 GUILE_PATH="$PATH"
573         fi
575         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
577         ## First, let's just see if we can find Guile at all.
578         if test "$GUILE_CONFIG" != no; then
579                 cf_result="yes";
581                 GUILE_LIBS="`guile-config link`"
582                 GUILE_CFLAGS="`guile-config compile`"
583                 LIBS="$GUILE_LIBS $LIBS"
584                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
585                 EL_CONFIG(CONFIG_GUILE, [Guile])
586                 AC_SUBST(GUILE_CFLAGS)
587                 cat <<EOF
588 ***********************************************************************
589 The Guile support is incomplete and not so well integrated to ELinks
590 yet. That means, e.g., that you have no Guile console and there might
591 not be all the necessary hooks. Also, the Guile interface is not too
592 well tested (success stories heartily welcomed!).  See
593 src/scripting/guile/README for further details and hints.
594 ***********************************************************************
596         else
597                 if test -n "$withval" && test "x$withval" != xno; then
598                         AC_MSG_ERROR([Guile not found])
599                 else
600                         AC_MSG_WARN([Guile support disabled])
601                 fi
602         fi
603 else
604         AC_MSG_RESULT(no);
607 dnl ===================================================================
608 dnl Check for Perl
609 dnl ===================================================================
610 enable_perl="no";
612 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
613             [
614 if test "$withval" = yes; then
615         # FIXME: If withval is a valid directory append it to PATH
616         # so that you can specify one of several perl installations.
617         withval="";
618         enable_perl=yes;
620             ])
622 AC_MSG_CHECKING([for Perl])
624 cf_result=no
626 EL_SAVE_FLAGS
628 if test "$enable_perl" = "yes"; then
629         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
630         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
631         LIBS="$PERL_LIBS $LIBS"
632         CFLAGS="$PERL_CFLAGS $CFLAGS"
633         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
634         AC_TRY_LINK([
635 #include <EXTERN.h>
636 #include <perl.h>
637 #include <perlapi.h>
639                     [PerlInterpreter *my_perl = perl_alloc();],
640                     cf_result=yes, cf_result=no)
643 if test "$cf_result" != "yes"; then
644         EL_RESTORE_FLAGS
645 else
646         EL_CONFIG(CONFIG_PERL, [Perl])
648         CFLAGS="$CFLAGS_X"
649         AC_SUBST(PERL_LIBS)
650         AC_SUBST(PERL_CFLAGS)
653 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
654 dnl ===================================================================
655 dnl Check for Python
656 dnl ===================================================================
657 enable_python="no";
659 AC_ARG_WITH(python, [  --with-python           enable Python support],
660             [
661 if test "$withval" = yes; then
662         # FIXME: If withval is a valid directory append it to PATH
663         # so that you can specify one of several Python installations.
664         withval="";
665         enable_python=yes;
666         cat <<EOF
667 ***********************************************************************
668 The Python support is incomplete and not so well integrated to ELinks
669 yet. That means, e.g.., that you have no Python console and there might
670 not be all the necessary hooks. Also, the Python interface is not too
671 well tested (success stories heartily welcomed!).
672 ***********************************************************************
675             ])
677 AC_MSG_CHECKING([for Python])
679 cf_result=no
681 EL_SAVE_FLAGS
683 if test "$enable_python" = "yes"; then
684         PYTHON_LIBS="-lpython`python -c 'from distutils import sysconfig; print sysconfig.get_config_var("VERSION")' 2> /dev/null`"
685         PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
686         LIBS="$PYTHON_LIBS $LIBS"
687         CFLAGS="$PYTHON_CFLAGS $CFLAGS"
688         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
689         AC_TRY_LINK([
690 #include <Python.h>
692                     [Py_Initialize();],
693                     cf_result=yes, cf_result=no)
696 if test "$cf_result" != "yes"; then
697         EL_RESTORE_FLAGS
698 else
699         EL_CONFIG(CONFIG_PYTHON, [Python])
701         CFLAGS="$CFLAGS_X"
702         AC_SUBST(PYTHON_LIBS)
703         AC_SUBST(PYTHON_CFLAGS)
706 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
709 dnl ===================================================================
710 dnl Check for Lua, optional even if installed.
711 dnl ===================================================================
713 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
714 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
716 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
717             [if test "$withval" = no; then disable_lua=yes; fi])
718 AC_MSG_CHECKING([for Lua])
720 EL_SAVE_FLAGS
721 cf_result=no
723 if test -z "$disable_lua"; then
724         if test ! -d "$withval"; then
725                 withval="";
726         fi
727         for luadir in "$withval" "" /usr /usr/local; do
728                 for suffix in "" 50 51; do
729                         if test "$cf_result" = no; then
730                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
732                                 if test ! -z "$luadir"; then
733                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
734                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
735                                 fi
737                                 LIBS="$LUA_LIBS $LIBS_X"
738                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
739                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
741                                 # Check that it is a compatible Lua version
742                                 AC_TRY_LINK([   #include <lua.h>
743                                                 #include <lualib.h>],
744                                             [   lua_State *L = lua_open();
745                                                 luaopen_base(L);
746                                                 luaopen_table(L);
747                                                 luaopen_io(L);
748                                                 luaopen_string(L);
749                                                 luaopen_math(L);
750                                                 lua_pushboolean(L, 1);
751                                                 lua_close(L);],
752                                             cf_result=yes, cf_result=no)
753                         fi
754                 done
755         done
758 AC_MSG_RESULT($cf_result)
760 if test "$cf_result" != yes; then
761         EL_RESTORE_FLAGS
762 else
763         EL_CONFIG(CONFIG_LUA, [Lua])
764         AC_CHECK_HEADERS(lauxlib.h)
766         CFLAGS="$CFLAGS_X"
767         AC_SUBST(LUA_LIBS)
768         AC_SUBST(LUA_CFLAGS)
772 dnl ===================================================================
773 dnl Check for Ruby, optional even if installed.
774 dnl ===================================================================
776 EL_CONFIG_RUBY
778 dnl ===================================================================
779 dnl Optional Spidermonkey-based ECMAScript browser scripting
780 dnl ===================================================================
782 AC_ARG_ENABLE(sm-scripting,
783               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
784               [if test "$enableval" != no; then enableval="yes"; fi
785                CONFIG_SM_SCRIPTING="$enableval";])
787 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
788    test "x$CONFIG_SM_SCRIPTING" = xyes; then
789         EL_CONFIG(CONFIG_SM_SCRIPTING, [SpiderMonkey])
790 else
791         CONFIG_SM_SCRIPTING=no
794 dnl ===================================================================
795 dnl Setup global scripting
796 dnl ===================================================================
798 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY CONFIG_SM_SCRIPTING], [Browser scripting])
799 AC_SUBST(CONFIG_GUILE)
800 AC_SUBST(CONFIG_LUA)
801 AC_SUBST(CONFIG_PERL)
802 AC_SUBST(CONFIG_PYTHON)
803 AC_SUBST(CONFIG_RUBY)
804 AC_SUBST(CONFIG_SM_SCRIPTING)
805 AC_SUBST(CONFIG_SCRIPTING)
808 dnl ===================================================================
809 dnl Check for SSL support.
810 dnl ===================================================================
812 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
813 dnl is enabled, we won't try to use OpenSSL anymore.
815 dnl For wiping SSL hooks..
816 #ifdef CONFIG_SSL
818 disable_openssl=""
819 disable_gnutls=""
820 enable_gnutls=""
822 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
823             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
824 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
825             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
826 gnutls_withval="$withval"
828 if test "$enable_gnutls" = yes; then
829         disable_openssl=yes;
832 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
833             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
834 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
835 openssl_withval="$withval"
837 dnl ---- OpenSSL
839 AC_MSG_CHECKING([for OpenSSL])
841 EL_SAVE_FLAGS
842 cf_result="no"
844 if test "$disable_openssl" = yes; then
845         cf_result="not used"
846 else
847         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
848                          /usr/lib/openssl /usr/local/ssl \
849                          /usr/local/www /usr/lib/ssl /usr/local \
850                          /usr/pkg /opt /opt/openssl; do
851                 if test "$cf_result" = no; then
852                         if test -d "$ssldir"; then
853                                 OPENSSL_CFLAGS="-I$ssldir/include"
854                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
855                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
856                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
857 #                               # FIXME: This created serious portability problems. --pasky
858 #                               if test "$CC" == "gcc"; then
859 #                                       # I'm not sure about compatibility here. --pasky
860 #                                       LIBS="$LIBS -R$ssldir/lib"
861 #                               fi
862                         else
863                                 LIBS="-lssl -lcrypto $LIBS_X"
864                         fi
865                         AC_TRY_LINK([#include <openssl/ssl.h>],
866                                     [OpenSSL_add_all_algorithms()],
867                                     cf_result=yes, cf_result=no)
868                         if test "$cf_result" != yes; then
869                                 AC_TRY_LINK([#include <openssl/ssl.h>],
870                                             [SSLeay_add_ssl_algorithms()],
871                                             cf_result=yes, cf_result=no)
872                         fi
873                 fi
874         done
876         if test "$cf_result" != yes; then
877                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
878                         AC_MSG_ERROR([OpenSSL not found])
879                 fi
880                 EL_RESTORE_FLAGS
881         else
882                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
884                 CFLAGS="$CFLAGS_X"
885                 AC_SUBST(OPENSSL_CFLAGS)
886         fi
889 AC_MSG_RESULT($cf_result)
891 CONFIG_GNUTLS_OPENSSL_COMPAT=no
892 dnl ---- GNU TLS
893 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
894 dnl it looks ugly then.
896 if test "$cf_result" = yes; then
897         cf_result="not used"
899 else
900         EL_SAVE_FLAGS
901         cf_result="no"
903         if test -z "$disable_gnutls"; then
904                 # Sure, we maybe _could_ use their macro, but how to ensure
905                 # that the ./configure script won't fail if the macro won't be
906                 # found..? :( --pasky
908                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
910                 if test -d "$gnutls_withval"; then
911                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
912                 fi
914                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
916                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
917                         cf_result=no
918                 else
919                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
920                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
922                         LIBS="$GNUTLS_LIBS $LIBS_X"
923                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
924                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
926                         # Verify if it's really usable.  gnutls_session was
927                         # renamed to gnutls_session_t before GNU TLS 1.2.0
928                         # (on 2004-06-13); ELinks now requires this.
929                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
930                                     [gnutls_session_t dummy;
931                                      gnutls_check_version(NULL)],
932                                     cf_result=yes, cf_result=no)
933                 fi
935                 if test "$cf_result" = yes; then
936                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
938                         CFLAGS="$CFLAGS_X"
939                         AC_SUBST(GNUTLS_CFLAGS)
941                         # Verify if the MD5 compatibility layer is usable.
942                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
943                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
944                                                   [GNU TLS OpenSSL compatibility],
945                                                   gnutls/openssl.h, gnutls-openssl,
946                                                   MD5_Init)
947                 else
948                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
949                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
950                         fi
951                         EL_RESTORE_FLAGS
952                 fi
953         fi
956 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
957 AC_MSG_RESULT($cf_result)
959 dnl Final SSL setup
961 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
962 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
963 AC_SUBST(CONFIG_OPENSSL)
964 AC_SUBST(CONFIG_GNUTLS)
966 #endif
968 AC_MSG_CHECKING([whether to be or not to be])
969 AC_MSG_RESULT([needs to be determined experimentally])
971 dnl ===================================================================
972 dnl Check for IPv6 support and related functions.
973 dnl ===================================================================
975 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
976 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
977 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
979 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
980 if test "$HAVE_GETADDRINFO" != yes; then
981         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
982         if test "$HAVE_GETADDRINFO" = yes; then
983                 LIBS="$LIBS -linet6"
984         fi
988 dnl ===================================================================
989 dnl Checking for X11 (window title restoring).
990 dnl ===================================================================
992 AC_PATH_X
993 if test x"$no_x" != xyes; then
994         if test -n "$x_includes"; then
995                 X_CFLAGS="-I$x_includes"
996                 CPPFLAGS="$CPPFLAGS -I$x_includes"
997         fi
998         if test -n "$x_libraries"; then
999                 LDFLAGS="$LDFLAGS -L$x_libraries"
1000         fi
1001         LIBS="-lX11 $LIBS"
1002         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1003         AC_SUBST(X_CFLAGS)
1007 dnl ===================================================================
1008 dnl Backtraces displaying support.
1009 dnl ===================================================================
1011 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1012 # possible checks for other system-specific means go here
1015 dnl ===================================================================
1016 dnl SMB protocol support.
1017 dnl ===================================================================
1019 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1022 dnl ===================================================================
1023 dnl Gettext grey zone. Beware.
1024 dnl ===================================================================
1026 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"
1028 AM_GNU_GETTEXT
1030 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1031 dnl # f33r d4 l33t... I hope it's portable. :)
1032 dnl cf_result=$((48#z - 48#a + 1));
1033 dnl AC_MSG_RESULT($cf_result)
1036 dnl ===================================================================
1037 dnl Compile-time features control
1038 dnl ===================================================================
1040 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1041               [  --disable-cookies       disable cookie support])
1043 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1044               [  --disable-formhist      disable form history support])
1046 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1047               [  --disable-globhist      disable global history support])
1050 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1051               [  --disable-mailcap       disable mailcap support])
1053 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1054               [  --disable-mimetypes     disable mimetypes files support])
1057 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1058               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1059               [IPv6],
1060               [  --disable-ipv6          disable IPv6 support])
1062 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1063               [  --enable-bittorrent     enable BitTorrent protocol support])
1065 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1066               [  --disable-data          disable data protocol support])
1068 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1069               [  --disable-uri-rewrite   disable URI rewrite support])
1071 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1072               [  --enable-cgi            enable local CGI support])
1074 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1075               [  --enable-finger         enable finger protocol support])
1077 dnl ===================================================================
1078 dnl FSP protocol
1079 dnl ===================================================================
1080 EL_SAVE_FLAGS
1082 if test "x${enable_fsp}" != xno; then
1083         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1085         if test "$HAVE_FSPLIB" = yes; then
1086                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1087                 if test "$HAVE_FSPLIB" = yes; then
1088                         LIBS="$LIBS -lfsplib"
1089                 else
1090                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1091                         if test "$HAVE_FSPLIB" = yes; then
1092                                 LIBS="$LIBS -lfsp"
1093                         fi
1094                 fi
1095         fi
1098 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1099               [  --enable-fsp            enable FSP protocol support])
1101 if test "x$CONFIG_FSP" = xno; then
1102         EL_RESTORE_FLAGS
1105 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1106               [  --disable-ftp           disable ftp protocol support])
1108 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1109               [  --enable-gopher         enable gopher protocol support])
1111 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1112               [  --enable-nntp           enable nntp protocol support])
1114 dnl Force disable SMB before EL_ARG_DEPEND so that it logs the correct value.
1115 if test "${enable_smb-no}" != no || test "${CONFIG_SMB-no}" != no; then
1116   AC_MSG_WARN([Forcing --disable-smb because of vulnerability CVE-2006-5925.
1117 If you want to use SMB, please vote for bug 844 or post a patch.])
1119 enable_smb=no
1120 CONFIG_SMB=no
1121 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1122               [  --enable-smb            not currently allowed])
1123 dnl EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1124 dnl           [  --disable-smb           disable SMB protocol support (requires smbclient)])
1127 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1128               [  --disable-mouse         disable mouse support])
1130 # GPM mouse is Linux specific, so ...
1131 CONFIG_SYSMOUSE=yes
1132 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1133               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1134               [BSD sysmouse],
1135               [  --disable-sysmouse      disable BSD sysmouse support])
1137 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1138               [  --enable-88-colors      enable 88 color support])
1140 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1141               [  --enable-256-colors     enable 256 color support])
1144 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1145               [  --enable-exmode         enable exmode (CLI) interface])
1147 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1148               [  --disable-leds          disable LEDs support])
1150 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1151               [  --disable-marks         disable document marks support])
1154 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1155               [  --disable-css           disable Cascading Style Sheet support])
1157 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1158               [  --enable-html-highlight HTML highlighting using DOM engine])
1160 dnl Everything in the tree already uses CONFIG_DOM
1161 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1162 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1164 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1165               [  --disable-backtrace     disable backtrace support])
1167 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1168               [  --enable-no-root        enable prevention of usage by root])
1171 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1172               [  --enable-debug          enable leak debug and internal error checking])
1174 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1175               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1177 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1178               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1180 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1181               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1183 if test "$CONFIG_OPENSSL" != yes &&
1184    test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1185    test "$CONFIG_OWN_LIBC" = yes;
1186 then
1187         AC_MSG_CHECKING(for built-in MD5 support)
1188         AC_MSG_RESULT(yes)
1189         EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1192 AC_SUBST(CONFIG_MD5)
1194 if test "$CONFIG_BITTORRENT" = yes; then
1195         if test "$CONFIG_OPENSSL" != yes ||
1196            test "$CONFIG_OWN_LIBC" = yes;
1197         then
1198                 AC_MSG_CHECKING(for built-in SHA1 support)
1199                 AC_MSG_RESULT(yes)
1200                 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1201         fi
1204 AC_SUBST(CONFIG_SHA1)
1206 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1207 then
1208         EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1210 AC_SUBST(CONFIG_SCANNER)
1212 AC_ARG_ENABLE(weehoofooboomookerchoo,
1213               [
1214     Also check out the features.conf file for more information about features!
1215               ],
1216               [AC_MSG_ERROR(Are you strange, or what?)])
1219 dnl == EMX hack
1221 test "$CONFIG_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1222 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1225 dnl ===================================================================
1226 dnl Export directory paths
1227 dnl ===================================================================
1229 # Set up the ``entry points'' if they were not supplied by builder
1230 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1231 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1233 # Create CONFDIR #define for config.h
1235 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1236 # it's autoconf fault to force us to do such hacks ;p.
1237 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1238   # sysconfdir is set to its default value... fine, let's append /elinks/
1239   # XXX: We can't modify listing of the default in ./configure --help :-(
1240   sysconfdir_n=`eval echo "$sysconfdir"`
1241   sysconfdir=$sysconfdir_n
1242   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1243         sysconfdir="$sysconfdir/elinks"
1246 CONFDIR=$sysconfdir
1247 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1248 AC_SUBST(CONFDIR)
1250 # Create LOCALEDIR #define for config.h
1251 LOCALEDIR=`eval echo "$datadir/locale"`
1252 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1253 AC_SUBST(LOCALEDIR)
1255 # Create LIBDIR #define for config.h
1256 LIBDIR=`eval echo "$libdir"`
1257 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1258 AC_SUBST(LIBDIR)
1260 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1261 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1263 dnl ===================================================================
1264 dnl A little fine tuning of gcc specific options (continued)
1265 dnl ===================================================================
1267 if test "x$ac_cv_prog_gcc" = "xyes"; then
1268   if test "$CONFIG_DEBUG" = "yes"; then
1269     dnl We want to see all warnings and live with none (in debug mode).
1270     CFLAGS="$CFLAGS -Werror"
1271   fi
1273   case "`$CC -dumpversion`" in
1274     3.0|3.1|3.2)
1275       # These should be ok using -Werror
1276       ;;
1277     3.*)
1278       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1279       # "dereferencing type-punned pointer will break strict-aliasing rules"
1280       # warnings. Disable them by not doing any strict-aliasing. The
1281       # alternative is just too ugly. Thanks gcc guys!! ;)
1282       CFLAGS="$CFLAGS -fno-strict-aliasing"
1283       ;;
1284     4.*)
1285       # Do not show warnings related to (char * | unsigned char *) type
1286       # difference.
1287       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1288       ;;
1289     *)
1290       # These should be ok using -Werror
1291       ;;
1292   esac
1295 # CFLAGS doesn't contain all compile flags. Some will be added only when
1296 # needed in the respective source directory. To get all compile flags
1297 # easily just add CPPFLAGS.
1298 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1300 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1301 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1303 dnl ===================================================================
1304 dnl Colored make output
1305 dnl ===================================================================
1307 if test $(`which tput` colors) -ge 4; then
1308         MAKE_COLOR=1
1309         AC_SUBST(MAKE_COLOR)
1312 dnl ===================================================================
1313 dnl Generated files
1314 dnl ===================================================================
1316 AC_OUTPUT([ \
1317  Makefile.config \
1318  contrib/elinks.spec \
1319  contrib/lua/hooks.lua \
1320  contrib/conv/w3m2links.awk \
1321  doc/man/man1/elinks.1 \
1322  src/intl/gettext/ref-add.sed \
1323  src/intl/gettext/ref-del.sed
1326 abs_srcdir="$(cd "$srcdir" && pwd)"
1327 # builddir is always absolute!
1328 if test "$abs_srcdir" != "$builddir"; then
1329         # Bootstrap the Makefile creation
1330         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1331         "$MAKE" "SRC=$abs_srcdir" init
1332         # Make cg-status ignore this build directory
1333         echo "*" > "$builddir/.gitignore"
1337 dnl ===================================================================
1338 dnl Configuration summary
1339 dnl ===================================================================
1341 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1342 cat features.log