Mercurial > pidgin.yaz
comparison console/libgnt/configure.ac @ 13891:da1046158b3b
[gaim-migrate @ 16374]
Add some autotool thingies. These work for me, I can almost swear.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 29 Jun 2006 18:16:07 +0000 |
parents | |
children | 863feae7fefa |
comparison
equal
deleted
inserted
replaced
13890:2bac009eaa0c | 13891:da1046158b3b |
---|---|
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 Check for inet_aton | |
41 AC_CHECK_FUNC(inet_aton, , [AC_CHECK_LIB(resolv, inet_aton, , | |
42 [AC_ERROR(inet_aton not found)])]) | |
43 AC_CHECK_LIB(resolv, __res_query) | |
44 AC_CHECK_LIB(nsl, gethostent) | |
45 AC_CHECK_FUNC(socket, , | |
46 [AC_CHECK_LIB(socket, socket, , [AC_ERROR([socket not found])])]) | |
47 dnl If all goes well, by this point the previous two checks will have | |
48 dnl pulled in -lsocket and -lnsl if we need them. | |
49 AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE([HAVE_GETADDRINFO], [1], | |
50 [Define to 1 if you have the getaddrinfo function.])], | |
51 [AC_CHECK_LIB(socket, getaddrinfo, | |
52 [AC_DEFINE([HAVE_GETADDRINFO]) LIBS="-lsocket -lsnl $LIBS"], , , -lnsl)]) | |
53 | |
54 dnl Check for socklen_t (in Unix98) | |
55 AC_MSG_CHECKING(for socklen_t) | |
56 AC_TRY_COMPILE([ | |
57 #include <sys/types.h> | |
58 #include <sys/socket.h> | |
59 socklen_t x; | |
60 ], [], | |
61 [ | |
62 AC_MSG_RESULT(yes) | |
63 ], [ | |
64 AC_TRY_COMPILE([ | |
65 #include <sys/types.h> | |
66 #include <sys/socket.h> | |
67 int accept(int, struct sockaddr *, size_t *); | |
68 ], [], [ | |
69 AC_MSG_RESULT(size_t) | |
70 AC_DEFINE(socklen_t, size_t, [socklen_t size]) | |
71 ], [ | |
72 AC_MSG_RESULT(int) | |
73 AC_DEFINE(socklen_t, int, [socklen_t size]) | |
74 ]) | |
75 ]) | |
76 | |
77 dnl to prevent the g_stat()/g_unlink() crash, | |
78 dnl (09:50:07) Robot101: LSchiere2: it's easy. +LC_SYS_LARGEFILE somewhere in configure.ac | |
79 AC_SYS_LARGEFILE | |
80 | |
81 dnl FreeBSD doesn't have libdl, dlopen is provided by libc | |
82 AC_CHECK_FUNC(dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")]) | |
83 | |
84 AC_MSG_CHECKING(for the %z format string in strftime()) | |
85 AC_TRY_RUN([ | |
86 #ifdef HAVE_SYS_TIME_H | |
87 #include <sys/time.h> | |
88 #endif | |
89 #include <time.h> | |
90 #include <stdio.h> | |
91 | |
92 int main() | |
93 { | |
94 char buf[6]; | |
95 time_t t = time(NULL); | |
96 | |
97 if (strftime(buf, sizeof(buf), "%z", localtime(&t)) != 5) | |
98 return 1; | |
99 | |
100 fprintf(stderr, "strftime(\"%%z\") yields: \"%s\"\n", buf); | |
101 | |
102 return !((buf[0] == '-' || buf[0] == '+') && | |
103 (buf[1] >= '0' && buf[1] <= '9') && | |
104 (buf[2] >= '0' && buf[2] <= '9') && | |
105 (buf[3] >= '0' && buf[3] <= '9') && | |
106 (buf[4] >= '0' && buf[4] <= '9') | |
107 ); | |
108 } | |
109 ], | |
110 [ | |
111 AC_MSG_RESULT(yes) | |
112 AC_DEFINE([HAVE_STRFTIME_Z_FORMAT], [1], | |
113 [Define to 1 if you have a strftime() that supports the %z format string.]) | |
114 ], | |
115 [ | |
116 AC_MSG_RESULT(no) | |
117 ], | |
118 [ | |
119 # Fallback for Cross Compiling... | |
120 # This will enable the compatibility code. | |
121 AC_MSG_RESULT(no) | |
122 ] | |
123 ) | |
124 | |
125 | |
126 AC_CHECK_HEADER(sys/utsname.h) | |
127 AC_CHECK_FUNC(uname) | |
128 | |
129 if test "x$enable_debug" = "xyes" ; then | |
130 AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.]) | |
131 enable_fatal_asserts="yes" | |
132 fi | |
133 | |
134 if test "x$enable_fatal_asserts" = "xyes" ; then | |
135 AC_DEFINE(GAIM_FATAL_ASSERTS, 1, [Define to make assertions fatal (useful for debugging).]) | |
136 fi | |
137 | |
138 if test "x$enable_deprecated" = "xno"; then | |
139 DEBUG_CFLAGS="$DEBUG_CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" | |
140 fi | |
141 | |
142 if test "x$GCC" = "xyes"; then | |
143 dnl We enable -Wall later. | |
144 dnl If it's set after the warning CFLAGS in the compiler invocation, it counteracts the -Wno... flags. | |
145 dnl This leads to warnings we don't want. | |
146 CFLAGS=`echo $CFLAGS |$sedpath 's/-Wall//'` | |
147 | |
148 dnl ENABLE WARNINGS SUPPORTED BY THE VERSION OF GCC IN USE | |
149 dnl | |
150 dnl Future Possibilities | |
151 dnl | |
152 dnl Consider adding -Wbad-function-cast. | |
153 dnl This leads to spurious warnings using GPOINTER_TO_INT(), et al. directly on a function call. | |
154 dnl We'd need an intermediate variable. | |
155 dnl | |
156 dnl Consider adding -Wfloat-equal. | |
157 dnl This leads to warnings with Perl. | |
158 dnl Perhaps we could write ugly configure magic and pass -Wno-float-equal down to that subdirectory. | |
159 dnl On the other hand, it's probably actually broken, so maybe the Perl folks should fix that? | |
160 dnl | |
161 dnl Consider removing -Wno-sign-compare (from the -Wextra set) and fixing all those cases. | |
162 dnl This is likely non-trivial. | |
163 dnl | |
164 for newflag in \ | |
165 "-Waggregate-return" \ | |
166 "-Wcast-align" \ | |
167 "-Wdeclaration-after-statement" \ | |
168 "-Werror-implicit-function-declaration" \ | |
169 "-Wextra -Wno-sign-compare -Wno-unused-parameter" \ | |
170 "-Winit-self" \ | |
171 "-Wmissing-declarations" \ | |
172 "-Wmissing-prototypes" \ | |
173 "-Wnested-externs" \ | |
174 "-Wpointer-arith" \ | |
175 "-Wundef" \ | |
176 ; do | |
177 orig_CFLAGS="$CFLAGS" | |
178 CFLAGS="$CFLAGS $newflag" | |
179 AC_MSG_CHECKING(for $newflag option to gcc) | |
180 AC_TRY_COMPILE([], [ | |
181 int main() {return 0;} | |
182 ], [ | |
183 AC_MSG_RESULT(yes) | |
184 CFLAGS="$orig_CFLAGS" | |
185 DEBUG_CFLAGS="$DEBUG_CFLAGS $newflag" | |
186 ], [ | |
187 AC_MSG_RESULT(no) | |
188 CFLAGS="$orig_CFLAGS" | |
189 ]) | |
190 done | |
191 | |
192 if test "x$enable_fortify" = "xyes"; then | |
193 AC_MSG_CHECKING(for FORTIFY_SOURCE support) | |
194 AC_TRY_COMPILE([#include <features.h>], [ | |
195 int main() { | |
196 #if !(__GNUC_PREREQ (4, 1) \ | |
197 || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (4, 0)) \ | |
198 || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (3, 4) \ | |
199 && __GNUC_MINOR__ == 4 \ | |
200 && (__GNUC_PATCHLEVEL__ > 2 \ | |
201 || (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ >= 8)))) | |
202 #error No FORTIFY_SOURCE support | |
203 #endif | |
204 return 0; | |
205 } | |
206 ], [ | |
207 AC_MSG_RESULT(yes) | |
208 DEBUG_CFLAGS="$DEBUG_CFLAGS -D_FORTIFY_SOURCE=2" | |
209 ], [ | |
210 AC_MSG_RESULT(no) | |
211 ]) | |
212 fi | |
213 | |
214 DEBUG_CFLAGS="-Wall $DEBUG_CFLAGS" | |
215 CFLAGS="-g $CFLAGS" | |
216 fi | |
217 AC_SUBST(CFLAGS) | |
218 | |
219 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.0 gobject-2.0 gmodule-2.0], | |
220 [ | |
221 AC_SUBST(GLIB_CFLAGS) | |
222 AC_SUBST(GLIB_LIBS) | |
223 ], | |
224 [ | |
225 AC_MSG_ERROR([ | |
226 *** GLib 2.0 is required to build Gaim; please make sure you have the GLib | |
227 *** development headers installed. The latest version of GLib is | |
228 *** always available at http://www.gtk.org/.]) | |
229 ]) | |
230 | |
231 | |
232 PKG_CHECK_MODULES(GAIM, [gaim], | |
233 [ | |
234 AC_SUBST(GAIM_CFLAGS) | |
235 AC_SUBST(GAIM_LIBS) | |
236 ], | |
237 [ | |
238 AC_MSG_ERROR([ | |
239 *** Need to have libgaim dude.]) | |
240 ]) | |
241 | |
242 | |
243 AC_MSG_CHECKING(for me pot o' gold) | |
244 AC_MSG_RESULT(no) | |
245 AC_CHECK_FUNCS(gethostid lrand48) | |
246 AC_CHECK_FUNCS(memcpy memmove random strchr strerror vprintf) | |
247 AC_CHECK_HEADERS(malloc.h paths.h sgtty.h stdarg.h sys/cdefs.h) | |
248 AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h) | |
249 AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h) | |
250 AC_CHECK_HEADERS(termios.h) | |
251 #AC_VAR_TIMEZONE_EXTERNALS | |
252 | |
253 | |
254 AC_OUTPUT([Makefile | |
255 gnt.pc | |
256 ]) | |
257 |