Mercurial > pidgin
annotate finch/libgnt/configure.ac @ 16125:5f204f55af09
Add a utility function to create widgets from an XML description.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 15 Apr 2007 05:49:27 +0000 |
parents | 0e3a8505ebbe |
children | 36d9409dab58 |
rev | line source |
---|---|
15817 | 1 dnl Process this file with autoconf to produce a configure script. |
2 AC_INIT([libgnt], [0.0.0dev], [gaim-devel@lists.sourceforge.net]) | |
3 AC_CANONICAL_SYSTEM | |
4 AM_CONFIG_HEADER(config.h) | |
5 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) | |
6 | |
7 AC_PREREQ([2.50]) | |
8 | |
9 AC_PATH_PROG(sedpath, sed) | |
10 | |
11 dnl Storing configure arguments | |
12 AC_DEFINE_UNQUOTED(CONFIG_ARGS, "$ac_configure_args", [configure arguments]) | |
13 | |
14 dnl Checks for programs. | |
15 AC_PROG_CC | |
16 AC_DISABLE_STATIC | |
17 AM_PROG_LIBTOOL | |
18 LIBTOOL="$LIBTOOL --silent" | |
19 AC_PROG_INSTALL | |
20 | |
21 dnl we don't use autobreak on cygwin!! | |
22 dnl AC_CYGWIN | |
23 | |
24 dnl Checks for header files. | |
25 AC_HEADER_STDC | |
26 AC_HEADER_SYS_WAIT | |
27 AC_CHECK_HEADERS(arpa/nameser_compat.h fcntl.h sys/time.h unistd.h locale.h signal.h stdint.h regex.h) | |
28 | |
29 dnl Checks for typedefs, structures, and compiler characteristics. | |
30 AC_C_CONST | |
31 AC_STRUCT_TM | |
32 | |
33 AC_C_BIGENDIAN | |
34 | |
35 dnl Checks for library functions. | |
36 AC_TYPE_SIGNAL | |
37 AC_FUNC_STRFTIME | |
38 AC_CHECK_FUNCS(strdup strstr atexit setlocale) | |
39 | |
40 dnl to prevent the g_stat()/g_unlink() crash, | |
41 dnl (09:50:07) Robot101: LSchiere2: it's easy. +LC_SYS_LARGEFILE somewhere in configure.ac | |
42 AC_SYS_LARGEFILE | |
43 | |
44 dnl FreeBSD doesn't have libdl, dlopen is provided by libc | |
45 AC_CHECK_FUNC(dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")]) | |
46 | |
47 AC_MSG_CHECKING(for the %z format string in strftime()) | |
48 AC_TRY_RUN([ | |
49 #ifdef HAVE_SYS_TIME_H | |
50 #include <sys/time.h> | |
51 #endif | |
52 #include <time.h> | |
53 #include <stdio.h> | |
54 | |
55 int main() | |
56 { | |
57 char buf[6]; | |
58 time_t t = time(NULL); | |
59 | |
60 if (strftime(buf, sizeof(buf), "%z", localtime(&t)) != 5) | |
61 return 1; | |
62 | |
63 fprintf(stderr, "strftime(\"%%z\") yields: \"%s\"\n", buf); | |
64 | |
65 return !((buf[0] == '-' || buf[0] == '+') && | |
66 (buf[1] >= '0' && buf[1] <= '9') && | |
67 (buf[2] >= '0' && buf[2] <= '9') && | |
68 (buf[3] >= '0' && buf[3] <= '9') && | |
69 (buf[4] >= '0' && buf[4] <= '9') | |
70 ); | |
71 } | |
72 ], | |
73 [ | |
74 AC_MSG_RESULT(yes) | |
75 AC_DEFINE([HAVE_STRFTIME_Z_FORMAT], [1], | |
76 [Define to 1 if you have a strftime() that supports the %z format string.]) | |
77 ], | |
78 [ | |
79 AC_MSG_RESULT(no) | |
80 ], | |
81 [ | |
82 # Fallback for Cross Compiling... | |
83 # This will enable the compatibility code. | |
84 AC_MSG_RESULT(no) | |
85 ] | |
86 ) | |
87 | |
88 | |
89 AC_CHECK_HEADER(sys/utsname.h) | |
90 AC_CHECK_FUNC(uname) | |
91 | |
92 if test "x$enable_debug" = "xyes" ; then | |
93 AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.]) | |
94 enable_fatal_asserts="yes" | |
95 fi | |
96 | |
97 if test "x$enable_fatal_asserts" = "xyes" ; then | |
98 AC_DEFINE(GAIM_FATAL_ASSERTS, 1, [Define to make assertions fatal (useful for debugging).]) | |
99 fi | |
100 | |
101 if test "x$enable_deprecated" = "xno"; then | |
102 DEBUG_CFLAGS="$DEBUG_CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" | |
103 fi | |
104 | |
105 if test "x$GCC" = "xyes"; then | |
106 dnl We enable -Wall later. | |
107 dnl If it's set after the warning CFLAGS in the compiler invocation, it counteracts the -Wno... flags. | |
108 dnl This leads to warnings we don't want. | |
109 CFLAGS=`echo $CFLAGS |$sedpath 's/-Wall//'` | |
110 | |
111 dnl ENABLE WARNINGS SUPPORTED BY THE VERSION OF GCC IN USE | |
112 dnl | |
113 dnl Future Possibilities | |
114 dnl | |
115 dnl Consider adding -Wbad-function-cast. | |
116 dnl This leads to spurious warnings using GPOINTER_TO_INT(), et al. directly on a function call. | |
117 dnl We'd need an intermediate variable. | |
118 dnl | |
119 dnl Consider adding -Wfloat-equal. | |
120 dnl This leads to warnings with Perl. | |
121 dnl Perhaps we could write ugly configure magic and pass -Wno-float-equal down to that subdirectory. | |
122 dnl On the other hand, it's probably actually broken, so maybe the Perl folks should fix that? | |
123 dnl | |
124 dnl Consider removing -Wno-sign-compare (from the -Wextra set) and fixing all those cases. | |
125 dnl This is likely non-trivial. | |
126 dnl | |
127 for newflag in \ | |
128 "-Waggregate-return" \ | |
129 "-Wcast-align" \ | |
130 "-Wdeclaration-after-statement" \ | |
131 "-Werror-implicit-function-declaration" \ | |
132 "-Wextra -Wno-sign-compare -Wno-unused-parameter" \ | |
133 "-Winit-self" \ | |
134 "-Wmissing-declarations" \ | |
135 "-Wmissing-prototypes" \ | |
136 "-Wnested-externs" \ | |
137 "-Wpointer-arith" \ | |
138 "-Wundef" \ | |
139 ; do | |
140 orig_CFLAGS="$CFLAGS" | |
141 CFLAGS="$CFLAGS $newflag" | |
142 AC_MSG_CHECKING(for $newflag option to gcc) | |
143 AC_TRY_COMPILE([], [ | |
144 int main() {return 0;} | |
145 ], [ | |
146 AC_MSG_RESULT(yes) | |
147 CFLAGS="$orig_CFLAGS" | |
148 DEBUG_CFLAGS="$DEBUG_CFLAGS $newflag" | |
149 ], [ | |
150 AC_MSG_RESULT(no) | |
151 CFLAGS="$orig_CFLAGS" | |
152 ]) | |
153 done | |
154 | |
155 if test "x$enable_fortify" = "xyes"; then | |
156 AC_MSG_CHECKING(for FORTIFY_SOURCE support) | |
157 AC_TRY_COMPILE([#include <features.h>], [ | |
158 int main() { | |
159 #if !(__GNUC_PREREQ (4, 1) \ | |
160 || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (4, 0)) \ | |
161 || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (3, 4) \ | |
162 && __GNUC_MINOR__ == 4 \ | |
163 && (__GNUC_PATCHLEVEL__ > 2 \ | |
164 || (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ >= 8)))) | |
165 #error No FORTIFY_SOURCE support | |
166 #endif | |
167 return 0; | |
168 } | |
169 ], [ | |
170 AC_MSG_RESULT(yes) | |
171 DEBUG_CFLAGS="$DEBUG_CFLAGS -D_FORTIFY_SOURCE=2" | |
172 ], [ | |
173 AC_MSG_RESULT(no) | |
174 ]) | |
175 fi | |
176 | |
177 DEBUG_CFLAGS="-Wall $DEBUG_CFLAGS" | |
178 CFLAGS="-g $CFLAGS" | |
179 fi | |
180 AC_SUBST(CFLAGS) | |
181 | |
182 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.0 gobject-2.0 gmodule-2.0],, | |
183 [ | |
184 AC_MSG_ERROR([ | |
185 *** GLib 2.0 is required to build LibGNT; please make sure you have the GLib | |
186 *** development headers installed. The latest version of GLib is | |
187 *** always available at http://www.gtk.org/.]) | |
188 ]) | |
189 AC_SUBST(GLIB_CFLAGS) | |
190 AC_SUBST(GLIB_LIBS) | |
191 | |
192 | |
193 AC_MSG_CHECKING(for me pot o' gold) | |
194 AC_MSG_RESULT(no) | |
195 AC_CHECK_FUNCS(gethostid lrand48) | |
196 AC_CHECK_FUNCS(memcpy memmove random strchr strerror vprintf) | |
197 AC_CHECK_HEADERS(malloc.h paths.h sgtty.h stdarg.h sys/cdefs.h) | |
198 AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h) | |
199 AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h) | |
200 AC_CHECK_HEADERS(termios.h) | |
201 #AC_CHECK_FUNC(wcwidth, [AC_DEFINE([HAVE_WCWIDTH], [1], [Define to 1 if you have wcwidth function.])]) | |
202 #AC_VAR_TIMEZONE_EXTERNALS | |
203 | |
204 GNT_CFLAGS= | |
205 GNT_LIBS= | |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
206 AC_ARG_WITH(ncurses-headers, [AC_HELP_STRING([--with-ncurses-headers=DIR], |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
207 [compile finch against the ncurses includes in DIR])], |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
208 [ac_ncurses_includes="$withval"], [ac_ncurses_includes=""]) |
15817 | 209 AC_CHECK_LIB(ncursesw, initscr, [GNT_LIBS="-lncursesw"], [enable_gnt=no]) |
210 AC_CHECK_LIB(panelw, update_panels, [GNT_LIBS="$GNT_LIBS -lpanelw"], [enable_gnt=no]) | |
211 | |
212 # If ncursesw is not found, look for plain old ncurses | |
213 if test "x$enable_gnt" = "xno"; then | |
214 AC_CHECK_LIB(ncurses, initscr, [[GNT_LIBS="-lncurses"] [enable_gnt=yes]], [enable_gnt=no]) | |
215 AC_CHECK_LIB(panel, update_panels, [[GNT_LIBS="$GNT_LIBS -lpanel"] [enable_gnt=yes]], [enable_gnt=no]) | |
216 AC_DEFINE(NO_WIDECHAR, [1], [Define to 1 if you do not have ncursesw.]) | |
217 else | |
218 dnl # Some distros put the headers in ncursesw/, some don't | |
219 found_ncurses_h=no | |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
220 for location in $ac_ncurses_includes /usr/include/ncursesw /usr/include |
15817 | 221 do |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
222 f="$location/ncurses.h" |
15817 | 223 AC_CHECK_HEADER($f,[ |
224 AC_MSG_CHECKING([if $f supports wide characters]) | |
225 AC_TRY_COMPILE([ | |
226 #define _XOPEN_SOURCE_EXTENDED | |
227 #include <$f> | |
228 ], [ | |
229 #ifndef get_wch | |
230 # error get_wch not found! | |
231 #endif | |
232 ], [ | |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
233 dir=$location |
15817 | 234 if test x"$dir" != x"." ; then |
235 GNT_CFLAGS="-I$dir/" | |
236 else | |
237 GNT_CFLAGS="" | |
238 fi | |
239 | |
240 found_ncurses_h=yes | |
241 AC_MSG_RESULT([yes]) | |
242 break | |
243 ], [ | |
244 AC_MSG_RESULT([no]) | |
245 ]) | |
246 ]) | |
247 done | |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
248 if test x"$found_ncurses_h" != "xyes"; then |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
249 enable_gnt="no" |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
250 fi |
15817 | 251 fi |
252 AC_SUBST(GNT_CFLAGS) | |
253 AC_SUBST(GNT_LIBS) | |
254 | |
255 if test "x$enable_gnt" = "xno"; then | |
256 AC_MSG_ERROR([ | |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
257 *** You need ncursesw or ncurses and its header files.]) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
258 fi |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
259 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
260 dnl Check for libxml |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
261 have_libxml=yes |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
262 PKG_CHECK_MODULES(LIBXML, [libxml-2.0], , [ |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
263 AC_MSG_RESULT(no) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
264 have_libxml=no |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
265 ]) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
266 AC_SUBST(LIBXML_CFLAGS) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
267 AC_SUBST(LIBXML_LIBS) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
268 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
269 if test "x$have_libxml" = "xno"; then |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
270 AC_DEFINE(NO_LIBXML, 1, [Do not have libxml2.]) |
15817 | 271 fi |
272 | |
273 AC_OUTPUT([Makefile | |
274 gnt.pc | |
275 wms/Makefile | |
276 ]) | |
277 |