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>
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)
PKG_LOCALE_DIR = @datadir@/locale
CC = @cc@
+BUILD_CC = @BUILD_CC@
AWK = @awk@
SED = @sed@
TAR = @tar@
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
# 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