Skip to content

Commit

Permalink
auto.def: fix detection of endian related functions
Browse files Browse the repository at this point in the history
while here fix build of binfmt_macho.c on FreeBSD.
  • Loading branch information
bapt committed Nov 21, 2024
1 parent a7a816b commit d635132
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 8 additions & 5 deletions auto.def
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,14 @@ cc-check-includes link.h machine/endian.h osreldate.h readpassphrase.h \
cc-check-includes dirent.h sys/sockio.h

#endian stuff
foreach header [list endian.h sys/endian.h machine/endian.h] {
if {[cc-check-includes $header]} {
cc-with [list -includes $header] {
cc-check-decls be16dec be16enc be32dec be32enc be64dec be64enc \
le16dec le16enc le32dec le32enc le64dec le64enc
foreach fct [list be16dec be16enc be32dec be32enc be64dec be64enc le16dec le16enc le32dec le32enc le64dec le64enc] {
foreach header [list endian.h sys/endian.h machine/endian.h] {
if {[cc-check-includes $header]} {
cc-with [list -includes $header] {
if {[cc-check-decls $fct]} {
break
}
}
}
}
}
Expand Down
13 changes: 12 additions & 1 deletion libpkg/binfmt_macho.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,25 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <endian_util.h>
#ifdef HAVE_CONFIG_H
#include "pkg_config.h"
#endif

#ifdef HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#elif HAVE_ENDIAN_H
#include <endian.h>
#elif HAVE_MACHINE_ENDIAN_H
#include <machine/endian.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <bsd_compat.h>
#include "private/binfmt_macho.h"

/**
Expand Down

0 comments on commit d635132

Please sign in to comment.