aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAlbert Ou <aou@eecs.berkeley.edu>2015-02-20 23:00:00 -0800
committerAlbert Ou <aou@eecs.berkeley.edu>2015-02-20 23:00:00 -0800
commit0d8ba68054701386304819c93084c115024ee5b1 (patch)
tree62967d21a91dcf602701342b47705d52cea6e6a4 /configure.ac
parent7a0dac10bf10dbf5162f15de84661af60d8550f8 (diff)
downloadriscv-gnu-toolchain-0d8ba68054701386304819c93084c115024ee5b1.zip
riscv-gnu-toolchain-0d8ba68054701386304819c93084c115024ee5b1.tar.gz
riscv-gnu-toolchain-0d8ba68054701386304819c93084c115024ee5b1.tar.bz2
Centralize GNU utility checks in autoconf
Tests for program presence, such as those formerly embedded in the top-level Makefile for gawk and gsed, are better suited for autoconf. Note that it is not sufficient to merely export AWK and SED environment variables, as packages may still directly invoke awk(1) and sed(1) with non-standard features independent of the autotools framework. Wrapper scripts therefore remain necessary, although these are now generated by the configure script to avoid hard-coded paths. Do not assume the existence of /bin/bash on all systems.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac40
1 files changed, 27 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index 44fbd45..7280fc1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,19 +1,31 @@
AC_INIT(riscv-toolchain, 1.0)
AC_PROG_CC
-AC_PROG_AWK
+AC_PROG_FGREP
-AC_CHECK_LIB(gmp, __gmpz_mul_si, , [AC_MSG_ERROR(
- [GNU MP 3.1 or greater not found.
- See http://gmplib.org])])
+AC_PATH_PROG([BASH], [bash],
+ [AC_MSG_ERROR([bash not found])])
-AC_CHECK_LIB(mpfr, mpfr_add, , [AC_MSG_ERROR(
- [MPFR 3.1 or greater not found.
- See http://www.mpfr.org])])
+AC_PATH_PROGS_FEATURE_CHECK([GAWK], [gawk awk],
+ [AS_IF([$ac_path_GAWK --version 2>&1 | $FGREP GNU >/dev/null],
+ [ac_cv_path_GAWK=$ac_path_GAWK ac_path_GAWK_found=:])],
+ [AC_MSG_ERROR([GNU Awk not found])])
+AC_SUBST([GAWK], [$ac_cv_path_GAWK])
-AC_CHECK_LIB(mpc, mpc_add, , [AC_MSG_ERROR(
- [MPC 0.8.1 or greater not found.
- See http://www.multiprecision.org])])
+AC_PATH_PROGS_FEATURE_CHECK([GSED], [gsed sed],
+ [AS_IF([$ac_path_GSED --version 2>&1 | $FGREP GNU >/dev/null],
+ [ac_cv_path_GSED=$ac_path_GSED ac_path_GSED_found=:])],
+ [AC_MSG_ERROR([GNU sed not found])])
+AC_SUBST([GSED], [$ac_cv_path_GSED])
+
+AC_CHECK_LIB(gmp, __gmpz_init, ,
+ [AC_MSG_ERROR([GNU MP not found; see https://gmplib.org/])])
+
+AC_CHECK_LIB(mpfr, mpfr_init, ,
+ [AC_MSG_ERROR([MPFR not found; see http://www.mpfr.org/])])
+
+AC_CHECK_LIB(mpc, mpc_init2, ,
+ [AC_MSG_ERROR([MPC not found; see http://www.multiprecision.org/])])
AC_ARG_ENABLE(linux,
[Toolchain targets Linux],
@@ -21,6 +33,8 @@ AC_ARG_ENABLE(linux,
AC_SUBST(default_target, newlib)
)
-AC_OUTPUT(
- Makefile
-)
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([scripts/wrapper/awk], [chmod +x scripts/wrapper/awk])
+AC_CONFIG_FILES([scripts/wrapper/sed], [chmod +x scripts/wrapper/sed])
+
+AC_OUTPUT