1 # Configuration for GNU nano - a small and user-friendly text editor
3 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 # Free Software Foundation, Inc.
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
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.
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,
21 # $Id: configure.ac 4538 2011-02-26 14:41:55Z astyanax $
23 AC_INIT([GNU nano], [2.3.1], [nano-devel@gnu.org], [nano])
24 AC_CONFIG_SRCDIR([src/nano.c])
25 AC_CANONICAL_TARGET([])
27 AC_CONFIG_HEADERS([config.h])
31 dnl Checks for programs.
39 dnl Internationalization macros.
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)
47 pkgdatadir=${datadir}/${PACKAGE}
48 AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
50 dnl Checks for header files.
53 AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h stdarg.h magic.h)
55 dnl Checks for options.
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
63 if test x$debug_support != xyes; then
64 AC_DEFINE(NDEBUG, 1, [Shut up assert warnings :-)])
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.])
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
87 [if test x$enable_tiny != xyes; then
88 AC_DEFINE(NANO_EXTRA, 1, [Define this to enable extra stuff.]) extra_support=yes
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.])
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.])
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.])
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.])
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).])
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.])
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.])
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.])
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.])
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
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.])
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
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.])
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
178 [if test x$enable_tiny != xyes; then
179 AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
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
187 [if test x$enable_tiny != xyes; then
188 AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
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"
197 AC_MSG_CHECKING([whether to enable UTF-8 support])
199 [ --enable-utf8 Enable UTF-8 support],
200 [if test x$enableval = xyes; then
206 AC_MSG_RESULT($enable_utf8)
208 AC_MSG_CHECKING([whether to use slang])
211 [ --with-slang[=DIR] Use the slang library instead of curses],
212 [ case "$with_slang" in
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"
225 if test x$enable_utf8 != xno; then
226 AC_CHECK_HEADER(slcurses.h,
227 AC_MSG_CHECKING([for SLutf8_enable in -lslang])
231 #include <slcurses.h>
238 AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
240 if test x$with_slang != xyes; then
241 CURSES_LIB="-L${with_slang}/lib -lslang"
245 CURSES_LIB_NAME=slang],
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
254 AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
257 #include <slcurses.h>
264 AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
266 if test x$with_slang != xyes; then
267 CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
269 CURSES_LIB="-lslang $tcap"
271 CURSES_LIB_NAME=slang],
274 # We might need the math library
275 AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
278 #include <slcurses.h>
285 AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
287 if test x$with_slang != xyes; then
288 CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
290 CURSES_LIB="-lslang $tcap -lm"
292 CURSES_LIB_NAME=slang],
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])),
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.]))
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
310 AC_CHECK_HEADER(slcurses.h,
311 AC_MSG_CHECKING([for SLtt_initialize in -lslang])
315 #include <slcurses.h>
318 SLtt_initialize(NULL);
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"
328 CURSES_LIB_NAME=slang],
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
337 AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
340 #include <slcurses.h>
343 SLtt_initialize(NULL);
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"
351 CURSES_LIB="-lslang $tcap"
353 CURSES_LIB_NAME=slang],
356 # We might need the math library
357 AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
360 #include <slcurses.h>
363 SLtt_initialize(NULL);
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"
371 CURSES_LIB="-lslang $tcap -lm"
373 CURSES_LIB_NAME=slang],
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])),
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.]))
385 if test "${_libs+set}" = "set"; then
389 if test x$with_slang != xyes; then
393 esac], [AC_MSG_RESULT(no)])
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.])
407 AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
408 AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
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
416 dnl Checks for functions.
418 AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
420 if test x$enable_utf8 != xno; then
421 AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth)
424 if test x$ac_cv_func_vsnprintf = xno; then
425 AM_PATH_GLIB_2_0(2.0.0,,
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/.]),
433 dnl Checks for typedefs, structures, and compiler characteristics.
435 dnl Checks for library functions.
438 AC_CHECK_FUNCS(getopt_long)
439 dnl Checks for libraries.
441 if eval "test x$CURSES_LIB_NAME = x"; then
442 AC_CHECK_HEADERS(ncurses.h)
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])
448 if eval "test x$CURSES_LIB_NAME = x"; then
449 AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
453 if eval "test x$CURSES_LIB_NAME = x"; then
454 AC_CHECK_HEADERS(curses.h)
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])
460 if eval "test x$CURSES_LIB_NAME = x"; then
461 AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
465 if eval "test x$CURSES_LIB_NAME = x"; then
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.])
471 AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
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.]))
476 dnl Parse any configure options.
478 LIBS="$LIBS $CURSES_LIB"
482 if test "x$GLIB_CFLAGS" != "x"; then
483 CFLAGS="$CFLAGS $GLIB_CFLAGS"
485 if test "x$GLIB_LIBS" != "x"; then
486 LDFLAGS="$LDFLAGS $GLIB_LIBS"
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()).])
502 if test x$enable_utf8 = xyes; then
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
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.])
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])
523 #ifdef HAVE_SYS_TYPES_H
524 #include <sys/types.h>
533 if (regcomp(&r, "\\\\>", REG_EXTENDED|REG_NOSUB))
535 if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
540 AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
542 AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
544 # if test x$CURSES_LIB_NAME = xcurses; then
545 AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
550 int testcolor = COLOR_WHITE;
552 }], AC_MSG_RESULT(no),
554 #ifndef _XOPEN_SOURCE_EXTENDED
555 #define _XOPEN_SOURCE_EXTENDED 1
560 int testcolor = COLOR_WHITE;
563 AC_DEFINE(NEED_XOPEN_SOURCE_EXTENDED, 1, [Define this if you need the _XOPEN_SOURCE_EXTENDED macro for color support])
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]))
572 AC_MSG_CHECKING([whether LINES and COLS can be redefined])
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])
584 AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
586 AC_CHECK_LIB(magic, magic_open)
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
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
598 groff_html_support=yes
600 AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes)