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])
21 for make in gnumake gmake make false; do
22 if test "x$MAKE" = x; then
23 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 AC_MSG_CHECKING([for previous build to clean])
32 "$MAKE" -C "$builddir/src" 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")
56 AC_PATH_PROGS(SPARSE, "sparse")
63 if test "x$CONFIG_DOC" != xno; then
64 AC_PATH_PROGS(ASCIIDOC, "asciidoc")
65 if test "x$ASCIIDOC" != "x"; then
66 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
67 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
68 EL_CONFIG(MAN_ASCIIDOC, [HTML])
71 AC_PATH_PROGS(XMLTO, "xmlto")
72 if test "x$XMLTO" != "x"; then
73 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
74 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
75 EL_CONFIG(MAN_XMLTO, [man (groff)])
78 AC_PATH_PROGS(JW, "jw")
79 if test "x$JW" != "x"; then
80 EL_CONFIG(CONFIG_JW, [JadeWrapper])
81 EL_CONFIG(MANUAL_JW, [PDF])
84 AC_PATH_PROGS(POD2HTML, "pod2html")
85 if test "x$POD2HTML" != "x"; then
86 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
90 AC_SUBST(CONFIG_ASCIIDOC)
91 AC_SUBST(CONFIG_POD2HTML)
92 AC_SUBST(CONFIG_XMLTO)
95 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation])
97 if test "$CONFIG_ASCIIDOC" = yes &&
98 test "$CONFIG_XMLTO" = yes &&
99 test "$CONFIG_JW" = yes; then
100 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
103 if test "$CONFIG_ASCIIDOC" = yes &&
104 test "$CONFIG_XMLTO" = yes; then
105 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
108 AC_SUBST(CONFIG_ASCIIDOC)
109 AC_SUBST(CONFIG_POD2HTML)
110 AC_SUBST(CONFIG_XMLTO)
113 dnl gcc specific options (to be continued at the bottom of configure)
114 if test "x$ac_cv_prog_gcc" = "xyes"; then
115 dnl We want to see all warnings and live with none.
116 dnl We can't set up -Werror here as there may be some warnings in test
117 dnl suite of configure, and we don't want to fail them.
118 CFLAGS="$CFLAGS -Wall"
121 dnl ===================================================================
122 dnl Checks for special OSes.
123 dnl ===================================================================
125 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
126 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
128 AC_MSG_CHECKING([for $2])
131 AC_TRY_COMPILE(, [#ifndef $flag
133 #endif ], $1=yes, $1=no)
134 if test "[$]$1" = yes; then
135 EL_CONFIG([$1], [$2])
143 EL_CHECK_COMPILER_MACROS(CONFIG_BEOS, [BEOS], [__BEOS__])
144 AC_SUBST(CONFIG_BEOS)
146 EL_CHECK_COMPILER_MACROS(CONFIG_RISCOS, [RISCOS], [__riscos__])
147 AC_SUBST(CONFIG_RISCOS)
149 EL_CHECK_COMPILER_MACROS(CONFIG_WIN32, [WIN32], [_WIN32 __WIN32__])
150 AC_SUBST(CONFIG_WIN32)
152 EL_CHECK_COMPILER_MACROS(CONFIG_OS2, [EMX], [__EMX__])
154 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
156 AC_MSG_CHECKING([for UNIX])
157 dnl FIXME: some depend kind of mechanism
158 if test "$CONFIG_BEOS" = no && \
159 test "$CONFIG_RISCOS" = no && \
160 test "$CONFIG_WIN32" = no && \
161 test "$CONFIG_OS2" = no; then
162 EL_CONFIG(CONFIG_UNIX, [UNIX])
166 AC_MSG_RESULT($CONFIG_UNIX)
167 AC_SUBST(CONFIG_UNIX)
169 dnl ===================================================================
170 dnl Checks for header files.
171 dnl ===================================================================
178 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
179 AC_CHECK_HEADERS(sigaction.h)
180 AC_CHECK_HEADERS(arpa/inet.h)
181 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
182 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
183 AC_CHECK_HEADERS(ifaddrs.h)
184 AC_CHECK_HEADERS(sys/cygwin.h io.h)
185 AC_CHECK_HEADERS(sys/fmutex.h)
186 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
187 AC_CHECK_HEADERS(sys/resource.h)
188 AC_CHECK_HEADERS(sys/select.h)
189 AC_CHECK_HEADERS(sys/signal.h)
190 AC_CHECK_HEADERS(sys/socket.h)
191 AC_CHECK_HEADERS(sys/time.h)
192 AC_CHECK_HEADERS(sys/utsname.h)
193 AC_CHECK_HEADERS(stdint.h inttypes.h)
194 AC_CHECK_HEADERS(locale.h pwd.h)
195 AC_CHECK_HEADERS(termios.h)
198 AC_CHECK_HEADERS(sys/un.h,
199 [CONFIG_INTERLINK=yes
200 EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
201 [CONFIG_INTERLINK=no])
202 AC_SUBST(CONFIG_INTERLINK)
204 dnl ===================================================================
205 dnl Checks for typedefs, structures, and compiler characteristics.
206 dnl ===================================================================
211 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
216 EL_CHECK_TYPE(ssize_t, int)
217 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
218 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
219 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
220 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
222 AC_CHECK_SIZEOF(char, 1)
223 AC_CHECK_SIZEOF(short, 2)
224 AC_CHECK_SIZEOF(int, 4)
225 AC_CHECK_SIZEOF(long, 4)
226 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
228 dnl Check for variadic macros
229 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
231 #define a(b,c...) printf(b,##c)],
232 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
234 dnl Check for -rdynamic
235 dnl FIXME: This check doesn't work. Something to do with the compiler
236 dnl happily ignoring it and stderr not being checked for error messages.
237 AC_MSG_CHECKING([for -rdynamic])
239 LDFLAGS="$LDFLAGS -rdynamic"
240 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
241 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
242 AC_MSG_RESULT($have_rdynamic)
244 dnl ===================================================================
245 dnl Check for POSIX <regex.h>
246 dnl ===================================================================
248 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
250 dnl ===================================================================
251 dnl Checks for library functions.
252 dnl ===================================================================
254 AC_PROG_GCC_TRADITIONAL
258 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
259 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
260 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
261 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
262 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
263 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
264 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
265 AC_CHECK_FUNCS(gettimeofday clock_gettime)
267 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
269 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
270 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
271 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
273 dnl These aren't probably needed now, as they are commented in links.h.
274 dnl I've no idea about their historical background, but I keep them here
275 dnl just in the case they will help later. --pasky
276 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
277 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
278 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
279 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
281 if test x"$HAVE_RAISE" = x; then
282 if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
283 AC_ERROR([Unable to emulate raise()])
287 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
288 AC_TRY_LINK([#include <stdarg.h>
289 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
290 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
291 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
292 EL_DEFINE(HAVE_VA_COPY, __va_copy)
295 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
296 AC_TRY_LINK([#include <unistd.h>
297 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
298 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
299 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
300 EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
303 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
312 int bar(char *buf, const char *format, va_list ap)
314 return vsnprintf(buf, 0, format, ap);
317 void foo(const char *format, ...) {
321 va_start(ap, format);
322 len = bar(buf, format, ap);
324 if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
326 va_start(ap, format);
327 len = bar(buf, format, ap);
329 if ((len != 6) && (len != 7)) exit(1);
331 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
335 main() { foo("hello\n"); }
337 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
338 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
339 EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
342 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
344 dnl ===================================================================
345 dnl Checks for libraries.
346 dnl ===================================================================
348 dnl Replace `main' with a function in -lsocket:
349 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
350 if test "$cf_result" = no; then
351 AC_CHECK_LIB(socket, socket)
354 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
355 if test "$cf_result" = no; then
356 AC_CHECK_LIB(socket, setsockopt)
359 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
360 if test "$cf_result" = no; then
361 AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
362 if test "$cf_result" = no; then
363 AC_CHECK_LIB(nsl, gethostbyname)
365 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
369 dnl ===================================================================
370 dnl Checks for packaging specific options.
371 dnl ===================================================================
373 AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
374 [ if test "$withval" != no && test "$withval" != yes; then
375 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
378 dnl ===================================================================
379 dnl Checks for a libraries, optional even if installed.
380 dnl ===================================================================
382 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
383 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
385 AC_MSG_CHECKING([for $2 support])
387 if test "[$]$1" != no; then
390 if test -n "$withval" && test -d "$withval"; then
391 CFLAGS="$CFLAGS -I$withval/include";
392 CPPFLAGS="$CPPFLAGS -I$withval/include";
393 LDFLAGS="$LDFLAGS -L$withval/lib";
396 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
397 if test "[$]$1" = yes; then
398 AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
401 if test "[$]$1" = yes; then
402 EL_CONFIG([$1], [$2])
405 if test -n "[$]WITHVAL_$1" &&
406 test "[$]WITHVAL_$1" != xno; then
407 AC_MSG_ERROR([$2 not found])
412 AC_MSG_RESULT(disabled)
416 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
417 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
422 AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
423 if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
425 EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
427 EL_LOG_CONFIG([$1], [$2], [])
430 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
431 [ --without-gpm disable gpm (mouse) support])
433 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
434 [ --without-zlib disable zlib support])
436 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
437 [ --without-bzlib disable bzlib support])
439 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
440 [ --without-idn disable international domain names support])
442 dnl ===================================================================
443 dnl Bookmark and XBEL support
444 dnl ===================================================================
448 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
449 [ --disable-bookmarks disable bookmark support])
451 # Check whether --enable-xbel or --disable-xbel was given.
452 if test "x${enable_xbel}" != xno; then
453 AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
455 if test "$HAVE_LIBEXPAT" = yes; then
456 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
457 if test "$HAVE_LIBEXPAT" = yes; then
464 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
466 [ --disable-xbel disable XBEL bookmark support (requires expat)])
468 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
472 dnl ===================================================================
473 dnl Checks for BSD sysmouse
474 dnl ===================================================================
476 HAVE_SYSMOUSE_HEADER="no"
478 # Either of these header files provides the (same) sysmouse interface
479 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
481 dnl ===================================================================
483 dnl ===================================================================
485 if test "$CONFIG_OS2" = yes; then
489 dnl ===================================================================
491 dnl ===================================================================
493 if test "$CONFIG_WIN32" = yes; then
497 dnl ===================================================================
498 dnl Check for SpiderMonkey, optional even if installed.
499 dnl ===================================================================
501 AC_ARG_WITH(spidermonkey, [ --without-spidermonkey disable SpiderMonkey Mozilla JavaScript engine support],
502 [if test "$withval" = no; then disable_spidermonkey=yes; fi])
503 AC_MSG_CHECKING([for SpiderMonkey])
508 if test -z "$disable_spidermonkey"; then
509 if test ! -d "$withval"; then
512 for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
513 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
514 for spidermonkeylib in js smjs; do
515 if test "$cf_result" = no; then
516 SPIDERMONKEY_LIBS="-l$spidermonkeylib"
518 if test ! -z "$spidermonkeydir"; then
519 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
520 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
523 LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
524 CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
525 CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
527 AC_TRY_LINK([#define XP_UNIX
529 [JS_GetImplementationVersion()],
530 cf_result=yes, cf_result=no)
537 AC_MSG_RESULT($cf_result)
539 if test "$cf_result" != yes; then
542 EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
545 AC_SUBST(SPIDERMONKEY_LIBS)
546 AC_SUBST(SPIDERMONKEY_CFLAGS)
549 AC_SUBST(CONFIG_SPIDERMONKEY)
551 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
554 dnl ===================================================================
555 dnl Check for Guile, optional even if installed.
556 dnl ===================================================================
560 AC_ARG_WITH(guile, [ --with-guile enable Guile support],
561 [ if test "x$withval" != xno; then enable_guile=yes; fi ])
563 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
564 # GUILE_FLAGS but I really don't want to require people to have Guile in order
565 # to compile CVS. Also, the macro seems to be really stupid regarding searching
566 # for Guile in $PATH etc. --pasky
568 AC_MSG_CHECKING([for Guile])
570 if test "$enable_guile" = "yes"; then
572 ## Based on the GUILE_FLAGS macro.
574 if test -d "$withval"; then
575 GUILE_PATH="$withval:$PATH"
580 AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
582 ## First, let's just see if we can find Guile at all.
583 if test "$GUILE_CONFIG" != no; then
586 GUILE_LIBS="`guile-config link`"
587 GUILE_CFLAGS="`guile-config compile`"
588 LIBS="$GUILE_LIBS $LIBS"
589 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
590 EL_CONFIG(CONFIG_GUILE, [Guile])
591 AC_SUBST(GUILE_CFLAGS)
593 ***********************************************************************
594 The Guile support is incomplete and not so well integrated to ELinks
595 yet. That means, ie., that you have no Guile console and there might
596 not be all the necessary hooks. Also, the Guile interface is not too
597 well tested (success stories heartily welcomed!). See
598 src/scripting/guile/README for further details and hints.
599 ***********************************************************************
602 if test -n "$withval" && test "x$withval" != xno; then
603 AC_MSG_ERROR([Guile not found])
605 AC_MSG_WARN([Guile support disabled])
612 dnl ===================================================================
614 dnl ===================================================================
617 AC_ARG_WITH(perl, [ --with-perl enable Perl support],
619 if test "$withval" = yes; then
620 # FIXME: If withval is a valid directory append it to PATH
621 # so that you can specify one of several perl installations.
627 AC_MSG_CHECKING([for Perl])
633 if test "$enable_perl" = "yes"; then
634 PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
635 PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
636 LIBS="$PERL_LIBS $LIBS"
637 CFLAGS="$PERL_CFLAGS $CFLAGS"
638 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
644 [PerlInterpreter *my_perl = perl_alloc();],
645 cf_result=yes, cf_result=no)
648 if test "$cf_result" != "yes"; then
651 EL_CONFIG(CONFIG_PERL, [Perl])
655 AC_SUBST(PERL_CFLAGS)
658 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
659 dnl ===================================================================
661 dnl ===================================================================
664 AC_ARG_WITH(python, [ --with-python enable Python support],
666 if test "$withval" = yes; then
667 # FIXME: If withval is a valid directory append it to PATH
668 # so that you can specify one of several Python installations.
672 ***********************************************************************
673 The Python support is incomplete and not so well integrated to ELinks
674 yet. That means, ie., that you have no Python console and there might
675 not be all the necessary hooks. Also, the Python interface is not too
676 well tested (success stories heartily welcomed!).
677 ***********************************************************************
682 AC_MSG_CHECKING([for Python])
688 if test "$enable_python" = "yes"; then
689 PYTHON_LIBS="-lpython"
690 PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
691 LIBS="$PYTHON_LIBS $LIBS"
692 CFLAGS="$PYTHON_CFLAGS $CFLAGS"
693 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
698 cf_result=yes, cf_result=no)
701 if test "$cf_result" != "yes"; then
704 EL_CONFIG(CONFIG_PYTHON, [Python])
707 AC_SUBST(PYTHON_LIBS)
708 AC_SUBST(PYTHON_CFLAGS)
711 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
714 dnl ===================================================================
715 dnl Check for Lua, optional even if installed.
716 dnl ===================================================================
718 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
719 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
721 AC_ARG_WITH(lua, [ --without-lua disable Lua support],
722 [if test "$withval" = no; then disable_lua=yes; fi])
723 AC_MSG_CHECKING([for Lua])
728 if test -z "$disable_lua"; then
729 if test ! -d "$withval"; then
732 for luadir in "$withval" "" /usr /usr/local; do
733 for suffix in "" 50 51; do
734 if test "$cf_result" = no; then
735 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
737 if test ! -z "$luadir"; then
738 LUA_LIBS="-L$luadir/lib $LUA_LIBS"
739 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
742 LIBS="$LUA_LIBS $LIBS_X"
743 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
744 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
746 # Check that it is a compatible Lua version
747 AC_TRY_LINK([ #include <lua.h>
748 #include <lualib.h>],
749 [ lua_State *L = lua_open();
754 lua_pushboolean(L, 1);
756 cf_result=yes, cf_result=no)
762 AC_MSG_RESULT($cf_result)
764 if test "$cf_result" != yes; then
767 EL_CONFIG(CONFIG_LUA, [Lua])
768 AC_CHECK_HEADERS(lauxlib.h)
776 dnl ===================================================================
777 dnl Check for Ruby, optional even if installed.
778 dnl ===================================================================
782 dnl ===================================================================
783 dnl Optional Spidermonkey-based ECMAScript browser scripting
784 dnl ===================================================================
786 AC_ARG_ENABLE(sm-scripting,
787 [ --disable-sm-scripting ECMAScript browser scripting (requires Spidermonkey)],
788 [if test "$enableval" != no; then enableval="yes"; fi
789 CONFIG_SM_SCRIPTING="$enableval";])
791 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
792 test "x$CONFIG_SM_SCRIPTING" = xyes; then
793 EL_CONFIG(CONFIG_SM_SCRIPTING, [SpiderMonkey])
795 CONFIG_SM_SCRIPTING=no
798 dnl ===================================================================
799 dnl Setup global scripting
800 dnl ===================================================================
802 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY CONFIG_SM_SCRIPTING], [Browser scripting])
803 AC_SUBST(CONFIG_GUILE)
805 AC_SUBST(CONFIG_PERL)
806 AC_SUBST(CONFIG_PYTHON)
807 AC_SUBST(CONFIG_RUBY)
808 AC_SUBST(CONFIG_SM_SCRIPTING)
809 AC_SUBST(CONFIG_SCRIPTING)
812 dnl ===================================================================
813 dnl Check for SSL support.
814 dnl ===================================================================
816 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
817 dnl is enabled, we won't try to use OpenSSL anymore.
819 dnl For wiping SSL hooks..
826 AC_ARG_WITH(gnutls, [ --without-gnutls disable GNUTLS SSL support],
827 [if test "$with_gnutls" = no; then disable_gnutls=yes; fi])
828 AC_ARG_WITH(gnutls, [ --with-gnutls[=DIR] enable GNUTLS SSL support],
829 [if test "$with_gnutls" != no; then enable_gnutls=yes; fi])
830 gnutls_withval="$withval"
832 if test "$enable_gnutls" = yes; then
836 AC_ARG_WITH(openssl, [ --without-openssl disable OpenSSL support],
837 [if test "$with_openssl" = no; then disable_openssl=yes; fi])
838 AC_ARG_WITH(openssl, [ --with-openssl[=DIR] enable OpenSSL support (default)])
839 openssl_withval="$withval"
843 AC_MSG_CHECKING([for OpenSSL])
848 if test "$disable_openssl" = yes; then
851 for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
852 /usr/lib/openssl /usr/local/ssl \
853 /usr/local/www /usr/lib/ssl /usr/local \
854 /usr/pkg /opt /opt/openssl; do
855 if test "$cf_result" = no; then
856 if test -d "$ssldir"; then
857 OPENSSL_CFLAGS="-I$ssldir/include"
858 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
859 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
860 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
861 # # FIXME: This created serious portability problems. --pasky
862 # if test "$CC" == "gcc"; then
863 # # I'm not sure about compatibility here. --pasky
864 # LIBS="$LIBS -R$ssldir/lib"
867 LIBS="-lssl -lcrypto $LIBS_X"
869 AC_TRY_LINK([#include <openssl/ssl.h>],
870 [OpenSSL_add_all_algorithms()],
871 cf_result=yes, cf_result=no)
872 if test "$cf_result" != yes; then
873 AC_TRY_LINK([#include <openssl/ssl.h>],
874 [SSLeay_add_ssl_algorithms()],
875 cf_result=yes, cf_result=no)
880 if test "$cf_result" != yes; then
881 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
882 AC_MSG_ERROR([OpenSSL not found])
886 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
889 AC_SUBST(OPENSSL_CFLAGS)
893 AC_MSG_RESULT($cf_result)
896 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
897 dnl it looks ugly then.
899 if test "$cf_result" = yes; then
906 if test -z "$disable_gnutls"; then
907 # Sure, we maybe _could_ use their macro, but how to ensure
908 # that the ./configure script won't fail if the macro won't be
909 # found..? :( --pasky
911 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
913 if test -d "$gnutls_withval"; then
914 GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
917 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
919 if test "$LIBGNUTLS_CONFIG" = "no" ; then
922 GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
923 GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
925 LIBS="$GNUTLS_LIBS $LIBS_X"
926 CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
927 CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
929 # Verify if it's really usable. gnutls_session was
930 # renamed to gnutls_session_t before GNU TLS 1.2.0
931 # (on 2004-06-13); ELinks now requires this.
932 AC_TRY_LINK([#include <gnutls/gnutls.h>],
933 [gnutls_session_t dummy;
934 gnutls_check_version(NULL)],
935 cf_result=yes, cf_result=no)
938 if test "$cf_result" = yes; then
939 EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
942 AC_SUBST(GNUTLS_CFLAGS)
944 # Verify if the MD5 compatibility layer is usable.
945 CONFIG_GNUTLS_OPENSSL_COMPAT=yes
946 EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
947 [GNU TLS OpenSSL compatibility],
948 gnutls/openssl.h, gnutls-openssl,
951 if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
952 AC_MSG_ERROR([GNUTLS (1.2 or later) not found. ELinks no longer supports GNUTLS 1.1.])
959 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
960 AC_MSG_RESULT($cf_result)
964 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
965 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
966 AC_SUBST(CONFIG_OPENSSL)
967 AC_SUBST(CONFIG_GNUTLS)
971 AC_MSG_CHECKING([whether to be or not to be])
972 AC_MSG_RESULT([needs to be determined experimentally])
974 dnl ===================================================================
975 dnl Check for IPv6 support and related functions.
976 dnl ===================================================================
978 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
979 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
980 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
982 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
983 if test "$HAVE_GETADDRINFO" != yes; then
984 AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
985 if test "$HAVE_GETADDRINFO" = yes; then
991 dnl ===================================================================
992 dnl Checking for X11 (window title restoring).
993 dnl ===================================================================
996 if test x"$no_x" != xyes; then
997 if test -n "$x_includes"; then
998 X_CFLAGS="-I$x_includes"
999 CPPFLAGS="$CPPFLAGS -I$x_includes"
1001 if test -n "$x_libraries"; then
1002 LDFLAGS="$LDFLAGS -L$x_libraries"
1005 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1010 dnl ===================================================================
1011 dnl Backtraces displaying support.
1012 dnl ===================================================================
1014 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1015 # possible checks for other system-specific means go here
1018 dnl ===================================================================
1019 dnl SMB protocol support.
1020 dnl ===================================================================
1022 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1025 dnl ===================================================================
1026 dnl Gettext grey zone. Beware.
1027 dnl ===================================================================
1029 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"
1033 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1034 dnl # f33r d4 l33t... I hope it's portable. :)
1035 dnl cf_result=$((48#z - 48#a + 1));
1036 dnl AC_MSG_RESULT($cf_result)
1039 dnl ===================================================================
1040 dnl Compile-time features control
1041 dnl ===================================================================
1043 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1044 [ --disable-cookies disable cookie support])
1046 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1047 [ --disable-formhist disable form history support])
1049 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1050 [ --disable-globhist disable global history support])
1053 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1054 [ --disable-mailcap disable mailcap support])
1056 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1057 [ --disable-mimetypes disable mimetypes files support])
1060 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1061 [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1063 [ --disable-ipv6 disable IPv6 support])
1065 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1066 [ --enable-bittorrent enable BitTorrent protocol support])
1068 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1069 [ --disable-data disable data protocol support])
1071 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1072 [ --disable-uri-rewrite disable URI rewrite support])
1074 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1075 [ --enable-cgi enable local CGI support])
1077 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1078 [ --enable-finger enable finger protocol support])
1080 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1081 [ --disable-ftp disable ftp protocol support])
1083 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1084 [ --enable-gopher enable gopher protocol support])
1086 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1087 [ --enable-nntp enable nntp protocol support])
1089 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1090 [ --disable-smb disable SMB protocol support (requires smbclient)])
1093 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1094 [ --disable-mouse disable mouse support])
1096 # GPM mouse is Linux specific, so ...
1098 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1099 [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1101 [ --disable-sysmouse disable BSD sysmouse support])
1103 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1104 [ --enable-88-colors enable 88 color support])
1106 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1107 [ --enable-256-colors enable 256 color support])
1110 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1111 [ --enable-exmode enable exmode (CLI) interface])
1113 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1114 [ --disable-leds disable LEDs support])
1116 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1117 [ --disable-marks disable document marks support])
1120 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1121 [ --disable-css disable Cascading Style Sheet support])
1123 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1124 [ --enable-html-highlight HTML highlighting using DOM engine])
1126 dnl Everything in the tree already uses CONFIG_DOM
1127 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1128 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1130 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1131 [ --disable-backtrace disable backtrace support])
1133 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1134 [ --enable-no-root enable prevention of usage by root])
1137 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1138 [ --enable-debug enable leak debug and internal error checking])
1140 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1141 [ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
1143 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1144 [ --enable-own-libc force use of internal functions instead of those of system libc])
1146 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1147 [ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1149 if test "$CONFIG_OPENSSL" != yes &&
1150 test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1151 test "$CONFIG_OWN_LIBC" = yes;
1153 AC_MSG_CHECKING(for built-in MD5 support)
1155 EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1158 AC_SUBST(CONFIG_MD5)
1160 if test "$CONFIG_BITTORRENT" = yes; then
1161 if test "$CONFIG_OPENSSL" != yes ||
1162 test "$CONFIG_OWN_LIBC" = yes;
1164 AC_MSG_CHECKING(for built-in SHA1 support)
1166 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1170 AC_SUBST(CONFIG_SHA1)
1172 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1174 EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1176 AC_SUBST(CONFIG_SCANNER)
1178 AC_ARG_ENABLE(weehoofooboomookerchoo,
1180 Also check out the features.conf file for more information about features!
1182 [AC_MSG_ERROR(Are you strange, or what?)])
1187 test "$CONFIG_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1188 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1191 dnl ===================================================================
1192 dnl Export directory paths
1193 dnl ===================================================================
1195 # Set up the ``entry points'' if they were not supplied by builder
1196 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1197 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1199 # Create CONFDIR #define for config.h
1201 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1202 # it's autoconf fault to force us to do such hacks ;p.
1203 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1204 # sysconfdir is set to its default value... fine, let's append /elinks/
1205 # XXX: We can't modify listing of the default in ./configure --help :-(
1206 sysconfdir_n=`eval echo "$sysconfdir"`
1207 sysconfdir=$sysconfdir_n
1208 (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1209 sysconfdir="$sysconfdir/elinks"
1213 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1216 # Create LOCALEDIR #define for config.h
1217 LOCALEDIR=`eval echo "$datadir/locale"`
1218 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1221 # Create LIBDIR #define for config.h
1222 LIBDIR=`eval echo "$libdir"`
1223 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1226 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1227 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1229 dnl ===================================================================
1230 dnl A little fine tuning of gcc specific options (continued)
1231 dnl ===================================================================
1233 if test "x$ac_cv_prog_gcc" = "xyes"; then
1234 if test "$CONFIG_DEBUG" = "yes"; then
1235 dnl We want to see all warnings and live with none (in debug mode).
1236 CFLAGS="$CFLAGS -Werror"
1239 case "`$CC -dumpversion`" in
1241 # These should be ok using -Werror
1244 # If gcc is version 3.3 (or higher?) it emits lots of false positive
1245 # "dereferencing type-punned pointer will break strict-aliasing rules"
1246 # warnings. Disable them by not doing any strict-aliasing. The
1247 # alternative is just too ugly. Thanks gcc guys!! ;)
1248 CFLAGS="$CFLAGS -fno-strict-aliasing"
1251 # Do not show warnings related to (char * | unsigned char *) type
1253 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1256 # These should be ok using -Werror
1261 # CFLAGS doesn't contain all compile flags. Some will be added only when
1262 # needed in the respective source directory. To get all compile flags
1263 # easily just add CPPFLAGS.
1264 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1266 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1267 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1269 dnl ===================================================================
1270 dnl Colored make output
1271 dnl ===================================================================
1273 if test $(`which tput` colors) -ge 4; then
1275 AC_SUBST(MAKE_COLOR)
1278 dnl ===================================================================
1280 dnl ===================================================================
1284 contrib/elinks.spec \
1285 contrib/lua/hooks.lua \
1286 contrib/conv/w3m2links.awk \
1287 doc/man/man1/elinks.1 \
1288 src/intl/gettext/ref-add.sed \
1289 src/intl/gettext/ref-del.sed
1292 abs_srcdir="$(cd "$srcdir" && pwd)"
1293 # builddir is always absolute!
1294 if test "$abs_srcdir" != "$builddir"; then
1295 echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1296 "$MAKE" "SRC=$abs_srcdir" init
1300 dnl ===================================================================
1301 dnl Configuration summary
1302 dnl ===================================================================
1304 AC_MSG_RESULT(The following feature summary has been saved to features.log)