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
18 [m4_esyscmd_s([./version.sh])],
19 [Geoff Levand <geoff@infradead.org>])
21 AC_CONFIG_MACRO_DIR([m4])
23 AC_PREFIX_DEFAULT([/usr/local])
25 AS_IF([test "x$CFLAGS" = "x"], [AC_SUBST([CFLAGS], [""])])
34 AM_GNU_GETTEXT([external])
35 AM_GNU_GETTEXT_VERSION(0.18.1)
38 AM_SILENT_RULES([yes])
44 AM_CONDITIONAL([WITH_NCURSES], [test "x$ax_cv_curses" = "xyes"])
46 if test "x$ax_cv_curses" = xyes; then
47 if test "x$ax_cv_menu" != xyes; then
48 AC_MSG_ERROR([--with-ncurses requires the ncurses menu library])
50 if test "x$ax_cv_form" != xyes; then
51 AC_MSG_ERROR([--with-ncurses requires the ncurses form library])
55 AC_CHECK_LIB([udev], [udev_new],
57 [AC_MSG_FAILURE([The libudev development library is required by petitboot. Try installing the package libudev-dev or libudev-devel.])]
60 PKG_CHECK_EXISTS(libudev >= 218, [old_udev=no], [old_udev=yes])
61 if test "$old_udev" = "yes" ; then
62 AC_DEFINE(UDEV_LOGGING, 1, [Support old udev logging interface])],
65 AC_CHECK_LIB([devmapper], [dm_task_create],
66 [DEVMAPPER_LIBS=-ldevmapper],
67 [AC_MSG_FAILURE([The libdevmapper development library is required by petitboot. Try installing the package libdevmapper-dev or libdevmapper-devel.])]
71 AS_HELP_STRING([--without-fdt],
72 [Build without libfdt (default: no)]))
74 AS_IF([test "x$with_fdt" != "xno"],
75 AC_CHECK_LIB([fdt], [fdt_check_header],
76 [FDT_LIBS=-lfdt; have_libfdt=yes]))
78 AM_CONDITIONAL([HAVE_LIBFDT], [test x"$have_libfdt" = xyes])
80 AC_CHECK_HEADERS([stdarg.h])
81 AC_CHECK_HEADERS([varargs.h])
83 dnl Checking for va_copy availability
84 AC_MSG_CHECKING([for va_copy])
85 AC_TRY_LINK([#include <stdarg.h>
86 va_list ap1,ap2;], [va_copy(ap1,ap2);],
89 AC_MSG_RESULT($have_va_copy)
90 if test x"$have_va_copy" = x"yes"; then
91 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
93 AC_MSG_CHECKING([for __va_copy])
94 AC_TRY_LINK([#include <stdarg.h>
95 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
98 AC_MSG_RESULT($have___va_copy)
99 if test x"$have___va_copy" = x"yes"; then
100 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
106 [AS_HELP_STRING([--with-twin-x11],
107 [build x11 GUI programs using the twin window system [default=yes]]
112 AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
118 [build frame buffer GUI programs using the twin window system [default=no]]
121 [with_twin_fbdev=yes]
123 AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
127 [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"])
130 [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"],
134 [SAVE_LIBS="$LIBS" LIBS="$LIBS $twin_LIBS"
139 [AC_MSG_FAILURE([--with-twin was given but the test for libtwin failed.])]
143 [AC_MSG_RESULT([$twin_PKG_ERRORS])
144 AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
150 [test "x$with_twin_x11" = "xyes"],
151 [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
153 [libtwin/twin_x11.h],
155 [AC_MSG_FAILURE([ --with-twin-x11 given but libtwin/twin_x11.h not found])]
157 CPPFLAGS="$SAVE_CPPFLAGS"
162 [test "x$with_twin_fbdev" = "xyes"],
163 [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
165 [libtwin/twin_fbdev.h],
167 [AC_MSG_FAILURE([ --with-twin-fbdev given but libtwin/twin_fbdev.h not found])]
169 CPPFLAGS="$SAVE_CPPFLAGS"
177 [build programs with extra support for busybox [default=no]])
182 #AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
188 [Add support for MTD devices on certain platforms [default=no]]
193 AM_CONDITIONAL([ENABLE_MTD], [test "x$enable_mtd" = "xyes"])
194 AS_IF([test "x$enable_mtd" = "xyes"],
195 [AC_DEFINE(MTD_SUPPORT, 1, [Enable MTD support])],
200 [test "x$enable_mtd" = "xyes"],
201 AC_CHECK_LIB([flash], [arch_flash_init],
202 [LIBFLASH_LIBS=-lflash],
203 [AC_MSG_FAILURE([--enable-mtd requires the libflash library])]
207 [test "x$enable_mtd" = "xyes"],
208 [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $libflash_CFLAGS"
210 [libflash/libflash.h],
212 [AC_MSG_FAILURE([--enable-mtd given but libflash/libflash.h not found])]
214 CPPFLAGS="$SAVE_CPPFLAGS"
222 [build additional programs for the PS3 game console [default=no]]
227 AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
231 [AS_HELP_STRING([--enable-debug],
232 [build programs with extra debug info [default=no]]
237 #AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
241 [AS_HELP_STRING([--enable-test-valgrind],
242 [run all tests with valgrind]
245 AM_CONDITIONAL([ENABLE_TEST_VALGRIND], [test "x$enable_test_valgrind" = "xyes"])
248 AC_DEFUN([DEFINE_HOST_PROG],
250 AC_ARG_VAR([HOST_PROG_$1], [Path to "$2" on the host [default $3]])
251 if test "x$HOST_PROG_$1" = "x"; then
254 AC_DEFINE_UNQUOTED(HOST_PROG_$1, ["$HOST_PROG_$1"],
255 [Path to "$2" on the host])
258 DEFINE_HOST_PROG(CP, cp, [/bin/cp])
259 DEFINE_HOST_PROG(KEXEC, kexec, [/sbin/kexec])
260 DEFINE_HOST_PROG(MOUNT, mount, [/bin/mount])
261 DEFINE_HOST_PROG(SHUTDOWN, shutdown, [/sbin/shutdown])
262 DEFINE_HOST_PROG(SFTP, sftp, [/usr/bin/sftp])
263 DEFINE_HOST_PROG(TFTP, tftp, [/usr/bin/tftp])
264 DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount])
265 DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget])
266 DEFINE_HOST_PROG(IP, ip, [/sbin/ip])
267 DEFINE_HOST_PROG(UDHCPC, udhcpc, [/sbin/udhcpc])
271 [AS_HELP_STRING([--with-tftp=TYPE],
272 [Use TYPE-type ftp client (either hpa or busybox) [default=runtime-check]]
280 tftp_type='TFTP_TYPE_HPA'
283 tftp_type='TFTP_TYPE_BUSYBOX'
286 tftp_type='TFTP_TYPE_UNKNOWN'
290 AC_DEFINE_UNQUOTED(TFTP_TYPE, $tftp_type, [tftp client type])
292 default_cflags="--std=gnu99 -g \
293 -Wall -W -Wunused -Wstrict-prototypes -Wmissing-prototypes \
294 -Wmissing-declarations -Wredundant-decls"
298 [AS_HELP_STRING([--enable-werror],
299 [build programs with -Werror]
301 [default_cflags="$default_cflags -Werror"]
305 [test "x$enable_debug" = "xyes"],
307 AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O0"])
308 AC_SUBST([DEFAULT_CPPFLAGS], ["-DDEBUG"])
311 AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2"])
312 AC_SUBST([DEFAULT_CPPFLAGS], ["-DNDEBUG"])
316 AC_SUBST([UDEV_LIBS])
317 AC_SUBST([DEVMAPPER_LIBS])
319 AC_SUBST([LIBFLASH_LIBS])
320 AC_SUBST([LIBTOOL_DEPS])
322 AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"])
324 AC_CONFIG_HEADERS([config.h])