]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: define and use BUILD_CC in configure.ac for cross compilation
authorTheodore Ts'o <tytso@mit.edu>
Mon, 3 Aug 2015 00:16:21 +0000 (10:16 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 3 Aug 2015 00:16:21 +0000 (10:16 +1000)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
configure.ac
include/builddefs.in
libxfs/Makefile

index 3dabd5d37dfd6d1b85224779c340df4aa0d9cc2c..f60efd14d09e847c68302b92ba90659f3e9d42d4 100644 (file)
@@ -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)
index d406774502fb3927192a077609b0d42ac75d4fac..cdf2d41cc4e0bbe1e9b4385009e8649cfe975456 100644 (file)
@@ -63,6 +63,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@
index 95de27ea08bc185ac7d31fafa9d4eb5f40f168e7..85c3ed7545507369b4aa2bc5d8ff9251a1a78a4d 100644 (file)
@@ -111,7 +111,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
 
@@ -122,7 +122,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) ./$@
 
 # set up include/xfs header directory