]> git.sur5r.net Git - kconfig-frontends/blob - configure.ac
configure: if not explicitly enabled, disable frontends with missing deps
[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 # Options to selectively enable/disable frontends
47 # All are selected by default
48 AC_ARG_ENABLE(
49     [conf],
50     [AS_HELP_STRING(
51         [--disable-conf],
52         [conf, the stdin-based frontend (default=enabled)])])
53 AC_SUBST([enable_conf], [${enable_conf:-auto}])
54 AC_ARG_ENABLE(
55     [mconf],
56     [AS_HELP_STRING(
57         [--disable-mconf],
58         [mconf, the traditional ncurses-based frontend (default=enabled)])])
59 AC_SUBST([enable_mconf], [${enable_mconf:-auto}])
60 AC_ARG_ENABLE(
61     [nconf],
62     [AS_HELP_STRING(
63         [--disable-nconf],
64         [nconf, the modern ncurses-based frontend (default=enabled)])])
65 AC_SUBST([enable_nconf], [${enable_nconf:-auto}])
66 AC_ARG_ENABLE(
67     [gconf],
68     [AS_HELP_STRING(
69         [--disable-gconf],
70         [gconf, the GTK-based frontend (default=enabled)])])
71 AC_SUBST([enable_gconf], [${enable_gconf:-auto}])
72 AC_ARG_ENABLE(
73     [qconf],
74     [AS_HELP_STRING(
75         [--disable-qconf],
76         [qconf, the QT-based frontend (default=enabled)])])
77 AC_SUBST([enable_qconf], [${enable_qconf:-auto}])
78
79 #----------------------------------------
80 # Some program checks
81 AC_PROG_RANLIB
82 AC_PROG_LEX
83 AC_PROG_YACC
84 AC_CHECK_PROGS(
85     [GPERF],
86     [gperf])
87 AS_IF(
88     [test -z "$GPERF"],
89     [AC_MSG_ERROR([can not find gperf])])
90 AC_SUBST([AM_LFLAGS], ["-L -P zconf"])
91 AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
92
93 #----------------------------------------
94 # Check for gettext, for the kconfig frontends
95 AC_SUBST([GETTEXT])
96 AC_CHECK_HEADERS(
97     [libintl.h],
98     [ac_ct_gettext_hdr=$ac_header; break],
99     [AC_MSG_WARN([libintl is missing, frontends will not be localised])])
100 AS_IF(
101     [test -n "$ac_ct_gettext_hdr"],
102     [AC_CHECK_DECL(
103         [gettext],,
104         [AC_MSG_WARN([gettext is missing, frontends will not be localised])
105          GETTEXT=-DKBUILD_NO_NLS],
106         [#include <$ac_ct_gettext_hdr>])])
107
108 #----------------------------------------
109 # Check for ncurses, for the mconf & nconf frontends
110 AS_CASE(
111     ["$enable_mconf":"$enable_nconf"],
112     [yes:*],  [need_curses=yes],
113     [*:yes],  [need_curses=yes],
114     [auto:*], [need_curses=auto],
115     [*:auto], [need_curses=auto],
116               [need_curses=no])
117
118 AS_IF(
119     [test "$need_curses" = "yes" -o "$need_curses" = "auto"],
120     [AC_SUBST([CURSES_LOC])
121      AC_CHECK_HEADERS(
122         [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
123         [CURSES_LOC=$ac_header; break])
124      AS_IF(
125         [test -z "$CURSES_LOC"],
126         [AS_IF(
127             [test "$need_curses" = "yes"],
128             [AC_MSG_ERROR([could not find curses headers (frontends: mconf/nconf)])],
129             [has_curses=no])])
130      AC_SEARCH_LIBS(
131         [initscr],
132         [ncursesw ncurses curses],
133         [ac_ct_curses_lib_found=yes; break])
134      AS_IF(
135         [test -z "$ac_ct_curses_lib_found"],
136         [AS_IF(
137             [test "$need_curses" = "yes"],
138             [AC_MSG_ERROR([could not find curses library (frontends: mconf/nconf)])],
139             [has_curses=no])])])
140
141 AS_IF(
142     [test "$has_curses" = "no" ],
143     [enable_mconf=no; enable_nconf=no])
144
145 #----------------------------------------
146 # Check for libpanel and libmenu, for the nconf frontend
147 [need_panel_menu="$enable_nconf"]
148
149 AS_IF(
150     [test "$need_panel_menu" = "yes" -o "$need_panel_menu" = "auto"],
151     [AC_SEARCH_LIBS(
152         [new_panel],
153         [panel],
154         [ac_ct_panel_lib_found=yes; break])
155      AS_IF(
156         [test -z "$ac_ct_panel_lib_found"],
157         [AS_IF(
158             [test "$need_panel_menu" = "yes"],
159             [AC_MSG_ERROR([could not find libpanel library (frontend: nconf)])],
160             [has_panel_menu=no])])
161      AC_SEARCH_LIBS(
162         [menu_init],
163         [menu],
164         [ac_ct_menu_lib_found=yes; break])
165      AS_IF(
166         [test -z "$ac_ct_panel_lib_found"],
167         [AS_IF(
168             [test "$need_panel_menu" = "yes"],
169             [AC_MSG_ERROR([could not find libmenu library (frontend: nconf)])],
170             [has_panel_menu=no])])])
171
172 AS_IF(
173     [test "$has_panel_menu" = "no" ],
174     [enable_nconf=no])
175
176 #----------------------------------------
177 # Check if the lxdialog library should be built
178 AS_IF(
179     [test "$enable_mconf" = "yes" -o "$enable_mconf" = "auto"],
180     [need_lxdialog=yes],
181     [need_lxdialog=no])
182
183 #----------------------------------------
184 # Check pkg-config if needed
185 AS_CASE(
186     ["$enable_gconf":"$enable_qconf"],
187     [yes:*],  [need_pkgconfig=yes],
188     [*:yes],  [need_pkgconfig=yes],
189     [auto:*], [need_pkgconfig=yes],
190     [*:auto], [need_pkgconfig=yes],
191               [need_pkgconfig=no ])
192
193 AS_IF(
194     [test "$need_pkgconfig" = "yes"],
195     [PKG_PROG_PKG_CONFIG()])
196
197 #----------------------------------------
198 # Check headers and libs for gconf
199 [need_gtk="$enable_gconf"]
200
201 AS_IF(
202     [test "$need_gtk" = "yes" -o "$need_gtk" = "auto"],
203     [PKG_CHECK_MODULES(
204         [gtk],
205         [gtk+-2.0 gmodule-2.0 libglade-2.0],
206         [has_gtk=yes],
207         [AS_IF(
208             [test "$need_gtk" = "yes"],
209             [AC_MSG_ERROR([could not find GTK+ headers and/or libraries (frontend: gconf)])],
210             [has_gtk=no])])])
211
212 AS_IF(
213     [test "$has_gtk" = "no" ],
214     [enable_gconf=no])
215
216 #----------------------------------------
217 # Check headers and libs for gconf
218 [need_qt="$enable_qconf"]
219
220 AS_IF(
221     [test "$need_qt" = "yes" -o "$need_qt" = "auto"],
222     [PKG_CHECK_MODULES(
223         [qt4],
224         [QtCore QtGui Qt3Support],
225         [has_qt=yes],
226         [AS_IF(
227             [test "$need_qt" = "yes"],
228             [AC_MSG_ERROR([could not find QT4 headers and/or libraries (frontend: qconf)])],
229             [has_qt=no])])])
230
231 AS_IF(
232     [test "$has_qt" = "no" ],
233     [enable_qconf=no])
234
235 #---------------------------------------------------------------------------
236 # Now, we know what frontends to enable
237 AS_IF([test "$enable_conf"  = "auto"], [enable_conf=yes ])
238 AS_IF([test "$enable_gconf" = "auto"], [enable_gconf=yes])
239 AS_IF([test "$enable_mconf" = "auto"], [enable_mconf=yes])
240 AS_IF([test "$enable_nconf" = "auto"], [enable_nconf=yes])
241 AS_IF([test "$enable_qconf" = "auto"], [enable_qconf=yes])
242
243 #---------------------------------------------------------------------------
244 # Prepare automake
245 AM_INIT_AUTOMAKE
246 AM_PROG_CC_C_O
247 AM_CONDITIONAL(
248     [COND_conf],
249     [test "$enable_conf" = "yes"])
250 AM_CONDITIONAL(
251     [COND_mconf],
252     [test "$enable_mconf" = "yes"])
253 AM_CONDITIONAL(
254     [COND_nconf],
255     [test "$enable_nconf" = "yes"])
256 AM_CONDITIONAL(
257     [COND_gconf],
258     [test "$enable_gconf" = "yes"])
259 AM_CONDITIONAL(
260     [COND_qconf],
261     [test "$enable_qconf" = "yes"])
262 AM_CONDITIONAL(
263     [COND_lxdialog],
264     [test "$need_lxdialog" = "yes"])
265
266 #----------------------------------------
267 # Finalise
268 AC_CONFIG_FILES([
269     Makefile
270     libs/Makefile
271     libs/lxdialog/Makefile
272     libs/parser/Makefile
273     frontends/Makefile
274     frontends/conf/Makefile
275     frontends/mconf/Makefile
276     frontends/nconf/Makefile
277     frontends/gconf/Makefile
278     frontends/qconf/Makefile
279 ])
280 AC_OUTPUT
281
282 AC_MSG_NOTICE([Configured with:])
283 AS_IF([test "$enable_conf" = "yes"],
284       [AC_MSG_NOTICE([  - conf:  yes])],
285       [AC_MSG_NOTICE([  - conf:  no])])
286 AS_IF([test "$enable_gconf" = "yes"],
287       [AC_MSG_NOTICE([  - gconf: yes])],
288       [AC_MSG_NOTICE([  - gconf: no])])
289 AS_IF([test "$enable_mconf" = "yes"],
290       [AC_MSG_NOTICE([  - mconf: yes])],
291       [AC_MSG_NOTICE([  - mconf: no])])
292 AS_IF([test "$enable_nconf" = "yes"],
293       [AC_MSG_NOTICE([  - nconf: yes])],
294       [AC_MSG_NOTICE([  - nconf: no])])
295 AS_IF([test "$enable_qconf" = "yes"],
296       [AC_MSG_NOTICE([  - qconf: yes])],
297       [AC_MSG_NOTICE([  - qconf: no])])