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