2005-09-15 09:58:31 -04:00
dnl Process this file with autoconf to produce a configure script.
2008-02-17 11:40:19 -05:00
dnl There are two types of comments in this file.
dnl Comments that refer to Autoconf macros begin with "dnl", and m4
dnl discards them. Other comments begin with "#", and they get copied
dnl to the configure script, hopefully making it easier to read.
2007-07-02 13:19:33 -04:00
dnl Autoconf 2.13 generates an incomplete config.h.in; see ELinks bug 936.
2009-05-22 15:51:18 -04:00
dnl Autoconf 2.61 is installed in the computer that generates our nightly
dnl snapshots, so we need to be compatible with that. (Also, some files
dnl in Autoconf 2.62 and 2.63 sources are not GPLv2 compatible.)
AC_PREREQ(2.61)
2007-07-05 09:03:59 -04:00
AC_INIT
AC_CONFIG_SRCDIR([src/main/main.c])
2005-09-15 09:58:31 -04:00
AC_CONFIG_AUX_DIR(config)
2017-10-22 21:19:02 -04:00
AC_CONFIG_MACRO_DIR([config/m4])
2005-09-15 09:58:31 -04:00
2005-09-16 07:42:25 -04:00
PACKAGE=elinks
2007-04-22 12:50:15 -04:00
VERSION=0.13.GIT
2005-09-16 07:42:25 -04:00
AC_SUBST(PACKAGE)
2005-09-16 07:45:59 -04:00
AC_SUBST(VERSION)
2005-09-16 07:54:26 -04:00
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
2005-09-16 07:45:59 -04:00
AC_CONFIG_HEADERS(config.h)
2005-09-15 09:58:31 -04:00
2005-10-02 19:29:52 -04:00
AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
2017-10-22 21:26:15 -04:00
AC_USE_SYSTEM_EXTENSIONS
2005-10-22 07:25:28 -04:00
MAKE=
for make in gnumake gmake make false; do
if test "x$MAKE" = x; then
AC_PATH_PROGS(MAKE, "$make")
fi
done
2006-01-14 09:00:26 -05:00
builddir="`pwd`"
2005-10-22 07:25:28 -04:00
# Cleanup if we are configuring with a previous build in the tree
if test -e Makefile.config; then
2006-01-14 09:00:26 -05:00
AC_MSG_CHECKING([for previous build to clean])
"$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
AC_MSG_RESULT(done)
2005-10-22 07:25:28 -04:00
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Load feature configuration file and start logging features.
# ===================================================================
2005-09-15 09:58:31 -04:00
features="features.conf"
2010-12-13 07:08:47 -05:00
test -f "$srcdir/$features" && . "$srcdir/$features"
test -f "$builddir/$features" && . "$builddir/$features"
2005-09-15 09:58:31 -04:00
echo "Feature summary:" > features.log
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for programs.
# ===================================================================
2005-09-15 09:58:31 -04:00
AC_PROG_CC
2010-12-13 07:08:46 -05:00
AC_CHECK_TOOL([LD], [ld])
2005-09-15 09:58:31 -04:00
AC_PROG_AWK
AC_PATH_PROGS(AWK, "$AWK")
AC_PROG_RANLIB
2005-09-17 14:00:58 -04:00
AC_PROG_INSTALL
2005-09-15 09:58:31 -04:00
2008-01-22 07:21:29 -05:00
AC_PATH_PROGS(GIT, "git")
2005-11-24 07:24:19 -05:00
AC_PATH_PROGS(SPARSE, "sparse")
2014-03-08 08:01:07 -05:00
PKG_PROG_PKG_CONFIG
2005-09-15 09:58:31 -04:00
CONFIG_ASCIIDOC="no"
CONFIG_POD2HTML="no"
CONFIG_XMLTO="no"
CONFIG_JW="no"
if test "x$CONFIG_DOC" != xno; then
2009-05-01 08:01:07 -04:00
AC_PATH_PROGS(PYTHON, "python")
if test "x$PYTHON" != "x"; then
2005-09-15 09:58:31 -04:00
EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
EL_CONFIG(MAN_ASCIIDOC, [HTML])
fi
AC_PATH_PROGS(XMLTO, "xmlto")
if test "x$XMLTO" != "x"; then
EL_CONFIG(CONFIG_XMLTO, [XmlTo])
EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
EL_CONFIG(MAN_XMLTO, [man (groff)])
fi
AC_PATH_PROGS(JW, "jw")
if test "x$JW" != "x"; then
EL_CONFIG(CONFIG_JW, [JadeWrapper])
EL_CONFIG(MANUAL_JW, [PDF])
fi
AC_PATH_PROGS(POD2HTML, "pod2html")
if test "x$POD2HTML" != "x"; then
EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
fi
2007-08-08 08:23:21 -04:00
AC_PATH_PROGS(DOXYGEN, "doxygen")
if test "x$DOXYGEN" != "x"; then
EL_CONFIG(CONFIG_DOXYGEN, [Doxygen])
api_srcdir="$(cd "$srcdir" && pwd)/src"
AC_SUBST(api_srcdir)
fi
2005-09-15 09:58:31 -04:00
fi
AC_SUBST(CONFIG_ASCIIDOC)
2007-08-08 08:23:21 -04:00
AC_SUBST(CONFIG_DOXYGEN)
2005-09-15 09:58:31 -04:00
AC_SUBST(CONFIG_POD2HTML)
AC_SUBST(CONFIG_XMLTO)
AC_SUBST(CONFIG_JW)
2006-02-08 14:28:10 -05:00
EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
2007-08-08 08:23:21 -04:00
EL_CONFIG_DEPENDS(CONFIG_APIDOCS, [CONFIG_DOXYGEN], [API Documentation])
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# gcc specific options (to be continued at the bottom of configure)
2007-07-05 09:03:59 -04:00
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
2008-02-17 11:40:19 -05:00
# We want to see all warnings and live with none.
# We can't set up -Werror here as there may be some warnings in test
# suite of configure, and we don't want to fail them.
2005-09-15 09:58:31 -04:00
CFLAGS="$CFLAGS -Wall"
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for special OSes.
# ===================================================================
2005-09-15 09:58:31 -04:00
dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
AC_DEFUN([EL_CHECK_COMPILER_MACROS],
[
AC_MSG_CHECKING([for $2])
for flag in $3; do
2007-07-05 09:03:59 -04:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef $flag
2005-09-15 09:58:31 -04:00
kill me!
2007-07-05 09:03:59 -04:00
#endif ]])],[$1=yes],[$1=no])
2005-09-15 09:58:31 -04:00
if test "[$]$1" = yes; then
EL_CONFIG([$1], [$2])
break
fi
done
AC_MSG_RESULT([$]$1)
])
2006-01-11 14:12:59 -05:00
EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
AC_SUBST(CONFIG_OS_BEOS)
2005-09-15 09:58:31 -04:00
2006-01-11 14:10:26 -05:00
EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
AC_SUBST(CONFIG_OS_RISCOS)
2005-09-15 09:58:31 -04:00
2006-01-11 14:10:27 -05:00
EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
AC_SUBST(CONFIG_OS_WIN32)
2005-09-15 09:58:31 -04:00
2006-01-11 14:10:26 -05:00
EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
AC_SUBST(CONFIG_OS_OS2)
test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
2005-09-15 09:58:31 -04:00
AC_MSG_CHECKING([for UNIX])
dnl FIXME: some depend kind of mechanism
2006-01-11 14:12:59 -05:00
if test "$CONFIG_OS_BEOS" = no && \
2006-01-11 14:10:26 -05:00
test "$CONFIG_OS_RISCOS" = no && \
2006-01-11 14:10:27 -05:00
test "$CONFIG_OS_WIN32" = no && \
2006-01-11 14:10:26 -05:00
test "$CONFIG_OS_OS2" = no; then
2006-01-11 14:10:27 -05:00
EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
2005-09-15 09:58:31 -04:00
else
2006-01-11 14:10:27 -05:00
CONFIG_OS_UNIX=no
2005-09-15 09:58:31 -04:00
fi
2006-01-11 14:10:27 -05:00
AC_MSG_RESULT($CONFIG_OS_UNIX)
AC_SUBST(CONFIG_OS_UNIX)
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for header files.
# ===================================================================
2005-09-15 09:58:31 -04:00
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
2008-01-02 06:29:26 -05:00
AC_CHECK_HEADERS(wchar.h wctype.h)
2005-09-15 09:58:31 -04:00
AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
AC_CHECK_HEADERS(sigaction.h)
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
2008-07-29 12:09:28 -04:00
AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/in6_var.h)
2005-09-15 09:58:31 -04:00
AC_CHECK_HEADERS(ifaddrs.h)
AC_CHECK_HEADERS(sys/cygwin.h io.h)
AC_CHECK_HEADERS(sys/fmutex.h)
AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(sys/signal.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(sys/utsname.h)
2008-07-29 12:09:28 -04:00
AC_CHECK_HEADERS([net/if.h], [], [],
[[#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> /* <net/if.h> on Mac OS X 10.5.4 needs this */
#endif
]])
2005-09-15 09:58:31 -04:00
AC_CHECK_HEADERS(stdint.h inttypes.h)
AC_CHECK_HEADERS(locale.h pwd.h)
AC_CHECK_HEADERS(termios.h)
2017-11-11 15:37:08 -05:00
AC_CHECK_HEADERS(poll.h)
2005-09-15 09:58:31 -04:00
AC_CHECK_HEADERS(sys/un.h,
[CONFIG_INTERLINK=yes
EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
[CONFIG_INTERLINK=no])
2005-09-15 22:24:01 -04:00
AC_SUBST(CONFIG_INTERLINK)
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for typedefs, structures, and compiler characteristics.
# ===================================================================
2005-09-15 09:58:31 -04:00
AC_STRUCT_TM
AC_C_CONST
AC_C_INLINE
2009-05-22 15:11:11 -04:00
AC_MSG_CHECKING([[for C99-conforming inline]])
2013-02-25 09:45:32 -05:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2016-04-24 11:23:36 -04:00
#ifdef __cplusplus
#error noinline
#endif
2009-05-22 15:11:11 -04:00
int add(int change);
2009-03-28 14:15:08 -04:00
static int sum;
inline int
add(int change)
{
sum += change;
return sum;
}
int
sub(int change)
{
return add(-change);
2013-02-25 09:45:32 -05:00
}]])],
2009-03-28 14:15:08 -04:00
[AC_MSG_RESULT([[yes]])
AC_DEFINE([NONSTATIC_INLINE], [inline],
[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.])],
[AC_MSG_RESULT([[no]])
AC_DEFINE([NONSTATIC_INLINE], [])])
2005-09-15 09:58:31 -04:00
EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
AC_SYS_LARGEFILE
AC_TYPE_SIZE_T
AC_TYPE_OFF_T
EL_CHECK_TYPE(ssize_t, int)
EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
2006-08-04 18:31:29 -04:00
EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
2005-09-15 09:58:31 -04:00
EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
2006-08-04 18:31:29 -04:00
test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# Check for variadic macros
2005-09-15 09:58:31 -04:00
EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
[#include <stdio.h>
#define a(b,c...) printf(b,##c)],
[a("foo");a("%s","bar");a("%s%s","baz","quux");])
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for library functions.
# ===================================================================
2005-09-15 09:58:31 -04:00
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_STRFTIME
2008-01-13 12:23:03 -05:00
AC_CHECK_FUNCS(atoll gethostbyaddr herror strerror)
2005-09-15 09:58:31 -04:00
AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
2006-10-21 17:05:37 -04:00
AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
2005-09-15 09:58:31 -04:00
AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
AC_CHECK_FUNCS(gettimeofday clock_gettime)
2009-07-18 19:41:01 -04:00
AC_CHECK_FUNCS(setitimer, HAVE_SETITIMER=yes)
2005-09-15 09:58:31 -04:00
2007-07-05 09:03:59 -04:00
AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
2005-09-15 09:58:31 -04:00
AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
2008-03-16 11:29:32 -04:00
AC_CHECK_FUNCS(unsetenv)
2005-09-15 09:58:31 -04:00
AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
2008-01-19 12:56:50 -05:00
AC_CHECK_FUNCS(wcwidth, HAVE_WCWIDTH=yes)
2008-01-02 06:29:26 -05:00
2012-05-25 10:13:25 -04:00
AC_CHECK_FUNCS(fork)
2008-02-17 11:40:19 -05:00
# These aren't probably needed now, as they are commented in links.h.
# I've no idea about their historical background, but I keep them here
# just in the case they will help later. --pasky
2005-09-15 09:58:31 -04:00
AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
2010-03-21 12:18:32 -04:00
AC_CHECK_FUNCS(fpathconf, HAVE_FPATHCONF=yes)
2017-11-11 15:37:08 -05:00
AC_CHECK_FUNCS(poll, HAVE_POLL=yes)
2005-09-15 09:58:31 -04:00
if test x"$HAVE_RAISE" = x; then
if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
2007-07-05 09:03:59 -04:00
AC_MSG_ERROR([Unable to emulate raise()])
2005-09-15 09:58:31 -04:00
fi
fi
AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
2007-07-05 09:03:59 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],[el_cv_HAVE_VA_COPY=yes],[el_cv_HAVE_VA_COPY=no])])
2005-09-15 09:58:31 -04:00
if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
EL_DEFINE(HAVE_VA_COPY, __va_copy)
fi
AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
2007-07-05 09:03:59 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
]], [[int page_size = sysconf(_SC_PAGE_SIZE);]])],[el_cv_HAVE_SC_PAGE_SIZE=yes],[el_cv_HAVE_SC_PAGE_SIZE=no])])
2005-09-15 09:58:31 -04:00
if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
fi
AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
2007-07-05 09:03:59 -04:00
AC_RUN_IFELSE([AC_LANG_SOURCE([[
2005-09-15 09:58:31 -04:00
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
char buf[8];
int bar(char *buf, const char *format, va_list ap)
{
return vsnprintf(buf, 0, format, ap);
}
void foo(const char *format, ...) {
va_list ap;
int len;
va_start(ap, format);
len = bar(buf, format, ap);
va_end(ap);
if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
va_start(ap, format);
len = bar(buf, format, ap);
va_end(ap);
if ((len != 6) && (len != 7)) exit(1);
if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
exit(0);
}
main() { foo("hello\n"); }
2007-07-05 09:03:59 -04:00
]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
2005-09-15 09:58:31 -04:00
if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
fi
2008-02-17 11:40:19 -05:00
# OpenSSL and Lua frequently need dlopen
AC_CHECK_LIB(dl, dlopen)
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for libraries.
# ===================================================================
2005-09-15 09:58:31 -04:00
AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
if test "$cf_result" = no; then
AC_CHECK_LIB(socket, socket)
fi
AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
if test "$cf_result" = no; then
AC_CHECK_LIB(socket, setsockopt)
fi
AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
if test "$cf_result" = no; then
AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
if test "$cf_result" = no; then
AC_CHECK_LIB(nsl, gethostbyname)
else
test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
fi
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for packaging specific options.
# ===================================================================
2005-09-15 09:58:31 -04:00
AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
[ if test "$withval" != no && test "$withval" != yes; then
AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
fi ])
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for a libraries, optional even if installed.
# ===================================================================
2005-09-15 09:58:31 -04:00
dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
[
AC_MSG_CHECKING([for $2 support])
if test "[$]$1" != no; then
AC_MSG_RESULT(yes)
EL_SAVE_FLAGS
if test -n "$withval" && test -d "$withval"; then
2006-01-30 22:28:25 -05:00
# Be a little more careful when setting
# include and lib directories. This way
# $withval will work when includes are
# there but the library is in the common
# /usr/lib ... Does the right thing when
# looking for gc on Debian.
if test -d "$withval/include"; then
CFLAGS="$CFLAGS -I$withval/include"
CPPFLAGS="$CPPFLAGS -I$withval/include"
else
CFLAGS="$CFLAGS -I$withval"
CPPFLAGS="$CPPFLAGS -I$withval"
fi
if test -d "$withval/lib"; then
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
2005-09-15 09:58:31 -04:00
fi
AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
if test "[$]$1" = yes; then
AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
fi
if test "[$]$1" = yes; then
EL_CONFIG([$1], [$2])
LIBS="$LIBS -l$4"
else
if test -n "[$]WITHVAL_$1" &&
2011-04-30 18:24:40 -04:00
test "x[$]WITHVAL_$1" != xno; then
2005-09-15 09:58:31 -04:00
AC_MSG_ERROR([$2 not found])
fi
EL_RESTORE_FLAGS
fi
else
AC_MSG_RESULT(disabled)
fi
])
dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
[
2009-02-23 05:00:59 -05:00
if test "x[$]$1" != xno; then $1=yes; fi
2005-09-15 09:58:31 -04:00
WITHVAL_$1=
AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
2009-02-23 05:00:59 -05:00
if test "x[$]WITHVAL_$1" = xyes; then $1=yes; fi
2005-09-15 09:58:31 -04:00
EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
EL_LOG_CONFIG([$1], [$2], [])
])
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
[ --without-gpm disable gpm (mouse) support])
2017-11-19 12:29:38 -05:00
2017-11-19 14:48:15 -05:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_TERMINFO, terminfo, term.h, tinfo, setupterm,
2017-11-19 12:29:38 -05:00
[ --with-terminfo enable terminfo support])
2008-02-17 11:44:48 -05:00
# ELinks calls deflateInit2 with windowBits = MAX_WBITS | 32, to
# enable automatic decoding of both zlib and gzip headers. This
# feature was added in zlib 1.2.0.2; earlier versions return an error.
# The gzclearerr function was also added in zlib 1.2.0.2, so check for
# that, even though ELinks does not actually call gzclearerr.
2007-06-11 03:15:43 -04:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
2005-09-15 09:58:31 -04:00
[ --without-zlib disable zlib support])
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
[ --without-bzlib disable bzlib support])
2017-07-01 16:38:06 -04:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BROTLI, brotli, brotli/decode.h, brotlidec, BrotliDecoderDecompressStream,
2015-10-12 17:18:23 -04:00
[ --with-brotli enable experimental brotli support])
2005-09-15 09:58:31 -04:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
[ --without-idn disable international domain names support])
2009-02-22 07:58:55 -05:00
# LZMA disabled by default, because of little usability and compilation problems
# with new xz
2009-02-23 05:00:59 -05:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
[ --with-lzma enable lzma encoding support])
2006-12-09 19:30:16 -05:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Check for GSSAPI, optional even if installed.
# ===================================================================
2006-06-14 08:41:59 -04:00
enable_gssapi="no";
AC_ARG_WITH(gssapi, [ --with-gssapi enable GSSAPI support],
[ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
AC_MSG_CHECKING([for GSSAPI])
if test "$enable_gssapi" = "yes"; then
AC_MSG_RESULT(yes)
GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
GSSAPI_LIBS=`krb5-config --libs gssapi`
CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
LIBS="$GSSAPI_LIBS $LIBS"
2017-11-17 11:33:51 -05:00
EL_CONFIG(CONFIG_GSSAPI, [GssApi])
2006-06-14 08:41:59 -04:00
else
AC_MSG_RESULT(no)
fi
AC_SUBST(CONFIG_GSSAPI)
2008-02-17 11:40:19 -05:00
# ===================================================================
# Bookmark and XBEL support
# ===================================================================
2005-09-15 09:58:31 -04:00
EL_SAVE_FLAGS
EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
[ --disable-bookmarks disable bookmark support])
# Check whether --enable-xbel or --disable-xbel was given.
if test "x${enable_xbel}" != xno; then
AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
if test "$HAVE_LIBEXPAT" = yes; then
AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
if test "$HAVE_LIBEXPAT" = yes; then
LIBS="$LIBS -lexpat"
fi
fi
fi
EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
[XBEL bookmarks],
[ --disable-xbel disable XBEL bookmark support (requires expat)])
if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
EL_RESTORE_FLAGS
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for BSD sysmouse
# ===================================================================
2005-09-15 09:58:31 -04:00
HAVE_SYSMOUSE_HEADER="no"
# Either of these header files provides the (same) sysmouse interface
AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for OS/2
# ===================================================================
2005-09-15 09:58:31 -04:00
2006-01-11 14:10:26 -05:00
if test "$CONFIG_OS_OS2" = yes; then
EL_CONFIG_OS_OS2
2005-09-15 09:58:31 -04:00
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checks for Win32
# ===================================================================
2005-09-15 09:58:31 -04:00
2006-01-11 14:10:27 -05:00
if test "$CONFIG_OS_WIN32" = yes; then
EL_CONFIG_OS_WIN32
2005-09-15 09:58:31 -04:00
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Check for SpiderMonkey, optional even if installed.
# ===================================================================
2005-12-24 20:23:54 -05:00
2011-05-01 14:13:37 -04:00
# This option sets the $with_spidermonkey variable.
AC_ARG_WITH([spidermonkey],
[AS_HELP_STRING([--without-spidermonkey],
[disable SpiderMonkey Mozilla JavaScript engine support])])
# CONFIG_SPIDERMONKEY is initially blank. We change it to "yes" or "no"
# when we know for sure whether we're going to use SpiderMonkey or not.
# (features.conf is not supposed to define it.)
CONFIG_SPIDERMONKEY=
2005-12-24 20:23:54 -05:00
EL_SAVE_FLAGS
2011-05-01 14:13:37 -04:00
case "$with_spidermonkey" in
no)
# The user specified --without-spidermonkey.
# That overrides the other SpiderMonkey options.
AC_MSG_CHECKING([for SpiderMonkey])
AC_MSG_RESULT([disabled])
CONFIG_SPIDERMONKEY="no"
;;
"" | yes)
;;
*)
AC_MSG_WARN([This version of ELinks does not support --with-spidermonkey=DIRECTORY.])
;;
esac
# The SpiderMonkey 1.8.5 standalone sources install mozjs185.pc,
# but the Debian libmozjs-dev package installs mozilla-js.pc.
# Check mozjs185 first, because it has the version number in the name
# and therefore is less likely to be a newer incompatible version.
# (This configure script rejects older incompatible versions
# but can let newer ones through.)
for package in mozjs185 mozilla-js; do
if test -n "$CONFIG_SPIDERMONKEY"; then
break
else
AC_MSG_CHECKING([for SpiderMonkey (1.8.5 or later) in pkg-config $package])
# In pkg-config 0.25, pkg-config --exists mozjs185
# returns 0 (success) even if mozjs185 depends on
# nspr, which has not been installed. However,
# pkg-config --cflags mozjs185 returns 1 then.
2014-03-08 08:01:07 -05:00
if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then
SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)"
SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)"
2011-05-01 14:13:37 -04:00
LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
/* mozilla-js.pc may have -DXP_UNIX or similar in Cflags.
* Avoid warnings about conflicting definitions. */
#if !defined(XP_BEOS) && !defined(XP_OS2) && !defined(XP_UNIX) && !defined(XP_WIN)
# define XP_UNIX 1
#endif
#include <jsapi.h>
#ifndef JS_VERSION
# error <jsapi.h> did not define JS_VERSION
#elif JS_VERSION < 185
# error too old
#endif]], [])],
[CONFIG_SPIDERMONKEY=yes
AC_MSG_RESULT([yes])],
[# Leave CONFIG_SPIDERMONKEY blank, to continue the search.
AC_MSG_RESULT([found but unusable])])
else
AC_MSG_RESULT([no])
fi
2005-12-24 20:23:54 -05:00
fi
2011-05-01 14:13:37 -04:00
done
if test -z "$CONFIG_SPIDERMONKEY"; then
# Didn't find SpiderMonkey anywhere.
CONFIG_SPIDERMONKEY=no
2005-12-24 20:23:54 -05:00
fi
2011-05-01 14:13:37 -04:00
if test "$CONFIG_SPIDERMONKEY" = "yes"; then
# LIBS, CFLAGS, and CPPFLAGS still include the SpiderMonkey options.
AC_CHECK_FUNCS([JS_ReportAllocationOverflow])
AC_CHECK_FUNCS([JS_SetBranchCallback])
AC_CHECK_FUNCS([JS_TriggerOperationCallback], [HAVE_JS_TRIGGEROPERATIONCALLBACK=yes])
elif test -n "$with_spidermonkey" && test "x$with_spidermonkey" != "xno"; then
AC_MSG_WARN([SpiderMonkey was not found even though you specified --with-spidermonkey.])
2009-02-08 16:07:22 -05:00
fi
2006-01-20 09:26:57 -05:00
EL_RESTORE_FLAGS
2005-12-24 20:23:54 -05:00
2011-05-11 05:31:15 -04:00
if test "x$CONFIG_SPIDERMONKEY" = xyes; then
2006-01-10 20:21:53 -05:00
EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
2006-01-20 10:31:59 -05:00
else
CONFIG_ECMASCRIPT_SMJS=no
2006-01-10 20:21:53 -05:00
fi
2011-05-11 05:31:15 -04:00
EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
2006-01-20 10:31:59 -05:00
AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
2006-01-10 20:21:53 -05:00
2009-07-18 19:41:01 -04:00
if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes &&
test "x$HAVE_JS_TRIGGEROPERATIONCALLBACK" = xyes &&
test "x$HAVE_SETITIMER" = xyes; then
EL_CONFIG(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT, [ECMAScript heartbeat support])
else
CONFIG_ECMASCRIPT_SMJS_HEARTBEAT=no
fi
AC_SUBST(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT)
2006-01-10 20:21:53 -05:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Optional Spidermonkey-based ECMAScript browser scripting
# ===================================================================
2006-01-10 20:21:53 -05:00
AC_ARG_ENABLE(sm-scripting,
[ --disable-sm-scripting ECMAScript browser scripting (requires Spidermonkey)],
[if test "$enableval" != no; then enableval="yes"; fi
2006-01-11 08:14:11 -05:00
CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
2006-01-10 20:21:53 -05:00
if test "x$CONFIG_SPIDERMONKEY" = xyes &&
2006-01-11 08:14:11 -05:00
test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
2006-01-10 20:21:53 -05:00
else
2006-01-11 08:14:11 -05:00
CONFIG_SCRIPTING_SPIDERMONKEY=no
2006-01-10 20:21:53 -05:00
fi
2005-12-24 20:23:54 -05:00
2006-01-20 10:31:59 -05:00
if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
LIBS="$LIBS $SPIDERMONKEY_LIBS"
AC_SUBST(SPIDERMONKEY_LIBS)
AC_SUBST(SPIDERMONKEY_CFLAGS)
AC_SUBST(CONFIG_SPIDERMONKEY)
2006-01-20 09:26:57 -05:00
fi
2005-12-24 20:23:54 -05:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Check for Guile, optional even if installed.
# ===================================================================
2005-09-15 09:58:31 -04:00
enable_guile="no";
AC_ARG_WITH(guile, [ --with-guile enable Guile support],
[ if test "x$withval" != xno; then enable_guile=yes; fi ])
# The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
# GUILE_FLAGS but I really don't want to require people to have Guile in order
# to compile CVS. Also, the macro seems to be really stupid regarding searching
# for Guile in $PATH etc. --pasky
AC_MSG_CHECKING([for Guile])
if test "$enable_guile" = "yes"; then
AC_MSG_RESULT(yes);
## Based on the GUILE_FLAGS macro.
if test -d "$withval"; then
GUILE_PATH="$withval:$PATH"
else
GUILE_PATH="$PATH"
fi
AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
## First, let's just see if we can find Guile at all.
if test "$GUILE_CONFIG" != no; then
cf_result="yes";
GUILE_LIBS="`guile-config link`"
GUILE_CFLAGS="`guile-config compile`"
LIBS="$GUILE_LIBS $LIBS"
2006-01-11 08:10:41 -05:00
EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
2005-09-15 09:58:31 -04:00
AC_SUBST(GUILE_CFLAGS)
cat <<EOF
***********************************************************************
The Guile support is incomplete and not so well integrated to ELinks
2006-02-11 13:37:57 -05:00
yet. That means, e.g., that you have no Guile console and there might
2005-09-15 09:58:31 -04:00
not be all the necessary hooks. Also, the Guile interface is not too
well tested (success stories heartily welcomed!). See
src/scripting/guile/README for further details and hints.
***********************************************************************
EOF
else
if test -n "$withval" && test "x$withval" != xno; then
AC_MSG_ERROR([Guile not found])
else
AC_MSG_WARN([Guile support disabled])
fi
fi
else
AC_MSG_RESULT(no);
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Check for Perl
# ===================================================================
2005-09-15 09:58:31 -04:00
enable_perl="no";
AC_ARG_WITH(perl, [ --with-perl enable Perl support],
[
if test "$withval" = yes; then
# FIXME: If withval is a valid directory append it to PATH
# so that you can specify one of several perl installations.
withval="";
enable_perl=yes;
fi
])
AC_MSG_CHECKING([for Perl])
cf_result=no
EL_SAVE_FLAGS
if test "$enable_perl" = "yes"; then
PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
LIBS="$PERL_LIBS $LIBS"
CFLAGS="$PERL_CFLAGS $CFLAGS"
CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
2007-07-05 09:03:59 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2005-09-15 09:58:31 -04:00
#include <EXTERN.h>
#include <perl.h>
#include <perlapi.h>
2007-07-05 09:03:59 -04:00
]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
2005-09-15 09:58:31 -04:00
fi
2006-12-09 13:26:06 -05:00
if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
AC_MSG_CHECKING([whether POPpx works without an n_a variable])
2007-07-05 09:03:59 -04:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2006-12-09 13:26:06 -05:00
#include <EXTERN.h>
#include <perl.h>
extern PerlInterpreter *my_perl;
2007-07-05 09:03:59 -04:00
]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
2006-12-09 13:26:06 -05:00
AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
[Define if using Perl 5.8.8 or later, where the "POPpx" macro
2007-07-05 09:03:59 -04:00
no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
2006-12-09 13:26:06 -05:00
2005-09-15 09:58:31 -04:00
if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS
else
2006-01-11 08:07:17 -05:00
EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
2005-09-15 09:58:31 -04:00
CFLAGS="$CFLAGS_X"
2007-02-17 12:08:00 -05:00
CPPFLAGS="$CPPFLAGS_X"
2005-09-15 09:58:31 -04:00
AC_SUBST(PERL_LIBS)
AC_SUBST(PERL_CFLAGS)
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Check for Python
# ===================================================================
2005-09-15 09:58:31 -04:00
enable_python="no";
2008-09-09 03:56:14 -04:00
AC_ARG_WITH(python, [[ --with-python[=DIR] enable Python support]],
2006-07-26 15:27:57 -04:00
[ if test "x$withval" != xno; then enable_python=yes; fi ])
2005-09-15 09:58:31 -04:00
2006-07-26 15:27:57 -04:00
EL_SAVE_FLAGS
2005-09-15 09:58:31 -04:00
cf_result=no
2006-07-26 15:27:57 -04:00
AC_MSG_CHECKING([for Python])
2005-09-15 09:58:31 -04:00
if test "$enable_python" = "yes"; then
2006-07-26 15:27:57 -04:00
AC_MSG_RESULT(yes);
if test -d "$withval"; then
PYTHON_PATH="$withval:$PATH"
2006-01-29 10:48:33 -05:00
else
PYTHON_PATH="$PATH"
fi
2006-07-26 15:27:57 -04:00
2006-01-29 10:48:33 -05:00
AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
2006-07-26 15:27:57 -04:00
if test "$PYTHON" != no; then
cf_result="yes";
PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; print "-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True))'`"
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"))'`"
2006-01-29 10:48:33 -05:00
LIBS="$PYTHON_LIBS $LIBS"
2006-07-26 15:27:57 -04:00
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
2007-07-05 09:03:59 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
2005-09-15 09:58:31 -04:00
2006-01-29 10:48:33 -05:00
if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_CFLAGS)
2007-02-17 12:12:53 -05:00
CPPFLAGS="$CPPFLAGS_X"
2006-07-26 15:27:57 -04:00
cat <<EOF
***********************************************************************
The Python support is incomplete and not so well integrated to ELinks
2006-09-17 10:32:07 -04:00
yet. That means, e.g., that you have no Python console and there might
2006-07-26 15:27:57 -04:00
not be all the necessary hooks. Also, the Python interface is not too
well tested (success stories heartily welcomed!).
***********************************************************************
EOF
fi
else
if test -n "$withval" && test "x$withval" != xno; then
AC_MSG_ERROR([Python not found])
else
AC_MSG_WARN([Python support disabled])
2006-01-29 10:48:33 -05:00
fi
fi
2006-07-26 15:27:57 -04:00
else
AC_MSG_RESULT(no);
2005-09-15 09:58:31 -04:00
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Check for Lua, optional even if installed.
# ===================================================================
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# Do this the long way, as FreeBSD reportedly needs -L<dir> for
# anything other than /usr/lib, and Lua is very often in /usr/local/lib.
2005-09-15 09:58:31 -04:00
AC_ARG_WITH(lua, [ --without-lua disable Lua support],
[if test "$withval" = no; then disable_lua=yes; fi])
AC_MSG_CHECKING([for Lua])
EL_SAVE_FLAGS
cf_result=no
if test -z "$disable_lua"; then
if test ! -d "$withval"; then
withval="";
fi
for luadir in "$withval" "" /usr /usr/local; do
2010-07-25 14:13:09 -04:00
for suffix in "" 5.1 51; do
2007-07-03 12:20:14 -04:00
if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
test -f "$luadir/include/lua$suffix/lua.h" ) ; then
2010-07-21 13:07:49 -04:00
LUA_LIBS="-L$luadir/lib -llua$suffix -lm"
2007-07-10 06:53:18 -04:00
LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
2005-09-15 09:58:31 -04:00
LIBS="$LUA_LIBS $LIBS_X"
CFLAGS="$CFLAGS_X $LUA_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
# Check that it is a compatible Lua version
2010-07-21 13:07:49 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lauxlib.h>]
#include <lua.h>
#include <lualib.h>
], [[ lua_State *L = luaL_newstate();
luaL_openlibs(L);
2005-09-15 09:58:31 -04:00
lua_pushboolean(L, 1);
2007-07-05 09:03:59 -04:00
lua_close(L);]])],[cf_result=yes],[cf_result=no])
2005-09-15 09:58:31 -04:00
fi
done
done
fi
AC_MSG_RESULT($cf_result)
if test "$cf_result" != yes; then
EL_RESTORE_FLAGS
else
2006-01-11 08:06:13 -05:00
EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
2005-09-15 09:58:31 -04:00
AC_CHECK_HEADERS(lauxlib.h)
CFLAGS="$CFLAGS_X"
2007-02-17 12:19:10 -05:00
CPPFLAGS="$CPPFLAGS_X"
2005-09-15 09:58:31 -04:00
AC_SUBST(LUA_LIBS)
AC_SUBST(LUA_CFLAGS)
fi
Bug 1060: Use libtre for regexp searches.
When the user tells ELinks to search for a regexp, ELinks 0.11.0
passes the regexp to regcomp() and the formatted document to
regexec(), both in the terminal charset. This works OK for unibyte
ASCII-compatible charsets because the regexp metacharacters are all in
the ASCII range. And ELinks 0.11.0 doesn't support multibyte or
ASCII-incompatible (e.g. EBCDIC) charsets in terminals, so it is no
big deal if regexp searches fail in such locales.
ELinks 0.12pre1 attempts to support UTF-8 as the terminal charset if
CONFIG_UTF8 is defined. Then, struct search contains unicode_val_T c
rather than unsigned char c, and get_srch() and add_srch_chr()
together save UTF-32 values there if the terminal charset is UTF-8.
In plain-text searches, is_in_range_plain() compares those values
directly if the search is case sensitive, or folds them to lower case
if the search is case insensitive: with towlower() if the terminal
charset is UTF-8, or with tolower() otherwise. In regexp searches
however, get_search_region_from_search_nodes() still truncates all
values to 8 bits in order to generate the string that
search_for_pattern() then passes to regexec(). In UTF-8 locales,
regexec() expects this string to be in UTF-8 and can't make sense of
the truncated characters. There is also a possible conflict in
regcomp() if the locale is UTF-8 but the terminal charset is not, or
vice versa.
Rejected ways of fixing the charset mismatches:
* When the terminal charset is UTF-8, recode the formatted document
from UTF-32 to UTF-8 for regexp searching. This would work if the
terminal and the locale both use UTF-8, or if both use unibyte
ASCII-compatible charsets, but not if only one of them uses UTF-8.
* Convert both the regexp and the formatted document to the charset of
the locale, as that is what regcomp() and regexec() expect. ELinks
would have to somehow keep track of which bytes in the converted
string correspond to which characters in the document; not entirely
trivial because convert_string() can replace a single unconvertible
character with a string of ASCII characters. If ELinks were
eventually changed to use iconv() for unrecognized charsets, such
tracking would become even harder.
* Temporarily switch to a locale that uses the charset of the
terminal. Unfortunately, it seems there is no portable way to
construct a name for such a locale. It is also possible that no
suitable locale is available; especially on Windows, whose C library
defines MB_LEN_MAX as 2 and thus cannot support UTF-8 locales.
Instead, this commit makes ELinks do the regexp matching with regwcomp
and regwexec from the TRE library. This way, ELinks can losslessly
recode both the pattern and the document to Unicode and rely on the
regexp code in TRE decoding them properly, regardless of locale.
There are some possible problems though:
1. ELinks stores strings as UTF-32 in arrays of unicode_val_T, but TRE
uses wchar_t instead. If wchar_t is UTF-16, as it is on Microsoft
Windows, then TRE will misdecode the strings. It wouldn't be too
hard to make ELinks convert to UTF-16 in this case, but (a) TRE
doesn't currently support UTF-16 either, and it seems possible that
wchar_t-independent UTF-32 interfaces will be added to TRE; and (b)
there seems to be little interest on using ELinks on Windows anyway.
2. The Citrus Project apparently wanted BSD to use a locale-dependent
wchar_t: e.g. UTF-32 in some locales and an ISO 2022 derivative in
others. Regexp searches in ELinks now do not support the latter.
[ Adapted to elinks-0.12 from bug 1060 attachment 506.
Commit message by me. --KON ]
2008-12-24 08:48:00 -05:00
# ===================================================================
# Check for TRE library
# ===================================================================
2009-05-21 10:22:12 -04:00
#
# This section only checks that --without-tre is not given and the
# library seems to work, and sets TRE_CFLAGS, TRE_LIBS, and
# tre_log. It does not define CONFIG_TRE, and always resets
# LIBS and CFLAGS back to their original values.
#
# After any --enable-utf-8 and --disable-utf-8 options have been
# handled, a separate section decides whether to actually use TRE.
2009-11-28 09:45:24 -05:00
#
# tre version 0.8.0 or higher is required which have the "tre_" prefix
# for functions.
2009-02-08 10:21:03 -05:00
2009-05-21 07:57:54 -04:00
AC_ARG_WITH([[tre]], [[ --without-tre disable TRE regex search support]])
if test "$with_tre" = no; then
AC_MSG_CHECKING([[for TRE]])
AC_MSG_RESULT([[disabled]])
2009-05-21 10:22:12 -04:00
tre_log="no (explicitly disabled)"
2009-02-08 10:21:03 -05:00
else
2009-04-26 07:13:01 -04:00
AC_MSG_CHECKING([[for TRE in pkg-config]])
2014-03-08 08:01:07 -05:00
if $PKG_CONFIG tre; then
TRE_CFLAGS=`$PKG_CONFIG --cflags tre`
TRE_LIBS=`$PKG_CONFIG --libs tre`
2009-04-26 07:13:01 -04:00
AC_MSG_RESULT([[yes]])
else
# <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513055>
# "libtre-dev: /usr/lib/pkgconfig/tre.pc missing"
# so we look for the library even if pkg-config doesn't know about it.
TRE_CFLAGS=
TRE_LIBS=-ltre
AC_MSG_RESULT([[no, but let's try defaults]])
fi
2009-02-08 10:21:03 -05:00
2009-04-26 07:13:01 -04:00
AC_MSG_CHECKING([[for TRE header and library]])
EL_SAVE_FLAGS
CFLAGS="$TRE_CFLAGS $CFLAGS"
2009-06-10 17:47:33 -04:00
LIBS="$TRE_LIBS $LIBS" # must be first, because of regfree conflict
2009-11-28 09:45:24 -05:00
AC_TRY_LINK([#include <tre/tre.h>],
2009-04-26 07:13:01 -04:00
[regex_t re;
regmatch_t match[1];
2009-11-28 09:45:24 -05:00
tre_regwcomp(&re, L"zap", REG_ICASE);
tre_regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
2009-04-26 07:13:01 -04:00
[AC_MSG_RESULT([[yes]])
2009-05-21 10:22:12 -04:00
tre_log="available"],
2009-04-26 07:13:01 -04:00
[AC_MSG_RESULT([[no]])
2009-05-21 10:22:12 -04:00
tre_log="no (TRE not found)"])
EL_RESTORE_FLAGS
2009-04-26 07:13:01 -04:00
fi
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Check for Ruby, optional even if installed.
# ===================================================================
2005-09-15 09:58:31 -04:00
2006-01-11 08:10:51 -05:00
EL_CONFIG_SCRIPTING_RUBY
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Setup global scripting
# ===================================================================
2005-09-15 09:58:31 -04:00
2006-01-11 08:14:11 -05:00
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])
2006-01-11 08:10:41 -05:00
AC_SUBST(CONFIG_SCRIPTING_GUILE)
2006-01-11 08:06:13 -05:00
AC_SUBST(CONFIG_SCRIPTING_LUA)
2006-01-11 08:07:17 -05:00
AC_SUBST(CONFIG_SCRIPTING_PERL)
2006-01-11 08:10:58 -05:00
AC_SUBST(CONFIG_SCRIPTING_PYTHON)
2006-01-11 08:10:51 -05:00
AC_SUBST(CONFIG_SCRIPTING_RUBY)
2006-01-11 08:14:11 -05:00
AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
2005-09-15 22:24:01 -04:00
AC_SUBST(CONFIG_SCRIPTING)
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Check for SSL support.
# ===================================================================
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# We by default use OpenSSL, and we always prefer it. However, when GNUTLS
# is enabled, we won't try to use OpenSSL anymore.
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# For wiping SSL hooks..
2005-09-15 09:58:31 -04:00
#ifdef CONFIG_SSL
2009-05-22 18:57:23 -04:00
chosen_ssl_library=""
2005-09-15 09:58:31 -04:00
2009-05-21 15:52:57 -04:00
AC_ARG_WITH(gnutls, [[ --without-gnutls disable GNUTLS SSL support]])
AC_ARG_WITH(gnutls, [[ --with-gnutls enable GNUTLS SSL support]],
[case "$with_gnutls" in
2009-05-22 18:57:23 -04:00
"no") : ;;
"yes") chosen_ssl_library="GNUTLS" ;;
*) chosen_ssl_library="GNUTLS"
AC_MSG_WARN([[Support for --with-gnutls=DIR has been removed.
You may have to set the PKG_CONFIG_PATH environment variable instead.]]) ;;
2009-05-21 15:52:57 -04:00
esac])
2005-09-15 09:58:31 -04:00
2009-05-22 18:57:23 -04:00
AC_ARG_WITH(openssl, [[ --without-openssl disable OpenSSL support]])
AC_ARG_WITH(openssl, [[ --with-openssl[=DIR] enable OpenSSL support (default)]],
[case "$with_openssl" in
"no") : ;;
*) chosen_ssl_library="OpenSSL" ;;
esac])
2005-09-15 09:58:31 -04:00
2008-09-23 07:27:47 -04:00
AC_ARG_WITH(nss_compat_ossl, [[ --with-nss_compat_ossl[=DIR]
2009-05-23 05:40:52 -04:00
NSS compatibility SSL libraries/include files]],
[case "$with_nss_compat_ossl" in
"no") : ;;
*) chosen_ssl_library="nss_compat_ossl" ;;
esac])
# ---- nss_compat_ossl
if test "$with_nss_compat_ossl" = no; then
# explicitly disabled
:
elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "nss_compat_ossl"; then
# not used, because $chosen_ssl_library was chosen
:
elif test -z "${with_nss_compat_ossl+set}"; then
# SSL_library_init() in nss_compat_ossl 0.9.2 calls exit(1)
# with no error message if there is no certificate database.
# https://bugzilla.redhat.com/show_bug.cgi?id=463437
# So ELinks uses nss_compat_ossl only if explicitly requested.
:
else
2008-09-23 07:27:47 -04:00
EL_SAVE_FLAGS
if test "$with_nss_compat_ossl" = yes; then
2014-03-08 08:01:07 -05:00
if $PKG_CONFIG nss; then
CFLAGS="$CFLAGS_X `$PKG_CONFIG --cflags nss`"
LIBS="$LIBS_X `$PKG_CONFIG --libs nss`"
2008-09-23 07:27:47 -04:00
else
with_nss_compat_ossl=no
fi
else
# Without pkg-config, we'll kludge in some defaults
CFLAGS="$CFLAGS_X -I$with_nss_compat_ossl/include -I/usr/include/nss3 -I/usr/include/nspr4"
LIBS="$LIBS_X -L$with_nss_compat_ossl/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
fi
AC_CHECK_HEADERS(nss_compat_ossl/nss_compat_ossl.h,, [with_nss_compat_ossl=no], [#define NSS_COMPAT_OSSL_H])
AC_CHECK_LIB(nss_compat_ossl, X509_free,, [with_nss_compat_ossl=no])
if test "$with_nss_compat_ossl" = "no"; then
EL_RESTORE_FLAGS
else
LIBS="$LIBS -lnss_compat_ossl"
EL_CONFIG(CONFIG_NSS_COMPAT_OSSL, [nss_compat_ossl])
2009-05-23 05:40:52 -04:00
chosen_ssl_library="nss_compat_ossl"
2008-09-23 07:27:47 -04:00
fi
fi
2008-02-17 11:40:19 -05:00
# ---- OpenSSL
2005-09-15 09:58:31 -04:00
AC_MSG_CHECKING([for OpenSSL])
EL_SAVE_FLAGS
2009-05-22 18:57:23 -04:00
if test "$with_openssl" = no; then
cf_result="explicitly disabled"
elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "OpenSSL"; then
cf_result="not used, because $chosen_ssl_library was chosen"
2005-09-15 09:58:31 -04:00
else
2009-05-22 18:57:23 -04:00
cf_result=no
for ssldir in "$with_openssl" "" /usr /usr/local/openssl \
2005-09-15 09:58:31 -04:00
/usr/lib/openssl /usr/local/ssl \
/usr/local/www /usr/lib/ssl /usr/local \
/usr/pkg /opt /opt/openssl; do
if test "$cf_result" = no; then
if test -d "$ssldir"; then
OPENSSL_CFLAGS="-I$ssldir/include"
LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
# # FIXME: This created serious portability problems. --pasky
# if test "$CC" == "gcc"; then
# # I'm not sure about compatibility here. --pasky
# LIBS="$LIBS -R$ssldir/lib"
# fi
else
LIBS="-lssl -lcrypto $LIBS_X"
fi
2007-07-05 09:03:59 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[OpenSSL_add_all_algorithms()]])],[cf_result=yes],[cf_result=no])
2005-09-15 09:58:31 -04:00
if test "$cf_result" != yes; then
2007-07-05 09:03:59 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[SSLeay_add_ssl_algorithms()]])],[cf_result=yes],[cf_result=no])
2005-09-15 09:58:31 -04:00
fi
fi
done
if test "$cf_result" != yes; then
2009-05-22 18:57:23 -04:00
if test "${with_openssl-no}" != "no"; then
2005-09-15 09:58:31 -04:00
AC_MSG_ERROR([OpenSSL not found])
fi
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
2009-05-22 18:57:23 -04:00
chosen_ssl_library="OpenSSL"
2005-09-15 09:58:31 -04:00
CFLAGS="$CFLAGS_X"
AC_SUBST(OPENSSL_CFLAGS)
fi
fi
AC_MSG_RESULT($cf_result)
2008-02-17 11:40:19 -05:00
# ---- GNU TLS
2005-09-15 09:58:31 -04:00
2009-05-22 18:57:23 -04:00
# GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
# to GPLv3+. Don't link that with the GPLv2 ELinks.
# ELinks will use its internal MD5 code instead.
CONFIG_GNUTLS_OPENSSL_COMPAT=no
2005-09-15 09:58:31 -04:00
2009-05-22 18:57:23 -04:00
if test "$with_gnutls" = no; then
2009-05-21 15:52:57 -04:00
AC_MSG_CHECKING([[for GNUTLS]])
AC_MSG_RESULT([[explicitly disabled]])
2005-09-15 09:58:31 -04:00
2009-05-22 18:57:23 -04:00
elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "GNUTLS"; then
AC_MSG_CHECKING([[for GNUTLS]])
AC_MSG_RESULT([[not used, because $chosen_ssl_library was chosen]])
2005-09-15 09:58:31 -04:00
2009-05-21 15:52:57 -04:00
else
cf_result=no
AC_MSG_CHECKING([[for GNUTLS (1.2 or later) in pkg-config]])
2014-03-08 08:01:07 -05:00
if $PKG_CONFIG --atleast-version=1.2 gnutls; then
GNUTLS_CFLAGS=`$PKG_CONFIG --cflags gnutls`
GNUTLS_LIBS=`$PKG_CONFIG --libs gnutls`
2009-05-21 15:52:57 -04:00
AC_MSG_RESULT([[yes: $GNUTLS_CFLAGS $GNUTLS_LIBS]])
EL_SAVE_FLAGS
LIBS="$GNUTLS_LIBS $LIBS"
CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
2009-05-30 05:03:04 -04:00
# Verify if it's really usable. gnutls_session was
# renamed to gnutls_session_t before GNU TLS 1.2.0
# (on 2004-06-13); ELinks now requires this.
AC_MSG_CHECKING([[whether GNUTLS can be linked with]])
2009-05-21 15:52:57 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]],
[[gnutls_session_t dummy;
2009-05-30 05:03:04 -04:00
gnutls_check_version(NULL)]])],
2009-05-21 15:52:57 -04:00
[cf_result=yes],
[cf_result=no])
2009-05-30 05:03:04 -04:00
AC_MSG_RESULT([[$cf_result]])
if test "$cf_result" = yes; then
# According to gnutls/NEWS, the function was originally
# added as gnutls_set_default_priority2 in GNUTLS 2.1.4
# (released 2007-10-27) and then renamed to
# gnutls_priority_set_direct in GNUTLS 2.1.7 (released
# 2007-11-29).
AC_CHECK_FUNCS([gnutls_priority_set_direct])
2017-11-14 10:02:22 -05:00
AC_CHECK_FUNCS([gnutls_certificate_set_x509_system_trust])
2009-05-30 05:03:04 -04:00
fi
2009-05-21 15:52:57 -04:00
EL_RESTORE_FLAGS
2009-05-30 05:03:04 -04:00
else
AC_MSG_RESULT([[$cf_result]])
2009-05-21 15:52:57 -04:00
fi
2005-09-15 09:58:31 -04:00
2009-05-21 15:52:57 -04:00
if test "$cf_result" = yes; then
EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
2009-05-22 18:57:23 -04:00
chosen_ssl_library="GNUTLS"
2005-09-15 09:58:31 -04:00
2011-04-28 12:02:00 -04:00
# gcry_create_nounce is part of libgcrypt
LIBGCRYPT_CFLAGS=`libgcrypt-config --cflags`
LIBGCRYPT_LIBS=`libgcrypt-config --libs`
LIBS="$LIBGCRYPT_LIBS $GNUTLS_LIBS $LIBS"
AC_SUBST(LIBGCRYPT_CFLAGS)
2009-05-21 15:52:57 -04:00
AC_SUBST(GNUTLS_CFLAGS)
2005-09-15 09:58:31 -04:00
2009-05-21 15:52:57 -04:00
elif test "${with_gnutls-no}" != "no"; then
AC_MSG_ERROR([[GNUTLS (1.2 or later) not found. ELinks no longer supports GNUTLS 1.1.]])
2005-09-15 09:58:31 -04:00
fi
fi
2017-11-12 07:41:31 -05:00
# ========
# libevent
# ========
2017-11-17 11:33:51 -05:00
CONFIG_LIBEV=no
2017-11-17 10:34:03 -05:00
AC_ARG_WITH(libev, [ --with-libev compile with libev (libevent compatibility mode)],
[if test "$withval" = yes; then enable_libev=yes; else enable_libev=no; fi])
cf_have_libev=no
if test "$enable_libev" = yes; then
AC_CHECK_HEADERS(event.h libev/event.h)
if test "$ac_cv_header_event_h" = yes -o "$ac_cv_header_libev_event_h"; then
AC_CHECK_LIB(ev, event_loop)
if test "$ac_cv_lib_ev_event_loop" = yes; then
cf_have_libev=yes
2017-11-17 11:33:51 -05:00
EL_CONFIG(CONFIG_LIBEV, [libev])
2017-11-17 10:34:03 -05:00
fi
fi
fi
2017-11-17 11:33:51 -05:00
AC_SUBST(CONFIG_LIBEV)
2017-11-17 10:34:03 -05:00
AC_ARG_WITH(libevent, [ --with-libevent compile with libevent. Note that --with-libev has precedence],
2017-11-12 07:41:31 -05:00
[if test "$withval" = yes; then enable_libevent=yes; else enable_libevent=no; fi])
2017-11-17 11:33:51 -05:00
CONFIG_LIBEVENT=no
2017-11-12 07:41:31 -05:00
cf_have_libevent=no
2017-11-17 10:34:03 -05:00
if test "$enable_libevent" = yes -a "$cf_have_libev" = no; then
AC_CHECK_HEADERS(event.h ev-event.h)
2017-11-12 07:41:31 -05:00
if test "$ac_cv_header_event_h" = yes; then
AC_CHECK_LIB(event, event_loop)
if test "$ac_cv_lib_event_event_loop" = yes; then
2017-11-17 10:34:03 -05:00
cf_have_libevent=yes
2017-11-17 11:33:51 -05:00
EL_CONFIG(CONFIG_LIBEVENT, [libevent])
2017-11-12 07:41:31 -05:00
fi
fi
fi
2017-11-17 11:33:51 -05:00
AC_SUBST(CONFIG_LIBEVENT)
2017-11-17 10:34:03 -05:00
if test "$cf_have_libev" = yes -o "$cf_have_libevent" = yes; then
2017-11-12 07:41:31 -05:00
AC_HAVE_FUNCS(event_base_set event_get_version event_get_method event_base_free event_base_new event_reinit event_base_get_method event_config_set_flag event_get_struct_event_size)
fi
2017-11-17 11:33:51 -05:00
2017-11-17 10:34:03 -05:00
EL_LOG_CONFIG([CONFIG_LIBEV], [[libev]], [[$cf_have_libev]])
2017-11-12 07:41:31 -05:00
EL_LOG_CONFIG([CONFIG_LIBEVENT], [[libevent]], [[$cf_have_libevent]])
2008-02-17 11:40:19 -05:00
# Final SSL setup
2005-09-15 09:58:31 -04:00
2008-09-23 07:27:47 -04:00
EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS CONFIG_NSS_COMPAT_OSSL], [SSL])
2006-01-12 19:40:02 -05:00
AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
2005-09-15 22:24:01 -04:00
AC_SUBST(CONFIG_OPENSSL)
AC_SUBST(CONFIG_GNUTLS)
2008-09-23 07:27:47 -04:00
AC_SUBST(CONFIG_NSS_COMPAT_OSSL)
2005-09-15 09:58:31 -04:00
#endif
AC_MSG_CHECKING([whether to be or not to be])
AC_MSG_RESULT([needs to be determined experimentally])
2008-02-17 11:40:19 -05:00
# ===================================================================
# Check for IPv6 support and related functions.
# ===================================================================
2005-09-15 09:58:31 -04:00
EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
if test "$HAVE_GETADDRINFO" != yes; then
AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
if test "$HAVE_GETADDRINFO" = yes; then
LIBS="$LIBS -linet6"
fi
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Checking for X11 (window title restoring).
# ===================================================================
2005-09-15 09:58:31 -04:00
AC_PATH_X
if test x"$no_x" != xyes; then
2007-07-05 08:34:06 -04:00
EL_SAVE_FLAGS
2005-09-15 09:58:31 -04:00
if test -n "$x_includes"; then
X_CFLAGS="-I$x_includes"
2007-07-05 08:34:06 -04:00
CPPFLAGS="$CPPLAGS $X_CFLAGS"
CFLAGS="$CFLAGS $X_CFLAGS"
2005-09-15 09:58:31 -04:00
fi
if test -n "$x_libraries"; then
LDFLAGS="$LDFLAGS -L$x_libraries"
fi
LIBS="-lX11 $LIBS"
2007-07-05 09:03:59 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize()]])],[cf_result=yes],[cf_result=no])
2007-07-05 08:34:06 -04:00
EL_RESTORE_FLAGS
if test "$cf_result" = yes; then
if test -n "$x_libraries"; then
LDFLAGS="$LDFLAGS -L$x_libraries"
fi
LIBS="-lX11 $LIBS"
EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
AC_SUBST(X_CFLAGS)
fi
2005-09-15 09:58:31 -04:00
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Backtraces displaying support.
# ===================================================================
2005-09-15 09:58:31 -04:00
AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
# possible checks for other system-specific means go here
2008-02-17 11:40:19 -05:00
# ===================================================================
# Gettext grey zone. Beware.
# ===================================================================
2005-09-15 09:58:31 -04:00
2006-10-11 08:39:04 -04:00
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"
2005-09-15 09:58:31 -04:00
AM_GNU_GETTEXT
2010-09-04 08:27:54 -04:00
# iconv is always used
LIBS="$LIBS $LIBICONV"
2005-09-15 09:58:31 -04:00
dnl AC_MSG_CHECKING([how many characters your English alphabet has])
dnl # f33r d4 l33t... I hope it's portable. :)
dnl cf_result=$((48#z - 48#a + 1));
dnl AC_MSG_RESULT($cf_result)
2008-02-17 11:40:19 -05:00
# ===================================================================
# Compile-time features control
# ===================================================================
2005-09-15 09:58:31 -04:00
EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
[ --disable-cookies disable cookie support])
EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
[ --disable-formhist disable form history support])
EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
[ --disable-globhist disable global history support])
EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
[ --disable-mailcap disable mailcap support])
EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
[ --disable-mimetypes disable mimetypes files support])
EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
[HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
[IPv6],
[ --disable-ipv6 disable IPv6 support])
EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
[ --enable-bittorrent enable BitTorrent protocol support])
EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
[ --disable-data disable data protocol support])
EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
[ --disable-uri-rewrite disable URI rewrite support])
EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
[ --enable-cgi enable local CGI support])
EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
[ --enable-finger enable finger protocol support])
2008-02-17 11:40:19 -05:00
# ===================================================================
# FSP protocol
# ===================================================================
2006-01-21 14:46:37 -05:00
EL_SAVE_FLAGS
2006-01-16 05:40:13 -05:00
if test "x${enable_fsp}" != xno; then
2006-01-16 16:03:31 -05:00
AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
2006-01-16 05:40:13 -05:00
2006-01-16 16:03:31 -05:00
if test "$HAVE_FSPLIB" = yes; then
AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
if test "$HAVE_FSPLIB" = yes; then
2006-01-16 05:40:13 -05:00
LIBS="$LIBS -lfsplib"
2006-01-16 16:03:31 -05:00
else
AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
if test "$HAVE_FSPLIB" = yes; then
LIBS="$LIBS -lfsp"
fi
2006-01-16 05:40:13 -05:00
fi
fi
fi
2006-01-16 16:03:31 -05:00
EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
[ --enable-fsp enable FSP protocol support])
2006-01-21 14:46:37 -05:00
if test "x$CONFIG_FSP" = xno; then
EL_RESTORE_FLAGS
fi
2005-09-15 09:58:31 -04:00
EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
[ --disable-ftp disable ftp protocol support])
EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
[ --enable-gopher enable gopher protocol support])
EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
[ --enable-nntp enable nntp protocol support])
2008-02-17 11:40:19 -05:00
# ===================================================================
# SMB protocol support.
# ===================================================================
2007-01-24 12:40:28 -05:00
EL_SAVE_FLAGS
if test "x${enable_smb}" != xno; then
AC_CHECK_HEADERS(libsmbclient.h, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
if test "$HAVE_SMBCLIENT" = yes; then
AC_CHECK_LIB(smbclient, smbc_init, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
if test "$HAVE_SMBCLIENT" = yes; then
LIBS="$LIBS -lsmbclient"
fi
fi
fi
EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [Samba protocol],
[ --enable-smb enable Samba protocol support])
if test "x$CONFIG_SMB" = xno; then
EL_RESTORE_FLAGS
2006-11-18 13:39:01 -05:00
fi
2005-09-15 09:58:31 -04:00
EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
[ --disable-mouse disable mouse support])
# GPM mouse is Linux specific, so ...
CONFIG_SYSMOUSE=yes
EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
[CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
[BSD sysmouse],
[ --disable-sysmouse disable BSD sysmouse support])
EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
2005-10-20 04:21:09 -04:00
[ --enable-88-colors enable 88 color support])
2005-09-15 09:58:31 -04:00
EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
[ --enable-256-colors enable 256 color support])
2006-08-19 17:39:40 -04:00
EL_ARG_ENABLE(CONFIG_TRUE_COLOR, true-color, [true color],
[ --enable-true-color enable true color support])
2005-09-15 09:58:31 -04:00
EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
[ --enable-exmode enable exmode (CLI) interface])
EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
[ --disable-leds disable LEDs support])
EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
[ --disable-marks disable document marks support])
EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
[ --disable-css disable Cascading Style Sheet support])
EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
[ --enable-html-highlight HTML highlighting using DOM engine])
2008-02-17 11:40:19 -05:00
# Everything in the tree already uses CONFIG_DOM
# so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
2005-09-15 09:58:31 -04:00
EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
[ --disable-backtrace disable backtrace support])
EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
[ --enable-no-root enable prevention of usage by root])
EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
[ --enable-debug enable leak debug and internal error checking])
EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
[ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
[ --enable-own-libc force use of internal functions instead of those of system libc])
EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
[ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
2006-09-17 09:12:47 -04:00
EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
2007-12-15 18:06:48 -05:00
[ --disable-utf-8 disable UTF-8 support])
2006-02-02 18:27:01 -05:00
2008-01-19 12:56:50 -05:00
EL_ARG_DEPEND(CONFIG_COMBINE, combining, [CONFIG_UTF8:yes HAVE_WCWIDTH:yes], [Combining characters],
[ --enable-combining support Unicode combining characters (experimental)])
2006-02-02 18:27:01 -05:00
2005-09-15 09:58:31 -04:00
AC_ARG_ENABLE(weehoofooboomookerchoo,
[
Also check out the features.conf file for more information about features!
],
[AC_MSG_ERROR(Are you strange, or what?)])
2009-05-21 10:22:12 -04:00
# ===================================================================
# Decide whether to use TRE
# ===================================================================
#
# This must be done after the CONFIG_UTF8 check above.
# The first part of the TRE check is separate, to get
# the configure --help output in a sensible order.
2009-06-10 17:47:33 -04:00
#
# After this section, nothing else must be added to the
# beginning of $LIBS.
2009-05-21 10:22:12 -04:00
if test "$tre_log" = "available"; then
if test "$CONFIG_UTF8" = "yes"; then
# When CONFIG_UTF8 and CONFIG_TRE are both defined,
# src/viewer/text/search.c makes a string of
# unicode_val_T and gives it to regwexec(), which
# expects a string of wchar_t. If the unicode_val_T
# and wchar_t types are too different, this won't
# work, so try to detect that and disable regexp
# operations entirely in that case.
#
# Currently, this code only compares the sizes of the
# types. src/intl/charsets.h defines unicode_val_T as
# uint32_t, so we check whether wchar_t has exactly 32
# bits. But don't use AC_CHECK_SIZEOF for this, because
# there doesn't seem to be a documented way to get the
# result of that for use in the configure script.
#
# C99 says the implementation can define
# __STDC_ISO_10646__ if wchar_t values match ISO 10646
# (or Unicode) numbers in all locales. Do not check
# that macro here, because it is too restrictive: it
# should be enough for ELinks if the values match in
# the locales where ELinks is actually run.
AC_MSG_CHECKING([[whether wchar_t is exactly 32-bit]])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <limits.h>
#include <stddef.h>
int dummy[(sizeof(wchar_t) * CHAR_BIT == 32) ? 1 : -1];]], [])],
[AC_MSG_RESULT([[yes]])
tre_log="TRE"],
[AC_MSG_RESULT([[no]])
tre_log="no (unsuitable wchar_t)"])
else
# If UTF-8 is not used, then wchar_t doesn't matter.
tre_log="TRE"
fi
fi
if test "$tre_log" = "TRE"; then
AC_DEFINE([CONFIG_TRE], [1],
[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.])
# TRE_CFLAGS will be used only where needed.
2009-06-10 17:47:33 -04:00
#
# Bug 1081: If both TRE and libc define the regfree function,
# ELinks needs to use the version defined by TRE because
# that's the one compatible with regex_t initialized by the
# regwcomp function of TRE. Therefore put $TRE_LIBS at the
# very beginning of $LIBS so that the linker hopefully finds
# regfree there before it examines libc. In particular,
# $PERL_LIBS appears to often include "-lc".
#
# This scheme still risks a crash if ELinks is linked with
# some static library that uses GNU <regex.h> extensions that
# TRE does not implement. For example, the library might call
# re_compile_pattern, which is found in GNU libc, and then
# regfree, which is found in TRE and probably crashes with the
# GNU-initialized regex_t. Ways to avoid such crashes:
#
# - Change TRE so it defines only tre_... functions and does
# not attempt to override the POSIX names by default.
#
# - Change ELinks to access TRE only via dlopen and dlsym.
# The problem then is how to find the correct file name.
# There might be libtre.so.4 and libtre.so.5 with different
# ABI. How can this configure script detect which of them
# matches the <tre/regex.h> in the include path?
#
# - Replace the static library with a shared library. At
# least on GNU/Linux, when the shared library is built, the
# linker should note that e.g. regfree is defined in libc
# and has the GLIBC_2.0 version there, and write that
# version string to the shared library as well; because TRE
# does not provide regfree with that version, any regfree
# calls at run time should then get resolved to libc.
LIBS="$TRE_LIBS $LIBS"
2009-05-21 10:22:12 -04:00
else
TRE_LIBS=
TRE_CFLAGS=
fi
AC_SUBST(TRE_CFLAGS)
AC_SUBST(TRE_LIBS)
2009-05-22 15:18:54 -04:00
EL_LOG_CONFIG([CONFIG_TRE], [[Regexp searching]], [[$tre_log]])
2009-05-21 10:22:12 -04:00
2016-12-03 13:06:03 -05:00
# ===================================================================
# libdom
# ===================================================================
LIBDOM_CFLAGS=
LIBDOM_LIBS=
CONFIG_LIBDOM=no
enable_libdom=no
AC_ARG_WITH(libdom, [ --with-libdom enable libdom],
[ if test "x$withval" != xno; then enable_libdom=yes; fi ])
if test "$enable_libdom" = no; then
AC_MSG_CHECKING([[for libdom]])
AC_MSG_RESULT([[disabled]])
else
AC_MSG_CHECKING([[for libdom in pkg-config]])
if $PKG_CONFIG libdom; then
LIBDOM_CFLAGS=`$PKG_CONFIG --cflags libdom`
LIBDOM_LIBS=`$PKG_CONFIG --libs libdom`
LIBS="$LIBDOM_LIBS $LIBS"
CONFIG_LIBDOM=yes
2016-12-11 10:52:44 -05:00
AC_DEFINE([CONFIG_LIBDOM], [1], [Define as 1 to use the libdom library.])
2016-12-03 13:06:03 -05:00
AC_MSG_RESULT([[yes]])
else
enable_libdom=no
fi
fi
AC_SUBST(LIBDOM_CFLAGS)
AC_SUBST(LIBDOM_LIBS)
EL_LOG_CONFIG([CONFIG_LIBDOM], [[libdom]], [[$enable_libdom]])
2009-05-21 10:22:12 -04:00
2008-08-17 15:08:36 -04:00
# ===================================================================
# Further LDFLAGS tweaks
# ===================================================================
2008-02-17 11:40:19 -05:00
# == EMX hack
2005-09-15 09:58:31 -04:00
2006-01-11 14:10:26 -05:00
test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
2005-09-15 09:58:31 -04:00
2008-08-17 15:08:36 -04:00
# Check for -rdynamic
#
# gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
# the executable to its dynamic symbol table. ELinks uses this for
# two purposes:
#
# 1. If ELinks detects a bug, it can try to display a backtrace by
# calling backtrace_symbols_fd() in the GNU libc. The glibc-2.3.6
# manual states users of GNU ld must pass -rdynamic to make the
# symbols available to the program.
#
# 2. It would eventually be nice to dynamically load shared
# libraries as plugins (bug 73). The plugins must be able to
# call ELinks functions. This can be implemented either by
# registering all callable functions in ELinks-specific data
# structures, or by letting the dynamic linker handle them.
# The latter way requires something equivalent to -rdynamic.
#
# Because backtraces are not needed for correct operation, and bug
# 73 is not yet being fixed, the configure script and makefiles
# should not complain to the user if they find that -rdynamic does
# not work. Besides, it was reported at elinks-users on 2006-09-12
# that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
# Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
# -rdynamic but does something equivalent automatically. (This was
# tested with "nm -D elinks | grep redraw_from_window".)
#
# With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
# -dynamic"; then, cc proceeds anyway, but the option can prevent the
# linker from finding the libraries listed in -l operands. So this
# -rdynamic check needs to happen after the libraries have already
# been added to $LDFLAGS.
AC_MSG_CHECKING([for -rdynamic])
LDFLAGS_X="$LDFLAGS"
LDFLAGS="-rdynamic $LDFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
AC_MSG_RESULT($have_rdynamic)
2008-02-17 11:40:19 -05:00
# ===================================================================
# Export directory paths
# ===================================================================
2005-09-15 09:58:31 -04:00
# Set up the ``entry points'' if they were not supplied by builder
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
# Create CONFDIR #define for config.h
# XXX: This may be dependent on a particular version of autoconf. Whatever,
# it's autoconf fault to force us to do such hacks ;p.
if test x"$sysconfdir" = x"\${prefix}/etc"; then
# sysconfdir is set to its default value... fine, let's append /elinks/
# XXX: We can't modify listing of the default in ./configure --help :-(
sysconfdir_n=`eval echo "$sysconfdir"`
sysconfdir=$sysconfdir_n
(echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
sysconfdir="$sysconfdir/elinks"
fi
CONFDIR=$sysconfdir
AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
AC_SUBST(CONFDIR)
# Create LOCALEDIR #define for config.h
LOCALEDIR=`eval echo "$datadir/locale"`
2006-07-21 08:08:24 -04:00
while echo "$LOCALEDIR" | grep "\\$"
do
LOCALEDIR=`eval echo "$LOCALEDIR"`
done > /dev/null 2> /dev/null
2005-09-15 09:58:31 -04:00
AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
AC_SUBST(LOCALEDIR)
# Create LIBDIR #define for config.h
LIBDIR=`eval echo "$libdir"`
AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
AC_SUBST(LIBDIR)
EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
2008-07-12 12:04:40 -04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
]], [[#if !defined(__TINYC__) || !defined(alloca)
#error not tcc
#endif ]])],[cf_result=yes],[cf_result=no])
if test "$cf_result" = "yes"; then
AC_DEFINE([HAVE_ALLOCA])
2008-07-15 15:53:26 -04:00
AC_DEFINE([_ALLOCA_H], [1], [Define as 1 if you are using Tiny C Compiler
with the GNU C Library, and <alloca.h> of glibc would otherwise
override the alloca macro defined in <stddef.h> of TCC.
If <alloca.h> of glibc sees the _ALLOCA_H macro, it assumes
it has already been included, and does not redefine alloca.
This might not work in future glibc versions though, because
the names of the #include guard macros are not documented.
The incompatibility has been reported to the tinycc-devel
mailing list on 2008-07-14. If a future version of TCC provides
an <alloca.h> of its own, this hack won't be needed.])
2008-07-12 12:04:40 -04:00
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# A little fine tuning of gcc specific options (continued)
# ===================================================================
2005-09-15 09:58:31 -04:00
2011-10-08 06:07:02 -04:00
GETTEXT_CFLAGS=
2007-07-05 09:03:59 -04:00
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
2005-09-15 09:58:31 -04:00
if test "$CONFIG_DEBUG" = "yes"; then
2008-02-17 11:40:19 -05:00
# We want to see all warnings and live with none (in debug mode).
2005-09-15 09:58:31 -04:00
CFLAGS="$CFLAGS -Werror"
fi
2011-10-08 06:07:02 -04:00
GETTEXT_CFLAGS="-Wno-uninitialized"
2005-09-15 09:58:31 -04:00
2005-12-20 16:44:15 -05:00
case "`$CC -dumpversion`" in
2005-09-15 09:58:31 -04:00
3.0|3.1|3.2)
# These should be ok using -Werror
;;
3.*)
# If gcc is version 3.3 (or higher?) it emits lots of false positive
# "dereferencing type-punned pointer will break strict-aliasing rules"
# warnings. Disable them by not doing any strict-aliasing. The
# alternative is just too ugly. Thanks gcc guys!! ;)
CFLAGS="$CFLAGS -fno-strict-aliasing"
;;
2010-07-04 07:32:06 -04:00
4.5*)
CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign -Wno-enum-compare"
;;
2017-11-11 10:26:21 -05:00
4.*|5.*|6.*|7.*)
2005-09-15 09:58:31 -04:00
# Do not show warnings related to (char * | unsigned char *) type
2007-02-22 03:59:25 -05:00
# difference.
CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
2005-09-15 09:58:31 -04:00
;;
*)
# These should be ok using -Werror
;;
esac
2007-02-22 03:59:25 -05:00
2007-09-24 03:17:19 -04:00
# GCC 4.2.1 warns if we use the address of an object in Boolean context:
# warning: the address of `builtin_modules' will always evaluate as `true'
# This hits the object_lock and foreach_module macros in particular.
# It would be okay to put something in the macros to avoid the warning,
# but currently this seems to require defining parallel macros that skip
# the NULL check, and that's too ugly. So we instead disable the warning.
# GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
# GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
for warning_flag in -Wno-address -Wno-always-true; do
AC_MSG_CHECKING([whether $CC accepts $warning_flag])
EL_SAVE_FLAGS
CFLAGS="$CFLAGS $warning_flag"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[AC_MSG_RESULT([yes])
break],
[AC_MSG_RESULT([no])])
EL_RESTORE_FLAGS
done
2008-05-04 04:20:55 -04:00
# Bug 1012: Some parts of ELinks do arithmetic with signed integers
# in such a way that an overflow is possible. GCC 4.2.1 warns
# "warning: assuming signed overflow does not occur when assuming
# that (X + c) > X is always true", which may be an incorrect
# optimization (although allowed by the standard), and breaks the
# build with -Werror.
#
# All of the following tests included -S -Wall -Wextra:
#
# GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
# * gcc-4.0 -O0: OK, compares the values
# * gcc-4.0 -O2: assumes no overflow, does not warn
# * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
# * gcc-4.0 -O0 -fwrapv: OK, compares the values
# * gcc-4.0 -O2 -fwrapv: OK, compares the values
# * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
# * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
# * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
# * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
#
# GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
# * gcc-4.1 -O0: assumes no overflow, does not warn
# * gcc-4.1 -O2: assumes no overflow, does not warn
# * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
# * gcc-4.1 -O0 -fwrapv: OK, compares the values
# * gcc-4.1 -O2 -fwrapv: OK, compares the values
# * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
# * gcc-4.1 -O2 -ftrapv: compares the values
# * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
# * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
#
# GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
# * gcc-4.2 -O0: OK, compares the values
# * gcc-4.2 -O2: assumes no overflow, warns about it
# * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
# * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
# * gcc-4.2 -O0 -fwrapv: OK, compares the values
# * gcc-4.2 -O2 -fwrapv: OK, compares the values
# * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
# * gcc-4.2 -O2 -ftrapv: compares the values
# * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
# * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
#
# Apparently, -ftrapv does not work reliably at all.
for overflow_flag in -fno-strict-overflow -fwrapv; do
AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
EL_SAVE_FLAGS
CFLAGS="$CFLAGS $overflow_flag"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[AC_MSG_RESULT([yes])
break],
[AC_MSG_RESULT([no])])
EL_RESTORE_FLAGS
done
2005-09-15 09:58:31 -04:00
fi
2011-10-08 06:07:02 -04:00
AC_SUBST(GETTEXT_CFLAGS)
2006-11-22 14:13:39 -05:00
EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
EL_LOG_CONFIG(CPPFLAGS, [Preprocessor flags (CPPFLAGS)], [])
EL_LOG_CONFIG(LDFLAGS, [Linker flags (LDFLAGS)], [])
EL_LOG_CONFIG(LIBS, [Library flags (LIBS)], [])
2005-09-15 09:58:31 -04:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Colored make output
# ===================================================================
2005-12-15 02:44:15 -05:00
2009-08-14 18:18:20 -04:00
if test $(`which tput` colors 2> /dev/null || echo 0) -ge 4; then
2005-12-15 02:44:15 -05:00
MAKE_COLOR=1
AC_SUBST(MAKE_COLOR)
fi
2008-02-17 11:40:19 -05:00
# ===================================================================
# Generated files
# ===================================================================
2005-09-15 09:58:31 -04:00
2007-07-05 09:03:59 -04:00
AC_CONFIG_FILES([ \
2005-09-15 15:03:56 -04:00
Makefile.config \
2005-09-15 09:58:31 -04:00
contrib/elinks.spec \
contrib/lua/hooks.lua \
contrib/conv/w3m2links.awk \
2007-08-08 08:23:21 -04:00
doc/Doxyfile \
2005-09-17 14:43:57 -04:00
doc/man/man1/elinks.1 \
2005-09-15 09:58:31 -04:00
src/intl/gettext/ref-add.sed \
2005-09-16 07:36:47 -04:00
src/intl/gettext/ref-del.sed
2005-09-15 09:58:31 -04:00
])
2007-07-05 09:03:59 -04:00
AC_OUTPUT
2005-09-15 09:58:31 -04:00
2005-10-25 11:33:01 -04:00
abs_srcdir="$(cd "$srcdir" && pwd)"
# builddir is always absolute!
if test "$abs_srcdir" != "$builddir"; then
2006-01-15 12:49:44 -05:00
# Bootstrap the Makefile creation
2005-10-25 18:34:13 -04:00
echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
2006-01-15 16:23:39 -05:00
"$MAKE" "SRC=$abs_srcdir" init
2006-01-15 12:49:44 -05:00
# Make cg-status ignore this build directory
echo "*" > "$builddir/.gitignore"
2005-10-19 21:49:40 -04:00
fi
2005-10-22 07:25:28 -04:00
2008-02-17 11:40:19 -05:00
# ===================================================================
# Configuration summary
# ===================================================================
2005-09-15 09:58:31 -04:00
AC_MSG_RESULT(The following feature summary has been saved to features.log)
cat features.log