1
0
Fork 0
elinks/configure.ac

1896 lines
63 KiB
Plaintext
Raw Normal View History

dnl Process this file with autoconf to produce a configure script.
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.
dnl Autoconf 2.13 generates an incomplete config.h.in; see ELinks bug 936.
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)
AC_INIT
AC_CONFIG_SRCDIR([src/main/main.c])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([config/m4])
PACKAGE=elinks
VERSION=0.14.GIT
AC_SUBST(PACKAGE)
2005-09-16 11:45:59 +00:00
AC_SUBST(VERSION)
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
2005-09-16 11:45:59 +00:00
AC_CONFIG_HEADERS(config.h)
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])
AC_USE_SYSTEM_EXTENSIONS
MAKE=
for make in gnumake gmake make false; do
if test "x$MAKE" = x; then
AC_PATH_PROGS(MAKE, "$make")
fi
done
builddir="`pwd`"
# Cleanup if we are configuring with a previous build in the tree
if test -e Makefile.config; then
AC_MSG_CHECKING([for previous build to clean])
"$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
AC_MSG_RESULT(done)
fi
# ===================================================================
# Load feature configuration file and start logging features.
# ===================================================================
features="features.conf"
test -f "$srcdir/$features" && . "$srcdir/$features"
test -f "$builddir/$features" && . "$builddir/$features"
echo "Feature summary:" > features.log
# ===================================================================
# Checks for programs.
# ===================================================================
AC_PROG_CC
AC_CHECK_TOOL([LD], [ld])
AC_PROG_AWK
AC_PATH_PROGS(AWK, "$AWK")
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PATH_PROGS(GIT, "git")
AC_PATH_PROGS(SPARSE, "sparse")
PKG_PROG_PKG_CONFIG
CONFIG_ASCIIDOC="no"
CONFIG_POD2HTML="no"
CONFIG_XMLTO="no"
CONFIG_JW="no"
if test "x$CONFIG_DOC" != xno; then
2020-01-04 19:12:34 +00:00
AC_PATH_PROGS(PYTHON3, "python3")
if test "x$PYTHON3" != "x"; then
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
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
fi
AC_SUBST(CONFIG_ASCIIDOC)
AC_SUBST(CONFIG_DOXYGEN)
AC_SUBST(CONFIG_POD2HTML)
AC_SUBST(CONFIG_XMLTO)
AC_SUBST(CONFIG_JW)
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])
EL_CONFIG_DEPENDS(CONFIG_APIDOCS, [CONFIG_DOXYGEN], [API Documentation])
# gcc specific options (to be continued at the bottom of configure)
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
# 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.
CFLAGS="$CFLAGS -Wall"
fi
# ===================================================================
# Checks for special OSes.
# ===================================================================
dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
AC_DEFUN([EL_CHECK_COMPILER_MACROS],
[
AC_MSG_CHECKING([for $2])
for flag in $3; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef $flag
kill me!
#endif ]])],[$1=yes],[$1=no])
if test "[$]$1" = yes; then
EL_CONFIG([$1], [$2])
break
fi
done
AC_MSG_RESULT([$]$1)
])
2006-01-11 19:12:59 +00:00
EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
AC_SUBST(CONFIG_OS_BEOS)
2006-01-11 19:10:26 +00:00
EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
AC_SUBST(CONFIG_OS_RISCOS)
2006-01-11 19:10:27 +00:00
EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
AC_SUBST(CONFIG_OS_WIN32)
2006-01-11 19:10:26 +00: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"`
AC_MSG_CHECKING([for UNIX])
dnl FIXME: some depend kind of mechanism
2006-01-11 19:12:59 +00:00
if test "$CONFIG_OS_BEOS" = no && \
2006-01-11 19:10:26 +00:00
test "$CONFIG_OS_RISCOS" = no && \
2006-01-11 19:10:27 +00:00
test "$CONFIG_OS_WIN32" = no && \
2006-01-11 19:10:26 +00:00
test "$CONFIG_OS_OS2" = no; then
2006-01-11 19:10:27 +00:00
EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
else
2006-01-11 19:10:27 +00:00
CONFIG_OS_UNIX=no
fi
2006-01-11 19:10:27 +00:00
AC_MSG_RESULT($CONFIG_OS_UNIX)
AC_SUBST(CONFIG_OS_UNIX)
# ===================================================================
# Checks for header files.
# ===================================================================
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
2008-01-02 11:29:26 +00:00
AC_CHECK_HEADERS(wchar.h wctype.h)
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)
AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/in6_var.h)
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/socket.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(sys/utsname.h)
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
]])
AC_CHECK_HEADERS(stdint.h inttypes.h)
AC_CHECK_HEADERS(locale.h pwd.h)
AC_CHECK_HEADERS(termios.h)
AC_CHECK_HEADERS(poll.h)
AC_CHECK_HEADERS(sys/un.h,
[CONFIG_INTERLINK=yes
EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
[CONFIG_INTERLINK=no])
AC_SUBST(CONFIG_INTERLINK)
# ===================================================================
# Checks for typedefs, structures, and compiler characteristics.
# ===================================================================
AC_STRUCT_TM
AC_C_CONST
AC_C_INLINE
AC_MSG_CHECKING([[for C99-conforming inline]])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2016-04-24 15:23:36 +00:00
#ifdef __cplusplus
#error noinline
#endif
int add(int change);
static int sum;
inline int
add(int change)
{
sum += change;
return sum;
}
int
sub(int change)
{
return add(-change);
}]])],
[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], [])])
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, [])
EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
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)
test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
# Check for variadic macros
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");])
# ===================================================================
# Checks for library functions.
# ===================================================================
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(strptime)
AC_CHECK_FUNCS(atoll gethostbyaddr herror strerror)
AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
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)
AC_CHECK_FUNCS(setitimer, HAVE_SETITIMER=yes)
AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
AC_CHECK_FUNCS(unsetenv)
AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
AC_CHECK_FUNCS(wcwidth, HAVE_WCWIDTH=yes)
2008-01-02 11:29:26 +00:00
AC_CHECK_FUNCS(fork)
# 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
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 16:18:32 +00:00
AC_CHECK_FUNCS(fpathconf, HAVE_FPATHCONF=yes)
AC_CHECK_FUNCS(poll, HAVE_POLL=yes)
if test x"$HAVE_RAISE" = x; then
if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
AC_MSG_ERROR([Unable to emulate raise()])
fi
fi
AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
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])])
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,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#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"); }
]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
fi
# OpenSSL and Lua frequently need dlopen
AC_CHECK_LIB(dl, dlopen)
# ===================================================================
# Checks for libraries.
# ===================================================================
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
# ===================================================================
# Checks for packaging specific options.
# ===================================================================
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 ])
# ===================================================================
# Checks for a libraries, optional even if installed.
# ===================================================================
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
# 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
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" &&
test "x[$]WITHVAL_$1" != xno; then
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],
[
if test "x[$]$1" != xno; then $1=yes; fi
WITHVAL_$1=
AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
if test "x[$]WITHVAL_$1" = xyes; then $1=yes; fi
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 19:48:15 +00:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_TERMINFO, terminfo, term.h, tinfo, setupterm,
[ --with-terminfo enable terminfo support])
# 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.
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
[ --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 20:38:06 +00:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BROTLI, brotli, brotli/decode.h, brotlidec, BrotliDecoderDecompressStream,
[ --with-brotli enable experimental brotli support])
2019-07-14 16:54:39 +00:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_ZSTD, zstd, zstd.h, zstd, ZSTD_createDCtx,
[ --with-zstd enable experimental zstd support])
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
[ --without-idn disable international domain names support])
2009-02-22 12:58:55 +00:00
# LZMA disabled by default, because of little usability and compilation problems
# with new xz
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
[ --with-lzma enable lzma encoding support])
# ===================================================================
# Check for GSSAPI, optional even if installed.
# ===================================================================
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 16:33:51 +00:00
EL_CONFIG(CONFIG_GSSAPI, [GssApi])
else
AC_MSG_RESULT(no)
fi
AC_SUBST(CONFIG_GSSAPI)
# ===================================================================
# Bookmark and XBEL support
# ===================================================================
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
# ===================================================================
# Checks for BSD sysmouse
# ===================================================================
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"])
# ===================================================================
# Checks for OS/2
# ===================================================================
2006-01-11 19:10:26 +00:00
if test "$CONFIG_OS_OS2" = yes; then
EL_CONFIG_OS_OS2
fi
# ===================================================================
# Checks for Win32
# ===================================================================
2006-01-11 19:10:27 +00:00
if test "$CONFIG_OS_WIN32" = yes; then
EL_CONFIG_OS_WIN32
fi
# ===================================================================
# Check for SpiderMonkey, optional even if installed.
# ===================================================================
# 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=
EL_SAVE_FLAGS
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
for package in mozjs-17.0; do
if test -n "$CONFIG_SPIDERMONKEY"; then
break
else
AC_MSG_CHECKING([for SpiderMonkey (mozjs-17.0) in pkg-config $package])
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)"
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>
]], [])],
[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
fi
done
if test -z "$CONFIG_SPIDERMONKEY"; then
# Didn't find SpiderMonkey anywhere.
CONFIG_SPIDERMONKEY=no
fi
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.])
fi
EL_RESTORE_FLAGS
if test "x$CONFIG_SPIDERMONKEY" = xyes; then
EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
else
CONFIG_ECMASCRIPT_SMJS=no
fi
EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
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)
# ===================================================================
# Optional Spidermonkey-based ECMAScript browser scripting
# ===================================================================
AC_ARG_ENABLE(sm-scripting,
[ --disable-sm-scripting ECMAScript browser scripting (requires Spidermonkey)],
[if test "$enableval" != no; then enableval="yes"; fi
2006-01-11 13:14:11 +00:00
CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
if test "x$CONFIG_SPIDERMONKEY" = xyes &&
2006-01-11 13:14:11 +00:00
test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
else
2006-01-11 13:14:11 +00:00
CONFIG_SCRIPTING_SPIDERMONKEY=no
fi
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)
fi
# ===================================================================
# Check for Guile, optional even if installed.
# ===================================================================
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 13:10:41 +00:00
EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
AC_SUBST(GUILE_CFLAGS)
cat <<EOF
***********************************************************************
The Guile support is incomplete and not so well integrated to ELinks
2006-02-11 18:37:57 +00:00
yet. That means, e.g., that you have no Guile console and there might
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
# ===================================================================
# Check for Perl
# ===================================================================
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"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <EXTERN.h>
#include <perl.h>
#include <perlapi.h>
]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
fi
if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
AC_MSG_CHECKING([whether POPpx works without an n_a variable])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <EXTERN.h>
#include <perl.h>
extern PerlInterpreter *my_perl;
]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
[Define if using Perl 5.8.8 or later, where the "POPpx" macro
no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS
else
2006-01-11 13:07:17 +00:00
EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
CFLAGS="$CFLAGS_X"
2007-02-17 17:08:00 +00:00
CPPFLAGS="$CPPFLAGS_X"
AC_SUBST(PERL_LIBS)
AC_SUBST(PERL_CFLAGS)
fi
# ===================================================================
# Check for Python
# ===================================================================
enable_python="no";
AC_ARG_WITH(python, [[ --with-python[=DIR] enable Python support]],
[ if test "x$withval" != xno; then enable_python=yes; fi ])
EL_SAVE_FLAGS
cf_result=no
AC_MSG_CHECKING([for Python3])
if test "$enable_python" = "yes"; then
AC_MSG_RESULT(yes);
if test -d "$withval"; then
PYTHON_PATH="$withval:$PATH"
2006-01-29 15:48:33 +00:00
else
PYTHON_PATH="$PATH"
fi
AC_PATH_PROG(PYTHON3, python3, no, $PYTHON_PATH)
if test "$PYTHON3" != no; then
cf_result="yes";
PYTHON_CFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; print("-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True)))'`"
PYTHON_LIBS="`$PYTHON3 -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 15:48:33 +00:00
LIBS="$PYTHON_LIBS $LIBS"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
2006-01-29 15:48:33 +00:00
if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python3])
2006-01-29 15:48:33 +00:00
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_CFLAGS)
2007-02-17 17:12:53 +00:00
CPPFLAGS="$CPPFLAGS_X"
cat <<EOF
***********************************************************************
The Python support is incomplete and not so well integrated to ELinks
yet. That means, e.g., that you have no Python console and there might
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([Python3 not found])
else
AC_MSG_WARN([Python3 support disabled])
2006-01-29 15:48:33 +00:00
fi
fi
else
AC_MSG_RESULT(no);
fi
# ===================================================================
# Check for Lua, optional even if installed.
# ===================================================================
luapkg=
AC_ARG_WITH(luapkg, [ --with-luapkg=name choose Lua version],
[luapkg="$withval"])
AC_MSG_CHECKING([for Lua])
EL_SAVE_FLAGS
cf_result=no
if test -n "$luapkg" && $PKG_CONFIG "$luapkg"; then
LUA_CFLAGS=`$PKG_CONFIG --cflags "$luapkg"`
LUA_LIBS=`$PKG_CONFIG --libs "$luapkg"`
CFLAGS="$CFLAGS_X $LUA_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
LIBS="$LUA_LIBS $LIBS_X"
# Check that it is a compatible Lua version
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lauxlib.h>]
#include <lua.h>
#include <lualib.h>
], [[lua_State *L = luaL_newstate();
luaL_openlibs(L);
lua_pushboolean(L, 1);
lua_close(L);]])],[cf_result=yes],[cf_result=no])
fi
AC_MSG_RESULT($cf_result)
if test "$cf_result" != yes; then
EL_RESTORE_FLAGS
else
2006-01-11 13:06:13 +00:00
EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
AC_CHECK_HEADERS(lauxlib.h)
CFLAGS="$CFLAGS_X"
2007-02-17 17:19:10 +00:00
CPPFLAGS="$CPPFLAGS_X"
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 13:48:00 +00:00
# ===================================================================
# Check for TRE library
# ===================================================================
#
# 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.
#
# tre version 0.8.0 or higher is required which have the "tre_" prefix
# for functions.
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]])
tre_log="no (explicitly disabled)"
else
AC_MSG_CHECKING([[for TRE in pkg-config]])
if $PKG_CONFIG tre; then
TRE_CFLAGS=`$PKG_CONFIG --cflags tre`
TRE_LIBS=`$PKG_CONFIG --libs tre`
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
AC_MSG_CHECKING([[for TRE header and library]])
EL_SAVE_FLAGS
CFLAGS="$TRE_CFLAGS $CFLAGS"
LIBS="$TRE_LIBS $LIBS" # must be first, because of regfree conflict
AC_TRY_LINK([#include <tre/tre.h>],
[regex_t re;
regmatch_t match[1];
tre_regwcomp(&re, L"zap", REG_ICASE);
tre_regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
[AC_MSG_RESULT([[yes]])
tre_log="available"],
[AC_MSG_RESULT([[no]])
tre_log="no (TRE not found)"])
EL_RESTORE_FLAGS
fi
# ===================================================================
# Check for Ruby, optional even if installed.
# ===================================================================
2006-01-11 13:10:51 +00:00
EL_CONFIG_SCRIPTING_RUBY
# ===================================================================
# Setup global scripting
# ===================================================================
2006-01-11 13:14:11 +00: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 13:10:41 +00:00
AC_SUBST(CONFIG_SCRIPTING_GUILE)
2006-01-11 13:06:13 +00:00
AC_SUBST(CONFIG_SCRIPTING_LUA)
2006-01-11 13:07:17 +00:00
AC_SUBST(CONFIG_SCRIPTING_PERL)
2006-01-11 13:10:58 +00:00
AC_SUBST(CONFIG_SCRIPTING_PYTHON)
2006-01-11 13:10:51 +00:00
AC_SUBST(CONFIG_SCRIPTING_RUBY)
2006-01-11 13:14:11 +00:00
AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
AC_SUBST(CONFIG_SCRIPTING)
# ===================================================================
# Check for SSL support.
# ===================================================================
# We by default use OpenSSL, and we always prefer it. However, when GNUTLS
# is enabled, we won't try to use OpenSSL anymore.
# For wiping SSL hooks..
#ifdef CONFIG_SSL
chosen_ssl_library=""
AC_ARG_WITH(gnutls, [[ --without-gnutls disable GNUTLS SSL support]])
AC_ARG_WITH(gnutls, [[ --with-gnutls enable GNUTLS SSL support]],
[case "$with_gnutls" in
"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.]]) ;;