-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
442 lines (373 loc) · 13.5 KB
/
configure.ac
File metadata and controls
442 lines (373 loc) · 13.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
dnl Copyright (C) 2002-2006 Ryan McCabe <ryan@numb.org> (GPL v2)
AC_INIT(pork, 0.99.9, ryan@numb.org)
AM_INIT_AUTOMAKE(pork, 0.99.9)
AC_DEFINE(PACKAGE_EXTRAVERSION, "CVS", [extraversion])
AC_DEFINE(PACKAGE_WEBSITE, ["http://dev.ojnk.net"], [website])
AC_DEFINE(PACKAGE_AUTHOR, ["Ryan McCabe"], [author])
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PATH_PROG(sedpath, sed)
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_CANONICAL_HOST
WARN_CFLAGS=""
DEBUG_CFLAGS=""
DEBUG_LIBS=""
enableval=""
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debugging])
if test "$enableval" = "yes"; then
AC_DEFINE(ENABLE_DEBUGGING, 1, [Define to enable debugging])
DEBUG_CFLAGS="-O0 -fvar-tracking -g3 -ggdb"
fi
enableval=""
AC_ARG_ENABLE(profile,
[ --enable-profile Enable profiling])
if test "$enableval" = "yes"; then
DEBUG_CFLAGS="-pg --coverage -ftest-coverage -fprofile-generate"
DEBUG_LIBS="-pg"
fi
enableval=""
AC_ARG_ENABLE(warn,
[ --enable-warn Enable a bunch of compiler warnings])
if test "$enableval" = "yes"; then
WARN_CFLAGS="-O3 -ggdb -fstack-protector -fstrict-aliasing -W -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -Wredundant-decls -Wmissing-format-attribute -Wmissing-noreturn -Waggregate-return -Wstrict-aliasing=2 -Wlong-long -Wcomment -Wunreachable-code -Wswitch-enum -Wswitch-default -Wvolatile-register-var -Wformat=2 -Winit-self -Winvalid-pch -Winline -Wpointer-arith -Wbad-function-cast -Wcast-align -Wchar-subscripts -Wunsafe-loop-optimizations -Wdisabled-optimization -Wwrite-strings -Wsign-compare -Wconversion -Wmissing-field-initializers -Wnested-externs -Wstack-protector -Wunused-macros -Wendif-labels -Wno-cast-qual"
fi
withval=""
irc="yes"
AC_ARG_WITH(irc,
[ --with-irc Include IRC support])
if test "$withval" = "no"; then
irc="no"
else
AC_DEFINE(IRC_SUPPORT, 1, [Define to enable IRC support])
fi
withval=""
aim="yes"
AC_ARG_WITH(aim,
[ --with-aim Include Oscar AIM support])
if test "$withval" = "no"; then
aim="no"
else
AC_DEFINE(AIM_SUPPORT, 1, [Define to enable AIM support])
fi
withval=""
ssl="yes"
AC_ARG_WITH(ssl,
[ --with-ssl Include SSL support for IRC])
if test "$withval" = "no"; then
ssl="no"
else
LDFLAGS="$LDFLAGS -lcrypto"
fi
withval=""
AC_ARG_WITH(efence,
[ --with-efence=PREFIX Use electric fence])
if test "$withval" = "yes"; then
have_efence=""
AC_CHECK_LIB(efence, malloc, have_efence="yes")
if test "$have_efence" = "yes"; then
DEBUG_LIBS="-lefence"
fi
fi
AC_ARG_WITH(ncurses-libs,
[ --with-ncurses-libs=DIR Specify location of the ncurses libraries],[
LDFLAGS="$LDFLAGS -L$withval"
])
AC_ARG_WITH(ncurses-includes,
[ --with-ncurses-includes=DIR Specify location of the ncurses header files],[
CPPFLAGS="$CPPFLAGS -I$withval"
])
withval=""
AC_ARG_WITH(dmalloc,
[ --with-dmalloc=PREFIX Use the dmalloc library])
if test "$withval" = "yes"; then
have_dmalloc=""
AC_CHECK_LIB(dmalloc, malloc, have_dmalloc="yes")
if test "$have_dmalloc" = "yes"; then
DEBUG_CFLAGS="$DEBUG_CFLAGS -DDEBUG_DMALLOC -DDMALLOC_FUNC_CHECK"
DEBUG_LIBS="-ldmalloc"
fi
fi
if test "$have_efence" = "yes" -a "$have_dmalloc" = "yes"; then
AC_MSG_ERROR([
*** You've requested support for both dmalloc and electric fence, however
*** only one may be linked in at one time.
])
exit -1
fi
AC_ARG_ENABLE(perl,
[ --disable-perl Disable use of perl scripting],
perl=$enableval, perl=yes)
AC_SUBST(WARN_CFLAGS)
AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(DEBUG_LIBS)
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h ncurses.h termios.h sys/termios.h)
have_ncurses="no"
AC_CHECK_LIB(ncurses, initscr, have_ncurses="yes")
if test "$have_ncurses" = "no"; then
echo "ncurses is required to build this program."
echo "install it and try again."
echo "try passing configure --with-ncurses-libs=<path to ncurses libraries> --with-ncurses-includes=<path to ncurses includes> if you believe ncurses is installed."
exit -1
fi
AC_CHECK_LIB(ncurses, resizeterm, AC_DEFINE(HAVE_RESIZETERM, 1, [Define to 1 if you have the 'resizeterm' function in -lncurses.]))
AC_CHECK_TYPE(u_int32_t, uint32_t)
if test "$ac_cv_type_u_int32_t" = "no"; then
AC_CHECK_TYPE(uint32_t, unsigned int)
fi
AC_CHECK_TYPE(u_int16_t, uint16_t)
if test "$ac_cv_type_u_int16_t" = "no"; then
AC_CHECK_TYPE(uint16_t, unsigned short)
fi
AC_CHECK_TYPE(u_int8_t, uint8_t)
if test "$ac_cv_type_u_int8_t" = "no"; then
AC_CHECK_TYPE(uint8_t, unsigned char)
fi
AC_MSG_CHECKING(for AF_INET6)
AC_TRY_COMPILE([#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>],
[AF_INET6+1;],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(AF_INET6, 10, [Define if AF_INET6 is missing])
AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>],
[sizeof(socklen_t);],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(socklen_t, int, [Define to int if socklen_t is missing])
AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for in_addr_t)
AC_TRY_COMPILE([#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>],
[sizeof(in_addr_t);],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(in_addr_t, unsigned int, [Define to unsigned int if in_addr_t is missing])
AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for in_port_t)
AC_TRY_COMPILE([#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>],
[sizeof(in_port_t);],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(in_port_t, unsigned short, [Define to unsigned short if in_port_t is missing])
AC_MSG_RESULT(no)])
AC_CHECK_SIZEOF(void *)
AC_DEFINE_UNQUOTED(SIZEOF_VOID_P, $ac_cv_sizeof_void_p, [Size of the 'void *' type])
AC_MSG_CHECKING(for __attribute__ unused)
AC_TRY_COMPILE([#include <stdlib.h>],
[int x __attribute__((unused));],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE___ATTRIBUTE__UNUSED, 1, [Define if your compiler has __attribute__ unused])],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for __attribute__ used)
AC_TRY_COMPILE([#include <stdlib.h>],
[int x __attribute__((used));],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE___ATTRIBUTE__USED, 1, [Define if your compiler has __attribute__ used])],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for __attribute__ noreturn)
AC_TRY_COMPILE([#include <stdlib.h>],
[ exit(0); } static void foo(void) __attribute__((noreturn));
static void foo(void) {exit(0); ],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE___ATTRIBUTE__NORETURN, 1, [Define if your compiler has __attribute__ noreturn])],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for __attribute__ format)
AC_TRY_COMPILE([#include <stdlib.h>
#include <stdarg.h>],
[ exit(0); } static int foo(char *fmt, ...) __attribute__((format (printf, 1, 2)));
static int foo(char *fmt, ...) { ],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE___ATTRIBUTE__FORMAT, 1, [Define if your compiler has __attribute__ format])],
[AC_MSG_RESULT(no)])
AC_TYPE_SIGNAL
PERL_CFLAGS=""
PERL_LDFLAGS=""
dnl
dnl This (Perl test) was taken from gaim.
dnl
if test "$perl" = "yes"; then
AC_PATH_PROG(perlpath, perl)
AC_MSG_CHECKING(for Perl compile flags)
PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
if test "_$PERL_CFLAGS" = _ ; then
AC_MSG_RESULT([not found, building without Perl.])
perl=no
else
PERL_LIBS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null |$sedpath 's/-lgdbm //'`
PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-ldb //'`
PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lndbm //'`
if test "$system" = "Linux"; then
PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lnsl //'`
PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lposix //'`
fi
PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lc //'`
AC_MSG_RESULT(ok)
TEMPCPP="$CPPFLAGS"
TEMPLDF="$LDFLAGS"
CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
LDFLAGS="$LDFLAGS $PERL_LIBS"
AC_CHECK_FUNCS(Perl_eval_pv)
CPPFLAGS="$TEMPCPP"
LDFLAGS="$TEMPLDF"
AC_MSG_CHECKING(for old perl)
PERL_OLD=`$perlpath -e 'if($]<5.006){printf"yes\n";}else{printf"no\n";}'`
if test "$PERL_OLD" = "yes"; then
AC_DEFINE(OLD_PERL, 1, [Define if Perl's version is < 5.006])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
fi
AC_CHECK_FUNCS(snprintf vsnprintf getopt_long strsep vasprintf)
AC_CHECK_FUNCS(gettimeofday select strdup strstr strtol uname)
AC_CHECK_FUNCS(memcmp strftime vprintf gethostbyname)
AC_SEARCH_LIBS(socket, socket, , [AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket -lnsl", , -lsocket)])
AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if you have the 'getaddrinfo' function.]),
AC_CHECK_LIB(socket, getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if you have the 'getaddrinfo' function.])))
AC_CHECK_FUNC(freeaddrinfo, AC_DEFINE(HAVE_FREEADDRINFO, 1, [Define to 1 if you have the 'freeaddrinfo' function.]),
AC_CHECK_LIB(socket, freeaddrinfo), AC_DEFINE(HAVE_FREEADDRINFO, 1, [Define to 1 if you have the 'freeaddrinfo' function.]))
AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAI_STRERROR, 1, [Define to 1 if you have the 'gai_strerror' function.]),
AC_CHECK_LIB(socket, gai_strerror, AC_DEFINE(HAVE_GAI_STRERROR, 1, [Define to 1 if you have the 'gai_strerror' function.])))
AC_CHECK_FUNC(getnameinfo, AC_DEFINE(HAVE_GETNAMEINFO, 1, [Define to 1 if you have the 'getnameinfo' function.]),
AC_CHECK_LIB(socket, gai_strerror, AC_DEFINE(HAVE_GETNAMEINFO, 1, [Define to 1 if you have the 'getnameinfo' function.])))
AC_CHECK_FUNC(inet_ntop, AC_DEFINE(HAVE_INET_NTOP, 1, [Define to 1 if you have the 'inet_ntop' function.]),
AC_CHECK_LIB(nsl, inet_ntop, AC_DEFINE(HAVE_INET_NTOP, 1, [Define to 1 if you have the 'inet_ntop' function.])))
AC_MSG_CHECKING(for struct sockaddr_storage)
AC_TRY_COMPILE( [ #include <sys/types.h>
#include <sys/socket.h>],
[ struct sockaddr_storage ss; ],
[ have_sockaddr_storage=yes ],
[ have_sockaddr_storage=no ])
AC_MSG_RESULT($have_sockaddr_storage)
if test "$have_sockaddr_storage" = "yes"; then
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Define to 1 if you have struct sockaddr_storage])
AC_MSG_CHECKING(for ss_family member in struct sockaddr_storage)
AC_TRY_COMPILE( [ #include <sys/types.h>
#include <sys/socket.h>],
[ size_t test =
sizeof(((struct sockaddr_storage *)0)->ss_family);],
[ have_ss_family=yes ],
[ have_ss_family=no ])
AC_MSG_RESULT($have_ss_family)
if test "$have_ss_family" = "no"; then
AC_MSG_CHECKING(for __ss_family member in struct sockaddr_storage)
AC_TRY_COMPILE( [ #include <sys/types.h>
#include <sys/socket.h>],
[ size_t test =
sizeof(((struct sockaddr_storage *)0)->__ss_family);],
[ have_ss_family=yes ],
[ have_ss_family=no ])
AC_MSG_RESULT($have_ss_family)
if test "$have_ss_family" = "yes"; then
AC_DEFINE(HAVE___SS_FAMILY, 1, [Define if the sockaddr storage struct has the ss_family member])
fi
fi
fi
AC_MSG_CHECKING(for struct sockaddr_in6)
AC_TRY_COMPILE( [ #include <sys/types.h>
#include <netinet/in.h>],
[ struct sockaddr_in6 s; ],
[ have_sockaddr_in6=yes ],
[ have_sockaddr_in6=no ])
AC_MSG_RESULT($have_sockaddr_in6)
if test "$have_sockaddr_in6" = "yes"; then
AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [Define to 1 if you have struct sockaddr_in6])
fi
AC_MSG_CHECKING(for struct in6_addr)
AC_TRY_COMPILE( [ #include <sys/types.h>
#include <netinet/in.h>],
[ struct in6_addr s; ],
[ have_in6_addr=yes ],
[ have_in6_addr=no ])
AC_MSG_RESULT($have_in6_addr)
if test "$have_in6_addr" = "yes"; then
AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [Define to 1 if you have struct in6_addr])
fi
AC_MSG_CHECKING(for struct addrinfo)
AC_TRY_COMPILE( [ #include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>],
[ size_t test =
sizeof(((struct addrinfo *)0)->ai_flags);],
[ have_struct_addrinfo=yes ],
[ have_struct_addrinfo=no ])
AC_MSG_RESULT($have_struct_addrinfo)
if test "$have_struct_addrinfo" = "yes"; then
AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Define to 1 if you have struct addrinfo])
fi
if test "$ssl" = "yes"; then
AC_CHECK_HEADER(openssl/ssl.h,, [ssl=no])
if test "$ssl" = "yes"; then
AC_CHECK_LIB(ssl, SSL_new,, [ssl=no])
fi
fi
if test "$ssl" = "yes"; then
AC_DEFINE(SSL_SUPPORT, 1, [Define to enable SSL support for IRC])
fi
CFLAGS="-Wextra -Wall -Wformat-security -Wno-unused -Wno-unused-parameter -D_GNU_SOURCE $CFLAGS"
if test -n "$DEBUG_CFLAGS$DEBUG_LIBS"; then
CFLAGS="$(echo $CFLAGS | sed 's/-O[[1-9]]*/-O0/g' | sed 's/-g[[0-9]]*/-g3 -ggdb/g')"
fi
AC_SUBST(LIBS)
AC_SUBST(PERL_CFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(PERL_LIBS)
AM_CONDITIONAL(COMPILE_PERL, test "$perl" = "yes")
AM_CONDITIONAL(IRC_SUPPORT, test "$irc" = "yes")
AM_CONDITIONAL(AIM_SUPPORT, test "$aim" = "yes")
AC_OUTPUT([
Makefile
src/Makefile
src/missing/Makefile
src/xml/Makefile
src/commands/Makefile
src/perl/Makefile
src/prefs/Makefile
src/protocols/Makefile
src/protocols/aim/Makefile
src/protocols/aim/libfaim/Makefile
src/protocols/irc/Makefile
doc/Makefile
doc/help/Makefile
doc/help/blist/Makefile
doc/help/buddy/Makefile
doc/help/chat/Makefile
doc/help/event/Makefile
doc/help/file/Makefile
doc/help/history/Makefile
doc/help/input/Makefile
doc/help/main/Makefile
doc/help/perl/Makefile
doc/help/scroll/Makefile
doc/help/timer/Makefile
doc/help/win/Makefile
examples/Makefile
examples/perl/Makefile])