Fix host build for newer linux distros

I realized there was a better way to do this..

Instead of specifying a path just have gcc run the preprocessor (-E) on
an input file consisting of only '#include <byteswap.h>' if it succeeds
then we can use it if not then don't define OS_USE_BYTESWAP_H

Change-Id: I0de8e469445221bc1b5ad8cc032de5b89a85ab66
This commit is contained in:
William Wilgus 2018-12-10 01:36:33 -06:00
parent 62a5ed49cc
commit 4055f90f08

17
tools/configure vendored
View file

@ -10,9 +10,6 @@
# global CC options for all platforms # global CC options for all platforms
CCOPTS="-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes -pipe -std=gnu99" CCOPTS="-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes -pipe -std=gnu99"
#newer versions GLIBC use byteswap.h
BYTESWP="/usr/include/byteswap.h"
# LD options for the core # LD options for the core
LDOPTS="" LDOPTS=""
# LD options for the core + plugins # LD options for the core + plugins
@ -349,6 +346,11 @@ simcc () {
sigaltstack=`check_sigaltstack` sigaltstack=`check_sigaltstack`
echo "Linux host detected" echo "Linux host detected"
LDOPTS="$LDOPTS -ldl" LDOPTS="$LDOPTS -ldl"
# newer glibc implementations use byteswap.h
if echo "#include <byteswap.h>" | gcc -E - > /dev/null 2>&1; then
echo "Using byteswap.h"
extradefines="$extradefines -DOS_USE_BYTESWAP_H"
fi
;; ;;
FreeBSD) FreeBSD)
@ -4394,7 +4396,6 @@ fi
;; ;;
[Cc]) [Cc])
uname=`uname` uname=`uname`
checkwps="yes"
simcc "checkwps" simcc "checkwps"
toolset=''; toolset='';
t_cpu=''; t_cpu='';
@ -4477,14 +4478,6 @@ if [ "yes" = "$simulator" ]; then
unset application unset application
fi fi
# newer glibc implementations use byteswap.h
if [ "$simulator" = "yes" ] || [ "$checkwps" = "yes" ]; then
if test -f "$BYTESWP"; then
echo Using "$BYTESWP"
extradefines="$extradefines -DOS_USE_BYTESWAP_H=$BYTESWP"
fi
fi
if [ "yes" = "$application" ]; then if [ "yes" = "$application" ]; then
echo Building Rockbox as an Application echo Building Rockbox as an Application
extradefines="$extradefines -DAPPLICATION" extradefines="$extradefines -DAPPLICATION"