From ff636cd27782f33f11ff8477b0dad4535d1ab9ab Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Sun, 29 Apr 2007 22:05:02 +0000 Subject: [PATCH] On Linux, define _GNU_SOURCE so that GNU libc exposes the wcwidth() prototype in wchar.h. --- Makefile.in | 2 +- configure.in | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 2fa252c..eecef1b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -48,7 +48,7 @@ default_pager = @pagerpath@ CC = @CC@ CPPFLAGS = @CPPFLAGS@ -DEFS = @DEFS@ +DEFS = @DEFS@ @OURDEFS@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ diff --git a/configure.in b/configure.in index 3b9f44c..e113860 100644 --- a/configure.in +++ b/configure.in @@ -444,6 +444,25 @@ AC_SUBST(MAIL_SPOOL_GRP)dnl dnl ------------------ dnl CHECK HEADER FILES dnl ------------------ + +dnl On glibc we need to define at least the '_XOPEN_SOURCE' level of features, +dnl or wchar.h doesn't declare a prototype for wcwidth(). But if we only define +dnl that level then db.h won't compile. So we define _GNU_SOURCE which turns +dnl on everything. Perhaps other OSes need some feature switch set to get wcwidth() +dnl declared; if so they should have an entry added to this case statement. +dnl NB that we must define this on the compiler command line, not in config.h, +dnl because it must be set before any system header is included and there's no +dnl portable way to make sure that files generated by lex include config.h +dnl before system header files. + +case "$target_os" in + linux*) + # Like DEFS, but doesn't get stomped on by configure when using config.h: + OURDEFS="$OURDEFS -D_GNU_SOURCE" + ;; +esac +AC_SUBST(OURDEFS) + AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_TIME @@ -984,6 +1003,7 @@ target os : ${target} compiler : ${CC} compiler flags : ${CFLAGS} linker flags : ${LDFLAGS} +definitions : ${OURDEFS} source code location : ${srcdir} binary install path : ${nmhbin2} libary install path : ${nmhlib2} -- 1.7.10.4