Speed up --start-daemon option
[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 dnl Checking for va_copy availability
35 AC_MSG_CHECKING([for va_copy])
36 AC_TRY_LINK([#include <stdarg.h>
37 va_list ap1,ap2;], [va_copy(ap1,ap2);],
38 have_va_copy=yes,
39 have_va_copy=no)
40 AC_MSG_RESULT($have_va_copy)
41 if test x"$have_va_copy" = x"yes"; then
42     AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
43 else
44     AC_MSG_CHECKING([for __va_copy])
45     AC_TRY_LINK([#include <stdarg.h>
46     va_list ap1,ap2;], [__va_copy(ap1,ap2);],
47     have___va_copy=yes,
48     have___va_copy=no)
49     AC_MSG_RESULT($have___va_copy)
50     if test x"$have___va_copy" = x"yes"; then
51         AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
52     fi
53 fi
54
55 AC_ARG_WITH(
56         [ncurses],
57         [AS_HELP_STRING([--with-ncurses],
58                 [build text console UI programs using ncurses [default=yes]]
59         )],
60         [],
61         [with_ncurses=yes]
62 )
63 AM_CONDITIONAL([WITH_NCURSES], [test "x$with_ncurses" = "xyes"])
64
65 AC_ARG_WITH(
66         [twin-x11],
67         [AS_HELP_STRING([--with-twin-x11],
68                 [build x11 GUI programs using the twin window system [default=yes]]
69         )],
70         [],
71         [with_twin_x11=yes]
72 )
73 AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
74
75 AC_ARG_WITH(
76         [twin-fbdev],
77         [AS_HELP_STRING(
78                 [--with-twin-fbdev],
79                 [build frame buffer GUI programs using the twin window system [default=no]]
80         )],
81         [],
82         [with_twin_fbdev=yes]
83 )
84 AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
85
86 AM_CONDITIONAL(
87         [WITH_TWIN],
88         [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"])
89
90 AS_IF(
91         [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"],
92         [PKG_CHECK_MODULES(
93                 [twin],
94                 [libtwin],
95                 [SAVE_LIBS="$LIBS" LIBS="$LIBS $twin_LIBS"
96                         AC_CHECK_LIB(
97                                 [twin],
98                                 [twin_feature_init],
99                                 [],
100                                 [AC_MSG_FAILURE([--with-twin was given, but test for twin failed])]
101                         )
102                         LIBS="$SAVE_LIBS"
103                 ],
104                 [AC_MSG_RESULT([$twin_PKG_ERRORS])
105                         AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
106                 ]
107         )]
108 )
109
110 AS_IF(
111         [test "x$with_twin_x11" = "xyes"],
112         [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
113                 AC_CHECK_HEADERS(
114                         [libtwin/twin_x11.h],
115                         [],
116                         [AC_MSG_FAILURE([ --with-twin-x11 given but libtwin/twin_x11.h not found])]
117                 )
118                 CPPFLAGS="$SAVE_CPPFLAGS"
119         ]
120 )
121
122 AS_IF(
123         [test "x$with_twin_fbdev" = "xyes"],
124         [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
125                 AC_CHECK_HEADERS(
126                         [libtwin/twin_fbdev.h],
127                         [],
128                         [AC_MSG_FAILURE([ --with-twin-fbdev given but libtwin/twin_fbdev.h not found])]
129                 )
130                 CPPFLAGS="$SAVE_CPPFLAGS"
131         ]
132 )
133
134 AC_ARG_ENABLE(
135         [busybox],
136         [AS_HELP_STRING(
137                 [--enable-busybox],
138                 [build programs with extra support for busybox [default=no]])
139         ],
140         [],
141         [enable_busybox=no]
142 )
143 #AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
144
145 AC_ARG_ENABLE(
146         [ps3],
147         [AS_HELP_STRING(
148                 [--enable-ps3],
149                 [build additional programs for the PS3 game console [default=no]]
150         )],
151         [],
152         [enable_ps3=no]
153 )
154 AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
155
156 AC_ARG_ENABLE(
157         [debug],
158         [AS_HELP_STRING([--enable-debug],
159                 [build programs with extra debug info [default=no]]
160         )],
161         [],
162         [enable_debug=check]
163 )
164 #AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
165
166 default_cflags="--std=gnu99 -g \
167         -Wall -W -Wunused -Wstrict-prototypes -Wmissing-prototypes \
168         -Wmissing-declarations -Wredundant-decls -Winline"
169
170 AS_IF(
171         [test "x$enable_debug" = "xyes"],
172         [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O0 -DDEBUG"])],
173         [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2 -DNDEBUG"])]
174 )
175  
176
177 AC_SUBST([LIBTOOL_DEPS])
178 AC_SUBST([DESTDIR])
179
180 AC_CONFIG_HEADERS([config.h])
181 AC_CONFIG_FILES([
182         Makefile
183         discover/Makefile
184         lib/Makefile
185         man/Makefile
186         test/Makefile
187         test/parser/Makefile
188         ui/Makefile
189         ui/common/Makefile
190         ui/ncurses/Makefile
191         ui/test/Makefile
192         ui/twin/Makefile
193         utils/Makefile
194 ])
195
196 AC_OUTPUT