configure: add --enable-external-build support
First attempt at avoiding all the compile-time environment detection for
cases where you can generate the environments statically, as when the
real build is being performed by another build system.
Change-Id: Ie3cf95d71d6c5169900f31e263b84bc123cdf73f
diff --git a/build/make/configure.sh b/build/make/configure.sh
index d9b0fe7..e19efb0 100755
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -277,6 +277,7 @@
# Toolchain Check Functions
#
check_cmd() {
+ enabled external_build && return
log "$@"
"$@" >>${logfile} 2>&1
}
@@ -1175,9 +1176,6 @@
;;
esac
- # for sysconf(3) and friends.
- check_header unistd.h
-
# glibc needs these
if enabled linux; then
add_cflags -D_LARGEFILE_SOURCE
diff --git a/configure b/configure
index d1d25b3..7d57d8c 100755
--- a/configure
+++ b/configure
@@ -298,6 +298,7 @@
${EXPERIMENT_LIST}
"
CMDLINE_SELECT="
+ external_build
extra_warnings
werror
install_docs
@@ -497,7 +498,7 @@
fi
fi
fi
- if [ -z "$CC" ]; then
+ if [ -z "$CC" ] || enabled external_build; then
echo "Bypassing toolchain for environment detection."
enable external_build
check_header() {
@@ -506,6 +507,7 @@
shift
var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
disable $var
+ # Headers common to all environments
case $header in
stdio.h)
true;
@@ -517,6 +519,25 @@
done
${result:-true}
esac && enable $var
+
+ # Specialize windows and POSIX environments.
+ case $toolchain in
+ *-win*-*)
+ case $header-$toolchain in
+ stdint*-gcc) true;;
+ *) false;;
+ esac && enable $var
+ ;;
+ *)
+ case $header in
+ stdint.h) true;;
+ pthread.h) true;;
+ sys/mman.h) true;;
+ unistd.h) true;;
+ *) false;;
+ esac && enable $var
+ esac
+ enabled $var
}
check_ld() {
true
@@ -530,6 +551,7 @@
check_header stdint.h
check_header pthread.h
check_header sys/mman.h
+ check_header unistd.h # for sysconf(3) and friends.
check_header vpx/vpx_integer.h -I${source_path} && enable vpx_ports
}