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 # Verify if the MD5 compatibility layer is usable.
959 CONFIG_GNUTLS_OPENSSL_COMPAT=yes
960 EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
961 [GNU TLS OpenSSL compatibility],
962 gnutls/openssl.h, gnutls-openssl,
965 if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
966 AC_MSG_ERROR([GNUTLS (1.2 or later) not found. ELinks no longer supports GNUTLS 1.1.])
973 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
974 AC_MSG_RESULT($cf_result)
978 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
979 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
980 AC_SUBST(CONFIG_OPENSSL)
981 AC_SUBST(CONFIG_GNUTLS)
985 AC_MSG_CHECKING([whether to be or not to be])
986 AC_MSG_RESULT([needs to be determined experimentally])
988 dnl ===================================================================
989 dnl Check for IPv6 support and related functions.
990 dnl ===================================================================
992 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
993 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
994 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
996 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
997 if test "$HAVE_GETADDRINFO" != yes; then
998 AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
999 if test "$HAVE_GETADDRINFO" = yes; then
1000 LIBS="$LIBS -linet6"
1005 dnl ===================================================================
1006 dnl Checking for X11 (window title restoring).
1007 dnl ===================================================================
1010 if test x"$no_x" != xyes; then
1012 if test -n "$x_includes"; then
1013 X_CFLAGS="-I$x_includes"
1014 CPPFLAGS="$CPPFLAGS -I$x_includes"
1016 if test -n "$x_libraries"; then
1017 LDFLAGS="$LDFLAGS -L$x_libraries"
1020 AC_TRY_LINK([#include <X11/Xlib.h>],[XrmInitialize()],
1021 cf_result=yes, cf_result=no)
1023 if test "$cf_result" = yes; then
1024 if test -n "$x_libraries"; then
1025 LDFLAGS="$LDFLAGS -L$x_libraries"
1028 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1034 dnl ===================================================================
1035 dnl Backtraces displaying support.
1036 dnl ===================================================================
1038 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1039 # possible checks for other system-specific means go here
1042 dnl ===================================================================
1043 dnl SMB protocol support.
1044 dnl ===================================================================
1046 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1049 dnl ===================================================================
1050 dnl Gettext grey zone. Beware.
1051 dnl ===================================================================
1053 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"
1057 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1058 dnl # f33r d4 l33t... I hope it's portable. :)
1059 dnl cf_result=$((48#z - 48#a + 1));
1060 dnl AC_MSG_RESULT($cf_result)
1063 dnl ===================================================================
1064 dnl Compile-time features control
1065 dnl ===================================================================
1067 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1068 [ --disable-cookies disable cookie support])
1070 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1071 [ --disable-formhist disable form history support])
1073 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1074 [ --disable-globhist disable global history support])
1077 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1078 [ --disable-mailcap disable mailcap support])
1080 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1081 [ --disable-mimetypes disable mimetypes files support])
1084 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1085 [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1087 [ --disable-ipv6 disable IPv6 support])
1089 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1090 [ --enable-bittorrent enable BitTorrent protocol support])
1092 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1093 [ --disable-data disable data protocol support])
1095 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1096 [ --disable-uri-rewrite disable URI rewrite support])
1098 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1099 [ --enable-cgi enable local CGI support])
1101 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1102 [ --enable-finger enable finger protocol support])
1104 dnl ===================================================================
1106 dnl ===================================================================
1109 if test "x${enable_fsp}" != xno; then
1110 AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1112 if test "$HAVE_FSPLIB" = yes; then
1113 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1114 if test "$HAVE_FSPLIB" = yes; then
1115 LIBS="$LIBS -lfsplib"
1117 AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1118 if test "$HAVE_FSPLIB" = yes; then
1125 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1126 [ --enable-fsp enable FSP protocol support])
1128 if test "x$CONFIG_FSP" = xno; then
1132 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1133 [ --disable-ftp disable ftp protocol support])
1135 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1136 [ --enable-gopher enable gopher protocol support])
1138 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1139 [ --enable-nntp enable nntp protocol support])
1141 dnl Force disable SMB before EL_ARG_DEPEND so that it logs the correct value.
1142 if test "${enable_smb-no}" != no || test "${CONFIG_SMB-no}" != no; then
1143 AC_MSG_WARN([Forcing --disable-smb because of vulnerability CVE-2006-5925.
1144 If you want to use SMB, please wait for ELinks 0.12.0 or see bug 844.])
1148 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1149 [ --enable-smb not currently allowed])
1150 dnl EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1151 dnl [ --disable-smb disable SMB protocol support (requires smbclient)])
1154 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1155 [ --disable-mouse disable mouse support])
1157 # GPM mouse is Linux specific, so ...
1159 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1160 [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1162 [ --disable-sysmouse disable BSD sysmouse support])
1164 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1165 [ --enable-88-colors enable 88 color support])
1167 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1168 [ --enable-256-colors enable 256 color support])
1171 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1172 [ --enable-exmode enable exmode (CLI) interface])
1174 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1175 [ --disable-leds disable LEDs support])
1177 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1178 [ --disable-marks disable document marks support])
1181 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1182 [ --disable-css disable Cascading Style Sheet support])
1184 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1185 [ --enable-html-highlight HTML highlighting using DOM engine])
1187 dnl Everything in the tree already uses CONFIG_DOM
1188 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1189 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1191 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1192 [ --disable-backtrace disable backtrace support])
1194 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1195 [ --enable-no-root enable prevention of usage by root])
1198 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1199 [ --enable-debug enable leak debug and internal error checking])
1201 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1202 [ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
1204 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1205 [ --enable-own-libc force use of internal functions instead of those of system libc])
1207 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1208 [ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1210 if test "$CONFIG_OPENSSL" != yes &&
1211 test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1212 test "$CONFIG_OWN_LIBC" = yes;
1214 AC_MSG_CHECKING(for built-in MD5 support)
1216 EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1219 AC_SUBST(CONFIG_MD5)
1221 if test "$CONFIG_BITTORRENT" = yes; then
1222 if test "$CONFIG_OPENSSL" != yes ||
1223 test "$CONFIG_OWN_LIBC" = yes;
1225 AC_MSG_CHECKING(for built-in SHA1 support)
1227 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1231 AC_SUBST(CONFIG_SHA1)
1233 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1235 EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1237 AC_SUBST(CONFIG_SCANNER)
1239 AC_ARG_ENABLE(weehoofooboomookerchoo,
1241 Also check out the features.conf file for more information about features!
1243 [AC_MSG_ERROR(Are you strange, or what?)])
1248 test "$CONFIG_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1249 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1252 dnl ===================================================================
1253 dnl Export directory paths
1254 dnl ===================================================================
1256 # Set up the ``entry points'' if they were not supplied by builder
1257 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1258 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1260 # Create CONFDIR #define for config.h
1262 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1263 # it's autoconf fault to force us to do such hacks ;p.
1264 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1265 # sysconfdir is set to its default value... fine, let's append /elinks/
1266 # XXX: We can't modify listing of the default in ./configure --help :-(
1267 sysconfdir_n=`eval echo "$sysconfdir"`
1268 sysconfdir=$sysconfdir_n
1269 (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1270 sysconfdir="$sysconfdir/elinks"
1274 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1277 # Create LOCALEDIR #define for config.h
1278 test -z "$localedir" && localedir="$datadir/locale"
1279 localedir0=`eval echo "$localedir"`
1280 LOCALEDIR=`eval echo "$localedir0"`
1281 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1284 # Create LIBDIR #define for config.h
1285 LIBDIR=`eval echo "$libdir"`
1286 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1289 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1290 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1292 dnl ===================================================================
1293 dnl A little fine tuning of gcc specific options (continued)
1294 dnl ===================================================================
1296 if test "x$ac_cv_prog_gcc" = "xyes"; then
1297 if test "$CONFIG_DEBUG" = "yes"; then
1298 dnl We want to see all warnings and live with none (in debug mode).
1299 CFLAGS="$CFLAGS -Werror"
1302 case "`$CC -dumpversion`" in
1304 # These should be ok using -Werror
1307 # If gcc is version 3.3 (or higher?) it emits lots of false positive
1308 # "dereferencing type-punned pointer will break strict-aliasing rules"
1309 # warnings. Disable them by not doing any strict-aliasing. The
1310 # alternative is just too ugly. Thanks gcc guys!! ;)
1311 CFLAGS="$CFLAGS -fno-strict-aliasing"
1314 # Do not show warnings related to (char * | unsigned char *) type
1316 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1319 # These should be ok using -Werror
1323 # GCC 4.2.1 warns if we use the address of an object in Boolean context:
1324 # warning: the address of `builtin_modules' will always evaluate as `true'
1325 # This hits the object_lock and foreach_module macros in particular.
1326 # It would be okay to put something in the macros to avoid the warning,
1327 # but currently this seems to require defining parallel macros that skip
1328 # the NULL check, and that's too ugly. So we instead disable the warning.
1329 # GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
1330 # GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
1331 for warning_flag in -Wno-address -Wno-always-true; do
1332 AC_MSG_CHECKING([whether $CC accepts $warning_flag])
1334 CFLAGS="$CFLAGS $warning_flag"
1335 AC_TRY_COMPILE([], [],
1336 [AC_MSG_RESULT([yes])
1338 [AC_MSG_RESULT([no])])
1342 # Bug 1012: Some parts of ELinks do arithmetic with signed integers
1343 # in such a way that an overflow is possible. GCC 4.2.1 warns
1344 # "warning: assuming signed overflow does not occur when assuming
1345 # that (X + c) > X is always true", which may be an incorrect
1346 # optimization (although allowed by the standard), and breaks the
1347 # build with -Werror.
1349 # All of the following tests included -S -Wall -Wextra:
1351 # GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
1352 # * gcc-4.0 -O0: OK, compares the values
1353 # * gcc-4.0 -O2: assumes no overflow, does not warn
1354 # * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
1355 # * gcc-4.0 -O0 -fwrapv: OK, compares the values
1356 # * gcc-4.0 -O2 -fwrapv: OK, compares the values
1357 # * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
1358 # * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
1359 # * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1360 # * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
1362 # GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
1363 # * gcc-4.1 -O0: assumes no overflow, does not warn
1364 # * gcc-4.1 -O2: assumes no overflow, does not warn
1365 # * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
1366 # * gcc-4.1 -O0 -fwrapv: OK, compares the values
1367 # * gcc-4.1 -O2 -fwrapv: OK, compares the values
1368 # * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
1369 # * gcc-4.1 -O2 -ftrapv: compares the values
1370 # * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1371 # * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
1373 # GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
1374 # * gcc-4.2 -O0: OK, compares the values
1375 # * gcc-4.2 -O2: assumes no overflow, warns about it
1376 # * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
1377 # * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
1378 # * gcc-4.2 -O0 -fwrapv: OK, compares the values
1379 # * gcc-4.2 -O2 -fwrapv: OK, compares the values
1380 # * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
1381 # * gcc-4.2 -O2 -ftrapv: compares the values
1382 # * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1383 # * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
1385 # Apparently, -ftrapv does not work reliably at all.
1386 for overflow_flag in -fno-strict-overflow -fwrapv; do
1387 AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
1389 CFLAGS="$CFLAGS $overflow_flag"
1390 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1391 [AC_MSG_RESULT([yes])
1393 [AC_MSG_RESULT([no])])
1398 # CFLAGS doesn't contain all compile flags. Some will be added only when
1399 # needed in the respective source directory. To get all compile flags
1400 # easily just add CPPFLAGS.
1401 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1403 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1404 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1406 dnl ===================================================================
1407 dnl Colored make output
1408 dnl ===================================================================
1410 if test $(`which tput` colors) -ge 4; then
1412 AC_SUBST(MAKE_COLOR)
1415 dnl ===================================================================
1417 dnl ===================================================================
1421 contrib/elinks.spec \
1422 contrib/lua/hooks.lua \
1423 contrib/conv/w3m2links.awk \
1424 doc/man/man1/elinks.1 \
1425 src/intl/gettext/ref-add.sed \
1426 src/intl/gettext/ref-del.sed
1429 abs_srcdir="$(cd "$srcdir" && pwd)"
1430 # builddir is always absolute!
1431 if test "$abs_srcdir" != "$builddir"; then
1432 # Bootstrap the Makefile creation
1433 echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1434 "$MAKE" "SRC=$abs_srcdir" init
1435 # Make cg-status ignore this build directory
1436 echo "*" > "$builddir/.gitignore"
1440 dnl ===================================================================
1441 dnl Configuration summary
1442 dnl ===================================================================
1444 AC_MSG_RESULT(The following feature summary has been saved to features.log)