forked from nandhp/multiload-nandhp
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathconfigure.ac
243 lines (208 loc) · 7.25 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
# Initialization
AC_PREREQ(2.60)
AC_INIT([multiload-ng], [m4_esyscmd([cat version])], [[email protected]])
AC_SUBST(APPICON, utilities-system-monitor)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-dist-gzip dist-xz silent-rules foreign])
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE()
# Set starting CFLAGS (instead of default "-g -O2")
: ${CFLAGS="-g -O3"}
# Checks for programs.
AM_PROG_AR()
LT_PREREQ([2.2.6])
LT_INIT([disable-static])
AC_PROG_CC()
# Compiling sources with per-target flags requires AM_PROG_CC_C_O
AM_PROG_CC_C_O()
AC_PROG_LD()
AC_PROG_INSTALL()
AC_PROG_LIBTOOL()
AC_PROG_INTLTOOL(, [no-xml])
# Check for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([time.h glib.h math.h dirent.h mntent.h ctype.h stdio.h errno.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
# Test CFLAGS
AC_DEFUN([TEST_CFLAGS],
AC_MSG_CHECKING([whether compiler understands $1])
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_TRY_COMPILE([],[], AC_MSG_RESULT(yes), AC_MSG_RESULT(no); CFLAGS="$old_CFLAGS")
)
TEST_CFLAGS([-Wall])
# GCC-specific CFLAGS (uncomment when needed)
# Runtime diagnostics (use with caution, breaks some plugins)
#CFLAGS="${CFLAGS} -fdiagnostics-color=auto -fsanitize=address -fsanitize=leak -fsanitize=undefined"
# Build-time error checking
#CFLAGS="${CFLAGS} -Wextra -Wpedantic -std=gnu99 -Wno-unused-parameter"
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset rint strchr strncasecmp strtol])
# I18n
rm -f $srcdir/po/LINGUAS
for po_file in `ls $srcdir/po/*.po | sort`; do
echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g" >> $srcdir/po/LINGUAS
done
# Set up gettext
GETTEXT_PACKAGE=multiload-ng
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
AM_GLIB_GNU_GETTEXT
# Default paths
AC_PREFIX_PROGRAM([ make ])
if test "${sysconfdir}" = '${prefix}/etc' ; then sysconfdir=/etc ; fi
# Check highest available GTK version
PKG_CHECK_EXISTS([gtk+-3.0], [auto_gtk=3.0], [auto_gtk=2.0])
# Select GTK version
AC_MSG_CHECKING([which gtk+ version to compile against])
AC_ARG_WITH([gtk], [AS_HELP_STRING([--with-gtk=2.0|3.0|auto], [which GTK+ version to compile against (default: auto)])],
[case "$with_gtk" in
2.0|3.0) ;;
auto) with_gtk=$auto_gtk ;;
*) AC_MSG_ERROR([invalid gtk version specified]) ;;
esac],
[ with_gtk=$auto_gtk ]
)
AC_MSG_RESULT([$with_gtk])
case "$with_gtk" in
2.0)
GTK_API=2
GTK_REQUIRED=2.20.0
;;
3.0)
GTK_API=3
GTK_REQUIRED=3.0.0
;;
esac
AC_SUBST(GTK_API_VERSION)
AC_DEFINE_UNQUOTED(GTK_API, $GTK_API, [GTK API version to compile against.])
# Log domain
AC_DEFINE_UNQUOTED(G_LOG_DOMAIN,"multiload-ng", [Log domain])
PKG_CHECK_MODULES(GTK, gtk+-$GTK_API.0 >= $GTK_REQUIRED)
AC_SUBST(GTK_FLAGS)
AC_SUBST(GTK_LIBS)
# Other dependencies
PKG_CHECK_MODULES(CAIRO, [cairo >= 1.0])
AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(CAIRO_LIBS)
# Disable Glib deprecation warnings
AC_ARG_ENABLE([deprecations], AS_HELP_STRING([--disable-deprecations], [Disable GDK/GTK deprecation warnings (useful when compiling with -Werror)]),
[if test "x$enableval" = "xno"; then
AC_DEFINE([GDK_DISABLE_DEPRECATION_WARNINGS], [1], [Disable GDK/GTK deprecation warnings])
fi]
)
# Experimental code blocks
AC_ARG_ENABLE([experimental], AS_HELP_STRING([--enable-experimental], [Compile also experimental code blocks. Warning: this is often unstable. Enable only if you are developing new features enclosed between #ifdef MULTILOAD_EXPERIMENTAL.]),
[if test "x$enableval" = "xyes"; then
AC_DEFINE([MULTILOAD_EXPERIMENTAL], [1], [Enable testing code (unstable)])
fi]
)
# Developer mode (additional checks/logs)
AC_ARG_ENABLE([developer-mode], AS_HELP_STRING([--enable-developer-mode], [Enable additional checks/logs/internal stuff useful to plugin developers. Do not enable this.]),
[if test "x$enableval" = "xyes"; then
AC_DEFINE([MULTILOAD_DEVELOPER_MODE], [1], [Enable developer mode])
fi]
)
# Enable debug CFLAGS
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable CFLAGS for debugging with GDB.]),
[if test "x$enableval" = "xyes"; then
AC_DEFINE([MULTILOAD_DEBUG], [1], [Debug])
CFLAGS="${CFLAGS} -ggdb3 -Og"
fi]
)
# Enable profiling CFLAGS
AC_ARG_ENABLE([profiling], AS_HELP_STRING([--enable-profiling], [Enable CFLAGS for profiling with gprof.]),
[if test "x$enableval" = "xyes"; then
CFLAGS="${CFLAGS} -pg"
fi]
)
# Enable autostart for suitable targets
AC_ARG_ENABLE([autostart], AS_HELP_STRING([--disable-autostart], [Do not install autostart entries for suitable targets.]))
# Default behavior is to install autostart entries
if test "x$enable_autostart" != "xno"; then
enable_autostart=yes
fi
AM_CONDITIONAL(ENABLE_AUTOSTART, test "x$enable_autostart" != "xno")
# Per-panel configure
m4_include([data/configure.m4])
m4_include([standalone/configure.m4])
m4_include([awn/configure.m4])
m4_include([indicator/configure.m4])
m4_include([lxpanel/configure.m4])
m4_include([mate/configure.m4])
m4_include([systray/configure.m4])
m4_include([xfce4/configure.m4])
# Checks if at least one build is available
if \
test x$with_standalone != xyes && \
test x$with_awn != xyes && \
test x$with_indicator != xyes && \
test x$with_lxpanel != xyes && \
test x$with_mate != xyes && \
test x$with_systray != xyes && \
test x$with_xfce4 != xyes
then
AC_MSG_FAILURE([No supported panels are installed and available.])
fi
# Directories; for substitution into .desktop files.
# From https://mail.gnome.org/archives/commits-list/2012-March/msg14085.html
# Of course it's worth noting that the patch in that message was to replace
# this nasty hack with an awk version that runs from the Makefile...
if test "${prefix}" = "NONE"; then
prefix=/usr/local
fi
if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
eval LIBDIR="$libdir"
AC_SUBST([LIBDIR])
# Output files
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
common/Makefile
po/Makefile.in
])
AC_OUTPUT
AS_ECHO([ ])
AS_ECHO([ ])
AS_ECHO([ "* -----------------------------" ])
AS_ECHO([ "* Configured $PACKAGE_NAME version $PACKAGE_VERSION" ])
AS_ECHO([ "* -----------------------------" ])
AS_ECHO([ "*" ])
AS_ECHO([ "* Using prefix: $prefix" ])
AS_ECHO([ "*" ])
AS_ECHO([ "* CFLAGS: $CFLAGS" ])
AS_ECHO([ "* Building against GTK+$GTK_API" ])
AS_ECHO([ "*" ])
if test "x$enable_debug" = "xyes"; then
AS_ECHO([ "* Enabled debugging CFLAGS" ])
fi
if test "x$enable_profiling" = "xyes"; then
AS_ECHO([ "* Enabled profiling CFLAGS" ])
fi
if test "x$enable_deprecations" = "xno"; then
AS_ECHO([ "* Disabled GDK/GTK deprecation warnings" ])
fi
if test "x$enable_experimental" = "xyes"; then
AS_ECHO([ "* Enabled experimental code (WARNING: this is unstable)" ])
fi
if test "x$enable_developer_mode" = "xyes"; then
AS_ECHO([ "* Enabled developer mode" ])
fi
AS_ECHO([ "* Install autostart entries: $enable_autostart" ])
AS_ECHO([ "*" ])
AS_ECHO([ "* Enabled plugins:" ])
AS_ECHO([ "* - standalone : $with_standalone" ])
AS_ECHO([ "* - awn : $with_awn" ])
AS_ECHO([ "* - indicator : $with_indicator" ])
AS_ECHO([ "* - lxpanel : $with_lxpanel" ])
AS_ECHO([ "* - mate-panel : $with_mate" ])
AS_ECHO([ "* - system tray : $with_systray" ])
AS_ECHO([ "* - xfce4-panel : $with_xfce4" ])
AS_ECHO([ "*" ])
AS_ECHO([ "* -----------------------------" ])
AS_ECHO([ ])