-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
503 lines (449 loc) · 13.5 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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
## configure.ac -- Process this file with autoconf to produce configure
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
AC_INIT([petitboot],
[m4_esyscmd_s([./version.sh])],
[https://lists.ozlabs.org/listinfo/petitboot])
AC_CONFIG_MACRO_DIR([m4])
AC_PREFIX_DEFAULT([/usr/local])
AS_IF([test "x$CFLAGS" = "x"], [AC_SUBST([CFLAGS], [""])])
AC_PROG_CC
AC_PROG_LEX
if test -z "$($LEX --version)"; then
AC_MSG_ERROR([[Please install flex/lex]])
fi
AC_PROG_YACC
if test -z "$($YACC --version)"; then
AC_MSG_ERROR([[Please install bison/yacc]])
fi
AC_PROG_INSTALL
AM_INIT_AUTOMAKE
AC_GNU_SOURCE
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.19)
if test "$USE_NLS" = "yes" -a -z "$($MSGFMT --version)"; then
AC_MSG_ERROR([[Please install gettext]])
fi
LT_INIT
AM_SILENT_RULES([yes])
AX_WITH_CURSES
AX_WITH_CURSES_MENU
AX_WITH_CURSES_FORM
AM_CONDITIONAL([WITH_NCURSES], [test "x$ax_cv_curses" = "xyes"])
if test "x$ax_cv_curses" = xyes; then
if test "x$ax_cv_menu" != xyes; then
AC_MSG_ERROR([--with-ncurses requires the ncurses menu library])
fi
if test "x$ax_cv_form" != xyes; then
AC_MSG_ERROR([--with-ncurses requires the ncurses form library])
fi
fi
AC_CHECK_LIB([udev], [udev_new],
[UDEV_LIBS=-ludev],
[AC_MSG_FAILURE([The libudev development library is required by petitboot. Try installing the package libudev-dev or libudev-devel.])]
)
AC_CHECK_LIB([elf], [elf_begin],
[ELF_LIBS=-lelf],
[AC_MSG_FAILURE([The libelf development library is required by petitboot. Try installing the package libelf-dev or elfutils-libelf-devel.])]
)
AC_CHECK_HEADERS([elfutils/libdw.h],
[],
[AC_MSG_FAILURE([elfutils/libdw.h not found. Try installing the package libdw-dev or elfutils-devel.])]
)
PKG_CHECK_EXISTS(libudev >= 218, [old_udev=no], [old_udev=yes])
if test "$old_udev" = "yes" ; then
AC_DEFINE(UDEV_LOGGING, 1, [Support old udev logging interface])
fi
AC_CHECK_LIB([devmapper], [dm_task_create],
[DEVMAPPER_LIBS=-ldevmapper],
[AC_MSG_FAILURE([The libdevmapper development library is required by petitboot. Try installing the package libdevmapper-dev or device-mapper-devel.])]
)
AC_ARG_ENABLE(
[crypt],
[AS_HELP_STRING(
[--enable-crypt],
[Include crypt support to enable password use [default=no]]
)],
[],
[enable_crypt=no]
)
AM_CONDITIONAL([ENABLE_CRYPT], [test "x$enable_crypt" = "xyes"])
AS_IF([test "x$enable_crypt" = "xyes"],
[AC_DEFINE(CRYPT_SUPPORT, 1, [Enable crypt/password support])],
[]
)
AS_IF([test "x$enable_crypt" = "xyes"],
AC_CHECK_LIB([crypt], [crypt],
[CRYPT_LIBS=-lcrypt],
[AC_MSG_FAILURE([shadow/crypt libs required])]
)
)
AC_ARG_WITH([fdt],
AS_HELP_STRING([--without-fdt],
[Build without libfdt (default: no)]))
AS_IF([test "x$with_fdt" != "xno"],
AC_CHECK_LIB([fdt], [fdt_check_header],
[FDT_LIBS=-lfdt; have_libfdt=yes]))
AM_CONDITIONAL([HAVE_LIBFDT], [test x"$have_libfdt" = xyes])
AC_CHECK_HEADERS([stdarg.h])
AC_CHECK_HEADERS([varargs.h])
dnl Checking for va_copy availability
AC_MSG_CHECKING([for va_copy])
AC_TRY_LINK([#include <stdarg.h>
va_list ap1,ap2;], [va_copy(ap1,ap2);],
have_va_copy=yes,
have_va_copy=no)
AC_MSG_RESULT($have_va_copy)
if test x"$have_va_copy" = x"yes"; then
AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
else
AC_MSG_CHECKING([for __va_copy])
AC_TRY_LINK([#include <stdarg.h>
va_list ap1,ap2;], [__va_copy(ap1,ap2);],
have___va_copy=yes,
have___va_copy=no)
AC_MSG_RESULT($have___va_copy)
if test x"$have___va_copy" = x"yes"; then
AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
fi
fi
AC_ARG_WITH(
[twin-x11],
[AS_HELP_STRING([--with-twin-x11],
[build x11 GUI programs using the twin window system [default=yes]]
)],
[],
[with_twin_x11=no]
)
AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
AC_ARG_WITH(
[twin-fbdev],
[AS_HELP_STRING(
[--with-twin-fbdev],
[build frame buffer GUI programs using the twin window system [default=no]]
)],
[],
[with_twin_fbdev=no]
)
AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
AM_CONDITIONAL(
[WITH_TWIN],
[test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"])
AS_IF(
[test "x$with_twin_x11" != "xyes" && \
test "x$with_twin_fbdev" != "xyes" && \
test "x$ax_cv_curses" != "xyes"],
[AC_MSG_WARN([ No user interface programs configured. Consider using --with-ncurses, --with-twin-x11 or --with-twin-fbdev'])]
)
AS_IF(
[test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"],
[PKG_CHECK_MODULES(
[twin],
[libtwin],
[SAVE_LIBS="$LIBS" LIBS="$LIBS $twin_LIBS"
AC_CHECK_LIB(
[twin],
[twin_feature_init],
[],
[AC_MSG_FAILURE([--with-twin was given but the test for libtwin failed.])]
)
LIBS="$SAVE_LIBS"
],
[AC_MSG_RESULT([$twin_PKG_ERRORS])
AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
]
)]
)
AS_IF(
[test "x$with_twin_x11" = "xyes"],
[SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
AC_CHECK_HEADERS(
[libtwin/twin_x11.h],
[],
[AC_MSG_FAILURE([ --with-twin-x11 given but libtwin/twin_x11.h not found])]
)
CPPFLAGS="$SAVE_CPPFLAGS"
]
)
AS_IF(
[test "x$with_twin_fbdev" = "xyes"],
[SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
AC_CHECK_HEADERS(
[libtwin/twin_fbdev.h],
[],
[AC_MSG_FAILURE([ --with-twin-fbdev given but libtwin/twin_fbdev.h not found])]
)
CPPFLAGS="$SAVE_CPPFLAGS"
]
)
AC_ARG_WITH(
[signed-boot],
[AS_HELP_STRING([--with-signed-boot=@<:@no|yes|gpgme|openssl@:>@],
[Build kernel signature checking support with specified
crypto pacakge. A @<:@yes@:>@ value will first check
for gpgme then openssl and use the first found.
@<:@default=no@:>@]
)],
[AS_IF([test "x$with_signed_boot" = xno],[],
[test "x$with_signed_boot" = xyes],
[AM_PATH_GPGME([1.0.0],
[sboot=gpgme],
[AX_CHECK_OPENSSL(
[sboot=openssl],
[AC_MSG_FAILURE([--with-signed-boot=yes specified but gpgme or openssl not found])]
)]
)],
[test "x$with_signed_boot" = xgpgme],
[AM_PATH_GPGME([1.0.0],
[sboot=gpgme],
[AC_MSG_FAILURE([--with-signed-boot=gpgme specified but gpgme not found])]
)],
[test "x$with_signed_boot" = xopenssl],
[AX_CHECK_OPENSSL(
[sboot=openssl],
[AC_MSG_FAILURE([--with-signed-boot=openssl specified but openssl not found])]
)],
[AC_MSG_FAILURE([--with-signed-boot given invalid option: $with_signed_boot])]
)],
[with_signed_boot=no]
)
AM_CONDITIONAL([WITH_GPGME], [test "x$sboot" = xgpgme])
AM_CONDITIONAL([WITH_OPENSSL], [test "x$sboot" = xopenssl])
AM_CONDITIONAL([WITH_SIGNED_BOOT], [test "x$with_signed_boot" != xno])
AM_COND_IF([WITH_SIGNED_BOOT],
[AC_DEFINE([SIGNED_BOOT], 1, [Define if you have signed boot enabled])],
[])
AC_ARG_VAR(
[lockdown_file],
[Location of authorized signature file [default = "/etc/pb-lockdown"]]
)
AS_IF([test "x$lockdown_file" = x], [lockdown_file="/etc/pb-lockdown"])
AC_DEFINE_UNQUOTED(LOCKDOWN_FILE, "$lockdown_file", [Lockdown file location])
AC_ARG_VAR(
[KEYRING_PATH],
[Path to keyring (gpgme home dir) @<:@default="/etc/gpg"@:>@]
)
AS_IF([test "x$KEYRING_PATH" = x], [KEYRING_PATH="/etc/gpg"])
AC_DEFINE_UNQUOTED(KEYRING_PATH, "$KEYRING_PATH", [gpgme home dir])
AC_ARG_VAR(
[VERIFY_DIGEST],
[Signed boot signature verification digest algorithm to use (only valid in openssl) @<:@default="sha256"@:>@]
)
AS_IF([test "x$VERIFY_DIGEST" = x], [VERIFY_DIGEST="sha256"])
AC_DEFINE_UNQUOTED(VERIFY_DIGEST, "$VERIFY_DIGEST", [openssl verify dgst])
AC_ARG_ENABLE([hard-lockdown],
[AS_HELP_STRING([--enable-hard-lockdown],
[if signed boot configured, the absence of the
LOCKDOWN_FILE does not disable signed boot at
runtime @<:@default=no@:>@])],
[AC_DEFINE(HARD_LOCKDOWN, 1, [Enable hard lockdown])],
[])
AC_ARG_ENABLE(
[busybox],
[AS_HELP_STRING(
[--enable-busybox],
[build programs with extra support for busybox [default=no]])
],
[],
[enable_busybox=no]
)
AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
AS_IF([test "x$enable_busybox" = "xyes"],
[AC_DEFINE(WITH_BUSYBOX, 1, [Busybox environment enabled])],
[]
)
AC_ARG_ENABLE(
[mtd],
[AS_HELP_STRING(
[--enable-mtd],
[Add support for MTD devices on certain platforms [default=no]]
)],
[],
[enable_mtd=no]
)
AM_CONDITIONAL([ENABLE_MTD], [test "x$enable_mtd" = "xyes"])
AS_IF([test "x$enable_mtd" = "xyes"],
[AC_DEFINE(MTD_SUPPORT, 1, [Enable MTD support])],
[]
)
AS_IF(
[test "x$enable_mtd" = "xyes"],
AC_CHECK_LIB([flash], [arch_flash_init],
[LIBFLASH_LIBS=-lflash],
[AC_MSG_FAILURE([--enable-mtd requires the libflash library])]
)
)
AS_IF(
[test "x$enable_mtd" = "xyes"],
[SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $libflash_CFLAGS"
AC_CHECK_HEADERS(
[libflash/libflash.h],
[],
[AC_MSG_FAILURE([--enable-mtd given but libflash/libflash.h not found])]
)
CPPFLAGS="$SAVE_CPPFLAGS"
]
)
# platform choice
AC_ARG_ENABLE(
[platform-all],
[AS_HELP_STRING(
[--enable-platform-all],
[build support for all platforms [default=no]]
)]
)
AS_IF(
[test "x$enable_platform_all" = "xyes"],
[enable_platform_arm64="yes"; enable_platform_powerpc="yes"; enable_platform_ps3="yes"]
)
AC_ARG_ENABLE(
[platform-auto],
[AS_HELP_STRING(
[--enable-platform-auto],
[auto detect platform support to build [default=yes]]
)],
[],
[enable_platform_auto="yes"]
)
AS_IF(
[test "x$enable_platform_auto" = "xyes"],
[AS_CASE([$host],
[aarch64-*-*], [enable_platform_arm64="yes"],
[powerpc*-*-*], [enable_platform_powerpc="yes"],
)]
)
AC_ARG_ENABLE(
[platform-arm64],
[AS_HELP_STRING(
[--enable-platform-arm64],
[build support for arm64 platforms [default=no]]
)]
)
AM_CONDITIONAL([PLATFORM_ARM64], [test "x$enable_platform_arm64" = "xyes"])
AC_ARG_ENABLE(
[platform-powerpc],
[AS_HELP_STRING(
[--enable-platform-powerpc],
[build support for powerpc platforms [default=no]]
)]
)
AM_CONDITIONAL([PLATFORM_POWERPC], [test "x$enable_platform_powerpc" = "xyes"])
AC_ARG_ENABLE(
[platform-ps3],
[AS_HELP_STRING(
[--enable-platform-ps3],
[build support for the PS3 game console [default=no]]
)])
AM_CONDITIONAL([PLATFORM_PS3], [test "x$enable_platform_ps3" = "xyes"])
AC_ARG_ENABLE(
[debug],
[AS_HELP_STRING([--enable-debug],
[build programs with extra debug info [default=no]]
)],
[],
[enable_debug=check]
)
AC_ARG_ENABLE(
[test-valgrind],
[AS_HELP_STRING([--enable-test-valgrind],
[run all tests with valgrind]
)],
)
AM_CONDITIONAL([ENABLE_TEST_VALGRIND], [test "x$enable_test_valgrind" = "xyes"])
# host program paths
AC_DEFUN([DEFINE_HOST_PROG],
[
AC_ARG_VAR([HOST_PROG_$1], [Path to "$2" on the host [default $3]])
if test "x$HOST_PROG_$1" = "x"; then
HOST_PROG_$1="$3"
fi
AC_DEFINE_UNQUOTED(HOST_PROG_$1, ["$HOST_PROG_$1"],
[Path to "$2" on the host])
])
DEFINE_HOST_PROG(CP, cp, [/bin/cp])
DEFINE_HOST_PROG(KEXEC, kexec, [/sbin/kexec])
DEFINE_HOST_PROG(MOUNT, mount, [/bin/mount])
DEFINE_HOST_PROG(SHUTDOWN, shutdown, [/sbin/shutdown])
DEFINE_HOST_PROG(SFTP, sftp, [/usr/bin/sftp])
DEFINE_HOST_PROG(TFTP, tftp, [/usr/bin/tftp])
DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount])
DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget])
DEFINE_HOST_PROG(IP, ip, [/sbin/ip])
DEFINE_HOST_PROG(UDHCPC, udhcpc, [/sbin/udhcpc])
DEFINE_HOST_PROG(UDHCPC6, udhcpc6, [/usr/bin/udhcpc6])
DEFINE_HOST_PROG(VGSCAN, vgscan, [/usr/sbin/vgscan])
DEFINE_HOST_PROG(VGCHANGE, vgchange, [/usr/sbin/vgchange])
DEFINE_HOST_PROG(PB_PLUGIN, pb-plugin, [/usr/sbin/pb-plugin])
DEFINE_HOST_PROG(PB_EXEC, pb-exec, [/usr/sbin/pb-exec])
DEFINE_HOST_PROG(SH, sh, [/bin/sh])
DEFINE_HOST_PROG(SCSI_RESCAN, scsi-rescan, [/usr/sbin/scsi-rescan])
DEFINE_HOST_PROG(DMIDECODE, dmidecode, [/sbin/dmidecode])
DEFINE_HOST_PROG(CRYPTSETUP, CRYPTSETUP, [/usr/sbin/cryptsetup])
AC_ARG_WITH(
[tftp],
[AS_HELP_STRING([--with-tftp=TYPE],
[Use TYPE-type ftp client (either hpa or busybox) [default=runtime-check]]
)],
[],
[with_tftp=detect]
)
case x$with_tftp in
'xhpa')
tftp_type='TFTP_TYPE_HPA'
;;
'xbusybox')
tftp_type='TFTP_TYPE_BUSYBOX'
;;
*)
tftp_type='TFTP_TYPE_UNKNOWN'
;;
esac
AC_DEFINE_UNQUOTED(TFTP_TYPE, $tftp_type, [tftp client type])
default_cflags="--std=gnu99 -g \
-Wall -W -Wunused -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls"
AC_ARG_ENABLE(
[werror],
[AS_HELP_STRING([--enable-werror],
[build programs with -Werror]
)],
[default_cflags="$default_cflags -Werror"]
)
AS_IF(
[test "x$enable_debug" = "xyes"],
[
AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O0"])
AC_SUBST([DEFAULT_CPPFLAGS], ["-DDEBUG"])
],
[
AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2"])
AC_SUBST([DEFAULT_CPPFLAGS], ["-DNDEBUG"])
]
)
AC_SUBST([UDEV_LIBS])
AC_SUBST([ELF_LIBS])
AC_SUBST([DEVMAPPER_LIBS])
AC_SUBST([CRYPT_LIBS])
AC_SUBST([FDT_LIBS])
AC_SUBST([LIBFLASH_LIBS])
AC_SUBST([LIBTOOL_DEPS])
AC_SUBST([DESTDIR])
AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
po/Makefile.in
])
AC_OUTPUT