2 # Process this file with autoconf to produce a configure script.
4 #---------------------------------------------------------------------------
5 # Global initialisation
7 #----------------------------------------
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])
20 #----------------------------------------
23 AM_INIT_AUTOMAKE([foreign subdir-objects])
25 # For releases, enable silent rules, unless the user explicitly
27 # For the devel tree, do build with verbose output, unless user
28 # explicitly enables silent rules
30 [test "$(${srcdir}/scripts/version.sh --internal)" = "git"],
32 [AM_SILENT_RULES([yes])])
34 #----------------------------------------
36 m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl Automake, we have a problem...
38 LT_INIT([disable-static])
40 #---------------------------------------------------------------------------
43 # By default, do build with -Wall, unless the user asks not to
49 [build with -Wall (default=yes)])],
52 [yes], [wall_CFLAGS=-Wall],
53 [*], [wall_CFLAGS=""])])
54 AC_SUBST([wall_CFLAGS],[${wall_CFLAGS}])
56 # For releases, do not build with -Werror, unless the user explicitly
57 # requests to build with -Werror.
58 # For the devel tree, do build with -Werror by default, unless user
59 # explicitly disables -Werror
61 [test "$(${srcdir}/scripts/version.sh --internal)" = "git"],
62 [werror_CFLAGS=-Werror])
67 [build with -Werror (default=no)])],
70 [yes], [werror_CFLAGS=-Werror],
71 [*], [werror_CFLAGS=""])])
72 AC_SUBST([werror_CFLAGS],[${werror_CFLAGS}])
74 # Although there is a default (="linux") in the code, we do provide
75 # a default here, to get a consistent autostuff behavior
79 [--enable-root-menu-prompt=PROMPT],
80 [set the root-menu prompt (default=Configuration)])],
83 [yes], [root_menu=Configuration],
85 [# Escape the $ signs, otherwise they would get munged by make
86 root_menu="$( echo "$enableval" |sed -e 's/\$/\\$$/g;' )"])])
87 AC_SUBST([root_menu], [${root_menu=Configuration}])
92 [--enable-config-prefix=PREFIX],
93 [the prefix to the config option (default=CONFIG_)])],
96 [*" "*],[AC_MSG_ERROR([config prefix can not contain spaces: '$enableval'])],
97 [yes], [config_prefix=CONFIG_],
98 [no], [config_prefix=],
99 [config_prefix=$enableval])])
100 AC_SUBST([config_prefix], [${config_prefix-CONFIG_}])
106 [install utilities to manage .config files (default=yes)])])
107 AC_SUBST([enable_utils], [${enable_utils:-yes}])
113 [enable localisation (L10n) (default=auto)])])
114 AC_SUBST([enable_L10n], [${enable_L10n:-yes}])
116 #----------------------------------------
117 # Options to selectively enable/disable frontends
118 # All are selected by default
123 [kconfig, the meta-frontend to all kconfig tools (default=yes)])])
124 AC_SUBST([enable_kconfig], [${enable_kconfig:-yes}])
130 [conf, the stdin-based frontend (default=auto)])])
131 AC_SUBST([enable_conf], [${enable_conf:-auto}])
136 [mconf, the traditional ncurses-based frontend (default=auto)])])
137 AC_SUBST([enable_mconf], [${enable_mconf:-auto}])
142 [nconf, the modern ncurses-based frontend (default=auto)])])
143 AC_SUBST([enable_nconf], [${enable_nconf:-auto}])
148 [gconf, the GTK-based frontend (default=auto)])])
149 AC_SUBST([enable_gconf], [${enable_gconf:-auto}])
154 [qconf, the QT-based frontend (default=auto)])])
155 AC_SUBST([enable_qconf], [${enable_qconf:-auto}])
160 [--enable-frontends=list],
161 [enables only the set of frontends in comma-separated 'list'
162 (default: auto selection), takes precedence over all
163 --enable-*conf, above])],
164 [for f in conf mconf nconf gconf qconf; do
167 [yes], [eval enable_$f=yes],
168 ["$f"], [eval enable_$f=yes],
169 ["$f",*], [eval enable_$f=yes],
170 [*,"$f"], [eval enable_$f=yes],
171 [*,"$f",*], [eval enable_$f=yes],
174 AC_SUBST([enable_frontends])
176 #----------------------------------------
177 # What extra CFLAGS we will be using
178 AC_SUBST([kf_CFLAGS], ["$wall_CFLAGS $werror_CFLAGS"])
180 #----------------------------------------
181 # Dependencies that will be needed, depending on the frontends
183 ["$enable_mconf":"$enable_nconf"],
184 [*yes*], [need_curses=yes],
185 [*auto*], [need_curses=auto],
187 [need_panel_menu="$enable_nconf"]
189 ["$enable_gconf":"$enable_qconf"],
190 [*yes*], [need_pkgconfig=yes],
191 [*auto*], [need_pkgconfig=yes],
192 [need_pkgconfig=no ])
193 [need_gtk="$enable_gconf"]
194 [need_qt="$enable_qconf"]
196 #---------------------------------------------------------------------------
197 # Now check we have the required stuff
199 #----------------------------------------
200 # Some program checks
211 [AC_MSG_ERROR([can not find gperf])])
213 [test "$need_pkgconfig" = "yes"],
214 [PKG_PROG_PKG_CONFIG()])
215 # Look for `lex'. If it cannot be found, autoconf sets $LEX to ':'.
219 [AC_MSG_ERROR([can not find a lexer generator (such as lex or flex)])])
220 AC_SUBST([AM_LFLAGS], ["-L -P zconf"])
221 # Look for `yacc'. If it cannot be found, autoconf sets $YACC to 'yacc'.
224 [test "$YACC" = "yacc"],
229 [test -z "$YACC_IN_PATH"],
230 [AC_MSG_ERROR([can not find a parser generator (such as yacc or bison)])]))
231 AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
233 #----------------------------------------
234 # Check for gettext, for the kconfig frontends
235 [has_gettext="$enable_L10n"]
237 [test "$has_gettext" = "yes"],
240 [ac_ct_gettext_hdr=$ac_header; break],
243 [test "$has_gettext" = "yes"],
247 [#include <$ac_ct_gettext_hdr>])])
249 [test "$has_gettext" = "yes"],
259 [test "$has_gettext" = "no"],
260 [intl_CPPFLAGS=-DKBUILD_NO_NLS])
261 AC_SUBST([intl_CPPFLAGS])
262 AC_SUBST([intl_LIBS])
264 #----------------------------------------
265 # Check for ncurses, for the mconf & nconf frontends
267 [test "$need_curses" = "yes" -o "$need_curses" = "auto"],
268 [AC_SUBST([ncurses_mconf_CPPFLAGS])
269 AC_SUBST([ncurses_LIBS])
273 [ncursesw/curses.h ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h],
274 [CURSES_LOC=$ac_header
275 ncurses_mconf_CPPFLAGS=-DCURSES_LOC=\\\"$ac_header\\\"
276 break # Stupid syntax-coloring in vim: "])
278 [test -z "$CURSES_LOC"],
280 [test "$need_curses" = "yes"],
281 [AC_MSG_ERROR([could not find curses headers (frontends: mconf/nconf)])],
285 [ncursesw/*],[ncurses_mconf_CPPFLAGS="$ncurses_mconf_CPPFLAGS -DNCURSES_WIDECHAR=1"])
292 [ncursesw ncurses curses],
293 [ac_ct_curses_lib_found=yes; break])
295 [test -z "$ac_ct_curses_lib_found"],
297 [test "$need_curses" = "yes"],
298 [AC_MSG_ERROR([could not find curses library (frontends: mconf/nconf)])],
304 [test "$has_curses" = "no" ],
305 [enable_mconf=no; enable_nconf=no])
307 #----------------------------------------
308 # Check for libpanel and libmenu, for the nconf frontend
310 [test "$need_panel_menu" = "yes" -o "$need_panel_menu" = "auto"],
311 [AC_SUBST([ncurses_nconf_CPPFLAGS])
312 AC_SUBST([ncurses_panel_menu_LIBS])
315 [ncursesw/*],[ncurses_nconf_CPPFLAGS="-I/usr/include/ncursesw"],
316 [ncurses/*],[ncurses_nconf_CPPFLAGS="-I/usr/include/ncurses"])
322 [ac_ct_panel_lib_found=yes; break],,
325 [test -z "$ac_ct_panel_lib_found"],
327 [test "$need_panel_menu" = "yes"],
328 [AC_MSG_ERROR([could not find libpanel library (frontend: nconf)])],
329 [has_panel_menu=no])])
333 [ac_ct_menu_lib_found=yes; break],,
336 [test -z "$ac_ct_panel_lib_found"],
338 [test "$need_panel_menu" = "yes"],
339 [AC_MSG_ERROR([could not find libmenu library (frontend: nconf)])],
340 [has_panel_menu=no])])
341 ncurses_panel_menu_LIBS="$LIBS"
345 [test "$has_panel_menu" = "no" ],
348 #----------------------------------------
349 # Check headers and libs for gconf
351 [test "$need_gtk" = "yes" -o "$need_gtk" = "auto"],
354 [gtk+-2.0 gmodule-2.0 libglade-2.0],
357 [test "$need_gtk" = "yes"],
358 [AC_MSG_ERROR([could not find GTK+ headers and/or libraries (frontend: gconf)])],
362 [test "$has_gtk" = "no" ],
365 #----------------------------------------
366 # Check headers and libs for qconf
368 [test "$need_qt" = "yes" -o "$need_qt" = "auto"],
371 [Qt5Core Qt5Gui Qt5Widgets],
372 [has_qt=yes; need_moc="$need_qt"],
374 [test "$need_qt" = "yes"],
375 [AC_MSG_ERROR([could not find Qt5 headers and/or libraries (frontend: qconf)])],
376 [has_qt=no; need_moc=no])])])
378 AC_ARG_VAR([MOC], [Qt5 meta object compiler (moc) command])
380 [test "$need_moc" = "yes" -o "$need_moc" = "auto"],
381 [QT5_BINDIR=`$PKG_CONFIG Qt5Core --variable host_bins`
390 [test "$need_moc" = "yes"],
391 [AC_MSG_ERROR([could not find moc (frontend: qconf)])],
395 [test "$has_qt" = "no" -o "$has_moc" = "no"],
398 #----------------------------------------
399 # Per-frontends extra libraries
400 AC_ARG_VAR([conf_EXTRA_LIBS], [Extra libraries to build the conf frontend] )
401 AC_ARG_VAR([gconf_EXTRA_LIBS], [Extra libraries to build the gconf frontend])
402 AC_ARG_VAR([mconf_EXTRA_LIBS], [Extra libraries to build the mconf frontend])
403 AC_ARG_VAR([nconf_EXTRA_LIBS], [Extra libraries to build the nconf frontend])
404 AC_ARG_VAR([qconf_EXTRA_LIBS], [Extra libraries to build the qconf frontend])
406 #---------------------------------------------------------------------------
407 # Now, we know what frontends to enable
408 AS_IF([test "$enable_conf" = "auto"], [enable_conf=yes ])
409 AS_IF([test "$enable_gconf" = "auto"], [enable_gconf=yes])
410 AS_IF([test "$enable_mconf" = "auto"], [enable_mconf=yes])
411 AS_IF([test "$enable_nconf" = "auto"], [enable_nconf=yes])
412 AS_IF([test "$enable_qconf" = "auto"], [enable_qconf=yes])
414 #----------------------------------------
415 # Check if the lxdialog library should be built
417 [test "$enable_mconf" = "yes"],
421 #----------------------------------------
422 # Check if the images library should be built
424 [test "$enable_gconf" = "yes" -o "$enable_qconf" = "yes"],
428 #----------------------------------------
429 # Setup automake conditional build
432 [test "$enable_kconfig" = "yes"])
435 [test "$enable_conf" = "yes"])
438 [test "$enable_mconf" = "yes"])
441 [test "$enable_nconf" = "yes"])
444 [test "$enable_gconf" = "yes"])
447 [test "$enable_qconf" = "yes"])
450 [test "$need_lxdialog" = "yes"])
453 [test "$need_images" = "yes"])
456 [test "$enable_utils" = "yes"])
458 [COND_utils_gettext],
459 [test "$has_gettext" = "yes"])
461 #----------------------------------------
462 # Get the version to apply to the parser shared library
464 [KCONFIGPARSER_LIB_VERSION],
465 [m4_esyscmd_s([./scripts/version.sh --plain])])
467 #----------------------------------------
468 # Pretty-print the configuration settings
470 AS_IF([test "$enable_conf" = "yes"], [fe_list="$fe_list conf" ])
471 AS_IF([test "$enable_gconf" = "yes"], [fe_list="$fe_list gconf"])
472 AS_IF([test "$enable_mconf" = "yes"], [fe_list="$fe_list mconf"])
473 AS_IF([test "$enable_nconf" = "yes"], [fe_list="$fe_list nconf"])
474 AS_IF([test "$enable_qconf" = "yes"], [fe_list="$fe_list qconf"])
475 # The meta frontend is handled separatly, below, because we do not
476 # want it in the list of tools, kcfg_list.
478 [kcfg_list="$fe_list"]
479 AS_IF([test "$enable_utils" = "yes"], [kcfg_list="$kcfg_list diff merge tweak"])
480 AS_IF([test "$has_gettext" = "yes"], [kcfg_list="$kcfg_list gettext"])
481 AC_SUBST([kcfg_list], [${kcfg_list}])
483 AS_IF([test "$enable_kconfig" = "yes"], [fe_list=" kconfig$fe_list"])
487 [test "$enable_shared" = "yes"],
488 [lib_list="$lib_list shared (version: $KCONFIGPARSER_LIB_VERSION)"])
490 [test "$enable_static" = "yes"],
491 [lib_list="$lib_list${lib_list:+,} static"])
493 #----------------------------------------
495 # All generated files are generated by a Makefile rule, except Makefile
497 # There is no generic solution in automake to generate a file from its
498 # .in source, so we'd have to provide custom, hand-made rules, which is
499 # not nice. So, we handle libs/parser/kconfig-parser.pc here.
502 libs/parser/kconfig-parser.pc
507 AC_MSG_NOTICE([Configured with:])
508 AC_MSG_NOTICE([- parser library :$lib_list])
509 AC_MSG_NOTICE([ - root-menu prompt : $root_menu])
510 AC_MSG_NOTICE([ - config prefix : $config_prefix])
511 AC_MSG_NOTICE([- frontends :$fe_list])
512 AC_MSG_NOTICE([ - localised : $has_gettext])
513 AC_MSG_NOTICE([- install utilities : $enable_utils])
514 AC_MSG_NOTICE([- CFLAGS CXXFLAGS : $wall_CFLAGS $werror_CFLAGS])