-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac.in
379 lines (322 loc) · 11.3 KB
/
configure.ac.in
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
dnl configure.ac.in
dnl
dnl xfce4-sensors-plugin - Sensors plugin for xfce4-panel
dnl
dnl 2003,2004, 2007 Benedikt Meurer <[email protected]>
dnl 2007-2011,2014-2020 Fabian Nowak <[email protected]>
dnl
m4_define([libxfce4sensors_verinfo], [5:1:0])
dnl Version information
m4_define([sensors_version_major], [1])
m4_define([sensors_version_minor], [4])
m4_define([sensors_version_micro], [1])
m4_define([sensors_version_build], [@REVISION@])
m4_define([sensors_version_tag], [git])
m4_define([sensors_version], [sensors_version_major().sensors_version_minor().sensors_version_micro()ifelse(sensors_version_tag(), [git], [sensors_version_tag()-sensors_version_build()], [sensors_version_tag()])])
dnl Initialize autoconf
AC_INIT([xfce4-sensors-plugin], [sensors_version], [https://gitlab.xfce.org/panel-plugins/xfce4-sensors-plugin/], [xfce4-sensors-plugin])
AC_PREREQ([2.60])
dnl Initialize automake
AM_INIT_AUTOMAKE([1.11 dist-bzip2 tar-ustar no-dist-gzip])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/main.c])
AM_MAINTAINER_MODE()
AM_SILENT_RULES([yes])
dnl Check for basic programs
AC_PROG_CC_C99
AC_PROG_LD()
AC_PROG_INSTALL
IT_PROG_INTLTOOL([0.35.0])
LT_PREREQ([2.2.6])
LT_INIT([disable-static])
dnl Check for libsensors depending on whether it is disabled upon user request
AC_ARG_ENABLE([libsensors],
AC_HELP_STRING([--enable-libsensors=auto|yes|no],
[Use LM-sensors to read a vast amount of sensors on your mainboards @<:@default=auto@:>@]),
[],
[enable_libsensors=auto])
if test x"$enable_libsensors" = x"auto"; then
AC_CHECK_LIB([sensors], [sensors_get_detected_chips], [enable_libsensors=yes], [enable_libsensors=no])
else
if test x"$enable_libsensors" = x"yes"; then
AC_CHECK_LIB([sensors], [sensors_get_detected_chips], [], [AC_MSG_ERROR(could not find libsensors)])
fi
fi
if test x"$enable_libsensors" = x"yes"; then
AC_DEFINE([HAVE_LIBSENSORS], [1], [Define to 1 if libsensors is found])
dnl FIXME: make that dynamic in case of auto
LIBSENSORS_CFLAGS="-I/usr/include"
LIBSENSORS_LDFLAGS="-lsensors"
fi
AC_SUBST([LIBSENSORS_CFLAGS])
AC_SUBST([LIBSENSORS_LDFLAGS])
AM_CONDITIONAL([HAVE_LIBSENSORS], [test x$enable_libsensors = x"yes"])
dnl Check for hddtemp depending on whether it is disabled upon user request
AC_ARG_ENABLE([hddtemp],
[AC_HELP_STRING([--enable-hddtemp=auto|yes|no],
[Use hddtemp to read your harddisk temperature @<:@default=auto@:>@])],
[],
[
enable_hddtemp=auto
])
if test x"$enable_hddtemp" = x"auto"; then
AC_CHECK_PROG([hddtemp], [hddtemp], [yes], [], [$PATH:/sbin:/usr/sbin:/usr/local/sbin])
if test x"$hddtemp" = x"yes"; then
enable_hddtemp=yes
else
enable_hddtemp=no
fi
fi
if test x"$enable_hddtemp" = x"yes"; then
AC_ARG_WITH([pathhddtemp], [AC_HELP_STRING([--with-pathhddtemp], [Specify path to hddtemp @<:@default=auto@:>@])],
[
HDDTEMP=$withval
], [
AC_MSG_CHECKING([for hddtemp path])
HDDTEMP=[`whereis -b hddtemp | sed 's/.*\ \(\/[a-zA-Z0-9\-\/.]*bin[A-Za-z0-9\-\/.]*hddtemp\).*/\1/'`]
AC_MSG_RESULT([$HDDTEMP])
])
if test x"$HDDTEMP" = x"hddtemp:"; then
enable_hddtemp=no
else
AC_DEFINE([HAVE_HDDTEMP], [1], [Define to 1 if hddtemp is desired])
AC_DEFINE_UNQUOTED([PATH_HDDTEMP], ["$HDDTEMP"], [Complete path to hddtemp])
AC_SUBST([PATH_HDDTEMP])
fi
fi
AM_CONDITIONAL([HAVE_HDDTEMP], [test x$enable_hddtemp = x"yes"])
dnl Check for netcat for hddtemp to be used
AC_ARG_ENABLE([netcat], [AC_HELP_STRING([--enable-netcat], [Use netcat to read your hddtemp temperature @<:@default=auto@:>@])],
[],
[
enable_netcat=auto
])
if test x"$enable_netcat" = x"auto"; then
AC_CHECK_PROG([netcat], [netcat], [yes], [], [$PATH:/sbin:/usr/sbin:/usr/local/sbin])
AC_CHECK_PROG([nc], [nc], [yes], [], [$PATH:/sbin:/usr/sbin:/usr/local/sbin])
if test x"$netcat" = x"yes" -o x"$nc" = x"yes"; then
enable_netcat1=yes
else
enable_netcat1=no
fi
else
if test x"$enable_netcat" = x"yes"; then
enable_netcat1=yes
else
enable_netcat1=no
fi
fi
if test x"$enable_netcat1" = x"yes"; then
AC_ARG_WITH([pathnetcat], [AC_HELP_STRING([--with-pathnetcat], [Specify path to netcat @<:@default=auto@:>@])],
[
NETCAT_PATH=$withval
], [
AC_MSG_CHECKING([for netcat path])
NETCAT_PATH=[`whereis -b netcat | sed 's/.*\ \(\/[a-zA-Z0-9\-\/.]*bin[A-Za-z0-9\-\/.]*netcat\).*/\1/'`]
if test x"$NETCAT_PATH" = x"netcat:"; then
NETCAT_PATH=[`whereis -b nc | sed 's/.*\ \(\/[a-zA-Z0-9\-\/.]*bin[A-Za-z0-9\-\/.]*nc\).*/\1/'`]
fi;
AC_MSG_RESULT([$NETCAT_PATH])
])
NETCAT_HOST=localhost
HDDTEMP_PORT=7634
AC_ARG_ENABLE([pathchecks], [AC_HELP_STRING([--enable-pathchecks], [Enable checks for paths, access and execution @<:@default=yes@:>@])],
[
], [
enable_pathchecks=yes
])
NETCAT_RUN=skip
if test x"$enable_pathchecks" = x"yes"; then
AC_MSG_CHECKING([for hddtemp being queryable via netcat])
NETCAT_RUN=[`"$NETCAT_PATH" "$NETCAT_HOST" "$HDDTEMP_PORT" 2> /dev/null`]
AC_MSG_RESULT([$NETCAT_RUN])
fi
if test x"$NETCAT_RUN" = x""; then
enable_netcat1=no
if test x"$enable_netcat" = x"yes"; then
AC_MSG_ERROR([hddtemp isn't queryable via netcat (use --disable-pathchecks to disable this check)])
fi
else
AC_DEFINE([HAVE_NETCAT], [1], [Define to 1 if hddtemp daemon is queried via netcat])
AC_DEFINE_UNQUOTED([NETCAT_PATH], [$NETCAT_PATH], [Complete path to netcat])
AC_SUBST([NETCAT_PATH])
AC_DEFINE_UNQUOTED([NETCAT_HOST], [$NETCAT_HOST], [Host for netcat])
AC_SUBST([NETCAT_HOST])
AC_DEFINE_UNQUOTED([HDDTEMP_PORT], [$HDDTEMP_PORT], [Port for hddtemp with netcat])
AC_SUBST([HDDTEMP_PORT])
fi
fi
AM_CONDITIONAL([HAVE__NETCAT], [test x$enable_netcat1 = x"yes"])
dnl Check for interface for /proc/acpi to be used
AC_ARG_ENABLE([procacpi], [AC_HELP_STRING([--enable-procacpi], [Use /proc/acpi to read your CPU temperature @<:@default=auto@:>@])],
[],
[
enable_procacpi=auto
])
if test x"$enable_procacpi" = x"auto"; then
AC_CHECK_FILE([/proc/acpi/info],
[
enable_procacpi=yes
],
[
enable_procacpi=no
])
fi
dnl Check for interface for /sys/class/power_supply to be used
AC_ARG_ENABLE([sysfsacpi], [AC_HELP_STRING([--enable-sysfsacpi], [Use /sys/class/power_supply to read your battery value @<:@default=auto@:>@])],
[],
[
enable_sysfsacpi=auto
])
if test x"$enable_sysfsacpi" = x"auto"; then
AC_CHECK_FILE([/sys/class/power_supply],
[
enable_sysfsacpi=yes
],
[
enable_sysfsacpi=no
])
fi
if test x"$enable_sysfsacpi" = x"yes"; then
AC_DEFINE([HAVE_SYSFS_ACPI], [1], [Define to 1 if /sys/class/power_supply is found])
enable_procacpi=yes
fi
if test x"$enable_procacpi" = x"yes"; then
AC_DEFINE([HAVE_ACPI], [1], [Define to 1 if /proc/acpi is found])
fi
dnl Check for nvidia blahblah to be used
AC_ARG_ENABLE([xnvctrl],
AC_HELP_STRING([--enable-xnvctrl],
[Use nvctrl to obtain Nvidia GPU temperature value @<:@default=auto@:>@]),
[],
[
enable_xnvctrl=auto
])
if test x"$enable_xnvctrl" = x"auto"; then
AC_CHECK_FILE([/usr/include/NVCtrl],
[
enable_xnvctrl=yes
],
[
enable_xnvctrl=no
])
fi
if test x"$enable_xnvctrl" = x"yes"; then
AC_DEFINE([HAVE_NVIDIA], [1], [Define to 1 if media-video/nvidia-drivers installed])
NVIDIA_CFLAGS="-I/usr/include/NVCtrl"
NVIDIA_LIBS="-lX11 -lXext -lXNVCtrl"
enable_xnvctrl=yes
AC_SUBST([NVIDIA_CFLAGS])
AC_SUBST([NVIDIA_LIBS])
fi
AM_CONDITIONAL([HAVE_ACPI], [test x$enable_procacpi = x"yes"])
AM_CONDITIONAL([HAVE_SYSFS_ACPI], [test x$enable_sysfsacpi = x"yes"])
AM_CONDITIONAL([HAVE_NVIDIA], [test x$enable_xnvctrl = x"yes"])
dnl Get operating system information
KERNEL=`uname -s`
if test "$KERNEL" = "Linux"; then
AC_DEFINE([HAVE_LINUX], [1], [Set this to 1 if using Linux or newer])
fi
dnl OS="$KERNEL"
dnl AC_DEFINE([OS], ["$OS"], [Set this to the name of the operating system.])
AC_CHECK_FUNCS([gethostname])
AC_CHECK_FUNCS([socket])
AC_CHECK_HEADERS([arpa/inet.h])
AC_CHECK_HEADERS([netinet/in.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([sys/param.h])
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([sys/sockio.h])
AC_HEADER_SYS_WAIT
AC_CHECK_LIB([kstat], [kstat_open], SOLLIBS="-lkstat -lsocket", SOLLIBS="")
AC_CHECK_LIB([nsl], [kstat_open], SOLLIBS="$SOLLIBS -linet_ntop", SOLLIBS="$SOLLIBS")
AC_SUBST(SOLLIBS)
dnl **************************************
dnl *** Substitute version information ***
dnl **************************************
LIBXFCE4SENSORS_VERINFO=libxfce4sensors_verinfo()
AC_SUBST([LIBXFCE4SENSORS_VERINFO])
dnl ***********************************
dnl *** Check for Glib/Gtk packages ***
dnl ***********************************
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.50.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.20.0])
dnl **************************************
dnl *** Check for notification library ***
dnl **************************************
XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY],
[libnotify],
[0.7], [notification],
[notification message library])
dnl **************************************
dnl *** Check for Xfce packages ***
dnl **************************************
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.14.0])
dnl configure the panel plugin
XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.14.0])
dnl I18n support
XDT_I18N([@LINGUAS@])
dnl Check for debugging support
XDT_FEATURE_DEBUG()
dnl *********************************
dnl *** Substitute platform flags ***
dnl *********************************
AC_MSG_CHECKING([PLATFORM_LDFLAGS])
AC_MSG_RESULT([$PLATFORM_LDFLAGS])
AC_SUBST([PLATFORM_LDFLAGS])
AC_SUBST([PLATFORM_CFLAGS])
AC_OUTPUT([
Makefile
xfce4-sensors-plugin.spec
src/xfce4-sensors.1
include/Makefile
lib/Makefile
lib/libxfce4sensors-1.0.pc
panel-plugin/Makefile
src/Makefile
icons/Makefile
po/Makefile.in
])
dnl ***************************
dnl *** Print configuration ***
dnl ***************************
echo
echo "==============================================================="
echo "Build Configuration"
echo "==============================================================="
dnl echo
dnl echo "Host system: $OS"
echo
echo "The following sensor interfaces will be built into the plugin:"
if test x"$enable_hddtemp" = x"yes"; then
echo "* hddtemp: $HDDTEMP (Make sure it is user-executable with UID bit set and user member of the respective group)"
fi
if test x"$enable_netcat1" = x"yes"; then
echo " netcat for hddtemp: $NETCAT_PATH on $NETCAT_HOST:$HDDTEMP_PORT"
fi
if test x"$LIBNOTIFY_FOUND" = x"yes"; then
echo "* libnotify"
fi
if test x"$enable_libsensors" = x"yes"; then
echo "* libsensors"
fi
if test x"$enable_procacpi" = x"yes"; then
echo "* /proc/acpi"
fi
if test x"$enable_sysfsacpi" = x"yes"; then
echo "* /sys/class/power_supply"
fi
if test x"$enable_xnvctrl" = x"yes"; then
echo "* NVIDIA X CTRL"
fi
echo
if test x"$enable_debug" = x"yes"; then
echo "Full debug is enabled"
else
echo "Full debug is disabled"
fi
echo
echo "==============================================================="