comparison finch/libgnt/configure.ac @ 16177:d88f0f320c9b

merge of '07fc4db9a3c2c12596e0354b8e7959aa847f966b' and '2e6d324c725b3e6a2c803589bca3f0ac9b9790bf'
author Richard Laager <rlaager@wiktel.com>
date Mon, 16 Apr 2007 00:44:33 +0000
parents 0e3a8505ebbe
children 5f204f55af09
comparison
equal deleted inserted replaced
14940:2e3eba412412 16177:d88f0f320c9b
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=
206 AC_CHECK_LIB(ncursesw, initscr, [GNT_LIBS="-lncursesw"], [enable_gnt=no])
207 AC_CHECK_LIB(panelw, update_panels, [GNT_LIBS="$GNT_LIBS -lpanelw"], [enable_gnt=no])
208
209 # If ncursesw is not found, look for plain old ncurses
210 if test "x$enable_gnt" = "xno"; then
211 AC_CHECK_LIB(ncurses, initscr, [[GNT_LIBS="-lncurses"] [enable_gnt=yes]], [enable_gnt=no])
212 AC_CHECK_LIB(panel, update_panels, [[GNT_LIBS="$GNT_LIBS -lpanel"] [enable_gnt=yes]], [enable_gnt=no])
213 AC_DEFINE(NO_WIDECHAR, [1], [Define to 1 if you do not have ncursesw.])
214 else
215 dnl # Some distros put the headers in ncursesw/, some don't
216 found_ncurses_h=no
217 for f in /usr/include/ncursesw/ncurses.h /usr/include/ncurses.h
218 do
219 AC_CHECK_HEADER($f,[
220 AC_MSG_CHECKING([if $f supports wide characters])
221 AC_TRY_COMPILE([
222 #define _XOPEN_SOURCE_EXTENDED
223 #include <$f>
224 ], [
225 #ifndef get_wch
226 # error get_wch not found!
227 #endif
228 ], [
229 dir=`dirname $f`
230 if test x"$dir" != x"." ; then
231 GNT_CFLAGS="-I$dir/"
232 else
233 GNT_CFLAGS=""
234 fi
235
236 found_ncurses_h=yes
237 AC_MSG_RESULT([yes])
238 break
239 ], [
240 AC_MSG_RESULT([no])
241 ])
242 ])
243 done
244 fi
245 AC_SUBST(GNT_CFLAGS)
246 AC_SUBST(GNT_LIBS)
247
248 if test "x$enable_gnt" = "xno"; then
249 AC_MSG_ERROR([
250 *** You need ncursesw or ncurses.])
251 fi
252
253 AC_OUTPUT([Makefile
254 gnt.pc
255 wms/Makefile
256 ])
257