blob: a1051c2311bd37d9955488038edf8a434fa7a13d [file] [log] [blame]
Benno Schulenberg49fc5282016-08-14 21:18:00 +02001# Configuration for GNU nano - a small and user-friendly text editor
Jordi Mallach631ee1f2003-01-15 17:40:35 +00002#
Benno Schulenberg7a9f4a42014-04-30 20:18:26 +00003# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4# 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc.
Jordi Mallach631ee1f2003-01-15 17:40:35 +00005#
Benno Schulenberg514cd9a2016-08-29 17:10:49 +02006# GNU nano is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published
8# by the Free Software Foundation, either version 3 of the License,
9# or (at your option) any later version.
Jordi Mallach631ee1f2003-01-15 17:40:35 +000010#
Benno Schulenberg514cd9a2016-08-29 17:10:49 +020011# GNU nano is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty
13# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14# See the GNU 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
Benno Schulenberg514cd9a2016-08-29 17:10:49 +020017# along with this program. If not, see http://www.gnu.org/licenses/.
Jordi Mallach631ee1f2003-01-15 17:40:35 +000018
Benno Schulenberg926fe5f2017-02-23 11:20:27 +010019AC_INIT([GNU nano], [2.7.5], [nano-devel@gnu.org], [nano])
Jordi Mallach298b9752003-09-07 00:44:12 +000020AC_CONFIG_SRCDIR([src/nano.c])
Chris Allegretta636e76a2013-01-03 03:47:26 +000021AC_CANONICAL_HOST
Jordi Mallach631ee1f2003-01-15 17:40:35 +000022AM_INIT_AUTOMAKE
Jordi Mallachd7b63252004-11-18 00:05:14 +000023AC_CONFIG_HEADERS([config.h])
Jordi Mallach631ee1f2003-01-15 17:40:35 +000024
Benno Schulenberg73ff00e2014-04-02 21:03:32 +000025dnl Make sure the ONCE macros are available.
26
27AC_PREREQ(2.61)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000028
29dnl Checks for programs.
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +000030
David Lawrence Ramsey9830d752004-05-13 17:19:54 +000031AC_GNU_SOURCE
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000032AC_PROG_CC
David Lawrence Ramsey76fb3ec2004-08-01 16:09:15 +000033AC_PROG_LN_S
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000034AC_ISC_POSIX
Jordi Mallach3c5653d2002-02-23 18:23:43 +000035AC_SYS_LARGEFILE
Benno Schulenberg41727142014-03-24 13:42:58 +000036PKG_PROG_PKG_CONFIG
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000037
Jordi Mallach631ee1f2003-01-15 17:40:35 +000038dnl Internationalization macros.
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +000039
Jordi Mallach631ee1f2003-01-15 17:40:35 +000040AM_GNU_GETTEXT_VERSION(0.11.5)
41AM_GNU_GETTEXT([external], [need-ngettext])
David Lawrence Ramsey935594b2006-07-18 18:16:30 +000042AM_CONDITIONAL(USE_NLS, test x$USE_NLS = xyes)
Jordi Mallach631ee1f2003-01-15 17:40:35 +000043
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +000044dnl Data location.
45
46pkgdatadir=${datadir}/${PACKAGE}
47AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
48
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000049dnl Checks for header files.
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +000050
Benno Schulenbergeaff14f2014-03-24 13:47:37 +000051AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h stdarg.h)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000052
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +000053dnl Checks for options.
54
Benno Schulenberg9d306cd2014-04-03 19:50:12 +000055AC_ARG_ENABLE(browser,
56AS_HELP_STRING([--disable-browser], [Disable built-in file browser]))
57if test "x$enable_browser" = xno; then
58 AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
59fi
60
61AC_ARG_ENABLE(color,
62AS_HELP_STRING([--disable-color], [Disable color and syntax highlighting]))
63if test "x$enable_nanorc" = xno; then
64 if test "x$enable_color" = xyes; then
65 AC_MSG_ERROR([--enable-color cannot work with --disable-nanorc])
66 else
Benno Schulenberg00389922014-04-04 11:59:03 +000067 # Disabling nanorc silently disables color support.
Benno Schulenberg9d306cd2014-04-03 19:50:12 +000068 enable_color=no
69 fi
70fi
Benno Schulenberg00389922014-04-04 11:59:03 +000071if test "x$enable_color" = xno; then
72 AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.])
73else
74 if test x$ac_cv_header_regex_h != xyes; then
Benno Schulenberg9d306cd2014-04-03 19:50:12 +000075 AC_MSG_ERROR([
Benno Schulenberg00389922014-04-04 11:59:03 +000076*** The header file regex.h was not found. If you wish to have
77*** color support, this header file is required. Please either
78*** install C libraries that include the regex.h file, or call
79*** the configure script with --disable-color.])
80 else
81 color_support=yes
Benno Schulenberg9d306cd2014-04-03 19:50:12 +000082 fi
83fi
Chris Allegretta83c3f952008-09-30 16:47:57 +000084
Mike Scalora6a2032f2016-05-25 22:13:50 +020085AC_ARG_ENABLE(comment,
86AS_HELP_STRING([--disable-comment], [Disable comment/uncomment functions]))
87if test "x$enable_tiny" = xyes; then
88 if test "x$enable_comment" = xyes; then
89 AC_MSG_ERROR([--enable-comment cannot work with --enable-tiny])
90 else
Mike Scalora6a2032f2016-05-25 22:13:50 +020091 enable_comment=no
92 fi
93fi
94if test "x$disable_comment" != xyes; then
95 if test "x$enable_comment" != xno; then
Benno Schulenberg964c10d2016-12-07 19:56:27 +010096 AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.])
Mike Scalora6a2032f2016-05-25 22:13:50 +020097 fi
98fi
99
Chris Allegretta83c3f952008-09-30 16:47:57 +0000100AC_ARG_ENABLE(extra,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000101AS_HELP_STRING([--disable-extra], [Disable extra features, currently only easter eggs]))
Benno Schulenbergd17438b2014-04-03 20:57:44 +0000102if test "x$enable_extra" = xno; then
103 AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000104fi
Chris Allegretta83c3f952008-09-30 16:47:57 +0000105
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000106AC_ARG_ENABLE(help,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000107AS_HELP_STRING([--disable-help], [Disable help functions]))
108if test "x$enable_help" = xno; then
David Lawrence Ramseyf50bd4b2006-04-14 20:15:44 +0000109 AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000110fi
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000111
Benno Schulenberg0615acd2014-06-19 17:39:26 +0000112AC_ARG_ENABLE(histories,
113AS_HELP_STRING([--disable-histories], [Disable search and position histories]))
114if test "x$enable_histories" = xno; then
115 AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.])
116fi
117
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000118AC_ARG_ENABLE(justify,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000119AS_HELP_STRING([--disable-justify], [Disable justify/unjustify functions]))
120if test "x$enable_justify" = xno; then
David Lawrence Ramseye53c3822007-04-19 03:23:16 +0000121 AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000122fi
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000123
Benno Schulenberg9d306cd2014-04-03 19:50:12 +0000124AC_ARG_ENABLE(libmagic,
125AS_HELP_STRING([--disable-libmagic], [Disable detection of file types via libmagic]))
126
Faissal Bensefiade95ca62016-10-20 09:44:29 +0100127AC_ARG_ENABLE(linenumbers,
128AS_HELP_STRING([--disable-linenumbers], [Disable line numbering]))
129if test "x$enable_tiny" = xyes; then
130 if test "x$enable_linenumbers" != xyes; then
131 enable_linenumbers=no
132 fi
133fi
134if test "x$disable_linenumbers" != xyes; then
135 if test "x$enable_linenumbers" != xno; then
136 AC_DEFINE(ENABLE_LINENUMBERS, 1, [Define this to enable line numbering.])
137 fi
138fi
139
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000140AC_ARG_ENABLE(mouse,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000141AS_HELP_STRING([--disable-mouse], [Disable mouse support (and -m flag)]))
142if test "x$enable_mouse" = xno; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000143 AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000144fi
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000145
Benno Schulenberg9d306cd2014-04-03 19:50:12 +0000146AC_ARG_ENABLE(multibuffer,
147AS_HELP_STRING([--disable-multibuffer], [Disable multiple file buffers]))
Benno Schulenberg0636d7b2014-04-03 20:23:07 +0000148if test "x$enable_multibuffer" = xno; then
149 AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.])
Benno Schulenberg9d306cd2014-04-03 19:50:12 +0000150fi
151
152AC_ARG_ENABLE(nanorc,
153AS_HELP_STRING([--disable-nanorc], [Disable use of .nanorc files]))
Benno Schulenbergeea09082014-04-13 20:50:20 +0000154if test "x$enable_nanorc" = xno; then
155 AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
156else
Benno Schulenberg9d306cd2014-04-03 19:50:12 +0000157 nanorc_support=yes
158fi
159
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000160AC_ARG_ENABLE(operatingdir,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000161AS_HELP_STRING([--disable-operatingdir], [Disable setting of operating directory (chroot of sorts)]))
162if test "x$enable_operatingdir" = xno; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000163 AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000164fi
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000165
166AC_ARG_ENABLE(speller,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000167AS_HELP_STRING([--disable-speller], [Disable spell checker functions]))
168if test "x$enable_speller" = xno; then
David Lawrence Ramsey708de362005-11-22 20:24:22 +0000169 AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000170fi
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000171
172AC_ARG_ENABLE(tabcomp,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000173AS_HELP_STRING([--disable-tabcomp], [Disable tab completion functions]))
174if test "x$enable_tabcomp" = xno; then
Benno Schulenberg964c10d2016-12-07 19:56:27 +0100175 AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab completion functions for filenames and search strings.])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000176fi
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000177
Benno Schulenberg68a03142016-12-07 13:10:40 +0100178AC_ARG_ENABLE(wordcomp,
179AS_HELP_STRING([--disable-wordcomp], [Disable the word completion function]))
180if test "x$enable_tiny" = xyes; then
181 if test "x$enable_wordcomp" = xyes; then
182 AC_MSG_ERROR([--enable-wordcomp cannot work with --enable-tiny])
183 else
184 enable_wordcomp=no
185 fi
186fi
187if test "x$disable_wordcomp" != xyes; then
188 if test "x$enable_wordcomp" != xno; then
189 AC_DEFINE(ENABLE_WORDCOMPLETION, 1, [Define this to enable the word completion function.])
190 fi
191fi
192
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000193AC_ARG_ENABLE(wrapping,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000194AS_HELP_STRING([--disable-wrapping], [Disable all wrapping of text (and -w flag)]))
195if test "x$enable_wrapping" = xno; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000196 AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000197fi
Chris Allegrettaea066c82001-04-13 02:32:06 +0000198
David Lawrence Ramseydc60b722002-10-25 16:08:53 +0000199AC_ARG_ENABLE(wrapping-as-root,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000200AS_HELP_STRING([--disable-wrapping-as-root], [Disable wrapping of text as root by default]))
201if test "x$enable_wrapping_as_root" = xno; then
David Lawrence Ramseyd21eea02006-11-25 18:26:07 +0000202 AC_DEFINE(DISABLE_ROOTWRAPPING, 1, [Define this to disable text wrapping as root by default.])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000203fi
David Lawrence Ramseydc60b722002-10-25 16:08:53 +0000204
Benno Schulenberg99011702014-04-04 13:12:07 +0000205AC_ARG_ENABLE(debug,
206AS_HELP_STRING([--enable-debug], [Enable debugging (disabled by default)]))
207if test "x$enable_debug" = xyes; then
208 AC_DEFINE(DEBUG, 1, [Define this to enable debug messages and assert warnings.])
209else
210 AC_DEFINE(NDEBUG, 1, [Shut up assert warnings :-)])
211fi
212
213AC_ARG_ENABLE(tiny,
214AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size]))
215if test "x$enable_tiny" = xyes; then
216 AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.])
Benno Schulenberg1db6de42014-04-04 13:54:05 +0000217 if test "x$enable_browser" != xyes; then
218 AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
219 fi
Benno Schulenberg46b07fa2014-04-04 13:42:13 +0000220 if test "x$enable_color" != xyes; then
221 AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.])
222 color_support=no
Benno Schulenberg9cc64382014-04-13 21:05:57 +0000223 else
224 if test "x$enable_nanorc" != xyes; then
225 AC_MSG_ERROR([--enable-color with --enable-tiny cannot work without --enable-nanorc])
226 fi
Benno Schulenberg46b07fa2014-04-04 13:42:13 +0000227 fi
Benno Schulenberg1db6de42014-04-04 13:54:05 +0000228 if test "x$enable_extra" != xyes; then
Benno Schulenberg99011702014-04-04 13:12:07 +0000229 AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.])
230 fi
Benno Schulenberg1db6de42014-04-04 13:54:05 +0000231 if test "x$enable_help" != xyes; then
232 AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
233 fi
Benno Schulenberg0615acd2014-06-19 17:39:26 +0000234 if test "x$enable_histories" != xyes; then
235 AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.])
236 fi
Benno Schulenberg1db6de42014-04-04 13:54:05 +0000237 if test "x$enable_justify" != xyes; then
238 AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
239 fi
Benno Schulenberg5c7a6d72014-04-13 19:44:30 +0000240 if test "x$enable_libmagic" != xyes; then
241 enable_libmagic=no
242 fi
Benno Schulenberg1db6de42014-04-04 13:54:05 +0000243 if test "x$enable_mouse" != xyes; then
244 AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
245 fi
246 if test "x$enable_multibuffer" != xyes; then
Benno Schulenberg99011702014-04-04 13:12:07 +0000247 AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.])
248 fi
Benno Schulenbergeea09082014-04-13 20:50:20 +0000249 if test "x$enable_nanorc" != xyes; then
250 AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
251 fi
Benno Schulenberg1db6de42014-04-04 13:54:05 +0000252 if test "x$enable_operatingdir" != xyes; then
253 AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
254 fi
255 if test "x$enable_speller" != xyes; then
256 AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
257 fi
258 if test "x$enable_tabcomp" != xyes; then
259 AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab completion functions for files and search strings.])
260 fi
261 if test "x$enable_wrapping" != xyes; then
262 AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
263 fi
Benno Schulenberg99011702014-04-04 13:12:07 +0000264fi
265
Benno Schulenberg9d306cd2014-04-03 19:50:12 +0000266AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
267AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
Chris Allegrettad957f592003-01-17 00:17:45 +0000268
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000269AC_MSG_CHECKING([whether to enable UTF-8 support])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000270AC_ARG_ENABLE(utf8, AS_HELP_STRING([--enable-utf8], [Enable UTF-8 support]))
Benno Schulenbergc55ac2b2014-03-27 10:28:19 +0000271AC_MSG_RESULT(${enable_utf8:-auto})
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000272
Benno Schulenberg9d306cd2014-04-03 19:50:12 +0000273AC_ARG_ENABLE(altrcname,
274AS_HELP_STRING([--enable-altrcname], [Specify an alternate rcfile name (default: .nanorc)]),
275[if test x$enableval != no; then
276 AC_DEFINE_UNQUOTED(RCFILE_NAME, "$enableval", [Specify an alternate rcfile name (default: .nanorc).]) rcfilename=$enableval
277fi])
278
279
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000280AC_MSG_CHECKING([whether to use slang])
281CURSES_LIB_NAME=""
282AC_ARG_WITH(slang,
Benno Schulenberg673d2102014-03-26 09:35:52 +0000283AS_HELP_STRING([--with-slang[=DIR]], [Use the slang library instead of curses]),
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000284[ case "$with_slang" in
285 no)
286 AC_MSG_RESULT(no)
287 ;;
288 *)
289 AC_MSG_RESULT(yes)
290
291 if test x$with_slang != xyes; then
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000292 # Add additional search path.
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000293 LDFLAGS="-L$with_slang/lib $LDFLAGS"
294 CPPFLAGS="-I$with_slang/include $CPPFLAGS"
295 fi
296
Benno Schulenberg673d2102014-03-26 09:35:52 +0000297 if test "x$enable_utf8" != xno; then
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000298 AC_CHECK_HEADER(slcurses.h,
299 AC_MSG_CHECKING([for SLutf8_enable in -lslang])
300 _libs=$LIBS
301 LIBS="$LIBS -lslang"
302 AC_TRY_RUN([
303#include <slcurses.h>
304int main(void)
305{
306 SLutf8_enable(1);
307 return 0;
308}],
309 [AC_MSG_RESULT(yes)
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000310 AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000311 CURSES_LIB_WIDE=yes
312 if test x$with_slang != xyes; then
313 CURSES_LIB="-L${with_slang}/lib -lslang"
314 else
315 CURSES_LIB="-lslang"
316 fi
317 CURSES_LIB_NAME=slang],
318 [AC_MSG_RESULT(no)
319
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000320 # We might need the term library.
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000321 for termlib in ncurses curses termcap terminfo termlib; do
322 AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
323 test -n "$tcap" && break
324 done
325
326 AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
327 LIBS="$LIBS $tcap"
328 AC_TRY_RUN([
329#include <slcurses.h>
330int main(void)
331{
332 SLutf8_enable(1);
333 return 0;
334}],
335 [AC_MSG_RESULT(yes)
Benno Schulenberga4c0c2f2014-04-03 10:52:27 +0000336 AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000337 CURSES_LIB_WIDE=yes
338 if test x$with_slang != xyes; then
339 CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
340 else
341 CURSES_LIB="-lslang $tcap"
342 fi
343 CURSES_LIB_NAME=slang],
344 [AC_MSG_RESULT(no)
345
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000346 # We might need the math library.
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000347 AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
348 LIBS="$LIBS -lm"
349 AC_TRY_RUN([
350#include <slcurses.h>
351int main(void)
352{
353 SLutf8_enable(1);
354 return 0;
355}],
356 [AC_MSG_RESULT(yes)
Benno Schulenberga4c0c2f2014-04-03 10:52:27 +0000357 AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000358 CURSES_LIB_WIDE=yes
359 if test x$with_slang != xyes; then
360 CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
361 else
362 CURSES_LIB="-lslang $tcap -lm"
363 fi
364 CURSES_LIB_NAME=slang],
365 [AC_MSG_RESULT(no)],
366 AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
367 AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
368 AC_MSG_WARN([*** Can not use slang when cross-compiling])),
369 AC_MSG_ERROR([
370*** The header file slcurses.h was not found. If you wish to use
371*** slang support this header file is required. Please either
372*** install a version of slang that includes the slcurses.h file or
373*** do not call the configure script with --with-slang.]))
374 fi
375
376 if eval "test x$CURSES_LIB_NAME = x"; then
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000377 # Reset libs if the above slang tests failed.
Benno Schulenberg673d2102014-03-26 09:35:52 +0000378 if test "x$enable_utf8" != xno; then
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000379 LIBS=$_libs
380 fi
381
382 AC_CHECK_HEADER(slcurses.h,
383 AC_MSG_CHECKING([for SLtt_initialize in -lslang])
384 _libs=$LIBS
385 LIBS="$LIBS -lslang"
386 AC_TRY_RUN([
387#include <slcurses.h>
388int main(void)
389{
390 SLtt_initialize(NULL);
391 return 0;
392}],
393 [AC_MSG_RESULT(yes)
Benno Schulenberga4c0c2f2014-04-03 10:52:27 +0000394 AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000395 if test x$with_slang != xyes; then
396 CURSES_LIB="-L${with_slang}/lib -lslang"
397 else
398 CURSES_LIB="-lslang"
399 fi
400 CURSES_LIB_NAME=slang],
401 [AC_MSG_RESULT(no)
402
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000403 # We might need the term library.
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000404 for termlib in ncurses curses termcap terminfo termlib; do
405 AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
406 test -n "$tcap" && break
407 done
408
409 AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
410 LIBS="$LIBS $tcap"
411 AC_TRY_RUN([
412#include <slcurses.h>
413int main(void)
414{
415 SLtt_initialize(NULL);
416 return 0;
417}],
418 [AC_MSG_RESULT(yes)
Benno Schulenberga4c0c2f2014-04-03 10:52:27 +0000419 AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000420 if test x$with_slang != xyes; then
421 CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
422 else
423 CURSES_LIB="-lslang $tcap"
424 fi
425 CURSES_LIB_NAME=slang],
426 [AC_MSG_RESULT(no)
427
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000428 # We might need the math library.
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000429 AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
430 LIBS="$LIBS -lm"
431 AC_TRY_RUN([
432#include <slcurses.h>
433int main(void)
434{
435 SLtt_initialize(NULL);
436 return 0;
437}],
438 [AC_MSG_RESULT(yes)
Benno Schulenberga4c0c2f2014-04-03 10:52:27 +0000439 AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000440 if test x$with_slang != xyes; then
441 CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
442 else
443 CURSES_LIB="-lslang $tcap -lm"
444 fi
445 CURSES_LIB_NAME=slang],
446 [AC_MSG_RESULT(no)],
447 AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
448 AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
449 AC_MSG_WARN([*** Can not use slang when cross-compiling])),
450 AC_MSG_ERROR([
451*** The header file slcurses.h was not found. If you wish to use
452*** slang support this header file is required. Please either
453*** install a version of slang that includes the slcurses.h file or
454*** do not call the configure script with --with-slang.]))
455 fi
456
457 if test "${_libs+set}" = "set"; then
458 LIBS=$_libs
459 fi
460
461 if test x$with_slang != xyes; then
462 LDFLAGS=${_ldflags}
463 fi
464 ;;
465 esac], [AC_MSG_RESULT(no)])
466
Chris Allegrettafaeeb5b2008-08-28 06:13:05 +0000467
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000468dnl Checks for functions.
469
Benno Schulenbergd6ecb962014-04-15 15:17:40 +0000470AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf)
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000471
Benno Schulenberg673d2102014-03-26 09:35:52 +0000472if test "x$enable_utf8" != xno; then
David Lawrence Ramseya78b4352007-05-25 14:39:40 +0000473 AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth)
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000474fi
475
Benno Schulenbergd6ecb962014-04-15 15:17:40 +0000476if test x$ac_cv_func_snprintf = xno; then
477 AM_PATH_GLIB_2_0(2.0.0,,
478 AC_MSG_ERROR([
479*** snprintf() not found. GLIB 2.x not found either.
480*** You should install the GLIB 2.x library which can
481*** be found at http://ftp.gtk.org/.]),
482 glib)
483fi
484
David Lawrence Ramseyda50e732005-07-04 04:22:30 +0000485if test x$ac_cv_func_vsnprintf = xno; then
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000486 AM_PATH_GLIB_2_0(2.0.0,,
487 AC_MSG_ERROR([
Benno Schulenbergd6ecb962014-04-15 15:17:40 +0000488*** vsnprintf() not found. GLIB 2.x not found either.
489*** You should install the GLIB 2.x library which can
490*** be found at http://ftp.gtk.org/.]),
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000491 glib)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000492fi
493
494dnl Checks for typedefs, structures, and compiler characteristics.
495
Benno Schulenberg3de6c572014-03-24 13:31:37 +0000496dnl Checks for available flags.
Benno Schulenberg73ff00e2014-04-02 21:03:32 +0000497
Benno Schulenberg3de6c572014-03-24 13:31:37 +0000498AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"], [], [])
499
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000500dnl Checks for library functions.
Benno Schulenberg73ff00e2014-04-02 21:03:32 +0000501
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000502AC_TYPE_SIGNAL
503AC_FUNC_VPRINTF
504AC_CHECK_FUNCS(getopt_long)
Benno Schulenberg73ff00e2014-04-02 21:03:32 +0000505
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000506dnl Checks for libraries.
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000507
508if eval "test x$CURSES_LIB_NAME = x"; then
Benno Schulenberg673d2102014-03-26 09:35:52 +0000509 if test "x$enable_utf8" != xno; then
Benno Schulenberg41727142014-03-24 13:42:58 +0000510 PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
511 CURSES_LIB=$NCURSESW_LIBS
512 CPPFLAGS="$NCURSESW_CFLAGS $CPPFLAGS"
513 CURSES_LIB_NAME=ncursesw
514 CURSES_LIB_WIDE=yes
515 ], [:])
516 else
517 PKG_CHECK_MODULES([NCURSES], [ncurses], [
518 CURSES_LIB=$NCURSES_LIBS
519 CPPFLAGS="$NCURSES_CFLAGS $CPPFLAGS"
520 CURSES_LIB_NAME=ncurses
521 ], [:])
522 fi
523fi
524
525if eval "test x$CURSES_LIB_NAME = x"; then
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000526 AC_CHECK_HEADERS(ncurses.h)
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000527
Benno Schulenberg673d2102014-03-26 09:35:52 +0000528 if test "x$enable_utf8" != xno; then
Chris Allegretta66e59722013-01-21 03:36:18 +0000529 OLDLIBS="$LIBS"
530 AC_CHECK_TOOL(NCURSESW_CONFIG, ncursesw5-config, no)
531 if test "x$NCURSESW_CONFIG" != xno; then
532 CURSES_LIB=`$NCURSESW_CONFIG --libs`
533 LIBS="$CURSES_LIB $LIBS"
534 CPPFLAGS="`$NCURSESW_CONFIG --cflags` $CPPFLAGS"
535 AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
536 else
537 AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
538 fi
539 LIBS="$OLDLIBS"
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000540 fi
541
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000542 if eval "test x$CURSES_LIB_NAME = x"; then
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000543 AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000544 fi
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000545fi
546
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000547if eval "test x$CURSES_LIB_NAME = x"; then
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000548 AC_CHECK_HEADERS(curses.h)
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000549
Benno Schulenberg673d2102014-03-26 09:35:52 +0000550 if test "x$enable_utf8" != xno; then
David Lawrence Ramsey25799f62005-06-18 17:06:02 +0000551 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 +0000552 fi
553
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000554 if eval "test x$CURSES_LIB_NAME = x"; then
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000555 AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000556 fi
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000557fi
558
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000559if eval "test x$CURSES_LIB_NAME = x"; then
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000560 AC_MSG_WARN([
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000561*** No curses lib available. Consider getting the official ncurses
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000562*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
563*** errors compiling nano.])
564else
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000565 AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000566fi
567
Mike Frysingerecea4132016-11-23 14:26:03 -0500568AC_CHECK_LIB([$CURSES_LIB_NAME], [use_default_colors],
569 [AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() command.])],
570 [], [$CURSES_LIB])
571AC_CHECK_LIB([$CURSES_LIB_NAME], [key_defined],
572 [AC_DEFINE(HAVE_KEY_DEFINED, 1, [Define this if your curses library has the key_defined() command.])],
573 [], [$CURSES_LIB])
Chris Allegrettac08f50d2001-01-06 18:12:43 +0000574
David Lawrence Ramseyd08348b2004-09-18 22:02:21 +0000575dnl Parse any configure options.
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000576
577LIBS="$LIBS $CURSES_LIB"
Chris Allegretta6724a7e2000-06-19 23:19:07 +0000578
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000579AC_SUBST(CURSES_LIB)
580
David Lawrence Ramsey261da142005-06-21 15:41:46 +0000581if test "x$GLIB_CFLAGS" != "x"; then
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000582 CFLAGS="$CFLAGS $GLIB_CFLAGS"
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000583fi
David Lawrence Ramsey261da142005-06-21 15:41:46 +0000584if test "x$GLIB_LIBS" != "x"; then
David Lawrence Ramseyc15583d2005-03-25 23:19:04 +0000585 LDFLAGS="$LDFLAGS $GLIB_LIBS"
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000586fi
587
Benno Schulenberg673d2102014-03-26 09:35:52 +0000588if test "x$enable_utf8" != xno && \
David Lawrence Ramsey99466bf2005-06-21 15:47:39 +0000589 test x$CURSES_LIB_WIDE = xyes && \
590 test x$ac_cv_func_iswalnum = xyes && \
591 test x$ac_cv_func_iswpunct = xyes && \
592 (test x$ac_cv_func_iswblank = xyes || test x$ac_cv_func_iswspace = xyes) && \
David Lawrence Ramseya78b4352007-05-25 14:39:40 +0000593 test x$ac_cv_func_nl_langinfo = xyes && \
David Lawrence Ramsey99466bf2005-06-21 15:47:39 +0000594 test x$ac_cv_func_mblen = xyes && \
595 test x$ac_cv_func_mbstowcs = xyes && \
596 test x$ac_cv_func_mbtowc = xyes && \
597 test x$ac_cv_func_wctomb = xyes && \
598 test x$ac_cv_func_wcwidth = xyes; then
David Lawrence Ramseya78b4352007-05-25 14:39:40 +0000599 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 +0000600else
Benno Schulenberg673d2102014-03-26 09:35:52 +0000601 if test "x$enable_utf8" = xyes; then
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000602 AC_MSG_ERROR([
603*** UTF-8 support was requested, but insufficient UTF-8 support was
604*** detected in your curses and/or C libraries. Please verify that your
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000605*** slang was built with UTF-8 support or your curses was built with
606*** wide character support, and that your C library was built with wide
607*** character support.])
Benno Schulenberg673d2102014-03-26 09:35:52 +0000608 elif test "x$enable_utf8" != xno; then
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000609 AC_MSG_WARN([
610*** Insufficient UTF-8 support was detected in your curses and/or C
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000611*** libraries. If you want UTF-8 support, please verify that your slang
612*** was built with UTF-8 support or your curses was built with wide
613*** character support, and that your C library was built with wide
614*** character support.])
David Lawrence Ramsey8ac90872005-03-25 22:25:24 +0000615 fi
David Lawrence Ramsey78ea5e42004-12-12 19:04:56 +0000616fi
617
Benno Schulenberg2f817a62016-03-22 10:42:28 +0000618AC_CACHE_CHECK([for enhanced regular expression flag], nano_cv_flag_reg_extended,
619 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <regex.h>]],
620 [[
621 #ifndef REG_ENHANCED
622 error: No REG_ENHANCED support!
623 #endif
624 ]])],
625 [nano_cv_flag_reg_extended="REG_EXTENDED | REG_ENHANCED"],
626 [nano_cv_flag_reg_extended="REG_EXTENDED"])])
627
628AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_cv_flag_reg_extended,
629 [Flag(s) to use to get the full range of extended regular expressions])
630
Benno Schulenberg14c62db2017-01-09 14:28:33 +0100631# Check for word-boundary support (/< and />).
632AC_MSG_CHECKING([for GNU-style word boundary regex support])
633AC_ARG_WITH(wordbounds,
634AS_HELP_STRING([--with-wordbounds], [Use GNU-style word boundary delimiters]),
Chris Allegrettaa1495492013-01-20 17:57:04 +0000635 [ case "$with_wordbounds" in
636 no)
637 AC_MSG_RESULT(no)
638 ;;
639 *)
640 AC_MSG_RESULT(yes)
641 # We explicitly don't check if the user forced the option, because
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000642 # this is needed for cross compilers and we can't test the target.
643 AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
644 ;;
645 esac
646 ], [
Chris Allegrettaa1495492013-01-20 17:57:04 +0000647 AC_TRY_RUN([
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000648#ifdef HAVE_SYS_TYPES_H
649#include <sys/types.h>
650#endif
651#include <regex.h>
652int main(void)
653{
654 regex_t r;
655 size_t nmatch;
656 regmatch_t pmatch;
657
Benno Schulenberg2f817a62016-03-22 10:42:28 +0000658 if (regcomp(&r, "\\\\>", $nano_cv_flag_reg_extended|REG_NOSUB))
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000659 return 1;
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000660 if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000661 return 1;
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000662 return 0;
663}],
Chris Allegrettaa1495492013-01-20 17:57:04 +0000664 AC_MSG_RESULT(yes)
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000665 AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
Chris Allegrettaa1495492013-01-20 17:57:04 +0000666 AC_MSG_RESULT(no),
667 AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
668 )
669])
670
Benno Schulenberg14c62db2017-01-09 14:28:33 +0100671if test x$color_support = xyes; then
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000672# if test x$CURSES_LIB_NAME = xcurses; then
673 AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
674 AC_TRY_RUN([
675#include <curses.h>
676int main(void)
677{
678 int testcolor = COLOR_WHITE;
679 return 0;
680}], AC_MSG_RESULT(no),
681 AC_TRY_RUN([
682#ifndef _XOPEN_SOURCE_EXTENDED
683#define _XOPEN_SOURCE_EXTENDED 1
684#endif
685#include <curses.h>
686int main(void)
687{
688 int testcolor = COLOR_WHITE;
689 return 0;
690}],
691 AC_DEFINE(NEED_XOPEN_SOURCE_EXTENDED, 1, [Define this if you need the _XOPEN_SOURCE_EXTENDED macro for color support])
692 AC_MSG_RESULT(yes),
693 AC_MSG_RESULT(not sure)
694 AC_MSG_WARN([*** Couldn't successfully compile basic color test with or without _XOPEN_SOURCE_EXTENDED])
695 AC_MSG_WARN([*** This build may not compile. Consider configuring with --disable-color or installing ncurses])),
696 AC_MSG_WARN([*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling]))
Benno Schulenberg2f817a62016-03-22 10:42:28 +0000697# fi
698fi
Chris Allegretta5a3464b2009-03-01 00:50:19 +0000699
Chris Allegretta42bd8712010-03-07 19:35:46 +0000700AC_MSG_CHECKING([whether LINES and COLS can be redefined])
701AC_TRY_RUN([
702#include <curses.h>
703int main(void)
704{
705 LINES = 80;
706 COLS = 25;
707 return 0;
Benno Schulenberg673d2102014-03-26 09:35:52 +0000708}],
Benno Schulenberg90ea21f2014-03-26 10:45:07 +0000709AC_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])
Chris Allegretta42bd8712010-03-07 19:35:46 +0000710AC_MSG_RESULT(yes),
711AC_MSG_RESULT(no),
712AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
713
Benno Schulenbergeaff14f2014-03-24 13:47:37 +0000714AS_IF([test "x$enable_libmagic" != "xno"], [
Benno Schulenberg454f6eb2015-12-23 09:39:50 +0000715 AC_CHECK_HEADERS([magic.h])
Benno Schulenbergeaff14f2014-03-24 13:47:37 +0000716 AC_CHECK_LIB(magic, magic_open)
Benno Schulenberg454f6eb2015-12-23 09:39:50 +0000717 AC_CHECK_HEADERS([zlib.h])
Benno Schulenbergca9abd82014-06-16 12:06:58 +0000718 AC_CHECK_LIB(z, inflate)
Benno Schulenbergeaff14f2014-03-24 13:47:37 +0000719])
Chris Allegretta42bd8712010-03-07 19:35:46 +0000720
Benno Schulenbergb29ea102014-04-02 20:37:30 +0000721# Check for groff html support.
Chris Allegretta7aec3922009-02-15 19:16:18 +0000722AC_MSG_CHECKING([for HTML support in groff])
723groff -t -mandoc -Thtml </dev/null >/dev/null
Benno Schulenberg673d2102014-03-26 09:35:52 +0000724if test $? -ne 0 ; then
725 AC_MSG_RESULT([no])
726 AC_MSG_WARN([*** Will not generate HTML version of man pages ***
727*** Consider installing a newer version of groff with HTML support ***])
Chris Allegretta7aec3922009-02-15 19:16:18 +0000728 groff_html_support=no
729else
Benno Schulenberg673d2102014-03-26 09:35:52 +0000730 AC_MSG_RESULT([yes])
Chris Allegretta7aec3922009-02-15 19:16:18 +0000731 groff_html_support=yes
732fi
733AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes)
734
Benno Schulenberg2ae490c2016-05-20 12:59:57 +0200735# Check whether this is a git repository.
Benno Schulenbergec295f52016-04-08 10:22:09 +0200736AC_MSG_CHECKING([whether building from git])
737if test -d .git ; then
738 AC_MSG_RESULT([yes])
Benno Schulenberg2ae490c2016-05-20 12:59:57 +0200739 from_git=yes
Benno Schulenbergec295f52016-04-08 10:22:09 +0200740else
741 AC_MSG_RESULT([no])
Benno Schulenberg2ae490c2016-05-20 12:59:57 +0200742 from_git=no
Benno Schulenbergec295f52016-04-08 10:22:09 +0200743fi
Benno Schulenberg2ae490c2016-05-20 12:59:57 +0200744AM_CONDITIONAL(BUILDING_FROM_GIT, test x$from_git = xyes)
Chris Allegretta7aec3922009-02-15 19:16:18 +0000745
Jordi Mallach298b9752003-09-07 00:44:12 +0000746AC_CONFIG_FILES([
747Makefile
748doc/Makefile
Benno Schulenbergf1b87f92016-12-24 17:49:14 +0100749doc/sample.nanorc
Jordi Mallach298b9752003-09-07 00:44:12 +0000750m4/Makefile
751po/Makefile.in
752src/Makefile
Benno Schulenbergb0ef2e22016-12-24 17:25:06 +0100753syntax/Makefile
Jordi Mallach298b9752003-09-07 00:44:12 +0000754nano.spec
755])
756
Jordi Mallach3c5653d2002-02-23 18:23:43 +0000757AC_OUTPUT