Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cc(1)'s __has_include() instead of build-system checks #1118

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
7 changes: 0 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ LT_LIB_DLLOAD

dnl Checks for libraries.

dnl Checks for header files.
AC_CHECK_HEADERS(crypt.h utmp.h \
termio.h sgtty.h sys/ioctl.h paths.h \
sys/capability.h sys/random.h \
gshadow.h lastlog.h rpc/key_prot.h acl/libacl.h \
attr/libattr.h attr/error_context.h)

dnl shadow now uses the libc's shadow implementation
AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])

Expand Down
4 changes: 2 additions & 2 deletions lib/csrand.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#if HAVE_SYS_RANDOM_H
#include <sys/random.h>
#if __has_include(<sys/random.h>)
# include <sys/random.h>
#endif

#include "bit.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* crypt(3), crypt_gensalt(3), and their
* feature test macros may be defined in here.
*/
#if HAVE_CRYPT_H
#if __has_include(<crypt.h>)
# include <crypt.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion lib/gshadow.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <config.h>

#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)

#ident "$Id$"

Expand Down
4 changes: 2 additions & 2 deletions lib/gshadow_.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define SHADOW_INCLUDE_LIB_GSHADOW__H_


#if defined(HAVE_GSHADOW_H)
#if __has_include(<gshadow.h>)
# include <gshadow.h>
#else

Expand Down Expand Up @@ -41,5 +41,5 @@ int putsgent (const struct sgrp *, FILE *);
#define GSHADOW "/etc/gshadow"


#endif // !HAVE_GSHADOW_H
#endif // !__has_include(<gshadow.h>)
#endif // include guard
8 changes: 4 additions & 4 deletions lib/idmapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#if HAVE_SYS_CAPABILITY_H
#include <sys/prctl.h>
#include <sys/capability.h>
#if __has_include(<sys/capability.h>)
# include <sys/capability.h>
#endif

#include "alloc/calloc.h"
Expand Down Expand Up @@ -86,7 +86,7 @@ get_map_ranges(int ranges, int argc, char **argv)
*/
#define ULONG_DIGITS (((WIDTHOF(unsigned long) + 9)/10)*3)

#if HAVE_SYS_CAPABILITY_H
#if __has_include(<sys/capability.h>)
static inline bool maps_lower_root(int cap, int ranges, const struct map_range *mappings)
{
int idx;
Expand Down Expand Up @@ -129,7 +129,7 @@ void write_mapping(int proc_dir_fd, int ranges, const struct map_range *mappings
char *buf, *pos, *end;
int fd;

#if HAVE_SYS_CAPABILITY_H
#if __has_include(<sys/capability.h>)
int cap;
struct __user_cap_header_struct hdr = {_LINUX_CAPABILITY_VERSION_3, 0};
struct __user_cap_data_struct data[2] = {{0}};
Expand Down
5 changes: 3 additions & 2 deletions lib/pam_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
*/

#include <config.h>

#include <security/pam_appl.h>
#ifdef HAVE_SECURITY_PAM_MISC_H
#if __has_include(<security/pam_misc.h>)
# include <security/pam_misc.h>
#endif
#ifdef HAVE_SECURITY_OPENPAM_H
#if __has_include(<security/openpam.h>)
# include <security/openpam.h>
#endif

Expand Down
Loading