ui/ncurses: Validate URL field
[petitboot] / configure.ac
index 08685ec02feb765c755afab9f884ac5fb4474398..2456194a55c3883c982f0a704ca0cf2c19aa53f0 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,7 +26,13 @@ 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
@@ -57,6 +63,16 @@ 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)]))
@@ -160,6 +176,69 @@ AS_IF(
        ]
 )
 
+AC_ARG_WITH(
+       [signed-boot],
+       [AS_HELP_STRING([--with-signed-boot],
+               [build kernel signature checking support [default=no]]
+       )],
+       [],
+       [with_signed_boot=no]
+)
+
+AM_CONDITIONAL(
+       [WITH_SIGNED_BOOT],
+       [test "x$with_signed_boot" = "xyes"])
+
+AS_IF(
+       [test "x$with_signed_boot" = "xyes"],
+       [PKG_CHECK_MODULES(
+               [GPGME],
+               [gpgme >= 1.0.0],
+               [SAVE_LIBS="$LIBS" LIBS="$LIBS $gpgme_LIBS"
+                       AC_CHECK_LIB(
+                               [gpgme],
+                               [gpgme_op_verify],
+                               [],
+                               [AC_MSG_FAILURE([--with-signed-boot was given but the test for gpgme failed.])]
+                       )
+                       LIBS="$SAVE_LIBS"
+               ],
+               [AM_PATH_GPGME([1.0.0], [SAVE_LIBS="$LIBS" LIBS="$LIBS $gpgme_LIBS"
+                       AC_CHECK_LIB(
+                               [gpgme],
+                               [gpgme_op_verify],
+                               [],
+                               [AC_MSG_FAILURE([--with-signed-boot was given but the test for gpgme failed.])]
+                       )
+                       LIBS="$SAVE_LIBS"],
+                       [AC_MSG_RESULT([$gpgme_PKG_ERRORS])
+                               AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
+                       ])
+               ]
+       )]
+)
+
+AS_IF(
+       [test "x$with_signed_boot" = "xyes"],
+       [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $gpgme_CFLAGS"
+               AC_CHECK_HEADERS(
+                       [gpgme.h],
+                       [],
+                       [AC_MSG_FAILURE([ --with-signed-boot given but gpgme.h not found])]
+               )
+               CPPFLAGS="$SAVE_CPPFLAGS"
+       ]
+)
+
+AM_CONDITIONAL([WITH_GPGME], [test "x$with_signed_boot" = "xyes"])
+
+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_ENABLE(
        [busybox],
        [AS_HELP_STRING(
@@ -169,7 +248,11 @@ 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(
        [mtd],
@@ -186,6 +269,25 @@ AS_IF([test "x$enable_mtd" = "xyes"],
       []
 )
 
+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"
+       ]
+)
+
 AC_ARG_ENABLE(
        [ps3],
        [AS_HELP_STRING(
@@ -236,6 +338,11 @@ 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(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])
 
 AC_ARG_WITH(
     [tftp],
@@ -285,7 +392,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}"])