From de9384767f4df49f0a85a0b95ba90bf66e6b5e59 Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Tue, 29 Oct 2024 07:59:19 +0800 Subject: [PATCH] build: Move _XOPEN_SOURCE_EXTENDED define to config.h This allows configure tests to utilize the macro. Also explain the reasons that we define _XOPEN_SOURCE_EXTENDED and not _XOPEN_SOURCE. Signed-off-by: Kang-Che Sung --- Makefile.am | 2 +- configure.ac | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 65de4f922..f25c0f068 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,7 +24,7 @@ pixmap_DATA = htop.png appicondir = $(datadir)/icons/hicolor/scalable/apps appicon_DATA = htop.svg -AM_CFLAGS += -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR="\"$(sysconfdir)\"" -I"$(top_srcdir)/$(my_htop_platform)" +AM_CFLAGS += -DSYSCONFDIR="\"$(sysconfdir)\"" -I"$(top_srcdir)/$(my_htop_platform)" AM_LDFLAGS = myhtopsources = \ diff --git a/configure.ac b/configure.ac index 857d865bf..5c9ccd2d4 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,22 @@ esac # Enable extensions, required by hwloc scripts AC_USE_SYSTEM_EXTENSIONS +# The header of ncurses exposes wide-character interfaces only if +# _XOPEN_SOURCE_EXTENDED is defined or _XOPEN_SOURCE defined to be +# >= 500. In DragonFly BSD, FreeBSD and OpenBSD, defining +# _XOPEN_SOURCE to any value *hides* interfaces that would be useful +# for htop. +dnl +dnl Note: The "#undef" in AH_VERBATIM will be replaced with "#define" +dnl when config.h is generated. +AH_VERBATIM([_XOPEN_SOURCE_EXTENDED], +[/* Enables XPG4v2 (SUSv1) interfaces if they are not enabled already with _XOPEN_SOURCE */ +#ifndef _XOPEN_SOURCE_EXTENDED +#undef _XOPEN_SOURCE_EXTENDED +#endif +]) +AC_DEFINE([_XOPEN_SOURCE_EXTENDED], 1) + # Activate some more of the missing global defines AC_SYS_LARGEFILE