1 dnl Process this file with autoconf to produce a configure script.
3 dnl Autoconf 2.13 generates an incomplete config.h.in; see ELinks bug 936.
4 dnl Autoconf 2.59 is installed in the computer that generates our nightly
5 dnl snapshots, so we need to be compatible with that.
7 AC_INIT(src/main/main.c)
8 AC_CONFIG_AUX_DIR(config)
14 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
15 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
16 AC_CONFIG_HEADERS(config.h)
18 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
19 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
20 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
24 for make in gnumake gmake make false; do
25 if test "x$MAKE" = x; then
26 AC_PATH_PROGS(MAKE, "$make")
32 # Cleanup if we are configuring with a previous build in the tree
33 if test -e Makefile.config; then
34 AC_MSG_CHECKING([for previous build to clean])
35 "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
39 dnl ===================================================================
40 dnl Load feature configuration file and start logging features.
41 dnl ===================================================================
43 features="features.conf"
44 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
45 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
46 echo "Feature summary:" > features.log
48 dnl ===================================================================
49 dnl Checks for programs.
50 dnl ===================================================================
54 AC_PATH_PROGS(AWK, "$AWK")
58 AC_PATH_PROGS(GIT, "git")
59 AC_PATH_PROGS(SPARSE, "sparse")
66 if test "x$CONFIG_DOC" != xno; then
67 AC_PATH_PROGS(ASCIIDOC, "asciidoc")
68 if test "x$ASCIIDOC" != "x"; then
69 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
70 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
71 EL_CONFIG(MAN_ASCIIDOC, [HTML])
73 echo > config.asciidoc-unsafe.txt
74 if "$ASCIIDOC" --unsafe config.asciidoc-unsafe.txt >/dev/null 2>/dev/null; then
75 ASCIIDOC_FLAGS=--unsafe
77 rm config.asciidoc-unsafe.*
80 AC_PATH_PROGS(XMLTO, "xmlto")
81 if test "x$XMLTO" != "x"; then
82 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
83 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
84 EL_CONFIG(MAN_XMLTO, [man (groff)])
87 AC_PATH_PROGS(JW, "jw")
88 if test "x$JW" != "x"; then
89 EL_CONFIG(CONFIG_JW, [JadeWrapper])
90 EL_CONFIG(MANUAL_JW, [PDF])
93 AC_PATH_PROGS(POD2HTML, "pod2html")
94 if test "x$POD2HTML" != "x"; then
95 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
99 AC_SUBST(ASCIIDOC_FLAGS)
100 AC_SUBST(CONFIG_ASCIIDOC)
101 AC_SUBST(CONFIG_POD2HTML)
102 AC_SUBST(CONFIG_XMLTO)
105 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
106 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
107 EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
109 dnl gcc specific options (to be continued at the bottom of configure)
110 if test "x$ac_cv_prog_gcc" = "xyes"; then
111 dnl We want to see all warnings and live with none.
112 dnl We can't set up -Werror here as there may be some warnings in test
113 dnl suite of configure, and we don't want to fail them.
114 CFLAGS="$CFLAGS -Wall"
117 dnl ===================================================================
118 dnl Checks for special OSes.
119 dnl ===================================================================
121 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
122 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
124 AC_MSG_CHECKING([for $2])
127 AC_TRY_COMPILE(, [#ifndef $flag
129 #endif ], $1=yes, $1=no)
130 if test "[$]$1" = yes; then
131 EL_CONFIG([$1], [$2])
139 EL_CHECK_COMPILER_MACROS(CONFIG_BEOS, [BEOS], [__BEOS__])
140 AC_SUBST(CONFIG_BEOS)
142 EL_CHECK_COMPILER_MACROS(CONFIG_RISCOS, [RISCOS], [__riscos__])
143 AC_SUBST(CONFIG_RISCOS)
145 EL_CHECK_COMPILER_MACROS(CONFIG_WIN32, [WIN32], [_WIN32 __WIN32__])
146 AC_SUBST(CONFIG_WIN32)
148 EL_CHECK_COMPILER_MACROS(CONFIG_OS2, [EMX], [__EMX__])
150 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
152 AC_MSG_CHECKING([for UNIX])
153 dnl FIXME: some depend kind of mechanism
154 if test "$CONFIG_BEOS" = no && \
155 test "$CONFIG_RISCOS" = no && \
156 test "$CONFIG_WIN32" = no && \
157 test "$CONFIG_OS2" = no; then
158 EL_CONFIG(CONFIG_UNIX, [UNIX])
162 AC_MSG_RESULT($CONFIG_UNIX)
163 AC_SUBST(CONFIG_UNIX)
165 dnl ===================================================================
166 dnl Checks for header files.
167 dnl ===================================================================
174 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
175 AC_CHECK_HEADERS(sigaction.h)
176 AC_CHECK_HEADERS(arpa/inet.h)
177 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
178 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
179 AC_CHECK_HEADERS(ifaddrs.h)
180 AC_CHECK_HEADERS(sys/cygwin.h io.h)
181 AC_CHECK_HEADERS(sys/fmutex.h)
182 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
183 AC_CHECK_HEADERS(sys/resource.h)
184 AC_CHECK_HEADERS(sys/select.h)
185 AC_CHECK_HEADERS(sys/signal.h)
186 AC_CHECK_HEADERS(sys/socket.h)
187 AC_CHECK_HEADERS(sys/time.h)
188 AC_CHECK_HEADERS(sys/utsname.h)
189 AC_CHECK_HEADERS(stdint.h inttypes.h)
190 AC_CHECK_HEADERS(locale.h pwd.h)
191 AC_CHECK_HEADERS(termios.h)
194 AC_CHECK_HEADERS(sys/un.h,
195 [CONFIG_INTERLINK=yes
196 EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
197 [CONFIG_INTERLINK=no])
198 AC_SUBST(CONFIG_INTERLINK)
200 dnl ===================================================================
201 dnl Checks for typedefs, structures, and compiler characteristics.
202 dnl ===================================================================
207 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
212 EL_CHECK_TYPE(ssize_t, int)
213 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
214 EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
215 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
216 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
217 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
219 AC_CHECK_SIZEOF(char, 1)
220 AC_CHECK_SIZEOF(short, 2)
221 AC_CHECK_SIZEOF(int, 4)
222 AC_CHECK_SIZEOF(long, 4)
223 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
224 test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
226 dnl Check for variadic macros
227 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
229 #define a(b,c...) printf(b,##c)],
230 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
232 dnl Check for -rdynamic
233 dnl FIXME: This check doesn't work. Something to do with the compiler
234 dnl happily ignoring it and stderr not being checked for error messages.
235 AC_MSG_CHECKING([for -rdynamic])
237 LDFLAGS="$LDFLAGS -rdynamic"
238 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
239 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
240 AC_MSG_RESULT($have_rdynamic)
242 dnl ===================================================================
243 dnl Check for POSIX <regex.h>
244 dnl ===================================================================
246 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
248 dnl ===================================================================
249 dnl Checks for library functions.
250 dnl ===================================================================
252 AC_PROG_GCC_TRADITIONAL
256 AC_CHECK_FUNCS(gethostbyaddr herror strerror)
257 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
258 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
259 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
260 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
261 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
262 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
263 AC_CHECK_FUNCS(gettimeofday clock_gettime)
265 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
267 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
268 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
269 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
271 dnl These aren't probably needed now, as they are commented in links.h.
272 dnl I've no idea about their historical background, but I keep them here
273 dnl just in the case they will help later. --pasky
274 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
275 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
276 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
277 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
279 if test x"$HAVE_RAISE" = x; then
280 if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
281 AC_ERROR([Unable to emulate raise()])
285 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
286 AC_TRY_LINK([#include <stdarg.h>
287 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
288 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
289 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
290 EL_DEFINE(HAVE_VA_COPY, __va_copy)
293 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
294 AC_TRY_LINK([#include <unistd.h>
295 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
296 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
297 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
298 EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
301 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
310 int bar(char *buf, const char *format, va_list ap)
312 return vsnprintf(buf, 0, format, ap);
315 void foo(const char *format, ...) {
319 va_start(ap, format);
320 len = bar(buf, format, ap);
322 if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
324 va_start(ap, format);
325 len = bar(buf, format, ap);
327 if ((len != 6) && (len != 7)) exit(1);
329 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
333 main() { foo("hello\n"); }
335 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
336 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
337 EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
340 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
342 dnl ===================================================================
343 dnl Checks for libraries.
344 dnl ===================================================================
346 dnl Replace `main' with a function in -lsocket:
347 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
348 if test "$cf_result" = no; then
349 AC_CHECK_LIB(socket, socket)
352 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
353 if test "$cf_result" = no; then
354 AC_CHECK_LIB(socket, setsockopt)
357 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
358 if test "$cf_result" = no; then
359 AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
360 if test "$cf_result" = no; then
361 AC_CHECK_LIB(nsl, gethostbyname)
363 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
367 dnl ===================================================================
368 dnl Checks for packaging specific options.
369 dnl ===================================================================
371 AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
372 [ if test "$withval" != no && test "$withval" != yes; then
373 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
376 dnl ===================================================================
377 dnl Checks for a libraries, optional even if installed.
378 dnl ===================================================================
380 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
381 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
383 AC_MSG_CHECKING([for $2 support])
385 if test "[$]$1" != no; then
388 if test -n "$withval" && test -d "$withval"; then
389 CFLAGS="$CFLAGS -I$withval/include";
390 CPPFLAGS="$CPPFLAGS -I$withval/include";
391 LDFLAGS="$LDFLAGS -L$withval/lib";
394 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
395 if test "[$]$1" = yes; then
396 AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
399 if test "[$]$1" = yes; then
400 EL_CONFIG([$1], [$2])
403 if test -n "[$]WITHVAL_$1" &&
404 test "[$]WITHVAL_$1" != xno; then
405 AC_MSG_ERROR([$2 not found])
410 AC_MSG_RESULT(disabled)
414 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
415 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
420 AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
421 if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
423 EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
425 EL_LOG_CONFIG([$1], [$2], [])
428 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
429 [ --without-gpm disable gpm (mouse) support])
431 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
432 [ --without-zlib disable zlib support])
434 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
435 [ --without-bzlib disable bzlib support])
437 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
438 [ --without-idn disable international domain names support])
440 dnl ===================================================================
441 dnl Bookmark and XBEL support
442 dnl ===================================================================
446 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
447 [ --disable-bookmarks disable bookmark support])
449 # Check whether --enable-xbel or --disable-xbel was given.
450 if test "x${enable_xbel}" != xno; then
451 AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
453 if test "$HAVE_LIBEXPAT" = yes; then
454 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
455 if test "$HAVE_LIBEXPAT" = yes; then
462 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
464 [ --disable-xbel disable XBEL bookmark support (requires expat)])
466 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
470 dnl ===================================================================
471 dnl Checks for BSD sysmouse
472 dnl ===================================================================
474 HAVE_SYSMOUSE_HEADER="no"
476 # Either of these header files provides the (same) sysmouse interface
477 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
479 dnl ===================================================================
481 dnl ===================================================================
483 if test "$CONFIG_OS2" = yes; then
487 dnl ===================================================================
489 dnl ===================================================================
491 if test "$CONFIG_WIN32" = yes; then
495 dnl ===================================================================
496 dnl Check for SpiderMonkey, optional even if installed.
497 dnl ===================================================================
499 AC_ARG_WITH(spidermonkey, [ --without-spidermonkey disable SpiderMonkey Mozilla JavaScript engine support],
500 [if test "$withval" = no; then disable_spidermonkey=yes; fi])
501 AC_MSG_CHECKING([for SpiderMonkey])
506 if test -z "$disable_spidermonkey"; then
507 if test ! -d "$withval"; then
510 for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
511 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
512 for spidermonkeylib in js smjs mozjs; do
513 if test "$cf_result" = no; then
514 SPIDERMONKEY_LIBS="-l$spidermonkeylib"
516 if test ! -z "$spidermonkeydir"; then
517 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
518 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
521 LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
522 CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
523 CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
525 AC_TRY_LINK([#define XP_UNIX
527 [JS_GetImplementationVersion()],
528 cf_result=yes, cf_result=no)
535 AC_MSG_RESULT($cf_result)
537 if test "$cf_result" != yes; then
540 EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
543 AC_SUBST(SPIDERMONKEY_LIBS)
544 AC_SUBST(SPIDERMONKEY_CFLAGS)
547 AC_SUBST(CONFIG_SPIDERMONKEY)
549 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
552 dnl ===================================================================
553 dnl Check for Guile, optional even if installed.
554 dnl ===================================================================
558 AC_ARG_WITH(guile, [ --with-guile enable Guile support],
559 [ if test "x$withval" != xno; then enable_guile=yes; fi ])
561 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
562 # GUILE_FLAGS but I really don't want to require people to have Guile in order
563 # to compile CVS. Also, the macro seems to be really stupid regarding searching
564 # for Guile in $PATH etc. --pasky
566 AC_MSG_CHECKING([for Guile])
568 if test "$enable_guile" = "yes"; then
570 ## Based on the GUILE_FLAGS macro.
572 if test -d "$withval"; then
573 GUILE_PATH="$withval:$PATH"
578 AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
580 ## First, let's just see if we can find Guile at all.
581 if test "$GUILE_CONFIG" != no; then
584 GUILE_LIBS="`guile-config link`"
585 GUILE_CFLAGS="`guile-config compile`"
586 LIBS="$GUILE_LIBS $LIBS"
587 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
588 EL_CONFIG(CONFIG_GUILE, [Guile])
589 AC_SUBST(GUILE_CFLAGS)
591 ***********************************************************************
592 The Guile support is incomplete and not so well integrated to ELinks
593 yet. That means, e.g., that you have no Guile console and there might
594 not be all the necessary hooks. Also, the Guile interface is not too
595 well tested (success stories heartily welcomed!). See
596 src/scripting/guile/README for further details and hints.
597 ***********************************************************************
600 if test -n "$withval" && test "x$withval" != xno; then
601 AC_MSG_ERROR([Guile not found])
603 AC_MSG_WARN([Guile support disabled])
610 dnl ===================================================================
612 dnl ===================================================================
615 AC_ARG_WITH(perl, [ --with-perl enable Perl support],
617 if test "$withval" = yes; then
618 # FIXME: If withval is a valid directory append it to PATH
619 # so that you can specify one of several perl installations.
625 AC_MSG_CHECKING([for Perl])
631 if test "$enable_perl" = "yes"; then
632 PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
633 PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
634 LIBS="$PERL_LIBS $LIBS"
635 CFLAGS="$PERL_CFLAGS $CFLAGS"
636 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
642 [PerlInterpreter *my_perl = perl_alloc();],
643 cf_result=yes, cf_result=no)
646 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
648 AC_MSG_CHECKING([whether POPpx works without an n_a variable])
652 extern PerlInterpreter *my_perl;
654 [dSP; (void) POPpx;],
655 [AC_MSG_RESULT([yes])
656 AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
657 [Define if using Perl 5.8.8 or later, where the "POPpx" macro
658 no longer needs an "n_a" variable like it did in 5.8.7])],
659 [AC_MSG_RESULT([no])])
661 if test "$cf_result" != "yes"; then
664 EL_CONFIG(CONFIG_PERL, [Perl])
668 AC_SUBST(PERL_CFLAGS)
671 dnl ===================================================================
673 dnl ===================================================================
676 AC_ARG_WITH(python, [ --with-python enable Python support],
678 if test "$withval" = yes; then
679 # FIXME: If withval is a valid directory append it to PATH
680 # so that you can specify one of several Python installations.
684 ***********************************************************************
685 The Python support is incomplete and not so well integrated to ELinks
686 yet. That means, e.g.., that you have no Python console and there might
687 not be all the necessary hooks. Also, the Python interface is not too
688 well tested (success stories heartily welcomed!).
689 ***********************************************************************
694 AC_MSG_CHECKING([for Python])
700 if test "$enable_python" = "yes"; then
701 PYTHON_LIBS="-lpython`python -c 'from distutils import sysconfig; print sysconfig.get_config_var("VERSION")' 2> /dev/null`"
702 PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
703 LIBS="$PYTHON_LIBS $LIBS"
704 CFLAGS="$PYTHON_CFLAGS $CFLAGS"
705 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
710 cf_result=yes, cf_result=no)
713 if test "$cf_result" != "yes"; then
716 EL_CONFIG(CONFIG_PYTHON, [Python])
719 AC_SUBST(PYTHON_LIBS)
720 AC_SUBST(PYTHON_CFLAGS)
723 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
726 dnl ===================================================================
727 dnl Check for Lua, optional even if installed.
728 dnl ===================================================================
730 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
731 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
733 AC_ARG_WITH(lua, [ --without-lua disable Lua support],
734 [if test "$withval" = no; then disable_lua=yes; fi])
735 AC_MSG_CHECKING([for Lua])
740 if test -z "$disable_lua"; then
741 if test ! -d "$withval"; then
744 for luadir in "$withval" "" /usr /usr/local; do
745 for suffix in "" 50; do
746 if test "$cf_result" = no; then
747 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
749 if test ! -z "$luadir"; then
750 LUA_LIBS="-L$luadir/lib $LUA_LIBS"
751 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
754 LIBS="$LUA_LIBS $LIBS_X"
755 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
756 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
758 # Check that it is a compatible Lua version
759 AC_TRY_LINK([ #include <lua.h>
760 #include <lualib.h>],
761 [ lua_State *L = lua_open();
767 lua_pushboolean(L, 1);
769 cf_result=yes, cf_result=no)
775 AC_MSG_RESULT($cf_result)
777 if test "$cf_result" != yes; then
780 EL_CONFIG(CONFIG_LUA, [Lua])
781 AC_CHECK_HEADERS(lauxlib.h)
789 dnl ===================================================================
790 dnl Check for Ruby, optional even if installed.
791 dnl ===================================================================
795 dnl ===================================================================
796 dnl Optional Spidermonkey-based ECMAScript browser scripting
797 dnl ===================================================================
799 AC_ARG_ENABLE(sm-scripting,
800 [ --disable-sm-scripting ECMAScript browser scripting (requires Spidermonkey)],
801 [if test "$enableval" != no; then enableval="yes"; fi
802 CONFIG_SM_SCRIPTING="$enableval";])
804 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
805 test "x$CONFIG_SM_SCRIPTING" = xyes; then
806 EL_CONFIG(CONFIG_SM_SCRIPTING, [SpiderMonkey])
808 CONFIG_SM_SCRIPTING=no
811 dnl ===================================================================
812 dnl Setup global scripting
813 dnl ===================================================================
815 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY CONFIG_SM_SCRIPTING], [Browser scripting])
816 AC_SUBST(CONFIG_GUILE)
818 AC_SUBST(CONFIG_PERL)
819 AC_SUBST(CONFIG_PYTHON)
820 AC_SUBST(CONFIG_RUBY)
821 AC_SUBST(CONFIG_SM_SCRIPTING)
822 AC_SUBST(CONFIG_SCRIPTING)
825 dnl ===================================================================
826 dnl Check for SSL support.
827 dnl ===================================================================
829 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
830 dnl is enabled, we won't try to use OpenSSL anymore.
832 dnl For wiping SSL hooks..
839 AC_ARG_WITH(gnutls, [ --without-gnutls disable GNUTLS SSL support],
840 [if test "$with_gnutls" = no; then disable_gnutls=yes; fi])
841 AC_ARG_WITH(gnutls, [ --with-gnutls[=DIR] enable GNUTLS SSL support],
842 [if test "$with_gnutls" != no; then enable_gnutls=yes; fi])
843 gnutls_withval="$withval"
845 if test "$enable_gnutls" = yes; then
849 AC_ARG_WITH(openssl, [ --without-openssl disable OpenSSL support],
850 [if test "$with_openssl" = no; then disable_openssl=yes; fi])
851 AC_ARG_WITH(openssl, [ --with-openssl[=DIR] enable OpenSSL support (default)])
852 openssl_withval="$withval"
856 AC_MSG_CHECKING([for OpenSSL])
861 if test "$disable_openssl" = yes; then
864 for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
865 /usr/lib/openssl /usr/local/ssl \
866 /usr/local/www /usr/lib/ssl /usr/local \
867 /usr/pkg /opt /opt/openssl; do
868 if test "$cf_result" = no; then
869 if test -d "$ssldir"; then
870 OPENSSL_CFLAGS="-I$ssldir/include"
871 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
872 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
873 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
874 # # FIXME: This created serious portability problems. --pasky
875 # if test "$CC" == "gcc"; then
876 # # I'm not sure about compatibility here. --pasky
877 # LIBS="$LIBS -R$ssldir/lib"
880 LIBS="-lssl -lcrypto $LIBS_X"
882 AC_TRY_LINK([#include <openssl/ssl.h>],
883 [OpenSSL_add_all_algorithms()],
884 cf_result=yes, cf_result=no)
885 if test "$cf_result" != yes; then
886 AC_TRY_LINK([#include <openssl/ssl.h>],
887 [SSLeay_add_ssl_algorithms()],
888 cf_result=yes, cf_result=no)
893 if test "$cf_result" != yes; then
894 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
895 AC_MSG_ERROR([OpenSSL not found])
899 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
902 AC_SUBST(OPENSSL_CFLAGS)
906 AC_MSG_RESULT($cf_result)
908 CONFIG_GNUTLS_OPENSSL_COMPAT=no
910 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
911 dnl it looks ugly then.
913 if test "$cf_result" = yes; then
920 if test -z "$disable_gnutls"; then
921 # Sure, we maybe _could_ use their macro, but how to ensure
922 # that the ./configure script won't fail if the macro won't be
923 # found..? :( --pasky
925 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
927 if test -d "$gnutls_withval"; then
928 GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
931 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
933 if test "$LIBGNUTLS_CONFIG" = "no" ; then
936 GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
937 GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
939 LIBS="$GNUTLS_LIBS $LIBS_X"
940 CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
941 CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
943 # Verify if it's really usable. gnutls_session was
944 # renamed to gnutls_session_t before GNU TLS 1.2.0
945 # (on 2004-06-13); ELinks now requires this.
946 AC_TRY_LINK([#include <gnutls/gnutls.h>],
947 [gnutls_session_t dummy;
948 gnutls_check_version(NULL)],
949 cf_result=yes, cf_result=no)
952 if test "$cf_result" = yes; then
953 EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
956 AC_SUBST(GNUTLS_CFLAGS)
958 # GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
959 # to GPLv3+. Don't link that with the GPLv2 ELinks.
960 # ELinks will use its internal MD5 code instead.
961 CONFIG_GNUTLS_OPENSSL_COMPAT=no
963 if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
964 AC_MSG_ERROR([GNUTLS (1.2 or later) not found. ELinks no longer supports GNUTLS 1.1.])
971 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
972 AC_MSG_RESULT($cf_result)
976 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
977 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
978 AC_SUBST(CONFIG_OPENSSL)
979 AC_SUBST(CONFIG_GNUTLS)
983 AC_MSG_CHECKING([whether to be or not to be])
984 AC_MSG_RESULT([needs to be determined experimentally])
986 dnl ===================================================================
987 dnl Check for IPv6 support and related functions.
988 dnl ===================================================================
990 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
991 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
992 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
994 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
995 if test "$HAVE_GETADDRINFO" != yes; then
996 AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
997 if test "$HAVE_GETADDRINFO" = yes; then
1003 dnl ===================================================================
1004 dnl Checking for X11 (window title restoring).
1005 dnl ===================================================================
1008 if test x"$no_x" != xyes; then
1010 if test -n "$x_includes"; then
1011 X_CFLAGS="-I$x_includes"
1012 CPPFLAGS="$CPPFLAGS -I$x_includes"
1014 if test -n "$x_libraries"; then
1015 LDFLAGS="$LDFLAGS -L$x_libraries"
1018 AC_TRY_LINK([#include <X11/Xlib.h>],[XrmInitialize()],
1019 cf_result=yes, cf_result=no)
1021 if test "$cf_result" = yes; then
1022 if test -n "$x_libraries"; then
1023 LDFLAGS="$LDFLAGS -L$x_libraries"
1026 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1032 dnl ===================================================================
1033 dnl Backtraces displaying support.
1034 dnl ===================================================================
1036 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1037 # possible checks for other system-specific means go here
1040 dnl ===================================================================
1041 dnl SMB protocol support.
1042 dnl ===================================================================
1044 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1047 dnl ===================================================================
1048 dnl Gettext grey zone. Beware.
1049 dnl ===================================================================
1051 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"
1055 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1056 dnl # f33r d4 l33t... I hope it's portable. :)
1057 dnl cf_result=$((48#z - 48#a + 1));
1058 dnl AC_MSG_RESULT($cf_result)
1061 dnl ===================================================================
1062 dnl Compile-time features control
1063 dnl ===================================================================
1065 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1066 [ --disable-cookies disable cookie support])
1068 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1069 [ --disable-formhist disable form history support])
1071 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1072 [ --disable-globhist disable global history support])
1075 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1076 [ --disable-mailcap disable mailcap support])
1078 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1079 [ --disable-mimetypes disable mimetypes files support])
1082 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1083 [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1085 [ --disable-ipv6 disable IPv6 support])
1087 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1088 [ --enable-bittorrent enable BitTorrent protocol support])
1090 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1091 [ --disable-data disable data protocol support])
1093 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1094 [ --disable-uri-rewrite disable URI rewrite support])
1096 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1097 [ --enable-cgi enable local CGI support])
1099 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1100 [ --enable-finger enable finger protocol support])
1102 dnl ===================================================================
1104 dnl ===================================================================
1107 if test "x${enable_fsp}" != xno; then
1108 AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1110 if test "$HAVE_FSPLIB" = yes; then
1111 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1112 if test "$HAVE_FSPLIB" = yes; then
1113 LIBS="$LIBS -lfsplib"
1115 AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1116 if test "$HAVE_FSPLIB" = yes; then
1123 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1124 [ --enable-fsp enable FSP protocol support])
1126 if test "x$CONFIG_FSP" = xno; then
1130 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1131 [ --disable-ftp disable ftp protocol support])
1133 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1134 [ --enable-gopher enable gopher protocol support])
1136 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1137 [ --enable-nntp enable nntp protocol support])
1139 dnl Force disable SMB before EL_ARG_DEPEND so that it logs the correct value.
1140 if test "${enable_smb-no}" != no || test "${CONFIG_SMB-no}" != no; then
1141 AC_MSG_WARN([Forcing --disable-smb because of vulnerability CVE-2006-5925.
1142 If you want to use SMB, please wait for ELinks 0.12.0 or see bug 844.])
1146 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1147 [ --enable-smb not currently allowed])
1148 dnl EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1149 dnl [ --disable-smb disable SMB protocol support (requires smbclient)])
1152 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1153 [ --disable-mouse disable mouse support])
1155 # GPM mouse is Linux specific, so ...
1157 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1158 [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1160 [ --disable-sysmouse disable BSD sysmouse support])
1162 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1163 [ --enable-88-colors enable 88 color support])
1165 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1166 [ --enable-256-colors enable 256 color support])
1169 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1170 [ --enable-exmode enable exmode (CLI) interface])
1172 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1173 [ --disable-leds disable LEDs support])
1175 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1176 [ --disable-marks disable document marks support])
1179 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1180 [ --disable-css disable Cascading Style Sheet support])
1182 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1183 [ --enable-html-highlight HTML highlighting using DOM engine])
1185 dnl Everything in the tree already uses CONFIG_DOM
1186 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1187 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1189 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1190 [ --disable-backtrace disable backtrace support])
1192 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1193 [ --enable-no-root enable prevention of usage by root])
1196 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1197 [ --enable-debug enable leak debug and internal error checking])
1199 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1200 [ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
1202 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1203 [ --enable-own-libc force use of internal functions instead of those of system libc])
1205 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1206 [ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1208 if test "$CONFIG_OPENSSL" != yes &&
1209 test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1210 test "$CONFIG_OWN_LIBC" = yes;
1212 AC_MSG_CHECKING(for built-in MD5 support)
1214 EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1217 AC_SUBST(CONFIG_MD5)
1219 if test "$CONFIG_BITTORRENT" = yes; then
1220 if test "$CONFIG_OPENSSL" != yes ||
1221 test "$CONFIG_OWN_LIBC" = yes;
1223 AC_MSG_CHECKING(for built-in SHA1 support)
1225 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1229 AC_SUBST(CONFIG_SHA1)
1231 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1233 EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1235 AC_SUBST(CONFIG_SCANNER)
1237 AC_ARG_ENABLE(weehoofooboomookerchoo,
1239 Also check out the features.conf file for more information about features!
1241 [AC_MSG_ERROR(Are you strange, or what?)])
1246 test "$CONFIG_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1247 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1250 dnl ===================================================================
1251 dnl Export directory paths
1252 dnl ===================================================================
1254 # Set up the ``entry points'' if they were not supplied by builder
1255 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1256 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1258 # Create CONFDIR #define for config.h
1260 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1261 # it's autoconf fault to force us to do such hacks ;p.
1262 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1263 # sysconfdir is set to its default value... fine, let's append /elinks/
1264 # XXX: We can't modify listing of the default in ./configure --help :-(
1265 sysconfdir_n=`eval echo "$sysconfdir"`
1266 sysconfdir=$sysconfdir_n
1267 (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1268 sysconfdir="$sysconfdir/elinks"
1272 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1275 # Create LOCALEDIR #define for config.h
1276 test -z "$localedir" && localedir="$datadir/locale"
1277 localedir0=`eval echo "$localedir"`
1278 LOCALEDIR=`eval echo "$localedir0"`
1279 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1282 # Create LIBDIR #define for config.h
1283 LIBDIR=`eval echo "$libdir"`
1284 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1287 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1288 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1290 dnl ===================================================================
1291 dnl A little fine tuning of gcc specific options (continued)
1292 dnl ===================================================================
1294 if test "x$ac_cv_prog_gcc" = "xyes"; then
1295 if test "$CONFIG_DEBUG" = "yes"; then
1296 dnl We want to see all warnings and live with none (in debug mode).
1297 CFLAGS="$CFLAGS -Werror"
1300 case "`$CC -dumpversion`" in
1302 # These should be ok using -Werror
1305 # If gcc is version 3.3 (or higher?) it emits lots of false positive
1306 # "dereferencing type-punned pointer will break strict-aliasing rules"
1307 # warnings. Disable them by not doing any strict-aliasing. The
1308 # alternative is just too ugly. Thanks gcc guys!! ;)
1309 CFLAGS="$CFLAGS -fno-strict-aliasing"
1312 # Do not show warnings related to (char * | unsigned char *) type
1314 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1317 # These should be ok using -Werror
1321 # GCC 4.2.1 warns if we use the address of an object in Boolean context:
1322 # warning: the address of `builtin_modules' will always evaluate as `true'
1323 # This hits the object_lock and foreach_module macros in particular.
1324 # It would be okay to put something in the macros to avoid the warning,
1325 # but currently this seems to require defining parallel macros that skip
1326 # the NULL check, and that's too ugly. So we instead disable the warning.
1327 # GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
1328 # GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
1329 for warning_flag in -Wno-address -Wno-always-true; do
1330 AC_MSG_CHECKING([whether $CC accepts $warning_flag])
1332 CFLAGS="$CFLAGS $warning_flag"
1333 AC_TRY_COMPILE([], [],
1334 [AC_MSG_RESULT([yes])
1336 [AC_MSG_RESULT([no])])
1340 # Bug 1012: Some parts of ELinks do arithmetic with signed integers
1341 # in such a way that an overflow is possible. GCC 4.2.1 warns
1342 # "warning: assuming signed overflow does not occur when assuming
1343 # that (X + c) > X is always true", which may be an incorrect
1344 # optimization (although allowed by the standard), and breaks the
1345 # build with -Werror.
1347 # All of the following tests included -S -Wall -Wextra:
1349 # GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
1350 # * gcc-4.0 -O0: OK, compares the values
1351 # * gcc-4.0 -O2: assumes no overflow, does not warn
1352 # * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
1353 # * gcc-4.0 -O0 -fwrapv: OK, compares the values
1354 # * gcc-4.0 -O2 -fwrapv: OK, compares the values
1355 # * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
1356 # * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
1357 # * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1358 # * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
1360 # GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
1361 # * gcc-4.1 -O0: assumes no overflow, does not warn
1362 # * gcc-4.1 -O2: assumes no overflow, does not warn
1363 # * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
1364 # * gcc-4.1 -O0 -fwrapv: OK, compares the values
1365 # * gcc-4.1 -O2 -fwrapv: OK, compares the values
1366 # * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
1367 # * gcc-4.1 -O2 -ftrapv: compares the values
1368 # * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1369 # * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
1371 # GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
1372 # * gcc-4.2 -O0: OK, compares the values
1373 # * gcc-4.2 -O2: assumes no overflow, warns about it
1374 # * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
1375 # * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
1376 # * gcc-4.2 -O0 -fwrapv: OK, compares the values
1377 # * gcc-4.2 -O2 -fwrapv: OK, compares the values
1378 # * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
1379 # * gcc-4.2 -O2 -ftrapv: compares the values
1380 # * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1381 # * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
1383 # Apparently, -ftrapv does not work reliably at all.
1384 for overflow_flag in -fno-strict-overflow -fwrapv; do
1385 AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
1387 CFLAGS="$CFLAGS $overflow_flag"
1388 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1389 [AC_MSG_RESULT([yes])
1391 [AC_MSG_RESULT([no])])
1396 # CFLAGS doesn't contain all compile flags. Some will be added only when
1397 # needed in the respective source directory. To get all compile flags
1398 # easily just add CPPFLAGS.
1399 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1401 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1402 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1404 dnl ===================================================================
1405 dnl Colored make output
1406 dnl ===================================================================
1408 if test $(`which tput` colors) -ge 4; then
1410 AC_SUBST(MAKE_COLOR)
1413 dnl ===================================================================
1415 dnl ===================================================================
1419 contrib/elinks.spec \
1420 contrib/lua/hooks.lua \
1421 contrib/conv/w3m2links.awk \
1422 doc/man/man1/elinks.1 \
1423 src/intl/gettext/ref-add.sed \
1424 src/intl/gettext/ref-del.sed
1427 abs_srcdir="$(cd "$srcdir" && pwd)"
1428 # builddir is always absolute!
1429 if test "$abs_srcdir" != "$builddir"; then
1430 # Bootstrap the Makefile creation
1431 echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1432 "$MAKE" "SRC=$abs_srcdir" init
1433 # Make cg-status ignore this build directory
1434 echo "*" > "$builddir/.gitignore"
1438 dnl ===================================================================
1439 dnl Configuration summary
1440 dnl ===================================================================
1442 AC_MSG_RESULT(The following feature summary has been saved to features.log)