]> git.sur5r.net Git - kconfig-frontends/blob - configure.ac
configure: eye-candy for --enable-root-menu-prompt
[kconfig-frontends] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 #---------------------------------------------------------------------------
5 # Global initialisation
6
7 #----------------------------------------
8 # Prepare autoconf
9 AC_PREREQ([2.67])
10 AC_INIT(
11     [kconfig-frontends],
12     [m4_esyscmd_s([./scripts/version.sh])],
13     [nobody@nowhere.org])
14 AC_CONFIG_SRCDIR([frontends/conf/conf.c])
15 # Use a config.h to avoid brazilions -DHAVE_FOO on compile lines
16 AC_CONFIG_HEADERS([scripts/.autostuff/config.h])
17 AC_CONFIG_AUX_DIR([scripts/.autostuff/scritps])
18 AC_CONFIG_MACRO_DIR([scripts/.autostuff/m4])
19
20 #----------------------------------------
21 # Prepare automake
22 AM_INIT_AUTOMAKE
23
24 #----------------------------------------
25 # Prepare libtool
26 LT_PREREQ([2.2.6])
27 LT_INIT([disable-static])
28
29 #---------------------------------------------------------------------------
30 # Set misc options
31 # Although there is a default (="linux") in the code, we do provide
32 # a default here, to get a consistent autostuff behavior
33 AC_ARG_ENABLE(
34     [root-menu-prompt],
35     [AS_HELP_STRING(
36         [--enable-root-menu-prompt=PROMPT],
37         [set the root-menu prompt (default=Configuration)])],
38     [AS_CASE(
39         ["$enableval"],
40         [yes], [root_menu=Configuration],
41         [no],  [root_menu=],
42                [# Escape the $ signs, otherwise they would get munged by make
43                 # Also, append a space at the end, to separate the package
44                 # name from the literal 'Configuration'
45                 root_menu="$( echo "$enableval"          \
46                               |sed -r -e 's/\$/\\$$/g;'  \
47                                       -e 's/$/ /;'       \
48                             )"])])
49 AC_SUBST([root_menu], [${root_menu=Configuration}])
50
51 AC_ARG_ENABLE(
52     [config-prefix],
53     [AS_HELP_STRING(
54         [--enable-config-prefix=PREFIX],
55         [the prefix to the config option (default=CONFIG_)])],
56     [AS_CASE(
57         ["$enableval"],
58         [*" "*],[AC_MSG_ERROR([config prefix can not contain spaces: '$enableval'])],
59         [yes],  [config_prefix=CONFIG_],
60         [no],   [config_prefix=],
61                 [config_prefix=$enableval])])
62 AC_SUBST([config_prefix], [${config_prefix-CONFIG_}])
63
64 #----------------------------------------
65 # Options to selectively enable/disable frontends
66 # All are selected by default
67 AC_ARG_ENABLE(
68     [conf],
69     [AS_HELP_STRING(
70         [--disable-conf],
71         [conf, the stdin-based frontend (default=auto)])])
72 AC_SUBST([enable_conf], [${enable_conf:-auto}])
73 AC_ARG_ENABLE(
74     [mconf],
75     [AS_HELP_STRING(
76         [--disable-mconf],
77         [mconf, the traditional ncurses-based frontend (default=auto)])])
78 AC_SUBST([enable_mconf], [${enable_mconf:-auto}])
79 AC_ARG_ENABLE(
80     [nconf],
81     [AS_HELP_STRING(
82         [--disable-nconf],
83         [nconf, the modern ncurses-based frontend (default=auto)])])
84 AC_SUBST([enable_nconf], [${enable_nconf:-auto}])
85 AC_ARG_ENABLE(
86     [gconf],
87     [AS_HELP_STRING(
88         [--disable-gconf],
89         [gconf, the GTK-based frontend (default=auto)])])
90 AC_SUBST([enable_gconf], [${enable_gconf:-auto}])
91 AC_ARG_ENABLE(
92     [qconf],
93     [AS_HELP_STRING(
94         [--disable-qconf],
95         [qconf, the QT-based frontend (default=auto)])])
96 AC_SUBST([enable_qconf], [${enable_qconf:-auto}])
97
98 AC_ARG_ENABLE(
99     [frontends],
100     [AS_HELP_STRING(
101         [--enable-frontends=list],
102         [enables only the set of frontends in comma-separated 'list'
103          (default: auto selection), takes precedence over all
104          --enable-*conf, above])],
105     [for f in conf mconf nconf gconf qconf; do
106         AS_CASE(
107             ["$enableval"],
108             [yes],      [eval enable_$f=yes],
109             ["$f"],     [eval enable_$f=yes],
110             ["$f",*],   [eval enable_$f=yes],
111             [*,"$f"],   [eval enable_$f=yes],
112             [*,"$f",*], [eval enable_$f=yes],
113                         [eval enable_$f=no])
114      done])
115 AC_SUBST([enable_frontends])
116
117 #----------------------------------------
118 # Dependencies that will be needed, depending on the frontends
119 AS_CASE(
120     ["$enable_mconf":"$enable_nconf"],
121     [*yes*],  [need_curses=yes],
122     [*auto*], [need_curses=auto],
123               [need_curses=no])
124 [need_panel_menu="$enable_nconf"]
125 AS_CASE(
126     ["$enable_gconf":"$enable_qconf"],
127     [*yes*],  [need_pkgconfig=yes],
128     [*auto*], [need_pkgconfig=yes],
129               [need_pkgconfig=no ])
130 [need_gtk="$enable_gconf"]
131 [need_qt="$enable_qconf"]
132
133 #---------------------------------------------------------------------------
134 # Now check we have the required stuff
135
136 #----------------------------------------
137 # Some program checks
138 AC_PROG_CC
139 AM_PROG_CC_C_O
140 AC_PROG_CXX
141 AC_C_INLINE
142 AC_PROG_MAKE_SET
143 AC_CHECK_PROGS(
144     [GPERF],
145     [gperf])
146 AS_IF(
147     [test -z "$GPERF"],
148     [AC_MSG_ERROR([can not find gperf])])
149 AS_IF(
150     [test "$need_pkgconfig" = "yes"],
151     [PKG_PROG_PKG_CONFIG()])
152 AC_PROG_LEX
153 AC_SUBST([AM_LFLAGS], ["-L -P zconf"])
154 AC_PROG_YACC
155 AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
156
157 #----------------------------------------
158 # Check for standard headers
159 AC_HEADER_STDC
160 AC_HEADER_STDBOOL
161 AC_CHECK_HEADERS([ fcntl.h libintl.h limits.h locale.h ])
162 AC_CHECK_HEADERS([ stdlib.h string.h sys/time.h unistd.h ])
163 AC_TYPE_SIZE_T
164
165 #----------------------------------------
166 # Checks for library functions.
167 AC_FUNC_MALLOC
168 AC_FUNC_REALLOC
169 AC_FUNC_ALLOCA
170 AC_CHECK_FUNCS([ bzero memmove memset ])
171 AC_CHECK_FUNCS([ strcasecmp strchr strcspn strdup strncasecmp strpbrk strrchr strspn strtol ])
172 AC_CHECK_FUNCS([ gettimeofday mkdir regcomp setlocale uname ])
173
174 #----------------------------------------
175 # Check for gettext, for the kconfig frontends
176 AC_SUBST([GETTEXT])
177 AC_CHECK_HEADERS(
178     [libintl.h],
179     [ac_ct_gettext_hdr=$ac_header; break],
180     [AC_MSG_WARN([libintl is missing, frontends will not be localised])])
181 AS_IF(
182     [test -n "$ac_ct_gettext_hdr"],
183     [AC_CHECK_DECL(
184         [gettext],,
185         [AC_MSG_WARN([gettext is missing, frontends will not be localised])
186          GETTEXT=-DKBUILD_NO_NLS],
187         [#include <$ac_ct_gettext_hdr>])])
188
189 #----------------------------------------
190 # Check for ncurses, for the mconf & nconf frontends
191 AS_IF(
192     [test "$need_curses" = "yes" -o "$need_curses" = "auto"],
193     [AC_SUBST([CURSES_LOC])
194      AC_SUBST([ncurses_LIBS])
195      LIBS_old="$LIBS"
196      AC_CHECK_HEADERS(
197         [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
198         [CURSES_LOC=$ac_header; break])
199      AS_IF(
200         [test -z "$CURSES_LOC"],
201         [AS_IF(
202             [test "$need_curses" = "yes"],
203             [AC_MSG_ERROR([could not find curses headers (frontends: mconf/nconf)])],
204             [has_curses=no])])
205      AC_SEARCH_LIBS(
206         [initscr],
207         [ncursesw ncurses curses],
208         [ac_ct_curses_lib_found=yes; break])
209      AS_IF(
210         [test -z "$ac_ct_curses_lib_found"],
211         [AS_IF(
212             [test "$need_curses" = "yes"],
213             [AC_MSG_ERROR([could not find curses library (frontends: mconf/nconf)])],
214             [has_curses=no])])
215      ncurses_LIBS="$LIBS"
216      LIBS=$LIBS_old])
217
218 AS_IF(
219     [test "$has_curses" = "no" ],
220     [enable_mconf=no; enable_nconf=no])
221
222 #----------------------------------------
223 # Check for libpanel and libmenu, for the nconf frontend
224 AS_IF(
225     [test "$need_panel_menu" = "yes" -o "$need_panel_menu" = "auto"],
226     [AC_SUBST([ncurses_extra_LIBS])
227      LIBS_old="$LIBS"
228      AC_SEARCH_LIBS(
229         [new_panel],
230         [panelw panel],
231         [ac_ct_panel_lib_found=yes; break])
232      AS_IF(
233         [test -z "$ac_ct_panel_lib_found"],
234         [AS_IF(
235             [test "$need_panel_menu" = "yes"],
236             [AC_MSG_ERROR([could not find libpanel library (frontend: nconf)])],
237             [has_panel_menu=no])])
238      AC_SEARCH_LIBS(
239         [menu_init],
240         [menuw menu],
241         [ac_ct_menu_lib_found=yes; break])
242      AS_IF(
243         [test -z "$ac_ct_panel_lib_found"],
244         [AS_IF(
245             [test "$need_panel_menu" = "yes"],
246             [AC_MSG_ERROR([could not find libmenu library (frontend: nconf)])],
247             [has_panel_menu=no])])
248      ncurses_extra_LIBS="$LIBS"
249      LIBS=$LIBS_old])
250
251 AS_IF(
252     [test "$has_panel_menu" = "no" ],
253     [enable_nconf=no])
254
255 #----------------------------------------
256 # Check headers and libs for gconf
257 AS_IF(
258     [test "$need_gtk" = "yes" -o "$need_gtk" = "auto"],
259     [PKG_CHECK_MODULES(
260         [gtk],
261         [gtk+-2.0 gmodule-2.0 libglade-2.0],
262         [has_gtk=yes],
263         [AS_IF(
264             [test "$need_gtk" = "yes"],
265             [AC_MSG_ERROR([could not find GTK+ headers and/or libraries (frontend: gconf)])],
266             [has_gtk=no])])])
267
268 AS_IF(
269     [test "$has_gtk" = "no" ],
270     [enable_gconf=no])
271
272 #----------------------------------------
273 # Check headers and libs for qconf
274 AS_IF(
275     [test "$need_qt" = "yes" -o "$need_qt" = "auto"],
276     [PKG_CHECK_MODULES(
277         [qt4],
278         [QtCore QtGui Qt3Support],
279         [has_qt=yes],
280         [AS_IF(
281             [test "$need_qt" = "yes"],
282             [AC_MSG_ERROR([could not find QT4 headers and/or libraries (frontend: qconf)])],
283             [has_qt=no])])])
284
285 AS_IF(
286     [test "$has_qt" = "no" ],
287     [enable_qconf=no])
288
289 #---------------------------------------------------------------------------
290 # Now, we know what frontends to enable
291 AS_IF([test "$enable_conf"  = "auto"], [enable_conf=yes ])
292 AS_IF([test "$enable_gconf" = "auto"], [enable_gconf=yes])
293 AS_IF([test "$enable_mconf" = "auto"], [enable_mconf=yes])
294 AS_IF([test "$enable_nconf" = "auto"], [enable_nconf=yes])
295 AS_IF([test "$enable_qconf" = "auto"], [enable_qconf=yes])
296
297 #----------------------------------------
298 # Check if the lxdialog library should be built
299 AS_IF(
300     [test "$enable_mconf" = "yes"],
301     [need_lxdialog=yes],
302     [need_lxdialog=no])
303
304 #----------------------------------------
305 # Setup automake conditional build
306 AM_CONDITIONAL(
307     [COND_conf],
308     [test "$enable_conf" = "yes"])
309 AM_CONDITIONAL(
310     [COND_mconf],
311     [test "$enable_mconf" = "yes"])
312 AM_CONDITIONAL(
313     [COND_nconf],
314     [test "$enable_nconf" = "yes"])
315 AM_CONDITIONAL(
316     [COND_gconf],
317     [test "$enable_gconf" = "yes"])
318 AM_CONDITIONAL(
319     [COND_qconf],
320     [test "$enable_qconf" = "yes"])
321 AM_CONDITIONAL(
322     [COND_lxdialog],
323     [test "$need_lxdialog" = "yes"])
324
325 #----------------------------------------
326 # Get the version to apply to the parser shared library
327 AC_SUBST(
328     [KCONFIGPARSER_LIB_VERSION],
329     [m4_esyscmd_s([./scripts/version.sh --plain])])
330
331 #----------------------------------------
332 # Finalise
333 AC_CONFIG_FILES([
334     Makefile
335     libs/Makefile
336     libs/images/Makefile
337     libs/lxdialog/Makefile
338     libs/parser/Makefile
339     frontends/Makefile
340     frontends/conf/Makefile
341     frontends/mconf/Makefile
342     frontends/nconf/Makefile
343     frontends/gconf/Makefile
344     frontends/qconf/Makefile
345 ])
346 AC_OUTPUT
347
348 AC_MSG_NOTICE()
349 AC_MSG_NOTICE([Configured with:])
350 AC_MSG_NOTICE([- root-menu prompt: '$root_menu'])
351 AC_MSG_NOTICE([- config prefix:    '$config_prefix'])
352 AC_MSG_NOTICE([- frontends:])
353 AS_IF([test "$enable_conf" = "yes"],
354       [AC_MSG_NOTICE([  - conf:  yes])],
355       [AC_MSG_NOTICE([  - conf:  no])])
356 AS_IF([test "$enable_gconf" = "yes"],
357       [AC_MSG_NOTICE([  - gconf: yes])],
358       [AC_MSG_NOTICE([  - gconf: no])])
359 AS_IF([test "$enable_mconf" = "yes"],
360       [AC_MSG_NOTICE([  - mconf: yes])],
361       [AC_MSG_NOTICE([  - mconf: no])])
362 AS_IF([test "$enable_nconf" = "yes"],
363       [AC_MSG_NOTICE([  - nconf: yes])],
364       [AC_MSG_NOTICE([  - nconf: no])])
365 AS_IF([test "$enable_qconf" = "yes"],
366       [AC_MSG_NOTICE([  - qconf: yes])],
367       [AC_MSG_NOTICE([  - qconf: no])])
368 AC_MSG_NOTICE([- parser library:])
369 AS_IF([test "$enable_shared" = "yes"],
370       [AC_MSG_NOTICE([  - shared: yes, versioned $KCONFIGPARSER_LIB_VERSION])],
371       [AC_MSG_NOTICE([  - shared: no])])
372 AC_MSG_NOTICE([  - static: $enable_static])