summaryrefslogtreecommitdiff
path: root/BUILD
diff options
context:
space:
mode:
Diffstat (limited to 'BUILD')
-rw-r--r--BUILD/Makefile.am1
-rwxr-xr-xBUILD/autorun.sh7
-rw-r--r--BUILD/choose_configure.sh14
3 files changed, 22 insertions, 0 deletions
diff --git a/BUILD/Makefile.am b/BUILD/Makefile.am
index cd4b00ea731..312340e7132 100644
--- a/BUILD/Makefile.am
+++ b/BUILD/Makefile.am
@@ -20,6 +20,7 @@
EXTRA_DIST = FINISH.sh \
SETUP.sh \
autorun.sh \
+ choose_configure.sh \
build_mccge.sh \
check-cpu \
cleanup \
diff --git a/BUILD/autorun.sh b/BUILD/autorun.sh
index 35a2e56cbdf..f45b1f7d08c 100755
--- a/BUILD/autorun.sh
+++ b/BUILD/autorun.sh
@@ -20,6 +20,7 @@ do
done
IFS="$save_ifs"
+rm -rf configure
aclocal || die "Can't execute aclocal"
autoheader || die "Can't execute autoheader"
# --force means overwrite ltmain.sh script if it already exists
@@ -29,3 +30,9 @@ $LIBTOOLIZE --automake --force --copy || die "Can't execute libtoolize"
# and --force to overwrite them if they already exist
automake --add-missing --force --copy || die "Can't execute automake"
autoconf || die "Can't execute autoconf"
+# Do not use autotools generated configure directly. Instead, use a script
+# that will either call CMake or original configure shell script at build
+# time (CMake is preferred if installed).
+mv configure configure.am
+cp BUILD/choose_configure.sh configure
+chmod a+x configure
diff --git a/BUILD/choose_configure.sh b/BUILD/choose_configure.sh
new file mode 100644
index 00000000000..71243ea09b6
--- /dev/null
+++ b/BUILD/choose_configure.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+# Choose whether to use autoconf created configure
+# of perl script that calls cmake.
+
+# Ensure cmake and perl are there
+cmake -P cmake/check_minimal_version.cmake >/dev/null 2>&1 || HAVE_CMAKE=no
+perl --version >/dev/null 2>&1 || HAVE_CMAKE=no
+if test "$HAVE_CMAKE" = "no"
+then
+ sh ./configure.am $@
+else
+ perl ./cmake/configure.pl $@
+fi
+