Add nano.changes file to source file to make gbs build succeed
[platform/upstream/nano.git] / configure.ac
1 # Configuration for GNU nano - a small and user-friendly text editor
2 #
3 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 # Free Software Foundation, Inc.
5 #
6 # 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
8 # Free Software Foundation; either version 3, or (at your option) any
9 # later version.
10 #
11 # 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.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with GNU nano; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
19 # USA.
20 #
21 # $Id: configure.ac 4538 2011-02-26 14:41:55Z astyanax $
22
23 AC_INIT([GNU nano], [2.3.1], [nano-devel@gnu.org], [nano])
24 AC_CONFIG_SRCDIR([src/nano.c])
25 AC_CANONICAL_TARGET([])
26 AM_INIT_AUTOMAKE
27 AC_CONFIG_HEADERS([config.h])
28
29 AC_PREREQ(2.54)
30
31 dnl Checks for programs.
32
33 AC_GNU_SOURCE
34 AC_PROG_CC
35 AC_PROG_LN_S
36 AC_ISC_POSIX
37 AC_SYS_LARGEFILE
38
39 dnl Internationalization macros.
40
41 AM_GNU_GETTEXT_VERSION(0.11.5)
42 AM_GNU_GETTEXT([external], [need-ngettext])
43 AM_CONDITIONAL(USE_NLS, test x$USE_NLS = xyes)
44
45 dnl Data location.
46
47 pkgdatadir=${datadir}/${PACKAGE}
48 AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
49
50 dnl Checks for header files.
51
52 AC_HEADER_STDC
53 AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h stdarg.h magic.h)
54
55 dnl Checks for options.
56
57 AC_ARG_ENABLE(debug,
58 [  --enable-debug          Enable debugging (disabled by default)],
59 [if test x$enableval = xyes; then
60     AC_DEFINE(DEBUG, 1, [Define this to enable debug messages and assert warnings.]) debug_support=yes
61 fi])
62
63 if test x$debug_support != xyes; then
64     AC_DEFINE(NDEBUG, 1, [Shut up assert warnings :-)])
65 fi
66
67 AC_ARG_ENABLE(tiny,
68 [  --enable-tiny           Disable features for the sake of size],
69 [if test x$enableval = xyes; then
70     AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
71     AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
72     AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
73     AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
74     AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
75     AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
76     AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
77     AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
78     AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
79 fi])
80
81
82 AC_ARG_ENABLE(extra,
83 [  --disable-extra          Disable extra features, currently only easter eggs],
84 [if test x$enableval != xno; then
85     AC_DEFINE(NANO_EXTRA, 1, [Define this to enable extra stuff.]) extra_support=yes
86 fi], 
87     [if test x$enable_tiny != xyes; then
88         AC_DEFINE(NANO_EXTRA, 1, [Define this to enable extra stuff.]) extra_support=yes
89     fi])
90
91 AC_ARG_ENABLE(browser,
92 [  --disable-browser       Disable built-in file browser],
93 [if test x$enableval != xyes; then
94     AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
95 fi])
96
97 AC_ARG_ENABLE(help,
98 [  --disable-help          Disable help functions],
99 [if test x$enableval != xyes; then
100     AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
101 fi])
102
103 AC_ARG_ENABLE(justify,
104 [  --disable-justify       Disable justify/unjustify functions],
105 [if test x$enableval != xyes; then
106     AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
107 fi])
108
109 AC_ARG_ENABLE(mouse,
110 [  --disable-mouse         Disable mouse support (and -m flag)],
111 [if test x$enableval != xyes; then
112     AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
113 fi])
114
115 AC_ARG_ENABLE(operatingdir,
116 [  --disable-operatingdir  Disable setting of operating directory (chroot of sorts)],
117 [if test x$enableval != xyes; then
118     AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
119 fi])
120
121 AC_ARG_ENABLE(speller,
122 [  --disable-speller       Disable spell checker functions],
123 [if test x$enableval != xyes; then
124     AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
125 fi])
126
127 AC_ARG_ENABLE(tabcomp,
128 [  --disable-tabcomp       Disable tab completion functions],
129 [if test x$enableval != xyes; then
130     AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
131 fi])
132
133 AC_ARG_ENABLE(wrapping,
134 [  --disable-wrapping      Disable all wrapping of text (and -w flag)],
135 [if test x$enableval != xyes; then
136     AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
137 fi])
138
139 AC_ARG_ENABLE(wrapping-as-root,
140 [  --disable-wrapping-as-root  Disable wrapping of text as root by default],
141 [if test x$enableval != xyes; then
142     AC_DEFINE(DISABLE_ROOTWRAPPING, 1, [Define this to disable text wrapping as root by default.])
143 fi])
144
145 AC_ARG_ENABLE(color,
146 [  --disable-color          Disable color and syntax highlighting],
147 if test x$enableval != xno; then
148     if test x$ac_cv_header_regex_h = xyes; then
149         AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
150         AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
151     else
152         AC_MSG_ERROR([
153 *** The header file regex.h was not found.  If you wish to use color
154 *** support this header file is required.  Please either install C
155 *** libraries that include the regex.h file or call the configure
156 *** script with --disable-color.])
157     fi
158 fi, 
159     if test x$enable_tiny != xyes; then
160         if test x$ac_cv_header_regex_h = xyes; then
161             AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
162             AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes    
163         else
164             AC_MSG_ERROR([
165 *** The header file regex.h was not found.  If you wish to use color
166 *** support this header file is required.  Please either install C
167 *** libraries that include the regex.h file or call the configure
168 *** script with --disable-color.])
169         fi
170     fi
171 )
172
173 AC_ARG_ENABLE(multibuffer,
174 [  --disable-multibuffer    Disable multiple file buffers],
175 [if test x$enableval != xno; then
176     AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
177 fi], 
178     [if test x$enable_tiny != xyes; then
179         AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
180     fi])
181
182 AC_ARG_ENABLE(nanorc,
183 [  --disable-nanorc         Disable use of .nanorc files],
184 [if test x$enableval != xno; then
185     AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
186 fi], 
187     [if test x$enable_tiny != xyes; then
188         AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
189     fi])
190
191 AC_ARG_ENABLE(all,
192 [  --enable-all            Enable ALL extra nano functionality (ignored for compatibility as all options default to on)],
193 [if test x$enableval = xyes; then
194     echo "--enable-all option no longer needed, ignoring for compatibility"
195 fi])
196
197 AC_MSG_CHECKING([whether to enable UTF-8 support])
198 AC_ARG_ENABLE(utf8,
199 [  --enable-utf8           Enable UTF-8 support],
200 [if test x$enableval = xyes; then
201     enable_utf8=yes
202 else
203     enable_utf8=no
204 fi],
205 [enable_utf8=auto])
206 AC_MSG_RESULT($enable_utf8)
207
208 AC_MSG_CHECKING([whether to use slang])
209 CURSES_LIB_NAME=""
210 AC_ARG_WITH(slang,
211 [  --with-slang[=DIR]      Use the slang library instead of curses],
212 [    case "$with_slang" in
213     no)
214         AC_MSG_RESULT(no)
215         ;;
216     *)
217         AC_MSG_RESULT(yes)
218
219         if test x$with_slang != xyes; then
220             # Add additional search path
221             LDFLAGS="-L$with_slang/lib $LDFLAGS"
222             CPPFLAGS="-I$with_slang/include $CPPFLAGS"
223         fi
224
225         if test x$enable_utf8 != xno; then
226             AC_CHECK_HEADER(slcurses.h,
227                 AC_MSG_CHECKING([for SLutf8_enable in -lslang])
228                 _libs=$LIBS
229                 LIBS="$LIBS -lslang"
230                 AC_TRY_RUN([
231 #include <slcurses.h>
232 int main(void)
233 {
234     SLutf8_enable(1);
235     return 0;
236 }],
237                     [AC_MSG_RESULT(yes)
238                     AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
239                     CURSES_LIB_WIDE=yes
240                     if test x$with_slang != xyes; then
241                         CURSES_LIB="-L${with_slang}/lib -lslang"
242                     else
243                         CURSES_LIB="-lslang"
244                     fi
245                     CURSES_LIB_NAME=slang],
246                     [AC_MSG_RESULT(no)
247
248                     # We might need the term library
249                     for termlib in ncurses curses termcap terminfo termlib; do
250                         AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
251                         test -n "$tcap" && break
252                     done
253
254                     AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
255                     LIBS="$LIBS $tcap"
256                     AC_TRY_RUN([
257 #include <slcurses.h>
258 int main(void)
259 {
260     SLutf8_enable(1);
261     return 0;
262 }],
263                         [AC_MSG_RESULT(yes)
264                         AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
265                         CURSES_LIB_WIDE=yes
266                         if test x$with_slang != xyes; then
267                             CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
268                         else
269                             CURSES_LIB="-lslang $tcap"
270                         fi
271                         CURSES_LIB_NAME=slang],
272                         [AC_MSG_RESULT(no)
273
274                         # We might need the math library
275                         AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
276                         LIBS="$LIBS -lm"
277                         AC_TRY_RUN([
278 #include <slcurses.h>
279 int main(void)
280 {
281     SLutf8_enable(1);
282     return 0;
283 }],
284                             [AC_MSG_RESULT(yes)
285                             AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
286                             CURSES_LIB_WIDE=yes
287                             if test x$with_slang != xyes; then
288                                 CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
289                             else
290                                 CURSES_LIB="-lslang $tcap -lm"
291                             fi
292                             CURSES_LIB_NAME=slang],
293                             [AC_MSG_RESULT(no)],
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_WARN([*** Can not use slang when cross-compiling])),
297             AC_MSG_ERROR([
298 *** The header file slcurses.h was not found.  If you wish to use
299 *** slang support this header file is required.  Please either
300 *** install a version of slang that includes the slcurses.h file or
301 *** do not call the configure script with --with-slang.]))
302         fi
303
304         if eval "test x$CURSES_LIB_NAME = x"; then
305             # Reset libs if the above slang tests failed
306             if test x$enable_utf8 != xno; then
307                 LIBS=$_libs
308             fi
309
310             AC_CHECK_HEADER(slcurses.h,
311                 AC_MSG_CHECKING([for SLtt_initialize in -lslang])
312                 _libs=$LIBS
313                 LIBS="$LIBS -lslang"
314                 AC_TRY_RUN([
315 #include <slcurses.h>
316 int main(void)
317 {
318     SLtt_initialize(NULL);
319     return 0;
320 }],
321                     [AC_MSG_RESULT(yes)
322                     AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
323                     if test x$with_slang != xyes; then
324                         CURSES_LIB="-L${with_slang}/lib -lslang"
325                     else
326                         CURSES_LIB="-lslang"
327                     fi
328                     CURSES_LIB_NAME=slang],
329                     [AC_MSG_RESULT(no)
330
331                     # We might need the term library
332                     for termlib in ncurses curses termcap terminfo termlib; do
333                         AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
334                         test -n "$tcap" && break
335                     done
336
337                     AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
338                     LIBS="$LIBS $tcap"
339                     AC_TRY_RUN([
340 #include <slcurses.h>
341 int main(void)
342 {
343     SLtt_initialize(NULL);
344     return 0;
345 }],
346                         [AC_MSG_RESULT(yes)
347                         AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
348                         if test x$with_slang != xyes; then
349                             CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
350                         else
351                             CURSES_LIB="-lslang $tcap"
352                         fi
353                         CURSES_LIB_NAME=slang],
354                         [AC_MSG_RESULT(no)
355
356                         # We might need the math library
357                         AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
358                         LIBS="$LIBS -lm"
359                         AC_TRY_RUN([
360 #include <slcurses.h>
361 int main(void)
362 {
363     SLtt_initialize(NULL);
364     return 0;
365 }],
366                             [AC_MSG_RESULT(yes)
367                             AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
368                             if test x$with_slang != xyes; then
369                                 CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
370                             else
371                                 CURSES_LIB="-lslang $tcap -lm"
372                             fi
373                             CURSES_LIB_NAME=slang],
374                             [AC_MSG_RESULT(no)],
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_WARN([*** Can not use slang when cross-compiling])),
378             AC_MSG_ERROR([
379 *** The header file slcurses.h was not found.  If you wish to use
380 *** slang support this header file is required.  Please either
381 *** install a version of slang that includes the slcurses.h file or
382 *** do not call the configure script with --with-slang.]))
383         fi
384
385         if test "${_libs+set}" = "set"; then
386             LIBS=$_libs
387         fi
388
389         if test x$with_slang != xyes; then
390             LDFLAGS=${_ldflags}
391         fi
392         ;;
393     esac], [AC_MSG_RESULT(no)])
394
395 if test x$CURSES_LIB_NAME = xslang; then
396     AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
397     AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
398     AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
399     AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
400     AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
401     AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
402     AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
403     AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
404     AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
405 fi
406
407 AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
408 AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
409
410 AC_ARG_ENABLE(altrcname,
411 [  --enable-altrcname          Specify alternate rcfile name (default: .nanorc)],
412 [if test x$enableval != no; then
413     AC_DEFINE_UNQUOTED(RCFILE_NAME, "$enableval", [Specify alternate rcfile name (default: .nanorc)]) rcfilename=$enableval
414 fi])
415
416 dnl Checks for functions.
417
418 AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
419
420 if test x$enable_utf8 != xno; then
421     AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth)
422 fi
423
424 if test x$ac_cv_func_vsnprintf = xno; then
425     AM_PATH_GLIB_2_0(2.0.0,,
426         AC_MSG_ERROR([
427 *** vsnprintf() not found.  GLIB 2.x not found either.  You should
428 *** install the GLIB 2.x library which can be found at
429 *** ftp://ftp.gtk.org/.]),
430         glib)
431 fi
432
433 dnl Checks for typedefs, structures, and compiler characteristics.
434
435 dnl Checks for library functions.
436 AC_TYPE_SIGNAL
437 AC_FUNC_VPRINTF
438 AC_CHECK_FUNCS(getopt_long)
439 dnl Checks for libraries.
440
441 if eval "test x$CURSES_LIB_NAME = x"; then
442     AC_CHECK_HEADERS(ncurses.h)
443
444     if test x$enable_utf8 != xno; then
445         AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CPPFLAGS="-I/usr/include/ncursesw $CPPFLAGS" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
446     fi
447
448     if eval "test x$CURSES_LIB_NAME = x"; then
449         AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
450     fi
451 fi
452
453 if eval "test x$CURSES_LIB_NAME = x"; then
454     AC_CHECK_HEADERS(curses.h)
455
456     if test x$enable_utf8 != xno; then
457         AC_CHECK_LIB(curses, get_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes])
458     fi
459
460     if eval "test x$CURSES_LIB_NAME = x"; then
461          AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
462     fi
463 fi
464
465 if eval "test x$CURSES_LIB_NAME = x"; then
466     AC_MSG_WARN([
467 *** No curses lib available.  Consider getting the official ncurses
468 *** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
469 *** errors compiling nano.])
470 else
471     AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
472 fi
473
474 AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() command.]))
475
476 dnl Parse any configure options.
477
478 LIBS="$LIBS $CURSES_LIB"
479
480 AC_SUBST(CURSES_LIB)
481
482 if test "x$GLIB_CFLAGS" != "x"; then
483     CFLAGS="$CFLAGS $GLIB_CFLAGS"
484 fi
485 if test "x$GLIB_LIBS" != "x"; then
486     LDFLAGS="$LDFLAGS $GLIB_LIBS"
487 fi
488
489 if test x$enable_utf8 != xno && \
490     test x$CURSES_LIB_WIDE = xyes && \
491     test x$ac_cv_func_iswalnum = xyes && \
492     test x$ac_cv_func_iswpunct = xyes && \
493     (test x$ac_cv_func_iswblank = xyes || test x$ac_cv_func_iswspace = xyes) && \
494     test x$ac_cv_func_nl_langinfo = xyes && \
495     test x$ac_cv_func_mblen = xyes && \
496     test x$ac_cv_func_mbstowcs = xyes && \
497     test x$ac_cv_func_mbtowc = xyes && \
498     test x$ac_cv_func_wctomb = xyes && \
499     test x$ac_cv_func_wcwidth = xyes; then
500         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()).])
501 else
502     if test x$enable_utf8 = xyes; then
503         AC_MSG_ERROR([
504 *** UTF-8 support was requested, but insufficient UTF-8 support was
505 *** detected in your curses and/or C libraries.  Please verify that your
506 *** slang was built with UTF-8 support or your curses was built with
507 *** wide character support, and that your C library was built with wide
508 *** character support.])
509     elif test x$enable_utf8 != xno; then
510         AC_MSG_WARN([
511 *** Insufficient UTF-8 support was detected in your curses and/or C
512 *** libraries.  If you want UTF-8 support, please verify that your slang
513 *** was built with UTF-8 support or your curses was built with wide
514 *** character support, and that your C library was built with wide
515 *** character support.])
516     fi
517 fi
518
519 if test x$color_support = xyes; then
520         # now check for the end of word boundary support (/< and />)
521         AC_MSG_CHECKING([for GNU-style word boundary regex support])
522         AC_TRY_RUN([
523 #ifdef HAVE_SYS_TYPES_H
524 #include <sys/types.h>
525 #endif
526 #include <regex.h>
527 int main(void)
528 {
529     regex_t r;
530     size_t nmatch;
531     regmatch_t pmatch;
532
533     if (regcomp(&r, "\\\\>", REG_EXTENDED|REG_NOSUB))
534         return 1;
535     if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
536         return 1;
537     return 0;
538 }],
539         AC_MSG_RESULT(yes)
540         AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
541         AC_MSG_RESULT(no),
542         AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
543 )
544 #    if test x$CURSES_LIB_NAME = xcurses; then
545         AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
546         AC_TRY_RUN([
547 #include <curses.h>
548 int main(void)
549 {
550     int testcolor = COLOR_WHITE;
551     return 0;
552 }], AC_MSG_RESULT(no),
553         AC_TRY_RUN([
554 #ifndef _XOPEN_SOURCE_EXTENDED
555 #define _XOPEN_SOURCE_EXTENDED 1
556 #endif
557 #include <curses.h>
558 int main(void)
559 {
560     int testcolor = COLOR_WHITE;
561     return 0;
562 }],
563         AC_DEFINE(NEED_XOPEN_SOURCE_EXTENDED, 1, [Define this if you need the _XOPEN_SOURCE_EXTENDED macro for color support])
564         AC_MSG_RESULT(yes),
565         AC_MSG_RESULT(not sure)
566         AC_MSG_WARN([*** Couldn't successfully compile basic color test with or without _XOPEN_SOURCE_EXTENDED])
567         AC_MSG_WARN([*** This build may not compile. Consider configuring with --disable-color or installing ncurses])),
568         AC_MSG_WARN([*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling]))
569     fi
570 #fi
571
572 AC_MSG_CHECKING([whether LINES and COLS can be redefined])
573 AC_TRY_RUN([
574 #include <curses.h>
575 int main(void)
576 {
577     LINES = 80;
578     COLS = 25;
579     return 0;
580 }], 
581 AC_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])
582 AC_MSG_RESULT(yes),
583 AC_MSG_RESULT(no),
584 AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
585
586 AC_CHECK_LIB(magic, magic_open)
587
588 # Check for groff html support
589 AC_MSG_CHECKING([for HTML support in groff])
590 groff -t -mandoc -Thtml </dev/null >/dev/null
591 if test $? -ne 0 ; then 
592     echo "no"
593     echo "*** Will not generate HTML version of man pages  ***"
594     echo "*** Consider installing a newer version of groff with HTML support ***"
595     groff_html_support=no
596 else
597     echo "yes"
598     groff_html_support=yes
599 fi
600 AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes)
601
602
603 AC_CONFIG_FILES([
604 Makefile
605 doc/Makefile
606 doc/nanorc.sample
607 doc/man/Makefile
608 doc/man/fr/Makefile
609 doc/syntax/Makefile
610 doc/texinfo/Makefile
611 m4/Makefile
612 po/Makefile.in
613 src/Makefile
614 nano.spec
615 ])
616
617 AC_OUTPUT