summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2023-03-08 20:36:47 +0100
committerChristian Persch <chpe@src.gnome.org>2023-03-08 20:36:47 +0100
commit75543c3b30dbf696b084e927dabbf52a41d32638 (patch)
treef53a025d6bf341aecdc4d2dac3cd3fd45aee794c
parentbd4f781d168859eb42943a23487422224124467c (diff)
downloadvte-75543c3b30dbf696b084e927dabbf52a41d32638.tar.gz
all: Use __has_include
... instead of checking for header presence from meson.build.
-rw-r--r--meson.build21
-rw-r--r--src/dumpkeys.c7
-rw-r--r--src/mev.c2
-rw-r--r--src/missing.cc3
-rw-r--r--src/pty.cc9
-rw-r--r--src/vte.cc12
-rw-r--r--src/vteaccess.cc2
-rw-r--r--src/vtegtk.cc2
-rw-r--r--src/vteseq.cc2
9 files changed, 22 insertions, 38 deletions
diff --git a/meson.build b/meson.build
index 62bfefdf..c2b10873 100644
--- a/meson.build
+++ b/meson.build
@@ -253,27 +253,6 @@ foreach f: libc_feature_defines
config_h.set(f[0], f[1])
endforeach
-# Check headers
-
-check_headers = [
- 'locale.h',
- 'pty.h',
- 'stropts.h',
- 'sys/resource.h',
- 'sys/select.h',
- 'sys/stream.h',
- 'sys/syslimits.h',
- 'sys/types.h',
- 'sys/wait.h',
- 'termios.h',
- 'util.h',
- 'wchar.h',
-]
-
-foreach header: check_headers
- config_h.set('HAVE_' + header.underscorify().to_upper(), cxx.has_header(header))
-endforeach
-
# Check for symbols
check_symbols_required = [
diff --git a/src/dumpkeys.c b/src/dumpkeys.c
index 08a72d23..53a2f588 100644
--- a/src/dumpkeys.c
+++ b/src/dumpkeys.c
@@ -15,11 +15,12 @@
* along with this library. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <config.h>
-#ifdef HAVE_SYS_TYPES_H
+#include "config.h"
+
+#if __has_include(<sys/types.h>)
#include <sys/types.h>
#endif
-#ifdef HAVE_SYS_SELECT_H
+#if __has_include(<sys/select.h>)
#include <sys/select.h>
#endif
#include <termios.h>
diff --git a/src/mev.c b/src/mev.c
index 2f81a640..74c4aca3 100644
--- a/src/mev.c
+++ b/src/mev.c
@@ -27,7 +27,7 @@
#include <glib.h>
#include "caps.hh"
-#ifdef HAVE_SYS_SELECT_H
+#if __has_include(<sys/select.h>)
#include <sys/select.h>
#endif
diff --git a/src/missing.cc b/src/missing.cc
index 469b3aff..ebaba4e1 100644
--- a/src/missing.cc
+++ b/src/missing.cc
@@ -17,8 +17,9 @@
#include "config.h"
-#ifdef HAVE_SYS_RESOURCE_H
+#if __has_include(<sys/resource.h>)
#include <sys/resource.h>
+#define HAVE_SYS_RESOURCE_H
#endif
#include <glib-unix.h>
diff --git a/src/pty.cc b/src/pty.cc
index 654eefbc..52d21fb7 100644
--- a/src/pty.cc
+++ b/src/pty.cc
@@ -41,7 +41,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
-#ifdef HAVE_SYS_SYSLIMITS_H
+#if __has_include(<sys/syslimits.h>)
#include <sys/syslimits.h>
#endif
#include <signal.h>
@@ -51,14 +51,15 @@
#include <string.h>
#include <termios.h>
#include <unistd.h>
-#ifdef HAVE_UTIL_H
+#if __has_include(<util.h>)
#include <util.h>
#endif
-#ifdef HAVE_PTY_H
+#if __has_include(<pty.h>)
#include <pty.h>
#endif
-#if defined(__sun) && defined(HAVE_STROPTS_H)
+#if defined(__sun) && __has_include(<stropts.h>)
#include <stropts.h>
+#define HAVE_STROPTS_H
#endif
#include <glib.h>
#include <gio/gio.h>
diff --git a/src/vte.cc b/src/vte.cc
index 05c12901..e047db61 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -27,10 +27,11 @@
#include <fcntl.h>
#include <termios.h>
-#ifdef HAVE_STROPTS_H
+#if __has_include(<stropts.h>)
#include <stropts.h>
+#define HAVE_STROPTS_H
#endif
-#ifdef HAVE_SYS_STREAM_H
+#if __has_include(<sys/stream.h>)
#include <sys/stream.h>
#endif
@@ -54,14 +55,15 @@
#include "graphene-glue.hh"
#endif
-#ifdef HAVE_WCHAR_H
+#if __has_include(<wchar.h>)
#include <wchar.h>
#endif
-#ifdef HAVE_SYS_SYSLIMITS_H
+#if __has_include(<sys/syslimits.h>)
#include <sys/syslimits.h>
#endif
-#ifdef HAVE_SYS_WAIT_H
+#if __has_include(<sys/wait.h>)
#include <sys/wait.h>
+#define HAVE_SYS_WAIT_H
#endif
#include <glib.h>
#include <glib-object.h>
diff --git a/src/vteaccess.cc b/src/vteaccess.cc
index 302635a4..00bb1cd3 100644
--- a/src/vteaccess.cc
+++ b/src/vteaccess.cc
@@ -27,7 +27,7 @@
#include "vteinternal.hh"
#include "widget.hh"
-#ifdef HAVE_LOCALE_H
+#if __has_include(<locale.h>)
#include <locale.h>
#endif
#include <glib/gi18n-lib.h>
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index d4eeea4f..fa7856d9 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -37,7 +37,7 @@
#include <pwd.h>
-#ifdef HAVE_LOCALE_H
+#if __has_include(<locale.h>)
#include <locale.h>
#endif
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 3945fcac..55315da6 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
-#ifdef HAVE_SYS_SYSLIMITS_H
+#if __has_include(<sys/syslimits.h>)
#include <sys/syslimits.h>
#endif