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,
2013-08-17 10:47:35 +08:00
m4_esyscmd([cut -f 3 -d ' ' FISH-BUILD-VERSION-FILE | tr -d '\n']),
2013-06-24 18:15:47 +08:00
fish-users@lists.sf.net)
2005-09-20 21:26:39 +08:00
2010-09-18 14:31:18 +08:00
conf_arg=$@
2006-10-31 10:06:56 +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)
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.
#
2006-03-02 21:44:44 +08:00
AC_MSG_CHECKING([if autoconf needs to be run])
if test configure -ot configure.ac; then
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT([yes])
if which autoconf >/dev/null; then
# No need to provide any error messages if autoconf fails, the
# shell and autconf should take care of that themselves
AC_MSG_NOTICE([running autoconf])
if autoconf; then
./configure "$@"
exit
fi
exit 1
else
AC_MSG_ERROR(
[cannot find the autoconf 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.
2006-08-28 18:03:34 +08:00
Please install it 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])
if which autoheader >/dev/null; then
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.
2006-08-28 18:03:34 +08:00
Please install it 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
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
#
AC_PROG_CXX([g++ c++])
AC_PROG_INSTALL
2013-09-22 19:54:09 +08:00
AC_LANG(C++)
2013-04-16 11:32:17 +08:00
echo "CXXFLAGS: $CXXFLAGS"
2006-03-02 21:44:44 +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)
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
#define __warn_unused __attribute__ ((warn_unused_result))
#define __sentinel __attribute__ ((sentinel))
2014-03-26 11:23:58 +08:00
#define __packed __attribute__ ((packed))
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
#
doxygen_minimum=1.5
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)
#
2012-01-07 02:23:38 +08:00
CXXFLAGS="$CXXFLAGS -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64"
2007-02-05 20:25:53 +08:00
2013-04-16 05:35:07 +08:00
2013-10-27 12:28:50 +08:00
# fish does not use exceptions
# Disabling exceptions saves about 20% (!) of the compiled code size
CXXFLAGS="$CXXFLAGS -fno-exceptions"
2006-03-26 00:18:48 +08:00
2013-10-27 12:28:50 +08:00
#
# -Wall is there to keep me on my toes
#
2006-03-26 00:18:48 +08:00
2013-10-27 12:28:50 +08:00
CXXFLAGS="$CXXFLAGS -Wall"
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
#
2007-01-20 10:36:49 +08:00
2013-10-27 12:28:50 +08:00
if test `uname` != "Darwin"; then
LDFLAGS_FISH="$LDFLAGS_FISH -rdynamic"
2006-03-29 08:25:00 +08:00
fi
2006-10-31 10:06:56 +08:00
2006-03-30 05:31:24 +08:00
#
# If we are compiling against glibc, set some flags to work around
# some rather stupid attempts to hide prototypes for *wprintf
# functions, as well as prototypes of various gnu extensions.
#
2006-03-29 08:25:00 +08:00
AC_MSG_CHECKING([if we are compiling against glibc])
AC_RUN_IFELSE(
2012-11-18 18:23:22 +08:00
[
AC_LANG_PROGRAM(
[
#include <stdlib.h>
#ifdef __GLIBC__
#define STATUS 0
#else
#define STATUS 1
#endif
],
[
return STATUS;
]
)
],
[glibc=yes],
[glibc=no]
2006-08-28 18:03:34 +08:00
)
2006-03-29 08:25:00 +08:00
if test "$glibc" = yes; then
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(yes)
2006-03-29 08:25:00 +08:00
2012-11-18 18:23:22 +08:00
#
# This gives us access to prototypes for gnu extensions and C99
# functions if we are compiling agains glibc. All GNU extensions
# that are used must have a fallback implementation available in
# fallback.h, in order to keep fish working on non-gnu platforms.
#
2006-03-26 00:18:48 +08:00
2013-09-22 19:54:09 +08:00
CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE=1 -D_ISO99_SOURCE=1"
2006-03-29 08:25:00 +08:00
else
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(no)
2006-03-29 08:25:00 +08:00
fi
2006-03-26 00:18:48 +08:00
2006-10-31 10:06:56 +08:00
#
2006-01-16 05:19:29 +08:00
# Test cpu for special handling of ppc
2006-03-29 08:25:00 +08:00
#
# This is used to skip use of tputs on ppc systems, since it seemed to
# be broken, at least on older debin-based systems. This is obviously
# not the right way to to detect whether this workaround should be
# used, since it catches far to many systems, but I do not have the
# hardware available to narrow this problem down, and in practice, it
# seems that tputs is never really needed.
#
2006-10-31 10:06:56 +08:00
2006-01-16 05:19:29 +08:00
AC_CANONICAL_TARGET
if test $target_cpu = powerpc; then
2012-11-18 18:23:22 +08:00
AC_DEFINE([TPUTS_KLUDGE],[1],[Evil kludge to get Power based machines to work])
2006-01-16 05:19:29 +08:00
fi
2006-10-31 10:06:56 +08:00
#
2006-08-11 04:37:56 +08:00
# Solaris-specific flags go here
2006-10-31 10:06:56 +08:00
#
2006-08-01 09:30:18 +08:00
AC_MSG_CHECKING([if we are under Solaris])
case $target_os in
2012-11-18 18:23:22 +08:00
solaris*)
AC_DEFINE( __EXTENSIONS__, 1, [Macro to enable additional prototypes under Solaris])
AC_MSG_RESULT(yes)
;;
*)
AC_MSG_RESULT(no)
;;
2006-08-01 09:30:18 +08:00
esac
2007-08-22 15:57:41 +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(
2012-11-18 18:23:22 +08:00
[
AC_LANG_PROGRAM(
[
#include <curses.h>
#include <term.h>
],
[
tparm( "" );
]
)
],
[tparm_solaris_kludge=no],
[tparm_solaris_kludge=yes]
2007-08-22 15:57:41 +08:00
)
if test "x$tparm_solaris_kludge" = "xyes"; then
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(yes)
AC_DEFINE(
[TPARM_SOLARIS_KLUDGE],
[1],
[Define to 1 if tparm accepts a fixed amount of paramters.]
2007-08-22 15:57:41 +08:00
)
else
AC_MSG_RESULT(no)
fi
2006-01-16 05:19:29 +08:00
2006-10-31 10:06:56 +08:00
#
2006-08-11 04:37:56 +08:00
# BSD-specific flags go here
2006-10-31 10:06:56 +08:00
#
2006-08-11 04:37:56 +08:00
AC_MSG_CHECKING([if we are under BSD])
case $target_os in
2012-11-18 18:23:22 +08:00
*bsd*)
AC_DEFINE( __BSD_VISIBLE, 1, [Macro to enable additional prototypes under BSD])
AC_DEFINE( _NETBSD_SOURCE, 1, [Macro to enable additional prototypes under BSD])
AC_MSG_RESULT(yes)
;;
*)
AC_MSG_RESULT(no)
;;
2006-08-11 04:37:56 +08:00
esac
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])
2006-10-31 10:06:56 +08:00
#
2006-03-29 08:25:00 +08:00
# This is ued to tell the wgetopt library to translate strings. This
# way wgetopt can be dropped into any project without requiring i18n.
2006-10-31 10:06:56 +08:00
#
2006-03-29 08:25:00 +08:00
2006-08-28 18:03:34 +08:00
AC_DEFINE(
2012-11-18 18:23:22 +08:00
[HAVE_TRANSLATE_H],
[1],
[Define to 1 if the wgettext function should be used for translating strings.]
2006-08-28 18:03:34 +08:00
)
2006-03-29 08:25:00 +08:00
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( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
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'])] )
2009-02-03 07:20:49 +08:00
AC_SEARCH_LIBS( [nan], [m], [AC_DEFINE( [HAVE_NAN], [1], [Define to 1 if you have the nan function])] )
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
#
2013-05-24 02:03:34 +08:00
AC_CHECK_HEADERS([getopt.h termios.h sys/resource.h term.h ncurses/term.h ncurses.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
2006-08-28 18:03:34 +08:00
AC_CHECK_HEADER(
2012-11-18 18:23:22 +08:00
[regex.h],
[
AC_DEFINE(
[HAVE_REGEX_H],
[1],
[Define to 1 if you have the <regex.h> header file.]
)
],
[AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])]
2006-08-28 18:03:34 +08:00
)
2006-10-31 10:06:56 +08:00
2006-08-28 18:03:34 +08:00
#
# On some platforms (Solaris 10) adding -std=c99 in turn requires that
# _POSIX_C_SOURCE be defined to 200112L otherwise several
# POSIX-specific, non-ISO-C99 types/prototypes are made unavailable
2006-11-30 21:24:31 +08:00
# e.g. siginfo_t. Defining _XOPEN_SOURCE to 600 is compatible with
2006-08-28 18:03:34 +08:00
# the _POSIX_C_SOURCE value and provides a little assurance that
# extension functions' prototypes are available, e.g. killpg().
#
# Some other platforms (OS X), will remove types/prototypes/macros
# e.g. SIGWINCH if either _POSIX_C_SOURCE or _XOPEN_SOURCE is defined.
#
# This test adds these macros only if they enable a program that uses
# both Posix and non-standard features to compile, and that program
# does not compile without these macros.
#
# We try to make everyone happy.
#
# The ordering of the various autoconf tests is very critical as well:
#
# * This test needs to be run _after_ header detection tests, so that
# the proper headers are included.
#
# * This test needs to be run _before_ testing for the presense of any
# prototypes or other language functinality.
#
# * This test should be (but does not need to be) run after the
# conditional definition of __EXTENSIONS__, to avoid redundant tests.
2006-10-31 10:06:56 +08:00
#
2006-08-28 18:03:34 +08:00
2013-09-22 19:54:09 +08:00
XCXXFLAGS="$CXXFLAGS"
2006-08-28 18:03:34 +08:00
2013-01-08 23:05:19 +08:00
echo checking how to use -D_XOPEN_SOURCE=600 and -D_POSIX_C_SOURCE=200112L...
2006-08-28 18:03:34 +08:00
local_found_posix_switch=no
for i in "" "-D_POSIX_C_SOURCE=200112L" "-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L"; do
2012-11-18 18:23:22 +08:00
AC_MSG_CHECKING( if switches \"$i\" works)
2013-09-22 19:54:09 +08:00
CXXFLAGS="$XCXXFLAGS $i"
2012-11-18 18:23:22 +08:00
#
# Try to run this program, which should test various extensions
# and Posix functionality. If this program works, then everything
# should work. Hopefully.
#
AC_TRY_LINK(
[
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
/* POSIX, C89 and C99: POSIX extends this header.
* For: kill(), killpg(), siginfo_t, sigset_t,
* struct sigaction, sigemptyset(), sigaction(),
* SIGIO and SIGWINCH. */
#include <signal.h>
#ifdef HAVE_SIGINFO_H
/* Neither POSIX, C89 nor C99: Solaris-specific (others?).
* For: siginfo_t (also defined by signal.h when in
* POSIX/extensions mode). */
#include <siginfo.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
/* As above (under at least Linux and FreeBSD). */
#include <sys/ioctl.h>
#endif
],
[
/* Avert high-level optimisation, by making the program's
* return value depend on all tested identifiers. */
long ret = 0;
/* POSIX only: might be unhidden by _POSIX_C_SOURCE. */
struct sigaction sa;
sigset_t ss;
siginfo_t info;
ret += (long)(void *)&info + kill( 0, 0 ) +
sigaction( 0, &sa, 0 ) + sigemptyset( &ss );
/* Extended-POSIX: might be unhidden by _XOPEN_SOURCE. */
ret += killpg( 0, 0 );
/* Non-standard: might be hidden by the macros. */
{
struct winsize termsize;
ret += (long)(void *)&termsize;
ret += SIGWINCH + TIOCGWINSZ + SIGIO;
}
return ret;
],
local_cv_use__posix_c_source=yes,
local_cv_use__posix_c_source=no,
)
if test x$local_cv_use__posix_c_source = xyes; then
AC_MSG_RESULT( yes )
local_found_posix_switch=yes
break;
else
AC_MSG_RESULT( no )
fi
2006-08-28 18:03:34 +08:00
done
2006-10-31 10:06:56 +08:00
#
2006-08-28 18:03:34 +08:00
# We didn't find any combination of switches that worked - revert to
# no switches and hope that the fallbacks work. A warning will be
# printed at the end of the configure script.
2006-10-31 10:06:56 +08:00
#
2006-08-28 18:03:34 +08:00
if test ! x$local_found_posix_switch = xyes; then
2013-09-22 19:54:09 +08:00
CXXFLAGS="$XCXXFLAGS"
2006-08-28 18:03:34 +08:00
fi
2006-03-02 09:28:58 +08:00
2006-10-31 10:06:56 +08:00
#
# Check for presense of various functions used by fish
#
2006-11-29 22:18:22 +08:00
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp fwprintf )
2006-08-28 18:29:49 +08:00
AC_CHECK_FUNCS( futimes wcwidth wcswidth wcstok fputwc fgetwc )
2013-02-24 09:07:08 +08:00
AC_CHECK_FUNCS( wcstol wcslcat wcslcpy lrand48_r killpg )
AC_CHECK_FUNCS( backtrace backtrace_symbols sysconf getifaddrs )
if test x$local_gettext != xno; then
AC_CHECK_FUNCS( gettext dcgettext )
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
#
2006-03-02 09:47:29 +08:00
2006-10-31 10:06:56 +08:00
#
2006-03-02 09:28:58 +08:00
# Check if realpath accepts null for its second argument
2006-10-31 10:06:56 +08:00
#
2006-03-02 09:28:58 +08:00
AC_MSG_CHECKING([if realpath accepts null for its second argument])
AC_RUN_IFELSE(
2012-11-18 18:23:22 +08:00
[
AC_LANG_PROGRAM(
[
#include <limits.h>
#include <errno.h>
#include <stdlib.h>
],
[
int status;
char *res;
res = realpath( "somefile", 0 );
status = !(res != 0 || errno == ENOENT);
exit( status );
]
)
],
[have_realpath_null=yes],
[have_realpath_null=no]
2006-08-28 18:03:34 +08:00
)
2006-03-02 09:28:58 +08:00
if test "$have_realpath_null" = yes; then
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(yes)
AC_DEFINE(
[HAVE_REALPATH_NULL],
[1],
[Define to 1 if realpath accepts null for its second argument.]
)
2006-03-02 09:28:58 +08:00
else
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(no)
2006-03-02 09:28:58 +08:00
fi
2006-07-31 04:55:44 +08:00
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-03-29 08:25:00 +08:00
# If we have a fwprintf in libc, test that it actually works. As of
# March 2006, it is broken under Dragonfly BSD.
2006-10-31 10:06:56 +08:00
#
2006-03-02 09:28:58 +08:00
if test "$ac_cv_func_fwprintf" = yes; then
2012-11-18 18:23:22 +08:00
AC_MSG_CHECKING([if fwprintf is broken])
AC_RUN_IFELSE(
[
AC_LANG_PROGRAM(
[
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <wchar.h>
],
[
setlocale( LC_ALL, "" );
fwprintf( stderr, L"%ls%ls", L"", L"fish:" );
]
)
],
[
AC_MSG_RESULT(no)
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_BROKEN_FWPRINTF], [1], [Define to 1 one if the implemented fwprintf is broken])
]
)
2006-03-02 09:28:58 +08:00
fi
2005-11-24 19:13:21 +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
],
[
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
# Check for __environ symbol
AC_MSG_CHECKING([for __environ symbol])
AC_TRY_LINK(
2012-11-18 18:23:22 +08:00
[
#include <unistd.h>
],
[
extern char **__environ;
char **tmp = __environ;
exit(tmp!=0);
],
have___environ=yes,
have___environ=no
2007-01-28 00:59:11 +08:00
)
if test "$have___environ" = yes; then
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(yes)
AC_DEFINE(
[HAVE___ENVIRON],
[1],
[Define to 1 if the __environ symbol is exported.]
)
2007-01-28 00:59:11 +08:00
else
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(no)
2007-01-28 00:59:11 +08:00
fi
2006-09-04 07:00:06 +08:00
# Check if getopt_long exists and works
AC_MSG_CHECKING([if getopt_long exists and works])
2006-08-28 18:29:49 +08:00
AC_TRY_LINK(
2012-11-18 18:23:22 +08:00
[
#if HAVE_GETOPT_H
#include <getopt.h>
#endif
],
[
static struct option
long_options[] =
{
0, 0, 0, 0
}
;
int opt = getopt_long( 0,
0,
0,
long_options,
0 );
],
have_working_getopt_long=yes,
have_working_getopt_long=no
2006-08-28 18:29:49 +08:00
)
if test "$have_working_getopt_long" = yes; then
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(yes)
AC_DEFINE(
[HAVE_WORKING_GETOPT_LONG],
[1],
[Define to 1 if getopt_long exists and works.]
)
2006-08-28 18:29:49 +08:00
else
2012-11-18 18:23:22 +08:00
AC_MSG_RESULT(no)
2006-08-28 18:29:49 +08:00
fi
2006-08-11 18:07:56 +08:00
# Check if del_curterm is broken - in that case we redefine
2006-05-11 19:58:46 +08:00
# del_curterm as a no-op, to avoid a double-free
2006-08-11 18:07:56 +08:00
AC_MSG_CHECKING([If del_curterm is broken])
2006-05-11 19:58:46 +08:00
case $target_os in
2012-11-18 18:23:22 +08:00
*bsd*)
AC_MSG_RESULT(yes)
AC_DEFINE(
[HAVE_BROKEN_DEL_CURTERM],
[1],
[del_curterm is broken, redefine it to a no-op to avoid a double-free bug]
)
;;
*)
AC_MSG_RESULT(no)
;;
2006-05-11 19:58:46 +08:00
esac
2006-03-02 09:47:29 +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-08-28 18:03:34 +08:00
if test ! x$local_found_posix_switch = xyes; then
2012-11-18 18:23:22 +08:00
echo "Can't find a combination of switches to enable common extensions like detecting window size."
echo "Some fish features may be disabled."
2006-08-28 18:03:34 +08:00
fi
2006-03-02 09:30:16 +08:00
echo "fish is now configured."
2006-06-14 07:40:36 +08:00
echo "Use 'make' and 'make install' to build and install fish."
2006-08-28 18:03:34 +08:00