1 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT(src/main/main.c)
5 AC_CONFIG_AUX_DIR(config)
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])
23 dnl ===================================================================
24 dnl Load feature configuration file and start logging features.
25 dnl ===================================================================
27 features="features.conf"
28 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
29 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
30 echo "Feature summary:" > features.log
32 dnl ===================================================================
33 dnl Checks for programs.
34 dnl ===================================================================
38 AC_PATH_PROGS(AWK, "$AWK")
42 AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id")
49 if test "x$CONFIG_DOC" != xno; then
50 AC_PATH_PROGS(ASCIIDOC, "asciidoc")
51 if test "x$ASCIIDOC" != "x"; then
52 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
53 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
54 EL_CONFIG(MAN_ASCIIDOC, [HTML])
57 AC_PATH_PROGS(XMLTO, "xmlto")
58 if test "x$XMLTO" != "x"; then
59 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
60 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
61 EL_CONFIG(MAN_XMLTO, [man (groff)])
64 AC_PATH_PROGS(JW, "jw")
65 if test "x$JW" != "x"; then
66 EL_CONFIG(CONFIG_JW, [JadeWrapper])
67 EL_CONFIG(MANUAL_JW, [PDF])
70 AC_PATH_PROGS(POD2HTML, "pod2html")
71 if test "x$POD2HTML" != "x"; then
72 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
76 AC_SUBST(CONFIG_ASCIIDOC)
77 AC_SUBST(CONFIG_POD2HTML)
78 AC_SUBST(CONFIG_XMLTO)
81 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation])
83 if test "$CONFIG_ASCIIDOC" = yes &&
84 test "$CONFIG_XMLTO" = yes &&
85 test "$CONFIG_JW" = yes; then
86 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
89 if test "$CONFIG_ASCIIDOC" = yes &&
90 test "$CONFIG_XMLTO" = yes; then
91 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
94 AC_SUBST(CONFIG_ASCIIDOC)
95 AC_SUBST(CONFIG_POD2HTML)
96 AC_SUBST(CONFIG_XMLTO)
99 dnl gcc specific options (to be continued at the bottom of configure)
100 if test "x$ac_cv_prog_gcc" = "xyes"; then
101 dnl We want to see all warnings and live with none.
102 dnl We can't set up -Werror here as there may be some warnings in test
103 dnl suite of configure, and we don't want to fail them.
104 CFLAGS="$CFLAGS -Wall"
107 dnl ===================================================================
108 dnl Checks for special OSes.
109 dnl ===================================================================
111 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
112 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
114 AC_MSG_CHECKING([for $2])
117 AC_TRY_COMPILE(, [#ifndef $flag
119 #endif ], $1=yes, $1=no)
120 if test "[$]$1" = yes; then
121 EL_CONFIG([$1], [$2])
129 EL_CHECK_COMPILER_MACROS(CONFIG_BEOS, [BEOS], [__BEOS__])
130 AC_SUBST(CONFIG_BEOS)
132 EL_CHECK_COMPILER_MACROS(CONFIG_RISCOS, [RISCOS], [__riscos__])
133 AC_SUBST(CONFIG_RISCOS)
135 EL_CHECK_COMPILER_MACROS(CONFIG_WIN32, [WIN32], [_WIN32 __WIN32__])
136 AC_SUBST(CONFIG_WIN32)
138 EL_CHECK_COMPILER_MACROS(CONFIG_OS2, [EMX], [__EMX__])
140 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
142 AC_MSG_CHECKING([for UNIX])
143 dnl FIXME: some depend kind of mechanism
144 if test "$CONFIG_BEOS" = no && \
145 test "$CONFIG_RISCOS" = no && \
146 test "$CONFIG_WIN32" = no && \
147 test "$CONFIG_OS2" = no; then
148 EL_CONFIG(CONFIG_UNIX, [UNIX])
152 AC_MSG_RESULT($CONFIG_UNIX)
153 AC_SUBST(CONFIG_UNIX)
155 dnl ===================================================================
156 dnl Checks for header files.
157 dnl ===================================================================
164 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
165 AC_CHECK_HEADERS(sigaction.h)
166 AC_CHECK_HEADERS(arpa/inet.h)
167 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
168 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
169 AC_CHECK_HEADERS(ifaddrs.h)
170 AC_CHECK_HEADERS(sys/cygwin.h io.h)
171 AC_CHECK_HEADERS(sys/fmutex.h)
172 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
173 AC_CHECK_HEADERS(sys/resource.h)
174 AC_CHECK_HEADERS(sys/select.h)
175 AC_CHECK_HEADERS(sys/signal.h)
176 AC_CHECK_HEADERS(sys/socket.h)
177 AC_CHECK_HEADERS(sys/time.h)
178 AC_CHECK_HEADERS(sys/utsname.h)
179 AC_CHECK_HEADERS(stdint.h inttypes.h)
180 AC_CHECK_HEADERS(locale.h pwd.h)
181 AC_CHECK_HEADERS(termios.h)
184 AC_CHECK_HEADERS(sys/un.h,
185 [CONFIG_INTERLINK=yes
186 EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
187 [CONFIG_INTERLINK=no])
188 AC_SUBST(CONFIG_INTERLINK)
190 dnl ===================================================================
191 dnl Checks for typedefs, structures, and compiler characteristics.
192 dnl ===================================================================
197 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
202 EL_CHECK_TYPE(ssize_t, int)
203 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
204 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
205 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
206 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
208 AC_CHECK_SIZEOF(char, 1)
209 AC_CHECK_SIZEOF(short, 2)
210 AC_CHECK_SIZEOF(int, 4)
211 AC_CHECK_SIZEOF(long, 4)
212 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
214 dnl Check for variadic macros
215 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
217 #define a(b,c...) printf(b,##c)],
218 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
220 dnl Check for -rdynamic
221 dnl FIXME: This check doesn't work. Something to do with the compiler
222 dnl happily ignoring it and stderr not being checked for error messages.
223 AC_MSG_CHECKING([for -rdynamic])
225 LDFLAGS="$LDFLAGS -rdynamic"
226 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
227 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
228 AC_MSG_RESULT($have_rdynamic)
230 dnl ===================================================================
231 dnl Check for POSIX <regex.h>
232 dnl ===================================================================
234 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
236 dnl ===================================================================
237 dnl Checks for library functions.
238 dnl ===================================================================
240 AC_PROG_GCC_TRADITIONAL
244 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
245 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
246 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
247 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
248 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
249 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
250 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
251 AC_CHECK_FUNCS(gettimeofday clock_gettime)
253 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
255 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
256 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
257 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
259 dnl These aren't probably needed now, as they are commented in links.h.
260 dnl I've no idea about their historical background, but I keep them here
261 dnl just in the case they will help later. --pasky
262 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
263 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
264 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
265 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
267 if test x"$HAVE_RAISE" = x; then
268 if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
269 AC_ERROR([Unable to emulate raise()])
273 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
274 AC_TRY_LINK([#include <stdarg.h>
275 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
276 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
277 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
278 EL_DEFINE(HAVE_VA_COPY, __va_copy)
281 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
282 AC_TRY_LINK([#include <unistd.h>
283 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
284 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
285 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
286 EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
289 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
298 int bar(char *buf, const char *format, va_list ap)
300 return vsnprintf(buf, 0, format, ap);
303 void foo(const char *format, ...) {
307 va_start(ap, format);
308 len = bar(buf, format, ap);
310 if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
312 va_start(ap, format);
313 len = bar(buf, format, ap);
315 if ((len != 6) && (len != 7)) exit(1);
317 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
321 main() { foo("hello\n"); }
323 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
324 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
325 EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
328 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
330 dnl ===================================================================
331 dnl Checks for libraries.
332 dnl ===================================================================
334 dnl Replace `main' with a function in -lsocket:
335 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
336 if test "$cf_result" = no; then
337 AC_CHECK_LIB(socket, socket)
340 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
341 if test "$cf_result" = no; then
342 AC_CHECK_LIB(socket, setsockopt)
345 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
346 if test "$cf_result" = no; then
347 AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
348 if test "$cf_result" = no; then
349 AC_CHECK_LIB(nsl, gethostbyname)
351 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
355 dnl ===================================================================
356 dnl Checks for packaging specific options.
357 dnl ===================================================================
359 AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
360 [ if test "$withval" != no && test "$withval" != yes; then
361 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
364 dnl ===================================================================
365 dnl Checks for a libraries, optional even if installed.
366 dnl ===================================================================
368 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
369 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
371 AC_MSG_CHECKING([for $2 support])
373 if test "[$]$1" != no; then
376 if test -n "$withval" && test -d "$withval"; then
377 CFLAGS="$CFLAGS -I$withval/include";
378 CPPFLAGS="$CPPFLAGS -I$withval/include";
379 LDFLAGS="$LDFLAGS -L$withval/lib";
382 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
383 if test "[$]$1" = yes; then
384 AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
387 if test "[$]$1" = yes; then
388 EL_CONFIG([$1], [$2])
391 if test -n "[$]WITHVAL_$1" &&
392 test "[$]WITHVAL_$1" != xno; then
393 AC_MSG_ERROR([$2 not found])
398 AC_MSG_RESULT(disabled)
402 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
403 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
408 AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
409 if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
411 EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
413 EL_LOG_CONFIG([$1], [$2], [])
416 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
417 [ --without-gpm disable gpm (mouse) support])
419 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
420 [ --without-zlib disable zlib support])
422 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
423 [ --without-bzlib disable bzlib support])
425 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
426 [ --without-idn disable international domain names support])
428 dnl ===================================================================
429 dnl Bookmark and XBEL support
430 dnl ===================================================================
434 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
435 [ --disable-bookmarks disable bookmark support])
437 # Check whether --enable-xbel or --disable-xbel was given.
438 if test "x${enable_xbel}" != xno; then
439 AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
441 if test "$HAVE_LIBEXPAT" = yes; then
442 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
443 if test "$HAVE_LIBEXPAT" = yes; then
450 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
452 [ --disable-xbel disable XBEL bookmark support (requires expat)])
454 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
458 dnl ===================================================================
459 dnl Checks for BSD sysmouse
460 dnl ===================================================================
462 HAVE_SYSMOUSE_HEADER="no"
464 # Either of these header files provides the (same) sysmouse interface
465 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
467 dnl ===================================================================
469 dnl ===================================================================
471 if test "$CONFIG_OS2" = yes; then
475 dnl ===================================================================
477 dnl ===================================================================
479 if test "$CONFIG_WIN32" = yes; then
483 dnl ===================================================================
484 dnl Check for Guile, optional even if installed.
485 dnl ===================================================================
489 AC_ARG_WITH(guile, [ --with-guile enable Guile support],
490 [ if test "x$withval" != xno; then enable_guile=yes; fi ])
492 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
493 # GUILE_FLAGS but I really don't want to require people to have Guile in order
494 # to compile CVS. Also, the macro seems to be really stupid regarding searching
495 # for Guile in $PATH etc. --pasky
497 AC_MSG_CHECKING([for Guile])
499 if test "$enable_guile" = "yes"; then
501 ## Based on the GUILE_FLAGS macro.
503 if test -d "$withval"; then
504 GUILE_PATH="$withval:$PATH"
509 AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
511 ## First, let's just see if we can find Guile at all.
512 if test "$GUILE_CONFIG" != no; then
515 GUILE_LIBS="`guile-config link`"
516 GUILE_CFLAGS="`guile-config compile`"
517 LIBS="$GUILE_LIBS $LIBS"
518 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
519 EL_CONFIG(CONFIG_GUILE, [Guile])
520 AC_SUBST(GUILE_CFLAGS)
522 ***********************************************************************
523 The Guile support is incomplete and not so well integrated to ELinks
524 yet. That means, ie., that you have no Guile console and there might
525 not be all the necessary hooks. Also, the Guile interface is not too
526 well tested (success stories heartily welcomed!). See
527 src/scripting/guile/README for further details and hints.
528 ***********************************************************************
531 if test -n "$withval" && test "x$withval" != xno; then
532 AC_MSG_ERROR([Guile not found])
534 AC_MSG_WARN([Guile support disabled])
541 dnl ===================================================================
543 dnl ===================================================================
546 AC_ARG_WITH(perl, [ --with-perl enable Perl support],
548 if test "$withval" = yes; then
549 # FIXME: If withval is a valid directory append it to PATH
550 # so that you can specify one of several perl installations.
556 AC_MSG_CHECKING([for Perl])
562 if test "$enable_perl" = "yes"; then
563 PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
564 PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
565 LIBS="$PERL_LIBS $LIBS"
566 CFLAGS="$PERL_CFLAGS $CFLAGS"
567 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
573 [PerlInterpreter *my_perl = perl_alloc();],
574 cf_result=yes, cf_result=no)
577 if test "$cf_result" != "yes"; then
580 EL_CONFIG(CONFIG_PERL, [Perl])
584 AC_SUBST(PERL_CFLAGS)
587 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
588 dnl ===================================================================
590 dnl ===================================================================
593 AC_ARG_WITH(python, [ --with-python enable Python support],
595 if test "$withval" = yes; then
596 # FIXME: If withval is a valid directory append it to PATH
597 # so that you can specify one of several Python installations.
601 ***********************************************************************
602 The Python support is incomplete and not so well integrated to ELinks
603 yet. That means, ie., that you have no Python console and there might
604 not be all the necessary hooks. Also, the Python interface is not too
605 well tested (success stories heartily welcomed!).
606 ***********************************************************************
611 AC_MSG_CHECKING([for Python])
617 if test "$enable_python" = "yes"; then
618 PYTHON_LIBS="-lpython"
619 PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
620 LIBS="$PYTHON_LIBS $LIBS"
621 CFLAGS="$PYTHON_CFLAGS $CFLAGS"
622 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
627 cf_result=yes, cf_result=no)
630 if test "$cf_result" != "yes"; then
633 EL_CONFIG(CONFIG_PYTHON, [Python])
636 AC_SUBST(PYTHON_LIBS)
637 AC_SUBST(PYTHON_CFLAGS)
640 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
643 dnl ===================================================================
644 dnl Check for Lua, optional even if installed.
645 dnl ===================================================================
647 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
648 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
650 AC_ARG_WITH(lua, [ --without-lua disable Lua support],
651 [if test "$withval" = no; then disable_lua=yes; fi])
652 AC_MSG_CHECKING([for Lua])
657 if test -z "$disable_lua"; then
658 if test ! -d "$withval"; then
661 for luadir in "$withval" "" /usr /usr/local; do
662 for suffix in "" 50 51; do
663 if test "$cf_result" = no; then
664 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
666 if test ! -z "$luadir"; then
667 LUA_LIBS="-L$luadir/lib $LUA_LIBS"
668 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
671 LIBS="$LUA_LIBS $LIBS_X"
672 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
673 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
675 # Check that it is a compatible Lua version
676 AC_TRY_LINK([ #include <lua.h>
677 #include <lualib.h>],
678 [ lua_State *L = lua_open();
683 lua_pushboolean(L, 1);
685 cf_result=yes, cf_result=no)
691 AC_MSG_RESULT($cf_result)
693 if test "$cf_result" != yes; then
696 EL_CONFIG(CONFIG_LUA, [Lua])
697 AC_CHECK_HEADERS(lauxlib.h)
705 dnl ===================================================================
706 dnl Check for Ruby, optional even if installed.
707 dnl ===================================================================
711 dnl ===================================================================
712 dnl Setup global scripting
713 dnl ===================================================================
715 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY], [Scripting])
716 AC_SUBST(CONFIG_GUILE)
718 AC_SUBST(CONFIG_PERL)
719 AC_SUBST(CONFIG_PYTHON)
720 AC_SUBST(CONFIG_RUBY)
721 AC_SUBST(CONFIG_SCRIPTING)
724 dnl ===================================================================
725 dnl Check for SpiderMonkey, optional even if installed.
726 dnl ===================================================================
728 AC_ARG_WITH(spidermonkey, [ --without-spidermonkey disable SpiderMonkey Mozilla JavaScript engine support],
729 [if test "$withval" = no; then disable_spidermonkey=yes; fi])
730 AC_MSG_CHECKING([for SpiderMonkey])
735 if test -z "$disable_spidermonkey"; then
736 if test ! -d "$withval"; then
739 for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
740 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
741 for spidermonkeylib in js smjs; do
742 if test "$cf_result" = no; then
743 SPIDERMONKEY_LIBS="-l$spidermonkeylib"
745 if test ! -z "$spidermonkeydir"; then
746 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
747 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
750 LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
751 CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
752 CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
754 AC_TRY_LINK([#define XP_UNIX
756 [JS_GetImplementationVersion()],
757 cf_result=yes, cf_result=no)
764 AC_MSG_RESULT($cf_result)
766 if test "$cf_result" != yes; then
769 EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
772 AC_SUBST(SPIDERMONKEY_LIBS)
773 AC_SUBST(SPIDERMONKEY_CFLAGS)
776 AC_SUBST(CONFIG_SPIDERMONKEY)
778 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
781 dnl ===================================================================
782 dnl Check for SSL support.
783 dnl ===================================================================
785 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
786 dnl is enabled, we won't try to use OpenSSL anymore.
788 dnl For wiping SSL hooks..
795 AC_ARG_WITH(gnutls, [ --without-gnutls disable GNUTLS SSL support],
796 [if test "$with_gnutls" = no; then disable_gnutls=yes; fi])
797 AC_ARG_WITH(gnutls, [ --with-gnutls[=DIR] enable GNUTLS SSL support],
798 [if test "$with_gnutls" != no; then enable_gnutls=yes; fi])
799 gnutls_withval="$withval"
801 if test "$enable_gnutls" = yes; then
805 AC_ARG_WITH(openssl, [ --without-openssl disable OpenSSL support],
806 [if test "$with_openssl" = no; then disable_openssl=yes; fi])
807 AC_ARG_WITH(openssl, [ --with-openssl[=DIR] enable OpenSSL support (default)])
808 openssl_withval="$withval"
812 AC_MSG_CHECKING([for OpenSSL])
817 if test "$disable_openssl" = yes; then
820 for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
821 /usr/lib/openssl /usr/local/ssl \
822 /usr/local/www /usr/lib/ssl /usr/local \
823 /usr/pkg /opt /opt/openssl; do
824 if test "$cf_result" = no; then
825 if test -d "$ssldir"; then
826 OPENSSL_CFLAGS="-I$ssldir/include"
827 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
828 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
829 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
830 # # FIXME: This created serious portability problems. --pasky
831 # if test "$CC" == "gcc"; then
832 # # I'm not sure about compatibility here. --pasky
833 # LIBS="$LIBS -R$ssldir/lib"
836 LIBS="-lssl -lcrypto $LIBS_X"
838 AC_TRY_LINK([#include <openssl/ssl.h>],
839 [OpenSSL_add_all_algorithms()],
840 cf_result=yes, cf_result=no)
841 if test "$cf_result" != yes; then
842 AC_TRY_LINK([#include <openssl/ssl.h>],
843 [SSLeay_add_ssl_algorithms()],
844 cf_result=yes, cf_result=no)
849 if test "$cf_result" != yes; then
850 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
851 AC_MSG_ERROR([OpenSSL not found])
855 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
858 AC_SUBST(OPENSSL_CFLAGS)
862 AC_MSG_RESULT($cf_result)
865 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
866 dnl it looks ugly then.
868 if test "$cf_result" = yes; then
875 if test -z "$disable_gnutls"; then
876 # Sure, we maybe _could_ use their macro, but how to ensure
877 # that the ./configure script won't fail if the macro won't be
878 # found..? :( --pasky
880 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
882 if test -d "$gnutls_withval"; then
883 GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
886 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
888 if test "$LIBGNUTLS_CONFIG" = "no" ; then
891 GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
892 GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
894 LIBS="$GNUTLS_LIBS $LIBS_X"
895 CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
896 CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
898 # Verify if it's really usable
899 AC_TRY_LINK([#include <gnutls/gnutls.h>],
900 [gnutls_check_version(NULL)],
901 cf_result=yes, cf_result=no)
904 if test "$cf_result" = yes; then
905 EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
908 AC_SUBST(GNUTLS_CFLAGS)
910 # Verify if the MD5 compatibility layer is usable.
911 CONFIG_GNUTLS_OPENSSL_COMPAT=yes
912 EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
913 [GNU TLS OpenSSL compatibility],
914 gnutls/openssl.h, gnutls-openssl,
917 if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
918 AC_MSG_ERROR([GNUTLS not found])
925 AC_MSG_CHECKING([for GNU TLS])
926 AC_MSG_RESULT($cf_result)
930 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
931 AC_SUBST(CONFIG_OPENSSL)
932 AC_SUBST(CONFIG_GNUTLS)
936 AC_MSG_CHECKING([whether to be or not to be])
937 AC_MSG_RESULT([needs to be determined experimentally])
939 dnl ===================================================================
940 dnl Check for IPv6 support and related functions.
941 dnl ===================================================================
943 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
944 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
945 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
947 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
948 if test "$HAVE_GETADDRINFO" != yes; then
949 AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
950 if test "$HAVE_GETADDRINFO" = yes; then
956 dnl ===================================================================
957 dnl Checking for X11 (window title restoring).
958 dnl ===================================================================
961 if test x"$no_x" != xyes; then
962 if test -n "$x_includes"; then
963 X_CFLAGS="-I$x_includes"
964 CPPFLAGS="$CPPFLAGS -I$x_includes"
966 if test -n "$x_libraries"; then
967 LDFLAGS="$LDFLAGS -L$x_libraries"
970 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
975 dnl ===================================================================
976 dnl Backtraces displaying support.
977 dnl ===================================================================
979 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
980 # possible checks for other system-specific means go here
983 dnl ===================================================================
984 dnl SMB protocol support.
985 dnl ===================================================================
987 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
990 dnl ===================================================================
991 dnl Gettext grey zone. Beware.
992 dnl ===================================================================
994 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"
998 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
999 dnl # f33r d4 l33t... I hope it's portable. :)
1000 dnl cf_result=$((48#z - 48#a + 1));
1001 dnl AC_MSG_RESULT($cf_result)
1004 dnl ===================================================================
1005 dnl Compile-time features control
1006 dnl ===================================================================
1008 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1009 [ --disable-cookies disable cookie support])
1011 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1012 [ --disable-formhist disable form history support])
1014 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1015 [ --disable-globhist disable global history support])
1018 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1019 [ --disable-mailcap disable mailcap support])
1021 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1022 [ --disable-mimetypes disable mimetypes files support])
1025 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1026 [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1028 [ --disable-ipv6 disable IPv6 support])
1030 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1031 [ --enable-bittorrent enable BitTorrent protocol support])
1033 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1034 [ --disable-data disable data protocol support])
1036 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1037 [ --disable-uri-rewrite disable URI rewrite support])
1039 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1040 [ --enable-cgi enable local CGI support])
1042 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1043 [ --enable-finger enable finger protocol support])
1045 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1046 [ --disable-ftp disable ftp protocol support])
1048 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1049 [ --enable-gopher enable gopher protocol support])
1051 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1052 [ --enable-nntp enable nntp protocol support])
1054 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1055 [ --disable-smb disable SMB protocol support (requires smbclient)])
1058 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1059 [ --disable-mouse disable mouse support])
1061 # GPM mouse is Linux specific, so ...
1063 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1064 [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1066 [ --disable-sysmouse disable BSD sysmouse support])
1068 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1069 [ --enable-88-colors enable 88 color support])
1071 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1072 [ --enable-256-colors enable 256 color support])
1075 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1076 [ --enable-exmode enable exmode (CLI) interface])
1078 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1079 [ --disable-leds disable LEDs support])
1081 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1082 [ --disable-marks disable document marks support])
1085 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1086 [ --disable-css disable Cascading Style Sheet support])
1088 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1089 [ --enable-html-highlight HTML highlighting using DOM engine])
1091 dnl Everything in the tree already uses CONFIG_DOM
1092 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1093 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1095 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1096 [ --disable-backtrace disable backtrace support])
1098 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1099 [ --enable-no-root enable prevention of usage by root])
1102 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1103 [ --enable-debug enable leak debug and internal error checking])
1105 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1106 [ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
1108 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1109 [ --enable-own-libc force use of internal functions instead of those of system libc])
1111 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1112 [ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1114 if test "$CONFIG_OPENSSL" != yes &&
1115 test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1116 test "$CONFIG_OWN_LIBC" = yes;
1118 AC_MSG_CHECKING(for built-in MD5 support)
1120 EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1123 AC_SUBST(CONFIG_MD5)
1125 if test "$CONFIG_BITTORRENT" = yes; then
1126 if test "$CONFIG_OPENSSL" != yes ||
1127 test "$CONFIG_OWN_LIBC" = yes;
1129 AC_MSG_CHECKING(for built-in SHA1 support)
1131 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1135 AC_SUBST(CONFIG_SHA1)
1137 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1139 EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1141 AC_SUBST(CONFIG_SCANNER)
1143 AC_ARG_ENABLE(weehoofooboomookerchoo,
1145 Also check out the features.conf file for more information about features!
1147 [AC_MSG_ERROR(Are you strange, or what?)])
1152 test "$CONFIG_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1153 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1156 dnl ===================================================================
1157 dnl Export directory paths
1158 dnl ===================================================================
1160 # Set up the ``entry points'' if they were not supplied by builder
1161 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1162 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1164 # Create CONFDIR #define for config.h
1166 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1167 # it's autoconf fault to force us to do such hacks ;p.
1168 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1169 # sysconfdir is set to its default value... fine, let's append /elinks/
1170 # XXX: We can't modify listing of the default in ./configure --help :-(
1171 sysconfdir_n=`eval echo "$sysconfdir"`
1172 sysconfdir=$sysconfdir_n
1173 (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1174 sysconfdir="$sysconfdir/elinks"
1178 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1181 # Create LOCALEDIR #define for config.h
1182 LOCALEDIR=`eval echo "$datadir/locale"`
1183 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1186 # Create LIBDIR #define for config.h
1187 LIBDIR=`eval echo "$libdir"`
1188 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1191 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1192 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1194 dnl ===================================================================
1195 dnl A little fine tuning of gcc specific options (continued)
1196 dnl ===================================================================
1198 if test "x$ac_cv_prog_gcc" = "xyes"; then
1199 if test "$CONFIG_DEBUG" = "yes"; then
1200 dnl We want to see all warnings and live with none (in debug mode).
1201 CFLAGS="$CFLAGS -Werror"
1204 case "`gcc -dumpversion`" in
1206 # These should be ok using -Werror
1209 # If gcc is version 3.3 (or higher?) it emits lots of false positive
1210 # "dereferencing type-punned pointer will break strict-aliasing rules"
1211 # warnings. Disable them by not doing any strict-aliasing. The
1212 # alternative is just too ugly. Thanks gcc guys!! ;)
1213 CFLAGS="$CFLAGS -fno-strict-aliasing"
1216 # Do not show warnings related to (char * | unsigned char *) type
1218 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1221 # These should be ok using -Werror
1226 # CFLAGS doesn't contain all compile flags. Some will be added only when
1227 # needed in the respective source directory. To get all compile flags
1228 # easily just add CPPFLAGS.
1229 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1231 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1232 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1234 dnl ===================================================================
1236 dnl ===================================================================
1240 contrib/elinks.spec \
1241 contrib/lua/hooks.lua \
1242 contrib/conv/w3m2links.awk \
1243 doc/man/man1/elinks.1 \
1244 src/intl/gettext/ref-add.sed \
1245 src/intl/gettext/ref-del.sed
1249 dnl ===================================================================
1250 dnl Configuration summary
1251 dnl ===================================================================
1253 AC_MSG_RESULT(The following feature summary has been saved to features.log)