commit:     063a90661c0423172e23405c2548e649a1631796
Author:     Mike Frysinger <vapier <AT> chromium <DOT> org>
AuthorDate: Wed Jan 24 15:35:52 2024 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Jan 24 15:35:52 2024 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=063a9066

build: use standard HAVE_xxx define style

Use the more standard HAVE_xxx convention, and only define when
available.  This avoids further confusion with code that is using
"#ifdef" already.

Signed-off-by: Mike Frysinger <vapier <AT> chromium.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 meson.build |  4 +---
 porting.h   | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/meson.build b/meson.build
index c91bb64..e891d98 100644
--- a/meson.build
+++ b/meson.build
@@ -48,11 +48,9 @@ foreach x : [
   'elf-hints.h',
   'glob.h',
 ]
-  x_exists = 0
   if cc.has_header(x)
-    x_exists = 1
+    probe_results.set('HAVE_' + x.to_upper().underscorify(), 1)
   endif
-  probe_results.set('HAS_' + x.to_upper().underscorify(), x_exists)
 endforeach
 
 configure_file(

diff --git a/porting.h b/porting.h
index 1ace55e..68e2b6c 100644
--- a/porting.h
+++ b/porting.h
@@ -40,36 +40,36 @@
 #include <time.h>
 #include <unistd.h>
 #include "elf.h"
-#if HAS_ALLOCA_H
+#ifdef HAVE_ALLOCA_H
 # include <alloca.h>
 #endif
-#if HAS_SYS_PRCTL_H
+#ifdef HAVE_SYS_PRCTL_H
 # include <sys/prctl.h>
-# if HAS_LINUX_SECCOMP_H
+# ifdef HAVE_LINUX_SECCOMP_H
 #  include <linux/seccomp.h>
 # endif
-# if HAS_LINUX_SECUREBITS_H
+# ifdef HAVE_LINUX_SECUREBITS_H
 #  include <linux/securebits.h>
 # endif
 #endif
-#if HAS_ENDIAN_H && HAS_BYTESWAP_H
+#if defined(HAVE_ENDIAN_H) && defined(HAVE_BYTESWAP_H)
 # include <byteswap.h>
 # include <endian.h>
-#elif HAS_SYS_ENDIAN_H
+#elif defined(HAVE_SYS_ENDIAN_H)
 # include <sys/endian.h>
-#elif HAS_ISA_DEFS_H
+#elif defined(HAVE_ISA_DEFS_H)
 # include <sys/isa_defs.h>
-#elif HAS_MACHINE_ENDIAN_H
+#elif defined(HAVE_MACHINE_ENDIAN_H)
 # include <machine/endian.h>
 #endif
 
-#ifdef HAS_GLOB_H
+#ifdef HAVE_GLOB_H
 # include <glob.h>
 #endif
 
 #if defined(__GLIBC__) || defined(__UCLIBC__) || defined(__NetBSD__)
 # define __PAX_UTILS_DEFAULT_LD_CACHE_CONFIG "/etc/ld.so.conf"
-#elif HAS_ELF_HINTS_H
+#elif defined(HAVE_ELF_HINTS_H)
 # include <elf-hints.h>
 # define __PAX_UTILS_DEFAULT_LD_CACHE_CONFIG _PATH_ELF_HINTS
 #else

Reply via email to