]> git.ozlabs.org Git - petitboot/blobdiff - configure.ac
lib/flash: Check if the partition is signed
[petitboot] / configure.ac
index 9511fefa8e14bfe659424d5ec760b5493dce9b9d..2bf6e6f64f3afe4748c0382b12ff634186086c8b 100644 (file)
@@ -16,7 +16,7 @@
 
 AC_INIT([petitboot],
     [m4_esyscmd_s([./version.sh])],
-    [Geoff Levand <geoff@infradead.org>])
+    [https://lists.ozlabs.org/listinfo/petitboot])
 
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -26,15 +26,26 @@ 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.18.1)
+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
@@ -55,6 +66,26 @@ AC_CHECK_LIB([udev], [udev_new],
        [AC_MSG_FAILURE([The libudev development library is required by petitboot.  Try installing the package libudev-dev or libudev-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_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])
 
@@ -85,7 +116,7 @@ AC_ARG_WITH(
                [build x11 GUI programs using the twin window system [default=yes]]
        )],
        [],
-       [with_twin_x11=yes]
+       [with_twin_x11=no]
 )
 AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
 
@@ -96,7 +127,7 @@ AC_ARG_WITH(
                [build frame buffer GUI programs using the twin window system [default=no]]
        )],
        [],
-       [with_twin_fbdev=yes]
+       [with_twin_fbdev=no]
 )
 AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
 
@@ -104,6 +135,13 @@ 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(
@@ -148,6 +186,74 @@ AS_IF(
        ]
 )
 
+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(
@@ -157,18 +263,101 @@ AC_ARG_ENABLE(
        [],
        [enable_busybox=no]
 )
-#AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
+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(
-       [ps3],
+       [mtd],
        [AS_HELP_STRING(
-               [--enable-ps3],
-               [build additional programs for the PS3 game console [default=no]]
+               [--enable-mtd],
+               [Add support for MTD devices on certain platforms [default=no]]
        )],
        [],
-       [enable_ps3=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])]
+               )
 )
-AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
+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],
@@ -178,7 +367,6 @@ AC_ARG_ENABLE(
        [],
        [enable_debug=check]
 )
-#AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
 
 AC_ARG_ENABLE(
        [test-valgrind],
@@ -209,6 +397,14 @@ 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])
 
 AC_ARG_WITH(
     [tftp],
@@ -258,6 +454,9 @@ AS_IF(
 )
  
 AC_SUBST([UDEV_LIBS])
+AC_SUBST([DEVMAPPER_LIBS])
+AC_SUBST([FDT_LIBS])
+AC_SUBST([LIBFLASH_LIBS])
 AC_SUBST([LIBTOOL_DEPS])
 AC_SUBST([DESTDIR])
 AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"])