Blame configure.ac

Packit 1ac44c
# Configuration for GNU nano - a small and user-friendly text editor
Packit 1ac44c
#
Packit 1ac44c
# Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.
Packit 1ac44c
# Copyright (C) 2014, 2017 Mike Frysinger
Packit 1ac44c
#
Packit 1ac44c
# GNU nano is free software: you can redistribute it and/or modify
Packit 1ac44c
# it under the terms of the GNU General Public License as published
Packit 1ac44c
# by the Free Software Foundation, either version 3 of the License,
Packit 1ac44c
# or (at your option) any later version.
Packit 1ac44c
#
Packit 1ac44c
# GNU nano is distributed in the hope that it will be useful,
Packit 1ac44c
# but WITHOUT ANY WARRANTY; without even the implied warranty
Packit 1ac44c
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit 1ac44c
# See the GNU General Public License for more details.
Packit 1ac44c
#
Packit 1ac44c
# You should have received a copy of the GNU General Public License
Packit 1ac44c
# along with this program.  If not, see http://www.gnu.org/licenses/.
Packit 1ac44c
Packit 1ac44c
AC_INIT([GNU nano], [2.9.8], [nano-devel@gnu.org], [nano])
Packit 1ac44c
AC_CONFIG_SRCDIR([src/nano.c])
Packit 1ac44c
AC_CANONICAL_HOST
Packit 1ac44c
AM_INIT_AUTOMAKE([1.14])
Packit 1ac44c
AC_CONFIG_HEADERS([config.h])
Packit 1ac44c
Packit 1ac44c
dnl Make sure the ONCE macros are available.
Packit 1ac44c
Packit 1ac44c
AC_PREREQ([2.69])
Packit 1ac44c
Packit 1ac44c
dnl Lie about gnulib features we don't use to speed up & shrink down.
Packit 1ac44c
Packit 1ac44c
gl_cv_func_printf_directive_n=yes
Packit 1ac44c
gl_cv_func_printf_infinite_long_double=yes
Packit 1ac44c
gl_cv_func_printf_long_double=yes
Packit 1ac44c
gl_cv_func_snprintf_directive_n=yes
Packit 1ac44c
gl_cv_glob_lists_symlinks=yes
Packit 1ac44c
Packit 1ac44c
dnl Checks for programs.
Packit 1ac44c
Packit 1ac44c
AC_GNU_SOURCE
Packit 1ac44c
AC_PROG_CC
Packit 1ac44c
gl_EARLY
Packit 1ac44c
gl_INIT
Packit 1ac44c
AC_PROG_LN_S
Packit 1ac44c
AC_ISC_POSIX
Packit 1ac44c
AC_SYS_LARGEFILE
Packit 1ac44c
PKG_PROG_PKG_CONFIG
Packit 1ac44c
Packit 1ac44c
dnl Internationalization macros.
Packit 1ac44c
Packit 1ac44c
AM_GNU_GETTEXT_VERSION([0.18.3])
Packit 1ac44c
AM_GNU_GETTEXT([external], [need-ngettext])
Packit 1ac44c
AM_CONDITIONAL(USE_NLS, test x$USE_NLS = xyes)
Packit 1ac44c
Packit 1ac44c
dnl Data location.
Packit 1ac44c
Packit 1ac44c
pkgdatadir=${datadir}/${PACKAGE}
Packit 1ac44c
AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
Packit 1ac44c
Packit 1ac44c
dnl Checks for header files.
Packit 1ac44c
Packit 1ac44c
AC_CHECK_HEADERS(libintl.h limits.h pwd.h termios.h sys/param.h)
Packit 1ac44c
Packit 1ac44c
dnl Checks for options.
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(browser,
Packit 1ac44c
AS_HELP_STRING([--disable-browser], [Disable the built-in file browser]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_browser" != xyes; then
Packit 1ac44c
		enable_browser=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_browser" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_BROWSER, 1, [Define this to enable the built-in file browser.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(color,
Packit 1ac44c
AS_HELP_STRING([--disable-color], [Disable color and syntax highlighting]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_color" = xyes; then
Packit 1ac44c
		if test "x$enable_nanorc" != xyes; then
Packit 1ac44c
			AC_MSG_ERROR([--enable-color needs --enable-nanorc to work])
Packit 1ac44c
		fi
Packit 1ac44c
	else
Packit 1ac44c
		enable_color=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_nanorc" = xno; then
Packit 1ac44c
	if test "x$enable_color" = xyes; then
Packit 1ac44c
		AC_MSG_ERROR([--enable-color cannot work with --disable-nanorc])
Packit 1ac44c
	else
Packit 1ac44c
		# Disabling nanorc silently disables color support.
Packit 1ac44c
		enable_color=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_color" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting.])
Packit 1ac44c
	color_support=yes
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(comment,
Packit 1ac44c
AS_HELP_STRING([--disable-comment], [Disable the comment/uncomment function]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_comment" = xyes; then
Packit 1ac44c
		AC_MSG_ERROR([--enable-comment cannot work with --enable-tiny])
Packit 1ac44c
	else
Packit 1ac44c
		enable_comment=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_comment" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(extra,
Packit 1ac44c
AS_HELP_STRING([--disable-extra], [Disable the Easter egg]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_extra" != xyes; then
Packit 1ac44c
		enable_extra=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_extra" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_EXTRA, 1, [Define this to have an Easter egg.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(help,
Packit 1ac44c
AS_HELP_STRING([--disable-help], [Disable the built-in help texts]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_help" = xyes; then
Packit 1ac44c
		if test "x$enable_multibuffer" != xyes; then
Packit 1ac44c
			AC_MSG_ERROR([--enable-help needs --enable-multibuffer to work])
Packit 1ac44c
		fi
Packit 1ac44c
	else
Packit 1ac44c
		enable_help=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_multibuffer" = xno; then
Packit 1ac44c
	if test "x$enable_help" = xyes; then
Packit 1ac44c
		AC_MSG_ERROR([--enable-help cannot work with --disable-multibuffer])
Packit 1ac44c
	else
Packit 1ac44c
		# Disabling multibuffer silently disables the help texts.
Packit 1ac44c
		enable_help=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_help" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_HELP, 1, [Define this to enable the Ctrl+G help texts.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(histories,
Packit 1ac44c
AS_HELP_STRING([--disable-histories], [Disable search and position histories]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_histories" != xyes; then
Packit 1ac44c
		enable_histories=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_histories" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_HISTORIES, 1, [Define this to have search and position histories.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(justify,
Packit 1ac44c
AS_HELP_STRING([--disable-justify], [Disable the justify/unjustify functions]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_justify" != xyes; then
Packit 1ac44c
		enable_justify=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_justify" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_JUSTIFY, 1, [Define this to have the routines for justifying.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(libmagic,
Packit 1ac44c
AS_HELP_STRING([--disable-libmagic], [Disable detection of file types via libmagic]))
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(linenumbers,
Packit 1ac44c
AS_HELP_STRING([--disable-linenumbers], [Disable line numbering]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_linenumbers" != xyes; then
Packit 1ac44c
		enable_linenumbers=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_linenumbers" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_LINENUMBERS, 1, [Define this to enable line numbering.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(mouse,
Packit 1ac44c
AS_HELP_STRING([--disable-mouse], [Disable mouse support]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_mouse" != xyes; then
Packit 1ac44c
		enable_mouse=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_mouse" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_MOUSE, 1, [Define this to enable mouse support.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(multibuffer,
Packit 1ac44c
AS_HELP_STRING([--disable-multibuffer], [Disable multiple file buffers]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_multibuffer" != xyes; then
Packit 1ac44c
		enable_multibuffer=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_multibuffer" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(nanorc,
Packit 1ac44c
AS_HELP_STRING([--disable-nanorc], [Disable the use of .nanorc files]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_nanorc" != xyes; then
Packit 1ac44c
		enable_nanorc=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_nanorc" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_NANORC, 1, [Define this to enable the use of .nanorc files.])
Packit 1ac44c
	nanorc_support=yes
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(operatingdir,
Packit 1ac44c
AS_HELP_STRING([--disable-operatingdir], [Disable the setting of an operating directory]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_operatingdir" != xyes; then
Packit 1ac44c
		enable_operatingdir=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_operatingdir" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_OPERATINGDIR, 1, [Define this to allow setting an operating directory (a chroot of sorts).])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(speller,
Packit 1ac44c
AS_HELP_STRING([--disable-speller], [Disable the spell-checker functions]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_speller" != xyes; then
Packit 1ac44c
		enable_speller=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_speller" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_SPELLER, 1, [Define this to have the spell-checker functions.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(tabcomp,
Packit 1ac44c
AS_HELP_STRING([--disable-tabcomp], [Disable the tab-completion functions]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_tabcomp" != xyes; then
Packit 1ac44c
		enable_tabcomp=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_tabcomp" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_TABCOMP, 1, [Define this to have tab completion for filenames and search strings.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(wordcomp,
Packit 1ac44c
AS_HELP_STRING([--disable-wordcomp], [Disable the word-completion function]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_wordcomp" = xyes; then
Packit 1ac44c
		AC_MSG_ERROR([--enable-wordcomp cannot work with --enable-tiny])
Packit 1ac44c
	else
Packit 1ac44c
		enable_wordcomp=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_wordcomp" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_WORDCOMPLETION, 1, [Define this to enable the word-completion function.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(wrapping,
Packit 1ac44c
AS_HELP_STRING([--disable-wrapping], [Disable all hard-wrapping of text]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	if test "x$enable_wrapping" != xyes; then
Packit 1ac44c
		enable_wrapping=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
if test "x$enable_wrapping" != xno; then
Packit 1ac44c
	AC_DEFINE(ENABLE_WRAPPING, 1, [Define this to have hard text wrapping.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(wrapping-as-root,
Packit 1ac44c
AS_HELP_STRING([--disable-wrapping-as-root], [Disable wrapping of text as root by default]))
Packit 1ac44c
if test "x$enable_wrapping_as_root" = xno; then
Packit 1ac44c
	AC_DEFINE(DISABLE_ROOTWRAPPING, 1, [Define this to disable text wrapping as root by default.])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(debug,
Packit 1ac44c
AS_HELP_STRING([--enable-debug], [Enable debugging (disabled by default)]))
Packit 1ac44c
if test "x$enable_debug" = xyes; then
Packit 1ac44c
	AC_DEFINE(DEBUG, 1, [Define this to enable debug messages and abortion on failing asserts.])
Packit 1ac44c
else
Packit 1ac44c
	AC_DEFINE(NDEBUG, 1, [Shut up assert warnings :-)])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(tiny,
Packit 1ac44c
AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size]))
Packit 1ac44c
if test "x$enable_tiny" = xyes; then
Packit 1ac44c
	AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.])
Packit 1ac44c
	if test "x$enable_libmagic" != xyes; then
Packit 1ac44c
		enable_libmagic=no
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
Packit 1ac44c
AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
Packit 1ac44c
Packit 1ac44c
AC_MSG_CHECKING([whether to enable UTF-8 support])
Packit 1ac44c
AC_ARG_ENABLE(utf8, AS_HELP_STRING([--enable-utf8], [Enable UTF-8 support]))
Packit 1ac44c
AC_MSG_RESULT(${enable_utf8:-auto})
Packit 1ac44c
Packit 1ac44c
AC_ARG_ENABLE(altrcname,
Packit 1ac44c
AS_HELP_STRING([--enable-altrcname], [Specify an alternate rcfile name (default: .nanorc)]),
Packit 1ac44c
[if test x$enableval != no; then
Packit 1ac44c
	AC_DEFINE_UNQUOTED(RCFILE_NAME, "$enableval", [Specify an alternate rcfile name (default: .nanorc).]) rcfilename=$enableval
Packit 1ac44c
fi])
Packit 1ac44c
Packit 1ac44c
Packit 1ac44c
AC_MSG_CHECKING([whether to use slang])
Packit 1ac44c
CURSES_LIB_NAME=""
Packit 1ac44c
AC_ARG_WITH(slang,
Packit 1ac44c
AS_HELP_STRING([--with-slang[=DIR]], [Use the slang library instead of curses]),
Packit 1ac44c
[    case "$with_slang" in
Packit 1ac44c
	no)
Packit 1ac44c
		AC_MSG_RESULT(no)
Packit 1ac44c
		;;
Packit 1ac44c
	*)
Packit 1ac44c
		AC_MSG_RESULT(yes)
Packit 1ac44c
Packit 1ac44c
		if test x$with_slang != xyes; then
Packit 1ac44c
			# Add additional search path.
Packit 1ac44c
			LDFLAGS="-L$with_slang/lib $LDFLAGS"
Packit 1ac44c
			CPPFLAGS="-I$with_slang/include $CPPFLAGS"
Packit 1ac44c
		fi
Packit 1ac44c
Packit 1ac44c
		if test "x$enable_utf8" != xno; then
Packit 1ac44c
			AC_CHECK_HEADER(slcurses.h,
Packit 1ac44c
				AC_MSG_CHECKING([for SLutf8_enable in -lslang])
Packit 1ac44c
				_libs=$LIBS
Packit 1ac44c
				LIBS="$LIBS -lslang"
Packit 1ac44c
				AC_TRY_RUN([
Packit 1ac44c
#include <slcurses.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	SLutf8_enable(1);
Packit 1ac44c
	return 0;
Packit 1ac44c
}],
Packit 1ac44c
					[AC_MSG_RESULT(yes)
Packit 1ac44c
					AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
Packit 1ac44c
					CURSES_LIB_WIDE=yes
Packit 1ac44c
					if test x$with_slang != xyes; then
Packit 1ac44c
						CURSES_LIB="-L${with_slang}/lib -lslang"
Packit 1ac44c
					else
Packit 1ac44c
						CURSES_LIB="-lslang"
Packit 1ac44c
					fi
Packit 1ac44c
					CURSES_LIB_NAME=slang],
Packit 1ac44c
					[AC_MSG_RESULT(no)
Packit 1ac44c
Packit 1ac44c
					# We might need the term library.
Packit 1ac44c
					for termlib in ncurses curses termcap terminfo termlib; do
Packit 1ac44c
						AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
Packit 1ac44c
						test -n "$tcap" && break
Packit 1ac44c
					done
Packit 1ac44c
Packit 1ac44c
					AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
Packit 1ac44c
					LIBS="$LIBS $tcap"
Packit 1ac44c
					AC_TRY_RUN([
Packit 1ac44c
#include <slcurses.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	SLutf8_enable(1);
Packit 1ac44c
	return 0;
Packit 1ac44c
}],
Packit 1ac44c
						[AC_MSG_RESULT(yes)
Packit 1ac44c
						AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
Packit 1ac44c
						CURSES_LIB_WIDE=yes
Packit 1ac44c
						if test x$with_slang != xyes; then
Packit 1ac44c
							CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
Packit 1ac44c
						else
Packit 1ac44c
							CURSES_LIB="-lslang $tcap"
Packit 1ac44c
						fi
Packit 1ac44c
						CURSES_LIB_NAME=slang],
Packit 1ac44c
						[AC_MSG_RESULT(no)
Packit 1ac44c
Packit 1ac44c
						# We might need the math library.
Packit 1ac44c
						AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
Packit 1ac44c
						LIBS="$LIBS -lm"
Packit 1ac44c
						AC_TRY_RUN([
Packit 1ac44c
#include <slcurses.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	SLutf8_enable(1);
Packit 1ac44c
	return 0;
Packit 1ac44c
}],
Packit 1ac44c
							[AC_MSG_RESULT(yes)
Packit 1ac44c
							AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
Packit 1ac44c
							CURSES_LIB_WIDE=yes
Packit 1ac44c
							if test x$with_slang != xyes; then
Packit 1ac44c
								CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
Packit 1ac44c
							else
Packit 1ac44c
								CURSES_LIB="-lslang $tcap -lm"
Packit 1ac44c
							fi
Packit 1ac44c
							CURSES_LIB_NAME=slang],
Packit 1ac44c
							[AC_MSG_RESULT(no)],
Packit 1ac44c
	AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
Packit 1ac44c
	AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
Packit 1ac44c
	AC_MSG_WARN([*** Can not use slang when cross-compiling])),
Packit 1ac44c
			AC_MSG_ERROR([
Packit 1ac44c
*** The header file slcurses.h was not found.  If you wish to use
Packit 1ac44c
*** slang support this header file is required.  Please either
Packit 1ac44c
*** install a version of slang that includes the slcurses.h file or
Packit 1ac44c
*** do not call the configure script with --with-slang.]))
Packit 1ac44c
		fi
Packit 1ac44c
Packit 1ac44c
		if eval "test x$CURSES_LIB_NAME = x"; then
Packit 1ac44c
			# Reset libs if the above slang tests failed.
Packit 1ac44c
			if test "x$enable_utf8" != xno; then
Packit 1ac44c
				LIBS=$_libs
Packit 1ac44c
			fi
Packit 1ac44c
Packit 1ac44c
			AC_CHECK_HEADER(slcurses.h,
Packit 1ac44c
				AC_MSG_CHECKING([for SLtt_initialize in -lslang])
Packit 1ac44c
				_libs=$LIBS
Packit 1ac44c
				LIBS="$LIBS -lslang"
Packit 1ac44c
				AC_TRY_RUN([
Packit 1ac44c
#include <slcurses.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	SLtt_initialize(NULL);
Packit 1ac44c
	return 0;
Packit 1ac44c
}],
Packit 1ac44c
					[AC_MSG_RESULT(yes)
Packit 1ac44c
					AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
Packit 1ac44c
					if test x$with_slang != xyes; then
Packit 1ac44c
						CURSES_LIB="-L${with_slang}/lib -lslang"
Packit 1ac44c
					else
Packit 1ac44c
						CURSES_LIB="-lslang"
Packit 1ac44c
					fi
Packit 1ac44c
					CURSES_LIB_NAME=slang],
Packit 1ac44c
					[AC_MSG_RESULT(no)
Packit 1ac44c
Packit 1ac44c
					# We might need the term library.
Packit 1ac44c
					for termlib in ncurses curses termcap terminfo termlib; do
Packit 1ac44c
						AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
Packit 1ac44c
						test -n "$tcap" && break
Packit 1ac44c
					done
Packit 1ac44c
Packit 1ac44c
					AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
Packit 1ac44c
					LIBS="$LIBS $tcap"
Packit 1ac44c
					AC_TRY_RUN([
Packit 1ac44c
#include <slcurses.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	SLtt_initialize(NULL);
Packit 1ac44c
	return 0;
Packit 1ac44c
}],
Packit 1ac44c
						[AC_MSG_RESULT(yes)
Packit 1ac44c
						AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
Packit 1ac44c
						if test x$with_slang != xyes; then
Packit 1ac44c
							CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
Packit 1ac44c
						else
Packit 1ac44c
							CURSES_LIB="-lslang $tcap"
Packit 1ac44c
						fi
Packit 1ac44c
						CURSES_LIB_NAME=slang],
Packit 1ac44c
						[AC_MSG_RESULT(no)
Packit 1ac44c
Packit 1ac44c
						# We might need the math library.
Packit 1ac44c
						AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
Packit 1ac44c
						LIBS="$LIBS -lm"
Packit 1ac44c
						AC_TRY_RUN([
Packit 1ac44c
#include <slcurses.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	SLtt_initialize(NULL);
Packit 1ac44c
	return 0;
Packit 1ac44c
}],
Packit 1ac44c
							[AC_MSG_RESULT(yes)
Packit 1ac44c
							AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
Packit 1ac44c
							if test x$with_slang != xyes; then
Packit 1ac44c
								CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
Packit 1ac44c
							else
Packit 1ac44c
								CURSES_LIB="-lslang $tcap -lm"
Packit 1ac44c
							fi
Packit 1ac44c
							CURSES_LIB_NAME=slang],
Packit 1ac44c
							[AC_MSG_RESULT(no)],
Packit 1ac44c
	AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
Packit 1ac44c
	AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
Packit 1ac44c
	AC_MSG_WARN([*** Can not use slang when cross-compiling])),
Packit 1ac44c
			AC_MSG_ERROR([
Packit 1ac44c
*** The header file slcurses.h was not found.  If you wish to use
Packit 1ac44c
*** slang support this header file is required.  Please either
Packit 1ac44c
*** install a version of slang that includes the slcurses.h file or
Packit 1ac44c
*** do not call the configure script with --with-slang.]))
Packit 1ac44c
		fi
Packit 1ac44c
Packit 1ac44c
		if test "${_libs+set}" = "set"; then
Packit 1ac44c
			LIBS=$_libs
Packit 1ac44c
		fi
Packit 1ac44c
Packit 1ac44c
		if test x$with_slang != xyes; then
Packit 1ac44c
			LDFLAGS=${_ldflags}
Packit 1ac44c
		fi
Packit 1ac44c
		;;
Packit 1ac44c
	esac], [AC_MSG_RESULT(no)])
Packit 1ac44c
Packit 1ac44c
Packit 1ac44c
dnl Checks for functions.
Packit 1ac44c
Packit 1ac44c
if test "x$enable_utf8" != xno; then
Packit 1ac44c
	AC_CHECK_FUNCS(iswalnum iswpunct mblen mbstowcs mbtowc wctomb)
Packit 1ac44c
fi
Packit 1ac44c
dnl Checks for typedefs, structures, and compiler characteristics.
Packit 1ac44c
Packit 1ac44c
dnl Checks for available flags.
Packit 1ac44c
Packit 1ac44c
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"], [], [])
Packit 1ac44c
Packit 1ac44c
dnl Checks for library functions.
Packit 1ac44c
Packit 1ac44c
AC_TYPE_SIGNAL
Packit 1ac44c
Packit 1ac44c
dnl Checks for libraries.
Packit 1ac44c
Packit 1ac44c
if eval "test x$CURSES_LIB_NAME = x"; then
Packit 1ac44c
	if test "x$enable_utf8" != xno; then
Packit 1ac44c
		PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
Packit 1ac44c
			CURSES_LIB=$NCURSESW_LIBS
Packit 1ac44c
			CPPFLAGS="$NCURSESW_CFLAGS $CPPFLAGS"
Packit 1ac44c
			CURSES_LIB_NAME=ncursesw
Packit 1ac44c
			CURSES_LIB_WIDE=yes
Packit 1ac44c
		], [:])
Packit 1ac44c
	else
Packit 1ac44c
		PKG_CHECK_MODULES([NCURSES], [ncurses], [
Packit 1ac44c
			CURSES_LIB=$NCURSES_LIBS
Packit 1ac44c
			CPPFLAGS="$NCURSES_CFLAGS $CPPFLAGS"
Packit 1ac44c
			CURSES_LIB_NAME=ncurses
Packit 1ac44c
		], [:])
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
if eval "test x$CURSES_LIB_NAME = x"; then
Packit 1ac44c
	AC_CHECK_HEADERS(ncurses.h)
Packit 1ac44c
Packit 1ac44c
	if test "x$enable_utf8" != xno; then
Packit 1ac44c
		OLDLIBS="$LIBS"
Packit 1ac44c
		AC_CHECK_TOOL(NCURSESW_CONFIG, ncursesw5-config, no)
Packit 1ac44c
		if test "x$NCURSESW_CONFIG" != xno; then
Packit 1ac44c
			CURSES_LIB=`$NCURSESW_CONFIG --libs`
Packit 1ac44c
			LIBS="$CURSES_LIB $LIBS"
Packit 1ac44c
			CPPFLAGS="`$NCURSESW_CONFIG --cflags` $CPPFLAGS"
Packit 1ac44c
			AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
Packit 1ac44c
		else
Packit 1ac44c
			AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
Packit 1ac44c
		fi
Packit 1ac44c
		LIBS="$OLDLIBS"
Packit 1ac44c
	fi
Packit 1ac44c
Packit 1ac44c
	if eval "test x$CURSES_LIB_NAME = x"; then
Packit 1ac44c
		AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
if eval "test x$CURSES_LIB_NAME = x"; then
Packit 1ac44c
	AC_CHECK_HEADERS(curses.h)
Packit 1ac44c
Packit 1ac44c
	if test "x$enable_utf8" != xno; then
Packit 1ac44c
		AC_CHECK_LIB(curses, get_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes])
Packit 1ac44c
	fi
Packit 1ac44c
Packit 1ac44c
	if eval "test x$CURSES_LIB_NAME = x"; then
Packit 1ac44c
		AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
if eval "test x$CURSES_LIB_NAME = x"; then
Packit 1ac44c
	AC_MSG_ERROR([
Packit 1ac44c
*** No curses lib was found.  Please install the curses header files
Packit 1ac44c
*** from libncursesw5-dev (Debian), ncurses-devel (Fedora), or similar.
Packit 1ac44c
*** (Or install ncurses from https://ftp.gnu.org/gnu/ncurses/.)])
Packit 1ac44c
else
Packit 1ac44c
	AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_CHECK_LIB([$CURSES_LIB_NAME], [use_default_colors],
Packit 1ac44c
			 [AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() function.])],
Packit 1ac44c
			 [], [$CURSES_LIB])
Packit 1ac44c
AC_CHECK_LIB([$CURSES_LIB_NAME], [set_escdelay],
Packit 1ac44c
			 [AC_DEFINE(HAVE_SET_ESCDELAY, 1, [Define this if your curses library has the set_escdelay() function.])],
Packit 1ac44c
			 [], [$CURSES_LIB])
Packit 1ac44c
AC_CHECK_LIB([$CURSES_LIB_NAME], [key_defined],
Packit 1ac44c
			 [AC_DEFINE(HAVE_KEY_DEFINED, 1, [Define this if your curses library has the key_defined() function.])],
Packit 1ac44c
			 [], [$CURSES_LIB])
Packit 1ac44c
Packit 1ac44c
dnl Parse any configure options.
Packit 1ac44c
Packit 1ac44c
LIBS="$LIBS $CURSES_LIB"
Packit 1ac44c
Packit 1ac44c
AC_SUBST(CURSES_LIB)
Packit 1ac44c
Packit 1ac44c
if test "x$enable_utf8" != xno && \
Packit 1ac44c
	test x$CURSES_LIB_WIDE = xyes && \
Packit 1ac44c
	test x$ac_cv_func_iswalnum = xyes && \
Packit 1ac44c
	test x$ac_cv_func_iswpunct = xyes && \
Packit 1ac44c
	test x$ac_cv_func_mblen = xyes && \
Packit 1ac44c
	test x$ac_cv_func_mbstowcs = xyes && \
Packit 1ac44c
	test x$ac_cv_func_mbtowc = xyes && \
Packit 1ac44c
	test x$ac_cv_func_wctomb = xyes; then
Packit 1ac44c
		AC_DEFINE(ENABLE_UTF8, 1, [Define this if your system has sufficient UTF-8 support.])
Packit 1ac44c
else
Packit 1ac44c
	if test "x$enable_utf8" = xyes; then
Packit 1ac44c
		AC_MSG_ERROR([
Packit 1ac44c
*** UTF-8 support was requested, but insufficient UTF-8 support was
Packit 1ac44c
*** detected in your curses and/or C libraries.  Please verify that your
Packit 1ac44c
*** slang was built with UTF-8 support or your curses was built with
Packit 1ac44c
*** wide character support, and that your C library was built with wide
Packit 1ac44c
*** character support.])
Packit 1ac44c
	elif test "x$enable_utf8" != xno; then
Packit 1ac44c
		AC_MSG_WARN([
Packit 1ac44c
*** Insufficient UTF-8 support was detected in your curses and/or C
Packit 1ac44c
*** libraries.  If you want UTF-8 support, please verify that your slang
Packit 1ac44c
*** was built with UTF-8 support or your curses was built with wide
Packit 1ac44c
*** character support, and that your C library was built with wide
Packit 1ac44c
*** character support.])
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_CACHE_CHECK([for enhanced regular expression flag], nano_cv_flag_reg_enhanced,
Packit 1ac44c
			   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <regex.h>]],
Packit 1ac44c
												   [[
Packit 1ac44c
													 #ifndef REG_ENHANCED
Packit 1ac44c
													 error: No REG_ENHANCED support!
Packit 1ac44c
													 #endif
Packit 1ac44c
												   ]])],
Packit 1ac44c
								  [nano_cv_flag_reg_enhanced=yes],
Packit 1ac44c
								  [nano_cv_flag_reg_enhanced=no])])
Packit 1ac44c
dnl The bundled gnulib regex module doesn't support REG_ENHANCED.
Packit 1ac44c
if test "$ac_use_included_regex" = "yes"; then
Packit 1ac44c
	nano_cv_flag_reg_enhanced="no"
Packit 1ac44c
fi
Packit 1ac44c
if test "$nano_cv_flag_reg_enhanced" = "yes"; then
Packit 1ac44c
	nano_reg_extended="REG_EXTENDED | REG_ENHANCED"
Packit 1ac44c
else
Packit 1ac44c
	nano_reg_extended="REG_EXTENDED"
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_reg_extended,
Packit 1ac44c
				   [Flag(s) to use to get the full range of extended regular expressions])
Packit 1ac44c
Packit 1ac44c
# Check for word-boundary support (/< and />).
Packit 1ac44c
AC_MSG_CHECKING([for GNU-style word boundary regex support])
Packit 1ac44c
AC_ARG_WITH(wordbounds,
Packit 1ac44c
AS_HELP_STRING([--with-wordbounds], [Use GNU-style word boundary delimiters]),
Packit 1ac44c
		[with_wordbounds=$withval], [with_wordbounds=auto])
Packit 1ac44c
if test "$with_wordbounds" != "no"; then
Packit 1ac44c
	dnl If we're using the bundled gnulib regex module, we know it's supported.
Packit 1ac44c
	if test "$ac_use_included_regex" = "yes"; then
Packit 1ac44c
	    with_wordbounds="yes"
Packit 1ac44c
	fi
Packit 1ac44c
Packit 1ac44c
	dnl We explicitly don't check if the user forced the option, because
Packit 1ac44c
	dnl this is needed for cross compilers and we can't test the target.
Packit 1ac44c
	if test "$with_wordbounds" != "yes"; then
Packit 1ac44c
	    AC_TRY_RUN([
Packit 1ac44c
#ifdef HAVE_SYS_TYPES_H
Packit 1ac44c
#include <sys/types.h>
Packit 1ac44c
#endif
Packit 1ac44c
#include <regex.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	regex_t r;
Packit 1ac44c
	size_t nmatch;
Packit 1ac44c
	regmatch_t pmatch;
Packit 1ac44c
Packit 1ac44c
	if (regcomp(&r, "\\\\>", $nano_reg_extended|REG_NOSUB))
Packit 1ac44c
		return 1;
Packit 1ac44c
	if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
Packit 1ac44c
		return 1;
Packit 1ac44c
	return 0;
Packit 1ac44c
}],
Packit 1ac44c
	    with_wordbounds="yes",
Packit 1ac44c
	    with_wordbounds="no",
Packit 1ac44c
	    with_wordbounds="cross")
Packit 1ac44c
	fi
Packit 1ac44c
fi
Packit 1ac44c
case $with_wordbounds in
Packit 1ac44c
yes)
Packit 1ac44c
	AC_MSG_RESULT(yes)
Packit 1ac44c
	AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.])
Packit 1ac44c
	;;
Packit 1ac44c
no)
Packit 1ac44c
	AC_MSG_RESULT(no)
Packit 1ac44c
	;;
Packit 1ac44c
cross)
Packit 1ac44c
	AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
Packit 1ac44c
	;;
Packit 1ac44c
esac
Packit 1ac44c
Packit 1ac44c
if test x$color_support = xyes; then
Packit 1ac44c
#    if test x$CURSES_LIB_NAME = xcurses; then
Packit 1ac44c
		AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
Packit 1ac44c
		AC_TRY_RUN([
Packit 1ac44c
#include <curses.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	int testcolor = COLOR_WHITE;
Packit 1ac44c
	return 0;
Packit 1ac44c
}], AC_MSG_RESULT(no),
Packit 1ac44c
	    AC_TRY_RUN([
Packit 1ac44c
#ifndef _XOPEN_SOURCE_EXTENDED
Packit 1ac44c
#define _XOPEN_SOURCE_EXTENDED 1
Packit 1ac44c
#endif
Packit 1ac44c
#include <curses.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	int testcolor = COLOR_WHITE;
Packit 1ac44c
	return 0;
Packit 1ac44c
}],
Packit 1ac44c
		AC_DEFINE(NEED_XOPEN_SOURCE_EXTENDED, 1, [Define this if you need the _XOPEN_SOURCE_EXTENDED macro for color support.])
Packit 1ac44c
		AC_MSG_RESULT(yes),
Packit 1ac44c
		AC_MSG_RESULT(not sure)
Packit 1ac44c
		AC_MSG_WARN([*** Couldn't successfully compile basic color test with or without _XOPEN_SOURCE_EXTENDED])
Packit 1ac44c
		AC_MSG_WARN([*** This build may not compile. Consider configuring with --disable-color or installing ncurses])),
Packit 1ac44c
		AC_MSG_WARN([*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling]))
Packit 1ac44c
#    fi
Packit 1ac44c
fi
Packit 1ac44c
Packit 1ac44c
AC_MSG_CHECKING([whether LINES and COLS can be redefined])
Packit 1ac44c
AC_TRY_RUN([
Packit 1ac44c
#include <curses.h>
Packit 1ac44c
int main(void)
Packit 1ac44c
{
Packit 1ac44c
	LINES = 80;
Packit 1ac44c
	COLS = 25;
Packit 1ac44c
	return 0;
Packit 1ac44c
}],
Packit 1ac44c
AC_DEFINE(REDEFINING_MACROS_OK, 1, [Define this if you know your curses library allows LINES and COLS to be redefined to deal with a resizing bug.])
Packit 1ac44c
AC_MSG_RESULT(yes),
Packit 1ac44c
AC_MSG_RESULT(no),
Packit 1ac44c
AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
Packit 1ac44c
Packit 1ac44c
AS_IF([test "x$enable_libmagic" != "xno"], [
Packit 1ac44c
  AC_CHECK_HEADERS([magic.h])
Packit 1ac44c
  AC_CHECK_LIB(magic, magic_open)
Packit 1ac44c
  AC_CHECK_HEADERS([zlib.h])
Packit 1ac44c
  AC_CHECK_LIB(z, inflate)
Packit 1ac44c
])
Packit 1ac44c
Packit 1ac44c
# Check for groff html support.
Packit 1ac44c
AC_MSG_CHECKING([for HTML support in groff])
Packit 1ac44c
groff -t -mandoc -Thtml </dev/null >/dev/null
Packit 1ac44c
if test $? -ne 0 ; then
Packit 1ac44c
	AC_MSG_RESULT([no])
Packit 1ac44c
	AC_MSG_WARN([*** Will not generate HTML version of man pages  ***
Packit 1ac44c
*** Consider installing a newer version of groff with HTML support ***])
Packit 1ac44c
	groff_html_support=no
Packit 1ac44c
else
Packit 1ac44c
	AC_MSG_RESULT([yes])
Packit 1ac44c
	groff_html_support=yes
Packit 1ac44c
fi
Packit 1ac44c
AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes)
Packit 1ac44c
Packit 1ac44c
# Check whether this is a git repository.
Packit 1ac44c
AC_MSG_CHECKING([whether building from git])
Packit 1ac44c
if test -d .git ; then
Packit 1ac44c
	AC_MSG_RESULT([yes])
Packit 1ac44c
	from_git=yes
Packit 1ac44c
else
Packit 1ac44c
	AC_MSG_RESULT([no])
Packit 1ac44c
	from_git=no
Packit 1ac44c
fi
Packit 1ac44c
AM_CONDITIONAL(BUILDING_FROM_GIT, test x$from_git = xyes)
Packit 1ac44c
Packit 1ac44c
AC_CONFIG_FILES([
Packit 1ac44c
Makefile
Packit 1ac44c
doc/Makefile
Packit 1ac44c
doc/sample.nanorc
Packit 1ac44c
lib/Makefile
Packit 1ac44c
m4/Makefile
Packit 1ac44c
po/Makefile.in
Packit 1ac44c
src/Makefile
Packit 1ac44c
syntax/Makefile
Packit 1ac44c
nano.spec
Packit 1ac44c
])
Packit 1ac44c
Packit 1ac44c
AC_OUTPUT