-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
262 lines (224 loc) · 8.04 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
256
257
258
259
260
261
262
# ================= initialization =================== #
AC_PREREQ([2.68])
AC_INIT([Hardware Sensors Indicator],[1.4],[https://github.com/alexmurray/indicator-sensors],[indicator-sensors])
AC_CONFIG_HEADERS([indicator-sensors/config.h])
AC_CONFIG_SRCDIR([indicator-sensors/indicator-sensors.c])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 dist-bzip2 foreign])
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])
# ============== basic compiler settings ============= #
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_AWK
AC_PROG_FGREP
AC_PROG_SED
AC_HEADER_STDC
# ================= initialize libtool =============== #
LT_PREREQ([2.2.6])
LT_INIT([disable-static])
# =========== take care of some localization ========= #
IT_PROG_INTLTOOL([0.40.0])
# Check for and fix missing delete of intltool cache lock file. Only
# needed with intltool >= 0.51.0-5.1, but just always fix as that is
# simpler and safe.
AC_MSG_CHECKING([whether po/Makefile.in.in deletes intltool cache lock file])
file='po/Makefile.in.in'
if test ! -f "$srcdir/$file"; then
AC_MSG_RESULT([not applicable])
elif $FGREP -q '.intltool-merge-cache.lock' "$srcdir/$file" 2> /dev/null; then
AC_MSG_RESULT([yes])
else
test -w "$srcdir/$file" && \
$SED -i '/rm -f .intltool-merge-cache/s/$/ .intltool-merge-cache.lock/' "$srcdir/$file" 2> /dev/null
if $FGREP -q '.intltool-merge-cache.lock' "$srcdir/$file" 2> /dev/null; then
AC_MSG_RESULT([fixed])
else
AC_MSG_RESULT([no])
fi
fi
GETTEXT_PACKAGE=indicator-sensors
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
# ========== export compiler / linker options ======== #
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
# ============== look for dependencies =============== #
# check for headers needed for standard interfaces
#AC_CHECK_HEADERS()
GLIB_REQUIRED=2.28.0
GIO_REQUIRED=2.26.0
GTK_REQUIRED=3.0.0
AYATANA_APPINDICATOR_REQUIRED=0.0.7
LIBPEAS_REQUIRED=0.7.2
LIBNOTIFY_REQUIRED=0.7.2
LIBUDISKS2_REQUIRED=2.0.0
LIBATASMART_REQUIRED=0.16
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
PKG_CHECK_MODULES(GIO, gio-2.0 >= $GIO_REQUIRED)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
PKG_CHECK_MODULES(LIBPEAS, libpeas-1.0 >= $LIBPEAS_REQUIRED)
AC_SUBST(LIBPEAS_CFLAGS)
AC_SUBST(LIBPEAS_LIBS)
PKG_CHECK_MODULES(LIBPEASGTK, libpeas-gtk-1.0 >= $LIBPEAS_REQUIRED)
AC_SUBST(LIBPEASGTK_CFLAGS)
AC_SUBST(LIBPEASGTK_LIBS)
PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED)
AC_SUBST(LIBNOTIFY_CFLAGS)
AC_SUBST(LIBNOTIFY_LIBS)
PKG_CHECK_MODULES(AYATANA_APPINDICATOR, ayatana-appindicator3-0.1 >= $AYATANA_APPINDICATOR_REQUIRED,
AC_DEFINE(HAVE_AYATANA_APPINDICATOR, 1, [ayatana-appindicator is available]),
AC_DEFINE(HAVE_AYATANA_APPINDICATOR, 0, [ayatana-appindicator is not available]))
AM_CONDITIONAL(AYATANA_APPINDICATOR, test -n "$AYATANA_AYATANA_APPINDICATOR_LIBS")
AC_SUBST(AYATANA_AYATANA_APPINDICATOR_CFLAGS)
AC_SUBST(AYATANA_AYATANA_APPINDICATOR_LIBS)
GLIB_GSETTINGS
AC_CHECK_HEADERS(regex.h)
AC_CHECK_HEADERS(sensors/sensors.h,
AC_CHECK_LIB(sensors, sensors_init,[
AC_DEFINE(HAVE_LIBSENSORS,1,[libsensors is available])
if test "x${SENSORS_DIR}" != "x"; then
LIBSENSORS_CFLAGS="-I${SENSORS_DIR}/include"
LIBSENSORS_LIBS="-L${SENSORS_DIR}/lib -lsensors"
else
LIBSENSORS_LIBS="-lsensors"
fi]))
AM_CONDITIONAL(LIBSENSORS, test -n "$LIBSENSORS_LIBS")
AC_SUBST(LIBSENSORS_CFLAGS)
AC_SUBST(LIBSENSORS_LIBS)
# do nvidia by default if available
AC_ARG_WITH(nvidia,
[ --with-nvidia[=DIR] use nvidia in DIR],[
if test "$withval" != "no" -a "$withval" != "yes"; then
NVIDIA_DIR=$withval
CFLAGS="${CFLAGS} -I${NVIDIA_DIR}/include"
LIBS="${LIBS} -L${NVIDIA_DIR}/lib"
fi
with_nvidia=$withval],[
with_nvidia="yes"
])
if test "$with_nvidia" = "no"; then
echo "Disabling nvidia support"
else
AC_ARG_WITH(x11,
[ --with-x11[=DIR] use x11 in DIR],[
if test "$withval" != "no" -a "$withval" != "yes"; then
X11_DIR=$withval
CFLAGS="${CFLAGS} -I${X11_DIR}/include"
LIBS="${LIBS} -L${X11_DIR}/lib"
fi
with_x11=$withval],[
with_x11="yes"
])
AC_CHECK_HEADERS(X11/Xlib.h,
AC_CHECK_LIB(X11, XOpenDisplay, [ HAVE_X11=true ]))
# can't embed next AC_CHECK_HEADERS in true case of AC_CHECK_LIB
if test "${HAVE_X11}" = "true"; then
LIBS="${LIBS} -lX11 -lXext"
# need to specifically include X11/Xlib header when
# doing checks for NVCtrl headers
AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h, [ HAVE_NVIDIA=true ], [],
[
#include <X11/Xlib.h>
])
if test "${HAVE_NVIDIA}" = "true"; then
AC_CHECK_LIB(XNVCtrl, XNVCTRLQueryExtension, [
NVIDIA_LIBS="-lXNVCtrl"
AC_DEFINE(HAVE_NVIDIA,1,[nvidia sensors available])
])
fi
fi
fi
AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS")
AC_SUBST(NVIDIA_CFLAGS)
AC_SUBST(NVIDIA_LIBS)
PKG_CHECK_MODULES(LIBATASMART, libatasmart >= $LIBATASMART_REQUIRED,
HAVE_LIBATASMART="yes", HAVE_LIBATASMART="no")
AC_SUBST(LIBATASMART_CFLAGS)
AC_SUBST(LIBATASMART_LIBS)
AM_CONDITIONAL(UDISKS, test -n "$LIBATASMART_CFLAGS")
PKG_CHECK_MODULES(LIBUDISKS2, udisks2 >= $LIBUDISKS2_REQUIRED,
HAVE_LIBUDISKS2="yes", HAVE_LIBUDISKS2="no")
AC_SUBST(LIBUDISKS2_CFLAGS)
AC_SUBST(LIBUDISKS2_LIBS)
AM_CONDITIONAL(UDISKS2, test -n "$LIBUDISKS2_CFLAGS")
# enable fake plugin if requested
AC_ARG_ENABLE(fake,
AS_HELP_STRING([--enable-fake], [Build plugin to generate fake sensors for testing]))
AM_CONDITIONAL(FAKE, test "x$enable_fake" = "xyes")
# ============ enable extra warnings etc ============= #
if test "$USE_MAINTAINER_MODE" = "yes"; then
CFLAGS+=" -ggdb"
CFLAGS+=" -Wall -Wextra"
CFLAGS+=" -Wno-missing-field-initializers"
CFLAGS+=" -Wno-unused-parameter"
CFLAGS+=" -Wmissing-declarations"
CFLAGS+=" -Wredundant-decls"
CFLAGS+=" -Wmissing-noreturn"
CFLAGS+=" -Wshadow"
CFLAGS+=" -Wpointer-arith"
CFLAGS+=" -Wcast-align"
CFLAGS+=" -Wwrite-strings"
CFLAGS+=" -Winline"
CFLAGS+=" -Wformat-nonliteral"
CFLAGS+=" -Wformat-security"
CFLAGS+=" -Wswitch-enum"
CFLAGS+=" -Wswitch-default"
CFLAGS+=" -Winit-self"
CFLAGS+=" -Wmissing-include-dirs"
CFLAGS+=" -Wundef"
CFLAGS+=" -Waggregate-return"
CFLAGS+=" -Wmissing-format-attribute"
CFLAGS+=" -Wnested-externs"
fi
AC_SUBST(CFLAGS)
# ========== extra debugging options ================= #
m4_define([debug_default],[minimum])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
[turn on debugging @<:@default=debug_default@:>@])],
[],
[enable_debug=debug_default])
AS_CASE([$enable_debug],
[yes], [ test "$cflags_set" = set || CFLAGS="$CFLAGS -O0 -g3 -ggdb" DEBUG_CFLAGS="-DDEBUG" ],
[minimum], [ DEBUG_CFLAGS="-DG_DISABLE_CAST_CHECKS" ],
[no], [ DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" ],
[AC_MSG_ERROR([Unknown argument to --enable-debug])])
AC_SUBST(DEBUG_CFLAGS)
# =========== we need glib-genmarshal ================ #
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
GNOME_COMPILE_WARNINGS(maximum)
# Use --enable-maintainer-mode to disabled deprecated symbols
GNOME_MAINTAINER_MODE_DEFINES
# ==================== plugin stuff ================== #
PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
# ================= generate files =================== #
AC_CONFIG_FILES([
Makefile
data/Makefile
data/indicator-sensors.gschema.xml.in
indicator-sensors/Makefile
icons/Makefile
plugins/Makefile
plugins/aticonfig/Makefile
plugins/dbus/Makefile
plugins/dynamic/Makefile
plugins/fake/Makefile
plugins/libsensors/Makefile
plugins/max/Makefile
plugins/nvidia/Makefile
plugins/udisks/Makefile
plugins/udisks2/Makefile
po/Makefile.in
])
AC_OUTPUT