Add Serbian translation
[elinks.git] / configure.in
blob999e787c67b157f822234b0a83ebe9e247b74762
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.13)
4 AC_INIT(src/main/main.c)
5 AC_CONFIG_AUX_DIR(config)
7 PACKAGE=elinks
8 VERSION=0.11.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_PROG_MAKE_SET
17 builddir="`pwd`"
19 dnl ===================================================================
20 dnl Load feature configuration file and start logging features.
21 dnl ===================================================================
23 features="features.conf"
24 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
25 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
26 echo "Feature summary:" > features.log
28 dnl ===================================================================
29 dnl Checks for programs.
30 dnl ===================================================================
32 AC_PROG_CC
33 AC_PROG_AWK
34 AC_PATH_PROGS(AWK, "$AWK")
35 AC_PROG_RANLIB
36 AC_PROG_INSTALL
38 AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id")
40 CONFIG_ASCIIDOC="no"
41 CONFIG_POD2HTML="no"
42 CONFIG_XMLTO="no"
43 CONFIG_JW="no"
45 if test "x$CONFIG_DOC" != xno; then
46         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
47         if test "x$ASCIIDOC" != "x"; then
48                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
49                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
50                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
51         fi
53         AC_PATH_PROGS(XMLTO, "xmlto")
54         if test "x$XMLTO" != "x"; then
55                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
56                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
57                 EL_CONFIG(MAN_XMLTO, [man (groff)])
58         fi
60         AC_PATH_PROGS(JW, "jw")
61         if test "x$JW" != "x"; then
62                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
63                 EL_CONFIG(MANUAL_JW, [PDF])
64         fi
66         AC_PATH_PROGS(POD2HTML, "pod2html")
67         if test "x$POD2HTML" != "x"; then
68                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
69         fi
72 AC_SUBST(CONFIG_ASCIIDOC)
73 AC_SUBST(CONFIG_POD2HTML)
74 AC_SUBST(CONFIG_XMLTO)
75 AC_SUBST(CONFIG_JW)
77 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation])
79 if test "$CONFIG_ASCIIDOC" = yes &&
80    test "$CONFIG_XMLTO" = yes &&
81    test "$CONFIG_JW" = yes; then
82         EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
85 if test "$CONFIG_ASCIIDOC" = yes &&
86    test "$CONFIG_XMLTO" = yes; then
87         EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
90 AC_SUBST(CONFIG_ASCIIDOC)
91 AC_SUBST(CONFIG_POD2HTML)
92 AC_SUBST(CONFIG_XMLTO)
93 AC_SUBST(CONFIG_JW)
95 dnl gcc specific options (to be continued at the bottom of configure)
96 if test "x$ac_cv_prog_gcc" = "xyes"; then
97   dnl We want to see all warnings and live with none.
98   dnl We can't set up -Werror here as there may be some warnings in test
99   dnl suite of configure, and we don't want to fail them.
100   CFLAGS="$CFLAGS -Wall"
103 dnl ===================================================================
104 dnl Checks for special OSes.
105 dnl ===================================================================
107 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
108 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
110         AC_MSG_CHECKING([for $2])
112         for flag in $3; do
113                 AC_TRY_COMPILE(, [#ifndef $flag
114 kill me!
115 #endif ], $1=yes, $1=no)
116                 if test "[$]$1" = yes; then
117                         EL_CONFIG([$1], [$2])
118                         break
119                 fi
120         done
122         AC_MSG_RESULT([$]$1)
125 EL_CHECK_COMPILER_MACROS(CONFIG_BEOS, [BEOS], [__BEOS__])
126 AC_SUBST(CONFIG_BEOS)
128 EL_CHECK_COMPILER_MACROS(CONFIG_RISCOS, [RISCOS], [__riscos__])
129 AC_SUBST(CONFIG_RISCOS)
131 EL_CHECK_COMPILER_MACROS(CONFIG_WIN32, [WIN32], [_WIN32 __WIN32__])
132 AC_SUBST(CONFIG_WIN32)
134 EL_CHECK_COMPILER_MACROS(CONFIG_OS2, [EMX], [__EMX__])
135 AC_SUBST(CONFIG_OS2)
136 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
138 AC_MSG_CHECKING([for UNIX])
139 dnl FIXME: some depend kind of mechanism
140 if test "$CONFIG_BEOS" = no && \
141    test "$CONFIG_RISCOS" = no && \
142    test "$CONFIG_WIN32" = no && \
143    test "$CONFIG_OS2" = no; then
144         EL_CONFIG(CONFIG_UNIX, [UNIX])
145 else
146         CONFIG_UNIX=no
148 AC_MSG_RESULT($CONFIG_UNIX)
149 AC_SUBST(CONFIG_UNIX)
151 dnl ===================================================================
152 dnl Checks for header files.
153 dnl ===================================================================
155 AC_HEADER_DIRENT
156 AC_HEADER_STDC
157 AC_HEADER_SYS_WAIT
158 AC_HEADER_TIME
160 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
161 AC_CHECK_HEADERS(sigaction.h)
162 AC_CHECK_HEADERS(arpa/inet.h)
163 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
164 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
165 AC_CHECK_HEADERS(ifaddrs.h)
166 AC_CHECK_HEADERS(sys/cygwin.h io.h)
167 AC_CHECK_HEADERS(sys/fmutex.h)
168 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
169 AC_CHECK_HEADERS(sys/resource.h)
170 AC_CHECK_HEADERS(sys/select.h)
171 AC_CHECK_HEADERS(sys/signal.h)
172 AC_CHECK_HEADERS(sys/socket.h)
173 AC_CHECK_HEADERS(sys/time.h)
174 AC_CHECK_HEADERS(sys/utsname.h)
175 AC_CHECK_HEADERS(stdint.h inttypes.h)
176 AC_CHECK_HEADERS(locale.h pwd.h)
177 AC_CHECK_HEADERS(termios.h)
180 AC_CHECK_HEADERS(sys/un.h,
181         [CONFIG_INTERLINK=yes
182          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
183         [CONFIG_INTERLINK=no])
184 AC_SUBST(CONFIG_INTERLINK)
186 dnl ===================================================================
187 dnl Checks for typedefs, structures, and compiler characteristics.
188 dnl ===================================================================
190 AC_STRUCT_TM
191 AC_C_CONST
192 AC_C_INLINE
193 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
195 AC_SYS_LARGEFILE
196 AC_TYPE_SIZE_T
197 AC_TYPE_OFF_T
198 EL_CHECK_TYPE(ssize_t, int)
199 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
200 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
201 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
202 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
204 AC_CHECK_SIZEOF(char, 1)
205 AC_CHECK_SIZEOF(short, 2)
206 AC_CHECK_SIZEOF(int, 4)
207 AC_CHECK_SIZEOF(long, 4)
208 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
210 dnl Check for variadic macros
211 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
212                 [#include <stdio.h>
213                  #define a(b,c...) printf(b,##c)],
214                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
216 dnl Check for -rdynamic
217 dnl FIXME: This check doesn't work. Something to do with the compiler
218 dnl happily ignoring it and stderr not being checked for error messages.
219 AC_MSG_CHECKING([for -rdynamic])
220 LDFLAGS_X="$LDFLAGS"
221 LDFLAGS="$LDFLAGS -rdynamic"
222 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
223 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
224 AC_MSG_RESULT($have_rdynamic)
226 dnl ===================================================================
227 dnl Check for POSIX <regex.h>
228 dnl ===================================================================
230 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
232 dnl ===================================================================
233 dnl Checks for library functions.
234 dnl ===================================================================
236 AC_PROG_GCC_TRADITIONAL
237 AC_FUNC_MEMCMP
238 AC_FUNC_MMAP
239 AC_FUNC_STRFTIME
240 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
241 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
242 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
243 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
244 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
245 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
246 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
247 AC_CHECK_FUNCS(gettimeofday clock_gettime)
249 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
251 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
252 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
253 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
255 dnl These aren't probably needed now, as they are commented in links.h.
256 dnl I've no idea about their historical background, but I keep them here
257 dnl just in the case they will help later. --pasky
258 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
259 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
260 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
261 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
263 if test x"$HAVE_RAISE" = x; then
264         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
265                 AC_ERROR([Unable to emulate raise()])
266         fi
269 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
270 AC_TRY_LINK([#include <stdarg.h>
271 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
272 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
273 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
274         EL_DEFINE(HAVE_VA_COPY, __va_copy)
277 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
278 AC_TRY_LINK([#include <unistd.h>
279 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
280 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
281 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
282         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
285 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
286 AC_TRY_RUN([
287 #include <stdio.h>
288 #include <stdarg.h>
289 #include <stdlib.h>
290 #include <string.h>
292 char buf[8];
294 int bar(char *buf, const char *format, va_list ap)
296        return vsnprintf(buf, 0, format, ap);
299 void foo(const char *format, ...) {
300        va_list ap;
301        int len;
303        va_start(ap, format);
304        len = bar(buf, format, ap);
305        va_end(ap);
306        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
308        va_start(ap, format);
309        len = bar(buf, format, ap);
310        va_end(ap);
311        if ((len != 6) && (len != 7)) exit(1);
313        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
315        exit(0);
317 main() { foo("hello\n"); }
319 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
320 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
321         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
324 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
326 dnl ===================================================================
327 dnl Checks for libraries.
328 dnl ===================================================================
330 dnl Replace `main' with a function in -lsocket:
331 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
332 if test "$cf_result" = no; then
333         AC_CHECK_LIB(socket, socket)
336 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
337 if test "$cf_result" = no; then
338         AC_CHECK_LIB(socket, setsockopt)
341 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
342 if test "$cf_result" = no; then
343         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
344         if test "$cf_result" = no; then
345                 AC_CHECK_LIB(nsl, gethostbyname)
346         else
347                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
348         fi
351 dnl ===================================================================
352 dnl Checks for packaging specific options.
353 dnl ===================================================================
355 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
356             [ if test "$withval" != no && test "$withval" != yes; then
357                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
358               fi ])
360 dnl ===================================================================
361 dnl Checks for a libraries, optional even if installed.
362 dnl ===================================================================
364 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
365 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
367         AC_MSG_CHECKING([for $2 support])
369         if test "[$]$1" != no; then
370                 AC_MSG_RESULT(yes)
371                 EL_SAVE_FLAGS
372                 if test -n "$withval" && test -d "$withval"; then
373                         CFLAGS="$CFLAGS -I$withval/include";
374                         CPPFLAGS="$CPPFLAGS -I$withval/include";
375                         LDFLAGS="$LDFLAGS -L$withval/lib";
376                 fi
378                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
379                 if test "[$]$1" = yes; then
380                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
381                 fi
383                 if test "[$]$1" = yes; then
384                         EL_CONFIG([$1], [$2])
385                         LIBS="$LIBS -l$4"
386                 else
387                         if test -n "[$]WITHVAL_$1" &&
388                            test "[$]WITHVAL_$1" != xno; then
389                                 AC_MSG_ERROR([$2 not found])
390                         fi
391                         EL_RESTORE_FLAGS
392                 fi
393         else
394                 AC_MSG_RESULT(disabled)
395         fi
398 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
399 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
401         $1=yes
402         WITHVAL_$1=
404         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
405         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
407         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
409         EL_LOG_CONFIG([$1], [$2], [])
412 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
413         [  --without-gpm           disable gpm (mouse) support])
415 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
416         [  --without-zlib          disable zlib support])
417 AC_SUBST(CONFIG_GZIP)
419 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
420         [  --without-bzlib         disable bzlib support])
421 AC_SUBST(CONFIG_BZIP2)
423 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
424         [  --without-idn           disable international domain names support])
426 dnl ===================================================================
427 dnl Bookmark and XBEL support
428 dnl ===================================================================
430 EL_SAVE_FLAGS
432 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
433               [  --disable-bookmarks     disable bookmark support])
434 AC_SUBST(CONFIG_BOOKMARKS)
436 # Check whether --enable-xbel or --disable-xbel was given.
437 if test "x${enable_xbel}" != xno; then
438         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
440         if test "$HAVE_LIBEXPAT" = yes; then
441                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
442                 if test "$HAVE_LIBEXPAT" = yes; then
443                         LIBS="$LIBS -lexpat"
444                 fi
445         fi
449 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
450               [XBEL bookmarks],
451               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
453 AC_SUBST(CONFIG_XBEL_BOOKMARKS)
455 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
456         EL_RESTORE_FLAGS
459 dnl ===================================================================
460 dnl Checks for BSD sysmouse
461 dnl ===================================================================
463 HAVE_SYSMOUSE_HEADER="no"
465 # Either of these header files provides the (same) sysmouse interface
466 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
468 dnl ===================================================================
469 dnl Checks for OS/2
470 dnl ===================================================================
472 if test "$CONFIG_OS2" = yes; then
473         EL_CONFIG_OS2
476 dnl ===================================================================
477 dnl Checks for Win32
478 dnl ===================================================================
480 if test "$CONFIG_WIN32" = yes; then
481         EL_CONFIG_WIN32
484 dnl ===================================================================
485 dnl Check for Guile, optional even if installed.
486 dnl ===================================================================
488 enable_guile="no";
490 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
491             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
493 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
494 # GUILE_FLAGS but I really don't want to require people to have Guile in order
495 # to compile CVS. Also, the macro seems to be really stupid regarding searching
496 # for Guile in $PATH etc. --pasky
498 AC_MSG_CHECKING([for Guile])
500 if test "$enable_guile" = "yes"; then
501         AC_MSG_RESULT(yes);
502         ## Based on the GUILE_FLAGS macro.
504         if test -d "$withval"; then
505                 GUILE_PATH="$withval:$PATH"
506         else
507                 GUILE_PATH="$PATH"
508         fi
510         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
512         ## First, let's just see if we can find Guile at all.
513         if test "$GUILE_CONFIG" != no; then
514                 cf_result="yes";
516                 GUILE_LIBS="`guile-config link`"
517                 GUILE_CFLAGS="`guile-config compile`"
518                 LIBS="$GUILE_LIBS $LIBS"
519                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
520                 EL_CONFIG(CONFIG_GUILE, [Guile])
521                 AC_SUBST(GUILE_CFLAGS)
522                 cat <<EOF
523 ***********************************************************************
524 The Guile support is incomplete and not so well integrated to ELinks
525 yet. That means, ie., that you have no Guile console and there might
526 not be all the necessary hooks. Also, the Guile interface is not too
527 well tested (success stories heartily welcomed!).  See
528 src/scripting/guile/README for further details and hints.
529 ***********************************************************************
531         else
532                 if test -n "$withval" && test "x$withval" != xno; then
533                         AC_MSG_ERROR([Guile not found])
534                 else
535                         AC_MSG_WARN([Guile support disabled])
536                 fi
537         fi
538 else
539         AC_MSG_RESULT(no);
542 dnl ===================================================================
543 dnl Check for Perl
544 dnl ===================================================================
545 enable_perl="no";
547 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
548             [
549 if test "$withval" = yes; then
550         # FIXME: If withval is a valid directory append it to PATH
551         # so that you can specify one of several perl installations.
552         withval="";
553         enable_perl=yes;
555             ])
557 AC_MSG_CHECKING([for Perl])
559 cf_result=no
561 EL_SAVE_FLAGS
563 if test "$enable_perl" = "yes"; then
564         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
565         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
566         LIBS="$PERL_LIBS $LIBS"
567         CFLAGS="$PERL_CFLAGS $CFLAGS"
568         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
569         AC_TRY_LINK([
570 #include <EXTERN.h>
571 #include <perl.h>
572 #include <perlapi.h>
574                     [PerlInterpreter *my_perl = perl_alloc();],
575                     cf_result=yes, cf_result=no)
578 if test "$cf_result" != "yes"; then
579         EL_RESTORE_FLAGS
580 else
581         EL_CONFIG(CONFIG_PERL, [Perl])
583         CFLAGS="$CFLAGS_X"
584         AC_SUBST(PERL_LIBS)
585         AC_SUBST(PERL_CFLAGS)
588 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
589 dnl ===================================================================
590 dnl Check for Python
591 dnl ===================================================================
592 enable_python="no";
594 AC_ARG_WITH(python, [  --with-python           enable Python support],
595             [
596 if test "$withval" = yes; then
597         # FIXME: If withval is a valid directory append it to PATH
598         # so that you can specify one of several Python installations.
599         withval="";
600         enable_python=yes;
601         cat <<EOF
602 ***********************************************************************
603 The Python support is incomplete and not so well integrated to ELinks
604 yet. That means, ie., that you have no Python console and there might
605 not be all the necessary hooks. Also, the Python interface is not too
606 well tested (success stories heartily welcomed!).
607 ***********************************************************************
610             ])
612 AC_MSG_CHECKING([for Python])
614 cf_result=no
616 EL_SAVE_FLAGS
618 if test "$enable_python" = "yes"; then
619         PYTHON_LIBS="-lpython"
620         PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
621         LIBS="$PYTHON_LIBS $LIBS"
622         CFLAGS="$PYTHON_CFLAGS $CFLAGS"
623         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
624         AC_TRY_LINK([
625 #include <Python.h>
627                     [Py_Initialize();],
628                     cf_result=yes, cf_result=no)
631 if test "$cf_result" != "yes"; then
632         EL_RESTORE_FLAGS
633 else
634         EL_CONFIG(CONFIG_PYTHON, [Python])
636         CFLAGS="$CFLAGS_X"
637         AC_SUBST(PYTHON_LIBS)
638         AC_SUBST(PYTHON_CFLAGS)
641 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
644 dnl ===================================================================
645 dnl Check for Lua, optional even if installed.
646 dnl ===================================================================
648 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
649 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
651 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
652             [if test "$withval" = no; then disable_lua=yes; fi])
653 AC_MSG_CHECKING([for Lua])
655 EL_SAVE_FLAGS
656 cf_result=no
658 if test -z "$disable_lua"; then
659         if test ! -d "$withval"; then
660                 withval="";
661         fi
662         for luadir in "$withval" "" /usr /usr/local; do
663                 for suffix in "" 50 51; do
664                         if test "$cf_result" = no; then
665                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
667                                 if test ! -z "$luadir"; then
668                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
669                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
670                                 fi
672                                 LIBS="$LUA_LIBS $LIBS_X"
673                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
674                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
676                                 # Check that it is a compatible Lua version
677                                 AC_TRY_LINK([   #include <lua.h>
678                                                 #include <lualib.h>],
679                                             [   lua_State *L = lua_open();
680                                                 lua_baselibopen(L);
681                                                 lua_mathlibopen(L);
682                                                 lua_strlibopen(L);
683                                                 lua_tablibopen(L);
684                                                 lua_pushboolean(L, 1);
685                                                 lua_close(L);],
686                                             cf_result=yes, cf_result=no)
687                         fi
688                 done
689         done
692 AC_MSG_RESULT($cf_result)
694 if test "$cf_result" != yes; then
695         EL_RESTORE_FLAGS
696 else
697         EL_CONFIG(CONFIG_LUA, [Lua])
698         AC_CHECK_HEADERS(lauxlib.h)
700         CFLAGS="$CFLAGS_X"
701         AC_SUBST(LUA_LIBS)
702         AC_SUBST(LUA_CFLAGS)
706 dnl ===================================================================
707 dnl Check for Ruby, optional even if installed.
708 dnl ===================================================================
710 EL_CONFIG_RUBY
712 dnl ===================================================================
713 dnl Setup global scripting
714 dnl ===================================================================
716 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY], [Scripting])
717 AC_SUBST(CONFIG_GUILE)
718 AC_SUBST(CONFIG_LUA)
719 AC_SUBST(CONFIG_PERL)
720 AC_SUBST(CONFIG_PYTHON)
721 AC_SUBST(CONFIG_RUBY)
722 AC_SUBST(CONFIG_SCRIPTING)
725 dnl ===================================================================
726 dnl Check for SpiderMonkey, optional even if installed.
727 dnl ===================================================================
729 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
730             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
731 AC_MSG_CHECKING([for SpiderMonkey])
733 EL_SAVE_FLAGS
734 cf_result=no
736 if test -z "$disable_spidermonkey"; then
737         if test ! -d "$withval"; then
738                 withval="";
739         fi
740         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
741                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
742                         for spidermonkeylib in js smjs; do
743                                 if test "$cf_result" = no; then
744                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
746                                         if test ! -z "$spidermonkeydir"; then
747                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
748                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
749                                         fi
751                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
752                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
753                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
755                                         AC_TRY_LINK([#define XP_UNIX
756                                                      #include <jsapi.h>],
757                                                      [JS_GetImplementationVersion()],
758                                                      cf_result=yes, cf_result=no)
759                                 fi
760                         done
761                 done
762         done
765 AC_MSG_RESULT($cf_result)
767 if test "$cf_result" != yes; then
768         EL_RESTORE_FLAGS
769 else
770         EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
772         CFLAGS="$CFLAGS_X"
773         AC_SUBST(SPIDERMONKEY_LIBS)
774         AC_SUBST(SPIDERMONKEY_CFLAGS)
777 AC_SUBST(CONFIG_SPIDERMONKEY)
779 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
780 AC_SUBST(CONFIG_ECMASCRIPT)
783 dnl ===================================================================
784 dnl Check for SSL support.
785 dnl ===================================================================
787 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
788 dnl is enabled, we won't try to use OpenSSL anymore.
790 dnl For wiping SSL hooks..
791 #ifdef CONFIG_SSL
793 disable_openssl=""
794 disable_gnutls=""
795 enable_gnutls=""
797 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
798             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
799 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
800             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
801 gnutls_withval="$withval"
803 if test "$enable_gnutls" = yes; then
804         disable_openssl=yes;
807 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
808             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
809 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
810 openssl_withval="$withval"
812 dnl ---- OpenSSL
814 AC_MSG_CHECKING([for OpenSSL])
816 EL_SAVE_FLAGS
817 cf_result="no"
819 if test "$disable_openssl" = yes; then
820         cf_result="not used"
821 else
822         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
823                          /usr/lib/openssl /usr/local/ssl \
824                          /usr/local/www /usr/lib/ssl /usr/local \
825                          /usr/pkg /opt /opt/openssl; do
826                 if test "$cf_result" = no; then
827                         if test -d "$ssldir"; then
828                                 OPENSSL_CFLAGS="-I$ssldir/include"
829                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
830                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
831                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
832 #                               # FIXME: This created serious portability problems. --pasky
833 #                               if test "$CC" == "gcc"; then
834 #                                       # I'm not sure about compatibility here. --pasky
835 #                                       LIBS="$LIBS -R$ssldir/lib"
836 #                               fi
837                         else
838                                 LIBS="-lssl -lcrypto $LIBS_X"
839                         fi
840                         AC_TRY_LINK([#include <openssl/ssl.h>],
841                                     [OpenSSL_add_all_algorithms()],
842                                     cf_result=yes, cf_result=no)
843                         if test "$cf_result" != yes; then
844                                 AC_TRY_LINK([#include <openssl/ssl.h>],
845                                             [SSLeay_add_ssl_algorithms()],
846                                             cf_result=yes, cf_result=no)
847                         fi
848                 fi
849         done
851         if test "$cf_result" != yes; then
852                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
853                         AC_MSG_ERROR([OpenSSL not found])
854                 fi
855                 EL_RESTORE_FLAGS
856         else
857                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
859                 CFLAGS="$CFLAGS_X"
860                 AC_SUBST(OPENSSL_CFLAGS)
861         fi
864 AC_MSG_RESULT($cf_result)
866 dnl ---- GNU TLS
867 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
868 dnl it looks ugly then.
870 if test "$cf_result" = yes; then
871         cf_result="not used"
873 else
874         EL_SAVE_FLAGS
875         cf_result="no"
877         if test -z "$disable_gnutls"; then
878                 # Sure, we maybe _could_ use their macro, but how to ensure
879                 # that the ./configure script won't fail if the macro won't be
880                 # found..? :( --pasky
882                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
884                 if test -d "$gnutls_withval"; then
885                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
886                 fi
888                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
890                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
891                         cf_result=no
892                 else
893                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
894                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
896                         LIBS="$GNUTLS_LIBS $LIBS_X"
897                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
898                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
900                         # Verify if it's really usable
901                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
902                                     [gnutls_check_version(NULL)],
903                                     cf_result=yes, cf_result=no)
904                 fi
906                 if test "$cf_result" = yes; then
907                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
909                         CFLAGS="$CFLAGS_X"
910                         AC_SUBST(GNUTLS_CFLAGS)
912                         # Verify if the MD5 compatibility layer is usable.
913                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
914                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
915                                                   [GNU TLS OpenSSL compatibility],
916                                                   gnutls/openssl.h, gnutls-openssl,
917                                                   MD5_Init)
918                 else
919                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
920                                 AC_MSG_ERROR([GNUTLS not found])
921                         fi
922                         EL_RESTORE_FLAGS
923                 fi
924         fi
927 AC_MSG_CHECKING([for GNU TLS])
928 AC_MSG_RESULT($cf_result)
930 dnl Final SSL setup
932 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
933 AC_SUBST(CONFIG_OPENSSL)
934 AC_SUBST(CONFIG_GNUTLS)
935 AC_SUBST(CONFIG_SSL)
937 #endif
939 AC_MSG_CHECKING([whether to be or not to be])
940 AC_MSG_RESULT([needs to be determined experimentally])
942 dnl ===================================================================
943 dnl Check for IPv6 support and related functions.
944 dnl ===================================================================
946 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
947 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
948 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
950 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
951 if test "$HAVE_GETADDRINFO" != yes; then
952         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
953         if test "$HAVE_GETADDRINFO" = yes; then
954                 LIBS="$LIBS -linet6"
955         fi
959 dnl ===================================================================
960 dnl Checking for X11 (window title restoring).
961 dnl ===================================================================
963 AC_PATH_X
964 if test x"$no_x" != xyes; then
965         if test -n "$x_includes"; then
966                 X_CFLAGS="-I$x_includes"
967                 CPPFLAGS="$CPPFLAGS -I$x_includes"
968         fi
969         if test -n "$x_libraries"; then
970                 LDFLAGS="$LDFLAGS -L$x_libraries"
971         fi
972         LIBS="-lX11 $LIBS"
973         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
974         AC_SUBST(X_CFLAGS)
978 dnl ===================================================================
979 dnl Backtraces displaying support.
980 dnl ===================================================================
982 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
983 # possible checks for other system-specific means go here
986 dnl ===================================================================
987 dnl SMB protocol support.
988 dnl ===================================================================
990 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
993 dnl ===================================================================
994 dnl Gettext grey zone. Beware.
995 dnl ===================================================================
997 ALL_LINGUAS="be bg ca cs da de el es et fi fr gl hr hu id is it lt nl no pl pt pt_BR ro ru sk sr sv tr uk"
999 AM_GNU_GETTEXT
1001 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1002 dnl # f33r d4 l33t... I hope it's portable. :)
1003 dnl cf_result=$((48#z - 48#a + 1));
1004 dnl AC_MSG_RESULT($cf_result)
1007 dnl ===================================================================
1008 dnl Compile-time features control
1009 dnl ===================================================================
1011 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1012               [  --disable-cookies       disable cookie support])
1013 AC_SUBST(CONFIG_COOKIES)
1015 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1016               [  --disable-formhist      disable form history support])
1017 AC_SUBST(CONFIG_FORMHIST)
1019 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1020               [  --disable-globhist      disable global history support])
1021 AC_SUBST(CONFIG_GLOBHIST)
1024 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1025               [  --disable-mailcap       disable mailcap support])
1026 AC_SUBST(CONFIG_MAILCAP)
1028 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1029               [  --disable-mimetypes     disable mimetypes files support])
1030 AC_SUBST(CONFIG_MIMETYPES)
1033 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1034               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1035               [IPv6],
1036               [  --disable-ipv6          disable IPv6 support])
1037 AC_SUBST(CONFIG_IPV6)
1039 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1040               [  --enable-bittorrent     enable BitTorrent protocol support])
1041 AC_SUBST(CONFIG_BITTORRENT)
1043 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1044               [  --disable-data          disable data protocol support])
1045 AC_SUBST(CONFIG_DATA)
1047 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1048               [  --disable-uri-rewrite   disable URI rewrite support])
1049 AC_SUBST(CONFIG_URI_REWRITE)
1051 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1052               [  --enable-cgi            enable local CGI support])
1053 AC_SUBST(CONFIG_CGI)
1055 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1056               [  --enable-finger         enable finger protocol support])
1057 AC_SUBST(CONFIG_FINGER)
1059 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1060               [  --disable-ftp           disable ftp protocol support])
1061 AC_SUBST(CONFIG_FTP)
1063 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1064               [  --enable-gopher         enable gopher protocol support])
1065 AC_SUBST(CONFIG_GOPHER)
1067 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1068               [  --enable-nntp           enable nntp protocol support])
1069 AC_SUBST(CONFIG_NNTP)
1071 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1072               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1073 AC_SUBST(CONFIG_SMB)
1076 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1077               [  --disable-mouse         disable mouse support])
1078 AC_SUBST(CONFIG_MOUSE)
1080 # GPM mouse is Linux specific, so ...
1081 CONFIG_SYSMOUSE=yes
1082 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1083               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1084               [BSD sysmouse],
1085               [  --disable-sysmouse      disable BSD sysmouse support])
1086 AC_SUBST(CONFIG_SYSMOUSE)
1088 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1089               [  --enable-88-colors     enable 88 color support])
1090 AC_SUBST(CONFIG_256_COLORS)
1092 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1093               [  --enable-256-colors     enable 256 color support])
1094 AC_SUBST(CONFIG_256_COLORS)
1097 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1098               [  --enable-exmode         enable exmode (CLI) interface])
1099 AC_SUBST(CONFIG_EXMODE)
1101 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1102               [  --disable-leds          disable LEDs support])
1103 AC_SUBST(CONFIG_LEDS)
1105 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1106               [  --disable-marks         disable document marks support])
1107 AC_SUBST(CONFIG_MARKS)
1110 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1111               [  --disable-css           disable Cascading Style Sheet support])
1112 AC_SUBST(CONFIG_CSS)
1114 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1115               [  --enable-html-highlight HTML highlighting using DOM engine])
1116 AC_SUBST(CONFIG_HTML_HIGHLIGHT)
1118 dnl Everything in the tree already uses CONFIG_DOM
1119 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1120 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1121 AC_SUBST(CONFIG_DOM)
1123 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1124               [  --disable-backtrace     disable backtrace support])
1125 AC_SUBST(CONFIG_BACKTRACE)
1127 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1128               [  --enable-no-root        enable prevention of usage by root])
1129 AC_SUBST(CONFIG_NO_ROOT_EXEC)
1132 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1133               [  --enable-debug          enable leak debug and internal error checking])
1134 AC_SUBST(CONFIG_DEBUG)
1136 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1137               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1138 AC_SUBST(CONFIG_FASTMEM)
1140 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1141               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1142 AC_SUBST(CONFIG_OWN_LIBC)
1144 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1145               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1146 AC_SUBST(CONFIG_SMALL)
1148 if test "$CONFIG_OPENSSL" != yes &&
1149    test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1150    test "$CONFIG_OWN_LIBC" = yes;
1151 then
1152         AC_MSG_CHECKING(for built-in MD5 support)
1153         AC_MSG_RESULT(yes)
1154         EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1157 AC_SUBST(CONFIG_MD5)
1159 if test "$CONFIG_BITTORRENT" = yes; then
1160         if test "$CONFIG_OPENSSL" != yes ||
1161            test "$CONFIG_OWN_LIBC" = yes;
1162         then
1163                 AC_MSG_CHECKING(for built-in SHA1 support)
1164                 AC_MSG_RESULT(yes)
1165                 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1166         fi
1169 AC_SUBST(CONFIG_SHA1)
1171 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1172 then
1173         EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1175 AC_SUBST(CONFIG_SCANNER)
1177 AC_ARG_ENABLE(weehoofooboomookerchoo,
1178               [
1179     Also check out the features.conf file for more information about features!
1180               ],
1181               [AC_MSG_ERROR(Are you strange, or what?)])
1184 dnl == EMX hack
1186 test "$CONFIG_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1187 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1190 dnl ===================================================================
1191 dnl Export directory paths
1192 dnl ===================================================================
1194 # Set up the ``entry points'' if they were not supplied by builder
1195 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1196 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1198 # Create CONFDIR #define for config.h
1200 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1201 # it's autoconf fault to force us to do such hacks ;p.
1202 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1203   # sysconfdir is set to its default value... fine, let's append /elinks/
1204   # XXX: We can't modify listing of the default in ./configure --help :-(
1205   sysconfdir_n=`eval echo "$sysconfdir"`
1206   sysconfdir=$sysconfdir_n
1207   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1208         sysconfdir="$sysconfdir/elinks"
1211 CONFDIR=$sysconfdir
1212 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1213 AC_SUBST(CONFDIR)
1215 # Create LOCALEDIR #define for config.h
1216 LOCALEDIR=`eval echo "$datadir/locale"`
1217 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1218 AC_SUBST(LOCALEDIR)
1220 # Create LIBDIR #define for config.h
1221 LIBDIR=`eval echo "$libdir"`
1222 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1223 AC_SUBST(LIBDIR)
1225 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1226 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1228 dnl ===================================================================
1229 dnl A little fine tuning of gcc specific options (continued)
1230 dnl ===================================================================
1232 if test "x$ac_cv_prog_gcc" = "xyes"; then
1233   if test "$CONFIG_DEBUG" = "yes"; then
1234     dnl We want to see all warnings and live with none (in debug mode).
1235     CFLAGS="$CFLAGS -Werror"
1236   fi
1238   case "`gcc -dumpversion`" in
1239     3.0|3.1|3.2)
1240       # These should be ok using -Werror
1241       ;;
1242     3.*)
1243       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1244       # "dereferencing type-punned pointer will break strict-aliasing rules"
1245       # warnings. Disable them by not doing any strict-aliasing. The
1246       # alternative is just too ugly. Thanks gcc guys!! ;)
1247       CFLAGS="$CFLAGS -fno-strict-aliasing"
1248       ;;
1249     4.*)
1250       # Do not show warnings related to (char * | unsigned char *) type
1251       # difference.
1252       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1253       ;;
1254     *)
1255       # These should be ok using -Werror
1256       ;;
1257   esac
1260 # CFLAGS doesn't contain all compile flags. Some will be added only when
1261 # needed in the respective source directory. To get all compile flags
1262 # easily just add CPPFLAGS.
1263 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1265 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1266 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1268 dnl ===================================================================
1269 dnl Generated files
1270 dnl ===================================================================
1272 AC_OUTPUT([ \
1273  Makefile.config \
1274  contrib/elinks.spec \
1275  contrib/lua/hooks.lua \
1276  contrib/conv/w3m2links.awk \
1277  doc/man/man1/elinks.1 \
1278  src/intl/gettext/ref-add.sed \
1279  src/intl/gettext/ref-del.sed
1283 dnl ===================================================================
1284 dnl Configuration summary
1285 dnl ===================================================================
1287 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1288 cat features.log