Skip to content

Commit

Permalink
build: use standard HAVE_xxx define style
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Mike Frysinger <[email protected]>
  • Loading branch information
vapier committed Jan 24, 2024
1 parent e679f9b commit 063a906
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
4 changes: 1 addition & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
20 changes: 10 additions & 10 deletions porting.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 063a906

Please sign in to comment.