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 <explorer09@gmail.com>
diff --git a/configure.ac b/configure.ac
index 857d865..5c9ccd2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,22 @@
# 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