osdep/osdep.h was superfluos
[elinks.git] / configure.in
blobad2831d108a7aa8c8e574a4fd0baa7653f7681b3
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.13)
4 AC_INIT(src/main/main.c)
5 AC_CONFIG_AUX_DIR(config)
7 PACKAGE=elinks
8 VERSION=0.12.GIT
9 AC_SUBST(PACKAGE)
10 AC_SUBST(VERSION)
11 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
12 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
13 AC_CONFIG_HEADERS(config.h)
15 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
16 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
17 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
19 MAKE=
21 for make in gnumake gmake make false; do
22         if test "x$MAKE" = x; then
23                 AC_PATH_PROGS(MAKE, "$make")
24         fi
25 done
27 builddir="`pwd`"
29 # Cleanup if we are configuring with a previous build in the tree
30 if test -e Makefile.config; then
31         AC_MSG_CHECKING([for previous build to clean])
32         "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
33         AC_MSG_RESULT(done)
36 dnl ===================================================================
37 dnl Load feature configuration file and start logging features.
38 dnl ===================================================================
40 features="features.conf"
41 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
42 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
43 echo "Feature summary:" > features.log
45 dnl ===================================================================
46 dnl Checks for programs.
47 dnl ===================================================================
49 AC_PROG_CC
50 AC_PROG_AWK
51 AC_PATH_PROGS(AWK, "$AWK")
52 AC_PROG_RANLIB
53 AC_PROG_INSTALL
55 AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id")
56 AC_PATH_PROGS(SPARSE, "sparse")
58 CONFIG_ASCIIDOC="no"
59 CONFIG_POD2HTML="no"
60 CONFIG_XMLTO="no"
61 CONFIG_JW="no"
63 if test "x$CONFIG_DOC" != xno; then
64         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
65         if test "x$ASCIIDOC" != "x"; then
66                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
67                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
68                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
70                 echo > config.asciidoc-unsafe.txt
71                 if "$ASCIIDOC" --unsafe config.asciidoc-unsafe.txt >/dev/null 2>/dev/null; then
72                         ASCIIDOC_FLAGS=--unsafe
73                 fi
74                 rm config.asciidoc-unsafe.*
75         fi
77         AC_PATH_PROGS(XMLTO, "xmlto")
78         if test "x$XMLTO" != "x"; then
79                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
80                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
81                 EL_CONFIG(MAN_XMLTO, [man (groff)])
82         fi
84         AC_PATH_PROGS(JW, "jw")
85         if test "x$JW" != "x"; then
86                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
87                 EL_CONFIG(MANUAL_JW, [PDF])
88         fi
90         AC_PATH_PROGS(POD2HTML, "pod2html")
91         if test "x$POD2HTML" != "x"; then
92                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
93         fi
96 AC_SUBST(ASCIIDOC_FLAGS)
97 AC_SUBST(CONFIG_ASCIIDOC)
98 AC_SUBST(CONFIG_POD2HTML)
99 AC_SUBST(CONFIG_XMLTO)
100 AC_SUBST(CONFIG_JW)
102 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
103 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
104 EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
106 dnl gcc specific options (to be continued at the bottom of configure)
107 if test "x$ac_cv_prog_gcc" = "xyes"; then
108   dnl We want to see all warnings and live with none.
109   dnl We can't set up -Werror here as there may be some warnings in test
110   dnl suite of configure, and we don't want to fail them.
111   CFLAGS="$CFLAGS -Wall"
114 dnl ===================================================================
115 dnl Checks for special OSes.
116 dnl ===================================================================
118 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
119 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
121         AC_MSG_CHECKING([for $2])
123         for flag in $3; do
124                 AC_TRY_COMPILE(, [#ifndef $flag
125 kill me!
126 #endif ], $1=yes, $1=no)
127                 if test "[$]$1" = yes; then
128                         EL_CONFIG([$1], [$2])
129                         break
130                 fi
131         done
133         AC_MSG_RESULT([$]$1)
136 EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
137 AC_SUBST(CONFIG_OS_BEOS)
139 EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
140 AC_SUBST(CONFIG_OS_RISCOS)
142 EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
143 AC_SUBST(CONFIG_OS_WIN32)
145 EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
146 AC_SUBST(CONFIG_OS_OS2)
147 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
149 AC_MSG_CHECKING([for UNIX])
150 dnl FIXME: some depend kind of mechanism
151 if test "$CONFIG_OS_BEOS" = no && \
152    test "$CONFIG_OS_RISCOS" = no && \
153    test "$CONFIG_OS_WIN32" = no && \
154    test "$CONFIG_OS_OS2" = no; then
155         EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
156 else
157         CONFIG_OS_UNIX=no
159 AC_MSG_RESULT($CONFIG_OS_UNIX)
160 AC_SUBST(CONFIG_OS_UNIX)
162 dnl ===================================================================
163 dnl Checks for header files.
164 dnl ===================================================================
166 AC_HEADER_DIRENT
167 AC_HEADER_STDC
168 AC_HEADER_SYS_WAIT
169 AC_HEADER_TIME
171 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
172 AC_CHECK_HEADERS(sigaction.h)
173 AC_CHECK_HEADERS(arpa/inet.h)
174 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
175 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
176 AC_CHECK_HEADERS(ifaddrs.h)
177 AC_CHECK_HEADERS(sys/cygwin.h io.h)
178 AC_CHECK_HEADERS(sys/fmutex.h)
179 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
180 AC_CHECK_HEADERS(sys/resource.h)
181 AC_CHECK_HEADERS(sys/select.h)
182 AC_CHECK_HEADERS(sys/signal.h)
183 AC_CHECK_HEADERS(sys/socket.h)
184 AC_CHECK_HEADERS(sys/time.h)
185 AC_CHECK_HEADERS(sys/utsname.h)
186 AC_CHECK_HEADERS(stdint.h inttypes.h)
187 AC_CHECK_HEADERS(locale.h pwd.h)
188 AC_CHECK_HEADERS(termios.h)
191 AC_CHECK_HEADERS(sys/un.h,
192         [CONFIG_INTERLINK=yes
193          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
194         [CONFIG_INTERLINK=no])
195 AC_SUBST(CONFIG_INTERLINK)
197 dnl ===================================================================
198 dnl Checks for typedefs, structures, and compiler characteristics.
199 dnl ===================================================================
201 AC_STRUCT_TM
202 AC_C_CONST
203 AC_C_INLINE
204 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
206 AC_SYS_LARGEFILE
207 AC_TYPE_SIZE_T
208 AC_TYPE_OFF_T
209 EL_CHECK_TYPE(ssize_t, int)
210 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
211 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
212 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
213 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
215 AC_CHECK_SIZEOF(char, 1)
216 AC_CHECK_SIZEOF(short, 2)
217 AC_CHECK_SIZEOF(int, 4)
218 AC_CHECK_SIZEOF(long, 4)
219 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
221 dnl Check for variadic macros
222 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
223                 [#include <stdio.h>
224                  #define a(b,c...) printf(b,##c)],
225                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
227 dnl Check for -rdynamic
228 dnl FIXME: This check doesn't work. Something to do with the compiler
229 dnl happily ignoring it and stderr not being checked for error messages.
230 AC_MSG_CHECKING([for -rdynamic])
231 LDFLAGS_X="$LDFLAGS"
232 LDFLAGS="$LDFLAGS -rdynamic"
233 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
234 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
235 AC_MSG_RESULT($have_rdynamic)
237 dnl ===================================================================
238 dnl Check for POSIX <regex.h>
239 dnl ===================================================================
241 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
243 dnl ===================================================================
244 dnl Checks for library functions.
245 dnl ===================================================================
247 AC_PROG_GCC_TRADITIONAL
248 AC_FUNC_MEMCMP
249 AC_FUNC_MMAP
250 AC_FUNC_STRFTIME
251 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
252 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
253 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
254 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
255 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
256 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
257 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
258 AC_CHECK_FUNCS(gettimeofday clock_gettime)
260 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
262 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
263 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
264 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
266 dnl These aren't probably needed now, as they are commented in links.h.
267 dnl I've no idea about their historical background, but I keep them here
268 dnl just in the case they will help later. --pasky
269 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
270 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
271 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
272 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
274 if test x"$HAVE_RAISE" = x; then
275         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
276                 AC_ERROR([Unable to emulate raise()])
277         fi
280 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
281 AC_TRY_LINK([#include <stdarg.h>
282 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
283 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
284 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
285         EL_DEFINE(HAVE_VA_COPY, __va_copy)
288 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
289 AC_TRY_LINK([#include <unistd.h>
290 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
291 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
292 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
293         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
296 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
297 AC_TRY_RUN([
298 #include <stdio.h>
299 #include <stdarg.h>
300 #include <stdlib.h>
301 #include <string.h>
303 char buf[8];
305 int bar(char *buf, const char *format, va_list ap)
307        return vsnprintf(buf, 0, format, ap);
310 void foo(const char *format, ...) {
311        va_list ap;
312        int len;
314        va_start(ap, format);
315        len = bar(buf, format, ap);
316        va_end(ap);
317        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
319        va_start(ap, format);
320        len = bar(buf, format, ap);
321        va_end(ap);
322        if ((len != 6) && (len != 7)) exit(1);
324        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
326        exit(0);
328 main() { foo("hello\n"); }
330 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
331 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
332         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
335 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
337 dnl ===================================================================
338 dnl Checks for libraries.
339 dnl ===================================================================
341 dnl Replace `main' with a function in -lsocket:
342 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
343 if test "$cf_result" = no; then
344         AC_CHECK_LIB(socket, socket)
347 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
348 if test "$cf_result" = no; then
349         AC_CHECK_LIB(socket, setsockopt)
352 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
353 if test "$cf_result" = no; then
354         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
355         if test "$cf_result" = no; then
356                 AC_CHECK_LIB(nsl, gethostbyname)
357         else
358                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
359         fi
362 dnl ===================================================================
363 dnl Checks for packaging specific options.
364 dnl ===================================================================
366 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
367             [ if test "$withval" != no && test "$withval" != yes; then
368                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
369               fi ])
371 dnl ===================================================================
372 dnl Checks for a libraries, optional even if installed.
373 dnl ===================================================================
375 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
376 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
378         AC_MSG_CHECKING([for $2 support])
380         if test "[$]$1" != no; then
381                 AC_MSG_RESULT(yes)
382                 EL_SAVE_FLAGS
383                 if test -n "$withval" && test -d "$withval"; then
384                         # Be a little more careful when setting
385                         # include and lib directories. This way
386                         # $withval will work when includes are
387                         # there but the library is in the common
388                         # /usr/lib ... Does the right thing when
389                         # looking for gc on Debian.
390                         if test -d "$withval/include"; then
391                                 CFLAGS="$CFLAGS -I$withval/include"
392                                 CPPFLAGS="$CPPFLAGS -I$withval/include"
393                         else
394                                 CFLAGS="$CFLAGS -I$withval"
395                                 CPPFLAGS="$CPPFLAGS -I$withval"
396                         fi
397                         if test -d "$withval/lib"; then
398                                 LDFLAGS="$LDFLAGS -L$withval/lib"
399                         fi
400                 fi
402                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
403                 if test "[$]$1" = yes; then
404                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
405                 fi
407                 if test "[$]$1" = yes; then
408                         EL_CONFIG([$1], [$2])
409                         LIBS="$LIBS -l$4"
410                 else
411                         if test -n "[$]WITHVAL_$1" &&
412                            test "[$]WITHVAL_$1" != xno; then
413                                 AC_MSG_ERROR([$2 not found])
414                         fi
415                         EL_RESTORE_FLAGS
416                 fi
417         else
418                 AC_MSG_RESULT(disabled)
419         fi
422 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
423 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
425         $1=yes
426         WITHVAL_$1=
428         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
429         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
431         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
433         EL_LOG_CONFIG([$1], [$2], [])
436 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
437         [  --without-gpm           disable gpm (mouse) support])
439 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
440         [  --without-zlib          disable zlib support])
442 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
443         [  --without-bzlib         disable bzlib support])
445 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
446         [  --without-idn           disable international domain names support])
448 if test "x{with_gc}" != xno; then
449         EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
450                 [  --with-gc            enable Boehm's garbage collector])
453 EL_ARG_ENABLE(CONFIG_LZMA, lzma, [lzma],
454               [  --enable-lzma           enable lzma encoding support])
455 dnl ===================================================================
456 dnl Check for GSSAPI, optional even if installed.
457 dnl ===================================================================
459 enable_gssapi="no";
461 AC_ARG_WITH(gssapi, [  --with-gssapi           enable GSSAPI support],
462             [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
464 AC_MSG_CHECKING([for GSSAPI])
466 if test "$enable_gssapi" = "yes"; then
467         AC_MSG_RESULT(yes)
468         GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
469         GSSAPI_LIBS=`krb5-config --libs gssapi`
470         CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
471         LIBS="$GSSAPI_LIBS $LIBS"
472         EL_CONFIG(CONFIG_GSSAPI, [GssApi])
473 else
474         AC_MSG_RESULT(no)
477 AC_SUBST(CONFIG_GSSAPI)
479 dnl ===================================================================
480 dnl Bookmark and XBEL support
481 dnl ===================================================================
483 EL_SAVE_FLAGS
485 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
486               [  --disable-bookmarks     disable bookmark support])
488 # Check whether --enable-xbel or --disable-xbel was given.
489 if test "x${enable_xbel}" != xno; then
490         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
492         if test "$HAVE_LIBEXPAT" = yes; then
493                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
494                 if test "$HAVE_LIBEXPAT" = yes; then
495                         LIBS="$LIBS -lexpat"
496                 fi
497         fi
501 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
502               [XBEL bookmarks],
503               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
505 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
506         EL_RESTORE_FLAGS
509 dnl ===================================================================
510 dnl Checks for BSD sysmouse
511 dnl ===================================================================
513 HAVE_SYSMOUSE_HEADER="no"
515 # Either of these header files provides the (same) sysmouse interface
516 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
518 dnl ===================================================================
519 dnl Checks for OS/2
520 dnl ===================================================================
522 if test "$CONFIG_OS_OS2" = yes; then
523         EL_CONFIG_OS_OS2
526 dnl ===================================================================
527 dnl Checks for Win32
528 dnl ===================================================================
530 if test "$CONFIG_OS_WIN32" = yes; then
531         EL_CONFIG_OS_WIN32
534 dnl ===================================================================
535 dnl Check for SEE (Simple Ecmascript Engine)
536 dnl ===================================================================
537 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
538             [ if test "x$withval" != xno; then enable_see=yes; fi ])
540 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
541 # SEE_FLAGS but I really don't want to require people to have Guile in order
542 # to compile CVS. Also, the macro seems to be really stupid regarding searching
543 # for Guile in $PATH etc. --pasky
545 AC_MSG_CHECKING([for SEE])
547 CONFIG_ECMASCRIPT_SEE=no
549 if test "$enable_see" = "yes"; then
550         AC_MSG_RESULT(yes);
551         ## Based on the SEE_FLAGS macro.
553         if test -d "$withval"; then
554                 SEE_PATH="$withval:$PATH"
555         else
556                 SEE_PATH="$PATH"
557         fi
559         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
561         ## First, let's just see if we can find Guile at all.
562         if test "$SEE_CONFIG" != no; then
563                 cf_result="yes";
565                 SEE_LIBS="`$SEE_CONFIG --libs`"
566                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
567                 LIBS="$SEE_LIBS $LIBS"
568                 CPPFLAGS="$CPPFLAGS $SEE_CFLAGS"
569                 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
570                 AC_SUBST(SEE_CFLAGS)
571         else
572                 if test -n "$withval" && test "x$withval" != xno; then
573                         AC_MSG_ERROR([SEE not found])
574                 else
575                         AC_MSG_WARN([SEE support disabled])
576                 fi
577         fi
578 else
579         AC_MSG_RESULT(no);
583 dnl ===================================================================
584 dnl Check for SpiderMonkey, optional even if installed.
585 dnl ===================================================================
587 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
588             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
589 AC_MSG_CHECKING([for SpiderMonkey])
591 EL_SAVE_FLAGS
592 cf_result=no
594 if test -z "$disable_spidermonkey"; then
595         if test ! -d "$withval"; then
596                 withval="";
597         fi
598         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
599                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
600                         for spidermonkeylib in js smjs mozjs; do
601                                 if test "$cf_result" = no; then
602                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
604                                         if test ! -z "$spidermonkeydir"; then
605                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
606                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
607                                         fi
609                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
610                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
611                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
613                                         AC_TRY_LINK([#define XP_UNIX
614                                                      #include <jsapi.h>],
615                                                      [JS_GetImplementationVersion()],
616                                                      cf_result=yes, cf_result=no)
617                                 fi
618                         done
619                 done
620         done
623 AC_MSG_RESULT($cf_result)
624 CONFIG_SPIDERMONKEY="$cf_result"
625 EL_RESTORE_FLAGS
627 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
628    test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
629         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
630 else
631         CONFIG_ECMASCRIPT_SMJS=no
634 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
635 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
636 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
639 dnl ===================================================================
640 dnl Optional Spidermonkey-based ECMAScript browser scripting
641 dnl ===================================================================
643 AC_ARG_ENABLE(sm-scripting,
644               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
645               [if test "$enableval" != no; then enableval="yes"; fi
646                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
648 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
649    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
650         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
651 else
652         CONFIG_SCRIPTING_SPIDERMONKEY=no
655 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
656    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
657         LIBS="$LIBS $SPIDERMONKEY_LIBS"
658         AC_SUBST(SPIDERMONKEY_LIBS)
659         AC_SUBST(SPIDERMONKEY_CFLAGS)
660         AC_SUBST(CONFIG_SPIDERMONKEY)
663 dnl ===================================================================
664 dnl Check for Guile, optional even if installed.
665 dnl ===================================================================
667 enable_guile="no";
669 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
670             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
672 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
673 # GUILE_FLAGS but I really don't want to require people to have Guile in order
674 # to compile CVS. Also, the macro seems to be really stupid regarding searching
675 # for Guile in $PATH etc. --pasky
677 AC_MSG_CHECKING([for Guile])
679 if test "$enable_guile" = "yes"; then
680         AC_MSG_RESULT(yes);
681         ## Based on the GUILE_FLAGS macro.
683         if test -d "$withval"; then
684                 GUILE_PATH="$withval:$PATH"
685         else
686                 GUILE_PATH="$PATH"
687         fi
689         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
691         ## First, let's just see if we can find Guile at all.
692         if test "$GUILE_CONFIG" != no; then
693                 cf_result="yes";
695                 GUILE_LIBS="`guile-config link`"
696                 GUILE_CFLAGS="`guile-config compile`"
697                 LIBS="$GUILE_LIBS $LIBS"
698                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
699                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
700                 AC_SUBST(GUILE_CFLAGS)
701                 cat <<EOF
702 ***********************************************************************
703 The Guile support is incomplete and not so well integrated to ELinks
704 yet. That means, e.g., that you have no Guile console and there might
705 not be all the necessary hooks. Also, the Guile interface is not too
706 well tested (success stories heartily welcomed!).  See
707 src/scripting/guile/README for further details and hints.
708 ***********************************************************************
710         else
711                 if test -n "$withval" && test "x$withval" != xno; then
712                         AC_MSG_ERROR([Guile not found])
713                 else
714                         AC_MSG_WARN([Guile support disabled])
715                 fi
716         fi
717 else
718         AC_MSG_RESULT(no);
721 dnl ===================================================================
722 dnl Check for Perl
723 dnl ===================================================================
724 enable_perl="no";
726 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
727             [
728 if test "$withval" = yes; then
729         # FIXME: If withval is a valid directory append it to PATH
730         # so that you can specify one of several perl installations.
731         withval="";
732         enable_perl=yes;
734             ])
736 AC_MSG_CHECKING([for Perl])
738 cf_result=no
740 EL_SAVE_FLAGS
742 if test "$enable_perl" = "yes"; then
743         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
744         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
745         LIBS="$PERL_LIBS $LIBS"
746         CFLAGS="$PERL_CFLAGS $CFLAGS"
747         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
748         AC_TRY_LINK([
749 #include <EXTERN.h>
750 #include <perl.h>
751 #include <perlapi.h>
753                     [PerlInterpreter *my_perl = perl_alloc();],
754                     cf_result=yes, cf_result=no)
757 if test "$cf_result" != "yes"; then
758         EL_RESTORE_FLAGS
759 else
760         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
762         CFLAGS="$CFLAGS_X"
763         AC_SUBST(PERL_LIBS)
764         AC_SUBST(PERL_CFLAGS)
767 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
768 dnl ===================================================================
769 dnl Check for Python
770 dnl ===================================================================
771 enable_python="no";
773 AC_ARG_WITH(python, [  --with-python=[prefix]       enable Python support],
774             [
775 if test "$withval" != no; then
776         # FIXME: If withval is a valid directory append it to PATH
777         # so that you can specify one of several Python installations.
778         if test "$withval" != yes; then
779                 python_prefix="$withval"
780         else
781                 python_prefix=""
782         fi
783         enable_python=yes
784         cat <<EOF
785 ***********************************************************************
786 The Python support is incomplete and not so well integrated to ELinks
787 yet. That means, e.g.., that you have no Python console and there might
788 not be all the necessary hooks. Also, the Python interface is not too
789 well tested (success stories heartily welcomed!).
790 ***********************************************************************
793             ])
796 cf_result=no
798 EL_SAVE_FLAGS
800 if test "$enable_python" = "yes"; then
801         if test -n "$python_prefix" && test -d "$python_prefix/bin"; then
802                 PYTHON_PATH="$python_prefix/bin:$PATH"
803         else
804                 PYTHON_PATH="$PATH"
805         fi
806         AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
807         if test "$PYTHON" = "no" ; then
808                 cf_result=no
809         else
810                 PYTHON_CFLAGS="-I`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
811                 if test -n "$python_prefix" && test -d "$python_prefix/lib"; then
812                         PYTHON_LIBS="-L$python_prefix/lib -lpython"
813                 else
814                         PYTHON_LIBS="-lpython"
815                 fi
816                 LIBS="$PYTHON_LIBS $LIBS"
817                 CFLAGS="$PYTHON_CFLAGS $CFLAGS"
818                 AC_TRY_LINK([#include <Python.h>],
819                     [Py_Initialize();],
820                     cf_result=yes, cf_result=no)
822                 if test "$cf_result" != "yes"; then
823                         EL_RESTORE_FLAGS
824                 else
825                         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
827                         CFLAGS="$CFLAGS_X"
828                         AC_SUBST(PYTHON_LIBS)
829                         AC_SUBST(PYTHON_CFLAGS)
830                 fi
831         fi
834 AC_MSG_CHECKING([for Python])
835 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
838 dnl ===================================================================
839 dnl Check for Lua, optional even if installed.
840 dnl ===================================================================
842 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
843 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
845 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
846             [if test "$withval" = no; then disable_lua=yes; fi])
847 AC_MSG_CHECKING([for Lua])
849 EL_SAVE_FLAGS
850 cf_result=no
852 if test -z "$disable_lua"; then
853         if test ! -d "$withval"; then
854                 withval="";
855         fi
856         for luadir in "$withval" "" /usr /usr/local; do
857                 for suffix in "" 50 51; do
858                         if test "$cf_result" = no; then
859                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
861                                 if test ! -z "$luadir"; then
862                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
863                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
864                                 fi
866                                 LIBS="$LUA_LIBS $LIBS_X"
867                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
868                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
870                                 # Check that it is a compatible Lua version
871                                 AC_TRY_LINK([   #include <lua.h>
872                                                 #include <lualib.h>],
873                                             [   lua_State *L = lua_open();
874                                                 luaopen_base(L);
875                                                 luaopen_table(L);
876                                                 luaopen_io(L);
877                                                 luaopen_string(L);
878                                                 luaopen_math(L);
879                                                 lua_pushboolean(L, 1);
880                                                 lua_close(L);],
881                                             cf_result=yes, cf_result=no)
882                         fi
883                 done
884         done
887 AC_MSG_RESULT($cf_result)
889 if test "$cf_result" != yes; then
890         EL_RESTORE_FLAGS
891 else
892         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
893         AC_CHECK_HEADERS(lauxlib.h)
895         CFLAGS="$CFLAGS_X"
896         AC_SUBST(LUA_LIBS)
897         AC_SUBST(LUA_CFLAGS)
901 dnl ===================================================================
902 dnl Check for Ruby, optional even if installed.
903 dnl ===================================================================
905 EL_CONFIG_SCRIPTING_RUBY
907 dnl ===================================================================
908 dnl Setup global scripting
909 dnl ===================================================================
911 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])
912 AC_SUBST(CONFIG_SCRIPTING_GUILE)
913 AC_SUBST(CONFIG_SCRIPTING_LUA)
914 AC_SUBST(CONFIG_SCRIPTING_PERL)
915 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
916 AC_SUBST(CONFIG_SCRIPTING_RUBY)
917 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
918 AC_SUBST(CONFIG_SCRIPTING)
921 dnl ===================================================================
922 dnl Check for SSL support.
923 dnl ===================================================================
925 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
926 dnl is enabled, we won't try to use OpenSSL anymore.
928 dnl For wiping SSL hooks..
929 #ifdef CONFIG_SSL
931 disable_openssl=""
932 disable_gnutls=""
933 enable_gnutls=""
935 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
936             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
937 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
938             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
939 gnutls_withval="$withval"
941 if test "$enable_gnutls" = yes; then
942         disable_openssl=yes;
945 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
946             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
947 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
948 openssl_withval="$withval"
950 dnl ---- OpenSSL
952 AC_MSG_CHECKING([for OpenSSL])
954 EL_SAVE_FLAGS
955 cf_result="no"
957 if test "$disable_openssl" = yes; then
958         cf_result="not used"
959 else
960         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
961                          /usr/lib/openssl /usr/local/ssl \
962                          /usr/local/www /usr/lib/ssl /usr/local \
963                          /usr/pkg /opt /opt/openssl; do
964                 if test "$cf_result" = no; then
965                         if test -d "$ssldir"; then
966                                 OPENSSL_CFLAGS="-I$ssldir/include"
967                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
968                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
969                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
970 #                               # FIXME: This created serious portability problems. --pasky
971 #                               if test "$CC" == "gcc"; then
972 #                                       # I'm not sure about compatibility here. --pasky
973 #                                       LIBS="$LIBS -R$ssldir/lib"
974 #                               fi
975                         else
976                                 LIBS="-lssl -lcrypto $LIBS_X"
977                         fi
978                         AC_TRY_LINK([#include <openssl/ssl.h>],
979                                     [OpenSSL_add_all_algorithms()],
980                                     cf_result=yes, cf_result=no)
981                         if test "$cf_result" != yes; then
982                                 AC_TRY_LINK([#include <openssl/ssl.h>],
983                                             [SSLeay_add_ssl_algorithms()],
984                                             cf_result=yes, cf_result=no)
985                         fi
986                 fi
987         done
989         if test "$cf_result" != yes; then
990                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
991                         AC_MSG_ERROR([OpenSSL not found])
992                 fi
993                 EL_RESTORE_FLAGS
994         else
995                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
997                 CFLAGS="$CFLAGS_X"
998                 AC_SUBST(OPENSSL_CFLAGS)
999         fi
1002 AC_MSG_RESULT($cf_result)
1004 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1005 dnl ---- GNU TLS
1006 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
1007 dnl it looks ugly then.
1009 if test "$cf_result" = yes; then
1010         cf_result="not used"
1012 else
1013         EL_SAVE_FLAGS
1014         cf_result="no"
1016         if test -z "$disable_gnutls"; then
1017                 # Sure, we maybe _could_ use their macro, but how to ensure
1018                 # that the ./configure script won't fail if the macro won't be
1019                 # found..? :( --pasky
1021                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
1023                 if test -d "$gnutls_withval"; then
1024                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
1025                 fi
1027                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1029                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1030                         cf_result=no
1031                 else
1032                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1033                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1035                         LIBS="$GNUTLS_LIBS $LIBS_X"
1036                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1037                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1039                         # Verify if it's really usable.  gnutls_session was
1040                         # renamed to gnutls_session_t before GNU TLS 1.2.0
1041                         # (on 2004-06-13); ELinks now requires this.
1042                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
1043                                     [gnutls_session_t dummy;
1044                                      gnutls_check_version(NULL)],
1045                                     cf_result=yes, cf_result=no)
1046                 fi
1048                 if test "$cf_result" = yes; then
1049                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1051                         CFLAGS="$CFLAGS_X"
1052                         AC_SUBST(GNUTLS_CFLAGS)
1054                         # Verify if the MD5 compatibility layer is usable.
1055                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
1056                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
1057                                                   [GNU TLS OpenSSL compatibility],
1058                                                   gnutls/openssl.h, gnutls-openssl,
1059                                                   MD5_Init)
1060                 else
1061                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1062                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1063                         fi
1064                         EL_RESTORE_FLAGS
1065                 fi
1066         fi
1069 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1070 AC_MSG_RESULT($cf_result)
1072 dnl Final SSL setup
1074 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1075 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1076 AC_SUBST(CONFIG_OPENSSL)
1077 AC_SUBST(CONFIG_GNUTLS)
1079 #endif
1081 AC_MSG_CHECKING([whether to be or not to be])
1082 AC_MSG_RESULT([needs to be determined experimentally])
1084 dnl ===================================================================
1085 dnl Check for IPv6 support and related functions.
1086 dnl ===================================================================
1088 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1089 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1090 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1092 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1093 if test "$HAVE_GETADDRINFO" != yes; then
1094         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1095         if test "$HAVE_GETADDRINFO" = yes; then
1096                 LIBS="$LIBS -linet6"
1097         fi
1101 dnl ===================================================================
1102 dnl Checking for X11 (window title restoring).
1103 dnl ===================================================================
1105 AC_PATH_X
1106 if test x"$no_x" != xyes; then
1107         if test -n "$x_includes"; then
1108                 X_CFLAGS="-I$x_includes"
1109                 CPPFLAGS="$CPPFLAGS -I$x_includes"
1110         fi
1111         if test -n "$x_libraries"; then
1112                 LDFLAGS="$LDFLAGS -L$x_libraries"
1113         fi
1114         LIBS="-lX11 $LIBS"
1115         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1116         AC_SUBST(X_CFLAGS)
1120 dnl ===================================================================
1121 dnl Backtraces displaying support.
1122 dnl ===================================================================
1124 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1125 # possible checks for other system-specific means go here
1128 dnl ===================================================================
1129 dnl SMB protocol support.
1130 dnl ===================================================================
1132 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1135 dnl ===================================================================
1136 dnl Gettext grey zone. Beware.
1137 dnl ===================================================================
1139 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"
1141 AM_GNU_GETTEXT
1143 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1144 dnl # f33r d4 l33t... I hope it's portable. :)
1145 dnl cf_result=$((48#z - 48#a + 1));
1146 dnl AC_MSG_RESULT($cf_result)
1149 dnl ===================================================================
1150 dnl Compile-time features control
1151 dnl ===================================================================
1153 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1154               [  --disable-cookies       disable cookie support])
1156 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1157               [  --disable-formhist      disable form history support])
1159 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1160               [  --disable-globhist      disable global history support])
1163 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1164               [  --disable-mailcap       disable mailcap support])
1166 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1167               [  --disable-mimetypes     disable mimetypes files support])
1170 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1171               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1172               [IPv6],
1173               [  --disable-ipv6          disable IPv6 support])
1175 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1176               [  --enable-bittorrent     enable BitTorrent protocol support])
1178 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1179               [  --disable-data          disable data protocol support])
1181 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1182               [  --disable-uri-rewrite   disable URI rewrite support])
1184 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1185               [  --enable-cgi            enable local CGI support])
1187 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1188               [  --enable-finger         enable finger protocol support])
1190 dnl ===================================================================
1191 dnl FSP protocol
1192 dnl ===================================================================
1193 EL_SAVE_FLAGS
1195 if test "x${enable_fsp}" != xno; then
1196         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1198         if test "$HAVE_FSPLIB" = yes; then
1199                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1200                 if test "$HAVE_FSPLIB" = yes; then
1201                         LIBS="$LIBS -lfsplib"
1202                 else
1203                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1204                         if test "$HAVE_FSPLIB" = yes; then
1205                                 LIBS="$LIBS -lfsp"
1206                         fi
1207                 fi
1208         fi
1211 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1212               [  --enable-fsp            enable FSP protocol support])
1214 if test "x$CONFIG_FSP" = xno; then
1215         EL_RESTORE_FLAGS
1218 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1219               [  --disable-ftp           disable ftp protocol support])
1221 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1222               [  --enable-gopher         enable gopher protocol support])
1224 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1225               [  --enable-nntp           enable nntp protocol support])
1227 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1228               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1231 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1232               [  --disable-mouse         disable mouse support])
1234 # GPM mouse is Linux specific, so ...
1235 CONFIG_SYSMOUSE=yes
1236 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1237               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1238               [BSD sysmouse],
1239               [  --disable-sysmouse      disable BSD sysmouse support])
1241 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1242               [  --enable-88-colors      enable 88 color support])
1244 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1245               [  --enable-256-colors     enable 256 color support])
1248 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1249               [  --enable-exmode         enable exmode (CLI) interface])
1251 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1252               [  --disable-leds          disable LEDs support])
1254 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1255               [  --disable-marks         disable document marks support])
1258 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1259               [  --disable-css           disable Cascading Style Sheet support])
1261 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1262               [  --enable-html-highlight HTML highlighting using DOM engine])
1264 dnl Everything in the tree already uses CONFIG_DOM
1265 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1266 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1268 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1269               [  --disable-backtrace     disable backtrace support])
1271 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1272               [  --enable-no-root        enable prevention of usage by root])
1275 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1276               [  --enable-debug          enable leak debug and internal error checking])
1278 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1279               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1281 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1282               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1284 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1285               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1287 AC_ARG_ENABLE(weehoofooboomookerchoo,
1288               [
1289     Also check out the features.conf file for more information about features!
1290               ],
1291               [AC_MSG_ERROR(Are you strange, or what?)])
1294 dnl == EMX hack
1296 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1297 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1300 dnl ===================================================================
1301 dnl Export directory paths
1302 dnl ===================================================================
1304 # Set up the ``entry points'' if they were not supplied by builder
1305 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1306 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1308 # Create CONFDIR #define for config.h
1310 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1311 # it's autoconf fault to force us to do such hacks ;p.
1312 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1313   # sysconfdir is set to its default value... fine, let's append /elinks/
1314   # XXX: We can't modify listing of the default in ./configure --help :-(
1315   sysconfdir_n=`eval echo "$sysconfdir"`
1316   sysconfdir=$sysconfdir_n
1317   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1318         sysconfdir="$sysconfdir/elinks"
1321 CONFDIR=$sysconfdir
1322 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1323 AC_SUBST(CONFDIR)
1325 # Create LOCALEDIR #define for config.h
1326 LOCALEDIR=`eval echo "$datadir/locale"`
1327 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1328 AC_SUBST(LOCALEDIR)
1330 # Create LIBDIR #define for config.h
1331 LIBDIR=`eval echo "$libdir"`
1332 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1333 AC_SUBST(LIBDIR)
1335 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1336 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1338 dnl ===================================================================
1339 dnl A little fine tuning of gcc specific options (continued)
1340 dnl ===================================================================
1342 if test "x$ac_cv_prog_gcc" = "xyes"; then
1343   if test "$CONFIG_DEBUG" = "yes"; then
1344     dnl We want to see all warnings and live with none (in debug mode).
1345     CFLAGS="$CFLAGS -Werror"
1346   fi
1348   case "`$CC -dumpversion`" in
1349     3.0|3.1|3.2)
1350       # These should be ok using -Werror
1351       ;;
1352     3.*)
1353       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1354       # "dereferencing type-punned pointer will break strict-aliasing rules"
1355       # warnings. Disable them by not doing any strict-aliasing. The
1356       # alternative is just too ugly. Thanks gcc guys!! ;)
1357       CFLAGS="$CFLAGS -fno-strict-aliasing"
1358       ;;
1359     4.*)
1360       # Do not show warnings related to (char * | unsigned char *) type
1361       # difference.
1362       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1363       ;;
1364     *)
1365       # These should be ok using -Werror
1366       ;;
1367   esac
1370 # CFLAGS doesn't contain all compile flags. Some will be added only when
1371 # needed in the respective source directory. To get all compile flags
1372 # easily just add CPPFLAGS.
1373 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1375 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1376 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1378 dnl ===================================================================
1379 dnl Colored make output
1380 dnl ===================================================================
1382 if test $(`which tput` colors) -ge 4; then
1383         MAKE_COLOR=1
1384         AC_SUBST(MAKE_COLOR)
1387 dnl ===================================================================
1388 dnl Generated files
1389 dnl ===================================================================
1391 AC_OUTPUT([ \
1392  Makefile.config \
1393  contrib/elinks.spec \
1394  contrib/lua/hooks.lua \
1395  contrib/conv/w3m2links.awk \
1396  doc/man/man1/elinks.1 \
1397  src/intl/gettext/ref-add.sed \
1398  src/intl/gettext/ref-del.sed
1401 abs_srcdir="$(cd "$srcdir" && pwd)"
1402 # builddir is always absolute!
1403 if test "$abs_srcdir" != "$builddir"; then
1404         # Bootstrap the Makefile creation
1405         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1406         "$MAKE" "SRC=$abs_srcdir" init
1408         # Make cg-status ignore this build directory
1409         echo "*" > "$builddir/.gitignore"
1412 dnl ===================================================================
1413 dnl Configuration summary
1414 dnl ===================================================================
1416 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1417 cat features.log