forked from RIPE-NCC/ripe-atlas-software-probe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
174 lines (145 loc) · 6.24 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
AC_PREREQ([2.68])
AC_INIT([ripe-atlas], [m4_esyscmd_s([cat VERSION])], [[email protected]])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
AM_SILENT_RULES([yes])
# use the following arguments for '--with-probe-type' flag
# v3: openwrt-atlas-probev3
# v4: openwrt-atlas-probev4
# v5: openwrt-atlas-probev5
# centos: centos-rpm-<PACKAGE_NAME>-<PACKAGE_VERSION>-<PACKAGE_RELEASE> (ie. centos-rpm-ripe-atlas-probe-5090-1.el7)
# debian: debian-<PACKAGE_NAME>-<VERSION> (ie. debian-ripe-atlas-probe-5090)
AC_ARG_WITH([probe-type], [AS_HELP_STRING([--with-probe-type], [define which probe flavour should be built (v3,v4,v5)])], [], [with_probe_type=no])
probe_type=${with_probe_type}
AC_SUBST(probe_type)
AS_CASE([$probe_type],
[*openwrt*], [probe_scripts_path=$probe_type],
[probe_scripts_path=generic])
AC_SUBST(probe_scripts_path)
AM_CONDITIONAL([PROBE_TYPE_V3], [test "x${probe_type}" = 'xopenwrt-atlas-probev3'])
AM_CONDITIONAL([PROBE_TYPE_V4], [test "x${probe_type}" = 'xopenwrt-atlas-probev4'])
AM_CONDITIONAL([PROBE_TYPE_V5], [test "x${probe_type}" = 'xopenwrt-atlas-probev5'])
AC_ARG_ENABLE([chown],
[AS_HELP_STRING([--enable-chown], [set permissions during install @<:@default=yes@:>@])],
[case "${enableval}" in
yes) do_chown=true ;;
no) do_chown=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-chown]) ;;
esac],[do_chown=true])
AM_CONDITIONAL([DO_CHOWN], [test "x${do_chown}" = 'xtrue'])
if test "x${do_chown}" != 'xtrue'; then
AC_MSG_WARN([Disabling chown may prevent the probe from running as a non-privileged user])
fi
ripe_atlas_user=
ripe_atlas_group=
ripe_atlas_measurement=
AC_ARG_WITH([user], [AS_HELP_STRING([--with-user], [run main process as username @<:@default=ripe-atlas@:>@])], [ripe_atlas_user="${withval}"], [])
AC_ARG_WITH([measurement-user], [AS_HELP_STRING([--with-measurement-user], [run measurement processes as username @<:@default=--with-user@:>@])], [ripe_atlas_measurement="${withval}"], [])
AC_ARG_WITH([group], [AS_HELP_STRING([--with-group], [run group @<:@default=ripe-atlas@:>@])], [ripe_atlas_group="${withval}"], [])
if test -z "${ripe_atlas_user}"; then
ripe_atlas_user='ripe-atlas'
fi
if ! grep -qE "^${ripe_atlas_user}:" /etc/passwd; then
AC_MSG_WARN([User ${ripe_atlas_user} doesn't seem to exist, installation may fail])
fi
if test -z "${ripe_atlas_group}"; then
ripe_atlas_group='ripe-atlas'
fi
if ! grep -qE "^${ripe_atlas_group}:" /etc/group; then
AC_MSG_WARN([Group ${ripe_atlas_group} doesn't seem to exist, installation may fail])
fi
if test -z "${ripe_atlas_measurement}"; then
ripe_atlas_measurement="${ripe_atlas_user}"
fi
if ! grep -qE "^${ripe_atlas_measurement}:" /etc/passwd; then
AC_MSG_WARN([User ${ripe_atlas_measurement} doesn't seem to exist, installation may fail])
fi
AM_CONDITIONAL(SINGLE_USER, [test "${ripe_atlas_measurement}" = "${ripe_atlas_user}"])
AC_SUBST(ripe_atlas_user)
AC_SUBST(ripe_atlas_group)
AC_SUBST(ripe_atlas_measurement)
# use the following arguments for the '--with-install-mode' flag
# common: common, non-probe specific
# probe: (software) probe
# anchor
AC_ARG_WITH([install-mode], [AS_HELP_STRING([--with-install-mode], [define the purpose of the probe (probe,anchor,common)])], [], [with_install_mode=probe])
AM_CONDITIONAL([INSTALL_MODE_probe], [test "x${with_install_mode}" = 'xprobe'])
AM_CONDITIONAL([INSTALL_MODE_anchor], [test "x${with_install_mode}" = 'xanchor'])
AC_PATH_PROG(SETCAP, setcap)
AC_ARG_ENABLE([setcap-install], [AC_HELP_STRING([--enable-setcap-install], [install measurements with cap_net_raw @<:@default=yes@:>@])], [enable_setcap_install="${enableval}"],[enable_setcap_install=yes])
AC_MSG_CHECKING([whether to install measurements with cap_net_raw capabilities])
if test "x${enable_setcap_install}" = 'xno'; then
AC_MSG_RESULT([no])
AC_MSG_WARN([Disabling setcap installation may prevent the probe from running as a non-privileged user])
else
if test "x${SETCAP}" = 'x'; then
AC_MSG_RESULT([no. 'setcap' not found])
else
AC_MSG_RESULT([yes])
fi
fi
AM_CONDITIONAL(SETCAP_INSTALL, [test "x${enable_setcap_install}" = 'xyes'])
AC_PATH_PROG(SYSTEMDPATH, systemd-path)
AC_ARG_ENABLE([systemd], [AC_HELP_STRING([--enable-systemd], [install files for systemd @<:@default=yes@:>@])], [enable_systemd="${enableval}"],[enable_systemd=yes])
AC_MSG_CHECKING([whether to install systemd support files])
systemd_tmpfilesdir=
systemd_unitsdir=
systemd_sysusersdir=
if test "x${enable_systemd}" = 'xno'; then
AC_MSG_RESULT([no])
else
if test "x${SYSTEMDPATH}" != 'x'; then
AC_MSG_RESULT([yes])
systemd_tmpfilesdir=$(${SYSTEMDPATH} tmpfiles 2>/dev/null)
if test "x${systemd_tmpfilesdir}" = "x"; then
systemd_tmpfilesdir=$(${SYSTEMDPATH} --suffix=tmpfiles.d system-library-private 2>/dev/null)
fi
systemd_unitsdir=$(${SYSTEMDPATH} systemd-system-unit 2>/dev/null)
if test "x${systemd_unitsdir}" = "x"; then
systemd_unitsdir=$(${SYSTEMDPATH} --suffix=systemd/system system-library-private 2>/dev/null)
fi
systemd_sysusersdir=$(${SYSTEMDPATH} sysusers 2>/dev/null)
if test "x${systemd_sysusersdir}" = "x"; then
systemd_sysusersdir=$(${SYSTEMDPATH} --suffix=sysusers.d system-library-private 2>/dev/null)
fi
else
AC_MSG_RESULT([no. 'systemd-path' not found])
fi
fi
AM_CONDITIONAL(SYSTEMD_INSTALL, [test "x${SYSTEMDPATH}" != 'x' -a "x${enable_systemd}" = 'xyes'])
AC_SUBST(systemd_tmpfilesdir)
AC_SUBST(systemd_unitsdir)
AC_SUBST(systemd_sysusersdir)
# system paths
atlas_libexecdir="\${libexecdir}/ripe-atlas"
atlas_datadir="\${datadir}/ripe-atlas"
atlas_measurementdir="${atlas_libexecdir}/measurement"
atlas_rundir="\${runstatedir}/ripe-atlas"
atlas_scriptsdir="${atlas_libexecdir}/scripts"
atlas_spooldir="\${localstatedir}/spool/ripe-atlas"
atlas_sysconfdir="\${sysconfdir}/ripe-atlas"
# Compatibility fix for EL8
if test "x${runstatedir}" = "x"; then
atlas_rundir="\${localstatedir}/run/ripe-atlas"
fi
storage_sysconfdir=/storage/etc
tmpdir=/tmp
AC_SUBST(storage_sysconfdir)
AC_SUBST(tmpdir)
AC_SUBST(atlas_libexecdir)
AC_SUBST(atlas_datadir)
AC_SUBST(atlas_measurementdir)
AC_SUBST(atlas_rundir)
AC_SUBST(atlas_scriptsdir)
AC_SUBST(atlas_sysconfdir)
AC_SUBST(atlas_spooldir)
AC_PROG_LIBTOOL
AC_PROG_CC
AC_CONFIG_FILES([
Makefile
config/Makefile
bin/Makefile
])
AC_CONFIG_SUBDIRS([probe-busybox/libevent-2.1.11-stable])
AC_OUTPUT