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
2022-07-31 09:33:22 -04:00
VERSION=0.16.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
2019-04-21 06:27:40 -04:00
AC_PROG_CC
2020-10-05 14:14:55 -04:00
AC_PROG_CXX
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"
2020-09-03 12:44:43 -04:00
CONFIG_DBLATEX="no"
2005-09-15 09:58:31 -04:00
if test "x$CONFIG_DOC" != xno; then
2020-01-04 14:12:34 -05:00
AC_PATH_PROGS(PYTHON3, "python3")
if test "x$PYTHON3" != "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
2020-09-03 12:44:43 -04:00
AC_PATH_PROGS(DBLATEX, "dblatex")
if test "x$DBLATEX" != "x"; then
EL_CONFIG(CONFIG_DBLATEX, [dblatex])
EL_CONFIG(MANUAL_DBLATEX, [PDF])
2005-09-15 09:58:31 -04:00
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)
2020-09-03 12:44:43 -04:00
AC_SUBST(CONFIG_DBLATEX)
2005-09-15 09:58:31 -04:00
2020-09-03 12:44:43 -04:00
EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_DBLATEX CONFIG_POD2HTML], [Documentation Tools])
EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_DBLATEX], [Manual Formats])
2006-02-08 14:28:10 -05:00
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
2020-11-09 16:04:48 -05:00
# ===================================================================
# static binary
# ===================================================================
enable_static=no
2020-11-24 13:36:29 -05:00
pkg_config_static=
2020-11-09 16:04:48 -05:00
AC_ARG_WITH(static, [ --with-static enable build of static binary],
[ if test "x$withval" != xno; then enable_static=yes; fi ])
if test "$enable_static" = yes; then
CFLAGS="$CFLAGS -static"
2020-11-24 13:36:29 -05:00
pkg_config_static="--static"
2020-11-09 16:04:48 -05:00
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
2022-05-09 12:53:36 -04:00
EL_CHECK_COMPILER_MACROS(CONFIG_OS_DOS, [DOS], [__DJGPP])
AC_SUBST(CONFIG_OS_DOS)
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 && \
2022-05-10 14:19:42 -04:00
test "$CONFIG_OS_DOS" = 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)
2022-05-08 07:59:24 -04:00
AC_CHECK_HEADERS(libgen.h)
2005-09-15 09:58:31 -04:00
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/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)
2021-01-13 16:02:30 -05:00
AC_CHECK_HEADERS(stdalign.h)
2005-09-15 09:58:31 -04:00
2022-05-09 12:53:36 -04:00
if test "$CONFIG_OS_DOS" = no; then
AC_CHECK_HEADERS(sys/un.h,
[CONFIG_INTERLINK=yes
EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
[CONFIG_INTERLINK=no])
else
CONFIG_INTERLINK=no
fi
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
2019-04-21 06:27:40 -04:00
AC_PROG_GCC_TRADITIONAL
2005-09-15 09:58:31 -04:00
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_STRFTIME
2018-08-25 16:44:11 -04:00
AC_CHECK_FUNCS(strptime)
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)
2022-05-03 09:33:48 -04:00
AC_CHECK_FUNCS(getifaddrs getpwnam inet_aton inet_pton inet_ntop)
2005-09-15 09:58:31 -04:00
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)
2022-01-06 13:51:18 -05:00
AC_CHECK_FUNCS(mkstemps)
2012-05-25 10:13:25 -04:00
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 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])
2022-05-30 15:02:25 -04:00
LIBS="-l$4 $LIBS"
2005-09-15 09:58:31 -04:00
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])
2019-07-14 12:54:39 -04:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_ZSTD, zstd, zstd.h, zstd, ZSTD_createDCtx,
[ --with-zstd enable experimental zstd support])
2020-11-09 15:16:43 -05:00
# ===================================================================
# brotli
# ===================================================================
BROTLI_CFLAGS=
BROTLI_LIBS=
CONFIG_BROTLI=no
enable_brotli=no
AC_ARG_WITH(brotli, [ --with-brotli enable brotli],
[ if test "x$withval" != xno; then enable_brotli=yes; fi ])
if test "$enable_brotli" = no; then
AC_MSG_CHECKING([[for brotli]])
AC_MSG_RESULT([[disabled]])
else
AC_MSG_CHECKING([[for brotli in pkg-config]])
2020-11-24 13:36:29 -05:00
if $PKG_CONFIG $pkg_config_static libbrotlidec; then
BROTLI_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags libbrotlidec`
BROTLI_LIBS=`$PKG_CONFIG $pkg_config_static --libs libbrotlidec`
2020-11-09 15:16:43 -05:00
LIBS="$BROTLI_LIBS $LIBS"
CONFIG_BROTLI=yes
AC_DEFINE([CONFIG_BROTLI], [1], [Define as 1 to use the libbrotli library.])
AC_MSG_RESULT([[yes]])
else
enable_brotli=no
fi
fi
AC_SUBST(BROTLI_CFLAGS)
AC_SUBST(BROTLI_LIBS)
EL_LOG_CONFIG([CONFIG_BROTLI], [[brotli]], [[$enable_brotli]])
2005-09-15 09:58:31 -04:00
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
2020-11-09 15:16:43 -05:00
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
[ --without-idn disable international domain names support])
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
2022-08-21 15:33:13 -04:00
# ===================================================================
# Check for MuJS
# ===================================================================
AC_ARG_WITH([mujs],
[AS_HELP_STRING([--with-mujs],
[enable MuJS engine])])
CONFIG_MUJS=
case "$with_mujs" in
"" | no)
# The user specified --without-mujs.
AC_MSG_CHECKING([for MuJS])
AC_MSG_RESULT([disabled])
CONFIG_MUJS="no"
;;
yes)
;;
*)
;;
esac
if test "x$CONFIG_MUJS" = x; then
AC_MSG_CHECKING([for MuJS in pkg-config])
if $PKG_CONFIG $pkg_config_static --cflags --libs mujs > /dev/null 2>&AS_MESSAGE_LOG_FD; then
DB_LOCALSTORAGE_LIBS="$($PKG_CONFIG $pkg_config_static --libs sqlite3)"
XMLPLUSPLUS_LIBS="$($PKG_CONFIG $pkg_config_static --libs libxml++-5.0)"
MUJS_LIBS="$($PKG_CONFIG $pkg_config_static --libs mujs) $DB_LOCALSTORAGE_LIBS $XMLPLUSPLUS_LIBS"
DB_LOCALSTORAGE_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags sqlite3)"
XMLPLUSPLUS_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libxml++-5.0)"
MUJS_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags mujs) $DB_LOCALSTORAGE_CFLAGS $XMLPLUSPLUS_CFLAGS"
LIBS="$LIBS $MUJS_LIBS $LIBS_X"
CPPFLAGS="$CPPFLAGS_X $MUJS_CFLAGS"
CFLAGS="$CFLAGS $MUJS_CFLAGS"
CONFIG_MUJS=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
2021-11-24 11:15:56 -05:00
# ===================================================================
# Check for QuickJS
# ===================================================================
AC_ARG_WITH([quickjs],
[AS_HELP_STRING([--with-quickjs],
[enable Quickjs engine])])
CONFIG_QUICKJS=
case "$with_quickjs" in
"" | no)
# The user specified --without-quickjs.
AC_MSG_CHECKING([for QuickJS])
AC_MSG_RESULT([disabled])
CONFIG_QUICKJS="no"
;;
yes)
;;
*)
;;
esac
2021-12-21 07:22:44 -05:00
if test "x$CONFIG_QUICKJS" = x; then
2021-11-24 11:15:56 -05:00
AC_MSG_CHECKING([for QuickJS])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <quickjs/quickjs.h>
]], [])],
[CONFIG_QUICKJS=yes
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([not found])]
)
if test "x$CONFIG_QUICKJS" = xyes; then
DB_LOCALSTORAGE_LIBS="$($PKG_CONFIG $pkg_config_static --libs sqlite3)"
XMLPLUSPLUS_LIBS="$($PKG_CONFIG $pkg_config_static --libs libxml++-5.0)"
DB_LOCALSTORAGE_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags sqlite3)"
XMLPLUSPLUS_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libxml++-5.0)"
CFLAGS="$CFLAGS $DB_LOCALSTORAGE_CFLAGS $XMLPLUSPLUS_CFLAGS"
2022-05-26 10:04:16 -04:00
QUICKJS_LIB="/usr/local/lib/quickjs/libquickjs.a"
TMPIFS="$IFS"
IFS=:
for p in "$LIBRARY_PATH"; do
if test -f "$p/quickjs/libquickjs.a"; then
QUICKJS_LIB="$p/quickjs/libquickjs.a"
break
fi
done
IFS="$TMPIFS"
2021-11-24 11:15:56 -05:00
2022-05-26 10:04:16 -04:00
LIBS="$LIBS $DB_LOCALSTORAGE_LIBS $XMLPLUSPLUS_LIBS $QUICKJS_LIB"
2021-11-24 11:15:56 -05:00
else
AC_MSG_RESULT([no])
fi
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],
2021-01-16 05:10:50 -05:00
[AS_HELP_STRING([--with-spidermonkey],
2021-11-04 10:31:54 -04:00
[enable SpiderMonkey Mozilla Javascript engine])])
2011-05-01 14:13:37 -04:00
# 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=
2021-07-09 11:52:15 -04:00
CONFIG_XML=
2022-07-11 15:23:18 -04:00
CONFIG_SCRIPTING_SPIDERMONKEY=
2005-12-24 20:23:54 -05:00
EL_SAVE_FLAGS
2022-07-11 15:23:18 -04:00
# ===================================================================
# Optional Spidermonkey-based ECMAScript browser scripting
# ===================================================================
AC_ARG_ENABLE(sm-scripting,
[ --enable-sm-scripting enable ECMAScript browser scripting],
[if test "$enableval" != no; then enableval="yes"; fi
CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
2011-05-01 14:13:37 -04:00
case "$with_spidermonkey" in
2021-01-16 05:10:50 -05:00
"" | no)
2011-05-01 14:13:37 -04:00
# The user specified --without-spidermonkey.
# That overrides the other SpiderMonkey options.
AC_MSG_CHECKING([for SpiderMonkey])
AC_MSG_RESULT([disabled])
CONFIG_SPIDERMONKEY="no"
;;
2021-01-16 05:10:50 -05:00
yes)
2022-07-11 15:23:18 -04:00
CONFIG_SPIDERMONKEY="yes"
2011-05-01 14:13:37 -04:00
;;
*)
AC_MSG_WARN([This version of ELinks does not support --with-spidermonkey=DIRECTORY.])
;;
esac
2022-07-11 15:23:18 -04:00
SPIDERMONKEY_FOUND=
if test "x$CONFIG_SPIDERMONKEY" = xyes ||
test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
2022-10-01 13:59:24 -04:00
package=mozjs-102
AC_MSG_CHECKING([for SpiderMonkey (mozjs-102) in pkg-config $package])
2022-07-11 15:23:18 -04:00
if $PKG_CONFIG $pkg_config_static --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then
DB_LOCALSTORAGE_LIBS="$($PKG_CONFIG $pkg_config_static --libs sqlite3)"
XMLPLUSPLUS_LIBS="$($PKG_CONFIG $pkg_config_static --libs libxml++-5.0)"
SPIDERMONKEY_LIBS="$($PKG_CONFIG $pkg_config_static --libs $package) $DB_LOCALSTORAGE_LIBS $XMLPLUSPLUS_LIBS"
DB_LOCALSTORAGE_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags sqlite3)"
XMLPLUSPLUS_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libxml++-5.0)"
SPIDERMONKEY_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags $package) $DB_LOCALSTORAGE_CFLAGS $XMLPLUSPLUS_CFLAGS"
LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
SPIDERMONKEY_FOUND=yes
AC_MSG_RESULT([yes])
2011-05-01 14:13:37 -04:00
else
2022-07-11 15:23:18 -04:00
AC_MSG_RESULT([no])
2005-12-24 20:23:54 -05:00
fi
2022-07-11 15:23:18 -04:00
fi
2011-05-01 14:13:37 -04:00
2022-07-11 15:23:18 -04:00
if test -z "$SPIDERMONKEY_FOUND"; then
2011-05-01 14:13:37 -04:00
# Didn't find SpiderMonkey anywhere.
CONFIG_SPIDERMONKEY=no
2022-07-11 15:23:18 -04:00
CONFIG_SCRIPTING_SPIDERMONKEY=no
2005-12-24 20:23:54 -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
2021-07-21 15:29:58 -04:00
CONFIG_XML=yes
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
2022-08-21 15:33:13 -04:00
EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SMJS CONFIG_MUJS CONFIG_QUICKJS CONFIG_SCRIPTING_SPIDERMONKEY], [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)
2022-07-11 15:23:18 -04:00
if test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
2006-01-11 08:14:11 -05:00
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