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