]> git.sur5r.net Git - kconfig-frontends/blob - configure.ac
Documentation: add MacOS X known-issues + typos
[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)" = "git"],
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 # For releases, do not build with -Werror, unless the user explcitly
67 # requests to build with -Werror.
68 # For the devel tree, do build with -Werror by default, unless user
69 # explicitly disables -Werror
70 AS_IF(
71     [test "$(${srcdir}/scripts/version.sh --internal)" = "git"],
72     [werror_CFLAGS=-Werror])
73 AC_ARG_ENABLE(
74     [werror],
75     [AS_HELP_STRING(
76         [--enable-werror],
77         [build with -Werror (default=no)])],
78     [AS_CASE(
79         ["$enableval"],
80         [yes], [werror_CFLAGS=-Werror],
81         [*],   [werror_CFLAGS=""])])
82 AC_SUBST([werror_CFLAGS],[${werror_CFLAGS}])
83
84 # Although there is a default (="linux") in the code, we do provide
85 # a default here, to get a consistent autostuff behavior
86 AC_ARG_ENABLE(
87     [root-menu-prompt],
88     [AS_HELP_STRING(
89         [--enable-root-menu-prompt=PROMPT],
90         [set the root-menu prompt (default=Configuration)])],
91     [AS_CASE(
92         ["$enableval"],
93         [yes], [root_menu=Configuration],
94         [no],  [root_menu=],
95                [# Escape the $ signs, otherwise they would get munged by make
96                 root_menu="$( echo "$enableval" |sed -e 's/\$/\\$$/g;' )"])])
97 AC_SUBST([root_menu], [${root_menu=Configuration}])
98
99 AC_ARG_ENABLE(
100     [config-prefix],
101     [AS_HELP_STRING(
102         [--enable-config-prefix=PREFIX],
103         [the prefix to the config option (default=CONFIG_)])],
104     [AS_CASE(
105         ["$enableval"],
106         [*" "*],[AC_MSG_ERROR([config prefix can not contain spaces: '$enableval'])],
107         [yes],  [config_prefix=CONFIG_],
108         [no],   [config_prefix=],
109                 [config_prefix=$enableval])])
110 AC_SUBST([config_prefix], [${config_prefix-CONFIG_}])
111
112 AC_ARG_ENABLE(
113     [utils],
114     [AS_HELP_STRING(
115         [--disable-utils],
116         [install utilities to manage .config files (default=yes)])])
117 AC_SUBST([enable_utils], [${enable_utils:-yes}])
118
119 AC_ARG_ENABLE(
120     [L10n],
121     [AS_HELP_STRING(
122         [--disable-L10n],
123         [enable localisation (L10n) (default=auto)])])
124 AC_SUBST([enable_L10n], [${enable_L10n:-yes}])
125
126 #----------------------------------------
127 # Options to selectively enable/disable frontends
128 # All are selected by default
129 AC_ARG_ENABLE(
130     [conf],
131     [AS_HELP_STRING(
132         [--disable-conf],
133         [conf, the stdin-based frontend (default=auto)])])
134 AC_SUBST([enable_conf], [${enable_conf:-auto}])
135 AC_ARG_ENABLE(
136     [mconf],
137     [AS_HELP_STRING(
138         [--disable-mconf],
139         [mconf, the traditional ncurses-based frontend (default=auto)])])
140 AC_SUBST([enable_mconf], [${enable_mconf:-auto}])
141 AC_ARG_ENABLE(
142     [nconf],
143     [AS_HELP_STRING(
144         [--disable-nconf],
145         [nconf, the modern ncurses-based frontend (default=auto)])])
146 AC_SUBST([enable_nconf], [${enable_nconf:-auto}])
147 AC_ARG_ENABLE(
148     [gconf],
149     [AS_HELP_STRING(
150         [--disable-gconf],
151         [gconf, the GTK-based frontend (default=auto)])])
152 AC_SUBST([enable_gconf], [${enable_gconf:-auto}])
153 AC_ARG_ENABLE(
154     [qconf],
155     [AS_HELP_STRING(
156         [--disable-qconf],
157         [qconf, the QT-based frontend (default=auto)])])
158 AC_SUBST([enable_qconf], [${enable_qconf:-auto}])
159
160 AC_ARG_ENABLE(
161     [frontends],
162     [AS_HELP_STRING(
163         [--enable-frontends=list],
164         [enables only the set of frontends in comma-separated 'list'
165          (default: auto selection), takes precedence over all
166          --enable-*conf, above])],
167     [for f in conf mconf nconf gconf qconf; do
168         AS_CASE(
169             ["$enableval"],
170             [yes],      [eval enable_$f=yes],
171             ["$f"],     [eval enable_$f=yes],
172             ["$f",*],   [eval enable_$f=yes],
173             [*,"$f"],   [eval enable_$f=yes],
174             [*,"$f",*], [eval enable_$f=yes],
175                         [eval enable_$f=no])
176      done])
177 AC_SUBST([enable_frontends])
178
179 #----------------------------------------
180 # What extra CFLAGS we will be using
181 AC_SUBST([kf_CFLAGS], ["$wall_CFLAGS $werror_CFLAGS"])
182
183 #----------------------------------------
184 # Dependencies that will be needed, depending on the frontends
185 AS_CASE(
186     ["$enable_mconf":"$enable_nconf"],
187     [*yes*],  [need_curses=yes],
188     [*auto*], [need_curses=auto],
189               [need_curses=no])
190 [need_panel_menu="$enable_nconf"]
191 AS_CASE(
192     ["$enable_gconf":"$enable_qconf"],
193     [*yes*],  [need_pkgconfig=yes],
194     [*auto*], [need_pkgconfig=yes],
195               [need_pkgconfig=no ])
196 [need_gtk="$enable_gconf"]
197 [need_qt="$enable_qconf"]
198
199 #---------------------------------------------------------------------------
200 # Now check we have the required stuff
201
202 #----------------------------------------
203 # Some program checks
204 AC_PROG_CC
205 AM_PROG_CC_C_O
206 AC_PROG_CXX
207 AC_C_INLINE
208 AC_PROG_MAKE_SET
209 AC_CHECK_PROGS(
210     [GPERF],
211     [gperf])
212 AS_IF(
213     [test -z "$GPERF"],
214     [AC_MSG_ERROR([can not find gperf])])
215 AS_IF(
216     [test "$need_pkgconfig" = "yes"],
217     [PKG_PROG_PKG_CONFIG()])
218 AC_PROG_LEX
219 AC_SUBST([AM_LFLAGS], ["-L -P zconf"])
220 AC_PROG_YACC
221 AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
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([ncurses_mconf_CPPFLAGS])
259      AC_SUBST([ncurses_LIBS])
260      LIBS_old="$LIBS"
261      LIBS=
262      AC_CHECK_HEADERS(
263         [ncursesw/curses.h ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h],
264         [CURSES_LOC=$ac_header; ncurses_mconf_CPPFLAGS=-DCURSES_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      AS_CASE(
272         [$CURSES_LOC],
273         [ncursesw/*],[ncurses_mconf_CPPFLAGS="$ncurses_mconf_CPPFLAGS -DNCURSES_WIDECHAR=1"])
274      AC_SEARCH_LIBS(
275         [initscr],
276         [ncursesw ncurses curses],
277         [ac_ct_curses_lib_found=yes; break])
278      AS_IF(
279         [test -z "$ac_ct_curses_lib_found"],
280         [AS_IF(
281             [test "$need_curses" = "yes"],
282             [AC_MSG_ERROR([could not find curses library (frontends: mconf/nconf)])],
283             [has_curses=no])])
284      AC_SEARCH_LIBS(
285         [setupterm],
286         [tinfo],
287         [break])
288      ncurses_LIBS="$LIBS"
289      LIBS=$LIBS_old])
290
291 AS_IF(
292     [test "$has_curses" = "no" ],
293     [enable_mconf=no; enable_nconf=no])
294
295 #----------------------------------------
296 # Check for libpanel and libmenu, for the nconf frontend
297 AS_IF(
298     [test "$need_panel_menu" = "yes" -o "$need_panel_menu" = "auto"],
299     [AC_SUBST([ncurses_nconf_CPPFLAGS])
300      AC_SUBST([ncurses_panel_menu_LIBS])
301      AS_CASE(
302         [$CURSES_LOC],
303         [ncursesw/*],[ncurses_nconf_CPPFLAGS="-I/usr/include/ncursesw"],
304         [ncurses/*],[ncurses_nconf_CPPFLAGS="-I/usr/include/ncurses"])
305      LIBS_old="$LIBS"
306      LIBS=
307      AC_SEARCH_LIBS(
308         [new_panel],
309         [panelw panel],
310         [ac_ct_panel_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 libpanel library (frontend: nconf)])],
317             [has_panel_menu=no])])
318      AC_SEARCH_LIBS(
319         [menu_init],
320         [menuw menu],
321         [ac_ct_menu_lib_found=yes; break],,
322         [$ncurses_LIBS])
323      AS_IF(
324         [test -z "$ac_ct_panel_lib_found"],
325         [AS_IF(
326             [test "$need_panel_menu" = "yes"],
327             [AC_MSG_ERROR([could not find libmenu library (frontend: nconf)])],
328             [has_panel_menu=no])])
329      ncurses_panel_menu_LIBS="$LIBS"
330      LIBS=$LIBS_old])
331
332 AS_IF(
333     [test "$has_panel_menu" = "no" ],
334     [enable_nconf=no])
335
336 #----------------------------------------
337 # Check headers and libs for gconf
338 AS_IF(
339     [test "$need_gtk" = "yes" -o "$need_gtk" = "auto"],
340     [PKG_CHECK_MODULES(
341         [gtk],
342         [gtk+-2.0 gmodule-2.0 libglade-2.0],
343         [has_gtk=yes],
344         [AS_IF(
345             [test "$need_gtk" = "yes"],
346             [AC_MSG_ERROR([could not find GTK+ headers and/or libraries (frontend: gconf)])],
347             [has_gtk=no])])])
348
349 AS_IF(
350     [test "$has_gtk" = "no" ],
351     [enable_gconf=no])
352
353 #----------------------------------------
354 # Check headers and libs for qconf
355 AS_IF(
356     [test "$need_qt" = "yes" -o "$need_qt" = "auto"],
357     [PKG_CHECK_MODULES(
358         [qt4],
359         [QtCore QtGui Qt3Support],
360         [has_qt=yes; need_moc="$need_qt"],
361         [AS_IF(
362             [test "$need_qt" = "yes"],
363             [AC_MSG_ERROR([could not find QT4 headers and/or libraries (frontend: qconf)])],
364             [has_qt=no; need_moc=no])])])
365
366 AC_ARG_VAR([MOC], [Qt meta object compiler (moc) command])
367 AS_IF(
368     [test "$need_moc" = "yes" -o "$need_moc" = "auto"],
369     [QT4_BINDIR=`$PKG_CONFIG Qt --variable bindir`
370      AC_PATH_PROGS(
371         [MOC],
372         [moc-qt4 moc],,
373         [$QT4_BINDIR:$PATH])
374      AS_IF(
375         [test -n "$MOC"],
376         [has_moc=yes],
377         [AS_IF(
378             [test "$need_moc" = "yes"],
379             [AC_MSG_ERROR([could not find moc (frontend: qconf)])],
380             [has_moc=no])])])
381
382 AS_IF(
383     [test "$has_qt" = "no" -o "$has_moc" = "no"],
384     [enable_qconf=no])
385
386 #----------------------------------------
387 # Per-frontends extra libraries
388 AC_ARG_VAR([conf_EXTRA_LIBS],  [Extra libraries to build the conf frontend] )
389 AC_ARG_VAR([gconf_EXTRA_LIBS], [Extra libraries to build the gconf frontend])
390 AC_ARG_VAR([mconf_EXTRA_LIBS], [Extra libraries to build the mconf frontend])
391 AC_ARG_VAR([nconf_EXTRA_LIBS], [Extra libraries to build the nconf frontend])
392 AC_ARG_VAR([qconf_EXTRA_LIBS], [Extra libraries to build the qconf frontend])
393
394 #---------------------------------------------------------------------------
395 # Now, we know what frontends to enable
396 AS_IF([test "$enable_conf"  = "auto"], [enable_conf=yes ])
397 AS_IF([test "$enable_gconf" = "auto"], [enable_gconf=yes])
398 AS_IF([test "$enable_mconf" = "auto"], [enable_mconf=yes])
399 AS_IF([test "$enable_nconf" = "auto"], [enable_nconf=yes])
400 AS_IF([test "$enable_qconf" = "auto"], [enable_qconf=yes])
401
402 #----------------------------------------
403 # Check if the lxdialog library should be built
404 AS_IF(
405     [test "$enable_mconf" = "yes"],
406     [need_lxdialog=yes],
407     [need_lxdialog=no])
408
409 #----------------------------------------
410 # Check if the images library should be built
411 AS_IF(
412     [test "$enable_gconf" = "yes" -o "$enable_qconf" = "yes"],
413     [need_images=yes],
414     [need_images=no])
415
416 #----------------------------------------
417 # Setup automake conditional build
418 AM_CONDITIONAL(
419     [COND_conf],
420     [test "$enable_conf" = "yes"])
421 AM_CONDITIONAL(
422     [COND_mconf],
423     [test "$enable_mconf" = "yes"])
424 AM_CONDITIONAL(
425     [COND_nconf],
426     [test "$enable_nconf" = "yes"])
427 AM_CONDITIONAL(
428     [COND_gconf],
429     [test "$enable_gconf" = "yes"])
430 AM_CONDITIONAL(
431     [COND_qconf],
432     [test "$enable_qconf" = "yes"])
433 AM_CONDITIONAL(
434     [COND_lxdialog],
435     [test "$need_lxdialog" = "yes"])
436 AM_CONDITIONAL(
437     [COND_images],
438     [test "$need_images" = "yes"])
439 AM_CONDITIONAL(
440     [COND_utils],
441     [test "$enable_utils" = "yes"])
442 AM_CONDITIONAL(
443     [COND_utils_gettext],
444     [test "$has_gettext" = "yes"])
445
446 #----------------------------------------
447 # Get the version to apply to the parser shared library
448 AC_SUBST(
449     [KCONFIGPARSER_LIB_VERSION],
450     [m4_esyscmd_s([./scripts/version.sh --plain])])
451
452 #----------------------------------------
453 # Finalise
454 AC_CONFIG_FILES([
455     Makefile
456     docs/Makefile
457     libs/Makefile
458     libs/images/Makefile
459     libs/lxdialog/Makefile
460     libs/parser/Makefile
461     frontends/Makefile
462     frontends/conf/Makefile
463     frontends/mconf/Makefile
464     frontends/nconf/Makefile
465     frontends/gconf/Makefile
466     frontends/qconf/Makefile
467     utils/Makefile
468     scripts/Makefile
469 ])
470 AC_OUTPUT
471
472 #----------------------------------------
473 # Pretty-print the configuration settings
474 [fe_list=]
475 AS_IF([test "$enable_conf"  = "yes"], [fe_list="$fe_list conf" ])
476 AS_IF([test "$enable_gconf" = "yes"], [fe_list="$fe_list gconf"])
477 AS_IF([test "$enable_mconf" = "yes"], [fe_list="$fe_list mconf"])
478 AS_IF([test "$enable_nconf" = "yes"], [fe_list="$fe_list nconf"])
479 AS_IF([test "$enable_qconf" = "yes"], [fe_list="$fe_list qconf"])
480
481 [lib_list=]
482 AS_IF(
483     [test "$enable_shared" = "yes"],
484     [lib_list="$lib_list shared (version: $KCONFIGPARSER_LIB_VERSION)"])
485 AS_IF(
486     [test "$enable_static" = "yes"],
487     [lib_list="$lib_list${lib_list:+,} static"])
488
489 AC_MSG_NOTICE()
490 AC_MSG_NOTICE([Configured with:])
491 AC_MSG_NOTICE([- parser library     :$lib_list])
492 AC_MSG_NOTICE([  - root-menu prompt : $root_menu])
493 AC_MSG_NOTICE([  - config prefix    : $config_prefix])
494 AC_MSG_NOTICE([- frontends          :$fe_list])
495 AC_MSG_NOTICE([  - transform name   : $program_transform_name])
496 AC_MSG_NOTICE([  - localised        : $has_gettext])
497 AC_MSG_NOTICE([- install utilities  : $enable_utils])
498 AC_MSG_NOTICE([- CFLAGS CXXFLAGS    : $wall_CFLAGS $werror_CFLAGS])