-
Notifications
You must be signed in to change notification settings - Fork 13
/
configure.ac
77 lines (60 loc) · 2.64 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
AC_INIT([terraform-examples], [0.1])
dependencies="
------------------------------------------------------------------------
Please install next dependencies before using terraform-examples:
make: ........................ > 3.x.x
sed: ......................... > 4.x.x
terraform: ................... > 0.14.x
jq: .......................... > 1.x
findutils: ................... > 4.x.x
coreutils: ................... > 8.x.x
------------------------------------------------------------------------
"
AC_PROG_SED
AC_PROG_AWK
AC_CHECK_PROG(MAKE,make,make)
if test x$MAKE = "x" ; then
AC_MSG_ERROR("${dependencies}Make is required to run examples.")
fi
make_version=$(make --version | head -n 1 | cut -d' ' -f 3)
make_maj_version=$(echo $make_version | awk -F. '$1 > 2 {print $1}')
if test x$make_maj_version = "x" ; then
AC_MSG_ERROR("${dependencies}Only 3.x.x versions of make are upported.")
fi
AC_CHECK_PROG(TERRAFORM,terraform,terraform)
if test x$TERRAFORM = "x" ; then
AC_MSG_ERROR("${dependencies}terraform is required to run examples.")
fi
terraform_version=$(terraform -version | awk '{print $2}' | head -n 1 | cut -c2-)
terraform_version_determination=$(echo $terraform_version | awk -F. '$2 > 0 && $1 > 0 || $1 == 0 && $2 > 13 {print $2}')
if test x$terraform_version_determination = "x" ; then
AC_MSG_ERROR("Only 0.14.x and newer terraform versions are supported. Current version is ${terraform_version}")
fi
AC_CHECK_PROG(FIND,find,find)
if test x$FIND = "x" ; then
AC_MSG_ERROR("{dependencies}find is required to run examples.")
fi
find_version=$(find --version | head -n 1 | awk '{print $4}')
xargs_version=$(xargs --version | head -n 1 | awk '{print $4}')
AC_CHECK_PROG(JQ,jq,jq)
if test x$JQ = "x" ; then
AC_MSG_ERROR("${dependencies}jq is required to run examples.")
fi
jq_version=$(jq --version | awk -F- '{print $2}')
AC_MSG_RESULT([
------------------------------------------------------------------------
$PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
General configuration:
Make version: .................. ${make_version}
Terraform version: ............. ${terraform_version}
JQ version: ................... ${jq_version}
Find version: .................. ${find_version}
Xargs version: ................. ${xargs_version}
------------------------------------------------------------------------
])
AC_CHECK_FILE(terraform.tfvars,[],AC_MSG_ERROR("terraform.tfvars file is required"))
AC_CONFIG_TESTDIR([tests])
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
echo "Type \"make\" to init terraform provider";
echo "Type \"make check\" to run all examples";
AC_OUTPUT