1 dnl Process this file with autoconf to produce a configure script.
3 dnl There are two types of comments in this file.
4 dnl Comments that refer to Autoconf macros begin with "dnl", and m4
5 dnl discards them. Other comments begin with "#", and they get copied
6 dnl to the configure script, hopefully making it easier to read.
8 dnl Autoconf 2.13 generates an incomplete config.h.in; see ELinks bug 936.
9 dnl Autoconf 2.61 is installed in the computer that generates our nightly
10 dnl snapshots, so we need to be compatible with that. (Also, some files
11 dnl in Autoconf 2.62 and 2.63 sources are not GPLv2 compatible.)
14 AC_CONFIG_SRCDIR([src/main/main.c])
15 AC_CONFIG_AUX_DIR(config)
21 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
22 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
23 AC_CONFIG_HEADERS(config.h)
25 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
26 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
27 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
31 for make in gnumake gmake make false; do
32 if test "x$MAKE" = x; then
33 AC_PATH_PROGS(MAKE, "$make")
39 # Cleanup if we are configuring with a previous build in the tree
40 if test -e Makefile.config; then
41 AC_MSG_CHECKING([for previous build to clean])
42 "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
46 # ===================================================================
47 # Load feature configuration file and start logging features.
48 # ===================================================================
50 features="features.conf"
51 test -f "$srcdir/$features" && . "$srcdir/$features"
52 test -f "$builddir/$features" && . "$builddir/$features"
53 echo "Feature summary:" > features.log
55 # ===================================================================
56 # Checks for programs.
57 # ===================================================================
60 AC_CHECK_TOOL([LD], [ld])
62 AC_PATH_PROGS(AWK, "$AWK")
66 AC_PATH_PROGS(GIT, "git")
67 AC_PATH_PROGS(SPARSE, "sparse")
76 if test "x$CONFIG_DOC" != xno; then
77 AC_PATH_PROGS(PYTHON, "python")
78 if test "x$PYTHON" != "x"; then
79 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
80 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
81 EL_CONFIG(MAN_ASCIIDOC, [HTML])
84 AC_PATH_PROGS(XMLTO, "xmlto")
85 if test "x$XMLTO" != "x"; then
86 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
87 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
88 EL_CONFIG(MAN_XMLTO, [man (groff)])
91 AC_PATH_PROGS(JW, "jw")
92 if test "x$JW" != "x"; then
93 EL_CONFIG(CONFIG_JW, [JadeWrapper])
94 EL_CONFIG(MANUAL_JW, [PDF])
97 AC_PATH_PROGS(POD2HTML, "pod2html")
98 if test "x$POD2HTML" != "x"; then
99 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
102 AC_PATH_PROGS(DOXYGEN, "doxygen")
103 if test "x$DOXYGEN" != "x"; then
104 EL_CONFIG(CONFIG_DOXYGEN, [Doxygen])
105 api_srcdir="$(cd "$srcdir" && pwd)/src"
110 AC_SUBST(CONFIG_ASCIIDOC)
111 AC_SUBST(CONFIG_DOXYGEN)
112 AC_SUBST(CONFIG_POD2HTML)
113 AC_SUBST(CONFIG_XMLTO)
116 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
117 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
118 EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
119 EL_CONFIG_DEPENDS(CONFIG_APIDOCS, [CONFIG_DOXYGEN], [API Documentation])
121 # gcc specific options (to be continued at the bottom of configure)
122 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
123 # We want to see all warnings and live with none.
124 # We can't set up -Werror here as there may be some warnings in test
125 # suite of configure, and we don't want to fail them.
126 CFLAGS="$CFLAGS -Wall"
129 # ===================================================================
130 # Checks for special OSes.
131 # ===================================================================
133 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
134 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
136 AC_MSG_CHECKING([for $2])
139 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef $flag
141 #endif ]])],[$1=yes],[$1=no])
142 if test "[$]$1" = yes; then
143 EL_CONFIG([$1], [$2])
151 EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
152 AC_SUBST(CONFIG_OS_BEOS)
154 EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
155 AC_SUBST(CONFIG_OS_RISCOS)
157 EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
158 AC_SUBST(CONFIG_OS_WIN32)
160 EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
161 AC_SUBST(CONFIG_OS_OS2)
162 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
164 AC_MSG_CHECKING([for UNIX])
165 dnl FIXME: some depend kind of mechanism
166 if test "$CONFIG_OS_BEOS" = no && \
167 test "$CONFIG_OS_RISCOS" = no && \
168 test "$CONFIG_OS_WIN32" = no && \
169 test "$CONFIG_OS_OS2" = no; then
170 EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
174 AC_MSG_RESULT($CONFIG_OS_UNIX)
175 AC_SUBST(CONFIG_OS_UNIX)
177 # ===================================================================
178 # Checks for header files.
179 # ===================================================================
186 AC_CHECK_HEADERS(wchar.h wctype.h)
187 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
188 AC_CHECK_HEADERS(sigaction.h)
189 AC_CHECK_HEADERS(arpa/inet.h)
190 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
191 AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/in6_var.h)
192 AC_CHECK_HEADERS(ifaddrs.h)
193 AC_CHECK_HEADERS(sys/cygwin.h io.h)
194 AC_CHECK_HEADERS(sys/fmutex.h)
195 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
196 AC_CHECK_HEADERS(sys/resource.h)
197 AC_CHECK_HEADERS(sys/select.h)
198 AC_CHECK_HEADERS(sys/signal.h)
199 AC_CHECK_HEADERS(sys/socket.h)
200 AC_CHECK_HEADERS(sys/time.h)
201 AC_CHECK_HEADERS(sys/utsname.h)
202 AC_CHECK_HEADERS([net/if.h], [], [],
203 [[#ifdef HAVE_SYS_SOCKET_H
204 # include <sys/socket.h> /* <net/if.h> on Mac OS X 10.5.4 needs this */
207 AC_CHECK_HEADERS(stdint.h inttypes.h)
208 AC_CHECK_HEADERS(locale.h pwd.h)
209 AC_CHECK_HEADERS(termios.h)
212 AC_CHECK_HEADERS(sys/un.h,
213 [CONFIG_INTERLINK=yes
214 EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
215 [CONFIG_INTERLINK=no])
216 AC_SUBST(CONFIG_INTERLINK)
218 # ===================================================================
219 # Checks for typedefs, structures, and compiler characteristics.
220 # ===================================================================
225 AC_MSG_CHECKING([[for C99-conforming inline]])
226 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
246 [AC_MSG_RESULT([[yes]])
247 AC_DEFINE([NONSTATIC_INLINE], [inline],
248 [Define as inline if the compiler lets you declare a function without inline, then define it with inline, and have that definition refer to identifiers with internal linkage. This is allowed by C99 6.7.4p6 and 6.7.4p3 together. Otherwise define as nothing.])],
249 [AC_MSG_RESULT([[no]])
250 AC_DEFINE([NONSTATIC_INLINE], [])])
251 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
256 EL_CHECK_TYPE(ssize_t, int)
257 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
258 EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
259 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
260 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
261 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
263 AC_CHECK_SIZEOF(char, 1)
264 AC_CHECK_SIZEOF(short, 2)
265 AC_CHECK_SIZEOF(int, 4)
266 AC_CHECK_SIZEOF(long, 4)
267 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
268 test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
270 # Check for variadic macros
271 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
273 #define a(b,c...) printf(b,##c)],
274 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
276 # ===================================================================
277 # Checks for library functions.
278 # ===================================================================
280 AC_PROG_GCC_TRADITIONAL
284 AC_CHECK_FUNCS(atoll gethostbyaddr herror strerror)
285 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
286 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
287 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
288 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
289 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
290 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
291 AC_CHECK_FUNCS(gettimeofday clock_gettime)
292 AC_CHECK_FUNCS(setitimer, HAVE_SETITIMER=yes)
294 AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
296 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
297 AC_CHECK_FUNCS(unsetenv)
298 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
299 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
301 AC_CHECK_FUNCS(wcwidth, HAVE_WCWIDTH=yes)
305 # These aren't probably needed now, as they are commented in links.h.
306 # I've no idea about their historical background, but I keep them here
307 # just in the case they will help later. --pasky
308 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
309 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
310 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
311 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
313 AC_CHECK_FUNCS(fpathconf, HAVE_FPATHCONF=yes)
315 if test x"$HAVE_RAISE" = x; then
316 if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
317 AC_MSG_ERROR([Unable to emulate raise()])
321 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
322 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
323 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],[el_cv_HAVE_VA_COPY=yes],[el_cv_HAVE_VA_COPY=no])])
324 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
325 EL_DEFINE(HAVE_VA_COPY, __va_copy)
328 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
329 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
330 ]], [[int page_size = sysconf(_SC_PAGE_SIZE);]])],[el_cv_HAVE_SC_PAGE_SIZE=yes],[el_cv_HAVE_SC_PAGE_SIZE=no])])
331 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
332 EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
335 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
336 AC_RUN_IFELSE([AC_LANG_SOURCE([[
344 int bar(char *buf, const char *format, va_list ap)
346 return vsnprintf(buf, 0, format, ap);
349 void foo(const char *format, ...) {
353 va_start(ap, format);
354 len = bar(buf, format, ap);
356 if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
358 va_start(ap, format);
359 len = bar(buf, format, ap);
361 if ((len != 6) && (len != 7)) exit(1);
363 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
367 main() { foo("hello\n"); }
368 ]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
369 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
370 EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
373 # OpenSSL and Lua frequently need dlopen
374 AC_CHECK_LIB(dl, dlopen)
376 # ===================================================================
377 # Checks for libraries.
378 # ===================================================================
380 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
381 if test "$cf_result" = no; then
382 AC_CHECK_LIB(socket, socket)
385 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
386 if test "$cf_result" = no; then
387 AC_CHECK_LIB(socket, setsockopt)
390 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
391 if test "$cf_result" = no; then
392 AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
393 if test "$cf_result" = no; then
394 AC_CHECK_LIB(nsl, gethostbyname)
396 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
400 # ===================================================================
401 # Checks for packaging specific options.
402 # ===================================================================
404 AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
405 [ if test "$withval" != no && test "$withval" != yes; then
406 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
409 # ===================================================================
410 # Checks for a libraries, optional even if installed.
411 # ===================================================================
413 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
414 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
416 AC_MSG_CHECKING([for $2 support])
418 if test "[$]$1" != no; then
421 if test -n "$withval" && test -d "$withval"; then
422 # Be a little more careful when setting
423 # include and lib directories. This way
424 # $withval will work when includes are
425 # there but the library is in the common
426 # /usr/lib ... Does the right thing when
427 # looking for gc on Debian.
428 if test -d "$withval/include"; then
429 CFLAGS="$CFLAGS -I$withval/include"
430 CPPFLAGS="$CPPFLAGS -I$withval/include"
432 CFLAGS="$CFLAGS -I$withval"
433 CPPFLAGS="$CPPFLAGS -I$withval"
435 if test -d "$withval/lib"; then
436 LDFLAGS="$LDFLAGS -L$withval/lib"
440 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
441 if test "[$]$1" = yes; then
442 AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
445 if test "[$]$1" = yes; then
446 EL_CONFIG([$1], [$2])
449 if test -n "[$]WITHVAL_$1" &&
450 test "x[$]WITHVAL_$1" != xno; then
451 AC_MSG_ERROR([$2 not found])
456 AC_MSG_RESULT(disabled)
460 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
461 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
463 if test "x[$]$1" != xno; then $1=yes; fi
466 AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
467 if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
468 if test "x[$]WITHVAL_$1" = xyes; then $1=yes; fi
470 EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
472 EL_LOG_CONFIG([$1], [$2], [])
475 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
476 [ --without-gpm disable gpm (mouse) support])
478 # ELinks calls deflateInit2 with windowBits = MAX_WBITS | 32, to
479 # enable automatic decoding of both zlib and gzip headers. This
480 # feature was added in zlib 1.2.0.2; earlier versions return an error.
481 # The gzclearerr function was also added in zlib 1.2.0.2, so check for
482 # that, even though ELinks does not actually call gzclearerr.
483 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
484 [ --without-zlib disable zlib support])
486 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
487 [ --without-bzlib disable bzlib support])
489 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BROTLI, brotli, brotli/decode.h, brotlidec, BrotliDecoderDecompressStream,
490 [ --with-brotli enable experimental brotli support])
492 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
493 [ --without-idn disable international domain names support])
495 # LZMA disabled by default, because of little usability and compilation problems
497 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
498 [ --with-lzma enable lzma encoding support])
500 # ===================================================================
501 # Check for GSSAPI, optional even if installed.
502 # ===================================================================
506 AC_ARG_WITH(gssapi, [ --with-gssapi enable GSSAPI support],
507 [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
509 AC_MSG_CHECKING([for GSSAPI])
511 if test "$enable_gssapi" = "yes"; then
513 GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
514 GSSAPI_LIBS=`krb5-config --libs gssapi`
515 CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
516 LIBS="$GSSAPI_LIBS $LIBS"
517 EL_CONFIG(CONFIG_GSSAPI, [GssApi])
522 AC_SUBST(CONFIG_GSSAPI)
524 # ===================================================================
525 # Bookmark and XBEL support
526 # ===================================================================
530 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
531 [ --disable-bookmarks disable bookmark support])
533 # Check whether --enable-xbel or --disable-xbel was given.
534 if test "x${enable_xbel}" != xno; then
535 AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
537 if test "$HAVE_LIBEXPAT" = yes; then
538 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
539 if test "$HAVE_LIBEXPAT" = yes; then
546 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
548 [ --disable-xbel disable XBEL bookmark support (requires expat)])
550 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
554 # ===================================================================
555 # Checks for BSD sysmouse
556 # ===================================================================
558 HAVE_SYSMOUSE_HEADER="no"
560 # Either of these header files provides the (same) sysmouse interface
561 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
563 # ===================================================================
565 # ===================================================================
567 if test "$CONFIG_OS_OS2" = yes; then
571 # ===================================================================
573 # ===================================================================
575 if test "$CONFIG_OS_WIN32" = yes; then
579 # ===================================================================
580 # Check for SpiderMonkey, optional even if installed.
581 # ===================================================================
583 # This option sets the $with_spidermonkey variable.
584 AC_ARG_WITH([spidermonkey],
585 [AS_HELP_STRING([--without-spidermonkey],
586 [disable SpiderMonkey Mozilla JavaScript engine support])])
588 # CONFIG_SPIDERMONKEY is initially blank. We change it to "yes" or "no"
589 # when we know for sure whether we're going to use SpiderMonkey or not.
590 # (features.conf is not supposed to define it.)
594 case "$with_spidermonkey" in
596 # The user specified --without-spidermonkey.
597 # That overrides the other SpiderMonkey options.
598 AC_MSG_CHECKING([for SpiderMonkey])
599 AC_MSG_RESULT([disabled])
600 CONFIG_SPIDERMONKEY="no"
605 AC_MSG_WARN([This version of ELinks does not support --with-spidermonkey=DIRECTORY.])
609 # The SpiderMonkey 1.8.5 standalone sources install mozjs185.pc,
610 # but the Debian libmozjs-dev package installs mozilla-js.pc.
611 # Check mozjs185 first, because it has the version number in the name
612 # and therefore is less likely to be a newer incompatible version.
613 # (This configure script rejects older incompatible versions
614 # but can let newer ones through.)
615 for package in mozjs185 mozilla-js; do
616 if test -n "$CONFIG_SPIDERMONKEY"; then
619 AC_MSG_CHECKING([for SpiderMonkey (1.8.5 or later) in pkg-config $package])
620 # In pkg-config 0.25, pkg-config --exists mozjs185
621 # returns 0 (success) even if mozjs185 depends on
622 # nspr, which has not been installed. However,
623 # pkg-config --cflags mozjs185 returns 1 then.
624 if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then
625 SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)"
626 SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)"
627 LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
628 CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
629 CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
632 /* mozilla-js.pc may have -DXP_UNIX or similar in Cflags.
633 * Avoid warnings about conflicting definitions. */
634 #if !defined(XP_BEOS) && !defined(XP_OS2) && !defined(XP_UNIX) && !defined(XP_WIN)
639 # error <jsapi.h> did not define JS_VERSION
640 #elif JS_VERSION < 185
643 [CONFIG_SPIDERMONKEY=yes
644 AC_MSG_RESULT([yes])],
645 [# Leave CONFIG_SPIDERMONKEY blank, to continue the search.
646 AC_MSG_RESULT([found but unusable])])
653 if test -z "$CONFIG_SPIDERMONKEY"; then
654 # Didn't find SpiderMonkey anywhere.
655 CONFIG_SPIDERMONKEY=no
658 if test "$CONFIG_SPIDERMONKEY" = "yes"; then
659 # LIBS, CFLAGS, and CPPFLAGS still include the SpiderMonkey options.
660 AC_CHECK_FUNCS([JS_ReportAllocationOverflow])
661 AC_CHECK_FUNCS([JS_SetBranchCallback])
662 AC_CHECK_FUNCS([JS_TriggerOperationCallback], [HAVE_JS_TRIGGEROPERATIONCALLBACK=yes])
663 elif test -n "$with_spidermonkey" && test "x$with_spidermonkey" != "xno"; then
664 AC_MSG_WARN([SpiderMonkey was not found even though you specified --with-spidermonkey.])
668 if test "x$CONFIG_SPIDERMONKEY" = xyes; then
669 EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
671 CONFIG_ECMASCRIPT_SMJS=no
674 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
675 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
677 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes &&
678 test "x$HAVE_JS_TRIGGEROPERATIONCALLBACK" = xyes &&
679 test "x$HAVE_SETITIMER" = xyes; then
680 EL_CONFIG(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT, [ECMAScript heartbeat support])
682 CONFIG_ECMASCRIPT_SMJS_HEARTBEAT=no
684 AC_SUBST(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT)
687 # ===================================================================
688 # Optional Spidermonkey-based ECMAScript browser scripting
689 # ===================================================================
691 AC_ARG_ENABLE(sm-scripting,
692 [ --disable-sm-scripting ECMAScript browser scripting (requires Spidermonkey)],
693 [if test "$enableval" != no; then enableval="yes"; fi
694 CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
696 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
697 test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
698 EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
700 CONFIG_SCRIPTING_SPIDERMONKEY=no
703 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
704 test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
705 LIBS="$LIBS $SPIDERMONKEY_LIBS"
706 AC_SUBST(SPIDERMONKEY_LIBS)
707 AC_SUBST(SPIDERMONKEY_CFLAGS)
708 AC_SUBST(CONFIG_SPIDERMONKEY)
711 # ===================================================================
712 # Check for Guile, optional even if installed.
713 # ===================================================================
717 AC_ARG_WITH(guile, [ --with-guile enable Guile support],
718 [ if test "x$withval" != xno; then enable_guile=yes; fi ])
720 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
721 # GUILE_FLAGS but I really don't want to require people to have Guile in order
722 # to compile CVS. Also, the macro seems to be really stupid regarding searching
723 # for Guile in $PATH etc. --pasky
725 AC_MSG_CHECKING([for Guile])
727 if test "$enable_guile" = "yes"; then
729 ## Based on the GUILE_FLAGS macro.
731 if test -d "$withval"; then
732 GUILE_PATH="$withval:$PATH"
737 AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
739 ## First, let's just see if we can find Guile at all.
740 if test "$GUILE_CONFIG" != no; then
743 GUILE_LIBS="`guile-config link`"
744 GUILE_CFLAGS="`guile-config compile`"
745 LIBS="$GUILE_LIBS $LIBS"
746 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
747 AC_SUBST(GUILE_CFLAGS)
749 ***********************************************************************
750 The Guile support is incomplete and not so well integrated to ELinks
751 yet. That means, e.g., that you have no Guile console and there might
752 not be all the necessary hooks. Also, the Guile interface is not too
753 well tested (success stories heartily welcomed!). See
754 src/scripting/guile/README for further details and hints.
755 ***********************************************************************
758 if test -n "$withval" && test "x$withval" != xno; then
759 AC_MSG_ERROR([Guile not found])
761 AC_MSG_WARN([Guile support disabled])
768 # ===================================================================
770 # ===================================================================
773 AC_ARG_WITH(perl, [ --with-perl enable Perl support],
775 if test "$withval" = yes; then
776 # FIXME: If withval is a valid directory append it to PATH
777 # so that you can specify one of several perl installations.
783 AC_MSG_CHECKING([for Perl])
789 if test "$enable_perl" = "yes"; then
790 PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
791 PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
792 LIBS="$PERL_LIBS $LIBS"
793 CFLAGS="$PERL_CFLAGS $CFLAGS"
794 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
795 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
799 ]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
802 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
804 AC_MSG_CHECKING([whether POPpx works without an n_a variable])
805 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
808 extern PerlInterpreter *my_perl;
809 ]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
810 AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
811 [Define if using Perl 5.8.8 or later, where the "POPpx" macro
812 no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
814 if test "$cf_result" != "yes"; then
817 EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
820 CPPFLAGS="$CPPFLAGS_X"
822 AC_SUBST(PERL_CFLAGS)
825 # ===================================================================
827 # ===================================================================
830 AC_ARG_WITH(python, [[ --with-python[=DIR] enable Python support]],
831 [ if test "x$withval" != xno; then enable_python=yes; fi ])
836 AC_MSG_CHECKING([for Python])
838 if test "$enable_python" = "yes"; then
841 if test -d "$withval"; then
842 PYTHON_PATH="$withval:$PATH"
847 AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
849 if test "$PYTHON" != no; then
852 PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; print "-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True))'`"
853 PYTHON_LIBS="`$PYTHON -c 'from distutils import sysconfig; var = sysconfig.get_config_var; print "%s %s %s -L%s -lpython%s" % (var("LINKFORSHARED"), var("LIBS"), var("SYSLIBS"), var("LIBPL"), var("VERSION"))'`"
854 LIBS="$PYTHON_LIBS $LIBS"
855 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
856 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
858 if test "$cf_result" != "yes"; then
861 EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
862 AC_SUBST(PYTHON_LIBS)
863 AC_SUBST(PYTHON_CFLAGS)
864 CPPFLAGS="$CPPFLAGS_X"
866 ***********************************************************************
867 The Python support is incomplete and not so well integrated to ELinks
868 yet. That means, e.g., that you have no Python console and there might
869 not be all the necessary hooks. Also, the Python interface is not too
870 well tested (success stories heartily welcomed!).
871 ***********************************************************************
875 if test -n "$withval" && test "x$withval" != xno; then
876 AC_MSG_ERROR([Python not found])
878 AC_MSG_WARN([Python support disabled])
886 # ===================================================================
887 # Check for Lua, optional even if installed.
888 # ===================================================================
890 # Do this the long way, as FreeBSD reportedly needs -L<dir> for
891 # anything other than /usr/lib, and Lua is very often in /usr/local/lib.
893 AC_ARG_WITH(lua, [ --without-lua disable Lua support],
894 [if test "$withval" = no; then disable_lua=yes; fi])
895 AC_MSG_CHECKING([for Lua])
900 if test -z "$disable_lua"; then
901 if test ! -d "$withval"; then
904 for luadir in "$withval" "" /usr /usr/local; do
905 for suffix in "" 5.1 51; do
906 if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
907 test -f "$luadir/include/lua$suffix/lua.h" ) ; then
908 LUA_LIBS="-L$luadir/lib -llua$suffix -lm"
909 LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
911 LIBS="$LUA_LIBS $LIBS_X"
912 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
913 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
915 # Check that it is a compatible Lua version
916 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lauxlib.h>]
919 ], [[ lua_State *L = luaL_newstate();
921 lua_pushboolean(L, 1);
922 lua_close(L);]])],[cf_result=yes],[cf_result=no])
928 AC_MSG_RESULT($cf_result)
930 if test "$cf_result" != yes; then
933 EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
934 AC_CHECK_HEADERS(lauxlib.h)
937 CPPFLAGS="$CPPFLAGS_X"
942 # ===================================================================
943 # Check for TRE library
944 # ===================================================================
946 # This section only checks that --without-tre is not given and the
947 # library seems to work, and sets TRE_CFLAGS, TRE_LIBS, and
948 # tre_log. It does not define CONFIG_TRE, and always resets
949 # LIBS and CFLAGS back to their original values.
951 # After any --enable-utf-8 and --disable-utf-8 options have been
952 # handled, a separate section decides whether to actually use TRE.
954 # tre version 0.8.0 or higher is required which have the "tre_" prefix
957 AC_ARG_WITH([[tre]], [[ --without-tre disable TRE regex search support]])
958 if test "$with_tre" = no; then
959 AC_MSG_CHECKING([[for TRE]])
960 AC_MSG_RESULT([[disabled]])
961 tre_log="no (explicitly disabled)"
963 AC_MSG_CHECKING([[for TRE in pkg-config]])
964 if $PKG_CONFIG tre; then
965 TRE_CFLAGS=`$PKG_CONFIG --cflags tre`
966 TRE_LIBS=`$PKG_CONFIG --libs tre`
967 AC_MSG_RESULT([[yes]])
969 # <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513055>
970 # "libtre-dev: /usr/lib/pkgconfig/tre.pc missing"
971 # so we look for the library even if pkg-config doesn't know about it.
974 AC_MSG_RESULT([[no, but let's try defaults]])
977 AC_MSG_CHECKING([[for TRE header and library]])
979 CFLAGS="$TRE_CFLAGS $CFLAGS"
980 LIBS="$TRE_LIBS $LIBS" # must be first, because of regfree conflict
981 AC_TRY_LINK([#include <tre/tre.h>],
984 tre_regwcomp(&re, L"zap", REG_ICASE);
985 tre_regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
986 [AC_MSG_RESULT([[yes]])
987 tre_log="available"],
988 [AC_MSG_RESULT([[no]])
989 tre_log="no (TRE not found)"])
993 # ===================================================================
994 # Check for Ruby, optional even if installed.
995 # ===================================================================
997 EL_CONFIG_SCRIPTING_RUBY
999 # ===================================================================
1000 # Setup global scripting
1001 # ===================================================================
1003 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_SCRIPTING_GUILE CONFIG_SCRIPTING_LUA CONFIG_SCRIPTING_PERL CONFIG_SCRIPTING_PYTHON CONFIG_SCRIPTING_RUBY CONFIG_SCRIPTING_SPIDERMONKEY], [Browser scripting])
1004 AC_SUBST(CONFIG_SCRIPTING_GUILE)
1005 AC_SUBST(CONFIG_SCRIPTING_LUA)
1006 AC_SUBST(CONFIG_SCRIPTING_PERL)
1007 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
1008 AC_SUBST(CONFIG_SCRIPTING_RUBY)
1009 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
1010 AC_SUBST(CONFIG_SCRIPTING)
1013 # ===================================================================
1014 # Check for SSL support.
1015 # ===================================================================
1017 # We by default use OpenSSL, and we always prefer it. However, when GNUTLS
1018 # is enabled, we won't try to use OpenSSL anymore.
1020 # For wiping SSL hooks..
1023 chosen_ssl_library=""
1025 AC_ARG_WITH(gnutls, [[ --without-gnutls disable GNUTLS SSL support]])
1026 AC_ARG_WITH(gnutls, [[ --with-gnutls enable GNUTLS SSL support]],
1027 [case "$with_gnutls" in
1029 "yes") chosen_ssl_library="GNUTLS" ;;
1030 *) chosen_ssl_library="GNUTLS"
1031 AC_MSG_WARN([[Support for --with-gnutls=DIR has been removed.
1032 You may have to set the PKG_CONFIG_PATH environment variable instead.]]) ;;
1035 AC_ARG_WITH(openssl, [[ --without-openssl disable OpenSSL support]])
1036 AC_ARG_WITH(openssl, [[ --with-openssl[=DIR] enable OpenSSL support (default)]],
1037 [case "$with_openssl" in
1039 *) chosen_ssl_library="OpenSSL" ;;
1042 AC_ARG_WITH(nss_compat_ossl, [[ --with-nss_compat_ossl[=DIR]
1043 NSS compatibility SSL libraries/include files]],
1044 [case "$with_nss_compat_ossl" in
1046 *) chosen_ssl_library="nss_compat_ossl" ;;
1049 # ---- nss_compat_ossl
1051 if test "$with_nss_compat_ossl" = no; then
1052 # explicitly disabled
1054 elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "nss_compat_ossl"; then
1055 # not used, because $chosen_ssl_library was chosen
1057 elif test -z "${with_nss_compat_ossl+set}"; then
1058 # SSL_library_init() in nss_compat_ossl 0.9.2 calls exit(1)
1059 # with no error message if there is no certificate database.
1060 # https://bugzilla.redhat.com/show_bug.cgi?id=463437
1061 # So ELinks uses nss_compat_ossl only if explicitly requested.
1065 if test "$with_nss_compat_ossl" = yes; then
1066 if $PKG_CONFIG nss; then
1067 CFLAGS="$CFLAGS_X `$PKG_CONFIG --cflags nss`"
1068 LIBS="$LIBS_X `$PKG_CONFIG --libs nss`"
1070 with_nss_compat_ossl=no
1073 # Without pkg-config, we'll kludge in some defaults
1074 CFLAGS="$CFLAGS_X -I$with_nss_compat_ossl/include -I/usr/include/nss3 -I/usr/include/nspr4"
1075 LIBS="$LIBS_X -L$with_nss_compat_ossl/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
1077 AC_CHECK_HEADERS(nss_compat_ossl/nss_compat_ossl.h,, [with_nss_compat_ossl=no], [#define NSS_COMPAT_OSSL_H])
1078 AC_CHECK_LIB(nss_compat_ossl, X509_free,, [with_nss_compat_ossl=no])
1080 if test "$with_nss_compat_ossl" = "no"; then
1083 LIBS="$LIBS -lnss_compat_ossl"
1084 EL_CONFIG(CONFIG_NSS_COMPAT_OSSL, [nss_compat_ossl])
1085 chosen_ssl_library="nss_compat_ossl"
1091 AC_MSG_CHECKING([for OpenSSL])
1095 if test "$with_openssl" = no; then
1096 cf_result="explicitly disabled"
1098 elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "OpenSSL"; then
1099 cf_result="not used, because $chosen_ssl_library was chosen"
1103 for ssldir in "$with_openssl" "" /usr /usr/local/openssl \
1104 /usr/lib/openssl /usr/local/ssl \
1105 /usr/local/www /usr/lib/ssl /usr/local \
1106 /usr/pkg /opt /opt/openssl; do
1107 if test "$cf_result" = no; then
1108 if test -d "$ssldir"; then
1109 OPENSSL_CFLAGS="-I$ssldir/include"
1110 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
1111 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
1112 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
1113 # # FIXME: This created serious portability problems. --pasky
1114 # if test "$CC" == "gcc"; then
1115 # # I'm not sure about compatibility here. --pasky
1116 # LIBS="$LIBS -R$ssldir/lib"
1119 LIBS="-lssl -lcrypto $LIBS_X"
1121 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[OpenSSL_add_all_algorithms()]])],[cf_result=yes],[cf_result=no])
1122 if test "$cf_result" != yes; then
1123 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[SSLeay_add_ssl_algorithms()]])],[cf_result=yes],[cf_result=no])
1128 if test "$cf_result" != yes; then
1129 if test "${with_openssl-no}" != "no"; then
1130 AC_MSG_ERROR([OpenSSL not found])
1134 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
1135 chosen_ssl_library="OpenSSL"
1138 AC_SUBST(OPENSSL_CFLAGS)
1142 AC_MSG_RESULT($cf_result)
1146 # GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
1147 # to GPLv3+. Don't link that with the GPLv2 ELinks.
1148 # ELinks will use its internal MD5 code instead.
1149 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1151 if test "$with_gnutls" = no; then
1152 AC_MSG_CHECKING([[for GNUTLS]])
1153 AC_MSG_RESULT([[explicitly disabled]])
1155 elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "GNUTLS"; then
1156 AC_MSG_CHECKING([[for GNUTLS]])
1157 AC_MSG_RESULT([[not used, because $chosen_ssl_library was chosen]])
1161 AC_MSG_CHECKING([[for GNUTLS (1.2 or later) in pkg-config]])
1162 if $PKG_CONFIG --atleast-version=1.2 gnutls; then
1163 GNUTLS_CFLAGS=`$PKG_CONFIG --cflags gnutls`
1164 GNUTLS_LIBS=`$PKG_CONFIG --libs gnutls`
1165 AC_MSG_RESULT([[yes: $GNUTLS_CFLAGS $GNUTLS_LIBS]])
1168 LIBS="$GNUTLS_LIBS $LIBS"
1169 CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
1170 CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
1172 # Verify if it's really usable. gnutls_session was
1173 # renamed to gnutls_session_t before GNU TLS 1.2.0
1174 # (on 2004-06-13); ELinks now requires this.
1175 AC_MSG_CHECKING([[whether GNUTLS can be linked with]])
1176 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]],
1177 [[gnutls_session_t dummy;
1178 gnutls_check_version(NULL)]])],
1181 AC_MSG_RESULT([[$cf_result]])
1183 if test "$cf_result" = yes; then
1184 # According to gnutls/NEWS, the function was originally
1185 # added as gnutls_set_default_priority2 in GNUTLS 2.1.4
1186 # (released 2007-10-27) and then renamed to
1187 # gnutls_priority_set_direct in GNUTLS 2.1.7 (released
1189 AC_CHECK_FUNCS([gnutls_priority_set_direct])
1194 AC_MSG_RESULT([[$cf_result]])
1197 if test "$cf_result" = yes; then
1198 EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1199 chosen_ssl_library="GNUTLS"
1201 # gcry_create_nounce is part of libgcrypt
1202 LIBGCRYPT_CFLAGS=`libgcrypt-config --cflags`
1203 LIBGCRYPT_LIBS=`libgcrypt-config --libs`
1205 LIBS="$LIBGCRYPT_LIBS $GNUTLS_LIBS $LIBS"
1206 AC_SUBST(LIBGCRYPT_CFLAGS)
1207 AC_SUBST(GNUTLS_CFLAGS)
1209 elif test "${with_gnutls-no}" != "no"; then
1210 AC_MSG_ERROR([[GNUTLS (1.2 or later) not found. ELinks no longer supports GNUTLS 1.1.]])
1216 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS CONFIG_NSS_COMPAT_OSSL], [SSL])
1217 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1218 AC_SUBST(CONFIG_OPENSSL)
1219 AC_SUBST(CONFIG_GNUTLS)
1220 AC_SUBST(CONFIG_NSS_COMPAT_OSSL)
1224 AC_MSG_CHECKING([whether to be or not to be])
1225 AC_MSG_RESULT([needs to be determined experimentally])
1227 # ===================================================================
1228 # Check for IPv6 support and related functions.
1229 # ===================================================================
1231 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1232 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1233 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1235 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1236 if test "$HAVE_GETADDRINFO" != yes; then
1237 AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1238 if test "$HAVE_GETADDRINFO" = yes; then
1239 LIBS="$LIBS -linet6"
1244 # ===================================================================
1245 # Checking for X11 (window title restoring).
1246 # ===================================================================
1249 if test x"$no_x" != xyes; then
1251 if test -n "$x_includes"; then
1252 X_CFLAGS="-I$x_includes"
1253 CPPFLAGS="$CPPLAGS $X_CFLAGS"
1254 CFLAGS="$CFLAGS $X_CFLAGS"
1256 if test -n "$x_libraries"; then
1257 LDFLAGS="$LDFLAGS -L$x_libraries"
1260 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize()]])],[cf_result=yes],[cf_result=no])
1262 if test "$cf_result" = yes; then
1263 if test -n "$x_libraries"; then
1264 LDFLAGS="$LDFLAGS -L$x_libraries"
1267 EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1273 # ===================================================================
1274 # Backtraces displaying support.
1275 # ===================================================================
1277 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1278 # possible checks for other system-specific means go here
1281 # ===================================================================
1282 # Gettext grey zone. Beware.
1283 # ===================================================================
1285 ALL_LINGUAS="af 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"
1289 # iconv is always used
1290 LIBS="$LIBS $LIBICONV"
1292 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1293 dnl # f33r d4 l33t... I hope it's portable. :)
1294 dnl cf_result=$((48#z - 48#a + 1));
1295 dnl AC_MSG_RESULT($cf_result)
1298 # ===================================================================
1299 # Compile-time features control
1300 # ===================================================================
1302 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1303 [ --disable-cookies disable cookie support])
1305 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1306 [ --disable-formhist disable form history support])
1308 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1309 [ --disable-globhist disable global history support])
1312 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1313 [ --disable-mailcap disable mailcap support])
1315 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1316 [ --disable-mimetypes disable mimetypes files support])
1319 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1320 [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1322 [ --disable-ipv6 disable IPv6 support])
1324 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1325 [ --enable-bittorrent enable BitTorrent protocol support])
1327 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1328 [ --disable-data disable data protocol support])
1330 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1331 [ --disable-uri-rewrite disable URI rewrite support])
1333 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1334 [ --enable-cgi enable local CGI support])
1336 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1337 [ --enable-finger enable finger protocol support])
1339 # ===================================================================
1341 # ===================================================================
1344 if test "x${enable_fsp}" != xno; then
1345 AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1347 if test "$HAVE_FSPLIB" = yes; then
1348 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1349 if test "$HAVE_FSPLIB" = yes; then
1350 LIBS="$LIBS -lfsplib"
1352 AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1353 if test "$HAVE_FSPLIB" = yes; then
1360 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1361 [ --enable-fsp enable FSP protocol support])
1363 if test "x$CONFIG_FSP" = xno; then
1367 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1368 [ --disable-ftp disable ftp protocol support])
1370 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1371 [ --enable-gopher enable gopher protocol support])
1373 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1374 [ --enable-nntp enable nntp protocol support])
1376 # ===================================================================
1377 # SMB protocol support.
1378 # ===================================================================
1381 if test "x${enable_smb}" != xno; then
1382 AC_CHECK_HEADERS(libsmbclient.h, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1384 if test "$HAVE_SMBCLIENT" = yes; then
1385 AC_CHECK_LIB(smbclient, smbc_init, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
1386 if test "$HAVE_SMBCLIENT" = yes; then
1387 LIBS="$LIBS -lsmbclient"
1392 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [Samba protocol],
1393 [ --enable-smb enable Samba protocol support])
1395 if test "x$CONFIG_SMB" = xno; then
1400 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1401 [ --disable-mouse disable mouse support])
1403 # GPM mouse is Linux specific, so ...
1405 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1406 [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1408 [ --disable-sysmouse disable BSD sysmouse support])
1410 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1411 [ --enable-88-colors enable 88 color support])
1413 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1414 [ --enable-256-colors enable 256 color support])
1416 EL_ARG_ENABLE(CONFIG_TRUE_COLOR, true-color, [true color],
1417 [ --enable-true-color enable true color support])
1419 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1420 [ --enable-exmode enable exmode (CLI) interface])
1422 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1423 [ --disable-leds disable LEDs support])
1425 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1426 [ --disable-marks disable document marks support])
1429 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1430 [ --disable-css disable Cascading Style Sheet support])
1432 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1433 [ --enable-html-highlight HTML highlighting using DOM engine])
1435 # Everything in the tree already uses CONFIG_DOM
1436 # so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1437 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1439 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1440 [ --disable-backtrace disable backtrace support])
1442 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1443 [ --enable-no-root enable prevention of usage by root])
1446 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1447 [ --enable-debug enable leak debug and internal error checking])
1449 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1450 [ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
1452 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1453 [ --enable-own-libc force use of internal functions instead of those of system libc])
1455 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1456 [ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1458 EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
1459 [ --disable-utf-8 disable UTF-8 support])
1461 EL_ARG_DEPEND(CONFIG_COMBINE, combining, [CONFIG_UTF8:yes HAVE_WCWIDTH:yes], [Combining characters],
1462 [ --enable-combining support Unicode combining characters (experimental)])
1465 AC_ARG_ENABLE(weehoofooboomookerchoo,
1467 Also check out the features.conf file for more information about features!
1469 [AC_MSG_ERROR(Are you strange, or what?)])
1472 # ===================================================================
1473 # Decide whether to use TRE
1474 # ===================================================================
1476 # This must be done after the CONFIG_UTF8 check above.
1477 # The first part of the TRE check is separate, to get
1478 # the configure --help output in a sensible order.
1480 # After this section, nothing else must be added to the
1481 # beginning of $LIBS.
1483 if test "$tre_log" = "available"; then
1484 if test "$CONFIG_UTF8" = "yes"; then
1485 # When CONFIG_UTF8 and CONFIG_TRE are both defined,
1486 # src/viewer/text/search.c makes a string of
1487 # unicode_val_T and gives it to regwexec(), which
1488 # expects a string of wchar_t. If the unicode_val_T
1489 # and wchar_t types are too different, this won't
1490 # work, so try to detect that and disable regexp
1491 # operations entirely in that case.
1493 # Currently, this code only compares the sizes of the
1494 # types. src/intl/charsets.h defines unicode_val_T as
1495 # uint32_t, so we check whether wchar_t has exactly 32
1496 # bits. But don't use AC_CHECK_SIZEOF for this, because
1497 # there doesn't seem to be a documented way to get the
1498 # result of that for use in the configure script.
1500 # C99 says the implementation can define
1501 # __STDC_ISO_10646__ if wchar_t values match ISO 10646
1502 # (or Unicode) numbers in all locales. Do not check
1503 # that macro here, because it is too restrictive: it
1504 # should be enough for ELinks if the values match in
1505 # the locales where ELinks is actually run.
1506 AC_MSG_CHECKING([[whether wchar_t is exactly 32-bit]])
1507 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1510 int dummy[(sizeof(wchar_t) * CHAR_BIT == 32) ? 1 : -1];]], [])],
1511 [AC_MSG_RESULT([[yes]])
1513 [AC_MSG_RESULT([[no]])
1514 tre_log="no (unsuitable wchar_t)"])
1516 # If UTF-8 is not used, then wchar_t doesn't matter.
1521 if test "$tre_log" = "TRE"; then
1522 AC_DEFINE([CONFIG_TRE], [1],
1523 [Define as 1 to use the TRE library for regular expression searching. This requires the <tre/regex.h> header file. If you define CONFIG_UTF8 too, then wchar_t must be exactly 32-bit so that it matches unicode_val_T.])
1524 # TRE_CFLAGS will be used only where needed.
1526 # Bug 1081: If both TRE and libc define the regfree function,
1527 # ELinks needs to use the version defined by TRE because
1528 # that's the one compatible with regex_t initialized by the
1529 # regwcomp function of TRE. Therefore put $TRE_LIBS at the
1530 # very beginning of $LIBS so that the linker hopefully finds
1531 # regfree there before it examines libc. In particular,
1532 # $PERL_LIBS appears to often include "-lc".
1534 # This scheme still risks a crash if ELinks is linked with
1535 # some static library that uses GNU <regex.h> extensions that
1536 # TRE does not implement. For example, the library might call
1537 # re_compile_pattern, which is found in GNU libc, and then
1538 # regfree, which is found in TRE and probably crashes with the
1539 # GNU-initialized regex_t. Ways to avoid such crashes:
1541 # - Change TRE so it defines only tre_... functions and does
1542 # not attempt to override the POSIX names by default.
1544 # - Change ELinks to access TRE only via dlopen and dlsym.
1545 # The problem then is how to find the correct file name.
1546 # There might be libtre.so.4 and libtre.so.5 with different
1547 # ABI. How can this configure script detect which of them
1548 # matches the <tre/regex.h> in the include path?
1550 # - Replace the static library with a shared library. At
1551 # least on GNU/Linux, when the shared library is built, the
1552 # linker should note that e.g. regfree is defined in libc
1553 # and has the GLIBC_2.0 version there, and write that
1554 # version string to the shared library as well; because TRE
1555 # does not provide regfree with that version, any regfree
1556 # calls at run time should then get resolved to libc.
1557 LIBS="$TRE_LIBS $LIBS"
1562 AC_SUBST(TRE_CFLAGS)
1564 EL_LOG_CONFIG([CONFIG_TRE], [[Regexp searching]], [[$tre_log]])
1566 # ===================================================================
1568 # ===================================================================
1575 AC_ARG_WITH(libdom, [ --with-libdom enable libdom],
1576 [ if test "x$withval" != xno; then enable_libdom=yes; fi ])
1578 if test "$enable_libdom" = no; then
1579 AC_MSG_CHECKING([[for libdom]])
1580 AC_MSG_RESULT([[disabled]])
1582 AC_MSG_CHECKING([[for libdom in pkg-config]])
1583 if $PKG_CONFIG libdom; then
1584 LIBDOM_CFLAGS=`$PKG_CONFIG --cflags libdom`
1585 LIBDOM_LIBS=`$PKG_CONFIG --libs libdom`
1586 LIBS="$LIBDOM_LIBS $LIBS"
1588 AC_DEFINE([CONFIG_LIBDOM], [1], [Define as 1 to use the libdom library.])
1589 AC_MSG_RESULT([[yes]])
1594 AC_SUBST(LIBDOM_CFLAGS)
1595 AC_SUBST(LIBDOM_LIBS)
1596 EL_LOG_CONFIG([CONFIG_LIBDOM], [[libdom]], [[$enable_libdom]])
1598 # ===================================================================
1599 # Further LDFLAGS tweaks
1600 # ===================================================================
1604 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1605 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1608 # Check for -rdynamic
1610 # gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
1611 # the executable to its dynamic symbol table. ELinks uses this for
1614 # 1. If ELinks detects a bug, it can try to display a backtrace by
1615 # calling backtrace_symbols_fd() in the GNU libc. The glibc-2.3.6
1616 # manual states users of GNU ld must pass -rdynamic to make the
1617 # symbols available to the program.
1619 # 2. It would eventually be nice to dynamically load shared
1620 # libraries as plugins (bug 73). The plugins must be able to
1621 # call ELinks functions. This can be implemented either by
1622 # registering all callable functions in ELinks-specific data
1623 # structures, or by letting the dynamic linker handle them.
1624 # The latter way requires something equivalent to -rdynamic.
1626 # Because backtraces are not needed for correct operation, and bug
1627 # 73 is not yet being fixed, the configure script and makefiles
1628 # should not complain to the user if they find that -rdynamic does
1629 # not work. Besides, it was reported at elinks-users on 2006-09-12
1630 # that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
1631 # Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
1632 # -rdynamic but does something equivalent automatically. (This was
1633 # tested with "nm -D elinks | grep redraw_from_window".)
1635 # With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
1636 # -dynamic"; then, cc proceeds anyway, but the option can prevent the
1637 # linker from finding the libraries listed in -l operands. So this
1638 # -rdynamic check needs to happen after the libraries have already
1639 # been added to $LDFLAGS.
1640 AC_MSG_CHECKING([for -rdynamic])
1641 LDFLAGS_X="$LDFLAGS"
1642 LDFLAGS="-rdynamic $LDFLAGS"
1643 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
1644 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
1645 AC_MSG_RESULT($have_rdynamic)
1647 # ===================================================================
1648 # Export directory paths
1649 # ===================================================================
1651 # Set up the ``entry points'' if they were not supplied by builder
1652 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1653 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1655 # Create CONFDIR #define for config.h
1657 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1658 # it's autoconf fault to force us to do such hacks ;p.
1659 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1660 # sysconfdir is set to its default value... fine, let's append /elinks/
1661 # XXX: We can't modify listing of the default in ./configure --help :-(
1662 sysconfdir_n=`eval echo "$sysconfdir"`
1663 sysconfdir=$sysconfdir_n
1664 (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1665 sysconfdir="$sysconfdir/elinks"
1669 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1672 # Create LOCALEDIR #define for config.h
1673 LOCALEDIR=`eval echo "$datadir/locale"`
1674 while echo "$LOCALEDIR" | grep "\\$"
1676 LOCALEDIR=`eval echo "$LOCALEDIR"`
1677 done > /dev/null 2> /dev/null
1678 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1681 # Create LIBDIR #define for config.h
1682 LIBDIR=`eval echo "$libdir"`
1683 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1686 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1687 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1690 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
1691 ]], [[#if !defined(__TINYC__) || !defined(alloca)
1693 #endif ]])],[cf_result=yes],[cf_result=no])
1695 if test "$cf_result" = "yes"; then
1696 AC_DEFINE([HAVE_ALLOCA])
1697 AC_DEFINE([_ALLOCA_H], [1], [Define as 1 if you are using Tiny C Compiler
1698 with the GNU C Library, and <alloca.h> of glibc would otherwise
1699 override the alloca macro defined in <stddef.h> of TCC.
1700 If <alloca.h> of glibc sees the _ALLOCA_H macro, it assumes
1701 it has already been included, and does not redefine alloca.
1702 This might not work in future glibc versions though, because
1703 the names of the #include guard macros are not documented.
1704 The incompatibility has been reported to the tinycc-devel
1705 mailing list on 2008-07-14. If a future version of TCC provides
1706 an <alloca.h> of its own, this hack won't be needed.])
1708 # ===================================================================
1709 # A little fine tuning of gcc specific options (continued)
1710 # ===================================================================
1713 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
1714 if test "$CONFIG_DEBUG" = "yes"; then
1715 # We want to see all warnings and live with none (in debug mode).
1716 CFLAGS="$CFLAGS -Werror"
1718 GETTEXT_CFLAGS="-Wno-uninitialized"
1720 case "`$CC -dumpversion`" in
1722 # These should be ok using -Werror
1725 # If gcc is version 3.3 (or higher?) it emits lots of false positive
1726 # "dereferencing type-punned pointer will break strict-aliasing rules"
1727 # warnings. Disable them by not doing any strict-aliasing. The
1728 # alternative is just too ugly. Thanks gcc guys!! ;)
1729 CFLAGS="$CFLAGS -fno-strict-aliasing"
1732 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign -Wno-enum-compare"
1735 # Do not show warnings related to (char * | unsigned char *) type
1737 CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1740 # These should be ok using -Werror
1744 # GCC 4.2.1 warns if we use the address of an object in Boolean context:
1745 # warning: the address of `builtin_modules' will always evaluate as `true'
1746 # This hits the object_lock and foreach_module macros in particular.
1747 # It would be okay to put something in the macros to avoid the warning,
1748 # but currently this seems to require defining parallel macros that skip
1749 # the NULL check, and that's too ugly. So we instead disable the warning.
1750 # GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
1751 # GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
1752 for warning_flag in -Wno-address -Wno-always-true; do
1753 AC_MSG_CHECKING([whether $CC accepts $warning_flag])
1755 CFLAGS="$CFLAGS $warning_flag"
1756 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1757 [AC_MSG_RESULT([yes])
1759 [AC_MSG_RESULT([no])])
1763 # Bug 1012: Some parts of ELinks do arithmetic with signed integers
1764 # in such a way that an overflow is possible. GCC 4.2.1 warns
1765 # "warning: assuming signed overflow does not occur when assuming
1766 # that (X + c) > X is always true", which may be an incorrect
1767 # optimization (although allowed by the standard), and breaks the
1768 # build with -Werror.
1770 # All of the following tests included -S -Wall -Wextra:
1772 # GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
1773 # * gcc-4.0 -O0: OK, compares the values
1774 # * gcc-4.0 -O2: assumes no overflow, does not warn
1775 # * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
1776 # * gcc-4.0 -O0 -fwrapv: OK, compares the values
1777 # * gcc-4.0 -O2 -fwrapv: OK, compares the values
1778 # * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
1779 # * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
1780 # * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1781 # * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
1783 # GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
1784 # * gcc-4.1 -O0: assumes no overflow, does not warn
1785 # * gcc-4.1 -O2: assumes no overflow, does not warn
1786 # * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
1787 # * gcc-4.1 -O0 -fwrapv: OK, compares the values
1788 # * gcc-4.1 -O2 -fwrapv: OK, compares the values
1789 # * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
1790 # * gcc-4.1 -O2 -ftrapv: compares the values
1791 # * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1792 # * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
1794 # GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
1795 # * gcc-4.2 -O0: OK, compares the values
1796 # * gcc-4.2 -O2: assumes no overflow, warns about it
1797 # * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
1798 # * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
1799 # * gcc-4.2 -O0 -fwrapv: OK, compares the values
1800 # * gcc-4.2 -O2 -fwrapv: OK, compares the values
1801 # * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
1802 # * gcc-4.2 -O2 -ftrapv: compares the values
1803 # * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
1804 # * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
1806 # Apparently, -ftrapv does not work reliably at all.
1807 for overflow_flag in -fno-strict-overflow -fwrapv; do
1808 AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
1810 CFLAGS="$CFLAGS $overflow_flag"
1811 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1812 [AC_MSG_RESULT([yes])
1814 [AC_MSG_RESULT([no])])
1819 AC_SUBST(GETTEXT_CFLAGS)
1820 EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
1821 EL_LOG_CONFIG(CPPFLAGS, [Preprocessor flags (CPPFLAGS)], [])
1822 EL_LOG_CONFIG(LDFLAGS, [Linker flags (LDFLAGS)], [])
1823 EL_LOG_CONFIG(LIBS, [Library flags (LIBS)], [])
1825 # ===================================================================
1826 # Colored make output
1827 # ===================================================================
1829 if test $(`which tput` colors 2> /dev/null || echo 0) -ge 4; then
1831 AC_SUBST(MAKE_COLOR)
1834 # ===================================================================
1836 # ===================================================================
1840 contrib/elinks.spec \
1841 contrib/lua/hooks.lua \
1842 contrib/conv/w3m2links.awk \
1844 doc/man/man1/elinks.1 \
1845 src/intl/gettext/ref-add.sed \
1846 src/intl/gettext/ref-del.sed
1850 abs_srcdir="$(cd "$srcdir" && pwd)"
1851 # builddir is always absolute!
1852 if test "$abs_srcdir" != "$builddir"; then
1853 # Bootstrap the Makefile creation
1854 echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1855 "$MAKE" "SRC=$abs_srcdir" init
1857 # Make cg-status ignore this build directory
1858 echo "*" > "$builddir/.gitignore"
1861 # ===================================================================
1862 # Configuration summary
1863 # ===================================================================
1865 AC_MSG_RESULT(The following feature summary has been saved to features.log)