blob: ee3ef716a458c65e30d3f8d8b7a87d5cfe58b3a4 [file] [log] [blame]
Jordi Mallach631ee1f2003-01-15 17:40:35 +00001# Configuration for GNU nano - a small and user-friendly text editor
2#
David Lawrence Ramseycb535632007-07-31 21:20:08 +00003# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4# Free Software Foundation, Inc.
Jordi Mallach631ee1f2003-01-15 17:40:35 +00005#
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +00006# GNU nano is free software; you can redistribute it and/or modify it
7# under the terms of the GNU General Public License as published by the
David Lawrence Ramseyd0035b42007-08-11 05:17:36 +00008# Free Software Foundation; either version 3, or (at your option) any
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +00009# later version.
Jordi Mallach631ee1f2003-01-15 17:40:35 +000010#
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000011# GNU nano is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# General Public License for more details.
Jordi Mallach631ee1f2003-01-15 17:40:35 +000015#
16# You should have received a copy of the GNU General Public License
David Lawrence Ramseya3831ab2003-09-22 16:26:40 +000017# along with GNU nano; if not, write to the Free Software
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000018# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
19# USA.
Jordi Mallach631ee1f2003-01-15 17:40:35 +000020#
Chris Allegrettae5935972000-08-08 22:00:30 +000021# $Id$
Jordi Mallach631ee1f2003-01-15 17:40:35 +000022
Chris Allegretta04385752013-03-24 12:38:51 +000023AC_INIT([GNU nano], [2.3.2-svn], [nano-devel@gnu.org], [nano])
Jordi Mallach298b9752003-09-07 00:44:12 +000024AC_CONFIG_SRCDIR([src/nano.c])
Chris Allegretta636e76a2013-01-03 03:47:26 +000025AC_CANONICAL_HOST
Jordi Mallach631ee1f2003-01-15 17:40:35 +000026AM_INIT_AUTOMAKE
Jordi Mallachd7b63252004-11-18 00:05:14 +000027AC_CONFIG_HEADERS([config.h])
Jordi Mallach631ee1f2003-01-15 17:40:35 +000028
David Lawrence Ramsey9830d752004-05-13 17:19:54 +000029AC_PREREQ(2.54)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000030
31dnl Checks for programs.
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +000032
David Lawrence Ramsey9830d752004-05-13 17:19:54 +000033AC_GNU_SOURCE
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000034AC_PROG_CC
David Lawrence Ramsey76fb3ec2004-08-01 16:09:15 +000035AC_PROG_LN_S
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000036AC_ISC_POSIX
Jordi Mallach3c5653d2002-02-23 18:23:43 +000037AC_SYS_LARGEFILE
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000038
Jordi Mallach631ee1f2003-01-15 17:40:35 +000039dnl Internationalization macros.
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +000040
Jordi Mallach631ee1f2003-01-15 17:40:35 +000041AM_GNU_GETTEXT_VERSION(0.11.5)
42AM_GNU_GETTEXT([external], [need-ngettext])
David Lawrence Ramsey935594b2006-07-18 18:16:30 +000043AM_CONDITIONAL(USE_NLS, test x$USE_NLS = xyes)
Jordi Mallach631ee1f2003-01-15 17:40:35 +000044
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +000045dnl Data location.
46
47pkgdatadir=${datadir}/${PACKAGE}
48AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
49
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000050dnl Checks for header files.
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +000051
Chris Allegrettab00d0b92011-02-13 04:23:10 +000052AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h stdarg.h magic.h)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000053
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +000054dnl Checks for options.
55
David Lawrence Ramseye53c3822007-04-19 03:23:16 +000056AC_ARG_ENABLE(debug,
Chris Allegretta6df90f52002-07-19 01:08:59 +000057[ --enable-debug Enable debugging (disabled by default)],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +000058[if test x$enableval = xyes; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +000059 AC_DEFINE(DEBUG, 1, [Define this to enable debug messages and assert warnings.]) debug_support=yes
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +000060fi])
Chris Allegretta6df90f52002-07-19 01:08:59 +000061
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +000062if test x$debug_support != xyes; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +000063 AC_DEFINE(NDEBUG, 1, [Shut up assert warnings :-)])
Chris Allegretta6df90f52002-07-19 01:08:59 +000064fi
65
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +000066AC_ARG_ENABLE(tiny,
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000067[ --enable-tiny Disable features for the sake of size],
Chris Allegretta7162e3d2002-04-06 05:02:14 +000068[if test x$enableval = xyes; then
David Lawrence Ramseyebe34252005-11-15 03:17:35 +000069 AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
David Lawrence Ramsey708de362005-11-22 20:24:22 +000070 AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
David Lawrence Ramseyf50bd4b2006-04-14 20:15:44 +000071 AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +000072 AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
David Lawrence Ramsey512adf62007-12-20 17:06:01 +000073 AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +000074 AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
David Lawrence Ramsey708de362005-11-22 20:24:22 +000075 AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +000076 AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
77 AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +000078fi])
Chris Allegretta2d7893d2001-07-11 02:08:33 +000079
Chris Allegretta83c3f952008-09-30 16:47:57 +000080
81AC_ARG_ENABLE(extra,
82[ --disable-extra Disable extra features, currently only easter eggs],
83[if test x$enableval != xno; then
84 AC_DEFINE(NANO_EXTRA, 1, [Define this to enable extra stuff.]) extra_support=yes
85fi],
86 [if test x$enable_tiny != xyes; then
87 AC_DEFINE(NANO_EXTRA, 1, [Define this to enable extra stuff.]) extra_support=yes
88 fi])
89
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +000090AC_ARG_ENABLE(browser,
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +000091[ --disable-browser Disable built-in file browser],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +000092[if test x$enableval != xyes; then
David Lawrence Ramsey854b71d2005-06-03 01:43:56 +000093 AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +000094fi])
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +000095
96AC_ARG_ENABLE(help,
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +000097[ --disable-help Disable help functions],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +000098[if test x$enableval != xyes; then
David Lawrence Ramseyf50bd4b2006-04-14 20:15:44 +000099 AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000100fi])
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000101
102AC_ARG_ENABLE(justify,
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000103[ --disable-justify Disable justify/unjustify functions],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000104[if test x$enableval != xyes; then
David Lawrence Ramseye53c3822007-04-19 03:23:16 +0000105 AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000106fi])
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000107
108AC_ARG_ENABLE(mouse,
109[ --disable-mouse Disable mouse support (and -m flag)],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000110[if test x$enableval != xyes; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000111 AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000112fi])
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000113
114AC_ARG_ENABLE(operatingdir,
115[ --disable-operatingdir Disable setting of operating directory (chroot of sorts)],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000116[if test x$enableval != xyes; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000117 AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000118fi])
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000119
120AC_ARG_ENABLE(speller,
David Lawrence Ramsey708de362005-11-22 20:24:22 +0000121[ --disable-speller Disable spell checker functions],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000122[if test x$enableval != xyes; then
David Lawrence Ramsey708de362005-11-22 20:24:22 +0000123 AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000124fi])
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000125
126AC_ARG_ENABLE(tabcomp,
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000127[ --disable-tabcomp Disable tab completion functions],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000128[if test x$enableval != xyes; then
David Lawrence Ramseye53c3822007-04-19 03:23:16 +0000129 AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000130fi])
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000131
132AC_ARG_ENABLE(wrapping,
133[ --disable-wrapping Disable all wrapping of text (and -w flag)],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000134[if test x$enableval != xyes; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000135 AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000136fi])
Chris Allegrettaea066c82001-04-13 02:32:06 +0000137
David Lawrence Ramseydc60b722002-10-25 16:08:53 +0000138AC_ARG_ENABLE(wrapping-as-root,
139[ --disable-wrapping-as-root Disable wrapping of text as root by default],
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000140[if test x$enableval != xyes; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000141 AC_DEFINE(DISABLE_ROOTWRAPPING, 1, [Define this to disable text wrapping as root by default.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000142fi])
David Lawrence Ramseydc60b722002-10-25 16:08:53 +0000143
Chris Allegretta18d70f12001-04-28 15:53:28 +0000144AC_ARG_ENABLE(color,
Chris Allegretta025548a2008-09-30 15:30:51 +0000145[ --disable-color Disable color and syntax highlighting],
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000146if test x$enableval != xno; then
David Lawrence Ramsey84b9f4b2006-07-12 18:59:29 +0000147 if test x$ac_cv_header_regex_h = xyes; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000148 AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
David Lawrence Ramsey84b9f4b2006-07-12 18:59:29 +0000149 AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
150 else
151 AC_MSG_ERROR([
152*** The header file regex.h was not found. If you wish to use color
153*** support this header file is required. Please either install C
Chris Allegretta025548a2008-09-30 15:30:51 +0000154*** libraries that include the regex.h file or call the configure
155*** script with --disable-color.])
David Lawrence Ramsey84b9f4b2006-07-12 18:59:29 +0000156 fi
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000157fi,
Chris Allegretta83c3f952008-09-30 16:47:57 +0000158 if test x$enable_tiny != xyes; then
159 if test x$ac_cv_header_regex_h = xyes; then
160 AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
161 AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
162 else
163 AC_MSG_ERROR([
Chris Allegretta025548a2008-09-30 15:30:51 +0000164*** The header file regex.h was not found. If you wish to use color
165*** support this header file is required. Please either install C
166*** libraries that include the regex.h file or call the configure
167*** script with --disable-color.])
Chris Allegretta83c3f952008-09-30 16:47:57 +0000168 fi
Chris Allegretta025548a2008-09-30 15:30:51 +0000169 fi
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000170)
Chris Allegretta18d70f12001-04-28 15:53:28 +0000171
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000172AC_ARG_ENABLE(multibuffer,
Chris Allegretta025548a2008-09-30 15:30:51 +0000173[ --disable-multibuffer Disable multiple file buffers],
174[if test x$enableval != xno; then
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000175 AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
Chris Allegretta025548a2008-09-30 15:30:51 +0000176fi],
Chris Allegretta83c3f952008-09-30 16:47:57 +0000177 [if test x$enable_tiny != xyes; then
178 AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
179 fi])
Chris Allegrettabe77c612000-11-24 14:00:16 +0000180
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000181AC_ARG_ENABLE(nanorc,
Chris Allegretta025548a2008-09-30 15:30:51 +0000182[ --disable-nanorc Disable use of .nanorc files],
183[if test x$enableval != xno; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000184 AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
Chris Allegretta025548a2008-09-30 15:30:51 +0000185fi],
Chris Allegretta83c3f952008-09-30 16:47:57 +0000186 [if test x$enable_tiny != xyes; then
187 AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
188 fi])
Chris Allegrettae1f14522001-09-19 03:19:43 +0000189
Chris Allegrettad957f592003-01-17 00:17:45 +0000190AC_ARG_ENABLE(all,
Chris Allegretta025548a2008-09-30 15:30:51 +0000191[ --enable-all Enable ALL extra nano functionality (ignored for compatibility as all options default to on)],
Chris Allegrettad957f592003-01-17 00:17:45 +0000192[if test x$enableval = xyes; then
Chris Allegrettab43f6912009-11-29 06:24:10 +0000193 echo "--enable-all option no longer needed, ignoring for compatibility"
Chris Allegrettad957f592003-01-17 00:17:45 +0000194fi])
195
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000196AC_MSG_CHECKING([whether to enable UTF-8 support])
197AC_ARG_ENABLE(utf8,
198[ --enable-utf8 Enable UTF-8 support],
199[if test x$enableval = xyes; then
200 enable_utf8=yes
201else
202 enable_utf8=no
203fi],
204[enable_utf8=auto])
205AC_MSG_RESULT($enable_utf8)
206
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000207AC_MSG_CHECKING([whether to use slang])
208CURSES_LIB_NAME=""
209AC_ARG_WITH(slang,
210[ --with-slang[=DIR] Use the slang library instead of curses],
211[ case "$with_slang" in
212 no)
213 AC_MSG_RESULT(no)
214 ;;
215 *)
216 AC_MSG_RESULT(yes)
217
218 if test x$with_slang != xyes; then
219 # Add additional search path
220 LDFLAGS="-L$with_slang/lib $LDFLAGS"
221 CPPFLAGS="-I$with_slang/include $CPPFLAGS"
222 fi
223
224 if test x$enable_utf8 != xno; then
225 AC_CHECK_HEADER(slcurses.h,
226 AC_MSG_CHECKING([for SLutf8_enable in -lslang])
227 _libs=$LIBS
228 LIBS="$LIBS -lslang"
229 AC_TRY_RUN([
230#include <slcurses.h>
231int main(void)
232{
233 SLutf8_enable(1);
234 return 0;
235}],
236 [AC_MSG_RESULT(yes)
237 AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
238 CURSES_LIB_WIDE=yes
239 if test x$with_slang != xyes; then
240 CURSES_LIB="-L${with_slang}/lib -lslang"
241 else
242 CURSES_LIB="-lslang"
243 fi
244 CURSES_LIB_NAME=slang],
245 [AC_MSG_RESULT(no)
246
247 # We might need the term library
248 for termlib in ncurses curses termcap terminfo termlib; do
249 AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
250 test -n "$tcap" && break
251 done
252
253 AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
254 LIBS="$LIBS $tcap"
255 AC_TRY_RUN([
256#include <slcurses.h>
257int main(void)
258{
259 SLutf8_enable(1);
260 return 0;
261}],
262 [AC_MSG_RESULT(yes)
263 AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
264 CURSES_LIB_WIDE=yes
265 if test x$with_slang != xyes; then
266 CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
267 else
268 CURSES_LIB="-lslang $tcap"
269 fi
270 CURSES_LIB_NAME=slang],
271 [AC_MSG_RESULT(no)
272
273 # We might need the math library
274 AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
275 LIBS="$LIBS -lm"
276 AC_TRY_RUN([
277#include <slcurses.h>
278int main(void)
279{
280 SLutf8_enable(1);
281 return 0;
282}],
283 [AC_MSG_RESULT(yes)
284 AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
285 CURSES_LIB_WIDE=yes
286 if test x$with_slang != xyes; then
287 CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
288 else
289 CURSES_LIB="-lslang $tcap -lm"
290 fi
291 CURSES_LIB_NAME=slang],
292 [AC_MSG_RESULT(no)],
293 AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
294 AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
295 AC_MSG_WARN([*** Can not use slang when cross-compiling])),
296 AC_MSG_ERROR([
297*** The header file slcurses.h was not found. If you wish to use
298*** slang support this header file is required. Please either
299*** install a version of slang that includes the slcurses.h file or
300*** do not call the configure script with --with-slang.]))
301 fi
302
303 if eval "test x$CURSES_LIB_NAME = x"; then
304 # Reset libs if the above slang tests failed
305 if test x$enable_utf8 != xno; then
306 LIBS=$_libs
307 fi
308
309 AC_CHECK_HEADER(slcurses.h,
310 AC_MSG_CHECKING([for SLtt_initialize in -lslang])
311 _libs=$LIBS
312 LIBS="$LIBS -lslang"
313 AC_TRY_RUN([
314#include <slcurses.h>
315int main(void)
316{
317 SLtt_initialize(NULL);
318 return 0;
319}],
320 [AC_MSG_RESULT(yes)
321 AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
322 if test x$with_slang != xyes; then
323 CURSES_LIB="-L${with_slang}/lib -lslang"
324 else
325 CURSES_LIB="-lslang"
326 fi
327 CURSES_LIB_NAME=slang],
328 [AC_MSG_RESULT(no)
329
330 # We might need the term library
331 for termlib in ncurses curses termcap terminfo termlib; do
332 AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
333 test -n "$tcap" && break
334 done
335
336 AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
337 LIBS="$LIBS $tcap"
338 AC_TRY_RUN([
339#include <slcurses.h>
340int main(void)
341{
342 SLtt_initialize(NULL);
343 return 0;
344}],
345 [AC_MSG_RESULT(yes)
346 AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
347 if test x$with_slang != xyes; then
348 CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
349 else
350 CURSES_LIB="-lslang $tcap"
351 fi
352 CURSES_LIB_NAME=slang],
353 [AC_MSG_RESULT(no)
354
355 # We might need the math library
356 AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
357 LIBS="$LIBS -lm"
358 AC_TRY_RUN([
359#include <slcurses.h>
360int main(void)
361{
362 SLtt_initialize(NULL);
363 return 0;
364}],
365 [AC_MSG_RESULT(yes)
366 AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
367 if test x$with_slang != xyes; then
368 CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
369 else
370 CURSES_LIB="-lslang $tcap -lm"
371 fi
372 CURSES_LIB_NAME=slang],
373 [AC_MSG_RESULT(no)],
374 AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
375 AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
376 AC_MSG_WARN([*** Can not use slang when cross-compiling])),
377 AC_MSG_ERROR([
378*** The header file slcurses.h was not found. If you wish to use
379*** slang support this header file is required. Please either
380*** install a version of slang that includes the slcurses.h file or
381*** do not call the configure script with --with-slang.]))
382 fi
383
384 if test "${_libs+set}" = "set"; then
385 LIBS=$_libs
386 fi
387
388 if test x$with_slang != xyes; then
389 LDFLAGS=${_ldflags}
390 fi
391 ;;
392 esac], [AC_MSG_RESULT(no)])
393
David Lawrence Ramsey3334eed2007-12-18 16:13:37 +0000394if test x$CURSES_LIB_NAME = xslang; then
395 AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
396 AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
397 AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
398 AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
David Lawrence Ramsey512adf62007-12-20 17:06:01 +0000399 AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
David Lawrence Ramsey3334eed2007-12-18 16:13:37 +0000400 AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
401 AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
402 AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
403 AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
404fi
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000405
David Lawrence Ramsey935594b2006-07-18 18:16:30 +0000406AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
David Lawrence Ramsey90098902007-01-06 18:06:02 +0000407AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +0000408
Chris Allegrettafaeeb5b2008-08-28 06:13:05 +0000409AC_ARG_ENABLE(altrcname,
410[ --enable-altrcname Specify alternate rcfile name (default: .nanorc)],
411[if test x$enableval != no; then
412 AC_DEFINE_UNQUOTED(RCFILE_NAME, "$enableval", [Specify alternate rcfile name (default: .nanorc)]) rcfilename=$enableval
413fi])
414
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000415dnl Checks for functions.
416
David Lawrence Ramseyda50e732005-07-04 04:22:30 +0000417AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000418
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000419if test x$enable_utf8 != xno; then
David Lawrence Ramseya78b4352007-05-25 14:39:40 +0000420 AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth)
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000421fi
422
David Lawrence Ramseyda50e732005-07-04 04:22:30 +0000423if test x$ac_cv_func_vsnprintf = xno; then
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000424 AM_PATH_GLIB_2_0(2.0.0,,
425 AC_MSG_ERROR([
David Lawrence Ramseyda50e732005-07-04 04:22:30 +0000426*** vsnprintf() not found. GLIB 2.x not found either. You should
427*** install the GLIB 2.x library which can be found at
428*** ftp://ftp.gtk.org/.]),
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000429 glib)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000430fi
431
432dnl Checks for typedefs, structures, and compiler characteristics.
433
434dnl Checks for library functions.
435AC_TYPE_SIGNAL
436AC_FUNC_VPRINTF
437AC_CHECK_FUNCS(getopt_long)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000438dnl Checks for libraries.
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000439
440if eval "test x$CURSES_LIB_NAME = x"; then
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000441 AC_CHECK_HEADERS(ncurses.h)
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000442
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000443 if test x$enable_utf8 != xno; then
Chris Allegretta66e59722013-01-21 03:36:18 +0000444 OLDLIBS="$LIBS"
445 AC_CHECK_TOOL(NCURSESW_CONFIG, ncursesw5-config, no)
446 if test "x$NCURSESW_CONFIG" != xno; then
447 CURSES_LIB=`$NCURSESW_CONFIG --libs`
448 LIBS="$CURSES_LIB $LIBS"
449 CPPFLAGS="`$NCURSESW_CONFIG --cflags` $CPPFLAGS"
450 AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
451 else
452 AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
453 fi
454 LIBS="$OLDLIBS"
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000455 fi
456
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000457 if eval "test x$CURSES_LIB_NAME = x"; then
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000458 AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000459 fi
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000460fi
461
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000462if eval "test x$CURSES_LIB_NAME = x"; then
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000463 AC_CHECK_HEADERS(curses.h)
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000464
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000465 if test x$enable_utf8 != xno; then
David Lawrence Ramsey25799f62005-06-18 17:06:02 +0000466 AC_CHECK_LIB(curses, get_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000467 fi
468
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000469 if eval "test x$CURSES_LIB_NAME = x"; then
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000470 AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
471 fi
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000472fi
473
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000474if eval "test x$CURSES_LIB_NAME = x"; then
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000475 AC_MSG_WARN([
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000476*** No curses lib available. Consider getting the official ncurses
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000477*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
478*** errors compiling nano.])
479else
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000480 AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000481fi
482
David Lawrence Ramseyd6c24c42005-07-27 03:11:41 +0000483AC_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.]))
Chris Allegrettac08f50d2001-01-06 18:12:43 +0000484
David Lawrence Ramseyd08348b2004-09-18 22:02:21 +0000485dnl Parse any configure options.
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000486
487LIBS="$LIBS $CURSES_LIB"
Chris Allegretta6724a7e2000-06-19 23:19:07 +0000488
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000489AC_SUBST(CURSES_LIB)
490
David Lawrence Ramsey261da142005-06-21 15:41:46 +0000491if test "x$GLIB_CFLAGS" != "x"; then
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000492 CFLAGS="$CFLAGS $GLIB_CFLAGS"
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000493fi
David Lawrence Ramsey261da142005-06-21 15:41:46 +0000494if test "x$GLIB_LIBS" != "x"; then
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000495 LDFLAGS="$LDFLAGS $GLIB_LIBS"
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000496fi
497
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000498if test x$enable_utf8 != xno && \
David Lawrence Ramsey99466bf2005-06-21 15:47:39 +0000499 test x$CURSES_LIB_WIDE = xyes && \
500 test x$ac_cv_func_iswalnum = xyes && \
501 test x$ac_cv_func_iswpunct = xyes && \
502 (test x$ac_cv_func_iswblank = xyes || test x$ac_cv_func_iswspace = xyes) && \
David Lawrence Ramseya78b4352007-05-25 14:39:40 +0000503 test x$ac_cv_func_nl_langinfo = xyes && \
David Lawrence Ramsey99466bf2005-06-21 15:47:39 +0000504 test x$ac_cv_func_mblen = xyes && \
505 test x$ac_cv_func_mbstowcs = xyes && \
506 test x$ac_cv_func_mbtowc = xyes && \
507 test x$ac_cv_func_wctomb = xyes && \
508 test x$ac_cv_func_wcwidth = xyes; then
David Lawrence Ramseya78b4352007-05-25 14:39:40 +0000509 AC_DEFINE(ENABLE_UTF8, 1, [Define this if your system has sufficient UTF-8 support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), nl_langinfo, mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000510else
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000511 if test x$enable_utf8 = xyes; then
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000512 AC_MSG_ERROR([
513*** UTF-8 support was requested, but insufficient UTF-8 support was
514*** detected in your curses and/or C libraries. Please verify that your
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000515*** slang was built with UTF-8 support or your curses was built with
516*** wide character support, and that your C library was built with wide
517*** character support.])
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000518 elif test x$enable_utf8 != xno; then
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000519 AC_MSG_WARN([
520*** Insufficient UTF-8 support was detected in your curses and/or C
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000521*** libraries. If you want UTF-8 support, please verify that your slang
522*** was built with UTF-8 support or your curses was built with wide
523*** character support, and that your C library was built with wide
524*** character support.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000525 fi
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000526fi
527
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000528if test x$color_support = xyes; then
529 # now check for the end of word boundary support (/< and />)
530 AC_MSG_CHECKING([for GNU-style word boundary regex support])
Chris Allegrettaa1495492013-01-20 17:57:04 +0000531
532 AC_ARG_WITH(wordbounds,
533 [ --with-wordbounds Use GNU-style word boundary delimiters],
534 [ case "$with_wordbounds" in
535 no)
536 AC_MSG_RESULT(no)
537 ;;
538 *)
539 AC_MSG_RESULT(yes)
540 # We explicitly don't check if the user forced the option, because
541 # this is needed for cross compilers and we cant test the target
542 AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
543 ;;
544 esac
545 ], [
546 AC_TRY_RUN([
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000547#ifdef HAVE_SYS_TYPES_H
548#include <sys/types.h>
549#endif
550#include <regex.h>
551int main(void)
552{
553 regex_t r;
554 size_t nmatch;
555 regmatch_t pmatch;
556
557 if (regcomp(&r, "\\\\>", REG_EXTENDED|REG_NOSUB))
558 return 1;
559 if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
560 return 1;
561 return 0;
562}],
Chris Allegrettaa1495492013-01-20 17:57:04 +0000563 AC_MSG_RESULT(yes)
564 AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
565 AC_MSG_RESULT(no),
566 AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
567 )
568])
569
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000570# if test x$CURSES_LIB_NAME = xcurses; then
571 AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
572 AC_TRY_RUN([
573#include <curses.h>
574int main(void)
575{
576 int testcolor = COLOR_WHITE;
577 return 0;
578}], AC_MSG_RESULT(no),
579 AC_TRY_RUN([
580#ifndef _XOPEN_SOURCE_EXTENDED
581#define _XOPEN_SOURCE_EXTENDED 1
582#endif
583#include <curses.h>
584int main(void)
585{
586 int testcolor = COLOR_WHITE;
587 return 0;
588}],
589 AC_DEFINE(NEED_XOPEN_SOURCE_EXTENDED, 1, [Define this if you need the _XOPEN_SOURCE_EXTENDED macro for color support])
590 AC_MSG_RESULT(yes),
591 AC_MSG_RESULT(not sure)
592 AC_MSG_WARN([*** Couldn't successfully compile basic color test with or without _XOPEN_SOURCE_EXTENDED])
593 AC_MSG_WARN([*** This build may not compile. Consider configuring with --disable-color or installing ncurses])),
594 AC_MSG_WARN([*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling]))
595 fi
596#fi
597
Chris Allegretta42bd8712010-03-07 19:35:46 +0000598AC_MSG_CHECKING([whether LINES and COLS can be redefined])
599AC_TRY_RUN([
600#include <curses.h>
601int main(void)
602{
603 LINES = 80;
604 COLS = 25;
605 return 0;
606}],
607AC_DEFINE(REDEFINIG_MACROS_OK, 1, [Define this if you know your curses library allows LINES and COLS to be redefined to deal with a resizing bug])
608AC_MSG_RESULT(yes),
609AC_MSG_RESULT(no),
610AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
611
Chris Allegrettab00d0b92011-02-13 04:23:10 +0000612AC_CHECK_LIB(magic, magic_open)
Chris Allegretta42bd8712010-03-07 19:35:46 +0000613
Chris Allegretta7aec3922009-02-15 19:16:18 +0000614# Check for groff html support
615AC_MSG_CHECKING([for HTML support in groff])
616groff -t -mandoc -Thtml </dev/null >/dev/null
617if test $? -ne 0 ; then
618 echo "no"
619 echo "*** Will not generate HTML version of man pages ***"
620 echo "*** Consider installing a newer version of groff with HTML support ***"
621 groff_html_support=no
622else
623 echo "yes"
624 groff_html_support=yes
625fi
626AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes)
627
628
Jordi Mallach298b9752003-09-07 00:44:12 +0000629AC_CONFIG_FILES([
630Makefile
631doc/Makefile
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +0000632doc/nanorc.sample
Jordi Mallach298b9752003-09-07 00:44:12 +0000633doc/man/Makefile
634doc/man/fr/Makefile
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +0000635doc/syntax/Makefile
Jordi Mallach298b9752003-09-07 00:44:12 +0000636doc/texinfo/Makefile
637m4/Makefile
638po/Makefile.in
639src/Makefile
640nano.spec
641])
642
Jordi Mallach3c5653d2002-02-23 18:23:43 +0000643AC_OUTPUT