]> git.sur5r.net Git - kconfig-frontends/blob - configure.ac
Synchronise with 3.8-rc4
[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     [yann.morin.1998@free.fr])
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/scripts])
18 AC_CONFIG_MACRO_DIR([scripts/.autostuff/m4])
19
20 #----------------------------------------
21 # Prepare automake
22
23 # We want to allow the user to override our default program-prefix,
24 # so we must set-it now, before automake has a chance to interpret
25 # it, but after the options are parsed, so as not to overwrite the
26 # value (if any) set by the user
27 AS_IF(
28     [test "$program_prefix" = NONE],
29     [program_prefix=kconfig-])
30
31 AM_INIT_AUTOMAKE([foreign])
32
33 AS_IF(
34     [test "$(${srcdir}/scripts/version.sh --internal)" = "hg"],
35     [AM_SILENT_RULES],
36     [AM_SILENT_RULES([yes])])
37
38 AS_IF(
39     [test $AM_DEFAULT_VERBOSITY -eq 0],
40     [SILENT_MAKEFLAGS="--no-print-directory -s"],
41     [SILENT_MAKEFLAGS=""])
42 AC_SUBST([SILENT_MAKEFLAGS])
43
44 #----------------------------------------
45 # Prepare libtool
46 m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl Automake, we have a problem...
47 LT_PREREQ([2.2.6])
48 LT_INIT([disable-static])
49
50 #---------------------------------------------------------------------------
51 # Set misc options
52
53 # By default, do build with -Wall, unless the user asks not to
54 [wall_CFLAGS=-Wall]
55 AC_ARG_ENABLE(
56     [wall],
57     [AS_HELP_STRING(
58         [--disable-wall],
59         [build with -Wall (default=yes)])],
60     [AS_CASE(
61         ["$enableval"],
62         [yes], [wall_CFLAGS=-Wall],
63         [*],   [wall_CFLAGS=""])])
64 AC_SUBST([wall_CFLAGS],[${wall_CFLAGS}])
65
66 # By default, do not build with -Werror, unless the user asks for it
67 AC_ARG_ENABLE(
68     [werror],
69     [AS_HELP_STRING(
70         [--enable-werror],
71         [build with -Werror (default=no)])],
72     [AS_CASE(
73         ["$enableval"],
74         [yes], [werror_CFLAGS=-Werror],
75         [*],   [werror_CFLAGS=""])])
76 AC_SUBST([werror_CFLAGS],[${werror_CFLAGS}])
77
78 # Although there is a default (="linux") in the code, we do provide
79 # a default here, to get a consistent autostuff behavior
80 AC_ARG_ENABLE(
81     [root-menu-prompt],
82     [AS_HELP_STRING(
83         [--enable-root-menu-prompt=PROMPT],
84         [set the root-menu prompt (default=Configuration)])],
85     [AS_CASE(
86         ["$enableval"],
87         [yes], [root_menu=Configuration],
88         [no],  [root_menu=],
89                [# Escape the $ signs, otherwise they would get munged by make
90                 # Also, append a space at the end, to separate the package
91                 # name from the literal 'Configuration'
92                 root_menu="$( echo "$enableval" |sed -r -e 's/\$/\\$$/g;' )"])])
93 AC_SUBST([root_menu], [${root_menu=Configuration}])
94
95 AC_ARG_ENABLE(
96     [config-prefix],
97     [AS_HELP_STRING(
98         [--enable-config-prefix=PREFIX],
99         [the prefix to the config option (default=CONFIG_)])],
100     [AS_CASE(
101         ["$enableval"],
102         [*" "*],[AC_MSG_ERROR([config prefix can not contain spaces: '$enableval'])],
103         [yes],  [config_prefix=CONFIG_],
104         [no],   [config_prefix=],
105                 [config_prefix=$enableval])])
106 AC_SUBST([config_prefix], [${config_prefix-CONFIG_}])
107
108 AC_ARG_ENABLE(
109     [utils],
110     [AS_HELP_STRING(
111         [--disable-utils],
112         [install utilities to manage .config files (default=yes)])])
113 AC_SUBST([enable_utils], [${enable_utils:-yes}])
114
115 AC_ARG_ENABLE(
116     [L10n],
117     [AS_HELP_STRING(
118         [--disable-L10n],
119         [enable localisation (L10n) (default=auto)])])
120 AC_SUBST([enable_L10n], [${enable_L10n:-yes}])
121
122 #----------------------------------------
123 # Options to selectively enable/disable frontends
124 # All are selected by default
125 AC_ARG_ENABLE(
126     [conf],
127     [AS_HELP_STRING(
128         [--disable-conf],
129         [conf, the stdin-based frontend (default=auto)])])
130 AC_SUBST([enable_conf], [${enable_conf:-auto}])
131 AC_ARG_ENABLE(
132     [mconf],
133     [AS_HELP_STRING(
134         [--disable-mconf],
135         [mconf, the traditional ncurses-based frontend (default=auto)])])
136 AC_SUBST([enable_mconf], [${enable_mconf:-auto}])
137 AC_ARG_ENABLE(
138     [nconf],
139     [AS_HELP_STRING(
140         [--disable-nconf],
141         [nconf, the modern ncurses-based frontend (default=auto)])])
142 AC_SUBST([enable_nconf], [${enable_nconf:-auto}])
143 AC_ARG_ENABLE(
144     [gconf],
145     [AS_HELP_STRING(
146         [--disable-gconf],
147         [gconf, the GTK-based frontend (default=auto)])])
148 AC_SUBST([enable_gconf], [${enable_gconf:-auto}])
149 AC_ARG_ENABLE(
150     [qconf],
151     [AS_HELP_STRING(
152         [--disable-qconf],
153         [qconf, the QT-based frontend (default=auto)])])
154 AC_SUBST([enable_qconf], [${enable_qconf:-auto}])
155
156 AC_ARG_ENABLE(
157     [frontends],
158     [AS_HELP_STRING(
159         [--enable-frontends=list],
160         [enables only the set of frontends in comma-separated 'list'
161          (default: auto selection), takes precedence over all
162          --enable-*conf, above])],
163     [for f in conf mconf nconf gconf qconf; do
164         AS_CASE(
165             ["$enableval"],
166             [yes],      [eval enable_$f=yes],
167             ["$f"],     [eval enable_$f=yes],
168             ["$f",*],   [eval enable_$f=yes],
169             [*,"$f"],   [eval enable_$f=yes],
170             [*,"$f",*], [eval enable_$f=yes],
171                         [eval enable_$f=no])
172      done])
173 AC_SUBST([enable_frontends])
174
175 #----------------------------------------
176 # What extra CFLAGS we will be using
177 AC_SUBST([kf_CFLAGS], ["$wall_CFLAGS $werror_CFLAGS"])
178
179 #----------------------------------------
180 # Dependencies that will be needed, depending on the frontends
181 AS_CASE(
182     ["$enable_mconf":"$enable_nconf"],
183     [*yes*],  [need_curses=yes],
184     [*auto*], [need_curses=auto],
185               [need_curses=no])
186 [need_panel_menu="$enable_nconf"]
187 AS_CASE(
188     ["$enable_gconf":"$enable_qconf"],
189     [*yes*],  [need_pkgconfig=yes],
190     [*auto*], [need_pkgconfig=yes],
191               [need_pkgconfig=no ])
192 [need_gtk="$enable_gconf"]
193 [need_qt="$enable_qconf"]
194
195 #---------------------------------------------------------------------------
196 # Now check we have the required stuff
197
198 #----------------------------------------
199 # Some program checks
200 AC_PROG_CC
201 AM_PROG_CC_C_O
202 AC_PROG_CXX
203 AC_C_INLINE
204 AC_PROG_MAKE_SET
205 AC_CHECK_PROGS(
206     [GPERF],
207     [gperf])
208 AS_IF(
209     [test -z "$GPERF"],
210     [AC_MSG_ERROR([can not find gperf])])
211 AS_IF(
212     [test "$need_pkgconfig" = "yes"],
213     [PKG_PROG_PKG_CONFIG()])
214 AC_PROG_LEX
215 AC_SUBST([AM_LFLAGS], ["-L -P zconf"])
216 AC_PROG_YACC
217 AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
218
219 #----------------------------------------
220 # Check for gettext, for the kconfig frontends
221 [has_gettext="$enable_L10n"]
222 AS_IF(
223     [test "$has_gettext" = "yes"],
224     [AC_CHECK_HEADERS(
225         [libintl.h],
226         [ac_ct_gettext_hdr=$ac_header; break],
227         [has_gettext=no])])
228 AS_IF(
229     [test "$has_gettext" = "yes"],
230     [AC_CHECK_DECL(
231         [gettext],,
232         [has_gettext=no],
233         [#include <$ac_ct_gettext_hdr>])])
234 AS_IF(
235     [test "$has_gettext" = "yes"],
236     [LIBS_old="$LIBS"
237      LIBS=
238      AC_SEARCH_LIBS(
239         [gettext],
240         [intl],,
241         [has_gettext=no])
242     intl_LIBS="$LIBS"
243     LIBS="$LIBS_old"])
244 AS_IF(
245     [test "$has_gettext" = "no"],
246     [intl_CPPFLAGS=-DKBUILD_NO_NLS])
247 AC_SUBST([intl_CPPFLAGS])
248 AC_SUBST([intl_LIBS])
249
250 #----------------------------------------
251 # Check for ncurses, for the mconf & nconf frontends
252 AS_IF(
253     [test "$need_curses" = "yes" -o "$need_curses" = "auto"],
254     [AC_SUBST([CURSES_LOC])
255      AC_SUBST([ncurses_LIBS])
256      LIBS_old="$LIBS"
257      LIBS=
258      AC_CHECK_HEADERS(
259         [ncursesw/curses.h ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h],
260         [CURSES_LOC=$ac_header; break])
261      AS_IF(
262         [test -z "$CURSES_LOC"],
263         [AS_IF(
264             [test "$need_curses" = "yes"],
265             [AC_MSG_ERROR([could not find curses headers (frontends: mconf/nconf)])],
266             [has_curses=no])])
267      AC_SEARCH_LIBS(
268         [initscr],
269         [ncursesw ncurses curses],
270         [ac_ct_curses_lib_found=yes; break])
271      AS_IF(
272         [test -z "$ac_ct_curses_lib_found"],
273         [AS_IF(
274             [test "$need_curses" = "yes"],
275             [AC_MSG_ERROR([could not find curses library (frontends: mconf/nconf)])],
276             [has_curses=no])])
277      ncurses_LIBS="$LIBS"
278      LIBS=$LIBS_old])
279
280 AS_IF(
281     [test "$has_curses" = "no" ],
282     [enable_mconf=no; enable_nconf=no])
283
284 #----------------------------------------
285 # Check for libpanel and libmenu, for the nconf frontend
286 AS_IF(
287     [test "$need_panel_menu" = "yes" -o "$need_panel_menu" = "auto"],
288     [AC_SUBST([ncurses_extra_LIBS])
289      AC_SUBST([ncurses_extra_CPPFLAGS])
290      AS_CASE(
291         [$CURSES_LOC],
292         [ncursesw/*],[ncurses_extra_CPPFLAGS="-I/usr/include/ncursesw"],
293         [ncurses/*],[ncurses_extra_CPPFLAGS="-I/usr/include/ncurses"])
294      LIBS_old="$LIBS"
295      LIBS=
296      AC_SEARCH_LIBS(
297         [new_panel],
298         [panelw panel],
299         [ac_ct_panel_lib_found=yes; break],,
300         [$ncurses_LIBS])
301      AS_IF(
302         [test -z "$ac_ct_panel_lib_found"],
303         [AS_IF(
304             [test "$need_panel_menu" = "yes"],
305             [AC_MSG_ERROR([could not find libpanel library (frontend: nconf)])],
306             [has_panel_menu=no])])
307      AC_SEARCH_LIBS(
308         [menu_init],
309         [menuw menu],
310         [ac_ct_menu_lib_found=yes; break],,
311         [$ncurses_LIBS])
312      AS_IF(
313         [test -z "$ac_ct_panel_lib_found"],
314         [AS_IF(
315             [test "$need_panel_menu" = "yes"],
316             [AC_MSG_ERROR([could not find libmenu library (frontend: nconf)])],
317             [has_panel_menu=no])])
318      ncurses_extra_LIBS="$LIBS"
319      LIBS=$LIBS_old])
320
321 AS_IF(
322     [test "$has_panel_menu" = "no" ],
323     [enable_nconf=no])
324
325 #----------------------------------------
326 # Check headers and libs for gconf
327 AS_IF(
328     [test "$need_gtk" = "yes" -o "$need_gtk" = "auto"],
329     [PKG_CHECK_MODULES(
330         [gtk],
331         [gtk+-2.0 gmodule-2.0 libglade-2.0],
332         [has_gtk=yes],
333         [AS_IF(
334             [test "$need_gtk" = "yes"],
335             [AC_MSG_ERROR([could not find GTK+ headers and/or libraries (frontend: gconf)])],
336             [has_gtk=no])])])
337
338 AS_IF(
339     [test "$has_gtk" = "no" ],
340     [enable_gconf=no])
341
342 #----------------------------------------
343 # Check headers and libs for qconf
344 AS_IF(
345     [test "$need_qt" = "yes" -o "$need_qt" = "auto"],
346     [PKG_CHECK_MODULES(
347         [qt4],
348         [QtCore QtGui Qt3Support],
349         [has_qt=yes; need_moc="$need_qt"],
350         [AS_IF(
351             [test "$need_qt" = "yes"],
352             [AC_MSG_ERROR([could not find QT4 headers and/or libraries (frontend: qconf)])],
353             [has_qt=no; need_moc=no])])])
354
355 AC_ARG_VAR([MOC], [Qt meta object compiler (moc) command])
356 AS_IF(
357     [test "$need_moc" = "yes" -o "$need_moc" = "auto"],
358     [QT4_BINDIR=`$PKG_CONFIG Qt --variable bindir`
359      AC_PATH_PROGS(
360         [MOC],
361         [moc-qt4 moc],,
362         [$QT4_BINDIR:$PATH])
363      AS_IF(
364         [test -n "$MOC"],
365         [has_moc=yes],
366         [AS_IF(
367             [test "$need_moc" = "yes"],
368             [AC_MSG_ERROR([could not find moc (frontend: qconf)])],
369             [has_moc=no])])])
370
371 AS_IF(
372     [test "$has_qt" = "no" -o "$has_moc" = "no"],
373     [enable_qconf=no])
374
375 #----------------------------------------
376 # Per-frontends extra libraries
377 AC_ARG_VAR([conf_EXTRA_LIBS],  [Extra libraries to build the conf frontend] )
378 AC_ARG_VAR([gconf_EXTRA_LIBS], [Extra libraries to build the gconf frontend])
379 AC_ARG_VAR([mconf_EXTRA_LIBS], [Extra libraries to build the mconf frontend])
380 AC_ARG_VAR([nconf_EXTRA_LIBS], [Extra libraries to build the nconf frontend])
381 AC_ARG_VAR([qconf_EXTRA_LIBS], [Extra libraries to build the qconf frontend])
382
383 #---------------------------------------------------------------------------
384 # Now, we know what frontends to enable
385 AS_IF([test "$enable_conf"  = "auto"], [enable_conf=yes ])
386 AS_IF([test "$enable_gconf" = "auto"], [enable_gconf=yes])
387 AS_IF([test "$enable_mconf" = "auto"], [enable_mconf=yes])
388 AS_IF([test "$enable_nconf" = "auto"], [enable_nconf=yes])
389 AS_IF([test "$enable_qconf" = "auto"], [enable_qconf=yes])
390
391 #----------------------------------------
392 # Check if the lxdialog library should be built
393 AS_IF(
394     [test "$enable_mconf" = "yes"],
395     [need_lxdialog=yes],
396     [need_lxdialog=no])
397
398 #----------------------------------------
399 # Check if the images library should be built
400 AS_IF(
401     [test "$enable_gconf" = "yes" -o "$enable_qconf" = "yes"],
402     [need_images=yes],
403     [need_images=no])
404
405 #----------------------------------------
406 # Setup automake conditional build
407 AM_CONDITIONAL(
408     [COND_conf],
409     [test "$enable_conf" = "yes"])
410 AM_CONDITIONAL(
411     [COND_mconf],
412     [test "$enable_mconf" = "yes"])
413 AM_CONDITIONAL(
414     [COND_nconf],
415     [test "$enable_nconf" = "yes"])
416 AM_CONDITIONAL(
417     [COND_gconf],
418     [test "$enable_gconf" = "yes"])
419 AM_CONDITIONAL(
420     [COND_qconf],
421     [test "$enable_qconf" = "yes"])
422 AM_CONDITIONAL(
423     [COND_lxdialog],
424     [test "$need_lxdialog" = "yes"])
425 AM_CONDITIONAL(
426     [COND_images],
427     [test "$need_images" = "yes"])
428 AM_CONDITIONAL(
429     [COND_utils],
430     [test "$enable_utils" = "yes"])
431 AM_CONDITIONAL(
432     [COND_utils_gettext],
433     [test "$has_gettext" = "yes"])
434
435 #----------------------------------------
436 # Get the version to apply to the parser shared library
437 AC_SUBST(
438     [KCONFIGPARSER_LIB_VERSION],
439     [m4_esyscmd_s([./scripts/version.sh --plain])])
440
441 #----------------------------------------
442 # Finalise
443 AC_CONFIG_FILES([
444     Makefile
445     docs/Makefile
446     libs/Makefile
447     libs/images/Makefile
448     libs/lxdialog/Makefile
449     libs/parser/Makefile
450     frontends/Makefile
451     frontends/conf/Makefile
452     frontends/mconf/Makefile
453     frontends/nconf/Makefile
454     frontends/gconf/Makefile
455     frontends/qconf/Makefile
456     utils/Makefile
457     scripts/Makefile
458 ])
459 AC_OUTPUT
460
461 #----------------------------------------
462 # Pretty-print the configuration settings
463 [fe_list=]
464 AS_IF([test "$enable_conf"  = "yes"], [fe_list="$fe_list conf" ])
465 AS_IF([test "$enable_gconf" = "yes"], [fe_list="$fe_list gconf"])
466 AS_IF([test "$enable_mconf" = "yes"], [fe_list="$fe_list mconf"])
467 AS_IF([test "$enable_nconf" = "yes"], [fe_list="$fe_list nconf"])
468 AS_IF([test "$enable_qconf" = "yes"], [fe_list="$fe_list qconf"])
469
470 [lib_list=]
471 AS_IF(
472     [test "$enable_shared" = "yes"],
473     [lib_list="$lib_list shared (version: $KCONFIGPARSER_LIB_VERSION)"])
474 AS_IF(
475     [test "$enable_static" = "yes"],
476     [lib_list="$lib_list${lib_list:+,} static"])
477
478 AC_MSG_NOTICE()
479 AC_MSG_NOTICE([Configured with:])
480 AC_MSG_NOTICE([- parser library     :$lib_list])
481 AC_MSG_NOTICE([  - root-menu prompt : $root_menu])
482 AC_MSG_NOTICE([  - config prefix    : $config_prefix])
483 AC_MSG_NOTICE([- frontends          :$fe_list])
484 AC_MSG_NOTICE([  - transform name   : $program_transform_name])
485 AC_MSG_NOTICE([  - localised        : $has_gettext])
486 AC_MSG_NOTICE([- install utilities  : $enable_utils])
487 AC_MSG_NOTICE([- CFLAGS CXXFLAGS    : $wall_CFLAGS $werror_CFLAGS])