forked from clearlinux/micro-config-drive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
170 lines (145 loc) · 6.33 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([micro-config-drive],[45],[[email protected]])
AM_INIT_AUTOMAKE([foreign -Wall -Wno-portability silent-rules subdir-objects color-tests no-dist-gzip dist-xz])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_FILES([Makefile
tests/Makefile
data/ucd.service
data/ucd-aws.service
data/ucd-oci.service
data/ucd-tencent.service
data/ucd-aliyun.service])
AC_CONFIG_HEADERS([config.h])
LT_INIT
AC_CONFIG_MACRO_DIR([m4])
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_MKDIR_P
# Add definitions
AC_DEFINE_UNQUOTED([SYSCONFDIR], ["$sysconfdir"], [Path to system configuration directory])
# Add options
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debug mode @<:@default=no@:>@]),
[], [enable_debug=no])
AS_IF([test "x$enable_debug" = "xyes"],
[AC_DEFINE([DEBUG], [1], [Debugging mode enabled])],
[AC_DEFINE([NDEBUG], [1], [Debugging and assertions disabled])])
AM_CONDITIONAL([DEBUG], [test x$enable_debug = x"yes"])
# Enable -Werror for harder flags.
AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror], [enable Werror @<:@default=no@:>@]),
[], [enable_werror=no])
AM_CONDITIONAL([ENABLE_WERROR], [test x$enable_werror = x"yes"])
AC_ARG_ENABLE(tests, AS_HELP_STRING([--disable-tests], [do not build unit tests @<:@default=no@:>@]),
[], [disable_tests=no])
AS_IF([test x"$disable_tests" = "xno"],
[AC_SUBST([BUILD_TESTS], [1])],
[AC_SUBST([BUILD_TESTS], [0])])
AM_CONDITIONAL([BUILD_TESTS], [test x$disable_tests = x"no"])
# Checks for libraries.
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.24.1])
PKG_CHECK_MODULES([YAML], [yaml-0.1 >= 0.1.4])
PKG_CHECK_MODULES([JSON_GLIB], [json-glib-1.0])
PKG_CHECK_MODULES([PARTED], [libparted >= 3.1])
PKG_CHECK_MODULES([BLKID], [blkid >= 2.25.0])
AS_IF([test $BUILD_TESTS = 1],
[PKG_CHECK_MODULES([CHECK], [check >= 0.9.14])]
)
# Checks for header files.
AC_CHECK_HEADERS([errno.h])
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_HEADERS([glib.h])
AC_CHECK_HEADERS([stdarg.h])
AC_CHECK_HEADERS([stdbool.h])
AC_CHECK_HEADERS([stdio.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([libgen.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
# Checks for commands
AC_PATH_PROG([RESIZE2FS], [resize2fs], [no], [$PATH:/sbin:/usr/sbin])
if test x"$RESIZE2FS" == x"no" ; then
AC_MSG_ERROR([Please install resize2fs.])
fi
AC_SUBST(RESIZE2FS)
AC_DEFINE_UNQUOTED([RESIZEFS_PATH], ["$RESIZE2FS"], [Path to resize2fs binary])
AC_PATH_PROG([SHELL], [sh], [no], [$PATH:/sbin:/usr/sbin])
if test x"$SHELL" == x"no" ; then
AC_MSG_ERROR([Please install sh.])
fi
AC_SUBST(SHELL)
AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL"], [Path to sh binary])
AC_PATH_PROG([HOSTNAMECTL], [hostnamectl], [no], [$PATH:/sbin:/usr/sbin])
if test x"$HOSTNAMECTL" == x"no" ; then
AC_MSG_ERROR([Please install hostnamectl.])
fi
AC_SUBST(HOSTNAMECTL)
AC_DEFINE_UNQUOTED([HOSTNAMECTL_PATH], ["$HOSTNAMECTL"], [Path to hostnamectl binary])
AC_PATH_PROG([SYSTEMCTL], [systemctl], [no], [$PATH:/sbin:/usr/sbin])
if test x"$SYSTEMCTL" == x"no" ; then
AC_MSG_ERROR([Please install systemctl.])
fi
AC_SUBST(SYSTEMCTL)
AC_DEFINE_UNQUOTED([SYSTEMCTL_PATH], ["$SYSTEMCTL"], [Path to systemctl binary])
AC_PATH_PROG([PASSWD], [passwd], [no], [$PATH:/sbin:/usr/sbin])
if test x"$PASSWD" == x"no" ; then
AC_MSG_ERROR([Please install passwd.])
fi
AC_SUBST(PASSWD)
AC_DEFINE_UNQUOTED([PASSWD_PATH], ["$PASSWD"], [Path to passwd binary])
AC_PATH_PROG([GROUPADD], [groupadd], [/usr/sbin/groupadd], [$PATH:/sbin:/usr/sbin])
if ! test -f "$GROUPADD" ; then
AC_MSG_ERROR([Please install groupadd.])
fi
AC_SUBST(GROUPADD)
AC_DEFINE_UNQUOTED([GROUPADD_PATH], ["$GROUPADD"], [Path to groupadd binary])
AC_PATH_PROG([USERMOD], [usermod], [/usr/sbin/usermod], [$PATH:/sbin:/usr/sbin])
if ! test -f "$USERMOD" ; then
AC_MSG_ERROR([Please install usermod.])
fi
AC_SUBST(USERMOD)
AC_DEFINE_UNQUOTED([USERMOD_PATH], ["$USERMOD"], [Path to usermod binary])
AC_PATH_PROG([USERADD], [useradd], [/usr/sbin/useradd], [$PATH:/sbin:/usr/sbin])
if ! test -f "$USERADD" ; then
AC_MSG_ERROR([Please install useradd.])
fi
AC_SUBST(USERADD)
AC_DEFINE_UNQUOTED([USERADD_PATH], ["$USERADD"], [Path to useradd binary])
# Options
AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
[path to systemd system service directory]), [path_systemdsystemunit=${withval}],
[path_systemdsystemunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
SYSTEMD_SYSTEMUNITDIR="${path_systemdsystemunit}"
AC_SUBST(SYSTEMD_SYSTEMUNITDIR)
AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdsystemunit}")
AC_ARG_WITH([datadir],[AC_HELP_STRING([--with-datadir=DIR],
[Default data directory (/var/lib/cloud)])], [datadir=${withval}],[datadir=/var/lib/cloud])
AC_SUBST([DATADIR], ["${datadir}"], [Default data directory])
AC_DEFINE_UNQUOTED([DATADIR_PATH], ["$DATADIR"], [Default data directory])
AC_ARG_WITH([packagemgr],[AS_HELP_STRING([--with-packagemgr=PKGMGR],[Default package manager (swupd|yum|dnf|tdnf|apt)])], [packagemgr=${withval}],[packagemgr=swupd])
AC_SUBST([PKGMGR], ["${packagemgr}"], [Default package manager])
if test "x$PKGMGR" = "xswupd" ; then
AC_DEFINE([PACKAGE_MANAGER_SWUPD], [1], [Define if swupd package manager selected])
elif test "x$PKGMGR" = "xyum" ; then
AC_DEFINE([PACKAGE_MANAGER_YUM], [1], [Define if yum package manager selected])
elif test "x$PKGMGR" = "xdnf" ; then
AC_DEFINE([PACKAGE_MANAGER_DNF], [1], [Define if dnf package manager selected])
elif test "x$PKGMGR" = "xtdnf" ; then
AC_DEFINE([PACKAGE_MANAGER_TDNF], [1], [Define if tdnf package manager selected])
elif test "x$PKGMGR" = "xapt" ; then
AC_DEFINE([PACKAGE_MANAGER_APT], [1], [Define if apt package manager selected])
else
AC_MSG_ERROR([Please provide a valid package manager (swupd, yum, dnf, tdnf, or apt).])
fi
AC_ARG_WITH([dnstestaddr],[AC_HELP_STRING([--with-dnstestaddr=hostname],
[Default DNS test host name (0.clearlinux.pool.ntp.org)])], [dnstestaddr=${withval}],
[dnstestaddr=0.clearlinux.pool.ntp.org])
AC_SUBST([DNSTESTADDR], ["$dnstestaddr"], [Default DNS test host name])
AC_DEFINE_UNQUOTED([DNSTESTADDR], ["$DNSTESTADDR"], [Default DNS test host name])
# Checks for library functions.
AC_OUTPUT