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 for make in gnumake gmake make false; do
24 if test "x$MAKE" = x; then
25 AC_PATH_PROGS(MAKE, "$make")
29 # Cleanup if we are configuring with a previous build in the tree
30 if test -e Makefile.config; then
31 "$MAKE" -C "$builddir" cleanall >/dev/null 2>/dev/null
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 ===================================================================
51 AC_PATH_PROGS(AWK, "$AWK")
55 AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id")
62 if test "x$CONFIG_DOC" != xno; then
63 AC_PATH_PROGS(ASCIIDOC, "asciidoc")
64 if test "x$ASCIIDOC" != "x"; then
65 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
66 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
67 EL_CONFIG(MAN_ASCIIDOC, [HTML])
70 AC_PATH_PROGS(XMLTO, "xmlto")
71 if test "x$XMLTO" != "x"; then
72 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
73 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
74 EL_CONFIG(MAN_XMLTO, [man (groff)])
77 AC_PATH_PROGS(JW, "jw")
78 if test "x$JW" != "x"; then
79 EL_CONFIG(CONFIG_JW, [JadeWrapper])
80 EL_CONFIG(MANUAL_JW, [PDF])
83 AC_PATH_PROGS(POD2HTML, "pod2html")
84 if test "x$POD2HTML" != "x"; then
85 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
89 AC_SUBST(CONFIG_ASCIIDOC)
90 AC_SUBST(CONFIG_POD2HTML)
91 AC_SUBST(CONFIG_XMLTO)
94 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation])
96 if test "$CONFIG_ASCIIDOC" = yes &&
97 test "$CONFIG_XMLTO" = yes &&
98 test "$CONFIG_JW" = yes; then
99 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
102 if test "$CONFIG_ASCIIDOC" = yes &&
103 test "$CONFIG_XMLTO" = yes; then
104 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
107 AC_SUBST(CONFIG_ASCIIDOC)
108 AC_SUBST(CONFIG_POD2HTML)
109 AC_SUBST(CONFIG_XMLTO)
112 dnl gcc specific options (to be continued at the bottom of configure)
113 if test "x$ac_cv_prog_gcc" = "xyes"; then
114 dnl We want to see all warnings and live with none.
115 dnl We can't set up -Werror here as there may be some warnings in test
116 dnl suite of configure, and we don't want to fail them.
117 CFLAGS="$CFLAGS -Wall"
120 dnl ===================================================================
121 dnl Checks for special OSes.
122 dnl ===================================================================
124 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
125 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
127 AC_MSG_CHECKING([for $2])
130 AC_TRY_COMPILE(, [#ifndef $flag
132 #endif ], $1=yes, $1=no)
133 if test "[$]$1" = yes; then
134 EL_CONFIG([$1], [$2])
142 EL_CHECK_COMPILER_MACROS(CONFIG_BEOS, [BEOS], [__BEOS__])
143 AC_SUBST(CONFIG_BEOS)
145 EL_CHECK_COMPILER_MACROS(CONFIG_RISCOS, [RISCOS], [__riscos__])
146 AC_SUBST(CONFIG_RISCOS)
148 EL_CHECK_COMPILER_MACROS(CONFIG_WIN32, [WIN32], [_WIN32 __WIN32__])
149 AC_SUBST(CONFIG_WIN32)
151 EL_CHECK_COMPILER_MACROS(CONFIG_OS2, [EMX], [__EMX__])
153 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
155 AC_MSG_CHECKING([for UNIX])
156 dnl FIXME: some depend kind of mechanism
157 if test "$CONFIG_BEOS" = no && \
158 test "$CONFIG_RISCOS" = no && \
159 test "$CONFIG_WIN32" = no && \
160 test "$CONFIG_OS2" = no; then
161 EL_CONFIG(CONFIG_UNIX, [UNIX])
165 AC_MSG_RESULT($CONFIG_UNIX)
166 AC_SUBST(CONFIG_UNIX)
168 dnl ===================================================================
169 dnl Checks for header files.
170 dnl ===================================================================
177 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
178 AC_CHECK_HEADERS(sigaction.h)
179 AC_CHECK_HEADERS(arpa/inet.h)
180 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
181 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
182 AC_CHECK_HEADERS(ifaddrs.h)
183 AC_CHECK_HEADERS(sys/cygwin.h io.h)
184 AC_CHECK_HEADERS(sys/fmutex.h)
185 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
186 AC_CHECK_HEADERS(sys/resource.h)
187 AC_CHECK_HEADERS(sys/select.h)
188 AC_CHECK_HEADERS(sys/signal.h)
189 AC_CHECK_HEADERS(sys/socket.h)
190 AC_CHECK_HEADERS(sys/time.h)
191 AC_CHECK_HEADERS(sys/utsname.h)
192 AC_CHECK_HEADERS(stdint.h inttypes.h)
193 AC_CHECK_HEADERS(locale.h pwd.h)
194 AC_CHECK_HEADERS(termios.h)
197 AC_CHECK_HEADERS(sys/un.h,
198 [CONFIG_INTERLINK=yes
199 EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
200 [CONFIG_INTERLINK=no])
201 AC_SUBST(CONFIG_INTERLINK)
203 dnl ===================================================================
204 dnl Checks for typedefs, structures, and compiler characteristics.
205 dnl ===================================================================
210 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
215 EL_CHECK_TYPE(ssize_t, int)
216 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
217 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
218 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
219 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
221 AC_CHECK_SIZEOF(char, 1)
222 AC_CHECK_SIZEOF(short, 2)
223 AC_CHECK_SIZEOF(int, 4)
224 AC_CHECK_SIZEOF(long, 4)
225 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
227 dnl Check for variadic macros
228 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
230 #define a(b,c...) printf(b,##c)],
231 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
233 dnl Check for -rdynamic
234 dnl FIXME: This check doesn't work. Something to do with the compiler
235 dnl happily ignoring it and stderr not being checked for error messages.
236 AC_MSG_CHECKING([for -rdynamic])
238 LDFLAGS="$LDFLAGS -rdynamic"
239 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
240 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
241 AC_MSG_RESULT($have_rdynamic)
243 dnl ===================================================================
244 dnl Check for POSIX <regex.h>
245 dnl ===================================================================
247 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
249 dnl ===================================================================
250 dnl Checks for library functions.
251 dnl ===================================================================
253 AC_PROG_GCC_TRADITIONAL
257 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
258 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
259 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
260 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
261 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
262 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
263 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
264 AC_CHECK_FUNCS(gettimeofday clock_gettime)
266 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
268 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
269 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
270 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
272 dnl These aren't probably needed now, as they are commented in links.h.
273 dnl I've no idea about their historical background, but I keep them here
274 dnl just in the case they will help later. --pasky
275 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
276 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
277 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
278 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
280 if test x"$HAVE_RAISE" = x; then
281 if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
282 AC_ERROR([Unable to emulate raise()])
286 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
287 AC_TRY_LINK([#include <stdarg.h>
288 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
289 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
290 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
291 EL_DEFINE(HAVE_VA_COPY, __va_copy)
294 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
295 AC_TRY_LINK([#include <unistd.h>
296 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
297 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
298 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
299 EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
302 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
311 int bar(char *buf, const char *format, va_list ap)
313 return vsnprintf(buf, 0, format, ap);
316 void foo(const char *format, ...) {
320 va_start(ap, format);
321 len = bar(buf, format, ap);
323 if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
325 va_start(ap, format);
326 len = bar(buf, format, ap);
328 if ((len != 6) && (len != 7)) exit(1);
330 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
334 main() { foo("hello\n"); }
336 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
337 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
338 EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
341 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
343 dnl ===================================================================
344 dnl Checks for libraries.
345 dnl ===================================================================
347 dnl Replace `main' with a function in -lsocket:
348 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
349 if test "$cf_result" = no; then
350 AC_CHECK_LIB(socket, socket)
353 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
354 if test "$cf_result" = no; then
355 AC_CHECK_LIB(socket, setsockopt)
358 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
359 if test "$cf_result" = no; then
360 AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
361 if test "$cf_result" = no; then
362 AC_CHECK_LIB(nsl, gethostbyname)
364 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
368 dnl ===================================================================
369 dnl Checks for packaging specific options.
370 dnl ===================================================================
372 AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
373 [ if test "$withval" != no && test "$withval" != yes; then
374 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
377 dnl ===================================================================
378 dnl Checks for a libraries, optional even if installed.
379 dnl ===================================================================
381 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
382 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
384 AC_MSG_CHECKING([for $2 support])
386 if test "[$]$1" != no; then
389 if test -n "$withval" && test -d "$withval"; then
390 CFLAGS="$CFLAGS -I$withval/include";
391 CPPFLAGS="$CPPFLAGS -I$withval/include";
392 LDFLAGS="$LDFLAGS -L$withval/lib";
395 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
396 if test "[$]$1" = yes; then
397 AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
400 if test "[$]$1" = yes; then
401 EL_CONFIG([$1], [$2])
404 if test -n "[$]WITHVAL_$1" &&
405 test "[$]WITHVAL_$1" != xno; then
406 AC_MSG_ERROR([$2 not found])
411 AC_MSG_RESULT(disabled)
415 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
416 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
421 AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
422 if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
424 EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
426 EL_LOG_CONFIG([$1], [$2], [])
429 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
430 [ --without-gpm disable gpm (mouse) support])
432 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
433 [ --without-zlib disable zlib support])
435 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
436 [ --without-bzlib disable bzlib support])
438 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
439 [ --without-idn disable international domain names support])
441 dnl ===================================================================
442 dnl Bookmark and XBEL support
443 dnl ===================================================================
447 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
448 [ --disable-bookmarks disable bookmark support])
450 # Check whether --enable-xbel or --disable-xbel was given.
451 if test "x${enable_xbel}" != xno; then
452 AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
454 if test "$HAVE_LIBEXPAT" = yes; then
455 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
456 if test "$HAVE_LIBEXPAT" = yes; then
463 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
465 [ --disable-xbel disable XBEL bookmark support (requires expat)])
467 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
471 dnl ===================================================================
472 dnl Checks for BSD sysmouse
473 dnl ===================================================================
475 HAVE_SYSMOUSE_HEADER="no"
477 # Either of these header files provides the (same) sysmouse interface
478 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
480 dnl ===================================================================
482 dnl ===================================================================
484 if test "$CONFIG_OS2" = yes; then
488 dnl ===================================================================
490 dnl ===================================================================
492 if test "$CONFIG_WIN32" = yes; then
496 dnl ===================================================================
497 dnl Check for Guile, optional even if installed.
498 dnl ===================================================================
502 AC_ARG_WITH(guile, [ --with-guile enable Guile support],
503 [ if test "x$withval" != xno; then enable_guile=yes; fi ])
505 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
506 # GUILE_FLAGS but I really don't want to require people to have Guile in order
507 # to compile CVS. Also, the macro seems to be really stupid regarding searching
508 # for Guile in $PATH etc. --pasky
510 AC_MSG_CHECKING([for Guile])
512 if test "$enable_guile" = "yes"; then
514 ## Based on the GUILE_FLAGS macro.
516 if test -d "$withval"; then
517 GUILE_PATH="$withval:$PATH"
522 AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
524 ## First, let's just see if we can find Guile at all.
525 if test "$GUILE_CONFIG" != no; then
528 GUILE_LIBS="`guile-config link`"
529 GUILE_CFLAGS="`guile-config compile`"
530 LIBS="$GUILE_LIBS $LIBS"
531 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
532 EL_CONFIG(CONFIG_GUILE, [Guile])
533 AC_SUBST(GUILE_CFLAGS)
535 ***********************************************************************
536 The Guile support is incomplete and not so well integrated to ELinks
537 yet. That means, ie., that you have no Guile console and there might
538 not be all the necessary hooks. Also, the Guile interface is not too
539 well tested (success stories heartily welcomed!). See
540 src/scripting/guile/README for further details and hints.
541 ***********************************************************************
544 if test -n "$withval" && test "x$withval" != xno; then
545 AC_MSG_ERROR([Guile not found])
547 AC_MSG_WARN([Guile support disabled])
554 dnl ===================================================================
556 dnl ===================================================================
559 AC_ARG_WITH(perl, [ --with-perl enable Perl support],
561 if test "$withval" = yes; then
562 # FIXME: If withval is a valid directory append it to PATH
563 # so that you can specify one of several perl installations.
569 AC_MSG_CHECKING([for Perl])
575 if test "$enable_perl" = "yes"; then
576 PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
577 PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
578 LIBS="$PERL_LIBS $LIBS"
579 CFLAGS="$PERL_CFLAGS $CFLAGS"
580 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
586 [PerlInterpreter *my_perl = perl_alloc();],
587 cf_result=yes, cf_result=no)
590 if test "$cf_result" != "yes"; then
593 EL_CONFIG(CONFIG_PERL, [Perl])
597 AC_SUBST(PERL_CFLAGS)
600 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
601 dnl ===================================================================
603 dnl ===================================================================
606 AC_ARG_WITH(python, [ --with-python enable Python support],
608 if test "$withval" = yes; then
609 # FIXME: If withval is a valid directory append it to PATH
610 # so that you can specify one of several Python installations.
614 ***********************************************************************
615 The Python support is incomplete and not so well integrated to ELinks
616 yet. That means, ie., that you have no Python console and there might
617 not be all the necessary hooks. Also, the Python interface is not too
618 well tested (success stories heartily welcomed!).
619 ***********************************************************************
624 AC_MSG_CHECKING([for Python])
630 if test "$enable_python" = "yes"; then
631 PYTHON_LIBS="-lpython"
632 PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
633 LIBS="$PYTHON_LIBS $LIBS"
634 CFLAGS="$PYTHON_CFLAGS $CFLAGS"
635 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
640 cf_result=yes, cf_result=no)
643 if test "$cf_result" != "yes"; then
646 EL_CONFIG(CONFIG_PYTHON, [Python])
649 AC_SUBST(PYTHON_LIBS)
650 AC_SUBST(PYTHON_CFLAGS)
653 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
656 dnl ===================================================================
657 dnl Check for Lua, optional even if installed.
658 dnl ===================================================================
660 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
661 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
663 AC_ARG_WITH(lua, [ --without-lua disable Lua support],
664 [if test "$withval" = no; then disable_lua=yes; fi])
665 AC_MSG_CHECKING([for Lua])
670 if test -z "$disable_lua"; then
671 if test ! -d "$withval"; then
674 for luadir in "$withval" "" /usr /usr/local; do
675 for suffix in "" 50 51; do
676 if test "$cf_result" = no; then
677 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
679 if test ! -z "$luadir"; then
680 LUA_LIBS="-L$luadir/lib $LUA_LIBS"
681 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
684 LIBS="$LUA_LIBS $LIBS_X"
685 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
686 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
688 # Check that it is a compatible Lua version
689 AC_TRY_LINK([ #include <lua.h>
690 #include <lualib.h>],
691 [ lua_State *L = lua_open();
696 lua_pushboolean(L, 1);
698 cf_result=yes, cf_result=no)
704 AC_MSG_RESULT($cf_result)
706 if test "$cf_result" != yes; then
709 EL_CONFIG(CONFIG_LUA, [Lua])
710 AC_CHECK_HEADERS(lauxlib.h)
718 dnl ===================================================================
719 dnl Check for Ruby, optional even if installed.
720 dnl ===================================================================
724 dnl ===================================================================
725 dnl Check for SEE, optional even if installed.
726 dnl ===================================================================
730 dnl ===================================================================
731 dnl Setup global scripting
732 dnl ===================================================================
734 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY CONFIG_SEE], [Scripting])
735 AC_SUBST(CONFIG_GUILE)
737 AC_SUBST(CONFIG_PERL)
738 AC_SUBST(CONFIG_PYTHON)
739 AC_SUBST(CONFIG_RUBY)
741 AC_SUBST(CONFIG_SCRIPTING)
744 dnl ===================================================================
745 dnl Check for SpiderMonkey, optional even if installed.
746 dnl ===================================================================
748 AC_ARG_WITH(spidermonkey, [ --without-spidermonkey disable SpiderMonkey Mozilla JavaScript engine support],
749 [if test "$withval" = no; then disable_spidermonkey=yes; fi])
750 AC_MSG_CHECKING([for SpiderMonkey])
755 if test -z "$disable_spidermonkey"; then
756 if test ! -d "$withval"; then
759 for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
760 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
761 for spidermonkeylib in js smjs; do
762 if test "$cf_result" = no; then
763 SPIDERMONKEY_LIBS="-l$spidermonkeylib"
765 if test ! -z "$spidermonkeydir"; then
766 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
767 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
770 LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
771 CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
772 CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
774 AC_TRY_LINK([#define XP_UNIX
776 [JS_GetImplementationVersion()],
777 cf_result=yes, cf_result=no)
784 AC_MSG_RESULT($cf_result)
786 if test "$cf_result" != yes; then
789 EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
792 AC_SUBST(SPIDERMONKEY_LIBS)
793 AC_SUBST(SPIDERMONKEY_CFLAGS)
796 AC_SUBST(CONFIG_SPIDERMONKEY)
798 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
801 dnl ===================================================================
802 dnl Check for SSL support.
803 dnl ===================================================================
805 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
806 dnl is enabled, we won't try to use OpenSSL anymore.
808 dnl For wiping SSL hooks..
815 AC_ARG_WITH(gnutls, [ --without-gnutls disable GNUTLS SSL support],
816 [if test "$with_gnutls" = no; then disable_gnutls=yes; fi])
817 AC_ARG_WITH(gnutls, [ --with-gnutls[=DIR] enable GNUTLS SSL support],
818 [if test "$with_gnutls" != no; then enable_gnutls=yes; fi])
819 gnutls_withval="$withval"
821 if test "$enable_gnutls" = yes; then
825 AC_ARG_WITH(openssl, [ --without-openssl disable OpenSSL support],
826 [if test "$with_openssl" = no; then disable_openssl=yes; fi])
827 AC_ARG_WITH(openssl, [ --with-openssl[=DIR] enable OpenSSL support (default)])
828 openssl_withval="$withval"
832 AC_MSG_CHECKING([for OpenSSL])
837 if test "$disable_openssl" = yes; then
840 for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
841 /usr/lib/openssl /usr/local/ssl \
842 /usr/local/www /usr/lib/ssl /usr/local \
843 /usr/pkg /opt /opt/openssl; do
844 if test "$cf_result" = no; then
845 if test -d "$ssldir"; then
846 OPENSSL_CFLAGS="-I$ssldir/include"
847 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
848 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
849 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
850 # # FIXME: This created serious portability problems. --pasky
851 # if test "$CC" == "gcc"; then
852 # # I'm not sure about compatibility here. --pasky
853 # LIBS="$LIBS -R$ssldir/lib"
856 LIBS="-lssl -lcrypto $LIBS_X"
858 AC_TRY_LINK([#include <openssl/ssl.h>],
859 [OpenSSL_add_all_algorithms()],
860 cf_result=yes, cf_result=no)
861 if test "$cf_result" != yes; then
862 AC_TRY_LINK([#include <openssl/ssl.h>],
863 [SSLeay_add_ssl_algorithms()],
864 cf_result=yes, cf_result=no)
869 if test "$cf_result" != yes; then
870 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
871 AC_MSG_ERROR([OpenSSL not found])
875 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
878 AC_SUBST(OPENSSL_CFLAGS)
882 AC_MSG_RESULT($cf_result)
885 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
886 dnl it looks ugly then.
888 if test "$cf_result" = yes; then
895 if test -z "$disable_gnutls"; then
896 # Sure, we maybe _could_ use their macro, but how to ensure
897 # that the ./configure script won't fail if the macro won't be
898 # found..? :( --pasky
900 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
902 if test -d "$gnutls_withval"; then
903 GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
906 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
908 if test "$LIBGNUTLS_CONFIG" = "no" ; then
911 GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
912 GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
914 LIBS="$GNUTLS_LIBS $LIBS_X"
915 CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
916 CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
918 # Verify if it's really usable
919 AC_TRY_LINK([#include <gnutls/gnutls.h>],
920 [gnutls_check_version(NULL)],
921 cf_result=yes, cf_result=no)
924 if test "$cf_result" = yes; then
925 EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
928 AC_SUBST(GNUTLS_CFLAGS)
930 # Verify if the MD5 compatibility layer is usable.
931 CONFIG_GNUTLS_OPENSSL_COMPAT=yes
932 EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
933 [GNU TLS OpenSSL compatibility],
934 gnutls/openssl.h, gnutls-openssl,
937 if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
938 AC_MSG_ERROR([GNUTLS not found])
945 AC_MSG_CHECKING([for GNU TLS])
946 AC_MSG_RESULT($cf_result)
950 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
951 AC_SUBST(CONFIG_OPENSSL)
952 AC_SUBST(CONFIG_GNUTLS)
956 AC_MSG_CHECKING([whether to be or not to be])
957 AC_MSG_RESULT([needs to be determined experimentally])
959 dnl ===================================================================
960 dnl Check for IPv6 support and related functions.
961 dnl ===================================================================
963 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
964 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
965 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
967 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
968 if test "$HAVE_GETADDRINFO" != yes; then
969 AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
970 if test "$HAVE_GETADDRINFO" = yes; then
976 dnl ===================================================================
977 dnl Checking for X11 (window title restoring).
978 dnl ===================================================================
981 if test x"$no_x" != xyes; then
982 if test -n "$x_includes"; then
983 X_CFLAGS="-I$x_includes"
984 CPPFLAGS="$CPPFLAGS -I$x_includes"
986 if test -n "$x_libraries"; then
987 LDFLAGS="$LDFLAGS -L$x_libraries"
990 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
995 dnl ===================================================================
996 dnl Backtraces displaying support.
997 dnl ===================================================================
999 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1000 # possible checks for other system-specific means go here
1003 dnl ===================================================================
1004 dnl SMB protocol support.
1005 dnl ===================================================================
1007 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1010 dnl ===================================================================
1011 dnl Gettext grey zone. Beware.
1012 dnl ===================================================================
1014 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"
1018 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1019 dnl # f33r d4 l33t... I hope it's portable. :)
1020 dnl cf_result=$((48#z - 48#a + 1));
1021 dnl AC_MSG_RESULT($cf_result)
1024 dnl ===================================================================
1025 dnl Compile-time features control
1026 dnl ===================================================================
1028 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1029 [ --disable-cookies disable cookie support])
1031 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1032 [ --disable-formhist disable form history support])
1034 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1035 [ --disable-globhist disable global history support])
1038 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1039 [ --disable-mailcap disable mailcap support])
1041 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1042 [ --disable-mimetypes disable mimetypes files support])
1045 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1046 [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1048 [ --disable-ipv6 disable IPv6 support])
1050 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1051 [ --enable-bittorrent enable BitTorrent protocol support])
1053 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1054 [ --disable-data disable data protocol support])
1056 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1057 [ --disable-uri-rewrite disable URI rewrite support])
1059 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1060 [ --enable-cgi enable local CGI support])
1062 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1063 [ --enable-finger enable finger protocol support])
1065 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1066 [ --disable-ftp disable ftp protocol support])
1068 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1069 [ --enable-gopher enable gopher protocol support])
1071 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1072 [ --enable-nntp enable nntp protocol support])
1074 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1075 [ --disable-smb disable SMB protocol support (requires smbclient)])
1078 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1079 [ --disable-mouse disable mouse support])
1081 # GPM mouse is Linux specific, so ...
1083 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1084 [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1086 [ --disable-sysmouse disable BSD sysmouse support])
1088 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1089 [ --enable-88-colors enable 88 color support])
1091 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1092 [ --enable-256-colors enable 256 color support])
1095 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1096 [ --enable-exmode enable exmode (CLI) interface])
1098 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1099 [ --disable-leds disable LEDs support])
1101 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1102 [ --disable-marks disable document marks support])
1105 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1106 [ --disable-css disable Cascading Style Sheet support])
1108 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1109 [ --enable-html-highlight HTML highlighting using DOM engine])
1111 dnl Everything in the tree already uses CONFIG_DOM
1112 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1113 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1115 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1116 [ --disable-backtrace disable backtrace support])
1118 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1119 [ --enable-no-root enable prevention of usage by root])
1122 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1123 [ --enable-debug enable leak debug and internal error checking])
1125 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1126 [ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
1128 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1129 [ --enable-own-libc force use of internal functions instead of those of system libc])
1131 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1132 [ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1134 if test "$CONFIG_OPENSSL" != yes &&
1135 test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1136 test "$CONFIG_OWN_LIBC" = yes;
1138 AC_MSG_CHECKING(for built-in MD5 support)
1140 EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1143 AC_SUBST(CONFIG_MD5)
1145 if test "$CONFIG_BITTORRENT" = yes; then
1146 if test "$CONFIG_OPENSSL" != yes ||
1147 test "$CONFIG_OWN_LIBC" = yes;
1149 AC_MSG_CHECKING(for built-in SHA1 support)
1151 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1155 AC_SUBST(CONFIG_SHA1)
1157 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1159 EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1161 AC_SUBST(CONFIG_SCANNER)
1163 AC_ARG_ENABLE(weehoofooboomookerchoo,
1165 Also check out the features.conf file for more information about features!
1167 [AC_MSG_ERROR(Are you strange, or what?)])
1172 test "$CONFIG_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1173 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1176 dnl ===================================================================
1177 dnl Export directory paths
1178 dnl ===================================================================
1180 # Set up the ``entry points'' if they were not supplied by builder
1181 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1182 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1184 # Create CONFDIR #define for config.h
1186 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1187 # it's autoconf fault to force us to do such hacks ;p.
1188 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1189 # sysconfdir is set to its default value... fine, let's append /elinks/
1190 # XXX: We can't modify listing of the default in ./configure --help :-(
1191 sysconfdir_n=`eval echo "$sysconfdir"`
1192 sysconfdir=$sysconfdir_n
1193 (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1194 sysconfdir="$sysconfdir/elinks"
1198 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1201 # Create LOCALEDIR #define for config.h
1202 LOCALEDIR=`eval echo "$datadir/locale"`
1203 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1206 # Create LIBDIR #define for config.h
1207 LIBDIR=`eval echo "$libdir"`
1208 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1211 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1212 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1214 dnl ===================================================================
1215 dnl A little fine tuning of gcc specific options (continued)
1216 dnl ===================================================================
1218 if test "x$ac_cv_prog_gcc" = "xyes"; then
1219 if test "$CONFIG_DEBUG" = "yes"; then
1220 dnl We want to see all warnings and live with none (in debug mode).
1221 CFLAGS="$CFLAGS -Werror"
1224 case "`gcc -dumpversion`" in
1226 # These should be ok using -Werror
1229 # If gcc is version 3.3 (or higher?) it emits lots of false positive
1230 # "dereferencing type-punned pointer will break strict-aliasing rules"
1231 # warnings. Disable them by not doing any strict-aliasing. The
1232 # alternative is just too ugly. Thanks gcc guys!! ;)
1233 CFLAGS="$CFLAGS -fno-strict-aliasing"
1236 # Do not show warnings related to (char * | unsigned char *) type
1238 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1241 # These should be ok using -Werror
1246 # CFLAGS doesn't contain all compile flags. Some will be added only when
1247 # needed in the respective source directory. To get all compile flags
1248 # easily just add CPPFLAGS.
1249 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1251 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1252 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1254 dnl ===================================================================
1256 dnl ===================================================================
1260 contrib/elinks.spec \
1261 contrib/lua/hooks.lua \
1262 contrib/conv/w3m2links.awk \
1263 doc/man/man1/elinks.1 \
1264 src/intl/gettext/ref-add.sed \
1265 src/intl/gettext/ref-del.sed
1268 abs_srcdir="$(cd "$srcdir" && pwd)"
1269 # builddir is always absolute!
1270 if test "$abs_srcdir" != "$builddir"; then
1271 echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1272 "$MAKE" "SRC=$abs_srcdir" init
1276 dnl ===================================================================
1277 dnl Configuration summary
1278 dnl ===================================================================
1280 AC_MSG_RESULT(The following feature summary has been saved to features.log)