2006-08-28 18:03:34 +08:00
#
# This file is the main build configuration file for fish. It is used
2006-10-31 10:06:56 +08:00
# to determine your systems capabilities, and tries to adapt fish to
2006-08-28 18:03:34 +08:00
# take maximum advantage of the services your system offers.
#
2006-10-31 10:06:56 +08:00
# Process this file using the 'autoconf' command to produce a working
2006-08-28 18:03:34 +08:00
# configure script, which should in turn be executed in order to
2006-10-31 10:06:56 +08:00
# configure the build process.
2006-08-28 18:03:34 +08:00
#
2013-06-24 18:15:47 +08:00
m4_syscmd([build_tools/git_version_gen.sh 2>/dev/null])
2013-09-06 10:41:58 +08:00
AC_PREREQ([2.60])
2013-06-24 18:15:47 +08:00
AC_INIT(fish,
2018-01-08 17:39:45 +08:00
m4_esyscmd([cut -f 2 -d '=' FISH-BUILD-VERSION-FILE | tr -d '"\n']),
2015-12-15 21:49:31 +08:00
fish-users@lists.sourceforge.net)
2016-09-16 09:37:37 +08:00
ac_clean_files=a.out.dSYM
2016-11-20 16:34:01 +08:00
2007-03-24 18:56:29 +08:00
#
# List of output variables produced by this configure script
#
2009-02-01 22:09:28 +08:00
AC_SUBST(HAVE_GETTEXT)
2013-06-19 23:59:13 +08:00
AC_SUBST(HAVE_DOXYGEN)
2009-02-01 22:09:28 +08:00
AC_SUBST(LDFLAGS_FISH)
2015-09-13 03:59:40 +08:00
AC_SUBST(WCHAR_T_BITS)
2015-10-01 16:33:23 +08:00
AC_SUBST(EXTRA_PCRE2)
2017-08-23 06:34:41 +08:00
AC_SUBST(EXTRA_MUPARSER)
2012-08-15 15:57:56 +08:00
2006-10-31 10:06:56 +08:00
#
2006-03-02 21:44:44 +08:00
# If needed, run autoconf to regenerate the configure file
2006-10-31 10:06:56 +08:00
#
# This makes sure that after running autoconf once to create the first
# version of configure, we never again need to worry about manually
# running autoconf to handle an updates configure.ac.
#
2016-11-27 05:17:23 +08:00
AC_MSG_CHECKING([if autoreconf needs to be run])
2006-03-02 21:44:44 +08:00
if test configure -ot configure.ac; then
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT([yes])
2017-04-06 22:32:22 +08:00
if command -v autoreconf >/dev/null; then
2016-11-27 05:17:23 +08:00
# No need to provide any error messages if autoreconf fails, the
2012-11-18 18:23:22 +08:00
# shell and autconf should take care of that themselves
2016-11-27 05:17:23 +08:00
AC_MSG_NOTICE([running autoreconf --no-recursive])
if autoreconf --no-recursive; then
2012-11-18 18:23:22 +08:00
./configure "$@"
exit
fi
exit 1
else
AC_MSG_ERROR(
2016-11-27 05:17:23 +08:00
[cannot find the autoreconf program in your path.
2006-03-29 08:25:00 +08:00
This program needs to be run whenever the configure.ac file is modified.
2016-11-27 05:17:23 +08:00
Please install autoreconf and try again.]
2012-11-18 18:23:22 +08:00
)
fi
2006-03-02 21:44:44 +08:00
else
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT([no])
2006-03-02 21:44:44 +08:00
fi
2006-10-31 10:06:56 +08:00
#
2006-03-02 21:44:44 +08:00
# If needed, run autoheader to regenerate config.h.in
2006-10-31 10:06:56 +08:00
#
# This makes sure we never ever have to run autoheader manually. It
# will be run whenever needed automatically.
#
2006-03-02 21:44:44 +08:00
AC_MSG_CHECKING([if autoheader needs to be run])
if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT([yes])
2017-04-06 22:32:22 +08:00
if command -v autoheader >/dev/null; then
2012-11-18 18:23:22 +08:00
AC_MSG_NOTICE([running autoheader])
autoheader || exit 1
else
AC_MSG_ERROR(
[cannot find the autoheader program in your path.
2006-03-29 08:25:00 +08:00
This program needs to be run whenever the configure.ac file is modified.
2016-09-16 09:37:37 +08:00
Please install autotools and try again.]
2012-11-18 18:23:22 +08:00
)
fi
2006-03-02 21:44:44 +08:00
else
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT([no])
2006-03-02 21:44:44 +08:00
fi
2016-11-20 16:34:01 +08:00
#
# Include the autoconf macros directory
#
AC_CONFIG_MACRO_DIRS([m4])
2013-04-16 11:32:17 +08:00
#
# Set up various programs needed for install
# Note AC_PROG_CXX sets CXXFLAGS if not set, which we want
# So ensure this happens before we modify CXXFLAGS below
2016-10-09 07:08:37 +08:00
# Do CC also, because PCRE2 will use it.
2016-10-08 14:52:33 +08:00
AC_PROG_CC
2016-09-16 14:55:02 +08:00
AC_PROG_CC_STDC # c99
2016-10-08 14:52:33 +08:00
AC_PROG_CXX
2016-09-16 14:55:02 +08:00
AC_LANG(C++)
2013-04-16 11:32:17 +08:00
AC_PROG_INSTALL
2016-09-16 09:37:37 +08:00
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_AWK
AC_PROG_FGREP
2014-09-18 20:29:49 +08:00
AC_PROG_SED
2016-04-21 22:34:37 +08:00
AC_USE_SYSTEM_EXTENSIONS
2016-11-20 16:34:01 +08:00
AX_CXX_COMPILE_STDCXX_11(noext,mandatory)
2013-04-16 11:32:17 +08:00
2006-10-31 10:06:56 +08:00
#
2010-09-18 10:18:26 +08:00
# Tell autoconf to create config.h header
2006-10-31 10:06:56 +08:00
#
2005-09-20 21:26:39 +08:00
AC_CONFIG_HEADERS(config.h)
2016-11-26 22:51:44 +08:00
AC_CANONICAL_HOST
2005-09-20 21:26:39 +08:00
2006-10-31 10:06:56 +08:00
#
# This adds markup to the code that results in a few extra compile
# time checks on recent GCC versions. It helps stop a few common bugs.
#
2006-10-19 23:19:47 +08:00
AH_BOTTOM([#if __GNUC__ >= 3
2015-07-29 21:13:38 +08:00
#ifndef __warn_unused
2006-10-19 23:19:47 +08:00
#define __warn_unused __attribute__ ((warn_unused_result))
2015-07-29 21:13:38 +08:00
#endif
#ifndef __sentinel
2006-10-19 23:19:47 +08:00
#define __sentinel __attribute__ ((sentinel))
2015-07-29 21:13:38 +08:00
#endif
#ifndef __packed
2014-03-26 11:23:58 +08:00
#define __packed __attribute__ ((packed))
2015-07-29 21:13:38 +08:00
#endif
2006-10-19 23:19:47 +08:00
#else
2010-09-18 10:18:26 +08:00
#define __warn_unused
#define __sentinel
2014-03-26 11:23:58 +08:00
#define __packed
2006-10-19 23:19:47 +08:00
#endif])
2006-11-29 22:18:22 +08:00
#
# Optionally drop gettext support
#
AC_ARG_WITH(
2012-11-18 18:23:22 +08:00
gettext,
2013-02-24 20:21:46 +08:00
AS_HELP_STRING(
2012-11-18 18:23:22 +08:00
[--without-gettext],
[do not translate messages, even if gettext is available]
),
[local_gettext=$withval],
2013-02-24 20:21:46 +08:00
[local_gettext=check]
2006-11-29 22:18:22 +08:00
)
2013-02-24 20:21:46 +08:00
AS_IF([test x$local_gettext != xno],
[ AC_CHECK_PROGS( [found_msgfmt], [msgfmt], [no] )
2013-04-16 21:13:05 +08:00
if test x$found_msgfmt != xno; then
2013-02-24 20:21:46 +08:00
AC_DEFINE([USE_GETTEXT],[1],[Perform string translations with gettext])
elif test "x$local_gettext" != "xcheck" ; then
AC_MSG_FAILURE([--with-gettext was given, but the msgfmt program could not be found])
else
local_gettext=no
fi
],
)
2006-11-29 22:18:22 +08:00
2013-06-19 23:59:13 +08:00
#
# Build/clean the documentation only if Doxygen is available
#
2014-09-04 19:07:07 +08:00
doxygen_minimum=1.8.7
2013-06-19 23:59:13 +08:00
AC_ARG_WITH(
doxygen,
AS_HELP_STRING(
[--with-doxygen],
[use Doxygen to regenerate documentation]
),
[use_doxygen=$withval],
[use_doxygen=auto]
)
AS_IF([test "$use_doxygen" != "no"],
[
AC_CHECK_PROGS([found_doxygen], [doxygen], [no])
if test "$found_doxygen" != no; then
# test version
AC_MSG_CHECKING([the doxygen version])
doxygen_version=`doxygen --version 2>/dev/null`
AC_MSG_RESULT([$doxygen_version])
2013-09-06 10:41:58 +08:00
dnl This requires autoconf 2.60 or newer
2013-06-19 23:59:13 +08:00
AS_VERSION_COMPARE([$doxygen_version], [$doxygen_minimum],
[ if test "$use_doxygen" = auto; then
AC_MSG_WARN([doxygen version $doxygen_version found, but $doxygen_minimum required])
HAVE_DOXYGEN=0
else
AC_MSG_FAILURE([doxygen version $doxygen_version found, but $doxygen_minimum required])
fi
],
[HAVE_DOXYGEN=1], [HAVE_DOXYGEN=1])
elif test "$use_doxygen" != auto; then
AC_MSG_FAILURE([--with-doxygen was given, but the doxygen program could not be found])
else
HAVE_DOXYGEN=0
fi
],
)
2007-02-05 20:25:53 +08:00
#
2007-02-25 19:17:38 +08:00
# Try to enable large file support. This will make sure that on systems
2007-02-05 20:25:53 +08:00
# where off_t can be either 32 or 64 bit, the latter size is used. On
# other systems, this should do nothing. (Hopefully)
#
2016-05-07 06:54:38 +08:00
AC_SYS_LARGEFILE
2007-02-05 20:25:53 +08:00
2013-04-16 05:35:07 +08:00
2017-12-18 06:53:23 +08:00
# Fish does not use exceptions.
CXXFLAGS="$CXXFLAGS -fno-exceptions"
2006-03-26 00:18:48 +08:00
2013-10-27 12:28:50 +08:00
#
2017-01-27 08:34:55 +08:00
# Set some warning flags
# Don't warn about missing field initializers, it has too many
# false positives for code like `struct termios tmodes = {};`
2013-10-27 12:28:50 +08:00
#
2017-01-27 08:34:55 +08:00
CXXFLAGS="$CXXFLAGS -Wextra -Wno-missing-field-initializers"
2007-01-20 10:36:49 +08:00
2013-10-27 12:28:50 +08:00
#
# This is needed in order to get the really cool backtraces on Linux
#
2015-06-20 21:33:36 +08:00
AC_MSG_CHECKING([for -rdynamic linker flag])
prev_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -rdynamic"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[
AC_MSG_RESULT([yes])
LDFLAGS_FISH="$LDFLAGS_FISH -rdynamic"
], [
AC_MSG_RESULT([no])
LDFLAGS_FISH="$LDFLAGS_FISH"
])
LDFLAGS="$prev_LDFLAGS"
2006-03-29 08:25:00 +08:00
2006-10-31 10:06:56 +08:00
#
2006-03-02 09:47:29 +08:00
# See if Linux procfs is present. This is used to get extra
# information about running processes.
2006-10-31 10:06:56 +08:00
#
2005-09-20 21:26:39 +08:00
AC_CHECK_FILES([/proc/self/stat])
2014-07-07 16:37:16 +08:00
# Disable curses macros that conflict with the STL
AC_DEFINE([NCURSES_NOMACROS], [1], [Define to 1 to disable ncurses macros that conflict with the STL])
AC_DEFINE([NOMACROS], [1], [Define to 1 to disable curses macros that conflict with the STL])
2006-10-31 10:06:56 +08:00
2016-11-26 22:51:44 +08:00
# Threading is excitingly broken on Solaris without adding -pthread to CXXFLAGS
# Only support GCC for now
dnl Ideally we would use the AX_PTHREAD macro here, but it's GPL3-licensed
dnl ACX_PTHREAD is way too old and seems to break the OS X build
dnl Both only check with AC_LANG(C) in any case
case $host_os in
solaris*)
CXXFLAGS="$CXXFLAGS -pthread"
CFLAGS="$CFLAGS -pthread"
;;
esac
2006-10-31 10:06:56 +08:00
#
2007-03-24 18:56:29 +08:00
# Check presense of various libraries. This is done on a per-binary
# level, since including various extra libraries in all binaries only
# because thay are used by some of them can cause extra bloat and
# slower compiles when developing fish.
2006-10-31 10:06:56 +08:00
#
2007-08-22 15:57:41 +08:00
# Check for os dependant libraries for all binaries.
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
2016-11-27 05:08:14 +08:00
AC_SEARCH_LIBS( shm_open, rt, [AC_DEFINE([HAVE_SHM_OPEN], [1], [Define to 1 if the shm_open() function exists])] )
2012-01-07 03:50:17 +08:00
AC_SEARCH_LIBS( pthread_create, pthread, , [AC_MSG_ERROR([Cannot find the pthread library, needed to build this package.] )] )
2014-03-03 08:58:07 +08:00
AC_SEARCH_LIBS( setupterm, [ncurses tinfo curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish. If this is Linux, try running 'sudo apt-get install libncurses5-dev' or 'sudo yum install ncurses-devel'])] )
2016-05-16 10:45:02 +08:00
AC_SEARCH_LIBS( [dladdr], [dl] )
2013-11-09 19:43:32 +08:00
if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
2006-10-31 10:06:56 +08:00
#
# Check presense of various header files
#
2014-12-07 16:41:15 +08:00
AC_CHECK_HEADERS([getopt.h termios.h sys/resource.h term.h ncurses/term.h ncurses.h ncurses/curses.h curses.h stropts.h siginfo.h sys/select.h sys/ioctl.h execinfo.h spawn.h sys/sysctl.h])
2013-02-24 04:37:12 +08:00
if test x$local_gettext != xno; then
AC_CHECK_HEADERS([libintl.h])
fi
2006-03-02 09:28:58 +08:00
2015-09-13 03:59:40 +08:00
#
# Get the size in bits of wchar_t, needed for configuring the pcre2 build
# and for code that #includes pcre2.h
#
AC_CHECK_SIZEOF(wchar_t)
WCHAR_T_BITS=`expr 8 \* $ac_cv_sizeof_wchar_t`
AC_DEFINE_UNQUOTED([WCHAR_T_BITS], [$WCHAR_T_BITS], [The size of wchar_t in bits.])
2014-11-11 19:07:43 +08:00
#
# Detect nanoseconds fields in struct stat
#
2016-10-11 06:40:33 +08:00
AC_CHECK_MEMBERS([struct stat.st_ctime_nsec])
2014-11-11 19:07:43 +08:00
AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
2014-12-11 15:24:42 +08:00
#
# Check for D_TYPE in dirent, only on BSD and Linux
#
AC_STRUCT_DIRENT_D_TYPE
2006-10-31 10:06:56 +08:00
#
2016-05-16 07:19:27 +08:00
# Check for presence of various functions used by fish
2006-10-31 10:06:56 +08:00
#
2016-05-16 07:19:27 +08:00
AC_CHECK_FUNCS( wcsndup )
AC_CHECK_FUNCS( futimes )
2016-05-29 13:28:26 +08:00
AC_CHECK_FUNCS( wcslcpy lrand48_r killpg )
2016-05-20 10:27:22 +08:00
AC_CHECK_FUNCS( backtrace_symbols getifaddrs )
Attempt to fix the sporadic uvar test failures on Linux
We identify when the universal variable file has changed out from under us by
comparing a bunch of fields from its stat: inode, device, size, high-precision
timestamp, generation. Linux aggressively reuses inodes, and the size may be
the same by coincidence (which is the case in the tests). Also, Linux
officially has nanosecond precision, but in practice it seems to only uses
millisecond precision for storing mtimes. Thus if there are three or more
updates within a millisecond, every field we check may be the same, and we are
vulnerable to the ABA problem. I believe this explains the occasional test
failures.
The solution is to manually set the nanosecond field of the mtime timestamp to
something unlikely to be duplicated, like a random number, or better yet, the
current time (with nanosecond precision). This is more in the spirit of the
timestamp, and it means we're around a million times less likely to collide.
This seems to fix the tests.
2015-11-09 15:48:32 +08:00
AC_CHECK_FUNCS( futimens clock_gettime )
2016-11-22 09:35:24 +08:00
AC_CHECK_FUNCS( getpwent flock )
2016-12-08 08:21:08 +08:00
AC_CHECK_FUNCS( dirfd )
2013-02-24 09:07:08 +08:00
2016-04-21 22:33:29 +08:00
AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] )
2017-03-05 15:06:20 +08:00
#
# Although setupterm is linkable thanks to SEARCH_LIBS above, some
# builds of ncurses include the actual headers in a different package
#
AC_CHECK_DECL( [setupterm], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish. If this is Linux, try running 'sudo apt-get install libncurses5-dev' or 'sudo yum install ncurses-devel'])], [
#if HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h>
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
] )
2016-11-15 12:12:23 +08:00
dnl AC_CHECK_FUNCS uses C linkage, but sometimes (Solaris!) the behaviour is
dnl different with C++.
AC_MSG_CHECKING([for wcsdup])
AC_TRY_LINK( [ #include <wchar.h> ],
[ wchar_t* foo = wcsdup(L""); ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WCSDUP, 1, Define to 1 if you have the `wcsdup' function.)
],
[AC_MSG_RESULT(no)],
)
AC_MSG_CHECKING([for std::wcsdup])
AC_TRY_LINK( [ #include <wchar.h> ],
[ wchar_t* foo = std::wcsdup(L""); ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STD__WCSDUP, 1, Define to 1 if you have the `std::wcsdup' function.)
],
[AC_MSG_RESULT(no)],
)
AC_MSG_CHECKING([for wcscasecmp])
AC_TRY_LINK( [ #include <wchar.h> ],
[ int foo = wcscasecmp(L"", L""); ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WCSCASECMP, 1, Define to 1 if you have the `wcscasecmp' function.)
],
[AC_MSG_RESULT(no)],
)
AC_MSG_CHECKING([for std::wcscasecmp])
AC_TRY_LINK( [ #include <wchar.h> ],
[ int foo = std::wcscasecmp(L"", L""); ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STD__WCSCASECMP, 1, Define to 1 if you have the `std::wcscasecmp' function.)
],
[AC_MSG_RESULT(no)],
)
AC_MSG_CHECKING([for wcsncasecmp])
AC_TRY_LINK( [ #include <wchar.h> ],
[ int foo = wcsncasecmp(L"", L"", 0); ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WCSNCASECMP, 1, Define to 1 if you have the `wcsncasecmp' function.)
],
[AC_MSG_RESULT(no)],
)
AC_MSG_CHECKING([for std::wcsncasecmp])
AC_TRY_LINK( [ #include <wchar.h> ],
[ int foo = std::wcsncasecmp(L"", L"", 0); ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STD__WCSNCASECMP, 1, Define to 1 if you have the `std::wcsncasecmp' function.)
],
[AC_MSG_RESULT(no)],
)
2018-01-31 13:43:05 +08:00
AC_MSG_CHECKING([for std::make_unique])
AC_TRY_LINK( [ #include <memory> ],
[ std::unique_ptr<int> foo = std::make_unique<int>(); ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STD__MAKE_UNIQUE, 1, Define to 1 if you have the `std::make_unique' function.)
],
[AC_MSG_RESULT(no)],
)
2013-02-24 09:07:08 +08:00
if test x$local_gettext != xno; then
2016-06-06 09:52:19 +08:00
AC_CHECK_FUNCS( gettext )
2006-10-31 10:06:56 +08:00
#
# The Makefile also needs to know if we have gettext, so it knows if
# the translations should be installed.
#
2012-11-18 18:23:22 +08:00
AC_CHECK_FUNC( gettext, HAVE_GETTEXT=1, HAVE_GETTEXT=0 )
2006-11-29 22:18:22 +08:00
fi
2006-07-20 21:01:48 +08:00
2006-10-31 10:06:56 +08:00
#
2006-03-02 09:47:29 +08:00
# Here follows a list of small programs used to test for various
# features that Autoconf doesn't tell us about
2006-10-31 10:06:56 +08:00
#
2017-05-10 12:39:25 +08:00
dnl AC_CHECK_FUNCS uses C linkage, but sometimes (Solaris!) the behaviour is
dnl different with C++.
AC_MSG_CHECKING([if ctermid_r() available])
AC_TRY_LINK( [ #include <stdio.h> ],
[ char buf[L_ctermid]; char *foo = ctermid_r(buf); ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CTERMID_R, 1, Define to 1 if you have the `ctermid_r' function.)
],
[AC_MSG_RESULT(no)],
)
2006-10-31 10:06:56 +08:00
#
# Check if struct winsize and TIOCGWINSZ exist
#
2006-08-10 06:53:38 +08:00
AC_MSG_CHECKING([if struct winsize and TIOCGWINSZ exist])
2006-07-31 04:55:44 +08:00
AC_LINK_IFELSE(
2012-11-18 18:23:22 +08:00
[
AC_LANG_PROGRAM(
[
2013-02-24 23:00:54 +08:00
#ifdef HAVE_TERMIOS_H
#include <termios.h>
2012-11-18 18:23:22 +08:00
#endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
],
[
struct winsize termsize = {0};
TIOCGWINSZ;
]
)
],
[
AC_MSG_RESULT(yes);
AC_DEFINE([HAVE_WINSIZE], [1], [Define to 1 if the winsize struct and TIOCGWINSZ macro exist])
],
[
AC_MSG_RESULT(no)
]
2006-08-28 18:03:34 +08:00
)
2006-07-31 04:55:44 +08:00
2006-10-31 10:06:56 +08:00
2006-01-22 00:02:34 +08:00
# Check for _nl_msg_cat_cntr symbol
AC_MSG_CHECKING([for _nl_msg_cat_cntr symbol])
2006-08-28 18:03:34 +08:00
AC_TRY_LINK(
2012-11-18 18:23:22 +08:00
[
#if HAVE_LIBINTL_H
#include <libintl.h>
#endif
2016-05-18 05:15:48 +08:00
#include <stdlib.h>
2012-11-18 18:23:22 +08:00
],
[
extern int _nl_msg_cat_cntr;
int tmp = _nl_msg_cat_cntr;
exit(tmp);
],
have__nl_msg_cat_cntr=yes,
have__nl_msg_cat_cntr=no
2006-08-28 18:03:34 +08:00
)
2006-01-22 00:02:34 +08:00
if test "$have__nl_msg_cat_cntr" = yes; then
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(yes)
AC_DEFINE(
[HAVE__NL_MSG_CAT_CNTR],
[1],
[Define to 1 if the _nl_msg_cat_cntr symbol is exported.]
)
2006-01-22 00:02:34 +08:00
else
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(no)
2006-01-22 00:02:34 +08:00
fi
2007-01-28 00:59:11 +08:00
2014-12-08 08:43:38 +08:00
# Check for sys_errlist
AC_MSG_CHECKING([for sys_errlist array])
AC_TRY_LINK(
[
#include <stdio.h>
],
[
const char *p;
p = sys_errlist[sys_nerr];
],
have_sys_errlist=yes,
have_sys_errlist=no
)
if test "$have_sys_errlist" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(
[HAVE_SYS_ERRLIST],
[1],
[Define to 1 if the sys_errlist array is available.]
)
else
AC_MSG_RESULT(no)
fi
# Check for _sys_errs
AC_MSG_CHECKING([for _sys_errs array])
AC_TRY_LINK(
[
#include <string>
],
[
std::string p;
extern const char _sys_errs[];
extern const int _sys_index[];
p = _sys_errs[_sys_index[0]];
],
have__sys__errs=yes,
have__sys__errs=no
)
if test "$have__sys__errs" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(
[HAVE__SYS__ERRS],
[1],
[Define to 1 if the _sys_errs array is available.]
)
else
AC_MSG_RESULT(no)
fi
2014-12-07 16:41:15 +08:00
# Check for Solaris curses tputs having fixed length parameter list.
AC_MSG_CHECKING([if we are using non varargs tparm.])
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM(
[
#if HAVE_NCURSES_H
#include <ncurses.h>
2015-12-04 13:23:10 +08:00
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h>
2014-12-07 16:41:15 +08:00
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
],
[
tparm( "" );
]
)
],
[tparm_solaris_kludge=no],
[tparm_solaris_kludge=yes]
)
if test "x$tparm_solaris_kludge" = "xyes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(
[TPARM_SOLARIS_KLUDGE],
[1],
[Define to 1 if tparm accepts a fixed amount of paramters.]
)
else
AC_MSG_RESULT(no)
fi
2017-08-23 06:34:41 +08:00
# ========
# PCRE2 library configuration.
2016-04-24 12:09:17 +08:00
pcre2_min_version=10.21
2015-10-01 16:33:23 +08:00
EXTRA_PCRE2=
AC_ARG_WITH(
included-pcre2,
AS_HELP_STRING(
[--without-included-pcre2],
[build against the system PCRE2 library instead of the bundled version]
),
[included_pcre2=$withval],
[included_pcre2=auto]
)
if test "x$included_pcre2" != "xyes"; then
# test for pcre2-config
# can use either pcre2-config or pkgconfig here but only implement the former for now
AC_CHECK_PROG(PCRE2_CONFIG, pcre2-config, pcre2-config)
if test "x$PCRE2_CONFIG" != "x"; then
dnl AC_MSG_CHECKING([for $WCHAR_T_BITS-bit PCRE2])
XLIBS="$LIBS"
LIBS="$LIBS "`$PCRE2_CONFIG --libs$WCHAR_T_BITS 2>/dev/null`
XCXXFLAGS="$CXXFLAGS"
2016-05-26 05:39:36 +08:00
CXXFLAGS="$CXXFLAGS "`$PCRE2_CONFIG --cflags`
2015-10-01 16:33:23 +08:00
# cheat a bit here. the exact library is determined by $WCHAR_T_BITS,
# and so AC_CHECK_LIB won't work (can't use a variable as library name)
# AC_SEARCH_LIBS will use the existing $LIBS flags with no additional library first
AC_SEARCH_LIBS([pcre2_compile_$WCHAR_T_BITS], [],
2016-04-24 12:09:17 +08:00
[ # pcre2 lib found, check for minimum version
pcre2_version=`$PCRE2_CONFIG --version`
AS_VERSION_COMPARE([$pcre2_version], [$pcre2_min_version],
[ # version < minimum
AC_MSG_NOTICE([system PCRE2 library version $pcre2_version, need $pcre2_min_version or later])
if test "x$included_pcre2" = "xno"; then
# complain about pcre2 version
AC_MSG_ERROR([system PCRE2 library is too old, but --without-included-pcre2 was given.])
else
# use the internal version; undo changes to LIBS/CXXFLAGS
included_pcre2=yes
LIBS="$XLIBS"
CXXFLAGS="$XCXXFLAGS"
fi
],
[ # version == minimum
working_pcre2=yes
],
[ # version > minimum
working_pcre2=yes
]
)
2015-10-01 16:33:23 +08:00
],
[ # fail case; undo the changes to LIBS/CXXFLAGS
working_pcre2=no
LIBS="$XLIBS"
CXXFLAGS="$XCXXFLAGS"
]
)
fi
2016-04-24 12:09:17 +08:00
if test "x$working_pcre2" = "xyes"; then
AC_MSG_NOTICE([using system PCRE2 library])
else
2015-10-01 16:33:23 +08:00
# pcre2 size wrong or pcre2-config not found
# is it OK to use the included version?
if test "x$included_pcre2" = "xno"; then
# complain
AC_MSG_ERROR([cannot find system pcre2-config, but --without-included-pcre2 was given.
Make sure pcre2-config is installed and available in PATH.
You may need to install the PCRE2 development library for your system.])
else
# use the internal version
included_pcre2=yes
fi
fi
fi
2016-04-04 14:33:35 +08:00
# Re-test as value may have changed.
2015-10-01 16:33:23 +08:00
if test "x$included_pcre2" = "xyes"; then
# Build configure/Makefile for pcre2
AC_MSG_NOTICE([using included PCRE2 library])
# unfortunately these get added to the global configuration
ac_configure_args="$ac_configure_args --disable-pcre2-8 --enable-pcre2-$WCHAR_T_BITS --disable-shared"
2017-01-16 15:10:28 +08:00
AC_CONFIG_SUBDIRS([pcre2-10.22])
2015-10-01 16:33:23 +08:00
PCRE2_CXXFLAGS='-I$(PCRE2_DIR)/src'
PCRE2_LIBS='-L$(PCRE2_LIBDIR) -lpcre2-$(PCRE2_WIDTH)'
# Make the binary depend on the PCRE2 libraries so they get built
EXTRA_PCRE2='$(PCRE2_LIB)'
CXXFLAGS="$CXXFLAGS $PCRE2_CXXFLAGS"
LIBS="$LIBS $PCRE2_LIBS"
fi
2017-08-23 06:34:41 +08:00
# ========
# MuParser math expression library configuration.
EXTRA_MUPARSER=
# Build configure/Makefile for muparser
AC_MSG_NOTICE([using included MuParser library])
# unfortunately these get added to the global configuration
ac_configure_args="$ac_configure_args --enable-shared=no --enable-samples=no --enable-debug=no"
2017-08-25 01:26:16 +08:00
AC_CONFIG_SUBDIRS([muparser-2.2.5])
2017-08-23 06:34:41 +08:00
MUPARSER_CXXFLAGS='-I$(MUPARSER_DIR)/include'
MUPARSER_LIBS='-L$(MUPARSER_LIBDIR) -lmuparser'
# Make the binary depend on the MuParser libraries so they get built
EXTRA_MUPARSER='$(MUPARSER_LIB)'
CXXFLAGS="$CXXFLAGS $MUPARSER_CXXFLAGS"
LIBS="$LIBS $MUPARSER_LIBS"
2016-04-04 14:33:35 +08:00
# Allow configurable extra directories.
AC_SUBST(extra_completionsdir)
AC_ARG_WITH([extra-completionsdir],
AS_HELP_STRING([--with-extra-completionsdir=DIR],
[path for extra completions]),
[extra_completionsdir=$withval],
[extra_completionsdir='${datadir}/fish/vendor_completions.d'])
AC_SUBST(extra_functionsdir)
AC_ARG_WITH([extra_functionsdir],
AS_HELP_STRING([--with-extra-functionsdir=DIR],
[path for extra functions]),
[extra_functionsdir=$withval],
[extra_functionsdir='${datadir}/fish/vendor_functions.d'])
2016-04-05 22:22:12 +08:00
AC_SUBST(extra_confdir)
AC_ARG_WITH([extra-confdir],
AS_HELP_STRING([--with-extra-confdir=DIR],
[path for extra conf]),
[extra_confdir=$withval],
[extra_confdir='${datadir}/fish/vendor_conf.d'])
2016-04-04 14:33:35 +08:00
# Tell the world what we know.
2013-11-30 15:11:05 +08:00
AC_CONFIG_FILES([Makefile])
2005-09-20 21:26:39 +08:00
AC_OUTPUT
2006-01-16 05:19:29 +08:00
2006-03-02 09:30:16 +08:00
echo "fish is now configured."