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