aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorPrashanth Mundkur <prashanth.mundkur@gmail.com>2016-07-16 16:39:50 -0700
committerAndrew Waterman <waterman@eecs.berkeley.edu>2016-07-16 16:39:50 -0700
commitdc939be3b31a8d78690583ecccad286b8a2a8f76 (patch)
tree1730a7900c56cffca133392f7341ad86cf0d28f1 /configure.ac
parent748eee73a12b9263bf80a9ca9e8a40ce57a8da6d (diff)
downloadpk-dc939be3b31a8d78690583ecccad286b8a2a8f76.zip
pk-dc939be3b31a8d78690583ecccad286b8a2a8f76.tar.gz
pk-dc939be3b31a8d78690583ecccad286b8a2a8f76.tar.bz2
Support 32bit build (#27)
* Support configuration for a 32-bit build. * Regenerate configure.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac35
1 files changed, 32 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index a5b0624..1bf0326 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,11 +67,40 @@ MCPPBS_PROG_INSTALL
AC_HEADER_STDC
#-------------------------------------------------------------------------
-# Default compiler flags
+# Register RISCV environment variable
#-------------------------------------------------------------------------
-AC_SUBST([CFLAGS], ["-Wall -Werror -D__NO_INLINE__ -mcmodel=medany -O2 -std=gnu99 -Wno-unused -Wno-attributes -fno-delete-null-pointer-checks"])
-AC_SUBST([LIBS], ["-lgcc"])
+AC_ARG_VAR(RISCV, [top-level RISC-V install directory])
+
+#-------------------------------------------------------------------------
+# Set compiler flags
+#-------------------------------------------------------------------------
+
+default_CFLAGS="-Wall -Werror -D__NO_INLINE__ -mcmodel=medany -O2 -std=gnu99 -Wno-unused -Wno-attributes -fno-delete-null-pointer-checks"
+
+AC_ARG_ENABLE([32bit],
+ AS_HELP_STRING([--enable-32bit], [Build a 32-bit pk]),
+ BUILD_32BIT=$enableval,
+ BUILD_32BIT=no)
+
+case "${BUILD_32BIT}" in
+ yes|default)
+ echo "Building 32-bit pk"
+ CFLAGS="$default_CFLAGS -m32"
+ LDFLAGS="-m32"
+ install_subdir="riscv32-unknown-elf"
+ ;;
+ *)
+ CFLAGS="$default_CFLAGS"
+ LDFLAGS=
+ install_subdir="riscv64-unknown-elf"
+ ;;
+esac
+
+AC_SUBST(CFLAGS)
+AC_SUBST(LDFLAGS)
+AC_SUBST([LIBS], ["-lgcc"])
+AC_SUBST(install_subdir)
#-------------------------------------------------------------------------
# MCPPBS subproject list