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