commit 5a3464b57b282f249ec97e4fe0909f7eb6370a2c
parent fb6446d8260a49dd35ba4ace00e84962082c49be
Author: Chris Allegretta <chrisa@asty.org>
Date: Sun, 1 Mar 2009 00:50:19 +0000
2009-02-28 Chris Allegretta <chrisa@asty.org>
* configure.ac: Add check for whether _XOPEN_SOURCE_EXTENDED is needed for
curses to work w/color. Fixes compilation on HP-UX with older GCC,
reported by jay.krell@cornell.edu.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4387 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
3 files changed, 72 insertions(+), 33 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-28 Chris Allegretta <chrisa@asty.org>
+ * configure.ac: Add check for whether _XOPEN_SOURCE_EXTENDED is needed for
+ curses to work w/color. Fixes compilation on HP-UX with older GCC,
+ reported by jay.krell@cornell.edu.
+
2009-02-23 Eitan Adler <eitanadlerlist@gmail.com>
* doc/man/Makefile.am: Fix make variable substitution to be more portable
diff --git a/configure.ac b/configure.ac
@@ -50,7 +50,7 @@ AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h)
+AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h stdarg.h)
dnl Checks for options.
@@ -144,7 +144,7 @@ fi])
AC_ARG_ENABLE(color,
[ --disable-color Disable color and syntax highlighting],
-[if test x$enableval != xno; then
+if test x$enableval != xno; then
if test x$ac_cv_header_regex_h = xyes; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
@@ -155,7 +155,7 @@ AC_ARG_ENABLE(color,
*** libraries that include the regex.h file or call the configure
*** script with --disable-color.])
fi
-fi], [
+fi,
if test x$enable_tiny != xyes; then
if test x$ac_cv_header_regex_h = xyes; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
@@ -168,7 +168,7 @@ fi], [
*** script with --disable-color.])
fi
fi
-])
+)
AC_ARG_ENABLE(multibuffer,
[ --disable-multibuffer Disable multiple file buffers],
@@ -194,34 +194,6 @@ AC_ARG_ENABLE(all,
echo "--enable-all option no longer needed, ignoring for compatiblity"
fi])
-if test x$color_support = xyes; then
- # now check for the end of word boundary support (/< and />)
- AC_MSG_CHECKING([for GNU-style word boundary regex support])
- AC_TRY_RUN([
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <regex.h>
-int main(void)
-{
- regex_t r;
- size_t nmatch;
- regmatch_t pmatch;
-
- if (regcomp(&r, "\\\\>", REG_EXTENDED|REG_NOSUB))
- return 1;
- if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
- return 1;
- return 0;
-}],
- AC_MSG_RESULT(yes)
- AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
- AC_MSG_RESULT(no),
- AC_MSG_WARN([*** Can't check for gnu word boundary support when cross-compiling])
-)
-fi
-
-
AC_MSG_CHECKING([whether to enable UTF-8 support])
AC_ARG_ENABLE(utf8,
[ --enable-utf8 Enable UTF-8 support],
@@ -464,7 +436,6 @@ dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getopt_long)
-
dnl Checks for libraries.
if eval "test x$CURSES_LIB_NAME = x"; then
@@ -545,6 +516,59 @@ else
fi
fi
+if test x$color_support = xyes; then
+ # now check for the end of word boundary support (/< and />)
+ AC_MSG_CHECKING([for GNU-style word boundary regex support])
+ AC_TRY_RUN([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#include <regex.h>
+int main(void)
+{
+ regex_t r;
+ size_t nmatch;
+ regmatch_t pmatch;
+
+ if (regcomp(&r, "\\\\>", REG_EXTENDED|REG_NOSUB))
+ return 1;
+ if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
+ return 1;
+ return 0;
+}],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
+ AC_MSG_RESULT(no),
+ AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
+)
+# if test x$CURSES_LIB_NAME = xcurses; then
+ AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
+ AC_TRY_RUN([
+#include <curses.h>
+int main(void)
+{
+ int testcolor = COLOR_WHITE;
+ return 0;
+}], AC_MSG_RESULT(no),
+ AC_TRY_RUN([
+#ifndef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED 1
+#endif
+#include <curses.h>
+int main(void)
+{
+ int testcolor = COLOR_WHITE;
+ return 0;
+}],
+ AC_DEFINE(NEED_XOPEN_SOURCE_EXTENDED, 1, [Define this if you need the _XOPEN_SOURCE_EXTENDED macro for color support])
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(not sure)
+ AC_MSG_WARN([*** Couldn't successfully compile basic color test with or without _XOPEN_SOURCE_EXTENDED])
+ AC_MSG_WARN([*** This build may not compile. Consider configuring with --disable-color or installing ncurses])),
+ AC_MSG_WARN([*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling]))
+ fi
+#fi
+
# Check for groff html support
AC_MSG_CHECKING([for HTML support in groff])
groff -t -mandoc -Thtml </dev/null >/dev/null
diff --git a/src/nano.h b/src/nano.h
@@ -28,6 +28,12 @@
#include <config.h>
#endif
+#ifdef NEED_XOPEN_SOURCE_EXTENDED
+#ifndef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED 1
+#endif /* _XOPEN_SOURCE_EXTENDED */
+#endif /* NEED_XOPEN_SOURCE_EXTENDED */
+
#ifdef __TANDEM
/* Tandem NonStop Kernel support. */
#include <floss.h>
@@ -44,6 +50,10 @@
#include <sys/param.h>
#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+
/* Macros for flags. */
#define SET(bit) flags |= bit
#define UNSET(bit) flags &= ~bit