This repository was archived by the owner on Mar 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac-exec.m4
73 lines (61 loc) · 2.18 KB
/
configure.ac-exec.m4
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
if test -z "$GITOPS_ENV_PATH"; then
AC_MSG_ERROR([
The environment variable 'GITOPS_ENV_PATH' is not set. This is a
programming error of the program, contact the program's maintainer.
])
fi
# AUTOCMD()
# --------------------------------------
AC_DEFUN([AUTOCMD], [
cmd=$1
AC_MSG_NOTICE([executing $cmd...])
$cmd
command_status=$?
#TODO: there must be a better way to print the message just like a usual check
if test $command_status -eq 0; then
AC_MSG_RESULT([checking for ./configure exit code... 0 (success)])
else
AC_MSG_RESULT([checking for ./configure exit code... $command_status (failure)])
if test $command_status -ne 123; then
AC_MSG_NOTICE([executing automake --add-missing...])
automake --add-missing
AC_MSG_NOTICE([retrying $cmd...])
$cmd
command_status=$?
#TODO: there must be a better way to print the message just like a usual check
if test $command_status -eq 0; then
AC_MSG_RESULT([checking for ./configure exit code... 0 (success)])
else
AC_MSG_RESULT([checking for ./configure exit code... 1 (failure)])
MY_MSG_ERROR([panic: giving up...])
fi
else
MY_MSG_ERROR([panic: giving up...])
fi
fi
])
AC_ARG_WITH([gitops-env],
[AS_HELP_STRING([--with-gitops-env],
[keep GitOps data after configuration @<:@default=no@:>@])],
[ARG_GITOPS_ENV='yes'],
[ARG_GITOPS_ENV='no'])
AUTOCMD(["./configure"])
AC_MSG_CHECKING([for $GITOPS_ENV_PATH])
if test -f $GITOPS_ENV_PATH; then
AC_MSG_RESULT([found])
AC_MSG_NOTICE([sourcing properties from $GITOPS_ENV_PATH...])
. ./$GITOPS_ENV_PATH
AC_MSG_CHECKING([if configuration data should be kept...])
if test "$ARG_GITOPS_ENV" '!=' 'yes'; then
AC_MSG_RESULT([no])
rm -v $GITOPS_ENV_PATH
else
AC_MSG_RESULT([yes])
fi
else
AC_MSG_RESULT([no])
MY_MSG_ERROR([
Bad news! If this error happened, there's probably something wrong with
how your configure.ac was patched.
])
fi