Benno Schulenberg | 49fc528 | 2016-08-14 21:18:00 +0200 | [diff] [blame] | 1 | # Configuration for GNU nano - a small and user-friendly text editor |
Jordi Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 2 | # |
Benno Schulenberg | 7a9f4a4 | 2014-04-30 20:18:26 +0000 | [diff] [blame] | 3 | # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
| 4 | # 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. |
Jordi Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 5 | # |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 6 | # 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 Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 10 | # |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 11 | # 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 Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 17 | # along with this program. If not, see http://www.gnu.org/licenses/. |
Jordi Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 18 | |
Benno Schulenberg | 926fe5f | 2017-02-23 11:20:27 +0100 | [diff] [blame] | 19 | AC_INIT([GNU nano], [2.7.5], [nano-devel@gnu.org], [nano]) |
Jordi Mallach | 298b975 | 2003-09-07 00:44:12 +0000 | [diff] [blame] | 20 | AC_CONFIG_SRCDIR([src/nano.c]) |
Chris Allegretta | 636e76a | 2013-01-03 03:47:26 +0000 | [diff] [blame] | 21 | AC_CANONICAL_HOST |
Jordi Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 22 | AM_INIT_AUTOMAKE |
Jordi Mallach | d7b6325 | 2004-11-18 00:05:14 +0000 | [diff] [blame] | 23 | AC_CONFIG_HEADERS([config.h]) |
Jordi Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 24 | |
Benno Schulenberg | 73ff00e | 2014-04-02 21:03:32 +0000 | [diff] [blame] | 25 | dnl Make sure the ONCE macros are available. |
| 26 | |
| 27 | AC_PREREQ(2.61) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 28 | |
| 29 | dnl Checks for programs. |
David Lawrence Ramsey | 01e13ea | 2005-06-21 04:16:12 +0000 | [diff] [blame] | 30 | |
David Lawrence Ramsey | 9830d75 | 2004-05-13 17:19:54 +0000 | [diff] [blame] | 31 | AC_GNU_SOURCE |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 32 | AC_PROG_CC |
David Lawrence Ramsey | 76fb3ec | 2004-08-01 16:09:15 +0000 | [diff] [blame] | 33 | AC_PROG_LN_S |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 34 | AC_ISC_POSIX |
Jordi Mallach | 3c5653d | 2002-02-23 18:23:43 +0000 | [diff] [blame] | 35 | AC_SYS_LARGEFILE |
Benno Schulenberg | 4172714 | 2014-03-24 13:42:58 +0000 | [diff] [blame] | 36 | PKG_PROG_PKG_CONFIG |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 37 | |
Jordi Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 38 | dnl Internationalization macros. |
David Lawrence Ramsey | 01e13ea | 2005-06-21 04:16:12 +0000 | [diff] [blame] | 39 | |
Jordi Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 40 | AM_GNU_GETTEXT_VERSION(0.11.5) |
| 41 | AM_GNU_GETTEXT([external], [need-ngettext]) |
David Lawrence Ramsey | 935594b | 2006-07-18 18:16:30 +0000 | [diff] [blame] | 42 | AM_CONDITIONAL(USE_NLS, test x$USE_NLS = xyes) |
Jordi Mallach | 631ee1f | 2003-01-15 17:40:35 +0000 | [diff] [blame] | 43 | |
David Lawrence Ramsey | 5e6434c | 2006-06-01 17:23:28 +0000 | [diff] [blame] | 44 | dnl Data location. |
| 45 | |
| 46 | pkgdatadir=${datadir}/${PACKAGE} |
| 47 | AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.]) |
| 48 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 49 | dnl Checks for header files. |
David Lawrence Ramsey | 01e13ea | 2005-06-21 04:16:12 +0000 | [diff] [blame] | 50 | |
Benno Schulenberg | eaff14f | 2014-03-24 13:47:37 +0000 | [diff] [blame] | 51 | AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h stdarg.h) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 52 | |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 53 | dnl Checks for options. |
| 54 | |
Benno Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 55 | AC_ARG_ENABLE(browser, |
| 56 | AS_HELP_STRING([--disable-browser], [Disable built-in file browser])) |
| 57 | if test "x$enable_browser" = xno; then |
| 58 | AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.]) |
| 59 | fi |
| 60 | |
| 61 | AC_ARG_ENABLE(color, |
| 62 | AS_HELP_STRING([--disable-color], [Disable color and syntax highlighting])) |
| 63 | if 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 Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 67 | # Disabling nanorc silently disables color support. |
Benno Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 68 | enable_color=no |
| 69 | fi |
| 70 | fi |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 71 | if test "x$enable_color" = xno; then |
| 72 | AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.]) |
| 73 | else |
| 74 | if test x$ac_cv_header_regex_h != xyes; then |
Benno Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 75 | AC_MSG_ERROR([ |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 76 | *** 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 Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 82 | fi |
| 83 | fi |
Chris Allegretta | 83c3f95 | 2008-09-30 16:47:57 +0000 | [diff] [blame] | 84 | |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 85 | AC_ARG_ENABLE(comment, |
| 86 | AS_HELP_STRING([--disable-comment], [Disable comment/uncomment functions])) |
| 87 | if 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 Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 91 | enable_comment=no |
| 92 | fi |
| 93 | fi |
| 94 | if test "x$disable_comment" != xyes; then |
| 95 | if test "x$enable_comment" != xno; then |
Benno Schulenberg | 964c10d | 2016-12-07 19:56:27 +0100 | [diff] [blame] | 96 | AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.]) |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 97 | fi |
| 98 | fi |
| 99 | |
Chris Allegretta | 83c3f95 | 2008-09-30 16:47:57 +0000 | [diff] [blame] | 100 | AC_ARG_ENABLE(extra, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 101 | AS_HELP_STRING([--disable-extra], [Disable extra features, currently only easter eggs])) |
Benno Schulenberg | d17438b | 2014-04-03 20:57:44 +0000 | [diff] [blame] | 102 | if test "x$enable_extra" = xno; then |
| 103 | AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 104 | fi |
Chris Allegretta | 83c3f95 | 2008-09-30 16:47:57 +0000 | [diff] [blame] | 105 | |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 106 | AC_ARG_ENABLE(help, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 107 | AS_HELP_STRING([--disable-help], [Disable help functions])) |
| 108 | if test "x$enable_help" = xno; then |
David Lawrence Ramsey | f50bd4b | 2006-04-14 20:15:44 +0000 | [diff] [blame] | 109 | AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 110 | fi |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 111 | |
Benno Schulenberg | 0615acd | 2014-06-19 17:39:26 +0000 | [diff] [blame] | 112 | AC_ARG_ENABLE(histories, |
| 113 | AS_HELP_STRING([--disable-histories], [Disable search and position histories])) |
| 114 | if test "x$enable_histories" = xno; then |
| 115 | AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.]) |
| 116 | fi |
| 117 | |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 118 | AC_ARG_ENABLE(justify, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 119 | AS_HELP_STRING([--disable-justify], [Disable justify/unjustify functions])) |
| 120 | if test "x$enable_justify" = xno; then |
David Lawrence Ramsey | e53c382 | 2007-04-19 03:23:16 +0000 | [diff] [blame] | 121 | AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 122 | fi |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 123 | |
Benno Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 124 | AC_ARG_ENABLE(libmagic, |
| 125 | AS_HELP_STRING([--disable-libmagic], [Disable detection of file types via libmagic])) |
| 126 | |
Faissal Bensefia | de95ca6 | 2016-10-20 09:44:29 +0100 | [diff] [blame] | 127 | AC_ARG_ENABLE(linenumbers, |
| 128 | AS_HELP_STRING([--disable-linenumbers], [Disable line numbering])) |
| 129 | if test "x$enable_tiny" = xyes; then |
| 130 | if test "x$enable_linenumbers" != xyes; then |
| 131 | enable_linenumbers=no |
| 132 | fi |
| 133 | fi |
| 134 | if 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 |
| 138 | fi |
| 139 | |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 140 | AC_ARG_ENABLE(mouse, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 141 | AS_HELP_STRING([--disable-mouse], [Disable mouse support (and -m flag)])) |
| 142 | if test "x$enable_mouse" = xno; then |
David Lawrence Ramsey | d21eea0 | 2006-11-25 18:26:07 +0000 | [diff] [blame] | 143 | AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 144 | fi |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 145 | |
Benno Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 146 | AC_ARG_ENABLE(multibuffer, |
| 147 | AS_HELP_STRING([--disable-multibuffer], [Disable multiple file buffers])) |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 148 | if test "x$enable_multibuffer" = xno; then |
| 149 | AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.]) |
Benno Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 150 | fi |
| 151 | |
| 152 | AC_ARG_ENABLE(nanorc, |
| 153 | AS_HELP_STRING([--disable-nanorc], [Disable use of .nanorc files])) |
Benno Schulenberg | eea0908 | 2014-04-13 20:50:20 +0000 | [diff] [blame] | 154 | if test "x$enable_nanorc" = xno; then |
| 155 | AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.]) |
| 156 | else |
Benno Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 157 | nanorc_support=yes |
| 158 | fi |
| 159 | |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 160 | AC_ARG_ENABLE(operatingdir, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 161 | AS_HELP_STRING([--disable-operatingdir], [Disable setting of operating directory (chroot of sorts)])) |
| 162 | if test "x$enable_operatingdir" = xno; then |
David Lawrence Ramsey | d21eea0 | 2006-11-25 18:26:07 +0000 | [diff] [blame] | 163 | AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 164 | fi |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 165 | |
| 166 | AC_ARG_ENABLE(speller, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 167 | AS_HELP_STRING([--disable-speller], [Disable spell checker functions])) |
| 168 | if test "x$enable_speller" = xno; then |
David Lawrence Ramsey | 708de36 | 2005-11-22 20:24:22 +0000 | [diff] [blame] | 169 | AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 170 | fi |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 171 | |
| 172 | AC_ARG_ENABLE(tabcomp, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 173 | AS_HELP_STRING([--disable-tabcomp], [Disable tab completion functions])) |
| 174 | if test "x$enable_tabcomp" = xno; then |
Benno Schulenberg | 964c10d | 2016-12-07 19:56:27 +0100 | [diff] [blame] | 175 | AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab completion functions for filenames and search strings.]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 176 | fi |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 177 | |
Benno Schulenberg | 68a0314 | 2016-12-07 13:10:40 +0100 | [diff] [blame] | 178 | AC_ARG_ENABLE(wordcomp, |
| 179 | AS_HELP_STRING([--disable-wordcomp], [Disable the word completion function])) |
| 180 | if 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 |
| 186 | fi |
| 187 | if 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 |
| 191 | fi |
| 192 | |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 193 | AC_ARG_ENABLE(wrapping, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 194 | AS_HELP_STRING([--disable-wrapping], [Disable all wrapping of text (and -w flag)])) |
| 195 | if test "x$enable_wrapping" = xno; then |
David Lawrence Ramsey | d21eea0 | 2006-11-25 18:26:07 +0000 | [diff] [blame] | 196 | AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 197 | fi |
Chris Allegretta | ea066c8 | 2001-04-13 02:32:06 +0000 | [diff] [blame] | 198 | |
David Lawrence Ramsey | dc60b72 | 2002-10-25 16:08:53 +0000 | [diff] [blame] | 199 | AC_ARG_ENABLE(wrapping-as-root, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 200 | AS_HELP_STRING([--disable-wrapping-as-root], [Disable wrapping of text as root by default])) |
| 201 | if test "x$enable_wrapping_as_root" = xno; then |
David Lawrence Ramsey | d21eea0 | 2006-11-25 18:26:07 +0000 | [diff] [blame] | 202 | AC_DEFINE(DISABLE_ROOTWRAPPING, 1, [Define this to disable text wrapping as root by default.]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 203 | fi |
David Lawrence Ramsey | dc60b72 | 2002-10-25 16:08:53 +0000 | [diff] [blame] | 204 | |
Benno Schulenberg | 9901170 | 2014-04-04 13:12:07 +0000 | [diff] [blame] | 205 | AC_ARG_ENABLE(debug, |
| 206 | AS_HELP_STRING([--enable-debug], [Enable debugging (disabled by default)])) |
| 207 | if test "x$enable_debug" = xyes; then |
| 208 | AC_DEFINE(DEBUG, 1, [Define this to enable debug messages and assert warnings.]) |
| 209 | else |
| 210 | AC_DEFINE(NDEBUG, 1, [Shut up assert warnings :-)]) |
| 211 | fi |
| 212 | |
| 213 | AC_ARG_ENABLE(tiny, |
| 214 | AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size])) |
| 215 | if test "x$enable_tiny" = xyes; then |
| 216 | AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) |
Benno Schulenberg | 1db6de4 | 2014-04-04 13:54:05 +0000 | [diff] [blame] | 217 | 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 Schulenberg | 46b07fa | 2014-04-04 13:42:13 +0000 | [diff] [blame] | 220 | if test "x$enable_color" != xyes; then |
| 221 | AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.]) |
| 222 | color_support=no |
Benno Schulenberg | 9cc6438 | 2014-04-13 21:05:57 +0000 | [diff] [blame] | 223 | 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 Schulenberg | 46b07fa | 2014-04-04 13:42:13 +0000 | [diff] [blame] | 227 | fi |
Benno Schulenberg | 1db6de4 | 2014-04-04 13:54:05 +0000 | [diff] [blame] | 228 | if test "x$enable_extra" != xyes; then |
Benno Schulenberg | 9901170 | 2014-04-04 13:12:07 +0000 | [diff] [blame] | 229 | AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.]) |
| 230 | fi |
Benno Schulenberg | 1db6de4 | 2014-04-04 13:54:05 +0000 | [diff] [blame] | 231 | if test "x$enable_help" != xyes; then |
| 232 | AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.]) |
| 233 | fi |
Benno Schulenberg | 0615acd | 2014-06-19 17:39:26 +0000 | [diff] [blame] | 234 | if test "x$enable_histories" != xyes; then |
| 235 | AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.]) |
| 236 | fi |
Benno Schulenberg | 1db6de4 | 2014-04-04 13:54:05 +0000 | [diff] [blame] | 237 | if test "x$enable_justify" != xyes; then |
| 238 | AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.]) |
| 239 | fi |
Benno Schulenberg | 5c7a6d7 | 2014-04-13 19:44:30 +0000 | [diff] [blame] | 240 | if test "x$enable_libmagic" != xyes; then |
| 241 | enable_libmagic=no |
| 242 | fi |
Benno Schulenberg | 1db6de4 | 2014-04-04 13:54:05 +0000 | [diff] [blame] | 243 | 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 Schulenberg | 9901170 | 2014-04-04 13:12:07 +0000 | [diff] [blame] | 247 | AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.]) |
| 248 | fi |
Benno Schulenberg | eea0908 | 2014-04-13 20:50:20 +0000 | [diff] [blame] | 249 | 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 Schulenberg | 1db6de4 | 2014-04-04 13:54:05 +0000 | [diff] [blame] | 252 | 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 Schulenberg | 9901170 | 2014-04-04 13:12:07 +0000 | [diff] [blame] | 264 | fi |
| 265 | |
Benno Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 266 | AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes) |
| 267 | AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes) |
Chris Allegretta | d957f59 | 2003-01-17 00:17:45 +0000 | [diff] [blame] | 268 | |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 269 | AC_MSG_CHECKING([whether to enable UTF-8 support]) |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 270 | AC_ARG_ENABLE(utf8, AS_HELP_STRING([--enable-utf8], [Enable UTF-8 support])) |
Benno Schulenberg | c55ac2b | 2014-03-27 10:28:19 +0000 | [diff] [blame] | 271 | AC_MSG_RESULT(${enable_utf8:-auto}) |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 272 | |
Benno Schulenberg | 9d306cd | 2014-04-03 19:50:12 +0000 | [diff] [blame] | 273 | AC_ARG_ENABLE(altrcname, |
| 274 | AS_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 |
| 277 | fi]) |
| 278 | |
| 279 | |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 280 | AC_MSG_CHECKING([whether to use slang]) |
| 281 | CURSES_LIB_NAME="" |
| 282 | AC_ARG_WITH(slang, |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 283 | AS_HELP_STRING([--with-slang[=DIR]], [Use the slang library instead of curses]), |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 284 | [ 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 Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 292 | # Add additional search path. |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 293 | LDFLAGS="-L$with_slang/lib $LDFLAGS" |
| 294 | CPPFLAGS="-I$with_slang/include $CPPFLAGS" |
| 295 | fi |
| 296 | |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 297 | if test "x$enable_utf8" != xno; then |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 298 | 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> |
| 304 | int main(void) |
| 305 | { |
| 306 | SLutf8_enable(1); |
| 307 | return 0; |
| 308 | }], |
| 309 | [AC_MSG_RESULT(yes) |
Benno Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 310 | AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.]) |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 311 | 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 Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 320 | # We might need the term library. |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 321 | 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> |
| 330 | int main(void) |
| 331 | { |
| 332 | SLutf8_enable(1); |
| 333 | return 0; |
| 334 | }], |
| 335 | [AC_MSG_RESULT(yes) |
Benno Schulenberg | a4c0c2f | 2014-04-03 10:52:27 +0000 | [diff] [blame] | 336 | AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.]) |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 337 | 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 Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 346 | # We might need the math library. |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 347 | AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm]) |
| 348 | LIBS="$LIBS -lm" |
| 349 | AC_TRY_RUN([ |
| 350 | #include <slcurses.h> |
| 351 | int main(void) |
| 352 | { |
| 353 | SLutf8_enable(1); |
| 354 | return 0; |
| 355 | }], |
| 356 | [AC_MSG_RESULT(yes) |
Benno Schulenberg | a4c0c2f | 2014-04-03 10:52:27 +0000 | [diff] [blame] | 357 | AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.]) |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 358 | 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 Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 377 | # Reset libs if the above slang tests failed. |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 378 | if test "x$enable_utf8" != xno; then |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 379 | 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> |
| 388 | int main(void) |
| 389 | { |
| 390 | SLtt_initialize(NULL); |
| 391 | return 0; |
| 392 | }], |
| 393 | [AC_MSG_RESULT(yes) |
Benno Schulenberg | a4c0c2f | 2014-04-03 10:52:27 +0000 | [diff] [blame] | 394 | AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.]) |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 395 | 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 Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 403 | # We might need the term library. |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 404 | 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> |
| 413 | int main(void) |
| 414 | { |
| 415 | SLtt_initialize(NULL); |
| 416 | return 0; |
| 417 | }], |
| 418 | [AC_MSG_RESULT(yes) |
Benno Schulenberg | a4c0c2f | 2014-04-03 10:52:27 +0000 | [diff] [blame] | 419 | AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.]) |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 420 | 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 Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 428 | # We might need the math library. |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 429 | AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm]) |
| 430 | LIBS="$LIBS -lm" |
| 431 | AC_TRY_RUN([ |
| 432 | #include <slcurses.h> |
| 433 | int main(void) |
| 434 | { |
| 435 | SLtt_initialize(NULL); |
| 436 | return 0; |
| 437 | }], |
| 438 | [AC_MSG_RESULT(yes) |
Benno Schulenberg | a4c0c2f | 2014-04-03 10:52:27 +0000 | [diff] [blame] | 439 | AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.]) |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 440 | 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 Allegretta | faeeb5b | 2008-08-28 06:13:05 +0000 | [diff] [blame] | 467 | |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 468 | dnl Checks for functions. |
| 469 | |
Benno Schulenberg | d6ecb96 | 2014-04-15 15:17:40 +0000 | [diff] [blame] | 470 | AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf) |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 471 | |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 472 | if test "x$enable_utf8" != xno; then |
David Lawrence Ramsey | a78b435 | 2007-05-25 14:39:40 +0000 | [diff] [blame] | 473 | AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth) |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 474 | fi |
| 475 | |
Benno Schulenberg | d6ecb96 | 2014-04-15 15:17:40 +0000 | [diff] [blame] | 476 | if 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) |
| 483 | fi |
| 484 | |
David Lawrence Ramsey | da50e73 | 2005-07-04 04:22:30 +0000 | [diff] [blame] | 485 | if test x$ac_cv_func_vsnprintf = xno; then |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 486 | AM_PATH_GLIB_2_0(2.0.0,, |
| 487 | AC_MSG_ERROR([ |
Benno Schulenberg | d6ecb96 | 2014-04-15 15:17:40 +0000 | [diff] [blame] | 488 | *** 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 Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 491 | glib) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 492 | fi |
| 493 | |
| 494 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 495 | |
Benno Schulenberg | 3de6c57 | 2014-03-24 13:31:37 +0000 | [diff] [blame] | 496 | dnl Checks for available flags. |
Benno Schulenberg | 73ff00e | 2014-04-02 21:03:32 +0000 | [diff] [blame] | 497 | |
Benno Schulenberg | 3de6c57 | 2014-03-24 13:31:37 +0000 | [diff] [blame] | 498 | AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"], [], []) |
| 499 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 500 | dnl Checks for library functions. |
Benno Schulenberg | 73ff00e | 2014-04-02 21:03:32 +0000 | [diff] [blame] | 501 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 502 | AC_TYPE_SIGNAL |
| 503 | AC_FUNC_VPRINTF |
| 504 | AC_CHECK_FUNCS(getopt_long) |
Benno Schulenberg | 73ff00e | 2014-04-02 21:03:32 +0000 | [diff] [blame] | 505 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 506 | dnl Checks for libraries. |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 507 | |
| 508 | if eval "test x$CURSES_LIB_NAME = x"; then |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 509 | if test "x$enable_utf8" != xno; then |
Benno Schulenberg | 4172714 | 2014-03-24 13:42:58 +0000 | [diff] [blame] | 510 | 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 |
| 523 | fi |
| 524 | |
| 525 | if eval "test x$CURSES_LIB_NAME = x"; then |
David Lawrence Ramsey | 78ea5e4 | 2004-12-12 19:04:56 +0000 | [diff] [blame] | 526 | AC_CHECK_HEADERS(ncurses.h) |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 527 | |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 528 | if test "x$enable_utf8" != xno; then |
Chris Allegretta | 66e5972 | 2013-01-21 03:36:18 +0000 | [diff] [blame] | 529 | 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 Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 540 | fi |
| 541 | |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 542 | if eval "test x$CURSES_LIB_NAME = x"; then |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 543 | AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses]) |
David Lawrence Ramsey | 78ea5e4 | 2004-12-12 19:04:56 +0000 | [diff] [blame] | 544 | fi |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 545 | fi |
| 546 | |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 547 | if eval "test x$CURSES_LIB_NAME = x"; then |
David Lawrence Ramsey | 78ea5e4 | 2004-12-12 19:04:56 +0000 | [diff] [blame] | 548 | AC_CHECK_HEADERS(curses.h) |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 549 | |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 550 | if test "x$enable_utf8" != xno; then |
David Lawrence Ramsey | 25799f6 | 2005-06-18 17:06:02 +0000 | [diff] [blame] | 551 | AC_CHECK_LIB(curses, get_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes]) |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 552 | fi |
| 553 | |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 554 | if eval "test x$CURSES_LIB_NAME = x"; then |
Benno Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 555 | AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses]) |
David Lawrence Ramsey | 78ea5e4 | 2004-12-12 19:04:56 +0000 | [diff] [blame] | 556 | fi |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 557 | fi |
| 558 | |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 559 | if eval "test x$CURSES_LIB_NAME = x"; then |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 560 | AC_MSG_WARN([ |
David Lawrence Ramsey | 78ea5e4 | 2004-12-12 19:04:56 +0000 | [diff] [blame] | 561 | *** No curses lib available. Consider getting the official ncurses |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 562 | *** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get |
| 563 | *** errors compiling nano.]) |
| 564 | else |
David Lawrence Ramsey | 78ea5e4 | 2004-12-12 19:04:56 +0000 | [diff] [blame] | 565 | AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library]) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 566 | fi |
| 567 | |
Mike Frysinger | ecea413 | 2016-11-23 14:26:03 -0500 | [diff] [blame] | 568 | AC_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]) |
| 571 | AC_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 Allegretta | c08f50d | 2001-01-06 18:12:43 +0000 | [diff] [blame] | 574 | |
David Lawrence Ramsey | d08348b | 2004-09-18 22:02:21 +0000 | [diff] [blame] | 575 | dnl Parse any configure options. |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 576 | |
| 577 | LIBS="$LIBS $CURSES_LIB" |
Chris Allegretta | 6724a7e | 2000-06-19 23:19:07 +0000 | [diff] [blame] | 578 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 579 | AC_SUBST(CURSES_LIB) |
| 580 | |
David Lawrence Ramsey | 261da14 | 2005-06-21 15:41:46 +0000 | [diff] [blame] | 581 | if test "x$GLIB_CFLAGS" != "x"; then |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 582 | CFLAGS="$CFLAGS $GLIB_CFLAGS" |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 583 | fi |
David Lawrence Ramsey | 261da14 | 2005-06-21 15:41:46 +0000 | [diff] [blame] | 584 | if test "x$GLIB_LIBS" != "x"; then |
David Lawrence Ramsey | c15583d | 2005-03-25 23:19:04 +0000 | [diff] [blame] | 585 | LDFLAGS="$LDFLAGS $GLIB_LIBS" |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 586 | fi |
| 587 | |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 588 | if test "x$enable_utf8" != xno && \ |
David Lawrence Ramsey | 99466bf | 2005-06-21 15:47:39 +0000 | [diff] [blame] | 589 | 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 Ramsey | a78b435 | 2007-05-25 14:39:40 +0000 | [diff] [blame] | 593 | test x$ac_cv_func_nl_langinfo = xyes && \ |
David Lawrence Ramsey | 99466bf | 2005-06-21 15:47:39 +0000 | [diff] [blame] | 594 | 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 Ramsey | a78b435 | 2007-05-25 14:39:40 +0000 | [diff] [blame] | 599 | 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 Ramsey | 78ea5e4 | 2004-12-12 19:04:56 +0000 | [diff] [blame] | 600 | else |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 601 | if test "x$enable_utf8" = xyes; then |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 602 | 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 Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 605 | *** 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 Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 608 | elif test "x$enable_utf8" != xno; then |
David Lawrence Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 609 | AC_MSG_WARN([ |
| 610 | *** Insufficient UTF-8 support was detected in your curses and/or C |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 611 | *** 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 Ramsey | 8ac9087 | 2005-03-25 22:25:24 +0000 | [diff] [blame] | 615 | fi |
David Lawrence Ramsey | 78ea5e4 | 2004-12-12 19:04:56 +0000 | [diff] [blame] | 616 | fi |
| 617 | |
Benno Schulenberg | 2f817a6 | 2016-03-22 10:42:28 +0000 | [diff] [blame] | 618 | AC_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 | |
| 628 | AC_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 Schulenberg | 14c62db | 2017-01-09 14:28:33 +0100 | [diff] [blame] | 631 | # Check for word-boundary support (/< and />). |
| 632 | AC_MSG_CHECKING([for GNU-style word boundary regex support]) |
| 633 | AC_ARG_WITH(wordbounds, |
| 634 | AS_HELP_STRING([--with-wordbounds], [Use GNU-style word boundary delimiters]), |
Chris Allegretta | a149549 | 2013-01-20 17:57:04 +0000 | [diff] [blame] | 635 | [ 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 Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 642 | # 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 Allegretta | a149549 | 2013-01-20 17:57:04 +0000 | [diff] [blame] | 647 | AC_TRY_RUN([ |
Chris Allegretta | 5a3464b | 2009-03-01 00:50:19 +0000 | [diff] [blame] | 648 | #ifdef HAVE_SYS_TYPES_H |
| 649 | #include <sys/types.h> |
| 650 | #endif |
| 651 | #include <regex.h> |
| 652 | int main(void) |
| 653 | { |
| 654 | regex_t r; |
| 655 | size_t nmatch; |
| 656 | regmatch_t pmatch; |
| 657 | |
Benno Schulenberg | 2f817a6 | 2016-03-22 10:42:28 +0000 | [diff] [blame] | 658 | if (regcomp(&r, "\\\\>", $nano_cv_flag_reg_extended|REG_NOSUB)) |
Benno Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 659 | return 1; |
Chris Allegretta | 5a3464b | 2009-03-01 00:50:19 +0000 | [diff] [blame] | 660 | if (regexec(&r, "word boundary", nmatch, &pmatch, 0)) |
Benno Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 661 | return 1; |
Chris Allegretta | 5a3464b | 2009-03-01 00:50:19 +0000 | [diff] [blame] | 662 | return 0; |
| 663 | }], |
Chris Allegretta | a149549 | 2013-01-20 17:57:04 +0000 | [diff] [blame] | 664 | AC_MSG_RESULT(yes) |
Benno Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 665 | AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes, |
Chris Allegretta | a149549 | 2013-01-20 17:57:04 +0000 | [diff] [blame] | 666 | AC_MSG_RESULT(no), |
| 667 | AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling]) |
| 668 | ) |
| 669 | ]) |
| 670 | |
Benno Schulenberg | 14c62db | 2017-01-09 14:28:33 +0100 | [diff] [blame] | 671 | if test x$color_support = xyes; then |
Chris Allegretta | 5a3464b | 2009-03-01 00:50:19 +0000 | [diff] [blame] | 672 | # 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> |
| 676 | int 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> |
| 686 | int 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 Schulenberg | 2f817a6 | 2016-03-22 10:42:28 +0000 | [diff] [blame] | 697 | # fi |
| 698 | fi |
Chris Allegretta | 5a3464b | 2009-03-01 00:50:19 +0000 | [diff] [blame] | 699 | |
Chris Allegretta | 42bd871 | 2010-03-07 19:35:46 +0000 | [diff] [blame] | 700 | AC_MSG_CHECKING([whether LINES and COLS can be redefined]) |
| 701 | AC_TRY_RUN([ |
| 702 | #include <curses.h> |
| 703 | int main(void) |
| 704 | { |
| 705 | LINES = 80; |
| 706 | COLS = 25; |
| 707 | return 0; |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 708 | }], |
Benno Schulenberg | 90ea21f | 2014-03-26 10:45:07 +0000 | [diff] [blame] | 709 | 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]) |
Chris Allegretta | 42bd871 | 2010-03-07 19:35:46 +0000 | [diff] [blame] | 710 | AC_MSG_RESULT(yes), |
| 711 | AC_MSG_RESULT(no), |
| 712 | AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling])) |
| 713 | |
Benno Schulenberg | eaff14f | 2014-03-24 13:47:37 +0000 | [diff] [blame] | 714 | AS_IF([test "x$enable_libmagic" != "xno"], [ |
Benno Schulenberg | 454f6eb | 2015-12-23 09:39:50 +0000 | [diff] [blame] | 715 | AC_CHECK_HEADERS([magic.h]) |
Benno Schulenberg | eaff14f | 2014-03-24 13:47:37 +0000 | [diff] [blame] | 716 | AC_CHECK_LIB(magic, magic_open) |
Benno Schulenberg | 454f6eb | 2015-12-23 09:39:50 +0000 | [diff] [blame] | 717 | AC_CHECK_HEADERS([zlib.h]) |
Benno Schulenberg | ca9abd8 | 2014-06-16 12:06:58 +0000 | [diff] [blame] | 718 | AC_CHECK_LIB(z, inflate) |
Benno Schulenberg | eaff14f | 2014-03-24 13:47:37 +0000 | [diff] [blame] | 719 | ]) |
Chris Allegretta | 42bd871 | 2010-03-07 19:35:46 +0000 | [diff] [blame] | 720 | |
Benno Schulenberg | b29ea10 | 2014-04-02 20:37:30 +0000 | [diff] [blame] | 721 | # Check for groff html support. |
Chris Allegretta | 7aec392 | 2009-02-15 19:16:18 +0000 | [diff] [blame] | 722 | AC_MSG_CHECKING([for HTML support in groff]) |
| 723 | groff -t -mandoc -Thtml </dev/null >/dev/null |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 724 | if 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 Allegretta | 7aec392 | 2009-02-15 19:16:18 +0000 | [diff] [blame] | 728 | groff_html_support=no |
| 729 | else |
Benno Schulenberg | 673d210 | 2014-03-26 09:35:52 +0000 | [diff] [blame] | 730 | AC_MSG_RESULT([yes]) |
Chris Allegretta | 7aec392 | 2009-02-15 19:16:18 +0000 | [diff] [blame] | 731 | groff_html_support=yes |
| 732 | fi |
| 733 | AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes) |
| 734 | |
Benno Schulenberg | 2ae490c | 2016-05-20 12:59:57 +0200 | [diff] [blame] | 735 | # Check whether this is a git repository. |
Benno Schulenberg | ec295f5 | 2016-04-08 10:22:09 +0200 | [diff] [blame] | 736 | AC_MSG_CHECKING([whether building from git]) |
| 737 | if test -d .git ; then |
| 738 | AC_MSG_RESULT([yes]) |
Benno Schulenberg | 2ae490c | 2016-05-20 12:59:57 +0200 | [diff] [blame] | 739 | from_git=yes |
Benno Schulenberg | ec295f5 | 2016-04-08 10:22:09 +0200 | [diff] [blame] | 740 | else |
| 741 | AC_MSG_RESULT([no]) |
Benno Schulenberg | 2ae490c | 2016-05-20 12:59:57 +0200 | [diff] [blame] | 742 | from_git=no |
Benno Schulenberg | ec295f5 | 2016-04-08 10:22:09 +0200 | [diff] [blame] | 743 | fi |
Benno Schulenberg | 2ae490c | 2016-05-20 12:59:57 +0200 | [diff] [blame] | 744 | AM_CONDITIONAL(BUILDING_FROM_GIT, test x$from_git = xyes) |
Chris Allegretta | 7aec392 | 2009-02-15 19:16:18 +0000 | [diff] [blame] | 745 | |
Jordi Mallach | 298b975 | 2003-09-07 00:44:12 +0000 | [diff] [blame] | 746 | AC_CONFIG_FILES([ |
| 747 | Makefile |
| 748 | doc/Makefile |
Benno Schulenberg | f1b87f9 | 2016-12-24 17:49:14 +0100 | [diff] [blame] | 749 | doc/sample.nanorc |
Jordi Mallach | 298b975 | 2003-09-07 00:44:12 +0000 | [diff] [blame] | 750 | m4/Makefile |
| 751 | po/Makefile.in |
| 752 | src/Makefile |
Benno Schulenberg | b0ef2e2 | 2016-12-24 17:25:06 +0100 | [diff] [blame] | 753 | syntax/Makefile |
Jordi Mallach | 298b975 | 2003-09-07 00:44:12 +0000 | [diff] [blame] | 754 | nano.spec |
| 755 | ]) |
| 756 | |
Jordi Mallach | 3c5653d | 2002-02-23 18:23:43 +0000 | [diff] [blame] | 757 | AC_OUTPUT |