]> git.sur5r.net Git - kconfig-frontends/blob - configure.ac
d7f0a2fc69b8840909bdd1c1dc665d7752d46dd4
[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/scritps])
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     [package-name],
35     [AS_HELP_STRING(
36         [--enable-package-name],
37         [set the package name (default=kconfig-frontends)])],
38     [AS_CASE(
39         ["$enableval"],
40         [yes], [package_name=$PACKAGE_NAME],
41         [no],  [package_name=],
42                [package_name=$enableval])])
43 AC_SUBST([package_name], [${package_name=$PACKAGE_NAME}])
44
45 AC_ARG_ENABLE(
46     [config-prefix],
47     [AS_HELP_STRING(
48         [--enable-config-prefix=PREFIX],
49         [the prefix to the config option (default=CONFIG_)])],
50     [AS_CASE(
51         ["$enableval"],
52         [*" "*],[AC_MSG_ERROR([config prefix can not contain spaces: '$enableval'])],
53         [yes],  [config_prefix=CONFIG_],
54         [no],   [config_prefix=],
55                 [config_prefix=$enableval])])
56 AC_SUBST([config_prefix], [${config_prefix-CONFIG_}])
57
58 #----------------------------------------
59 # Options to selectively enable/disable frontends
60 # All are selected by default
61 AC_ARG_ENABLE(
62     [conf],
63     [AS_HELP_STRING(
64         [--disable-conf],
65         [conf, the stdin-based frontend (default=auto)])])
66 AC_SUBST([enable_conf], [${enable_conf:-auto}])
67 AC_ARG_ENABLE(
68     [mconf],
69     [AS_HELP_STRING(
70         [--disable-mconf],
71         [mconf, the traditional ncurses-based frontend (default=auto)])])
72 AC_SUBST([enable_mconf], [${enable_mconf:-auto}])
73 AC_ARG_ENABLE(
74     [nconf],
75     [AS_HELP_STRING(
76         [--disable-nconf],
77         [nconf, the modern ncurses-based frontend (default=auto)])])
78 AC_SUBST([enable_nconf], [${enable_nconf:-auto}])
79 AC_ARG_ENABLE(
80     [gconf],
81     [AS_HELP_STRING(
82         [--disable-gconf],
83         [gconf, the GTK-based frontend (default=auto)])])
84 AC_SUBST([enable_gconf], [${enable_gconf:-auto}])
85 AC_ARG_ENABLE(
86     [qconf],
87     [AS_HELP_STRING(
88         [--disable-qconf],
89         [qconf, the QT-based frontend (default=auto)])])
90 AC_SUBST([enable_qconf], [${enable_qconf:-auto}])
91
92 AC_ARG_ENABLE(
93     [frontends],
94     [AS_HELP_STRING(
95         [--enable-frontends=list],
96         [enables only the set of frontends in comma-separated 'list'
97          (default: auto selection), takes precedence over all
98          --enable-*conf, above])],
99     [for f in conf mconf nconf gconf qconf; do
100         AS_CASE(
101             ["$enableval"],
102             [yes],      [eval enable_$f=yes],
103             ["$f"],     [eval enable_$f=yes],
104             ["$f",*],   [eval enable_$f=yes],
105             [*,"$f"],   [eval enable_$f=yes],
106             [*,"$f",*], [eval enable_$f=yes],
107                         [eval enable_$f=no])
108      done])
109 AC_SUBST([enable_frontends])
110
111 #----------------------------------------
112 # Dependencies that will be needed, depending on the frontends
113 AS_CASE(
114     ["$enable_mconf":"$enable_nconf"],
115     [*yes*],  [need_curses=yes],
116     [*auto*], [need_curses=auto],
117               [need_curses=no])
118 [need_panel_menu="$enable_nconf"]
119 AS_CASE(
120     ["$enable_gconf":"$enable_qconf"],
121     [*yes*],  [need_pkgconfig=yes],
122     [*auto*], [need_pkgconfig=yes],
123               [need_pkgconfig=no ])
124 [need_gtk="$enable_gconf"]
125 [need_qt="$enable_qconf"]
126
127 #---------------------------------------------------------------------------
128 # Now check we have the required stuff
129
130 #----------------------------------------
131 # Some program checks
132 AC_PROG_CC
133 AM_PROG_CC_C_O
134 AC_PROG_CXX
135 AC_C_INLINE
136 AC_PROG_MAKE_SET
137 AC_CHECK_PROGS(
138     [GPERF],
139     [gperf])
140 AS_IF(
141     [test -z "$GPERF"],
142     [AC_MSG_ERROR([can not find gperf])])
143 AS_IF(
144     [test "$need_pkgconfig" = "yes"],
145     [PKG_PROG_PKG_CONFIG()])
146 AC_PROG_LEX
147 AC_SUBST([AM_LFLAGS], ["-L -P zconf"])
148 AC_PROG_YACC
149 AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
150
151 #----------------------------------------
152 # Check for standard headers
153 AC_HEADER_STDC
154 AC_HEADER_STDBOOL
155 AC_CHECK_HEADERS([ fcntl.h libintl.h limits.h locale.h ])
156 AC_CHECK_HEADERS([ stdlib.h string.h sys/time.h unistd.h ])
157 AC_TYPE_SIZE_T
158
159 #----------------------------------------
160 # Checks for library functions.
161 AC_FUNC_MALLOC
162 AC_FUNC_REALLOC
163 AC_FUNC_ALLOCA
164 AC_CHECK_FUNCS([ bzero memmove memset ])
165 AC_CHECK_FUNCS([ strcasecmp strchr strcspn strdup strncasecmp strpbrk strrchr strspn strtol ])
166 AC_CHECK_FUNCS([ gettimeofday mkdir regcomp setlocale uname ])
167
168 #----------------------------------------
169 # Check for gettext, for the kconfig frontends
170 AC_SUBST([GETTEXT])
171 AC_CHECK_HEADERS(
172     [libintl.h],
173     [ac_ct_gettext_hdr=$ac_header; break],
174     [AC_MSG_WARN([libintl is missing, frontends will not be localised])])
175 AS_IF(
176     [test -n "$ac_ct_gettext_hdr"],
177     [AC_CHECK_DECL(
178         [gettext],,
179         [AC_MSG_WARN([gettext is missing, frontends will not be localised])
180          GETTEXT=-DKBUILD_NO_NLS],
181         [#include <$ac_ct_gettext_hdr>])])
182
183 #----------------------------------------
184 # Check for ncurses, for the mconf & nconf frontends
185 AS_IF(
186     [test "$need_curses" = "yes" -o "$need_curses" = "auto"],
187     [AC_SUBST([CURSES_LOC])
188      AC_SUBST([ncurses_LIBS])
189      LIBS_old="$LIBS"
190      AC_CHECK_HEADERS(
191         [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
192         [CURSES_LOC=$ac_header; break])
193      AS_IF(
194         [test -z "$CURSES_LOC"],
195         [AS_IF(
196             [test "$need_curses" = "yes"],
197             [AC_MSG_ERROR([could not find curses headers (frontends: mconf/nconf)])],
198             [has_curses=no])])
199      AC_SEARCH_LIBS(
200         [initscr],
201         [ncursesw ncurses curses],
202         [ac_ct_curses_lib_found=yes; break])
203      AS_IF(
204         [test -z "$ac_ct_curses_lib_found"],
205         [AS_IF(
206             [test "$need_curses" = "yes"],
207             [AC_MSG_ERROR([could not find curses library (frontends: mconf/nconf)])],
208             [has_curses=no])])
209      ncurses_LIBS="$LIBS"
210      LIBS=$LIBS_old])
211
212 AS_IF(
213     [test "$has_curses" = "no" ],
214     [enable_mconf=no; enable_nconf=no])
215
216 #----------------------------------------
217 # Check for libpanel and libmenu, for the nconf frontend
218 AS_IF(
219     [test "$need_panel_menu" = "yes" -o "$need_panel_menu" = "auto"],
220     [AC_SUBST([ncurses_extra_LIBS])
221      LIBS_old="$LIBS"
222      AC_SEARCH_LIBS(
223         [new_panel],
224         [panelw panel],
225         [ac_ct_panel_lib_found=yes; break])
226      AS_IF(
227         [test -z "$ac_ct_panel_lib_found"],
228         [AS_IF(
229             [test "$need_panel_menu" = "yes"],
230             [AC_MSG_ERROR([could not find libpanel library (frontend: nconf)])],
231             [has_panel_menu=no])])
232      AC_SEARCH_LIBS(
233         [menu_init],
234         [menuw menu],
235         [ac_ct_menu_lib_found=yes; break])
236      AS_IF(
237         [test -z "$ac_ct_panel_lib_found"],
238         [AS_IF(
239             [test "$need_panel_menu" = "yes"],
240             [AC_MSG_ERROR([could not find libmenu library (frontend: nconf)])],
241             [has_panel_menu=no])])
242      ncurses_extra_LIBS="$LIBS"
243      LIBS=$LIBS_old])
244
245 AS_IF(
246     [test "$has_panel_menu" = "no" ],
247     [enable_nconf=no])
248
249 #----------------------------------------
250 # Check headers and libs for gconf
251 AS_IF(
252     [test "$need_gtk" = "yes" -o "$need_gtk" = "auto"],
253     [PKG_CHECK_MODULES(
254         [gtk],
255         [gtk+-2.0 gmodule-2.0 libglade-2.0],
256         [has_gtk=yes],
257         [AS_IF(
258             [test "$need_gtk" = "yes"],
259             [AC_MSG_ERROR([could not find GTK+ headers and/or libraries (frontend: gconf)])],
260             [has_gtk=no])])])
261
262 AS_IF(
263     [test "$has_gtk" = "no" ],
264     [enable_gconf=no])
265
266 #----------------------------------------
267 # Check headers and libs for qconf
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 # Setup automake conditional build
300 AM_CONDITIONAL(
301     [COND_conf],
302     [test "$enable_conf" = "yes"])
303 AM_CONDITIONAL(
304     [COND_mconf],
305     [test "$enable_mconf" = "yes"])
306 AM_CONDITIONAL(
307     [COND_nconf],
308     [test "$enable_nconf" = "yes"])
309 AM_CONDITIONAL(
310     [COND_gconf],
311     [test "$enable_gconf" = "yes"])
312 AM_CONDITIONAL(
313     [COND_qconf],
314     [test "$enable_qconf" = "yes"])
315 AM_CONDITIONAL(
316     [COND_lxdialog],
317     [test "$need_lxdialog" = "yes"])
318
319 #----------------------------------------
320 # Get the version to apply to the parser shared library
321 AC_SUBST(
322     [KCONFIGPARSER_LIB_VERSION],
323     [m4_esyscmd_s([./scripts/version.sh --plain])])
324
325 #----------------------------------------
326 # Finalise
327 AC_CONFIG_FILES([
328     Makefile
329     libs/Makefile
330     libs/images/Makefile
331     libs/lxdialog/Makefile
332     libs/parser/Makefile
333     frontends/Makefile
334     frontends/conf/Makefile
335     frontends/mconf/Makefile
336     frontends/nconf/Makefile
337     frontends/gconf/Makefile
338     frontends/qconf/Makefile
339 ])
340 AC_OUTPUT
341
342 AC_MSG_NOTICE()
343 AC_MSG_NOTICE([Configured with:])
344 AC_MSG_NOTICE([- package name: '$package_name'])
345 AC_MSG_NOTICE([- config prefix: '$config_prefix'])
346 AC_MSG_NOTICE([- frontends:])
347 AS_IF([test "$enable_conf" = "yes"],
348       [AC_MSG_NOTICE([  - conf:  yes])],
349       [AC_MSG_NOTICE([  - conf:  no])])
350 AS_IF([test "$enable_gconf" = "yes"],
351       [AC_MSG_NOTICE([  - gconf: yes])],
352       [AC_MSG_NOTICE([  - gconf: no])])
353 AS_IF([test "$enable_mconf" = "yes"],
354       [AC_MSG_NOTICE([  - mconf: yes])],
355       [AC_MSG_NOTICE([  - mconf: no])])
356 AS_IF([test "$enable_nconf" = "yes"],
357       [AC_MSG_NOTICE([  - nconf: yes])],
358       [AC_MSG_NOTICE([  - nconf: no])])
359 AS_IF([test "$enable_qconf" = "yes"],
360       [AC_MSG_NOTICE([  - qconf: yes])],
361       [AC_MSG_NOTICE([  - qconf: no])])
362 AC_MSG_NOTICE([- parser library:])
363 AS_IF([test "$enable_shared" = "yes"],
364       [AC_MSG_NOTICE([  - shared: yes, versioned $KCONFIGPARSER_LIB_VERSION])],
365       [AC_MSG_NOTICE([  - shared: no])])
366 AC_MSG_NOTICE([  - static: $enable_static])