]> git.sur5r.net Git - kconfig-frontends/blob - configure.ac
1c965f44c10cbe95ead86aef4f6b547665ffa1b2
[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=yes)])])
53 AC_SUBST([enable_conf], [${enable_conf:-yes}])
54 AC_ARG_ENABLE(
55     [mconf],
56     [AS_HELP_STRING(
57         [--disable-mconf],
58         [mconf, the traditional ncurses-based frontend (default=yes)])])
59 AC_SUBST([enable_mconf], [${enable_mconf:-yes}])
60 AC_ARG_ENABLE(
61     [nconf],
62     [AS_HELP_STRING(
63         [--disable-nconf],
64         [nconf, the modern ncurses-based frontend (default=yes)])])
65 AC_SUBST([enable_nconf], [${enable_nconf:-yes}])
66 AC_ARG_ENABLE(
67     [gconf],
68     [AS_HELP_STRING(
69         [--disable-gconf],
70         [gconf, the GTK-based frontend (default=yes)])])
71 AC_SUBST([enable_gconf], [${enable_gconf:-yes}])
72 AC_ARG_ENABLE(
73     [qconf],
74     [AS_HELP_STRING(
75         [--disable-qconf],
76         [qconf, the QT-based frontend (default=yes)])])
77 AC_SUBST([enable_qconf], [${enable_qconf:-yes}])
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 kconfig frontends
110 AS_IF(
111     [test "$enable_mconf" = "yes" -o "$enable_nconf" = "yes"],
112     [AC_SUBST([CURSES_LOC])
113      AC_CHECK_HEADERS(
114         [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
115         [CURSES_LOC=$ac_header; break])
116      AS_IF(
117         [test -z "$CURSES_LOC"],
118         [AC_MSG_ERROR([could not find curses headers])])
119      AC_SEARCH_LIBS(
120         [initscr],
121         [ncursesw ncurses curses],
122         [ac_ct_curses_lib_found=yes; break])
123      AS_IF(
124         [test -z "$ac_ct_curses_lib_found"],
125         [AC_MSG_ERROR([could not find curses library])])])
126
127 AS_IF(
128     [test "$enable_nconf" = "yes"],
129     [AC_SEARCH_LIBS(
130         [new_panel],
131         [panel],
132         [ac_ct_panel_lib_found=yes; break])
133      AS_IF(
134         [test -z "$ac_ct_panel_lib_found"],
135         [AC_MSG_ERROR([could not find libpanel library])])
136      AC_SEARCH_LIBS(
137         [menu_init],
138         [menu],
139         [ac_ct_menu_lib_found=yes; break])
140      AS_IF(
141         [test -z "$ac_ct_panel_lib_found"],
142         [AC_MSG_ERROR([could not find libmenu library])])])
143
144 #----------------------------------------
145 # Check if the lxdialog library should be built
146 AS_IF(
147     [test "$enable_mconf" = "yes"],
148     [need_lxdialog=yes],
149     [need_lxdialog=no])
150
151 #----------------------------------------
152 # Check pkg-config if needed
153 AS_IF(
154     [test    "$enable_gconf" = "yes"    \
155           -o "$enable_qconf" = "yes"],
156     [PKG_PROG_PKG_CONFIG()])
157
158 #----------------------------------------
159 # Check headers and libs for gconf
160 AS_IF(
161     [test "$enable_gconf" = yes ],
162     [PKG_CHECK_MODULES(
163         [gtk],
164         [gtk+-2.0 gmodule-2.0 libglade-2.0])])
165
166 #----------------------------------------
167 # Check headers and libs for gconf
168 AS_IF(
169     [test "$enable_qconf" = "yes"],
170     [PKG_CHECK_MODULES(
171         [qt4],
172         [QtCore QtGui Qt3Support])])
173
174 #---------------------------------------------------------------------------
175 # Prepare automake
176 AM_INIT_AUTOMAKE
177 AM_PROG_CC_C_O
178 AM_CONDITIONAL(
179     [COND_conf],
180     [test "$enable_conf" = "yes"])
181 AM_CONDITIONAL(
182     [COND_mconf],
183     [test "$enable_mconf" = "yes"])
184 AM_CONDITIONAL(
185     [COND_nconf],
186     [test "$enable_nconf" = "yes"])
187 AM_CONDITIONAL(
188     [COND_gconf],
189     [test "$enable_gconf" = "yes"])
190 AM_CONDITIONAL(
191     [COND_qconf],
192     [test "$enable_qconf" = "yes"])
193 AM_CONDITIONAL(
194     [COND_lxdialog],
195     [test "$need_lxdialog" = "yes"])
196
197 #----------------------------------------
198 # Finalise
199 AC_CONFIG_FILES([
200     Makefile
201     libs/Makefile
202     libs/lxdialog/Makefile
203     libs/parser/Makefile
204     frontends/Makefile
205     frontends/conf/Makefile
206     frontends/mconf/Makefile
207     frontends/nconf/Makefile
208     frontends/gconf/Makefile
209     frontends/qconf/Makefile
210 ])
211 AC_OUTPUT
212
213 AC_MSG_NOTICE([Configured with:])
214 AS_IF([test "$enable_conf" = "yes"],
215       [AC_MSG_NOTICE([  - conf:  yes])],
216       [AC_MSG_NOTICE([  - conf:  no])])
217 AS_IF([test "$enable_gconf" = "yes"],
218       [AC_MSG_NOTICE([  - gconf: yes])],
219       [AC_MSG_NOTICE([  - gconf: no])])
220 AS_IF([test "$enable_mconf" = "yes"],
221       [AC_MSG_NOTICE([  - mconf: yes])],
222       [AC_MSG_NOTICE([  - mconf: no])])
223 AS_IF([test "$enable_nconf" = "yes"],
224       [AC_MSG_NOTICE([  - nconf: yes])],
225       [AC_MSG_NOTICE([  - nconf: no])])
226 AS_IF([test "$enable_qconf" = "yes"],
227       [AC_MSG_NOTICE([  - qconf: yes])],
228       [AC_MSG_NOTICE([  - qconf: no])])