To allow for proper cross compilation support, pass the headers to the
compiler to see if they are available. Checking the return value from
the pre-processing (-E) seems to do the trick.
---
configure.sh | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/configure.sh b/configure.sh
index 98b740d..f5f6fc9 100755
--- a/configure.sh
+++ b/configure.sh
@@ -12,10 +12,15 @@ echo "/* This file is auto-generated by configure.sh */" >
config.h
TMP=$(mktemp)
-file_exists()
+check_header()
{
- echo -n "[*] Checking $1 exists... "
- if [ -f /usr/include/$1 ]; then
+ echo -n "[*] Checking header $1 ... "
+
+ rm -f "$TMP" || exit 1
+ echo "#include <$1>" >"$TMP.c"
+
+ ${CC} "$TMP.c" -E &>"$TMP.log"
+ if [ $? -eq 0 ]; then
echo $GREEN "[YES]" $COL_RESET
echo "#define $2 1" >> config.h
else
@@ -170,15 +175,15 @@ fi
#############################################################################################
-file_exists linux/caif/caif_socket.h USE_CAIF
-file_exists linux/if_alg.h USE_IF_ALG
-file_exists linux/rds.h USE_RDS
-file_exists linux/vfio.h USE_VFIO
-file_exists linux/btrfs.h USE_BTRFS
-file_exists drm/drm.h USE_DRM
-file_exists drm/exynos_drm.h USE_DRM_EXYNOS
-file_exists sound/compress_offload.h USE_SNDDRV_COMPRESS_OFFLOAD
-file_exists linux/vhost.h USE_VHOST
+check_header linux/caif/caif_socket.h USE_CAIF
+check_header linux/if_alg.h USE_IF_ALG
+check_header linux/rds.h USE_RDS
+check_header linux/vfio.h USE_VFIO
+check_header linux/btrfs.h USE_BTRFS
+check_header drm/drm.h USE_DRM
+check_header drm/exynos_drm.h USE_DRM_EXYNOS
+check_header sound/compress_offload.h USE_SNDDRV_COMPRESS_OFFLOAD
+check_header linux/vhost.h USE_VHOST
rm -f "$TMP" "$TMP.log" "$TMP.c"
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe trinity" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html