Fix SGML parser test program
[elinks.git] / configure.in
blobdf879335e2a96ec470411dfb9c1f82c4b988cbfe
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 AC_PROG_MAKE_SET
21 MAKE=
23 for make in gnumake gmake make false; do
24         if test "x$MAKE" = x; then
25                 AC_PATH_PROGS(MAKE, "$make")
26         fi
27 done
29 # Cleanup if we are configuring with a previous build in the tree
30 if test -e Makefile.config; then
31         "$MAKE" -C "$builddir" cleanall  >/dev/null 2>/dev/null
34 builddir="`pwd`"
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")
57 AC_PATH_PROGS(SPARSE, "sparse")
58 AC_SUBST(SPARSE)
60 CONFIG_ASCIIDOC="no"
61 CONFIG_POD2HTML="no"
62 CONFIG_XMLTO="no"
63 CONFIG_JW="no"
65 if test "x$CONFIG_DOC" != xno; then
66         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
67         if test "x$ASCIIDOC" != "x"; then
68                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
69                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
70                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
71         fi
73         AC_PATH_PROGS(XMLTO, "xmlto")
74         if test "x$XMLTO" != "x"; then
75                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
76                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
77                 EL_CONFIG(MAN_XMLTO, [man (groff)])
78         fi
80         AC_PATH_PROGS(JW, "jw")
81         if test "x$JW" != "x"; then
82                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
83                 EL_CONFIG(MANUAL_JW, [PDF])
84         fi
86         AC_PATH_PROGS(POD2HTML, "pod2html")
87         if test "x$POD2HTML" != "x"; then
88                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
89         fi
92 AC_SUBST(CONFIG_ASCIIDOC)
93 AC_SUBST(CONFIG_POD2HTML)
94 AC_SUBST(CONFIG_XMLTO)
95 AC_SUBST(CONFIG_JW)
97 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation])
99 if test "$CONFIG_ASCIIDOC" = yes &&
100    test "$CONFIG_XMLTO" = yes &&
101    test "$CONFIG_JW" = yes; then
102         EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
105 if test "$CONFIG_ASCIIDOC" = yes &&
106    test "$CONFIG_XMLTO" = yes; then
107         EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
110 AC_SUBST(CONFIG_ASCIIDOC)
111 AC_SUBST(CONFIG_POD2HTML)
112 AC_SUBST(CONFIG_XMLTO)
113 AC_SUBST(CONFIG_JW)
115 dnl gcc specific options (to be continued at the bottom of configure)
116 if test "x$ac_cv_prog_gcc" = "xyes"; then
117   dnl We want to see all warnings and live with none.
118   dnl We can't set up -Werror here as there may be some warnings in test
119   dnl suite of configure, and we don't want to fail them.
120   CFLAGS="$CFLAGS -Wall"
123 dnl ===================================================================
124 dnl Checks for special OSes.
125 dnl ===================================================================
127 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
128 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
130         AC_MSG_CHECKING([for $2])
132         for flag in $3; do
133                 AC_TRY_COMPILE(, [#ifndef $flag
134 kill me!
135 #endif ], $1=yes, $1=no)
136                 if test "[$]$1" = yes; then
137                         EL_CONFIG([$1], [$2])
138                         break
139                 fi
140         done
142         AC_MSG_RESULT([$]$1)
145 EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
146 AC_SUBST(CONFIG_OS_BEOS)
148 EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
149 AC_SUBST(CONFIG_OS_RISCOS)
151 EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
152 AC_SUBST(CONFIG_OS_WIN32)
154 EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
155 AC_SUBST(CONFIG_OS_OS2)
156 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
158 AC_MSG_CHECKING([for UNIX])
159 dnl FIXME: some depend kind of mechanism
160 if test "$CONFIG_OS_BEOS" = no && \
161    test "$CONFIG_OS_RISCOS" = no && \
162    test "$CONFIG_OS_WIN32" = no && \
163    test "$CONFIG_OS_OS2" = no; then
164         EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
165 else
166         CONFIG_OS_UNIX=no
168 AC_MSG_RESULT($CONFIG_OS_UNIX)
169 AC_SUBST(CONFIG_OS_UNIX)
171 dnl ===================================================================
172 dnl Checks for header files.
173 dnl ===================================================================
175 AC_HEADER_DIRENT
176 AC_HEADER_STDC
177 AC_HEADER_SYS_WAIT
178 AC_HEADER_TIME
180 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
181 AC_CHECK_HEADERS(sigaction.h)
182 AC_CHECK_HEADERS(arpa/inet.h)
183 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
184 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
185 AC_CHECK_HEADERS(ifaddrs.h)
186 AC_CHECK_HEADERS(sys/cygwin.h io.h)
187 AC_CHECK_HEADERS(sys/fmutex.h)
188 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
189 AC_CHECK_HEADERS(sys/resource.h)
190 AC_CHECK_HEADERS(sys/select.h)
191 AC_CHECK_HEADERS(sys/signal.h)
192 AC_CHECK_HEADERS(sys/socket.h)
193 AC_CHECK_HEADERS(sys/time.h)
194 AC_CHECK_HEADERS(sys/utsname.h)
195 AC_CHECK_HEADERS(stdint.h inttypes.h)
196 AC_CHECK_HEADERS(locale.h pwd.h)
197 AC_CHECK_HEADERS(termios.h)
200 AC_CHECK_HEADERS(sys/un.h,
201         [CONFIG_INTERLINK=yes
202          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
203         [CONFIG_INTERLINK=no])
204 AC_SUBST(CONFIG_INTERLINK)
206 dnl ===================================================================
207 dnl Checks for typedefs, structures, and compiler characteristics.
208 dnl ===================================================================
210 AC_STRUCT_TM
211 AC_C_CONST
212 AC_C_INLINE
213 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
215 AC_SYS_LARGEFILE
216 AC_TYPE_SIZE_T
217 AC_TYPE_OFF_T
218 EL_CHECK_TYPE(ssize_t, int)
219 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
220 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
221 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
222 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
224 AC_CHECK_SIZEOF(char, 1)
225 AC_CHECK_SIZEOF(short, 2)
226 AC_CHECK_SIZEOF(int, 4)
227 AC_CHECK_SIZEOF(long, 4)
228 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
230 dnl Check for variadic macros
231 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
232                 [#include <stdio.h>
233                  #define a(b,c...) printf(b,##c)],
234                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
236 dnl Check for -rdynamic
237 dnl FIXME: This check doesn't work. Something to do with the compiler
238 dnl happily ignoring it and stderr not being checked for error messages.
239 AC_MSG_CHECKING([for -rdynamic])
240 LDFLAGS_X="$LDFLAGS"
241 LDFLAGS="$LDFLAGS -rdynamic"
242 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
243 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
244 AC_MSG_RESULT($have_rdynamic)
246 dnl ===================================================================
247 dnl Check for POSIX <regex.h>
248 dnl ===================================================================
250 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
252 dnl ===================================================================
253 dnl Checks for library functions.
254 dnl ===================================================================
256 AC_PROG_GCC_TRADITIONAL
257 AC_FUNC_MEMCMP
258 AC_FUNC_MMAP
259 AC_FUNC_STRFTIME
260 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
261 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
262 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
263 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
264 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
265 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
266 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
267 AC_CHECK_FUNCS(gettimeofday clock_gettime)
269 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
271 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
272 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
273 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
275 dnl These aren't probably needed now, as they are commented in links.h.
276 dnl I've no idea about their historical background, but I keep them here
277 dnl just in the case they will help later. --pasky
278 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
279 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
280 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
281 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
283 if test x"$HAVE_RAISE" = x; then
284         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
285                 AC_ERROR([Unable to emulate raise()])
286         fi
289 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
290 AC_TRY_LINK([#include <stdarg.h>
291 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
292 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
293 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
294         EL_DEFINE(HAVE_VA_COPY, __va_copy)
297 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
298 AC_TRY_LINK([#include <unistd.h>
299 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
300 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
301 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
302         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
305 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
306 AC_TRY_RUN([
307 #include <stdio.h>
308 #include <stdarg.h>
309 #include <stdlib.h>
310 #include <string.h>
312 char buf[8];
314 int bar(char *buf, const char *format, va_list ap)
316        return vsnprintf(buf, 0, format, ap);
319 void foo(const char *format, ...) {
320        va_list ap;
321        int len;
323        va_start(ap, format);
324        len = bar(buf, format, ap);
325        va_end(ap);
326        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
328        va_start(ap, format);
329        len = bar(buf, format, ap);
330        va_end(ap);
331        if ((len != 6) && (len != 7)) exit(1);
333        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
335        exit(0);
337 main() { foo("hello\n"); }
339 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
340 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
341         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
344 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
346 dnl ===================================================================
347 dnl Checks for libraries.
348 dnl ===================================================================
350 dnl Replace `main' with a function in -lsocket:
351 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
352 if test "$cf_result" = no; then
353         AC_CHECK_LIB(socket, socket)
356 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
357 if test "$cf_result" = no; then
358         AC_CHECK_LIB(socket, setsockopt)
361 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
362 if test "$cf_result" = no; then
363         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
364         if test "$cf_result" = no; then
365                 AC_CHECK_LIB(nsl, gethostbyname)
366         else
367                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
368         fi
371 dnl ===================================================================
372 dnl Checks for packaging specific options.
373 dnl ===================================================================
375 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
376             [ if test "$withval" != no && test "$withval" != yes; then
377                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
378               fi ])
380 dnl ===================================================================
381 dnl Checks for a libraries, optional even if installed.
382 dnl ===================================================================
384 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
385 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
387         AC_MSG_CHECKING([for $2 support])
389         if test "[$]$1" != no; then
390                 AC_MSG_RESULT(yes)
391                 EL_SAVE_FLAGS
392                 if test -n "$withval" && test -d "$withval"; then
393                         CFLAGS="$CFLAGS -I$withval/include";
394                         CPPFLAGS="$CPPFLAGS -I$withval/include";
395                         LDFLAGS="$LDFLAGS -L$withval/lib";
396                 fi
398                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
399                 if test "[$]$1" = yes; then
400                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
401                 fi
403                 if test "[$]$1" = yes; then
404                         EL_CONFIG([$1], [$2])
405                         LIBS="$LIBS -l$4"
406                 else
407                         if test -n "[$]WITHVAL_$1" &&
408                            test "[$]WITHVAL_$1" != xno; then
409                                 AC_MSG_ERROR([$2 not found])
410                         fi
411                         EL_RESTORE_FLAGS
412                 fi
413         else
414                 AC_MSG_RESULT(disabled)
415         fi
418 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
419 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
421         $1=yes
422         WITHVAL_$1=
424         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
425         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
427         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
429         EL_LOG_CONFIG([$1], [$2], [])
432 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
433         [  --without-gpm           disable gpm (mouse) support])
435 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
436         [  --without-zlib          disable zlib support])
438 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
439         [  --without-bzlib         disable bzlib support])
441 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
442         [  --without-idn           disable international domain names support])
444 dnl ===================================================================
445 dnl Bookmark and XBEL support
446 dnl ===================================================================
448 EL_SAVE_FLAGS
450 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
451               [  --disable-bookmarks     disable bookmark support])
453 # Check whether --enable-xbel or --disable-xbel was given.
454 if test "x${enable_xbel}" != xno; then
455         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
457         if test "$HAVE_LIBEXPAT" = yes; then
458                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
459                 if test "$HAVE_LIBEXPAT" = yes; then
460                         LIBS="$LIBS -lexpat"
461                 fi
462         fi
466 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
467               [XBEL bookmarks],
468               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
470 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
471         EL_RESTORE_FLAGS
474 dnl ===================================================================
475 dnl Checks for BSD sysmouse
476 dnl ===================================================================
478 HAVE_SYSMOUSE_HEADER="no"
480 # Either of these header files provides the (same) sysmouse interface
481 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
483 dnl ===================================================================
484 dnl Checks for OS/2
485 dnl ===================================================================
487 if test "$CONFIG_OS_OS2" = yes; then
488         EL_CONFIG_OS_OS2
491 dnl ===================================================================
492 dnl Checks for Win32
493 dnl ===================================================================
495 if test "$CONFIG_OS_WIN32" = yes; then
496         EL_CONFIG_OS_WIN32
499 dnl ===================================================================
500 dnl Check for SEE (Simple Ecmascript Engine)
501 dnl ===================================================================
502 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
503             [ if test "x$withval" != xno; then enable_see=yes; fi ])
505 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
506 # SEE_FLAGS but I really don't want to require people to have Guile in order
507 # to compile CVS. Also, the macro seems to be really stupid regarding searching
508 # for Guile in $PATH etc. --pasky
510 AC_MSG_CHECKING([for SEE])
512 if test "$enable_see" = "yes"; then
513         AC_MSG_RESULT(yes);
514         ## Based on the SEE_FLAGS macro.
516         if test -d "$withval"; then
517                 SEE_PATH="$withval:$PATH"
518         else
519                 SEE_PATH="$PATH"
520         fi
522         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
524         ## First, let's just see if we can find Guile at all.
525         if test "$SEE_CONFIG" != no; then
526                 cf_result="yes";
528                 SEE_LIBS="`$SEE_CONFIG --libs`"
529                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
530                 LIBS="$SEE_LIBS $LIBS"
531                 CPPFLAGS="$CPPFLAGS $SEE_CFLAGS"
532                 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
533                 AC_SUBST(SEE_CFLAGS)
534                 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
535         else
536                 if test -n "$withval" && test "x$withval" != xno; then
537                         AC_MSG_ERROR([SEE not found])
538                 else
539                         AC_MSG_WARN([SEE support disabled])
540                 fi
541         fi
542 else
543         AC_MSG_RESULT(no);
547 dnl ===================================================================
548 dnl Check for SpiderMonkey, optional even if installed.
549 dnl ===================================================================
551 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
552             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
553 AC_MSG_CHECKING([for SpiderMonkey])
555 EL_SAVE_FLAGS
556 cf_result=no
558 if test -z "$disable_spidermonkey"; then
559         if test ! -d "$withval"; then
560                 withval="";
561         fi
562         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
563                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
564                         for spidermonkeylib in js smjs; do
565                                 if test "$cf_result" = no; then
566                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
568                                         if test ! -z "$spidermonkeydir"; then
569                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
570                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
571                                         fi
573                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
574                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
575                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
577                                         AC_TRY_LINK([#define XP_UNIX
578                                                      #include <jsapi.h>],
579                                                      [JS_GetImplementationVersion()],
580                                                      cf_result=yes, cf_result=no)
581                                 fi
582                         done
583                 done
584         done
587 AC_MSG_RESULT($cf_result)
589 if test "$cf_result" != yes; then
590         EL_RESTORE_FLAGS
591 else
592         EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
594         CFLAGS="$CFLAGS_X"
595         AC_SUBST(SPIDERMONKEY_LIBS)
596         AC_SUBST(SPIDERMONKEY_CFLAGS)
599 if test "$CONFIG_SPIDERMONKEY" = yes &&
600    test "$CONFIG_ECMASCRIPT_SEE" != yes; then
601         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
604 AC_SUBST(CONFIG_SPIDERMONKEY)
605 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
607 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
610 dnl ===================================================================
611 dnl Optional Spidermonkey-based ECMAScript browser scripting
612 dnl ===================================================================
614 AC_ARG_ENABLE(sm-scripting,
615               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
616               [if test "$enableval" != no; then enableval="yes"; fi
617                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
619 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
620    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
621         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
622 else
623         CONFIG_SCRIPTING_SPIDERMONKEY=no
627 dnl ===================================================================
628 dnl Check for Guile, optional even if installed.
629 dnl ===================================================================
631 enable_guile="no";
633 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
634             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
636 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
637 # GUILE_FLAGS but I really don't want to require people to have Guile in order
638 # to compile CVS. Also, the macro seems to be really stupid regarding searching
639 # for Guile in $PATH etc. --pasky
641 AC_MSG_CHECKING([for Guile])
643 if test "$enable_guile" = "yes"; then
644         AC_MSG_RESULT(yes);
645         ## Based on the GUILE_FLAGS macro.
647         if test -d "$withval"; then
648                 GUILE_PATH="$withval:$PATH"
649         else
650                 GUILE_PATH="$PATH"
651         fi
653         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
655         ## First, let's just see if we can find Guile at all.
656         if test "$GUILE_CONFIG" != no; then
657                 cf_result="yes";
659                 GUILE_LIBS="`guile-config link`"
660                 GUILE_CFLAGS="`guile-config compile`"
661                 LIBS="$GUILE_LIBS $LIBS"
662                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
663                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
664                 AC_SUBST(GUILE_CFLAGS)
665                 cat <<EOF
666 ***********************************************************************
667 The Guile support is incomplete and not so well integrated to ELinks
668 yet. That means, ie., that you have no Guile console and there might
669 not be all the necessary hooks. Also, the Guile interface is not too
670 well tested (success stories heartily welcomed!).  See
671 src/scripting/guile/README for further details and hints.
672 ***********************************************************************
674         else
675                 if test -n "$withval" && test "x$withval" != xno; then
676                         AC_MSG_ERROR([Guile not found])
677                 else
678                         AC_MSG_WARN([Guile support disabled])
679                 fi
680         fi
681 else
682         AC_MSG_RESULT(no);
685 dnl ===================================================================
686 dnl Check for Perl
687 dnl ===================================================================
688 enable_perl="no";
690 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
691             [
692 if test "$withval" = yes; then
693         # FIXME: If withval is a valid directory append it to PATH
694         # so that you can specify one of several perl installations.
695         withval="";
696         enable_perl=yes;
698             ])
700 AC_MSG_CHECKING([for Perl])
702 cf_result=no
704 EL_SAVE_FLAGS
706 if test "$enable_perl" = "yes"; then
707         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
708         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
709         LIBS="$PERL_LIBS $LIBS"
710         CFLAGS="$PERL_CFLAGS $CFLAGS"
711         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
712         AC_TRY_LINK([
713 #include <EXTERN.h>
714 #include <perl.h>
715 #include <perlapi.h>
717                     [PerlInterpreter *my_perl = perl_alloc();],
718                     cf_result=yes, cf_result=no)
721 if test "$cf_result" != "yes"; then
722         EL_RESTORE_FLAGS
723 else
724         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
726         CFLAGS="$CFLAGS_X"
727         AC_SUBST(PERL_LIBS)
728         AC_SUBST(PERL_CFLAGS)
731 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
732 dnl ===================================================================
733 dnl Check for Python
734 dnl ===================================================================
735 enable_python="no";
737 AC_ARG_WITH(python, [  --with-python           enable Python support],
738             [
739 if test "$withval" = yes; then
740         # FIXME: If withval is a valid directory append it to PATH
741         # so that you can specify one of several Python installations.
742         withval="";
743         enable_python=yes;
744         cat <<EOF
745 ***********************************************************************
746 The Python support is incomplete and not so well integrated to ELinks
747 yet. That means, ie., that you have no Python console and there might
748 not be all the necessary hooks. Also, the Python interface is not too
749 well tested (success stories heartily welcomed!).
750 ***********************************************************************
753             ])
755 AC_MSG_CHECKING([for Python])
757 cf_result=no
759 EL_SAVE_FLAGS
761 if test "$enable_python" = "yes"; then
762         PYTHON_LIBS="-lpython"
763         PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
764         LIBS="$PYTHON_LIBS $LIBS"
765         CFLAGS="$PYTHON_CFLAGS $CFLAGS"
766         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
767         AC_TRY_LINK([
768 #include <Python.h>
770                     [Py_Initialize();],
771                     cf_result=yes, cf_result=no)
774 if test "$cf_result" != "yes"; then
775         EL_RESTORE_FLAGS
776 else
777         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
779         CFLAGS="$CFLAGS_X"
780         AC_SUBST(PYTHON_LIBS)
781         AC_SUBST(PYTHON_CFLAGS)
784 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
787 dnl ===================================================================
788 dnl Check for Lua, optional even if installed.
789 dnl ===================================================================
791 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
792 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
794 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
795             [if test "$withval" = no; then disable_lua=yes; fi])
796 AC_MSG_CHECKING([for Lua])
798 EL_SAVE_FLAGS
799 cf_result=no
801 if test -z "$disable_lua"; then
802         if test ! -d "$withval"; then
803                 withval="";
804         fi
805         for luadir in "$withval" "" /usr /usr/local; do
806                 for suffix in "" 50 51; do
807                         if test "$cf_result" = no; then
808                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
810                                 if test ! -z "$luadir"; then
811                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
812                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
813                                 fi
815                                 LIBS="$LUA_LIBS $LIBS_X"
816                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
817                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
819                                 # Check that it is a compatible Lua version
820                                 AC_TRY_LINK([   #include <lua.h>
821                                                 #include <lualib.h>],
822                                             [   lua_State *L = lua_open();
823                                                 lua_baselibopen(L);
824                                                 lua_mathlibopen(L);
825                                                 lua_strlibopen(L);
826                                                 lua_tablibopen(L);
827                                                 lua_pushboolean(L, 1);
828                                                 lua_close(L);],
829                                             cf_result=yes, cf_result=no)
830                         fi
831                 done
832         done
835 AC_MSG_RESULT($cf_result)
837 if test "$cf_result" != yes; then
838         EL_RESTORE_FLAGS
839 else
840         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
841         AC_CHECK_HEADERS(lauxlib.h)
843         CFLAGS="$CFLAGS_X"
844         AC_SUBST(LUA_LIBS)
845         AC_SUBST(LUA_CFLAGS)
849 dnl ===================================================================
850 dnl Check for Ruby, optional even if installed.
851 dnl ===================================================================
853 EL_CONFIG_SCRIPTING_RUBY
855 dnl ===================================================================
856 dnl Setup global scripting
857 dnl ===================================================================
859 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])
860 AC_SUBST(CONFIG_SCRIPTING_GUILE)
861 AC_SUBST(CONFIG_SCRIPTING_LUA)
862 AC_SUBST(CONFIG_SCRIPTING_PERL)
863 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
864 AC_SUBST(CONFIG_SCRIPTING_RUBY)
865 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
866 AC_SUBST(CONFIG_SCRIPTING)
869 dnl ===================================================================
870 dnl Check for SSL support.
871 dnl ===================================================================
873 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
874 dnl is enabled, we won't try to use OpenSSL anymore.
876 dnl For wiping SSL hooks..
877 #ifdef CONFIG_SSL
879 disable_openssl=""
880 disable_gnutls=""
881 enable_gnutls=""
883 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
884             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
885 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
886             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
887 gnutls_withval="$withval"
889 if test "$enable_gnutls" = yes; then
890         disable_openssl=yes;
893 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
894             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
895 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
896 openssl_withval="$withval"
898 dnl ---- OpenSSL
900 AC_MSG_CHECKING([for OpenSSL])
902 EL_SAVE_FLAGS
903 cf_result="no"
905 if test "$disable_openssl" = yes; then
906         cf_result="not used"
907 else
908         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
909                          /usr/lib/openssl /usr/local/ssl \
910                          /usr/local/www /usr/lib/ssl /usr/local \
911                          /usr/pkg /opt /opt/openssl; do
912                 if test "$cf_result" = no; then
913                         if test -d "$ssldir"; then
914                                 OPENSSL_CFLAGS="-I$ssldir/include"
915                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
916                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
917                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
918 #                               # FIXME: This created serious portability problems. --pasky
919 #                               if test "$CC" == "gcc"; then
920 #                                       # I'm not sure about compatibility here. --pasky
921 #                                       LIBS="$LIBS -R$ssldir/lib"
922 #                               fi
923                         else
924                                 LIBS="-lssl -lcrypto $LIBS_X"
925                         fi
926                         AC_TRY_LINK([#include <openssl/ssl.h>],
927                                     [OpenSSL_add_all_algorithms()],
928                                     cf_result=yes, cf_result=no)
929                         if test "$cf_result" != yes; then
930                                 AC_TRY_LINK([#include <openssl/ssl.h>],
931                                             [SSLeay_add_ssl_algorithms()],
932                                             cf_result=yes, cf_result=no)
933                         fi
934                 fi
935         done
937         if test "$cf_result" != yes; then
938                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
939                         AC_MSG_ERROR([OpenSSL not found])
940                 fi
941                 EL_RESTORE_FLAGS
942         else
943                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
945                 CFLAGS="$CFLAGS_X"
946                 AC_SUBST(OPENSSL_CFLAGS)
947         fi
950 AC_MSG_RESULT($cf_result)
952 dnl ---- GNU TLS
953 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
954 dnl it looks ugly then.
956 if test "$cf_result" = yes; then
957         cf_result="not used"
959 else
960         EL_SAVE_FLAGS
961         cf_result="no"
963         if test -z "$disable_gnutls"; then
964                 # Sure, we maybe _could_ use their macro, but how to ensure
965                 # that the ./configure script won't fail if the macro won't be
966                 # found..? :( --pasky
968                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
970                 if test -d "$gnutls_withval"; then
971                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
972                 fi
974                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
976                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
977                         cf_result=no
978                 else
979                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
980                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
982                         LIBS="$GNUTLS_LIBS $LIBS_X"
983                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
984                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
986                         # Verify if it's really usable.  gnutls_session was
987                         # renamed to gnutls_session_t before GNU TLS 1.2.0
988                         # (on 2004-06-13); ELinks now requires this.
989                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
990                                     [gnutls_session_t dummy;
991                                      gnutls_check_version(NULL)],
992                                     cf_result=yes, cf_result=no)
993                 fi
995                 if test "$cf_result" = yes; then
996                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
998                         CFLAGS="$CFLAGS_X"
999                         AC_SUBST(GNUTLS_CFLAGS)
1001                         # Verify if the MD5 compatibility layer is usable.
1002                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
1003                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
1004                                                   [GNU TLS OpenSSL compatibility],
1005                                                   gnutls/openssl.h, gnutls-openssl,
1006                                                   MD5_Init)
1007                 else
1008                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1009                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1010                         fi
1011                         EL_RESTORE_FLAGS
1012                 fi
1013         fi
1016 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1017 AC_MSG_RESULT($cf_result)
1019 dnl Final SSL setup
1021 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1022 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1023 AC_SUBST(CONFIG_OPENSSL)
1024 AC_SUBST(CONFIG_GNUTLS)
1026 #endif
1028 AC_MSG_CHECKING([whether to be or not to be])
1029 AC_MSG_RESULT([needs to be determined experimentally])
1031 dnl ===================================================================
1032 dnl Check for IPv6 support and related functions.
1033 dnl ===================================================================
1035 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1036 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1037 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1039 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1040 if test "$HAVE_GETADDRINFO" != yes; then
1041         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1042         if test "$HAVE_GETADDRINFO" = yes; then
1043                 LIBS="$LIBS -linet6"
1044         fi
1048 dnl ===================================================================
1049 dnl Checking for X11 (window title restoring).
1050 dnl ===================================================================
1052 AC_PATH_X
1053 if test x"$no_x" != xyes; then
1054         if test -n "$x_includes"; then
1055                 X_CFLAGS="-I$x_includes"
1056                 CPPFLAGS="$CPPFLAGS -I$x_includes"
1057         fi
1058         if test -n "$x_libraries"; then
1059                 LDFLAGS="$LDFLAGS -L$x_libraries"
1060         fi
1061         LIBS="-lX11 $LIBS"
1062         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1063         AC_SUBST(X_CFLAGS)
1067 dnl ===================================================================
1068 dnl Backtraces displaying support.
1069 dnl ===================================================================
1071 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1072 # possible checks for other system-specific means go here
1075 dnl ===================================================================
1076 dnl SMB protocol support.
1077 dnl ===================================================================
1079 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1082 dnl ===================================================================
1083 dnl Gettext grey zone. Beware.
1084 dnl ===================================================================
1086 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"
1088 AM_GNU_GETTEXT
1090 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1091 dnl # f33r d4 l33t... I hope it's portable. :)
1092 dnl cf_result=$((48#z - 48#a + 1));
1093 dnl AC_MSG_RESULT($cf_result)
1096 dnl ===================================================================
1097 dnl Compile-time features control
1098 dnl ===================================================================
1100 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1101               [  --disable-cookies       disable cookie support])
1103 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1104               [  --disable-formhist      disable form history support])
1106 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1107               [  --disable-globhist      disable global history support])
1110 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1111               [  --disable-mailcap       disable mailcap support])
1113 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1114               [  --disable-mimetypes     disable mimetypes files support])
1117 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1118               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1119               [IPv6],
1120               [  --disable-ipv6          disable IPv6 support])
1122 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1123               [  --enable-bittorrent     enable BitTorrent protocol support])
1125 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1126               [  --disable-data          disable data protocol support])
1128 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1129               [  --disable-uri-rewrite   disable URI rewrite support])
1131 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1132               [  --enable-cgi            enable local CGI support])
1134 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1135               [  --enable-finger         enable finger protocol support])
1137 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1138               [  --disable-ftp           disable ftp protocol support])
1140 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1141               [  --enable-gopher         enable gopher protocol support])
1143 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1144               [  --enable-nntp           enable nntp protocol support])
1146 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1147               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1150 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1151               [  --disable-mouse         disable mouse support])
1153 # GPM mouse is Linux specific, so ...
1154 CONFIG_SYSMOUSE=yes
1155 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1156               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1157               [BSD sysmouse],
1158               [  --disable-sysmouse      disable BSD sysmouse support])
1160 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1161               [  --enable-88-colors      enable 88 color support])
1163 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1164               [  --enable-256-colors     enable 256 color support])
1167 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1168               [  --enable-exmode         enable exmode (CLI) interface])
1170 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1171               [  --disable-leds          disable LEDs support])
1173 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1174               [  --disable-marks         disable document marks support])
1177 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1178               [  --disable-css           disable Cascading Style Sheet support])
1180 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1181               [  --enable-html-highlight HTML highlighting using DOM engine])
1183 dnl Everything in the tree already uses CONFIG_DOM
1184 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1185 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1187 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1188               [  --disable-backtrace     disable backtrace support])
1190 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1191               [  --enable-no-root        enable prevention of usage by root])
1194 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1195               [  --enable-debug          enable leak debug and internal error checking])
1197 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1198               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1200 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1201               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1203 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1204               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1206 if test "$CONFIG_OPENSSL" != yes &&
1207    test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1208    test "$CONFIG_OWN_LIBC" = yes;
1209 then
1210         AC_MSG_CHECKING(for built-in MD5 support)
1211         AC_MSG_RESULT(yes)
1212         EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1215 AC_SUBST(CONFIG_MD5)
1217 if test "$CONFIG_BITTORRENT" = yes; then
1218         if test "$CONFIG_OPENSSL" != yes ||
1219            test "$CONFIG_OWN_LIBC" = yes;
1220         then
1221                 AC_MSG_CHECKING(for built-in SHA1 support)
1222                 AC_MSG_RESULT(yes)
1223                 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1224         fi
1227 AC_SUBST(CONFIG_SHA1)
1229 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1230 then
1231         EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1233 AC_SUBST(CONFIG_SCANNER)
1235 AC_ARG_ENABLE(weehoofooboomookerchoo,
1236               [
1237     Also check out the features.conf file for more information about features!
1238               ],
1239               [AC_MSG_ERROR(Are you strange, or what?)])
1242 dnl == EMX hack
1244 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1245 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1248 dnl ===================================================================
1249 dnl Export directory paths
1250 dnl ===================================================================
1252 # Set up the ``entry points'' if they were not supplied by builder
1253 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1254 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1256 # Create CONFDIR #define for config.h
1258 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1259 # it's autoconf fault to force us to do such hacks ;p.
1260 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1261   # sysconfdir is set to its default value... fine, let's append /elinks/
1262   # XXX: We can't modify listing of the default in ./configure --help :-(
1263   sysconfdir_n=`eval echo "$sysconfdir"`
1264   sysconfdir=$sysconfdir_n
1265   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1266         sysconfdir="$sysconfdir/elinks"
1269 CONFDIR=$sysconfdir
1270 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1271 AC_SUBST(CONFDIR)
1273 # Create LOCALEDIR #define for config.h
1274 LOCALEDIR=`eval echo "$datadir/locale"`
1275 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1276 AC_SUBST(LOCALEDIR)
1278 # Create LIBDIR #define for config.h
1279 LIBDIR=`eval echo "$libdir"`
1280 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1281 AC_SUBST(LIBDIR)
1283 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1284 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1286 dnl ===================================================================
1287 dnl A little fine tuning of gcc specific options (continued)
1288 dnl ===================================================================
1290 if test "x$ac_cv_prog_gcc" = "xyes"; then
1291   if test "$CONFIG_DEBUG" = "yes"; then
1292     dnl We want to see all warnings and live with none (in debug mode).
1293     CFLAGS="$CFLAGS -Werror"
1294   fi
1296   case "`$CC -dumpversion`" in
1297     3.0|3.1|3.2)
1298       # These should be ok using -Werror
1299       ;;
1300     3.*)
1301       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1302       # "dereferencing type-punned pointer will break strict-aliasing rules"
1303       # warnings. Disable them by not doing any strict-aliasing. The
1304       # alternative is just too ugly. Thanks gcc guys!! ;)
1305       CFLAGS="$CFLAGS -fno-strict-aliasing"
1306       ;;
1307     4.*)
1308       # Do not show warnings related to (char * | unsigned char *) type
1309       # difference.
1310       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1311       ;;
1312     *)
1313       # These should be ok using -Werror
1314       ;;
1315   esac
1318 # CFLAGS doesn't contain all compile flags. Some will be added only when
1319 # needed in the respective source directory. To get all compile flags
1320 # easily just add CPPFLAGS.
1321 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1323 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1324 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1326 dnl ===================================================================
1327 dnl Colored make output
1328 dnl ===================================================================
1330 if test $(`which tput` colors) -ge 4; then
1331         MAKE_COLOR=1
1332         AC_SUBST(MAKE_COLOR)
1335 dnl ===================================================================
1336 dnl Generated files
1337 dnl ===================================================================
1339 AC_OUTPUT([ \
1340  Makefile.config \
1341  contrib/elinks.spec \
1342  contrib/lua/hooks.lua \
1343  contrib/conv/w3m2links.awk \
1344  doc/man/man1/elinks.1 \
1345  src/intl/gettext/ref-add.sed \
1346  src/intl/gettext/ref-del.sed
1349 abs_srcdir="$(cd "$srcdir" && pwd)"
1350 # builddir is always absolute!
1351 if test "$abs_srcdir" != "$builddir"; then
1352         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1353         "$MAKE" "SRC=$abs_srcdir" init
1357 dnl ===================================================================
1358 dnl Configuration summary
1359 dnl ===================================================================
1361 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1362 cat features.log