]> git.ozlabs.org Git - petitboot/blob - configure.ac.in
lib/url: fix no-scheme URL parsing
[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 AC_CHECK_HEADERS([stdarg.h])
32 AC_CHECK_HEADERS([varargs.h])
33
34 AC_CHECK_LIB([udev], [udev_new],
35         [],
36         [AC_MSG_FAILURE([The libudev development library is required by petitboot.  Try installing the package libudev-dev or libudev-devel.])]
37 )
38
39 dnl Checking for va_copy availability
40 AC_MSG_CHECKING([for va_copy])
41 AC_TRY_LINK([#include <stdarg.h>
42 va_list ap1,ap2;], [va_copy(ap1,ap2);],
43 have_va_copy=yes,
44 have_va_copy=no)
45 AC_MSG_RESULT($have_va_copy)
46 if test x"$have_va_copy" = x"yes"; then
47     AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
48 else
49     AC_MSG_CHECKING([for __va_copy])
50     AC_TRY_LINK([#include <stdarg.h>
51     va_list ap1,ap2;], [__va_copy(ap1,ap2);],
52     have___va_copy=yes,
53     have___va_copy=no)
54     AC_MSG_RESULT($have___va_copy)
55     if test x"$have___va_copy" = x"yes"; then
56         AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
57     fi
58 fi
59
60 AC_ARG_WITH(
61         [ncurses],
62         [AS_HELP_STRING([--with-ncurses],
63                 [build text console UI programs using ncurses [default=yes]]
64         )],
65         [],
66         [with_ncurses=yes]
67 )
68 AM_CONDITIONAL([WITH_NCURSES], [test "x$with_ncurses" = "xyes"])
69
70 AC_ARG_WITH(
71         [twin-x11],
72         [AS_HELP_STRING([--with-twin-x11],
73                 [build x11 GUI programs using the twin window system [default=yes]]
74         )],
75         [],
76         [with_twin_x11=yes]
77 )
78 AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
79
80 AC_ARG_WITH(
81         [twin-fbdev],
82         [AS_HELP_STRING(
83                 [--with-twin-fbdev],
84                 [build frame buffer GUI programs using the twin window system [default=no]]
85         )],
86         [],
87         [with_twin_fbdev=yes]
88 )
89 AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
90
91 AM_CONDITIONAL(
92         [WITH_TWIN],
93         [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"])
94
95 AS_IF(
96         [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"],
97         [PKG_CHECK_MODULES(
98                 [twin],
99                 [libtwin],
100                 [SAVE_LIBS="$LIBS" LIBS="$LIBS $twin_LIBS"
101                         AC_CHECK_LIB(
102                                 [twin],
103                                 [twin_feature_init],
104                                 [],
105                                 [AC_MSG_FAILURE([--with-twin was given, but test for twin failed])]
106                         )
107                         LIBS="$SAVE_LIBS"
108                 ],
109                 [AC_MSG_RESULT([$twin_PKG_ERRORS])
110                         AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
111                 ]
112         )]
113 )
114
115 AS_IF(
116         [test "x$with_twin_x11" = "xyes"],
117         [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
118                 AC_CHECK_HEADERS(
119                         [libtwin/twin_x11.h],
120                         [],
121                         [AC_MSG_FAILURE([ --with-twin-x11 given but libtwin/twin_x11.h not found])]
122                 )
123                 CPPFLAGS="$SAVE_CPPFLAGS"
124         ]
125 )
126
127 AS_IF(
128         [test "x$with_twin_fbdev" = "xyes"],
129         [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
130                 AC_CHECK_HEADERS(
131                         [libtwin/twin_fbdev.h],
132                         [],
133                         [AC_MSG_FAILURE([ --with-twin-fbdev given but libtwin/twin_fbdev.h not found])]
134                 )
135                 CPPFLAGS="$SAVE_CPPFLAGS"
136         ]
137 )
138
139 AC_ARG_ENABLE(
140         [busybox],
141         [AS_HELP_STRING(
142                 [--enable-busybox],
143                 [build programs with extra support for busybox [default=no]])
144         ],
145         [],
146         [enable_busybox=no]
147 )
148 #AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
149
150 AC_ARG_ENABLE(
151         [ps3],
152         [AS_HELP_STRING(
153                 [--enable-ps3],
154                 [build additional programs for the PS3 game console [default=no]]
155         )],
156         [],
157         [enable_ps3=no]
158 )
159 AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
160
161 AC_ARG_ENABLE(
162         [debug],
163         [AS_HELP_STRING([--enable-debug],
164                 [build programs with extra debug info [default=no]]
165         )],
166         [],
167         [enable_debug=check]
168 )
169 #AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
170
171 # host program paths
172 AC_DEFUN([DEFINE_HOST_PROG],
173         [
174                 AC_ARG_VAR([HOST_PROG_$1], [Path to "$2" on the host [default $3]])
175                 if test "x$HOST_PROG_$1" = "x"; then
176                         HOST_PROG_$1="$3"
177                 fi
178                 AC_DEFINE_UNQUOTED(HOST_PROG_$1, ["$HOST_PROG_$1"],
179                                 [Path to "$2" on the host])
180         ])
181
182 DEFINE_HOST_PROG(CP, cp, [/bin/cp])
183 DEFINE_HOST_PROG(KEXEC, kexec, [/sbin/kexec])
184 DEFINE_HOST_PROG(MOUNT, mount, [/bin/mount])
185 DEFINE_HOST_PROG(SHUTDOWN, shutdown, [/sbin/shutdown])
186 DEFINE_HOST_PROG(SFTP, sftp, [/usr/bin/sftp])
187 DEFINE_HOST_PROG(TFTP, tftp, [/usr/bin/tftp])
188 DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount])
189 DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget])
190
191 default_cflags="--std=gnu99 -g \
192         -Wall -W -Wunused -Wstrict-prototypes -Wmissing-prototypes \
193         -Wmissing-declarations -Wredundant-decls -Winline"
194
195 AC_ARG_ENABLE(
196         [werror],
197         [AS_HELP_STRING([--enable-werror],
198                 [build programs with -Werror]
199         )],
200         [default_cflags="$default_cflags -Werror"]
201 )
202
203 AS_IF(
204         [test "x$enable_debug" = "xyes"],
205         [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O0 -DDEBUG"])],
206         [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2 -DNDEBUG"])]
207 )
208  
209
210 AC_SUBST([LIBTOOL_DEPS])
211 AC_SUBST([DESTDIR])
212
213 AC_CONFIG_HEADERS([config.h])
214 AC_CONFIG_FILES([
215         Makefile
216         discover/Makefile
217         lib/Makefile
218         man/Makefile
219         test/Makefile
220         test/lib/Makefile
221         test/parser/Makefile
222         test/urls/Makefile
223         ui/Makefile
224         ui/common/Makefile
225         ui/ncurses/Makefile
226         ui/test/Makefile
227         ui/twin/Makefile
228         utils/Makefile
229 ])
230
231 AC_OUTPUT