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], [""])])
35 AM_CONDITIONAL([WITH_NCURSES], [test "x$ax_cv_curses" = "xyes"])
37 if test "x$ax_cv_curses" = xyes; then
38 if test "x$ax_cv_menu" != xyes; then
39 AC_MSG_ERROR([--with-ncurses requires the ncurses menu library])
41 if test "x$ax_cv_form" != xyes; then
42 AC_MSG_ERROR([--with-ncurses requires the ncurses form library])
46 AC_CHECK_LIB([udev], [udev_new],
48 [AC_MSG_FAILURE([The libudev development library is required by petitboot. Try installing the package libudev-dev or libudev-devel.])]
51 AC_CHECK_HEADERS([stdarg.h])
52 AC_CHECK_HEADERS([varargs.h])
54 dnl Checking for va_copy availability
55 AC_MSG_CHECKING([for va_copy])
56 AC_TRY_LINK([#include <stdarg.h>
57 va_list ap1,ap2;], [va_copy(ap1,ap2);],
60 AC_MSG_RESULT($have_va_copy)
61 if test x"$have_va_copy" = x"yes"; then
62 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
64 AC_MSG_CHECKING([for __va_copy])
65 AC_TRY_LINK([#include <stdarg.h>
66 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
69 AC_MSG_RESULT($have___va_copy)
70 if test x"$have___va_copy" = x"yes"; then
71 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
77 [AS_HELP_STRING([--with-twin-x11],
78 [build x11 GUI programs using the twin window system [default=yes]]
83 AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
89 [build frame buffer GUI programs using the twin window system [default=no]]
94 AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
98 [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"])
101 [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"],
105 [SAVE_LIBS="$LIBS" LIBS="$LIBS $twin_LIBS"
110 [AC_MSG_FAILURE([--with-twin was given but the test for libtwin failed.])]
114 [AC_MSG_RESULT([$twin_PKG_ERRORS])
115 AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
121 [test "x$with_twin_x11" = "xyes"],
122 [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
124 [libtwin/twin_x11.h],
126 [AC_MSG_FAILURE([ --with-twin-x11 given but libtwin/twin_x11.h not found])]
128 CPPFLAGS="$SAVE_CPPFLAGS"
133 [test "x$with_twin_fbdev" = "xyes"],
134 [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
136 [libtwin/twin_fbdev.h],
138 [AC_MSG_FAILURE([ --with-twin-fbdev given but libtwin/twin_fbdev.h not found])]
140 CPPFLAGS="$SAVE_CPPFLAGS"
148 [build programs with extra support for busybox [default=no]])
153 #AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
159 [build additional programs for the PS3 game console [default=no]]
164 AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
168 [AS_HELP_STRING([--enable-debug],
169 [build programs with extra debug info [default=no]]
174 #AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
177 AC_DEFUN([DEFINE_HOST_PROG],
179 AC_ARG_VAR([HOST_PROG_$1], [Path to "$2" on the host [default $3]])
180 if test "x$HOST_PROG_$1" = "x"; then
183 AC_DEFINE_UNQUOTED(HOST_PROG_$1, ["$HOST_PROG_$1"],
184 [Path to "$2" on the host])
187 DEFINE_HOST_PROG(CP, cp, [/bin/cp])
188 DEFINE_HOST_PROG(KEXEC, kexec, [/sbin/kexec])
189 DEFINE_HOST_PROG(MOUNT, mount, [/bin/mount])
190 DEFINE_HOST_PROG(SHUTDOWN, shutdown, [/sbin/shutdown])
191 DEFINE_HOST_PROG(SFTP, sftp, [/usr/bin/sftp])
192 DEFINE_HOST_PROG(TFTP, tftp, [/usr/bin/tftp])
193 DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount])
194 DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget])
195 DEFINE_HOST_PROG(IP, ip, [/sbin/ip])
196 DEFINE_HOST_PROG(UDHCPC, udhcpc, [/sbin/udhcpc])
198 default_cflags="--std=gnu99 -g \
199 -Wall -W -Wunused -Wstrict-prototypes -Wmissing-prototypes \
200 -Wmissing-declarations -Wredundant-decls"
204 [AS_HELP_STRING([--enable-werror],
205 [build programs with -Werror]
207 [default_cflags="$default_cflags -Werror"]
211 [test "x$enable_debug" = "xyes"],
212 [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O0 -DDEBUG"])],
213 [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2 -DNDEBUG"])]
217 AC_SUBST([LIBTOOL_DEPS])
219 AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"])
221 AC_CONFIG_HEADERS([config.h])