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