1 ## configure.ac -- Process this file with autoconf to produce configure
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; version 2 of the License.
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License
13 # along with this program; if not, write to the Free Software
14 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 AC_INIT([petitboot], [@version@], [Geoff Levand <geoff@infradead.org>])
19 AC_CONFIG_MACRO_DIR([m4])
21 AC_PREFIX_DEFAULT([/usr/local])
23 AS_IF([test "x$CFLAGS" = "x"], [AC_SUBST([CFLAGS], [""])])
37 AM_CONDITIONAL([WITH_NCURSES], [test "x$ax_cv_curses" = "xyes"])
39 if test "x$ax_cv_curses" = xyes; then
40 if test "x$ax_cv_menu" != xyes; then
41 AC_MSG_ERROR([--with-ncurses requires the ncurses menu library])
43 if test "x$ax_cv_form" != xyes; then
44 AC_MSG_ERROR([--with-ncurses requires the ncurses form library])
48 AC_CHECK_LIB([udev], [udev_new],
50 [AC_MSG_FAILURE([The libudev development library is required by petitboot. Try installing the package libudev-dev or libudev-devel.])]
53 AC_CHECK_HEADERS([stdarg.h])
54 AC_CHECK_HEADERS([varargs.h])
56 dnl Checking for va_copy availability
57 AC_MSG_CHECKING([for va_copy])
58 AC_TRY_LINK([#include <stdarg.h>
59 va_list ap1,ap2;], [va_copy(ap1,ap2);],
62 AC_MSG_RESULT($have_va_copy)
63 if test x"$have_va_copy" = x"yes"; then
64 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
66 AC_MSG_CHECKING([for __va_copy])
67 AC_TRY_LINK([#include <stdarg.h>
68 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
71 AC_MSG_RESULT($have___va_copy)
72 if test x"$have___va_copy" = x"yes"; then
73 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
79 [AS_HELP_STRING([--with-twin-x11],
80 [build x11 GUI programs using the twin window system [default=yes]]
85 AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
91 [build frame buffer GUI programs using the twin window system [default=no]]
96 AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
100 [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"])
103 [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"],
107 [SAVE_LIBS="$LIBS" LIBS="$LIBS $twin_LIBS"
112 [AC_MSG_FAILURE([--with-twin was given but the test for libtwin failed.])]
116 [AC_MSG_RESULT([$twin_PKG_ERRORS])
117 AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
123 [test "x$with_twin_x11" = "xyes"],
124 [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
126 [libtwin/twin_x11.h],
128 [AC_MSG_FAILURE([ --with-twin-x11 given but libtwin/twin_x11.h not found])]
130 CPPFLAGS="$SAVE_CPPFLAGS"
135 [test "x$with_twin_fbdev" = "xyes"],
136 [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
138 [libtwin/twin_fbdev.h],
140 [AC_MSG_FAILURE([ --with-twin-fbdev given but libtwin/twin_fbdev.h not found])]
142 CPPFLAGS="$SAVE_CPPFLAGS"
150 [build programs with extra support for busybox [default=no]])
155 #AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
161 [build additional programs for the PS3 game console [default=no]]
166 AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
170 [AS_HELP_STRING([--enable-debug],
171 [build programs with extra debug info [default=no]]
176 #AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
180 [AS_HELP_STRING([--enable-test-valgrind],
181 [run all tests with valgrind]
184 AM_CONDITIONAL([ENABLE_TEST_VALGRIND], [test "x$enable_test_valgrind" = "xyes"])
187 AC_DEFUN([DEFINE_HOST_PROG],
189 AC_ARG_VAR([HOST_PROG_$1], [Path to "$2" on the host [default $3]])
190 if test "x$HOST_PROG_$1" = "x"; then
193 AC_DEFINE_UNQUOTED(HOST_PROG_$1, ["$HOST_PROG_$1"],
194 [Path to "$2" on the host])
197 DEFINE_HOST_PROG(CP, cp, [/bin/cp])
198 DEFINE_HOST_PROG(KEXEC, kexec, [/sbin/kexec])
199 DEFINE_HOST_PROG(MOUNT, mount, [/bin/mount])
200 DEFINE_HOST_PROG(SHUTDOWN, shutdown, [/sbin/shutdown])
201 DEFINE_HOST_PROG(SFTP, sftp, [/usr/bin/sftp])
202 DEFINE_HOST_PROG(TFTP, tftp, [/usr/bin/tftp])
203 DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount])
204 DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget])
205 DEFINE_HOST_PROG(IP, ip, [/sbin/ip])
206 DEFINE_HOST_PROG(UDHCPC, udhcpc, [/sbin/udhcpc])
210 [AS_HELP_STRING([--with-tftp=TYPE],
211 [Use TYPE-type ftp client (either hpa or busybox) [default=runtime-check]]
219 tftp_type='TFTP_TYPE_HPA'
222 tftp_type='TFTP_TYPE_BUSYBOX'
225 tftp_type='TFTP_TYPE_UNKNOWN'
229 AC_DEFINE_UNQUOTED(TFTP_TYPE, $tftp_type, [tftp client type])
231 default_cflags="--std=gnu99 -g \
232 -Wall -W -Wunused -Wstrict-prototypes -Wmissing-prototypes \
233 -Wmissing-declarations -Wredundant-decls"
237 [AS_HELP_STRING([--enable-werror],
238 [build programs with -Werror]
240 [default_cflags="$default_cflags -Werror"]
244 [test "x$enable_debug" = "xyes"],
245 [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O0 -DDEBUG"])],
246 [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2 -DNDEBUG"])]
250 AC_SUBST([LIBTOOL_DEPS])
252 AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"])
254 AC_CONFIG_HEADERS([config.h])
258 discover/grub2/Makefile