forked from jonls/redshift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
393 lines (348 loc) · 11.3 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
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([redshift], [1.11], [https://github.com/jonls/redshift/issues])
AC_CONFIG_SRCDIR([src/redshift.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Checks for programs.
AC_PROG_CC_C99
AC_PROG_LIBTOOL
AC_PROG_OBJC # For macOS support modules
AC_LANG([C])
AC_PROG_INTLTOOL([0.50])
AC_CANONICAL_HOST
# Test host platform
build_windows=no
case "${host_os}" in
mingw*)
build_windows=yes
;;
esac
# Test whether to compile Windows resources
AC_CHECK_TOOL([WINDRES], [windres], [])
AS_IF([test "x$build_windows" = "xyes" -a -n "x$WINDRES"], [
enable_windows_resource=yes
], [
enable_windows_resource=no
])
AM_CONDITIONAL([ENABLE_WINDOWS_RESOURCE],
[test "x$enable_windows_resource" = xyes])
# Test whether Objective C compiler works
AC_MSG_CHECKING([whether Objective C compiler works])
AC_LANG_PUSH([Objective C])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [
AC_MSG_RESULT([yes])
have_objc_compiler=yes
], [
AC_MSG_RESULT([no])
have_objc_compiler=no
])
AC_LANG_POP([Objective C])
# Checks for libraries.
AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])
GETTEXT_PACKAGE=redshift
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
PKG_CHECK_MODULES([DRM], [libdrm], [have_drm=yes], [have_drm=no])
PKG_CHECK_MODULES([DBUS], [dbus-1], [have_dbus=yes], [have_dbus=no])
PKG_CHECK_MODULES([X11], [x11], [have_x11=yes], [have_x11=no])
PKG_CHECK_MODULES([XF86VM], [xxf86vm], [have_xf86vm=yes], [have_xf86vm=no])
PKG_CHECK_MODULES([XCB], [xcb], [have_xcb=yes], [have_xcb=no])
PKG_CHECK_MODULES([XCB_RANDR], [xcb-randr],
[have_xcb_randr=yes], [have_xcb_randr=no])
PKG_CHECK_MODULES([GLIB], [glib-2.0 gobject-2.0], [have_glib=yes], [have_glib=no])
PKG_CHECK_MODULES([GEOCLUE2], [glib-2.0 gio-2.0 >= 2.26], [have_geoclue2=yes], [have_geoclue2=no])
# macOS headers
AC_CHECK_HEADER([ApplicationServices/ApplicationServices.h], [have_appserv_h=yes], [have_appserv_h=no])
# CoreLocation.h is an Objective C header. Only test if
# Objective C compiler works. AC_CHECK_HEADER does not
# appear to work if the Ojective C compiler is not
# available so we need a custom test.
AC_MSG_CHECKING([whether CoreLocation/CoreLocation.h is usable])
AS_IF([test "x$have_objc_compiler" = xyes], [
AC_LANG_PUSH([Objective C])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#import <CoreLocation/CoreLocation.h>]],[[]])], [
AC_MSG_RESULT([yes])
have_corelocation_h=yes
], [
AC_MSG_RESULT([no])
have_corelocation_h=no
])
AC_LANG_POP([Objective C])
], [
AC_MSG_RESULT([no Objective C compiler available])
have_corelocation_h=no
])
# Windows header
AC_CHECK_HEADER([windows.h], [have_windows_h=yes], [have_windows_h=no])
# Check for Python
AM_PATH_PYTHON([3.2], [have_python=yes], [have_python=no])
# Check DRM method
AC_MSG_CHECKING([whether to enable DRM method])
AC_ARG_ENABLE([drm], [AC_HELP_STRING([--enable-drm],
[enable DRM method])],
[enable_drm=$enableval],[enable_drm=maybe])
AS_IF([test "x$enable_drm" != xno], [
AS_IF([test $have_drm = yes], [
AC_DEFINE([ENABLE_DRM], 1,
[Define to 1 to enable DRM method])
AC_MSG_RESULT([yes])
enable_drm=yes
], [
AC_MSG_RESULT([missing dependencies])
AS_IF([test "x$enable_drm" = xyes], [
AC_MSG_ERROR([missing dependencies for DRM method])
])
enable_drm=no
])
], [
AC_MSG_RESULT([no])
enable_drm=no
])
AM_CONDITIONAL([ENABLE_DRM], [test "x$enable_drm" = xyes])
# Check RANDR method
AC_MSG_CHECKING([whether to enable RANDR method])
AC_ARG_ENABLE([randr], [AC_HELP_STRING([--enable-randr],
[enable RANDR method])],
[enable_randr=$enableval],[enable_randr=maybe])
AS_IF([test "x$enable_randr" != xno], [
AS_IF([test $have_xcb = yes -a $have_xcb_randr = yes], [
AC_DEFINE([ENABLE_RANDR], 1,
[Define to 1 to enable RANDR method])
AC_MSG_RESULT([yes])
enable_randr=yes
], [
AC_MSG_RESULT([missing dependencies])
AS_IF([test "x$enable_randr" = xyes], [
AC_MSG_ERROR([missing dependencies for RANDR method])
])
enable_randr=no
])
], [
AC_MSG_RESULT([no])
enable_randr=no
])
AM_CONDITIONAL([ENABLE_RANDR], [test "x$enable_randr" = xyes])
# Check VidMode method
AC_MSG_CHECKING([whether to enable VidMode method])
AC_ARG_ENABLE([vidmode], [AC_HELP_STRING([--enable-vidmode],
[enable VidMode method])],
[enable_vidmode=$enableval],[enable_vidmode=maybe])
AS_IF([test "x$enable_vidmode" != xno], [
AS_IF([test $have_x11 = yes -a $have_xf86vm = yes], [
AC_DEFINE([ENABLE_VIDMODE], 1,
[Define to 1 to enable VidMode method])
AC_MSG_RESULT([yes])
enable_vidmode=yes
], [
AC_MSG_RESULT([missing dependencies])
AS_IF([test "x$enable_vidmode" = xyes], [
AC_MSG_ERROR([missing dependencies for VidMode method])
])
enable_vidmode=no
])
], [
AC_MSG_RESULT([no])
enable_vidmode=no
])
AM_CONDITIONAL([ENABLE_VIDMODE], [test "x$enable_vidmode" = xyes])
# Check Quartz (macOS) method
AC_MSG_CHECKING([whether to enable Quartz method])
AC_ARG_ENABLE([quartz], [AC_HELP_STRING([--enable-quartz],
[enable Quartz (macOS) method])],
[enable_quartz=$enableval],[enable_quartz=maybe])
AS_IF([test "x$enable_quartz" != xno], [
AS_IF([test $have_appserv_h = yes], [
QUARTZ_CFLAGS=""
QUARTZ_LIBS="-framework ApplicationServices"
AC_DEFINE([ENABLE_QUARTZ], 1,
[Define to 1 to enable Quartz method])
AC_MSG_RESULT([yes])
enable_quartz=yes
], [
AC_MSG_RESULT([missing dependencies])
AS_IF([test "x$enable_quartz" = xyes], [
AC_MSG_ERROR([missing Quartz headers])
])
enable_quartz=no
])
], [
AC_MSG_RESULT([no])
enable_quartz=no
])
AM_CONDITIONAL([ENABLE_QUARTZ], [test "x$enable_quartz" = xyes])
AC_SUBST([QUARTZ_CFLAGS])
AC_SUBST([QUARTZ_LIBS])
# Check Windows GDI method
AC_MSG_CHECKING([whether to enable WinGDI method])
AC_ARG_ENABLE([wingdi], [AC_HELP_STRING([--enable-wingdi],
[enable WinGDI method])],
[enable_wingdi=$enableval],[enable_wingdi=maybe])
AS_IF([test "x$enable_wingdi" != xno], [
AS_IF([test $have_windows_h = yes], [
AC_DEFINE([ENABLE_WINGDI], 1,
[Define to 1 to enable WinGDI method])
AC_MSG_RESULT([yes])
enable_wingdi=yes
], [
AC_MSG_RESULT([missing dependencies])
AS_IF([test "x$enable_wingdi" = xyes], [
AC_MSG_ERROR([missing Windows API headers for WinGDI method])
])
enable_wingdi=no
])
], [
AC_MSG_RESULT([no])
enable_wingdi=no
])
AM_CONDITIONAL([ENABLE_WINGDI], [test "x$enable_wingdi" = xyes])
# Check Geoclue2 location provider
AC_MSG_CHECKING([whether to enable Geoclue2 location provider])
AC_ARG_ENABLE([geoclue2], [AC_HELP_STRING([--enable-geoclue2],
[enable Geoclue2 location provider])],
[enable_geoclue2=$enableval],[enable_geoclue2=maybe])
AS_IF([test "x$enable_geoclue2" != xno], [
AS_IF([test "x$have_geoclue2" = xyes], [
AC_DEFINE([ENABLE_GEOCLUE2], 1,
[Define to 1 to enable Geoclue2 location provider])
AC_MSG_RESULT([yes])
enable_geoclue2=yes
], [
AC_MSG_RESULT([missing dependencies])
AS_IF([test "x$enable_geoclue2" = xyes], [
AC_MSG_ERROR([missing dependencies for Geoclue2 location provider])
])
enable_geoclue2=no
])
], [
AC_MSG_RESULT([no])
enable_geoclue2=no
])
AM_CONDITIONAL([ENABLE_GEOCLUE2], [test "x$enable_geoclue2" = xyes])
# Check CoreLocation (macOS) provider
AC_MSG_CHECKING([whether to enable CoreLocation method])
AC_ARG_ENABLE([corelocation], [AC_HELP_STRING([--enable-corelocation],
[enable CoreLocation (macOS) provider])],
[enable_corelocation=$enableval],[enable_corelocation=maybe])
AS_IF([test "x$enable_corelocation" != xno], [
AS_IF([test "x$have_corelocation_h" = xyes], [
CORELOCATION_CFLAGS=""
CORELOCATION_LIBS="-framework Foundation -framework Cocoa -framework CoreLocation"
AC_DEFINE([ENABLE_CORELOCATION], 1,
[Define to 1 to enable CoreLocation provider])
AC_MSG_RESULT([yes])
enable_corelocation=yes
], [
AC_MSG_RESULT([missing dependencies])
AS_IF([test "x$enable_corelocation" = xyes], [
AC_MSG_ERROR([missing CoreLocation headers])
])
enable_corelocation=no
])
], [
AC_MSG_RESULT([no])
enable_corelocation=no
])
AM_CONDITIONAL([ENABLE_CORELOCATION], [test "x$enable_corelocation" = xyes])
AC_SUBST([CORELOCATION_CFLAGS])
AC_SUBST([CORELOCATION_LIBS])
# Check for GUI status icon
AC_MSG_CHECKING([whether to enable GUI status icon])
AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui],
[enable GUI status icon])],
[enable_gui=$enableval],[enable_gui=maybe])
AS_IF([test "x$enable_gui" != xno], [
AS_IF([test $have_python = yes], [
AC_MSG_RESULT([yes])
enable_gui=yes
], [
AC_MSG_RESULT([missing dependencies])
AS_IF([test "x$enable_gui" = xyes], [
AC_MSG_ERROR([GUI status icon script requires Python])
])
enable_gui=no
])
], [
AC_MSG_RESULT([no])
enable_gui=no
])
AM_CONDITIONAL([ENABLE_GUI], [test "x$enable_gui" != xno])
# Check for Ubuntu icons
AC_MSG_CHECKING([whether to enable Ubuntu icons])
AC_ARG_ENABLE([ubuntu], [AC_HELP_STRING([--enable-ubuntu],
[enable Ubuntu icons])],
[enable_ubuntu=$enableval],[enable_ubuntu=no])
AS_IF([test "x$enable_ubuntu" != xno], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
AM_CONDITIONAL([ENABLE_UBUNTU], [test "x$enable_ubuntu" != xno])
# Check for systemd
PKG_PROG_PKG_CONFIG
AC_MSG_CHECKING([Directory to install systemd user unit files])
AC_ARG_WITH([systemduserunitdir],
[AS_HELP_STRING([--with-systemduserunitdir=<dir>],
[Directory for systemd user unit files])],
[], [with_systemduserunitdir=$($PKG_CONFIG --variable=systemduserunitdir systemd)])
AS_IF([test -n "$with_systemduserunitdir" -a "x$with_systemduserunitdir" != xno], [
AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
AC_MSG_RESULT([$systemduserunitdir])
enable_systemd=yes
], [
AC_MSG_RESULT([not enabled])
enable_systemd=no
])
AM_CONDITIONAL([ENABLE_SYSTEMD], [test "x$enable_systemd" != xno])
# Check for AppArmor
AC_MSG_CHECKING([whether to enable AppArmor profile])
AC_ARG_ENABLE([apparmor], [AC_HELP_STRING([--enable-apparmor],
[enable AppArmor profile])],
[enable_apparmor=$enableval],[enable_apparmor=no])
AS_IF([test "x$enable_apparmor" != xno], [
AC_MSG_RESULT([yes])
enable_apparmor=yes
], [
AC_MSG_RESULT([no])
enable_apparmor=no
])
AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" != xno])
# Checks for header files.
AC_CHECK_HEADERS([locale.h stdint.h stdlib.h string.h unistd.h signal.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UINT16_T
# Checks for library functions.
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_SEARCH_LIBS([floor], [m])
AC_CHECK_FUNCS([setlocale strchr floor pow])
AC_CONFIG_FILES([
Makefile
po/Makefile.in
src/Makefile
src/redshift-gtk/Makefile
])
AC_OUTPUT
echo "
$PACKAGE_NAME $VERSION
prefix: ${prefix}
compiler: ${CC}
cflags: ${CFLAGS}
ldflags: ${LDFLAGS}
Adjustment methods:
DRM: ${enable_drm}
RANDR: ${enable_randr}
VidMode: ${enable_vidmode}
Quartz (macOS): ${enable_quartz}
WinGDI (Windows): ${enable_wingdi}
Location providers:
Geoclue2: ${enable_geoclue2}
CoreLocation (macOS): ${enable_corelocation}
GUI: ${enable_gui}
Ubuntu icons: ${enable_ubuntu}
systemd units: ${enable_systemd} ${systemduserunitdir}
AppArmor profile: ${enable_apparmor}
"