forked from cfengine/masterfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
255 lines (210 loc) · 7.47 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
dnl ##########################################################################
dnl #
dnl # Build CFEngine
dnl #
dnl # Run ./autogen.sh to build configure script
dnl #
dnl ##########################################################################
AC_PREREQ(2.63)
m4_define([cfversion_from_env], m4_normalize(m4_esyscmd([echo $EXPLICIT_VERSION])))
m4_define([cfversion_from_file], m4_normalize(m4_esyscmd([cat CFVERSION])))
m4_ifval(cfversion_from_env, [
m4_define([cfversion], cfversion_from_env)
], [
m4_ifval(cfversion_from_file, [
m4_define([cfversion], cfversion_from_file)
], [
m4_fatal([Could not determine CFEngine version;
please set EXPLICIT_VERSION in the environment,
or make sure all git tags are up to date and rerun autogen.sh])
])
])
AC_INIT([cfengine-masterfiles], cfversion)
cfengine_version=cfversion
m4_undefine([cfversion])
m4_undefine([cfversion_from_file])
m4_undefine([cfversion_from_env])
m4_define([cfrelease], m4_normalize(m4_esyscmd([cat CFRELEASE])))
AC_SUBST([RELEASE], [cfrelease])
cfengine_release=cfrelease
m4_undefine([cfrelease])
AC_CANONICAL_TARGET
_AM_SET_OPTION([tar-ustar])
AM_INIT_AUTOMAKE([foreign])
AM_MAINTAINER_MODE([enable])
AC_DEFINE_UNQUOTED(ABS_TOP_SRCDIR,
"`cd -- "$srcdir"; pwd`",
[Absolute path of source tree])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
dnl Libtool madness
AC_CONFIG_MACRO_DIR([m4])
dnl
dnl hide [s]include macros, so old aclocal (automake < 1.10) won't find them and
dnl won't complain about something/something.m4 not found
dnl
m4_define(incstart,sinc)
m4_define(incend,lude)
AC_PROG_MKDIR_P
AC_PROG_INSTALL
dnl ######################################################################
dnl Figure out core and enterprise directory.
dnl ######################################################################
AC_ARG_WITH(core,
AS_HELP_STRING(--with-core=<core>,
[Build against core in directory <core>. Defaults to "../core". \
If not found there or if --with-core=no then tests are disabled]
),
AS_IF(test "x$with_core" == "xno",
[
core_dir=
],
[
dnl The user passed --with-core=path but we must check if it's a
dnl valid core directory.
AS_IF(test -d "$with_core/libpromises",
[
core_dir="$with_core"
],
[
AC_MSG_ERROR([$with_core is not a valid core directory (--with-core=$with_core)])
])
]),
dnl If --with-core was not passed at all, then default to ../core
dnl only if that is a valid core directory.
[if test -d `pwd`/../core/libpromises
then
core_dir="`pwd`/../core"
else
core_dir=
fi]
)
dnl export HAVE_CORE for makefiles
AM_CONDITIONAL(HAVE_CORE, test "x$core_dir" != x)
dnl Transform the path from relative to absolute
AS_IF(test "x$core_dir" != x,
[
AS_CASE([$core_dir], [/*], [],
[core_dir=`pwd`/$core_dir])
]
)
AC_SUBST([core_dir])
AC_ARG_WITH(enterprise,
AS_HELP_STRING(--with-enterprise=<enterprise>,
[Build against enterprise in directory <enterprise>. \
Defaults to "../enterprise"]
),
AS_IF(test "x$with_enterprise" == "xno",
[
enterprise_dir=
],
[
enterprise_dir=$with_enterprise
]),
enterprise_dir=`pwd`/../enterprise
)
AS_CASE([$enterprise_dir], [/*], [], [enterprise_dir=`pwd`/$enterprise_dir])
AM_CONDITIONAL([HAVE_ENTERPRISE], [test -d "$enterprise_dir/libcfenterprise"])
AC_SUBST([enterprise_dir])
dnl ######################################################################
dnl Set prefix to correct directory.
dnl ######################################################################
AS_IF([test x"$prefix" = xNONE],
prefix=/var/cfengine
)
bindir="${bindir:-${exec_prefix}/bin}"
dnl Expand ${prefix} and whatnot in bindir
adl_RECURSIVE_EVAL("${bindir}", bindir)
AC_SUBST(bindir, "${bindir}")
dnl ######################################################################
dnl OS specific stuff
dnl ######################################################################
m4_include([m4/cf3_platforms.m4])
AC_CHECK_PROG([ac_cv_pkg_install], [pkg_install], [yes], [no])
AC_CHECK_PROG([ac_cv_shunit2], [shunit2], [yes], [no])
AM_CONDITIONAL([HAVE_PKG_INSTALL], [test "$ac_cv_pkg_install" = "yes"])
AM_CONDITIONAL([HAVE_SHUNIT2], [test "$ac_cv_shunit2" = "yes"])
dnl ######################################################################
dnl Print summary
dnl ######################################################################
AC_MSG_RESULT()
AC_MSG_RESULT(Summary:)
AC_MSG_RESULT(Version -> $cfengine_version)
AC_MSG_RESULT(Release -> $cfengine_release)
AM_COND_IF(HAVE_CORE,
AC_MSG_RESULT(Core directory -> $core_dir),
AC_MSG_RESULT(Core directory -> not set - tests are disabled)
)
AM_COND_IF(HAVE_ENTERPRISE,
AC_MSG_RESULT(Enterprise directory -> $enterprise_dir),
AC_MSG_RESULT(Enterprise directory -> not set - some tests are disabled)
)
AC_MSG_RESULT(Install prefix -> $prefix)
AC_MSG_RESULT(bindir -> $bindir)
AC_MSG_RESULT()
dnl ######################################################################
dnl Generate install target list.
dnl ######################################################################
AC_MSG_NOTICE([generating makefile targets])
# Do not try to unroll these for loops by putting the find commands directly in
# the assignments, it will overflow on the Solaris and HP-UX shells.
MASTERFILES_TESTS=''
for i in `cd "$srcdir/tests/acceptance/" && find . -name '*.cf*'`
do
MASTERFILES_TESTS="$MASTERFILES_TESTS $i"
done
AC_SUBST(MASTERFILES_TESTS)
MASTERFILES_INSTALL_TARGETS=
for j in `echo $srcdir/*.cf`
do
# Only add those that don't have a corresponding .in file.
# They will be added later.
if ! test -f "$j.in"
then
MASTERFILES_INSTALL_TARGETS="$MASTERFILES_INSTALL_TARGETS $j"
fi
done
for j in `echo $srcdir/*.cf.in`
do
# Add .in files, but without the .in suffix.
MASTERFILES_INSTALL_TARGETS="$MASTERFILES_INSTALL_TARGETS `echo $j | sed -e 's/\.in$//'`"
done
for i in cfe_internal controls inventory lib services
do
for j in `find "$srcdir/$i" -name '*.cf'`
do
# Only add those that don't have a corresponding .in file.
# They will be added later.
if ! test -f "$j.in"
then
MASTERFILES_INSTALL_TARGETS="$MASTERFILES_INSTALL_TARGETS $j"
fi
done
for j in `find "$srcdir/$i" -name '*.cf.in'`
do
# Add .in files, but without the .in suffix.
MASTERFILES_INSTALL_TARGETS="$MASTERFILES_INSTALL_TARGETS `echo $j | sed -e 's/\.in$//'`"
done
done
for i in templates cfe_internal modules/packages/vendored lib/templates
do
for j in `find "$srcdir/$i" -name '*.mustache' -o -name '*.sh' -o -name '*.awk' -o -name '*.sed' -o -name '*.ps1' -o -name '*.py'`
do
MASTERFILES_INSTALL_TARGETS="$MASTERFILES_INSTALL_TARGETS $j"
done
done
AC_SUBST(MASTERFILES_INSTALL_TARGETS)
dnl ######################################################################
dnl Now make the Makefiles
dnl ######################################################################
AC_CONFIG_FILES([Makefile
controls/update_def.cf
promises.cf
standalone_self_upgrade.cf
tests/Makefile
tests/acceptance/Makefile
tests/unit/Makefile
])
AC_OUTPUT
AC_MSG_RESULT()
AC_MSG_RESULT(DONE: Configuration done. Run "make install" to install CFEngine Masterfiles.)
AC_MSG_RESULT()