Replace --'s so they do not get translated to —
[elinks.git] / configure.in
blobea9118485f0a094d197fd3448d196f773d751df7
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.13)
4 AC_INIT(src/main/main.c)
5 AC_CONFIG_AUX_DIR(config)
7 PACKAGE=elinks
8 VERSION=0.12.GIT
9 AC_SUBST(PACKAGE)
10 AC_SUBST(VERSION)
11 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
12 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
13 AC_CONFIG_HEADERS(config.h)
15 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
16 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
17 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
19 MAKE=
21 for make in gnumake gmake make false; do
22         if test "x$MAKE" = x; then
23                 AC_PATH_PROGS(MAKE, "$make")
24         fi
25 done
27 builddir="`pwd`"
29 # Cleanup if we are configuring with a previous build in the tree
30 if test -e Makefile.config; then
31         AC_MSG_CHECKING([for previous build to clean])
32         "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
33         AC_MSG_RESULT(done)
36 dnl ===================================================================
37 dnl Load feature configuration file and start logging features.
38 dnl ===================================================================
40 features="features.conf"
41 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
42 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
43 echo "Feature summary:" > features.log
45 dnl ===================================================================
46 dnl Checks for programs.
47 dnl ===================================================================
49 AC_PROG_CC
50 AC_PROG_AWK
51 AC_PATH_PROGS(AWK, "$AWK")
52 AC_PROG_RANLIB
53 AC_PROG_INSTALL
55 AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id")
56 AC_PATH_PROGS(SPARSE, "sparse")
58 CONFIG_ASCIIDOC="no"
59 CONFIG_POD2HTML="no"
60 CONFIG_XMLTO="no"
61 CONFIG_JW="no"
63 if test "x$CONFIG_DOC" != xno; then
64         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
65         if test "x$ASCIIDOC" != "x"; then
66                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
67                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
68                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
69         fi
71         AC_PATH_PROGS(XMLTO, "xmlto")
72         if test "x$XMLTO" != "x"; then
73                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
74                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
75                 EL_CONFIG(MAN_XMLTO, [man (groff)])
76         fi
78         AC_PATH_PROGS(JW, "jw")
79         if test "x$JW" != "x"; then
80                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
81                 EL_CONFIG(MANUAL_JW, [PDF])
82         fi
84         AC_PATH_PROGS(POD2HTML, "pod2html")
85         if test "x$POD2HTML" != "x"; then
86                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
87         fi
90 AC_SUBST(CONFIG_ASCIIDOC)
91 AC_SUBST(CONFIG_POD2HTML)
92 AC_SUBST(CONFIG_XMLTO)
93 AC_SUBST(CONFIG_JW)
95 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation])
97 if test "$CONFIG_ASCIIDOC" = yes &&
98    test "$CONFIG_XMLTO" = yes &&
99    test "$CONFIG_JW" = yes; then
100         EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
103 if test "$CONFIG_ASCIIDOC" = yes &&
104    test "$CONFIG_XMLTO" = yes; then
105         EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
108 AC_SUBST(CONFIG_ASCIIDOC)
109 AC_SUBST(CONFIG_POD2HTML)
110 AC_SUBST(CONFIG_XMLTO)
111 AC_SUBST(CONFIG_JW)
113 dnl gcc specific options (to be continued at the bottom of configure)
114 if test "x$ac_cv_prog_gcc" = "xyes"; then
115   dnl We want to see all warnings and live with none.
116   dnl We can't set up -Werror here as there may be some warnings in test
117   dnl suite of configure, and we don't want to fail them.
118   CFLAGS="$CFLAGS -Wall"
121 dnl ===================================================================
122 dnl Checks for special OSes.
123 dnl ===================================================================
125 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
126 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
128         AC_MSG_CHECKING([for $2])
130         for flag in $3; do
131                 AC_TRY_COMPILE(, [#ifndef $flag
132 kill me!
133 #endif ], $1=yes, $1=no)
134                 if test "[$]$1" = yes; then
135                         EL_CONFIG([$1], [$2])
136                         break
137                 fi
138         done
140         AC_MSG_RESULT([$]$1)
143 EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
144 AC_SUBST(CONFIG_OS_BEOS)
146 EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
147 AC_SUBST(CONFIG_OS_RISCOS)
149 EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
150 AC_SUBST(CONFIG_OS_WIN32)
152 EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
153 AC_SUBST(CONFIG_OS_OS2)
154 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
156 AC_MSG_CHECKING([for UNIX])
157 dnl FIXME: some depend kind of mechanism
158 if test "$CONFIG_OS_BEOS" = no && \
159    test "$CONFIG_OS_RISCOS" = no && \
160    test "$CONFIG_OS_WIN32" = no && \
161    test "$CONFIG_OS_OS2" = no; then
162         EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
163 else
164         CONFIG_OS_UNIX=no
166 AC_MSG_RESULT($CONFIG_OS_UNIX)
167 AC_SUBST(CONFIG_OS_UNIX)
169 dnl ===================================================================
170 dnl Checks for header files.
171 dnl ===================================================================
173 AC_HEADER_DIRENT
174 AC_HEADER_STDC
175 AC_HEADER_SYS_WAIT
176 AC_HEADER_TIME
178 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
179 AC_CHECK_HEADERS(sigaction.h)
180 AC_CHECK_HEADERS(arpa/inet.h)
181 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
182 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
183 AC_CHECK_HEADERS(ifaddrs.h)
184 AC_CHECK_HEADERS(sys/cygwin.h io.h)
185 AC_CHECK_HEADERS(sys/fmutex.h)
186 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
187 AC_CHECK_HEADERS(sys/resource.h)
188 AC_CHECK_HEADERS(sys/select.h)
189 AC_CHECK_HEADERS(sys/signal.h)
190 AC_CHECK_HEADERS(sys/socket.h)
191 AC_CHECK_HEADERS(sys/time.h)
192 AC_CHECK_HEADERS(sys/utsname.h)
193 AC_CHECK_HEADERS(stdint.h inttypes.h)
194 AC_CHECK_HEADERS(locale.h pwd.h)
195 AC_CHECK_HEADERS(termios.h)
198 AC_CHECK_HEADERS(sys/un.h,
199         [CONFIG_INTERLINK=yes
200          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
201         [CONFIG_INTERLINK=no])
202 AC_SUBST(CONFIG_INTERLINK)
204 dnl ===================================================================
205 dnl Checks for typedefs, structures, and compiler characteristics.
206 dnl ===================================================================
208 AC_STRUCT_TM
209 AC_C_CONST
210 AC_C_INLINE
211 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
213 AC_SYS_LARGEFILE
214 AC_TYPE_SIZE_T
215 AC_TYPE_OFF_T
216 EL_CHECK_TYPE(ssize_t, int)
217 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
218 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
219 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
220 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
222 AC_CHECK_SIZEOF(char, 1)
223 AC_CHECK_SIZEOF(short, 2)
224 AC_CHECK_SIZEOF(int, 4)
225 AC_CHECK_SIZEOF(long, 4)
226 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
228 dnl Check for variadic macros
229 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
230                 [#include <stdio.h>
231                  #define a(b,c...) printf(b,##c)],
232                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
234 dnl Check for -rdynamic
235 dnl FIXME: This check doesn't work. Something to do with the compiler
236 dnl happily ignoring it and stderr not being checked for error messages.
237 AC_MSG_CHECKING([for -rdynamic])
238 LDFLAGS_X="$LDFLAGS"
239 LDFLAGS="$LDFLAGS -rdynamic"
240 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
241 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
242 AC_MSG_RESULT($have_rdynamic)
244 dnl ===================================================================
245 dnl Check for POSIX <regex.h>
246 dnl ===================================================================
248 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
250 dnl ===================================================================
251 dnl Checks for library functions.
252 dnl ===================================================================
254 AC_PROG_GCC_TRADITIONAL
255 AC_FUNC_MEMCMP
256 AC_FUNC_MMAP
257 AC_FUNC_STRFTIME
258 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
259 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
260 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
261 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
262 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
263 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
264 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
265 AC_CHECK_FUNCS(gettimeofday clock_gettime)
267 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
269 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
270 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
271 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
273 dnl These aren't probably needed now, as they are commented in links.h.
274 dnl I've no idea about their historical background, but I keep them here
275 dnl just in the case they will help later. --pasky
276 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
277 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
278 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
279 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
281 if test x"$HAVE_RAISE" = x; then
282         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
283                 AC_ERROR([Unable to emulate raise()])
284         fi
287 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
288 AC_TRY_LINK([#include <stdarg.h>
289 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
290 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
291 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
292         EL_DEFINE(HAVE_VA_COPY, __va_copy)
295 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
296 AC_TRY_LINK([#include <unistd.h>
297 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
298 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
299 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
300         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
303 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
304 AC_TRY_RUN([
305 #include <stdio.h>
306 #include <stdarg.h>
307 #include <stdlib.h>
308 #include <string.h>
310 char buf[8];
312 int bar(char *buf, const char *format, va_list ap)
314        return vsnprintf(buf, 0, format, ap);
317 void foo(const char *format, ...) {
318        va_list ap;
319        int len;
321        va_start(ap, format);
322        len = bar(buf, format, ap);
323        va_end(ap);
324        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
326        va_start(ap, format);
327        len = bar(buf, format, ap);
328        va_end(ap);
329        if ((len != 6) && (len != 7)) exit(1);
331        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
333        exit(0);
335 main() { foo("hello\n"); }
337 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
338 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
339         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
342 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
344 dnl ===================================================================
345 dnl Checks for libraries.
346 dnl ===================================================================
348 dnl Replace `main' with a function in -lsocket:
349 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
350 if test "$cf_result" = no; then
351         AC_CHECK_LIB(socket, socket)
354 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
355 if test "$cf_result" = no; then
356         AC_CHECK_LIB(socket, setsockopt)
359 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
360 if test "$cf_result" = no; then
361         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
362         if test "$cf_result" = no; then
363                 AC_CHECK_LIB(nsl, gethostbyname)
364         else
365                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
366         fi
369 dnl ===================================================================
370 dnl Checks for packaging specific options.
371 dnl ===================================================================
373 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
374             [ if test "$withval" != no && test "$withval" != yes; then
375                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
376               fi ])
378 dnl ===================================================================
379 dnl Checks for a libraries, optional even if installed.
380 dnl ===================================================================
382 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
383 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
385         AC_MSG_CHECKING([for $2 support])
387         if test "[$]$1" != no; then
388                 AC_MSG_RESULT(yes)
389                 EL_SAVE_FLAGS
390                 if test -n "$withval" && test -d "$withval"; then
391                         CFLAGS="$CFLAGS -I$withval/include";
392                         CPPFLAGS="$CPPFLAGS -I$withval/include";
393                         LDFLAGS="$LDFLAGS -L$withval/lib";
394                 fi
396                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
397                 if test "[$]$1" = yes; then
398                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
399                 fi
401                 if test "[$]$1" = yes; then
402                         EL_CONFIG([$1], [$2])
403                         LIBS="$LIBS -l$4"
404                 else
405                         if test -n "[$]WITHVAL_$1" &&
406                            test "[$]WITHVAL_$1" != xno; then
407                                 AC_MSG_ERROR([$2 not found])
408                         fi
409                         EL_RESTORE_FLAGS
410                 fi
411         else
412                 AC_MSG_RESULT(disabled)
413         fi
416 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
417 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
419         $1=yes
420         WITHVAL_$1=
422         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
423         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
425         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
427         EL_LOG_CONFIG([$1], [$2], [])
430 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
431         [  --without-gpm           disable gpm (mouse) support])
433 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
434         [  --without-zlib          disable zlib support])
436 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
437         [  --without-bzlib         disable bzlib support])
439 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
440         [  --without-idn           disable international domain names support])
442 dnl ===================================================================
443 dnl Bookmark and XBEL support
444 dnl ===================================================================
446 EL_SAVE_FLAGS
448 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
449               [  --disable-bookmarks     disable bookmark support])
451 # Check whether --enable-xbel or --disable-xbel was given.
452 if test "x${enable_xbel}" != xno; then
453         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
455         if test "$HAVE_LIBEXPAT" = yes; then
456                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
457                 if test "$HAVE_LIBEXPAT" = yes; then
458                         LIBS="$LIBS -lexpat"
459                 fi
460         fi
464 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
465               [XBEL bookmarks],
466               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
468 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
469         EL_RESTORE_FLAGS
472 dnl ===================================================================
473 dnl Checks for BSD sysmouse
474 dnl ===================================================================
476 HAVE_SYSMOUSE_HEADER="no"
478 # Either of these header files provides the (same) sysmouse interface
479 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
481 dnl ===================================================================
482 dnl Checks for OS/2
483 dnl ===================================================================
485 if test "$CONFIG_OS_OS2" = yes; then
486         EL_CONFIG_OS_OS2
489 dnl ===================================================================
490 dnl Checks for Win32
491 dnl ===================================================================
493 if test "$CONFIG_OS_WIN32" = yes; then
494         EL_CONFIG_OS_WIN32
497 dnl ===================================================================
498 dnl Check for SEE (Simple Ecmascript Engine)
499 dnl ===================================================================
500 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
501             [ if test "x$withval" != xno; then enable_see=yes; fi ])
503 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
504 # SEE_FLAGS but I really don't want to require people to have Guile in order
505 # to compile CVS. Also, the macro seems to be really stupid regarding searching
506 # for Guile in $PATH etc. --pasky
508 AC_MSG_CHECKING([for SEE])
510 if test "$enable_see" = "yes"; then
511         AC_MSG_RESULT(yes);
512         ## Based on the SEE_FLAGS macro.
514         if test -d "$withval"; then
515                 SEE_PATH="$withval:$PATH"
516         else
517                 SEE_PATH="$PATH"
518         fi
520         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
522         ## First, let's just see if we can find Guile at all.
523         if test "$SEE_CONFIG" != no; then
524                 cf_result="yes";
526                 SEE_LIBS="`$SEE_CONFIG --libs`"
527                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
528                 LIBS="$SEE_LIBS $LIBS"
529                 CPPFLAGS="$CPPFLAGS $SEE_CFLAGS"
530                 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
531                 AC_SUBST(SEE_CFLAGS)
532                 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
533         else
534                 if test -n "$withval" && test "x$withval" != xno; then
535                         AC_MSG_ERROR([SEE not found])
536                 else
537                         AC_MSG_WARN([SEE support disabled])
538                 fi
539         fi
540 else
541         AC_MSG_RESULT(no);
545 dnl ===================================================================
546 dnl Check for SpiderMonkey, optional even if installed.
547 dnl ===================================================================
549 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
550             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
551 AC_MSG_CHECKING([for SpiderMonkey])
553 EL_SAVE_FLAGS
554 cf_result=no
556 if test -z "$disable_spidermonkey"; then
557         if test ! -d "$withval"; then
558                 withval="";
559         fi
560         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
561                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
562                         for spidermonkeylib in js smjs; do
563                                 if test "$cf_result" = no; then
564                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
566                                         if test ! -z "$spidermonkeydir"; then
567                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
568                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
569                                         fi
571                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
572                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
573                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
575                                         AC_TRY_LINK([#define XP_UNIX
576                                                      #include <jsapi.h>],
577                                                      [JS_GetImplementationVersion()],
578                                                      cf_result=yes, cf_result=no)
579                                 fi
580                         done
581                 done
582         done
585 AC_MSG_RESULT($cf_result)
587 if test "$cf_result" != yes; then
588         EL_RESTORE_FLAGS
589 else
590         EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
592         CFLAGS="$CFLAGS_X"
593         AC_SUBST(SPIDERMONKEY_LIBS)
594         AC_SUBST(SPIDERMONKEY_CFLAGS)
597 if test "$CONFIG_SPIDERMONKEY" = yes &&
598    test "$CONFIG_ECMASCRIPT_SEE" != yes; then
599         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
602 AC_SUBST(CONFIG_SPIDERMONKEY)
603 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
605 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
608 dnl ===================================================================
609 dnl Optional Spidermonkey-based ECMAScript browser scripting
610 dnl ===================================================================
612 AC_ARG_ENABLE(sm-scripting,
613               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
614               [if test "$enableval" != no; then enableval="yes"; fi
615                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
617 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
618    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
619         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
620 else
621         CONFIG_SCRIPTING_SPIDERMONKEY=no
625 dnl ===================================================================
626 dnl Check for Guile, optional even if installed.
627 dnl ===================================================================
629 enable_guile="no";
631 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
632             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
634 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
635 # GUILE_FLAGS but I really don't want to require people to have Guile in order
636 # to compile CVS. Also, the macro seems to be really stupid regarding searching
637 # for Guile in $PATH etc. --pasky
639 AC_MSG_CHECKING([for Guile])
641 if test "$enable_guile" = "yes"; then
642         AC_MSG_RESULT(yes);
643         ## Based on the GUILE_FLAGS macro.
645         if test -d "$withval"; then
646                 GUILE_PATH="$withval:$PATH"
647         else
648                 GUILE_PATH="$PATH"
649         fi
651         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
653         ## First, let's just see if we can find Guile at all.
654         if test "$GUILE_CONFIG" != no; then
655                 cf_result="yes";
657                 GUILE_LIBS="`guile-config link`"
658                 GUILE_CFLAGS="`guile-config compile`"
659                 LIBS="$GUILE_LIBS $LIBS"
660                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
661                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
662                 AC_SUBST(GUILE_CFLAGS)
663                 cat <<EOF
664 ***********************************************************************
665 The Guile support is incomplete and not so well integrated to ELinks
666 yet. That means, ie., that you have no Guile console and there might
667 not be all the necessary hooks. Also, the Guile interface is not too
668 well tested (success stories heartily welcomed!).  See
669 src/scripting/guile/README for further details and hints.
670 ***********************************************************************
672         else
673                 if test -n "$withval" && test "x$withval" != xno; then
674                         AC_MSG_ERROR([Guile not found])
675                 else
676                         AC_MSG_WARN([Guile support disabled])
677                 fi
678         fi
679 else
680         AC_MSG_RESULT(no);
683 dnl ===================================================================
684 dnl Check for Perl
685 dnl ===================================================================
686 enable_perl="no";
688 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
689             [
690 if test "$withval" = yes; then
691         # FIXME: If withval is a valid directory append it to PATH
692         # so that you can specify one of several perl installations.
693         withval="";
694         enable_perl=yes;
696             ])
698 AC_MSG_CHECKING([for Perl])
700 cf_result=no
702 EL_SAVE_FLAGS
704 if test "$enable_perl" = "yes"; then
705         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
706         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
707         LIBS="$PERL_LIBS $LIBS"
708         CFLAGS="$PERL_CFLAGS $CFLAGS"
709         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
710         AC_TRY_LINK([
711 #include <EXTERN.h>
712 #include <perl.h>
713 #include <perlapi.h>
715                     [PerlInterpreter *my_perl = perl_alloc();],
716                     cf_result=yes, cf_result=no)
719 if test "$cf_result" != "yes"; then
720         EL_RESTORE_FLAGS
721 else
722         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
724         CFLAGS="$CFLAGS_X"
725         AC_SUBST(PERL_LIBS)
726         AC_SUBST(PERL_CFLAGS)
729 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
730 dnl ===================================================================
731 dnl Check for Python
732 dnl ===================================================================
733 enable_python="no";
735 AC_ARG_WITH(python, [  --with-python           enable Python support],
736             [
737 if test "$withval" = yes; then
738         # FIXME: If withval is a valid directory append it to PATH
739         # so that you can specify one of several Python installations.
740         withval="";
741         enable_python=yes;
742         cat <<EOF
743 ***********************************************************************
744 The Python support is incomplete and not so well integrated to ELinks
745 yet. That means, ie., that you have no Python console and there might
746 not be all the necessary hooks. Also, the Python interface is not too
747 well tested (success stories heartily welcomed!).
748 ***********************************************************************
751             ])
753 AC_MSG_CHECKING([for Python])
755 cf_result=no
757 EL_SAVE_FLAGS
759 if test "$enable_python" = "yes"; then
760         PYTHON_LIBS="-lpython"
761         PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
762         LIBS="$PYTHON_LIBS $LIBS"
763         CFLAGS="$PYTHON_CFLAGS $CFLAGS"
764         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
765         AC_TRY_LINK([
766 #include <Python.h>
768                     [Py_Initialize();],
769                     cf_result=yes, cf_result=no)
772 if test "$cf_result" != "yes"; then
773         EL_RESTORE_FLAGS
774 else
775         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
777         CFLAGS="$CFLAGS_X"
778         AC_SUBST(PYTHON_LIBS)
779         AC_SUBST(PYTHON_CFLAGS)
782 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
785 dnl ===================================================================
786 dnl Check for Lua, optional even if installed.
787 dnl ===================================================================
789 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
790 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
792 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
793             [if test "$withval" = no; then disable_lua=yes; fi])
794 AC_MSG_CHECKING([for Lua])
796 EL_SAVE_FLAGS
797 cf_result=no
799 if test -z "$disable_lua"; then
800         if test ! -d "$withval"; then
801                 withval="";
802         fi
803         for luadir in "$withval" "" /usr /usr/local; do
804                 for suffix in "" 50 51; do
805                         if test "$cf_result" = no; then
806                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
808                                 if test ! -z "$luadir"; then
809                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
810                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
811                                 fi
813                                 LIBS="$LUA_LIBS $LIBS_X"
814                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
815                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
817                                 # Check that it is a compatible Lua version
818                                 AC_TRY_LINK([   #include <lua.h>
819                                                 #include <lualib.h>],
820                                             [   lua_State *L = lua_open();
821                                                 lua_baselibopen(L);
822                                                 lua_mathlibopen(L);
823                                                 lua_strlibopen(L);
824                                                 lua_tablibopen(L);
825                                                 lua_pushboolean(L, 1);
826                                                 lua_close(L);],
827                                             cf_result=yes, cf_result=no)
828                         fi
829                 done
830         done
833 AC_MSG_RESULT($cf_result)
835 if test "$cf_result" != yes; then
836         EL_RESTORE_FLAGS
837 else
838         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
839         AC_CHECK_HEADERS(lauxlib.h)
841         CFLAGS="$CFLAGS_X"
842         AC_SUBST(LUA_LIBS)
843         AC_SUBST(LUA_CFLAGS)
847 dnl ===================================================================
848 dnl Check for Ruby, optional even if installed.
849 dnl ===================================================================
851 EL_CONFIG_SCRIPTING_RUBY
853 dnl ===================================================================
854 dnl Setup global scripting
855 dnl ===================================================================
857 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_SCRIPTING_GUILE CONFIG_SCRIPTING_LUA CONFIG_SCRIPTING_PERL CONFIG_SCRIPTING_PYTHON CONFIG_SCRIPTING_RUBY CONFIG_SCRIPTING_SPIDERMONKEY], [Browser scripting])
858 AC_SUBST(CONFIG_SCRIPTING_GUILE)
859 AC_SUBST(CONFIG_SCRIPTING_LUA)
860 AC_SUBST(CONFIG_SCRIPTING_PERL)
861 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
862 AC_SUBST(CONFIG_SCRIPTING_RUBY)
863 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
864 AC_SUBST(CONFIG_SCRIPTING)
867 dnl ===================================================================
868 dnl Check for SSL support.
869 dnl ===================================================================
871 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
872 dnl is enabled, we won't try to use OpenSSL anymore.
874 dnl For wiping SSL hooks..
875 #ifdef CONFIG_SSL
877 disable_openssl=""
878 disable_gnutls=""
879 enable_gnutls=""
881 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
882             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
883 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
884             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
885 gnutls_withval="$withval"
887 if test "$enable_gnutls" = yes; then
888         disable_openssl=yes;
891 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
892             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
893 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
894 openssl_withval="$withval"
896 dnl ---- OpenSSL
898 AC_MSG_CHECKING([for OpenSSL])
900 EL_SAVE_FLAGS
901 cf_result="no"
903 if test "$disable_openssl" = yes; then
904         cf_result="not used"
905 else
906         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
907                          /usr/lib/openssl /usr/local/ssl \
908                          /usr/local/www /usr/lib/ssl /usr/local \
909                          /usr/pkg /opt /opt/openssl; do
910                 if test "$cf_result" = no; then
911                         if test -d "$ssldir"; then
912                                 OPENSSL_CFLAGS="-I$ssldir/include"
913                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
914                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
915                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
916 #                               # FIXME: This created serious portability problems. --pasky
917 #                               if test "$CC" == "gcc"; then
918 #                                       # I'm not sure about compatibility here. --pasky
919 #                                       LIBS="$LIBS -R$ssldir/lib"
920 #                               fi
921                         else
922                                 LIBS="-lssl -lcrypto $LIBS_X"
923                         fi
924                         AC_TRY_LINK([#include <openssl/ssl.h>],
925                                     [OpenSSL_add_all_algorithms()],
926                                     cf_result=yes, cf_result=no)
927                         if test "$cf_result" != yes; then
928                                 AC_TRY_LINK([#include <openssl/ssl.h>],
929                                             [SSLeay_add_ssl_algorithms()],
930                                             cf_result=yes, cf_result=no)
931                         fi
932                 fi
933         done
935         if test "$cf_result" != yes; then
936                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
937                         AC_MSG_ERROR([OpenSSL not found])
938                 fi
939                 EL_RESTORE_FLAGS
940         else
941                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
943                 CFLAGS="$CFLAGS_X"
944                 AC_SUBST(OPENSSL_CFLAGS)
945         fi
948 AC_MSG_RESULT($cf_result)
950 dnl ---- GNU TLS
951 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
952 dnl it looks ugly then.
954 if test "$cf_result" = yes; then
955         cf_result="not used"
957 else
958         EL_SAVE_FLAGS
959         cf_result="no"
961         if test -z "$disable_gnutls"; then
962                 # Sure, we maybe _could_ use their macro, but how to ensure
963                 # that the ./configure script won't fail if the macro won't be
964                 # found..? :( --pasky
966                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
968                 if test -d "$gnutls_withval"; then
969                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
970                 fi
972                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
974                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
975                         cf_result=no
976                 else
977                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
978                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
980                         LIBS="$GNUTLS_LIBS $LIBS_X"
981                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
982                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
984                         # Verify if it's really usable.  gnutls_session was
985                         # renamed to gnutls_session_t before GNU TLS 1.2.0
986                         # (on 2004-06-13); ELinks now requires this.
987                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
988                                     [gnutls_session_t dummy;
989                                      gnutls_check_version(NULL)],
990                                     cf_result=yes, cf_result=no)
991                 fi
993                 if test "$cf_result" = yes; then
994                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
996                         CFLAGS="$CFLAGS_X"
997                         AC_SUBST(GNUTLS_CFLAGS)
999                         # Verify if the MD5 compatibility layer is usable.
1000                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
1001                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
1002                                                   [GNU TLS OpenSSL compatibility],
1003                                                   gnutls/openssl.h, gnutls-openssl,
1004                                                   MD5_Init)
1005                 else
1006                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1007                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1008                         fi
1009                         EL_RESTORE_FLAGS
1010                 fi
1011         fi
1014 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1015 AC_MSG_RESULT($cf_result)
1017 dnl Final SSL setup
1019 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1020 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1021 AC_SUBST(CONFIG_OPENSSL)
1022 AC_SUBST(CONFIG_GNUTLS)
1024 #endif
1026 AC_MSG_CHECKING([whether to be or not to be])
1027 AC_MSG_RESULT([needs to be determined experimentally])
1029 dnl ===================================================================
1030 dnl Check for IPv6 support and related functions.
1031 dnl ===================================================================
1033 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1034 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1035 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1037 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1038 if test "$HAVE_GETADDRINFO" != yes; then
1039         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1040         if test "$HAVE_GETADDRINFO" = yes; then
1041                 LIBS="$LIBS -linet6"
1042         fi
1046 dnl ===================================================================
1047 dnl Checking for X11 (window title restoring).
1048 dnl ===================================================================
1050 AC_PATH_X
1051 if test x"$no_x" != xyes; then
1052         if test -n "$x_includes"; then
1053                 X_CFLAGS="-I$x_includes"
1054                 CPPFLAGS="$CPPFLAGS -I$x_includes"
1055         fi
1056         if test -n "$x_libraries"; then
1057                 LDFLAGS="$LDFLAGS -L$x_libraries"
1058         fi
1059         LIBS="-lX11 $LIBS"
1060         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1061         AC_SUBST(X_CFLAGS)
1065 dnl ===================================================================
1066 dnl Backtraces displaying support.
1067 dnl ===================================================================
1069 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1070 # possible checks for other system-specific means go here
1073 dnl ===================================================================
1074 dnl SMB protocol support.
1075 dnl ===================================================================
1077 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1080 dnl ===================================================================
1081 dnl Gettext grey zone. Beware.
1082 dnl ===================================================================
1084 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"
1086 AM_GNU_GETTEXT
1088 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1089 dnl # f33r d4 l33t... I hope it's portable. :)
1090 dnl cf_result=$((48#z - 48#a + 1));
1091 dnl AC_MSG_RESULT($cf_result)
1094 dnl ===================================================================
1095 dnl Compile-time features control
1096 dnl ===================================================================
1098 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1099               [  --disable-cookies       disable cookie support])
1101 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1102               [  --disable-formhist      disable form history support])
1104 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1105               [  --disable-globhist      disable global history support])
1108 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1109               [  --disable-mailcap       disable mailcap support])
1111 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1112               [  --disable-mimetypes     disable mimetypes files support])
1115 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1116               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1117               [IPv6],
1118               [  --disable-ipv6          disable IPv6 support])
1120 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1121               [  --enable-bittorrent     enable BitTorrent protocol support])
1123 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1124               [  --disable-data          disable data protocol support])
1126 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1127               [  --disable-uri-rewrite   disable URI rewrite support])
1129 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1130               [  --enable-cgi            enable local CGI support])
1132 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1133               [  --enable-finger         enable finger protocol support])
1135 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1136               [  --disable-ftp           disable ftp protocol support])
1138 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1139               [  --enable-gopher         enable gopher protocol support])
1141 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1142               [  --enable-nntp           enable nntp protocol support])
1144 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1145               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1148 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1149               [  --disable-mouse         disable mouse support])
1151 # GPM mouse is Linux specific, so ...
1152 CONFIG_SYSMOUSE=yes
1153 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1154               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1155               [BSD sysmouse],
1156               [  --disable-sysmouse      disable BSD sysmouse support])
1158 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1159               [  --enable-88-colors      enable 88 color support])
1161 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1162               [  --enable-256-colors     enable 256 color support])
1165 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1166               [  --enable-exmode         enable exmode (CLI) interface])
1168 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1169               [  --disable-leds          disable LEDs support])
1171 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1172               [  --disable-marks         disable document marks support])
1175 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1176               [  --disable-css           disable Cascading Style Sheet support])
1178 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1179               [  --enable-html-highlight HTML highlighting using DOM engine])
1181 dnl Everything in the tree already uses CONFIG_DOM
1182 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1183 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1185 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1186               [  --disable-backtrace     disable backtrace support])
1188 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1189               [  --enable-no-root        enable prevention of usage by root])
1192 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1193               [  --enable-debug          enable leak debug and internal error checking])
1195 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1196               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1198 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1199               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1201 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1202               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1204 if test "$CONFIG_OPENSSL" != yes &&
1205    test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1206    test "$CONFIG_OWN_LIBC" = yes;
1207 then
1208         AC_MSG_CHECKING(for built-in MD5 support)
1209         AC_MSG_RESULT(yes)
1210         EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1213 AC_SUBST(CONFIG_MD5)
1215 if test "$CONFIG_BITTORRENT" = yes; then
1216         if test "$CONFIG_OPENSSL" != yes ||
1217            test "$CONFIG_OWN_LIBC" = yes;
1218         then
1219                 AC_MSG_CHECKING(for built-in SHA1 support)
1220                 AC_MSG_RESULT(yes)
1221                 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1222         fi
1225 AC_SUBST(CONFIG_SHA1)
1227 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1228 then
1229         EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1231 AC_SUBST(CONFIG_SCANNER)
1233 AC_ARG_ENABLE(weehoofooboomookerchoo,
1234               [
1235     Also check out the features.conf file for more information about features!
1236               ],
1237               [AC_MSG_ERROR(Are you strange, or what?)])
1240 dnl == EMX hack
1242 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1243 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1246 dnl ===================================================================
1247 dnl Export directory paths
1248 dnl ===================================================================
1250 # Set up the ``entry points'' if they were not supplied by builder
1251 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1252 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1254 # Create CONFDIR #define for config.h
1256 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1257 # it's autoconf fault to force us to do such hacks ;p.
1258 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1259   # sysconfdir is set to its default value... fine, let's append /elinks/
1260   # XXX: We can't modify listing of the default in ./configure --help :-(
1261   sysconfdir_n=`eval echo "$sysconfdir"`
1262   sysconfdir=$sysconfdir_n
1263   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1264         sysconfdir="$sysconfdir/elinks"
1267 CONFDIR=$sysconfdir
1268 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1269 AC_SUBST(CONFDIR)
1271 # Create LOCALEDIR #define for config.h
1272 LOCALEDIR=`eval echo "$datadir/locale"`
1273 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1274 AC_SUBST(LOCALEDIR)
1276 # Create LIBDIR #define for config.h
1277 LIBDIR=`eval echo "$libdir"`
1278 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1279 AC_SUBST(LIBDIR)
1281 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1282 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1284 dnl ===================================================================
1285 dnl A little fine tuning of gcc specific options (continued)
1286 dnl ===================================================================
1288 if test "x$ac_cv_prog_gcc" = "xyes"; then
1289   if test "$CONFIG_DEBUG" = "yes"; then
1290     dnl We want to see all warnings and live with none (in debug mode).
1291     CFLAGS="$CFLAGS -Werror"
1292   fi
1294   case "`$CC -dumpversion`" in
1295     3.0|3.1|3.2)
1296       # These should be ok using -Werror
1297       ;;
1298     3.*)
1299       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1300       # "dereferencing type-punned pointer will break strict-aliasing rules"
1301       # warnings. Disable them by not doing any strict-aliasing. The
1302       # alternative is just too ugly. Thanks gcc guys!! ;)
1303       CFLAGS="$CFLAGS -fno-strict-aliasing"
1304       ;;
1305     4.*)
1306       # Do not show warnings related to (char * | unsigned char *) type
1307       # difference.
1308       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1309       ;;
1310     *)
1311       # These should be ok using -Werror
1312       ;;
1313   esac
1316 # CFLAGS doesn't contain all compile flags. Some will be added only when
1317 # needed in the respective source directory. To get all compile flags
1318 # easily just add CPPFLAGS.
1319 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1321 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1322 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1324 dnl ===================================================================
1325 dnl Colored make output
1326 dnl ===================================================================
1328 if test $(`which tput` colors) -ge 4; then
1329         MAKE_COLOR=1
1330         AC_SUBST(MAKE_COLOR)
1333 dnl ===================================================================
1334 dnl Generated files
1335 dnl ===================================================================
1337 AC_OUTPUT([ \
1338  Makefile.config \
1339  contrib/elinks.spec \
1340  contrib/lua/hooks.lua \
1341  contrib/conv/w3m2links.awk \
1342  doc/man/man1/elinks.1 \
1343  src/intl/gettext/ref-add.sed \
1344  src/intl/gettext/ref-del.sed
1347 abs_srcdir="$(cd "$srcdir" && pwd)"
1348 # builddir is always absolute!
1349 if test "$abs_srcdir" != "$builddir"; then
1350         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1351         "$MAKE" "SRC=$abs_srcdir" init
1355 dnl ===================================================================
1356 dnl Configuration summary
1357 dnl ===================================================================
1359 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1360 cat features.log