discover/boot: Fix log message with no newline
[petitboot] / configure.ac.in
1 ## configure.ac -- Process this file with autoconf to produce configure
2 #
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.
6 #
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.
11 #
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
15 #
16
17 AC_INIT([petitboot], [@version@], [Geoff Levand <geoff@infradead.org>])
18
19 AC_CONFIG_MACRO_DIR([m4])
20
21 AC_PREFIX_DEFAULT([/usr/local])
22
23 AS_IF([test "x$CFLAGS" = "x"], [AC_SUBST([CFLAGS], [""])])
24
25 AC_PROG_CC
26 AC_PROG_INSTALL
27
28 AM_INIT_AUTOMAKE
29 LT_INIT
30
31 AX_WITH_CURSES
32 AX_WITH_CURSES_MENU
33 AX_WITH_CURSES_FORM
34
35 AM_CONDITIONAL([WITH_NCURSES], [test "x$ax_cv_curses" = "xyes"])
36
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])
40         fi
41         if test "x$ax_cv_form" != xyes; then
42                 AC_MSG_ERROR([--with-ncurses requires the ncurses form library])
43         fi
44 fi
45
46 AC_CHECK_LIB([udev], [udev_new],
47         [],
48         [AC_MSG_FAILURE([The libudev development library is required by petitboot.  Try installing the package libudev-dev or libudev-devel.])]
49 )
50
51 AC_CHECK_HEADERS([stdarg.h])
52 AC_CHECK_HEADERS([varargs.h])
53
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);],
58 have_va_copy=yes,
59 have_va_copy=no)
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])
63 else
64     AC_MSG_CHECKING([for __va_copy])
65     AC_TRY_LINK([#include <stdarg.h>
66     va_list ap1,ap2;], [__va_copy(ap1,ap2);],
67     have___va_copy=yes,
68     have___va_copy=no)
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])
72     fi
73 fi
74
75 AC_ARG_WITH(
76         [twin-x11],
77         [AS_HELP_STRING([--with-twin-x11],
78                 [build x11 GUI programs using the twin window system [default=yes]]
79         )],
80         [],
81         [with_twin_x11=yes]
82 )
83 AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
84
85 AC_ARG_WITH(
86         [twin-fbdev],
87         [AS_HELP_STRING(
88                 [--with-twin-fbdev],
89                 [build frame buffer GUI programs using the twin window system [default=no]]
90         )],
91         [],
92         [with_twin_fbdev=yes]
93 )
94 AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
95
96 AM_CONDITIONAL(
97         [WITH_TWIN],
98         [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"])
99
100 AS_IF(
101         [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"],
102         [PKG_CHECK_MODULES(
103                 [twin],
104                 [libtwin],
105                 [SAVE_LIBS="$LIBS" LIBS="$LIBS $twin_LIBS"
106                         AC_CHECK_LIB(
107                                 [twin],
108                                 [twin_feature_init],
109                                 [],
110                                 [AC_MSG_FAILURE([--with-twin was given but the test for libtwin failed.])]
111                         )
112                         LIBS="$SAVE_LIBS"
113                 ],
114                 [AC_MSG_RESULT([$twin_PKG_ERRORS])
115                         AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
116                 ]
117         )]
118 )
119
120 AS_IF(
121         [test "x$with_twin_x11" = "xyes"],
122         [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
123                 AC_CHECK_HEADERS(
124                         [libtwin/twin_x11.h],
125                         [],
126                         [AC_MSG_FAILURE([ --with-twin-x11 given but libtwin/twin_x11.h not found])]
127                 )
128                 CPPFLAGS="$SAVE_CPPFLAGS"
129         ]
130 )
131
132 AS_IF(
133         [test "x$with_twin_fbdev" = "xyes"],
134         [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
135                 AC_CHECK_HEADERS(
136                         [libtwin/twin_fbdev.h],
137                         [],
138                         [AC_MSG_FAILURE([ --with-twin-fbdev given but libtwin/twin_fbdev.h not found])]
139                 )
140                 CPPFLAGS="$SAVE_CPPFLAGS"
141         ]
142 )
143
144 AC_ARG_ENABLE(
145         [busybox],
146         [AS_HELP_STRING(
147                 [--enable-busybox],
148                 [build programs with extra support for busybox [default=no]])
149         ],
150         [],
151         [enable_busybox=no]
152 )
153 #AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
154
155 AC_ARG_ENABLE(
156         [ps3],
157         [AS_HELP_STRING(
158                 [--enable-ps3],
159                 [build additional programs for the PS3 game console [default=no]]
160         )],
161         [],
162         [enable_ps3=no]
163 )
164 AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
165
166 AC_ARG_ENABLE(
167         [debug],
168         [AS_HELP_STRING([--enable-debug],
169                 [build programs with extra debug info [default=no]]
170         )],
171         [],
172         [enable_debug=check]
173 )
174 #AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
175
176 AC_ARG_ENABLE(
177         [test-valgrind],
178         [AS_HELP_STRING([--enable-test-valgrind],
179                 [run all tests with valgrind]
180         )],
181 )
182 AM_CONDITIONAL([ENABLE_TEST_VALGRIND], [test "x$enable_test_valgrind" = "xyes"])
183
184 # host program paths
185 AC_DEFUN([DEFINE_HOST_PROG],
186         [
187                 AC_ARG_VAR([HOST_PROG_$1], [Path to "$2" on the host [default $3]])
188                 if test "x$HOST_PROG_$1" = "x"; then
189                         HOST_PROG_$1="$3"
190                 fi
191                 AC_DEFINE_UNQUOTED(HOST_PROG_$1, ["$HOST_PROG_$1"],
192                                 [Path to "$2" on the host])
193         ])
194
195 DEFINE_HOST_PROG(CP, cp, [/bin/cp])
196 DEFINE_HOST_PROG(KEXEC, kexec, [/sbin/kexec])
197 DEFINE_HOST_PROG(MOUNT, mount, [/bin/mount])
198 DEFINE_HOST_PROG(SHUTDOWN, shutdown, [/sbin/shutdown])
199 DEFINE_HOST_PROG(SFTP, sftp, [/usr/bin/sftp])
200 DEFINE_HOST_PROG(TFTP, tftp, [/usr/bin/tftp])
201 DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount])
202 DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget])
203 DEFINE_HOST_PROG(IP, ip, [/sbin/ip])
204 DEFINE_HOST_PROG(UDHCPC, udhcpc, [/sbin/udhcpc])
205
206 default_cflags="--std=gnu99 -g \
207         -Wall -W -Wunused -Wstrict-prototypes -Wmissing-prototypes \
208         -Wmissing-declarations -Wredundant-decls"
209
210 AC_ARG_ENABLE(
211         [werror],
212         [AS_HELP_STRING([--enable-werror],
213                 [build programs with -Werror]
214         )],
215         [default_cflags="$default_cflags -Werror"]
216 )
217
218 AS_IF(
219         [test "x$enable_debug" = "xyes"],
220         [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O0 -DDEBUG"])],
221         [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2 -DNDEBUG"])]
222 )
223  
224
225 AC_SUBST([LIBTOOL_DEPS])
226 AC_SUBST([DESTDIR])
227 AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"])
228
229 AC_CONFIG_HEADERS([config.h])
230 AC_CONFIG_FILES([
231         Makefile
232         discover/Makefile
233         lib/Makefile
234         man/Makefile
235         test/Makefile
236         test/lib/Makefile
237         test/parser/Makefile
238         test/urls/Makefile
239         ui/Makefile
240         ui/common/Makefile
241         ui/ncurses/Makefile
242         ui/test/Makefile
243         ui/twin/Makefile
244         utils/Makefile
245 ])
246
247 AC_OUTPUT