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