2003-01-15 20:40:35 +03:00
# Configuration for GNU nano - a small and user-friendly text editor
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
#
2003-09-22 20:26:40 +04:00
# GNU nano is free software; you can redistribute it and/or modify
2003-01-15 20:40:35 +03:00
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
2003-09-22 20:26:40 +04:00
# GNU nano is distributed in the hope that it will be useful,
2003-01-15 20:40:35 +03:00
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
2003-09-22 20:26:40 +04:00
# along with GNU nano; if not, write to the Free Software
2003-01-15 20:40:35 +03:00
# Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
2000-08-09 02:00:30 +04:00
# $Id$
2003-01-15 20:40:35 +03:00
2004-11-22 20:58:06 +03:00
AC_INIT([GNU nano], [1.3.5-cvs], [nano-devel@gnu.org], [nano])
2003-09-07 04:44:12 +04:00
AC_CONFIG_SRCDIR([src/nano.c])
2004-11-18 03:05:14 +03:00
AC_CANONICAL_TARGET([])
2003-01-15 20:40:35 +03:00
AM_INIT_AUTOMAKE
2004-11-18 03:05:14 +03:00
AC_CONFIG_HEADERS([config.h])
2003-01-15 20:40:35 +03:00
2004-05-13 21:19:54 +04:00
AC_PREREQ(2.54)
2000-06-06 09:53:49 +04:00
dnl Checks for programs.
2004-05-13 21:19:54 +04:00
AC_GNU_SOURCE
2000-06-06 09:53:49 +04:00
AC_PROG_CC
2004-08-01 20:09:15 +04:00
AC_PROG_LN_S
2000-06-06 09:53:49 +04:00
AC_ISC_POSIX
2002-02-23 21:23:43 +03:00
AC_SYS_LARGEFILE
2000-06-06 09:53:49 +04:00
2003-01-15 20:40:35 +03:00
dnl Internationalization macros.
AM_GNU_GETTEXT_VERSION(0.11.5)
AM_GNU_GETTEXT([external], [need-ngettext])
2000-06-06 09:53:49 +04:00
dnl Checks for header files.
AC_HEADER_STDC
2004-12-24 21:11:53 +03:00
AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termios.h wchar.h)
2003-03-11 06:50:40 +03:00
AC_CHECK_HEADER(regex.h,
AC_MSG_CHECKING([for broken regexec])
AC_TRY_RUN([
#include <sys/types.h>
#include <regex.h>
2004-05-13 21:46:57 +04:00
int main(void)
{
regex_t reg;
size_t n = 1;
regmatch_t r;
regcomp(®, "\\<", 0);
regexec(®, "", n, &r, 0);
regfree(®);
return 0;
}],
2003-03-11 06:50:40 +03:00
AC_MSG_RESULT(no),
2004-09-07 04:48:49 +04:00
AC_MSG_RESULT(yes)
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.]),
AC_MSG_RESULT([cross-compiling; assuming no])
2003-03-11 06:50:40 +03:00
)
)
2000-06-06 09:53:49 +04:00
dnl options
2002-07-19 05:08:59 +04:00
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debugging (disabled by default)],
[if test x$enableval = xyes; then
2003-03-11 06:50:40 +03:00
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
2002-07-19 05:08:59 +04:00
debug_support=yes
fi])
if test "$debug_support" != "yes"; then
2002-11-04 19:05:42 +03:00
AC_DEFINE(NDEBUG, 1, [Shut up the assert warnings :-)])
2002-07-19 05:08:59 +04:00
fi
2002-09-07 00:35:28 +04:00
AC_ARG_ENABLE(extra,
[ --enable-extra Enable extra (optional) functions, including easter eggs],
[if test x$enableval = xyes; then
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
fi])
2000-06-06 09:53:49 +04:00
AC_ARG_ENABLE(tiny,
2002-12-22 19:30:00 +03:00
[ --enable-tiny Disable features for the sake of size],
2000-06-06 09:53:49 +04:00
[if test x$enableval = xyes; then
2002-07-06 03:46:31 +04:00
AC_DEFINE(NANO_SMALL, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
2002-09-07 00:35:28 +04:00
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in (crappy) file browser.])
2004-11-28 00:39:01 +03:00
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
2002-07-06 03:46:31 +04:00
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
2002-07-19 05:08:59 +04:00
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
2002-09-07 00:35:28 +04:00
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
2000-06-06 09:53:49 +04:00
fi])
2002-09-07 00:35:28 +04:00
AC_ARG_ENABLE(browser,
[ --disable-browser Disable mini file browser],
[if test x$enableval != xyes; then
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in (crappy) file browser.])
2000-11-24 23:45:14 +03:00
fi])
2002-09-07 00:35:28 +04:00
AC_ARG_ENABLE(help,
2004-11-28 00:39:01 +03:00
[ --disable-help Disable help function],
2002-09-07 00:35:28 +04:00
[if test x$enableval != xyes; then
2004-11-28 00:39:01 +03:00
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
2001-07-11 06:08:33 +04:00
fi])
2002-09-07 00:35:28 +04:00
AC_ARG_ENABLE(justify,
[ --disable-justify Disable justify/unjustify function],
[if test x$enableval != xyes; then
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
2001-04-13 06:32:06 +04:00
fi])
2002-09-07 00:35:28 +04:00
AC_ARG_ENABLE(mouse,
[ --disable-mouse Disable mouse support (and -m flag)],
2000-11-24 17:00:16 +03:00
[if test x$enableval != xyes; then
2002-09-07 00:35:28 +04:00
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
2000-11-24 17:00:16 +03:00
fi])
2002-09-07 00:35:28 +04:00
AC_ARG_ENABLE(operatingdir,
[ --disable-operatingdir Disable setting of operating directory (chroot of sorts)],
2000-12-01 21:46:01 +03:00
[if test x$enableval != xyes; then
2002-09-07 00:35:28 +04:00
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
2000-12-01 21:46:01 +03:00
fi])
2000-12-06 04:08:10 +03:00
AC_ARG_ENABLE(speller,
2001-05-02 21:18:17 +04:00
[ --disable-speller Disable spell checker function],
2000-12-01 21:46:01 +03:00
[if test x$enableval != xyes; then
2002-07-06 03:46:31 +04:00
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
2000-12-01 21:46:01 +03:00
fi])
2002-09-07 00:35:28 +04:00
AC_ARG_ENABLE(tabcomp,
[ --disable-tabcomp Disable tab completion code for a smaller binary],
2001-01-05 08:41:07 +03:00
[if test x$enableval != xyes; then
2002-09-07 00:35:28 +04:00
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
2001-01-03 10:11:47 +03:00
fi])
2001-04-02 09:36:08 +04:00
AC_ARG_ENABLE(wrapping,
2001-05-02 21:18:17 +04:00
[ --disable-wrapping Disable all wrapping of text (and -w flag)],
2001-04-02 09:36:08 +04:00
[if test x$enableval != xyes; then
2002-07-06 03:46:31 +04:00
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable any and all text wrapping.])
2001-04-02 09:36:08 +04:00
fi])
2002-10-25 20:08:53 +04:00
AC_ARG_ENABLE(wrapping-as-root,
[ --disable-wrapping-as-root Disable wrapping of text as root by default],
[if test x$enableval != xyes; then
AC_DEFINE(DISABLE_ROOTWRAP, 1, [Define this to disable wrapping as root by default.])
fi])
2002-09-07 00:35:28 +04:00
AC_ARG_ENABLE(color,
[ --enable-color Enable color and syntax highlighting],
[if test x$enableval = xyes; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
AC_MSG_WARN([
***********************************************************************
*** WARNING: Color support is far from perfect, but functional. ***
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
***********************************************************************
])
fi])
AC_ARG_ENABLE(multibuffer,
[ --enable-multibuffer Enable multiple file buffers],
[if test x$enableval = xyes; then
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
2001-04-12 18:51:48 +04:00
fi])
2002-09-07 00:35:28 +04:00
AC_ARG_ENABLE(nanorc,
[ --enable-nanorc Enable use of .nanorc file],
[if test x$enableval = xyes; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
2001-09-19 07:19:43 +04:00
fi])
2003-01-17 03:17:45 +03:00
AC_ARG_ENABLE(all,
[ --enable-all Enable ALL extra nano functionality (kitchen sink option)],
[if test x$enableval = xyes; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
AC_MSG_WARN([
***********************************************************************
*** WARNING: Color support is far from perfect, but functional. ***
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
***********************************************************************
])
fi])
2001-02-02 01:56:44 +03:00
AC_MSG_CHECKING([whether to use slang])
2000-06-06 09:53:49 +04:00
CURSES_LIB_NAME=""
AC_ARG_WITH(slang,
[ --with-slang[=DIR] Use the slang library instead of curses],
[ case "$with_slang" in
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(yes)
2000-08-06 02:49:30 +04:00
if test "$with_slang" != "yes"; then
# Add additional search path
LDFLAGS="-L$with_slang/lib $LDFLAGS"
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
fi
2000-06-06 09:53:49 +04:00
AC_CHECK_HEADER(slcurses.h,
2001-02-02 01:56:44 +03:00
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
2000-08-09 02:00:30 +04:00
_libs=$LIBS
LIBS="$LIBS -lslang"
2000-08-09 07:26:33 +04:00
AC_TRY_RUN([
#include <slcurses.h>
2004-05-13 21:46:57 +04:00
int main(void)
{
SLtt_initialize(NULL);
return 0;
}],
2000-08-09 02:00:30 +04:00
[AC_MSG_RESULT(yes)
2002-07-06 03:46:31 +04:00
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
2000-08-06 02:49:30 +04:00
slang_support=yes
if test "$with_slang" != "yes"; then
CURSES_LIB="-L${with_slang}/lib -lslang"
else
CURSES_LIB="-lslang"
fi
2004-09-07 19:45:14 +04:00
CURSES_LIB_NAME=slang],
[AC_MSG_RESULT(no)
2000-08-09 02:00:30 +04:00
# We might need the term library
for termlib in ncurses curses termcap terminfo termlib; do
2001-02-02 01:56:44 +03:00
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
2000-08-09 02:00:30 +04:00
test -n "$tcap" && break
done
2001-02-02 01:56:44 +03:00
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
2000-08-09 02:00:30 +04:00
LIBS="$LIBS $tcap"
2000-08-09 07:26:33 +04:00
AC_TRY_RUN([
#include <slcurses.h>
2004-05-13 21:46:57 +04:00
int main(void)
{
SLtt_initialize(NULL);
return 0;
}],
2000-08-09 02:00:30 +04:00
[AC_MSG_RESULT(yes)
2002-07-06 03:46:31 +04:00
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
2000-08-09 02:00:30 +04:00
slang_support=yes
if test "$with_slang" != "yes"; then
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
else
CURSES_LIB="-lslang $tcap"
fi
CURSES_LIB_NAME=slang], [
AC_MSG_RESULT(no)
# We might need the math library
2001-02-02 01:56:44 +03:00
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
2000-08-09 02:00:30 +04:00
LIBS="$LIBS -lm"
2000-08-09 07:26:33 +04:00
AC_TRY_RUN([
#include <slcurses.h>
2004-05-13 21:46:57 +04:00
int main(void)
{
SLtt_initialize(NULL);
return 0;
}],
2000-08-09 02:00:30 +04:00
[AC_MSG_RESULT(yes)
2002-07-06 03:46:31 +04:00
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
2000-08-09 02:00:30 +04:00
slang_support=yes
if test "$with_slang" != "yes"; then
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
else
CURSES_LIB="-lslang $tcap -lm"
fi
CURSES_LIB_NAME=slang],
2000-09-13 22:12:05 +04:00
[AC_MSG_RESULT(no)],
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
2004-11-27 23:39:26 +03:00
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
2000-09-13 22:12:05 +04:00
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
2000-06-06 09:53:49 +04:00
AC_MSG_ERROR([
*** The header file slcurses.h was not found. If you wish to use
*** slang support this header file is required. Please either
*** install a version of slang that includes the slcurses.h file or
*** do not call the configure script with --with-slang
]))
2000-08-09 02:00:30 +04:00
test "${_libs+set}" = "set" && LIBS=$_libs
2000-08-06 02:49:30 +04:00
if test "$with_slang" != "yes"; then
LDFLAGS=${_ldflags}
fi
2000-06-06 09:53:49 +04:00
;;
2001-02-02 01:56:44 +03:00
esac], [AC_MSG_RESULT(no)])
2000-06-06 09:53:49 +04:00
dnl Checks for functions
2004-12-24 21:11:53 +03:00
AC_CHECK_FUNCS(snprintf vsnprintf isblank strcasecmp strncasecmp strcasestr strnlen getline getdelim mbtowc wctomb wcwidth)
if test "x$ac_cv_func_snprintf" = "xno" -o "x$ac_cv_func_vsnprintf" = "xno"
2000-06-06 09:53:49 +04:00
then
2003-11-20 03:15:52 +03:00
AM_PATH_GLIB_2_0(2.0.0,,
2004-10-18 18:13:28 +04:00
AC_MSG_ERROR([
*** snprintf() and/or vsnprintf() not found. GLIB 2.x not found either.
2000-06-06 09:53:49 +04:00
*** You need both snprintf() and vsnprintf(). Alternatively you can
2004-10-18 18:13:28 +04:00
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
glib)
2000-06-06 09:53:49 +04:00
fi
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getopt_long)
dnl Checks for libraries.
if eval "test x$CURSES_LIB_NAME = x"
then
2004-12-12 22:04:56 +03:00
AC_CHECK_HEADERS(ncurses.h)
2004-12-20 18:39:12 +03:00
AC_CHECK_LIB(ncursesw, wget_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE="yes"])
2004-12-12 22:04:56 +03:00
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
fi
2000-06-06 09:53:49 +04:00
fi
2000-09-21 08:25:45 +04:00
if eval "test x$CURSES_LIB_NAME = x"
then
2004-12-12 22:04:56 +03:00
AC_CHECK_HEADERS(curses.h)
2004-12-20 18:39:12 +03:00
AC_CHECK_LIB(curses, wget_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE="yes"])
2004-12-12 22:04:56 +03:00
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
fi
2000-06-06 09:53:49 +04:00
fi
if eval "test x$CURSES_LIB_NAME = x"
then
AC_MSG_WARN([
2004-12-12 22:04:56 +03:00
*** No curses lib available. Consider getting the official ncurses
2000-06-06 09:53:49 +04:00
*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
*** errors compiling nano.])
else
2004-12-12 22:04:56 +03:00
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
2000-06-06 09:53:49 +04:00
fi
2002-07-06 03:46:31 +04:00
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
2001-01-06 21:12:43 +03:00
2004-09-19 02:02:21 +04:00
dnl Parse any configure options.
2000-06-06 09:53:49 +04:00
LIBS="$LIBS $CURSES_LIB"
2000-06-20 03:19:07 +04:00
2000-06-06 09:53:49 +04:00
AC_SUBST(CURSES_LIB)
2003-11-20 03:15:52 +03:00
if test "x$GLIB_CFLAGS" != "x"
2000-06-06 09:53:49 +04:00
then
2003-11-20 03:15:52 +03:00
CFLAGS="$CFLAGS $GLIB_CFLAGS"
2000-06-06 09:53:49 +04:00
fi
2003-11-20 03:15:52 +03:00
if test "x$GLIB_LIBS" != "x"
2000-06-06 09:53:49 +04:00
then
2003-11-20 03:15:52 +03:00
LDFLAGS="$LDFLAGS $GLIB_LIBS"
2000-06-06 09:53:49 +04:00
fi
2004-12-24 21:11:53 +03:00
if test "x$CURSES_LIB_WIDE" = "xyes" -a "x$ac_cv_func_mbtowc" = "xyes" -a "x$ac_cv_func_wctomb" = "xyes" -a "x$ac_cv_func_wcwidth" = "xyes"
2004-12-12 22:04:56 +03:00
then
2004-12-24 21:11:53 +03:00
AC_DEFINE(NANO_WIDE, 1, [Define this if your system has wide character support (a wide curses library, mbtowc(), wctomb(), and wcwidth()).])
2004-12-12 22:04:56 +03:00
else
2004-12-28 02:21:34 +03:00
AC_MSG_WARN([Insufficient wide character support found. nano will not be able to support UTF-8.])
2004-12-12 22:04:56 +03:00
fi
2003-09-07 04:44:12 +04:00
AC_CONFIG_FILES([
Makefile
doc/Makefile
doc/man/Makefile
doc/man/fr/Makefile
doc/texinfo/Makefile
m4/Makefile
po/Makefile.in
src/Makefile
nano.spec
])
2002-02-23 21:23:43 +03:00
AC_OUTPUT