]> git.sur5r.net Git - kconfig-frontends/blob - configure.ac
configure: enable all frontends if --enable-frontends has no list
[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 #----------------------------------------
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 # Some program checks
116 AC_PROG_LEX
117 AC_PROG_YACC
118 AC_CHECK_PROGS(
119     [GPERF],
120     [gperf])
121 AS_IF(
122     [test -z "$GPERF"],
123     [AC_MSG_ERROR([can not find gperf])])
124 AC_SUBST([AM_LFLAGS], ["-L -P zconf"])
125 AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
126
127 #----------------------------------------
128 # Check for gettext, for the kconfig frontends
129 AC_SUBST([GETTEXT])
130 AC_CHECK_HEADERS(
131     [libintl.h],
132     [ac_ct_gettext_hdr=$ac_header; break],
133     [AC_MSG_WARN([libintl is missing, frontends will not be localised])])
134 AS_IF(
135     [test -n "$ac_ct_gettext_hdr"],
136     [AC_CHECK_DECL(
137         [gettext],,
138         [AC_MSG_WARN([gettext is missing, frontends will not be localised])
139          GETTEXT=-DKBUILD_NO_NLS],
140         [#include <$ac_ct_gettext_hdr>])])
141
142 #----------------------------------------
143 # Check for ncurses, for the mconf & nconf frontends
144 AS_CASE(
145     ["$enable_mconf":"$enable_nconf"],
146     [yes:*],  [need_curses=yes],
147     [*:yes],  [need_curses=yes],
148     [auto:*], [need_curses=auto],
149     [*:auto], [need_curses=auto],
150               [need_curses=no])
151
152 AS_IF(
153     [test "$need_curses" = "yes" -o "$need_curses" = "auto"],
154     [AC_SUBST([CURSES_LOC])
155      AC_SUBST([ncurses_LIBS])
156      LIBS_old="$LIBS"
157      AC_CHECK_HEADERS(
158         [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
159         [CURSES_LOC=$ac_header; break])
160      AS_IF(
161         [test -z "$CURSES_LOC"],
162         [AS_IF(
163             [test "$need_curses" = "yes"],
164             [AC_MSG_ERROR([could not find curses headers (frontends: mconf/nconf)])],
165             [has_curses=no])])
166      AC_SEARCH_LIBS(
167         [initscr],
168         [ncursesw ncurses curses],
169         [ac_ct_curses_lib_found=yes; break])
170      AS_IF(
171         [test -z "$ac_ct_curses_lib_found"],
172         [AS_IF(
173             [test "$need_curses" = "yes"],
174             [AC_MSG_ERROR([could not find curses library (frontends: mconf/nconf)])],
175             [has_curses=no])])
176      ncurses_LIBS="$LIBS"
177      LIBS=$LIBS_old])
178
179 AS_IF(
180     [test "$has_curses" = "no" ],
181     [enable_mconf=no; enable_nconf=no])
182
183 #----------------------------------------
184 # Check for libpanel and libmenu, for the nconf frontend
185 [need_panel_menu="$enable_nconf"]
186
187 AS_IF(
188     [test "$need_panel_menu" = "yes" -o "$need_panel_menu" = "auto"],
189     [AC_SUBST([ncurses_extra_LIBS])
190      LIBS_old="$LIBS"
191      AC_SEARCH_LIBS(
192         [new_panel],
193         [panel],
194         [ac_ct_panel_lib_found=yes; break])
195      AS_IF(
196         [test -z "$ac_ct_panel_lib_found"],
197         [AS_IF(
198             [test "$need_panel_menu" = "yes"],
199             [AC_MSG_ERROR([could not find libpanel library (frontend: nconf)])],
200             [has_panel_menu=no])])
201      AC_SEARCH_LIBS(
202         [menu_init],
203         [menu],
204         [ac_ct_menu_lib_found=yes; break])
205      AS_IF(
206         [test -z "$ac_ct_panel_lib_found"],
207         [AS_IF(
208             [test "$need_panel_menu" = "yes"],
209             [AC_MSG_ERROR([could not find libmenu library (frontend: nconf)])],
210             [has_panel_menu=no])])
211      ncurses_extra_LIBS="$LIBS"
212      LIBS=$LIBS_old])
213
214 AS_IF(
215     [test "$has_panel_menu" = "no" ],
216     [enable_nconf=no])
217
218 #----------------------------------------
219 # Check if the lxdialog library should be built
220 AS_IF(
221     [test "$enable_mconf" = "yes" -o "$enable_mconf" = "auto"],
222     [need_lxdialog=yes],
223     [need_lxdialog=no])
224
225 #----------------------------------------
226 # Check pkg-config if needed
227 AS_CASE(
228     ["$enable_gconf":"$enable_qconf"],
229     [yes:*],  [need_pkgconfig=yes],
230     [*:yes],  [need_pkgconfig=yes],
231     [auto:*], [need_pkgconfig=yes],
232     [*:auto], [need_pkgconfig=yes],
233               [need_pkgconfig=no ])
234
235 AS_IF(
236     [test "$need_pkgconfig" = "yes"],
237     [PKG_PROG_PKG_CONFIG()])
238
239 #----------------------------------------
240 # Check headers and libs for gconf
241 [need_gtk="$enable_gconf"]
242
243 AS_IF(
244     [test "$need_gtk" = "yes" -o "$need_gtk" = "auto"],
245     [PKG_CHECK_MODULES(
246         [gtk],
247         [gtk+-2.0 gmodule-2.0 libglade-2.0],
248         [has_gtk=yes],
249         [AS_IF(
250             [test "$need_gtk" = "yes"],
251             [AC_MSG_ERROR([could not find GTK+ headers and/or libraries (frontend: gconf)])],
252             [has_gtk=no])])])
253
254 AS_IF(
255     [test "$has_gtk" = "no" ],
256     [enable_gconf=no])
257
258 #----------------------------------------
259 # Check headers and libs for gconf
260 [need_qt="$enable_qconf"]
261
262 AS_IF(
263     [test "$need_qt" = "yes" -o "$need_qt" = "auto"],
264     [PKG_CHECK_MODULES(
265         [qt4],
266         [QtCore QtGui Qt3Support],
267         [has_qt=yes],
268         [AS_IF(
269             [test "$need_qt" = "yes"],
270             [AC_MSG_ERROR([could not find QT4 headers and/or libraries (frontend: qconf)])],
271             [has_qt=no])])])
272
273 AS_IF(
274     [test "$has_qt" = "no" ],
275     [enable_qconf=no])
276
277 #---------------------------------------------------------------------------
278 # Now, we know what frontends to enable
279 AS_IF([test "$enable_conf"  = "auto"], [enable_conf=yes ])
280 AS_IF([test "$enable_gconf" = "auto"], [enable_gconf=yes])
281 AS_IF([test "$enable_mconf" = "auto"], [enable_mconf=yes])
282 AS_IF([test "$enable_nconf" = "auto"], [enable_nconf=yes])
283 AS_IF([test "$enable_qconf" = "auto"], [enable_qconf=yes])
284
285 #---------------------------------------------------------------------------
286 # Prepare automake
287 AM_INIT_AUTOMAKE
288 AM_PROG_CC_C_O
289 AM_CONDITIONAL(
290     [COND_conf],
291     [test "$enable_conf" = "yes"])
292 AM_CONDITIONAL(
293     [COND_mconf],
294     [test "$enable_mconf" = "yes"])
295 AM_CONDITIONAL(
296     [COND_nconf],
297     [test "$enable_nconf" = "yes"])
298 AM_CONDITIONAL(
299     [COND_gconf],
300     [test "$enable_gconf" = "yes"])
301 AM_CONDITIONAL(
302     [COND_qconf],
303     [test "$enable_qconf" = "yes"])
304 AM_CONDITIONAL(
305     [COND_lxdialog],
306     [test "$need_lxdialog" = "yes"])
307
308 #---------------------------------------------------------------------------
309 # Prepare libtool
310 LT_INIT([disable-static])
311
312 #----------------------------------------
313 # Get the version to apply to the parser shared library
314 AC_SUBST(
315     [KCONFIGPARSER_LIB_VERSION],
316     [m4_esyscmd_s([./scripts/version.sh --plain])])
317
318 #----------------------------------------
319 # Finalise
320 AC_CONFIG_FILES([
321     Makefile
322     libs/Makefile
323     libs/lxdialog/Makefile
324     libs/parser/Makefile
325     frontends/Makefile
326     frontends/conf/Makefile
327     frontends/mconf/Makefile
328     frontends/nconf/Makefile
329     frontends/gconf/Makefile
330     frontends/qconf/Makefile
331 ])
332 AC_OUTPUT
333
334 AC_MSG_NOTICE([Configured with:])
335 AC_MSG_NOTICE([- package name: '$package_name'])
336 AC_MSG_NOTICE([- frontends:])
337 AS_IF([test "$enable_conf" = "yes"],
338       [AC_MSG_NOTICE([  - conf:  yes])],
339       [AC_MSG_NOTICE([  - conf:  no])])
340 AS_IF([test "$enable_gconf" = "yes"],
341       [AC_MSG_NOTICE([  - gconf: yes])],
342       [AC_MSG_NOTICE([  - gconf: no])])
343 AS_IF([test "$enable_mconf" = "yes"],
344       [AC_MSG_NOTICE([  - mconf: yes])],
345       [AC_MSG_NOTICE([  - mconf: no])])
346 AS_IF([test "$enable_nconf" = "yes"],
347       [AC_MSG_NOTICE([  - nconf: yes])],
348       [AC_MSG_NOTICE([  - nconf: no])])
349 AS_IF([test "$enable_qconf" = "yes"],
350       [AC_MSG_NOTICE([  - qconf: yes])],
351       [AC_MSG_NOTICE([  - qconf: no])])
352 AC_MSG_NOTICE([- parser library:])
353 AS_IF([test "$enable_shared" = "yes"],
354       [AC_MSG_NOTICE([  - shared: yes, versioned $KCONFIGPARSER_LIB_VERSION])],
355       [AC_MSG_NOTICE([  - shared: no])])
356 AC_MSG_NOTICE([  - static: $enable_static])