public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: xfs@oss.sgi.com
Cc: Theodore Ts'o <tytso@mit.edu>, fstests@vger.kernel.org
Subject: [PATCH 3/6] xfsprogs: define and use BUILD_CC in configure.ac for cross compilation
Date: Sun, 26 Jul 2015 08:20:52 -0400	[thread overview]
Message-ID: <1437913255-7524-4-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1437913255-7524-1-git-send-email-tytso@mit.edu>

In order to support cross-compilation, we need to build gen_crc32table
using the C compiler targetted for the build platform, since it is run
as part of the build process.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 configure.ac         | 8 ++++++++
 include/builddefs.in | 1 +
 libxfs/Makefile      | 4 ++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index ae17c68..4cfbd4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,6 +8,14 @@ AC_PREFIX_DEFAULT(/usr)
 
 AC_PROG_LIBTOOL
 
+AC_PROG_CC
+if test $cross_compiling = no; then
+  BUILD_CC="$CC"
+  AC_SUBST(BUILD_CC)
+else
+  AC_CHECK_PROGS(BUILD_CC, gcc cc)
+fi
+
 AC_ARG_ENABLE(shared,
 [ --enable-shared=[yes/no] Enable use of shared libraries [default=yes]],,
 	enable_shared=yes)
diff --git a/include/builddefs.in b/include/builddefs.in
index 7e9f53d..1d2d22e 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -64,6 +64,7 @@ PKG_DOC_DIR	= @datadir@/doc/@pkg_name@
 PKG_LOCALE_DIR	= @datadir@/locale
 
 CC		= @cc@
+BUILD_CC	= @BUILD_CC@
 AWK		= @awk@
 SED		= @sed@
 TAR		= @tar@
diff --git a/libxfs/Makefile b/libxfs/Makefile
index ae15a5d..6323b81 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -67,7 +67,7 @@ default: crc32selftest ltdepend $(LTLIBRARY)
 
 crc32table.h: gen_crc32table.c
 	@echo "    [CC]     gen_crc32table"
-	$(Q) $(CC) $(CFLAGS) -o gen_crc32table $<
+	$(Q) $(BUILD_CC) $(CFLAGS) -o gen_crc32table $<
 	@echo "    [GENERATE] $@"
 	$(Q) ./gen_crc32table > crc32table.h
 
@@ -78,7 +78,7 @@ crc32table.h: gen_crc32table.c
 # disk.
 crc32selftest: gen_crc32table.c crc32table.h crc32.c
 	@echo "    [TEST]    CRC32"
-	$(Q) $(CC) $(CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
+	$(Q) $(BUILD_CC) $(CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
 	$(Q) ./$@
 
 include $(BUILDRULES)
-- 
2.3.0

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2015-07-26 12:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-26 12:20 [PATCH 0/6] Add cross-compilation support for android Theodore Ts'o
2015-07-26 12:20 ` [PATCH 1/6] xfsprogs: define NBBY if not defined by the system header files Theodore Ts'o
2015-07-30 17:07   ` Christoph Hellwig
2015-07-26 12:20 ` [PATCH 2/6] xfsprogs: pull in libgen.h to get prototype for basename() Theodore Ts'o
2015-07-30 17:11   ` Christoph Hellwig
2015-07-26 12:20 ` Theodore Ts'o [this message]
2015-07-30 17:10   ` [PATCH 3/6] xfsprogs: define and use BUILD_CC in configure.ac for cross compilation Christoph Hellwig
2016-02-01 21:25   ` xfsprogs: Add BUILD_CFLAGS " Gwendal Grignou
2016-02-02 18:08     ` Christoph Hellwig
2016-05-27 16:34       ` Gwendal Grignou
2016-05-31 12:51         ` Christoph Hellwig
2016-05-31 16:19           ` Gwendal Grignou
2015-07-26 12:20 ` [PATCH 4/6] xfsprogs: avoid use of si_tid in struct xlog_split_item Theodore Ts'o
2015-07-30 17:11   ` Christoph Hellwig
2015-07-26 12:20 ` [PATCH 5/6] xfsprogs: use "unsigned short" instead of ushort Theodore Ts'o
2015-07-30 17:09   ` Christoph Hellwig
2015-07-26 12:20 ` [PATCH 6/6] xfsprogs: add missing include of <stat.h> Theodore Ts'o
2015-07-30 17:10   ` Christoph Hellwig

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=1437913255-7524-4-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=fstests@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /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