From: Tommi Rantala <tt.rantala@gmail.com>
To: davej@redhat.com, trinity@vger.kernel.org
Cc: Tommi Rantala <tt.rantala@gmail.com>
Subject: [PATCH 7/9] Check headers with the compiler in configure.sh
Date: Mon, 1 Apr 2013 21:58:37 +0300 [thread overview]
Message-ID: <1364842720-24127-7-git-send-email-tt.rantala@gmail.com> (raw)
In-Reply-To: <1364842720-24127-1-git-send-email-tt.rantala@gmail.com>
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
next prev parent reply other threads:[~2013-04-01 18:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-01 18:58 [PATCH 1/9] Use color clearing also in Makefile Tommi Rantala
2013-04-01 18:58 ` [PATCH 2/9] Check 'drm.h' existence Tommi Rantala
2013-04-01 18:58 ` [PATCH 3/9] Fix bitrot in include/syscalls-ia64.h Tommi Rantala
2013-04-01 18:58 ` [PATCH 4/9] Include asm/perfmon.h for the PFM_* constants in syscalls/ia64/perfmonctl.c Tommi Rantala
2013-04-01 18:58 ` [PATCH 5/9] Fix double .arg3name assignment " Tommi Rantala
2013-04-01 18:58 ` [PATCH 6/9] Dummy PTRACE_GETFPREGS and PTRACE_SETFPREGS for IA64 Tommi Rantala
2013-04-01 18:58 ` Tommi Rantala [this message]
2013-04-01 18:58 ` [PATCH 8/9] Fix SYSCALLS_ARCH Tommi Rantala
2013-04-01 18:58 ` [PATCH 9/9] Build syscalls/ia64/*.c Tommi Rantala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1364842720-24127-7-git-send-email-tt.rantala@gmail.com \
--to=tt.rantala@gmail.com \
--cc=davej@redhat.com \
--cc=trinity@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).