|
1 |
| -#! /bin/sh |
| 1 | +#!/bin/sh |
| 2 | +# |
2 | 3 | # +----------------------------------------------------------------------+
|
3 | 4 | # | PHP Version 7 |
|
4 | 5 | # +----------------------------------------------------------------------+
|
|
15 | 16 | # | Authors: Stig Bakken <[email protected]> |
|
16 | 17 | # | Sascha Schumann <[email protected]> |
|
17 | 18 | # +----------------------------------------------------------------------+
|
| 19 | +# |
| 20 | +# Check PHP build system tools such as autoconf and their versions. |
| 21 | +# |
| 22 | +# SYNOPSIS: |
| 23 | +# buildcheck.sh [stampfile] |
| 24 | +# |
| 25 | +# DESCRIPTION: |
| 26 | +# Optional stampfile is for Makefile to check build system only once. |
| 27 | +# |
| 28 | +# ENVIRONMENT: |
| 29 | +# The following optional variables are supported: |
| 30 | +# |
| 31 | +# PHP_AUTOCONF Overrides the path to autoconf tool. |
| 32 | +# PHP_AUTOCONF=/path/to/autoconf buildcheck.sh |
18 | 33 |
|
19 | 34 | echo "buildconf: checking installation..."
|
20 | 35 |
|
21 | 36 | stamp=$1
|
22 | 37 |
|
23 | 38 | # Allow the autoconf executable to be overridden by $PHP_AUTOCONF.
|
24 |
| -if test -z "$PHP_AUTOCONF"; then |
25 |
| - PHP_AUTOCONF='autoconf' |
26 |
| -fi |
| 39 | +PHP_AUTOCONF=${PHP_AUTOCONF:-autoconf} |
| 40 | + |
| 41 | +# Go to project root. |
| 42 | +cd $(CDPATH= cd -- "$(dirname -- "$0")/../" && pwd -P) |
| 43 | + |
| 44 | +# Get minimum required autoconf version from the configure.ac file. |
| 45 | +min_version=$(sed -n 's/AC_PREREQ(\[\(.*\)\])/\1/p' configure.ac) |
| 46 | + |
| 47 | +# Check if autoconf exists. |
| 48 | +ac_version=$($PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//') |
27 | 49 |
|
28 |
| -# autoconf 2.68 or newer |
29 |
| -ac_version=`$PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` |
30 | 50 | if test -z "$ac_version"; then
|
31 |
| -echo "buildconf: autoconf not found." >&2 |
32 |
| -echo " You need autoconf version 2.68 or newer installed" >&2 |
33 |
| -echo " to build PHP from Git." >&2 |
34 |
| -exit 1 |
| 51 | + echo "buildconf: autoconf not found." >&2 |
| 52 | + echo " You need autoconf version $min_version or newer installed" >&2 |
| 53 | + echo " to build PHP from Git." >&2 |
| 54 | + exit 1 |
35 | 55 | fi
|
36 |
| -IFS=.; set $ac_version; IFS=' ' |
37 |
| -if test "$1" = "2" -a "$2" -lt "68" || test "$1" -lt "2"; then |
38 |
| -echo "buildconf: autoconf version $ac_version found." >&2 |
39 |
| -echo " You need autoconf version 2.68 or newer installed" >&2 |
40 |
| -echo " to build PHP from Git." >&2 |
41 |
| -exit 1 |
| 56 | + |
| 57 | +# Check autoconf version. |
| 58 | +set -f; IFS='.'; set -- $ac_version; set +f; IFS=' ' |
| 59 | +ac_version_num="$(expr ${1} \* 10000 + ${2} \* 100)" |
| 60 | +set -f; IFS='.'; set -- $min_version; set +f; IFS=' ' |
| 61 | +min_version_num="$(expr ${1} \* 10000 + ${2} \* 100)" |
| 62 | + |
| 63 | +if test "$ac_version_num" -lt "$min_version_num"; then |
| 64 | + echo "buildconf: autoconf version $ac_version found." >&2 |
| 65 | + echo " You need autoconf version $min_version or newer installed" >&2 |
| 66 | + echo " to build PHP from Git." >&2 |
| 67 | + exit 1 |
42 | 68 | else
|
43 |
| -echo "buildconf: autoconf version $ac_version (ok)" |
| 69 | + echo "buildconf: autoconf version $ac_version (ok)" |
44 | 70 | fi
|
45 | 71 |
|
46 | 72 | test -n "$stamp" && touch $stamp
|
47 |
| - |
48 |
| -exit 0 |
|
0 commit comments