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
207 [test "$need_pkgconfig" = "yes"],
208 [PKG_PROG_PKG_CONFIG()])
209 # Look for `lex'. If it cannot be found, autoconf sets $LEX to ':'.
213 [AC_MSG_ERROR([can not find a lexer generator (such as lex or flex)])])
214 AC_SUBST([AM_LFLAGS], ["-L -P zconf"])
215 # Look for `yacc'. If it cannot be found, autoconf sets $YACC to 'yacc'.
218 [test "$YACC" = "yacc"],
223 [test -z "$YACC_IN_PATH"],
224 [AC_MSG_ERROR([can not find a parser generator (such as yacc or bison)])]))
225 AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
227 #----------------------------------------
228 # Special section to check for gperf.
234 [AC_MSG_ERROR([can not find gperf])])
236 # gperf 3.1 generates functions with 'size_t' instead of 'unsigned int'
237 AC_MSG_CHECKING([for the type used in gperf declarations])
241 [`echo foo,bar | ${GPERF} -L ANSI-C`])
247 const char * in_word_set(const char *, size_t);
250 [GPERF_LEN_TYPE='size_t'],
257 const char * in_word_set(const char *, unsigned int);
260 [GPERF_LEN_TYPE='unsigned int'],
261 [AC_MSG_RESULT([not size_t, not unsigned int. What else?])
262 AC_MSG_FAILURE([unable to detect the type used in gperf declarations])
264 AC_MSG_RESULT([${GPERF_LEN_TYPE}])
265 AC_SUBST([GPERF_LEN_TYPE])
267 #----------------------------------------
268 # Check for gettext, for the kconfig frontends
269 [has_gettext="$enable_L10n"]
271 [test "$has_gettext" = "yes"],
274 [ac_ct_gettext_hdr=$ac_header; break],
277 [test "$has_gettext" = "yes"],
281 [#include <$ac_ct_gettext_hdr>])])
283 [test "$has_gettext" = "yes"],
293 [test "$has_gettext" = "no"],
294 [intl_CPPFLAGS=-DKBUILD_NO_NLS])
295 AC_SUBST([intl_CPPFLAGS])
296 AC_SUBST([intl_LIBS])
298 #----------------------------------------
299 # Check for ncurses, for the mconf & nconf frontends
301 [test "$need_curses" = "yes" -o "$need_curses" = "auto"],
302 [AC_SUBST([ncurses_mconf_CPPFLAGS])
303 AC_SUBST([ncurses_LIBS])
307 [ncursesw/curses.h ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h],
308 [CURSES_LOC=$ac_header
309 ncurses_mconf_CPPFLAGS=-DCURSES_LOC=\\\"$ac_header\\\"
310 break # Stupid syntax-coloring in vim: "])
312 [test -z "$CURSES_LOC"],
314 [test "$need_curses" = "yes"],
315 [AC_MSG_ERROR([could not find curses headers (frontends: mconf/nconf)])],
319 [ncursesw/*],[ncurses_mconf_CPPFLAGS="$ncurses_mconf_CPPFLAGS -DNCURSES_WIDECHAR=1"])
326 [ncursesw ncurses curses],
327 [ac_ct_curses_lib_found=yes; break])
329 [test -z "$ac_ct_curses_lib_found"],
331 [test "$need_curses" = "yes"],
332 [AC_MSG_ERROR([could not find curses library (frontends: mconf/nconf)])],
338 [test "$has_curses" = "no" ],
339 [enable_mconf=no; enable_nconf=no])
341 #----------------------------------------
342 # Check for libpanel and libmenu, for the nconf frontend
344 [test "$need_panel_menu" = "yes" -o "$need_panel_menu" = "auto"],
345 [AC_SUBST([ncurses_nconf_CPPFLAGS])
346 AC_SUBST([ncurses_panel_menu_LIBS])
349 [ncursesw/*],[ncurses_nconf_CPPFLAGS="-I/usr/include/ncursesw"],
350 [ncurses/*],[ncurses_nconf_CPPFLAGS="-I/usr/include/ncurses"])
356 [ac_ct_panel_lib_found=yes; break],,
359 [test -z "$ac_ct_panel_lib_found"],
361 [test "$need_panel_menu" = "yes"],
362 [AC_MSG_ERROR([could not find libpanel library (frontend: nconf)])],
363 [has_panel_menu=no])])
367 [ac_ct_menu_lib_found=yes; break],,
370 [test -z "$ac_ct_panel_lib_found"],
372 [test "$need_panel_menu" = "yes"],
373 [AC_MSG_ERROR([could not find libmenu library (frontend: nconf)])],
374 [has_panel_menu=no])])
375 ncurses_panel_menu_LIBS="$LIBS"
379 [test "$has_panel_menu" = "no" ],
382 #----------------------------------------
383 # Check headers and libs for gconf
385 [test "$need_gtk" = "yes" -o "$need_gtk" = "auto"],
388 [gtk+-2.0 gmodule-2.0 libglade-2.0],
391 [test "$need_gtk" = "yes"],
392 [AC_MSG_ERROR([could not find GTK+ headers and/or libraries (frontend: gconf)])],
396 [test "$has_gtk" = "no" ],
399 #----------------------------------------
400 # Check headers and libs for qconf
402 [test "$need_qt" = "yes" -o "$need_qt" = "auto"],
405 [Qt5Core Qt5Gui Qt5Widgets],
406 [has_qt=yes; need_moc="$need_qt"],
408 [test "$need_qt" = "yes"],
409 [AC_MSG_ERROR([could not find Qt5 headers and/or libraries (frontend: qconf)])],
410 [has_qt=no; need_moc=no])])])
412 AC_ARG_VAR([MOC], [Qt5 meta object compiler (moc) command])
414 [test "$need_moc" = "yes" -o "$need_moc" = "auto"],
415 [QT5_BINDIR=`$PKG_CONFIG Qt5Core --variable host_bins`
424 [test "$need_moc" = "yes"],
425 [AC_MSG_ERROR([could not find moc (frontend: qconf)])],
429 [test "$has_qt" = "no" -o "$has_moc" = "no"],
432 #----------------------------------------
433 # Per-frontends extra libraries
434 AC_ARG_VAR([conf_EXTRA_LIBS], [Extra libraries to build the conf frontend] )
435 AC_ARG_VAR([gconf_EXTRA_LIBS], [Extra libraries to build the gconf frontend])
436 AC_ARG_VAR([mconf_EXTRA_LIBS], [Extra libraries to build the mconf frontend])
437 AC_ARG_VAR([nconf_EXTRA_LIBS], [Extra libraries to build the nconf frontend])
438 AC_ARG_VAR([qconf_EXTRA_LIBS], [Extra libraries to build the qconf frontend])
440 #---------------------------------------------------------------------------
441 # Now, we know what frontends to enable
442 AS_IF([test "$enable_conf" = "auto"], [enable_conf=yes ])
443 AS_IF([test "$enable_gconf" = "auto"], [enable_gconf=yes])
444 AS_IF([test "$enable_mconf" = "auto"], [enable_mconf=yes])
445 AS_IF([test "$enable_nconf" = "auto"], [enable_nconf=yes])
446 AS_IF([test "$enable_qconf" = "auto"], [enable_qconf=yes])
448 #----------------------------------------
449 # Check if the lxdialog library should be built
451 [test "$enable_mconf" = "yes"],
455 #----------------------------------------
456 # Check if the images library should be built
458 [test "$enable_gconf" = "yes" -o "$enable_qconf" = "yes"],
462 #----------------------------------------
463 # Setup automake conditional build
466 [test "$enable_kconfig" = "yes"])
469 [test "$enable_conf" = "yes"])
472 [test "$enable_mconf" = "yes"])
475 [test "$enable_nconf" = "yes"])
478 [test "$enable_gconf" = "yes"])
481 [test "$enable_qconf" = "yes"])
484 [test "$need_lxdialog" = "yes"])
487 [test "$need_images" = "yes"])
490 [test "$enable_utils" = "yes"])
492 [COND_utils_gettext],
493 [test "$has_gettext" = "yes"])
495 #----------------------------------------
496 # Get the version to apply to the parser shared library
498 [KCONFIGPARSER_LIB_VERSION],
499 [m4_esyscmd_s([./scripts/version.sh --plain])])
501 #----------------------------------------
502 # Pretty-print the configuration settings
504 AS_IF([test "$enable_conf" = "yes"], [fe_list="$fe_list conf" ])
505 AS_IF([test "$enable_gconf" = "yes"], [fe_list="$fe_list gconf"])
506 AS_IF([test "$enable_mconf" = "yes"], [fe_list="$fe_list mconf"])
507 AS_IF([test "$enable_nconf" = "yes"], [fe_list="$fe_list nconf"])
508 AS_IF([test "$enable_qconf" = "yes"], [fe_list="$fe_list qconf"])
509 # The meta frontend is handled separatly, below, because we do not
510 # want it in the list of tools, kcfg_list.
512 [kcfg_list="$fe_list"]
513 AS_IF([test "$enable_utils" = "yes"], [kcfg_list="$kcfg_list diff merge tweak"])
514 AS_IF([test "$has_gettext" = "yes"], [kcfg_list="$kcfg_list gettext"])
515 AC_SUBST([kcfg_list], [${kcfg_list}])
517 AS_IF([test "$enable_kconfig" = "yes"], [fe_list=" kconfig$fe_list"])
521 [test "$enable_shared" = "yes"],
522 [lib_list="$lib_list shared (version: $KCONFIGPARSER_LIB_VERSION)"])
524 [test "$enable_static" = "yes"],
525 [lib_list="$lib_list${lib_list:+,} static"])
527 #----------------------------------------
529 # All generated files are generated by a Makefile rule, except Makefile
531 # There is no generic solution in automake to generate a file from its
532 # .in source, so we'd have to provide custom, hand-made rules, which is
533 # not nice. So, we handle libs/parser/kconfig-parser.pc here.
536 libs/parser/kconfig-parser.pc
541 AC_MSG_NOTICE([Configured with:])
542 AC_MSG_NOTICE([- parser library :$lib_list])
543 AC_MSG_NOTICE([ - root-menu prompt : $root_menu])
544 AC_MSG_NOTICE([ - config prefix : $config_prefix])
545 AC_MSG_NOTICE([- frontends :$fe_list])
546 AC_MSG_NOTICE([ - localised : $has_gettext])
547 AC_MSG_NOTICE([- install utilities : $enable_utils])
548 AC_MSG_NOTICE([- CFLAGS CXXFLAGS : $wall_CFLAGS $werror_CFLAGS])