+ 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_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"])
+
+AC_ARG_ENABLE(
+ [ps3],
+ [AS_HELP_STRING(
+ [--enable-ps3],
+ [build additional programs for the PS3 game console [default=no]]
+ )],
+ [],
+ [enable_ps3=no]
+)
+AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
+
+AC_ARG_ENABLE(
+ [debug],
+ [AS_HELP_STRING([--enable-debug],
+ [build programs with extra debug info [default=no]]
+ )],
+ [],
+ [enable_debug=check]
+)
+#AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
+
+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])
+
+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 -DDEBUG"])],
+ [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2 -DNDEBUG"])]
+)
+
+
+AC_SUBST([LIBTOOL_DEPS])
+AC_SUBST([DESTDIR])
+AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"])
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([
+ Makefile
+ discover/Makefile
+ discover/grub2/Makefile
+ lib/Makefile
+ man/Makefile
+ test/Makefile
+ test/lib/Makefile
+ test/parser/Makefile
+ test/urls/Makefile
+ ui/Makefile
+ ui/common/Makefile
+ ui/ncurses/Makefile
+ ui/test/Makefile
+ ui/twin/Makefile
+ utils/Makefile
+])