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