1 |
dnl aclocal.m4: macros autoconf uses when building configure from configure.ac |
2 |
dnl |
3 |
dnl Copyright (C) 1999 - 2010 Eggheads Development Team |
4 |
dnl |
5 |
dnl This program is free software; you can redistribute it and/or |
6 |
dnl modify it under the terms of the GNU General Public License |
7 |
dnl as published by the Free Software Foundation; either version 2 |
8 |
dnl of the License, or (at your option) any later version. |
9 |
dnl |
10 |
dnl This program is distributed in the hope that it will be useful, |
11 |
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
dnl GNU General Public License for more details. |
14 |
dnl |
15 |
dnl You should have received a copy of the GNU General Public License |
16 |
dnl along with this program; if not, write to the Free Software |
17 |
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 |
dnl |
19 |
dnl $Id: aclocal.m4,v 1.116 2010/06/29 15:52:23 thommey Exp $ |
20 |
dnl |
21 |
|
22 |
|
23 |
dnl |
24 |
dnl Message macros. |
25 |
dnl |
26 |
|
27 |
|
28 |
dnl EGG_MSG_CONFIGURE_START() |
29 |
dnl |
30 |
AC_DEFUN([EGG_MSG_CONFIGURE_START], |
31 |
[ |
32 |
AC_MSG_RESULT |
33 |
AC_MSG_RESULT([This is Eggdrop's GNU configure script.]) |
34 |
AC_MSG_RESULT([It's going to run a bunch of tests to hopefully make your compile]) |
35 |
AC_MSG_RESULT([work without much twiddling.]) |
36 |
AC_MSG_RESULT |
37 |
]) |
38 |
|
39 |
|
40 |
dnl EGG_MSG_CONFIGURE_END() |
41 |
dnl |
42 |
AC_DEFUN([EGG_MSG_CONFIGURE_END], |
43 |
[ |
44 |
AC_MSG_RESULT([Type 'make config' to configure the modules, or type 'make iconfig']) |
45 |
AC_MSG_RESULT([to interactively choose which modules to compile.]) |
46 |
AC_MSG_RESULT |
47 |
]) |
48 |
|
49 |
|
50 |
dnl EGG_MSG_WEIRDOS() |
51 |
dnl |
52 |
dnl Print some messages at the end of configure to give extra information to |
53 |
dnl users of 'weird' operating systems. |
54 |
dnl |
55 |
AC_DEFUN([EGG_MSG_WEIRDOS], |
56 |
[ |
57 |
AC_MSG_RESULT([Operating System: $egg_cv_var_system_type $egg_cv_var_system_release]) |
58 |
AC_MSG_RESULT |
59 |
if test "$UNKNOWN_OS" = yes; then |
60 |
AC_MSG_RESULT([WARNING:]) |
61 |
AC_MSG_RESULT |
62 |
AC_MSG_RESULT([ Unknown Operating System: $egg_cv_var_system_type $egg_cv_var_system_release]) |
63 |
AC_MSG_RESULT |
64 |
AC_MSG_RESULT([ Module support has been disabled for this build.]) |
65 |
AC_MSG_RESULT |
66 |
AC_MSG_RESULT([ Please let us know what type of system this is by e-mailing]) |
67 |
AC_MSG_RESULT([ bugs@eggheads.org. The output of uname -a, and some other basic]) |
68 |
AC_MSG_RESULT([ information about the OS should be included.]) |
69 |
AC_MSG_RESULT |
70 |
else |
71 |
if test "$WEIRD_OS" = yes; then |
72 |
AC_MSG_RESULT([WARNING:]) |
73 |
AC_MSG_RESULT |
74 |
AC_MSG_RESULT([ The operating system you are using has not yet had a great]) |
75 |
AC_MSG_RESULT([ deal of testing with Eggdrop. For this reason, this compile]) |
76 |
AC_MSG_RESULT([ will default to "make static".]) |
77 |
AC_MSG_RESULT |
78 |
AC_MSG_RESULT([ To enable module support, type "make eggdrop" instead of just]) |
79 |
AC_MSG_RESULT([ "make" after you run "make config" (or "make iconfig").]) |
80 |
AC_MSG_RESULT |
81 |
AC_MSG_RESULT([ As we have not done a sufficient amount of testing on this]) |
82 |
AC_MSG_RESULT([ OS, your feedback is greatly appreciated. Please let us know]) |
83 |
AC_MSG_RESULT([ at bugs@eggheads.org if there are any problems compiling with]) |
84 |
AC_MSG_RESULT([ module support, or if you got it to work :)]) |
85 |
AC_MSG_RESULT |
86 |
fi |
87 |
AC_MSG_RESULT([If you experience any problems compiling Eggdrop, please read the]) |
88 |
AC_MSG_RESULT([compile guide, found in doc/COMPILE-GUIDE.]) |
89 |
AC_MSG_RESULT |
90 |
fi |
91 |
]) |
92 |
|
93 |
|
94 |
dnl EGG_APPEND_VAR() |
95 |
dnl |
96 |
dnl Append a non-empty string to a variable |
97 |
dnl |
98 |
dnl $1 = variable |
99 |
dnl $2 = string |
100 |
dnl |
101 |
AC_DEFUN([EGG_APPEND_VAR], |
102 |
[ |
103 |
if test "x$2" != x; then |
104 |
if test "x$$1" = x; then |
105 |
$1="$2" |
106 |
else |
107 |
$1="$$1 $2" |
108 |
fi |
109 |
fi |
110 |
]) |
111 |
|
112 |
|
113 |
dnl |
114 |
dnl Compiler checks. |
115 |
dnl |
116 |
|
117 |
|
118 |
dnl EGG_CHECK_CC() |
119 |
dnl |
120 |
dnl Check for a working C compiler. |
121 |
dnl |
122 |
AC_DEFUN([EGG_CHECK_CC], |
123 |
[ |
124 |
if test "x$cross_compiling" = x; then |
125 |
cat << 'EOF' >&2 |
126 |
configure: error: |
127 |
|
128 |
This system does not appear to have a working C compiler. |
129 |
A working C compiler is required to compile Eggdrop. |
130 |
|
131 |
EOF |
132 |
exit 1 |
133 |
fi |
134 |
]) |
135 |
|
136 |
|
137 |
dnl EGG_HEADER_STDC() |
138 |
dnl |
139 |
AC_DEFUN([EGG_HEADER_STDC], |
140 |
[ |
141 |
if test "$ac_cv_header_stdc" = no; then |
142 |
cat << 'EOF' >&2 |
143 |
configure: error: |
144 |
|
145 |
Your system must support ANSI C Header files. |
146 |
These are required for the language support. Sorry. |
147 |
|
148 |
EOF |
149 |
exit 1 |
150 |
fi |
151 |
]) |
152 |
|
153 |
|
154 |
dnl EGG_CHECK_ICC() |
155 |
dnl |
156 |
dnl Check for Intel's C compiler. It attempts to emulate gcc but doesn't |
157 |
dnl accept all the standard gcc options. |
158 |
dnl |
159 |
dnl |
160 |
AC_DEFUN([EGG_CHECK_ICC],[ |
161 |
AC_CACHE_CHECK([for icc], egg_cv_var_cc_icc, [ |
162 |
AC_COMPILE_IFELSE([[ |
163 |
#if !(defined(__ICC) || defined(__ECC) || defined(__INTEL_COMPILER)) |
164 |
"Toto, I've a feeling we're not in Kansas anymore." |
165 |
#endif |
166 |
]], [ |
167 |
egg_cv_var_cc_icc="yes" |
168 |
], [ |
169 |
egg_cv_var_cc_icc="no" |
170 |
]) |
171 |
]) |
172 |
|
173 |
if test "$egg_cv_var_cc_icc" = yes; then |
174 |
ICC="yes" |
175 |
else |
176 |
ICC="no" |
177 |
fi |
178 |
]) |
179 |
|
180 |
|
181 |
dnl EGG_CHECK_CCPIPE() |
182 |
dnl |
183 |
dnl This macro checks whether or not the compiler supports the `-pipe' flag, |
184 |
dnl which speeds up the compilation. |
185 |
dnl |
186 |
AC_DEFUN([EGG_CHECK_CCPIPE], |
187 |
[ |
188 |
if test "$GCC" = yes && test "$ICC" = no; then |
189 |
AC_CACHE_CHECK([whether the compiler understands -pipe], egg_cv_var_ccpipe, [ |
190 |
ac_old_CC="$CC" |
191 |
CC="$CC -pipe" |
192 |
AC_COMPILE_IFELSE([[ |
193 |
int main () |
194 |
{ |
195 |
return(0); |
196 |
} |
197 |
]], [ |
198 |
egg_cv_var_ccpipe="yes" |
199 |
], [ |
200 |
egg_cv_var_ccpipe="no" |
201 |
]) |
202 |
CC="$ac_old_CC" |
203 |
]) |
204 |
|
205 |
if test "$egg_cv_var_ccpipe" = yes; then |
206 |
EGG_APPEND_VAR(CFLAGS, -pipe) |
207 |
fi |
208 |
fi |
209 |
]) |
210 |
|
211 |
|
212 |
dnl EGG_CHECK_CCWALL() |
213 |
dnl |
214 |
dnl See if the compiler supports -Wall. |
215 |
dnl |
216 |
AC_DEFUN([EGG_CHECK_CCWALL], |
217 |
[ |
218 |
if test "$GCC" = yes && test "$ICC" = no; then |
219 |
AC_CACHE_CHECK([whether the compiler understands -Wall], egg_cv_var_ccwall, [ |
220 |
ac_old_CFLAGS="$CFLAGS" |
221 |
CFLAGS="$CFLAGS -Wall" |
222 |
AC_COMPILE_IFELSE([[ |
223 |
int main () |
224 |
{ |
225 |
return(0); |
226 |
} |
227 |
]], [ |
228 |
egg_cv_var_ccwall="yes" |
229 |
], [ |
230 |
egg_cv_var_ccwall="no" |
231 |
]) |
232 |
CFLAGS="$ac_old_CFLAGS" |
233 |
]) |
234 |
|
235 |
if test "$egg_cv_var_ccwall" = yes; then |
236 |
EGG_APPEND_VAR(CFLAGS, -Wall) |
237 |
fi |
238 |
fi |
239 |
]) |
240 |
|
241 |
|
242 |
dnl |
243 |
dnl Checks for types and functions. |
244 |
dnl |
245 |
|
246 |
|
247 |
dnl EGG_CHECK_SOCKLEN_T() |
248 |
dnl |
249 |
dnl Check for the socklen_t type. |
250 |
dnl |
251 |
AC_DEFUN([EGG_CHECK_SOCKLEN_T], |
252 |
[ |
253 |
AC_CACHE_CHECK([for socklen_t], egg_cv_socklen_t, [ |
254 |
AC_RUN_IFELSE([[ |
255 |
#include <unistd.h> |
256 |
#include <sys/param.h> |
257 |
#include <sys/types.h> |
258 |
#include <sys/socket.h> |
259 |
#include <netinet/in.h> |
260 |
#include <arpa/inet.h> |
261 |
|
262 |
int main() |
263 |
{ |
264 |
socklen_t test = 55; |
265 |
|
266 |
if (test != 55) |
267 |
exit(1); |
268 |
|
269 |
return(0); |
270 |
} |
271 |
]], [ |
272 |
egg_cv_socklen_t="yes" |
273 |
], [ |
274 |
egg_cv_socklen_t="no" |
275 |
], [ |
276 |
egg_cv_socklen_t="cross" |
277 |
]) |
278 |
]) |
279 |
|
280 |
if test "$egg_cv_socklen_t" = yes; then |
281 |
AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define to 1 if you have the `socklen_t' type.]) |
282 |
fi |
283 |
]) |
284 |
|
285 |
|
286 |
dnl EGG_FUNC_VPRINTF() |
287 |
dnl |
288 |
AC_DEFUN([EGG_FUNC_VPRINTF], |
289 |
[ |
290 |
AC_FUNC_VPRINTF |
291 |
if test "$ac_cv_func_vprintf" = no; then |
292 |
cat << 'EOF' >&2 |
293 |
configure: error: |
294 |
|
295 |
Your system does not have the vprintf/vsprintf/sprintf libraries. |
296 |
These are required to compile almost anything. Sorry. |
297 |
|
298 |
EOF |
299 |
exit 1 |
300 |
fi |
301 |
]) |
302 |
|
303 |
|
304 |
dnl |
305 |
dnl Checks for programs. |
306 |
dnl |
307 |
|
308 |
|
309 |
dnl EGG_PROG_HEAD_1() |
310 |
dnl |
311 |
dnl This macro checks for the proper 'head -1' command variant to use. |
312 |
dnl |
313 |
AC_DEFUN([EGG_PROG_HEAD_1], |
314 |
[ |
315 |
cat << 'EOF' > conftest.head |
316 |
a |
317 |
b |
318 |
c |
319 |
EOF |
320 |
|
321 |
for ac_prog in 'head -n 1' 'head -1' 'sed 1q'; do |
322 |
AC_MSG_CHECKING([whether $ac_prog works]) |
323 |
AC_CACHE_VAL([ac_cv_prog_HEAD_1], [ |
324 |
if test -n "$HEAD_1"; then |
325 |
# Let the user override the test. |
326 |
ac_cv_prog_HEAD_1="$HEAD_1" |
327 |
else |
328 |
if test `cat conftest.head | $ac_prog` = a; then |
329 |
ac_cv_prog_HEAD_1="$ac_prog" |
330 |
fi |
331 |
fi |
332 |
]) |
333 |
if test -n "$ac_cv_prog_HEAD_1"; then |
334 |
AC_MSG_RESULT([yes]) |
335 |
break |
336 |
else |
337 |
AC_MSG_RESULT([no]) |
338 |
fi |
339 |
done |
340 |
|
341 |
if test "x$ac_cv_prog_HEAD_1" = x; then |
342 |
cat << 'EOF' >&2 |
343 |
configure: error: |
344 |
|
345 |
This system seems to lack a working 'head -1' or 'head -n 1' command. |
346 |
A working 'head -1' (or equivalent) command is required to compile Eggdrop. |
347 |
|
348 |
EOF |
349 |
exit 1 |
350 |
fi |
351 |
|
352 |
rm -f conftest.head |
353 |
HEAD_1="$ac_cv_prog_HEAD_1" |
354 |
AC_SUBST(HEAD_1) |
355 |
]) |
356 |
|
357 |
|
358 |
dnl EGG_PROG_STRIP() |
359 |
dnl |
360 |
AC_DEFUN([EGG_PROG_STRIP], |
361 |
[ |
362 |
AC_CHECK_PROG(STRIP, strip, strip) |
363 |
if test "x$STRIP" = x; then |
364 |
STRIP=touch |
365 |
fi |
366 |
]) |
367 |
|
368 |
|
369 |
dnl EGG_PROG_AWK() |
370 |
dnl |
371 |
AC_DEFUN([EGG_PROG_AWK], |
372 |
[ |
373 |
AC_PROG_AWK |
374 |
if test "x$AWK" = x; then |
375 |
cat << 'EOF' >&2 |
376 |
configure: error: |
377 |
|
378 |
This system seems to lack a working 'awk' command. |
379 |
A working 'awk' command is required to compile Eggdrop. |
380 |
|
381 |
EOF |
382 |
exit 1 |
383 |
fi |
384 |
]) |
385 |
|
386 |
|
387 |
dnl EGG_PROG_BASENAME() |
388 |
dnl |
389 |
AC_DEFUN([EGG_PROG_BASENAME], |
390 |
[ |
391 |
AC_CHECK_PROG(BASENAME, basename, basename) |
392 |
if test "x$BASENAME" = x; then |
393 |
cat << 'EOF' >&2 |
394 |
configure: error: |
395 |
|
396 |
This system seems to lack a working 'basename' command. |
397 |
A working 'basename' command is required to compile Eggdrop. |
398 |
|
399 |
EOF |
400 |
exit 1 |
401 |
fi |
402 |
]) |
403 |
|
404 |
|
405 |
dnl EGG_ENABLE_STRIP() |
406 |
dnl |
407 |
AC_DEFUN([EGG_ENABLE_STRIP], |
408 |
[ |
409 |
AC_ARG_ENABLE([strip], |
410 |
[ --enable-strip enable stripping of binaries], |
411 |
[enable_strip="$enableval"], |
412 |
[enable_strip="no"]) |
413 |
|
414 |
if test "$enable_strip" = yes; then |
415 |
cat << 'EOF' >&2 |
416 |
|
417 |
configure: WARNING: |
418 |
|
419 |
Stripping the executable, while saving some disk space, will make bug |
420 |
reports nearly worthless. If Eggdrop crashes and you wish to report |
421 |
a bug, you will need to recompile with stripping disabled. |
422 |
|
423 |
EOF |
424 |
else |
425 |
STRIP="touch" |
426 |
fi |
427 |
]) |
428 |
|
429 |
|
430 |
dnl |
431 |
dnl Checks for operating system and module support. |
432 |
dnl |
433 |
|
434 |
|
435 |
dnl EGG_OS_VERSION() |
436 |
dnl |
437 |
AC_DEFUN([EGG_OS_VERSION], |
438 |
[ |
439 |
dnl FIXME: Eventually replace these with the results of AC_CANONICAL_* below |
440 |
AC_CACHE_CHECK([system type], egg_cv_var_system_type, [egg_cv_var_system_type=`$UNAME -s`]) |
441 |
AC_CACHE_CHECK([system release], egg_cv_var_system_release, [egg_cv_var_system_release=`$UNAME -r`]) |
442 |
|
443 |
AC_CANONICAL_BUILD |
444 |
AC_CANONICAL_HOST |
445 |
AC_CANONICAL_TARGET |
446 |
]) |
447 |
|
448 |
|
449 |
dnl EGG_CYGWIN_BINMODE |
450 |
dnl |
451 |
dnl Check for binmode.o on Cygwin. |
452 |
dnl |
453 |
AC_DEFUN([EGG_CYGWIN_BINMODE], |
454 |
[ |
455 |
if test "$EGG_CYGWIN" = yes; then |
456 |
AC_MSG_CHECKING([for /usr/lib/binmode.o]) |
457 |
if test -r /usr/lib/binmode.o; then |
458 |
AC_MSG_RESULT([yes]) |
459 |
EGG_APPEND_VAR(LIBS, /usr/lib/binmode.o) |
460 |
else |
461 |
AC_MSG_RESULT([no]) |
462 |
AC_MSG_WARN([Make sure the directory Eggdrop is installed into is mounted in binary mode.]) |
463 |
fi |
464 |
fi |
465 |
]) |
466 |
|
467 |
|
468 |
dnl EGG_DARWIN_BUNDLE |
469 |
dnl |
470 |
dnl Locate bundle1.o on Darwin. Test systems seem to have it in /usr/lib, |
471 |
dnl however the official docs say /lib. |
472 |
dnl |
473 |
AC_DEFUN([EGG_DARWIN_BUNDLE], |
474 |
[ |
475 |
BUNDLE="" |
476 |
for bundlepath in "/lib" "/usr/lib" "/usr/local/lib"; do |
477 |
AC_MSG_CHECKING([for bundle1.o in ${bundlepath}]) |
478 |
if test -r "${bundlepath}/bundle1.o"; then |
479 |
AC_MSG_RESULT([yes]) |
480 |
BUNDLE="${bundlepath}/bundle1.o" |
481 |
break |
482 |
else |
483 |
AC_MSG_RESULT([no]) |
484 |
fi |
485 |
done |
486 |
|
487 |
if test "x$BUNDLE" = x; then |
488 |
cat << 'EOF' >&2 |
489 |
configure: WARNING: |
490 |
|
491 |
bundle1.o cannot be located. A module build might not compile correctly. |
492 |
|
493 |
EOF |
494 |
fi |
495 |
]) |
496 |
|
497 |
|
498 |
dnl EGG_CHECK_MODULE_SUPPORT() |
499 |
dnl |
500 |
dnl Checks for module support. This should be run after EGG_OS_VERSION. |
501 |
dnl |
502 |
AC_DEFUN([EGG_CHECK_MODULE_SUPPORT], |
503 |
[ |
504 |
MODULES_OK="yes" |
505 |
MOD_EXT="so" |
506 |
DEFAULT_MAKE="eggdrop" |
507 |
LOAD_METHOD="dl" |
508 |
WEIRD_OS="yes" |
509 |
UNKNOWN_OS="no" |
510 |
MODULE_XLIBS="" |
511 |
|
512 |
AC_MSG_CHECKING([module loading capabilities]) |
513 |
AC_MSG_RESULT |
514 |
AC_CHECK_HEADERS([dl.h dlfcn.h loader.h rld.h mach-o/dyld.h mach-o/rld.h]) |
515 |
AC_CHECK_FUNCS([dlopen load NSLinkModule shl_load rld_load]) |
516 |
|
517 |
# Note to other maintainers: |
518 |
# Bourne shell has no concept of "fall through" |
519 |
case "$egg_cv_var_system_type" in |
520 |
BSD/OS) |
521 |
if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 2; then |
522 |
MODULES_OK="no" |
523 |
fi |
524 |
;; |
525 |
CYGWI*) |
526 |
WEIRD_OS="no" |
527 |
MOD_EXT="dll" |
528 |
;; |
529 |
HP-UX) |
530 |
LOAD_METHOD="shl" |
531 |
;; |
532 |
dell) |
533 |
# do nothing |
534 |
;; |
535 |
IRIX) |
536 |
# do nothing |
537 |
;; |
538 |
Ultrix) |
539 |
# No dlopen() or similar on Ultrix. We can't use modules. |
540 |
MODULES_OK="no" |
541 |
;; |
542 |
BeOS) |
543 |
# We don't yet support BeOS's dynamic linking interface. |
544 |
MODULES_OK="no" |
545 |
;; |
546 |
Linux) |
547 |
WEIRD_OS="no" |
548 |
;; |
549 |
Lynx) |
550 |
# do nothing |
551 |
;; |
552 |
QNX) |
553 |
# do nothing |
554 |
# QNX (recent versions at least) support dlopen(). |
555 |
;; |
556 |
OSF1) |
557 |
case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in |
558 |
1.*) LOAD_METHOD="loader" ;; |
559 |
esac |
560 |
;; |
561 |
SunOS) |
562 |
if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 5; then |
563 |
# We've had quite a bit of testing on Solaris. |
564 |
WEIRD_OS="no" |
565 |
else |
566 |
# SunOS 4 |
567 |
AC_DEFINE(DLOPEN_1, 1, [Define if running on SunOS 4.0.]) |
568 |
fi |
569 |
;; |
570 |
*BSD) |
571 |
# FreeBSD/OpenBSD/NetBSD all support dlopen() and have had plenty of |
572 |
# testing with Eggdrop. |
573 |
WEIRD_OS="no" |
574 |
;; |
575 |
Darwin) |
576 |
# We should support Mac OS X (at least 10.1 and later) now. |
577 |
# Use rld on < 10.1. |
578 |
if test "$ac_cv_func_NSLinkModule" = no; then |
579 |
LOAD_METHOD="rld" |
580 |
fi |
581 |
LOAD_METHOD="dyld" |
582 |
EGG_DARWIN_BUNDLE |
583 |
EGG_APPEND_VAR(MODULE_XLIBS, $BUNDLE) |
584 |
;; |
585 |
*) |
586 |
if test -r /mach; then |
587 |
# At this point, we're guessing this is NeXT Step. We support rld, so |
588 |
# modules will probably work on NeXT now, but we have absolutely no way |
589 |
# to test this. I've never even seen a NeXT box, let alone do I know of |
590 |
# one I can test this on. |
591 |
LOAD_METHOD="rld" |
592 |
else |
593 |
# QNX apparently supports dlopen()... Fallthrough. |
594 |
if test -r /cmds; then |
595 |
UNKNOWN_OS="yes" |
596 |
MODULES_OK="no" |
597 |
fi |
598 |
fi |
599 |
;; |
600 |
esac |
601 |
|
602 |
if test "$MODULES_OK" = yes; then |
603 |
AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.]) |
604 |
case $LOAD_METHOD in |
605 |
dl) |
606 |
AC_DEFINE(MOD_USE_DL, 1, [Define if modules should be loaded using the dl*() functions.]) |
607 |
;; |
608 |
shl) |
609 |
AC_DEFINE(MOD_USE_SHL, 1, [Define if modules should be loaded using the shl_*() functions.]) |
610 |
;; |
611 |
dyld) |
612 |
AC_DEFINE(MOD_USE_DYLD, 1, [Define if modules should be loaded using the NS*() functions.]) |
613 |
;; |
614 |
loader) |
615 |
AC_DEFINE(MOD_USE_LOADER, 1, [Define if modules should be loaded using the ldr*() and *load() functions.]) |
616 |
;; |
617 |
rld) |
618 |
AC_DEFINE(MOD_USE_RLD, 1, [Define if modules should be loaded using the rld_*() functions.]) |
619 |
;; |
620 |
esac |
621 |
else |
622 |
DEFAULT_MAKE="static" |
623 |
fi |
624 |
|
625 |
if test "$WEIRD_OS" = yes; then |
626 |
# Default to "make static" for 'weird' operating systems. Will print a |
627 |
# note at the end of configure explaining. This way, Eggdrop should compile |
628 |
# "out of the box" on most every operating system we know of, and they can |
629 |
# do a "make eggdrop" if they want to use(/try to use) module support. - Wcc |
630 |
DEFAULT_MAKE="static" |
631 |
fi |
632 |
|
633 |
AC_SUBST(DEFAULT_MAKE) |
634 |
AC_SUBST(MOD_EXT) |
635 |
AC_SUBST(MODULE_XLIBS) |
636 |
AC_DEFINE_UNQUOTED(EGG_MOD_EXT, "$MOD_EXT", [Defines the extension of Eggdrop modules.]) |
637 |
]) |
638 |
|
639 |
|
640 |
dnl EGG_CHECK_OS() |
641 |
dnl |
642 |
dnl Various operating system tests. |
643 |
dnl |
644 |
AC_DEFUN([EGG_CHECK_OS], |
645 |
[ |
646 |
MOD_CC="$CC" |
647 |
MOD_LD="$CC" |
648 |
MOD_STRIP="$STRIP" |
649 |
SHLIB_CC="$CC" |
650 |
SHLIB_LD="$CC" |
651 |
SHLIB_STRIP="$STRIP" |
652 |
LINUX="no" |
653 |
IRIX="no" |
654 |
SUNOS="no" |
655 |
HPUX="no" |
656 |
EGG_CYGWIN="no" |
657 |
|
658 |
case "$egg_cv_var_system_type" in |
659 |
BSD/OS) |
660 |
case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in |
661 |
2) |
662 |
# do nothing |
663 |
;; |
664 |
3) |
665 |
MOD_CC="shlicc" |
666 |
MOD_LD="shlicc" |
667 |
if test "$STRIP" != touch; then |
668 |
MOD_STRIP="$STRIP -d" |
669 |
fi |
670 |
SHLIB_LD="shlicc -r" |
671 |
SHLIB_STRIP="touch" |
672 |
;; |
673 |
*) |
674 |
if test "$STRIP" != touch; then |
675 |
MOD_STRIP="$STRIP -d" |
676 |
fi |
677 |
SHLIB_CC="$CC -export-dynamic -fPIC" |
678 |
SHLIB_LD="$CC -shared -nostartfiles" |
679 |
;; |
680 |
esac |
681 |
;; |
682 |
CYGWI*) |
683 |
AC_PROG_CC_WIN32 |
684 |
SHLIB_LD="$CC -shared" |
685 |
CC="$CC $WIN32FLAGS" |
686 |
MOD_CC="$CC" |
687 |
MOD_LD="$CC" |
688 |
EGG_CYGWIN="yes" |
689 |
EGG_CYGWIN_BINMODE |
690 |
AC_DEFINE(CYGWIN_HACKS, 1, [Define if running under Cygwin.]) |
691 |
;; |
692 |
HP-UX) |
693 |
HPUX="yes" |
694 |
if test "$CC" = cc; then |
695 |
# HP-UX ANSI C Compiler. |
696 |
MOD_LD="$CC +z" |
697 |
SHLIB_CC="$CC +z" |
698 |
else |
699 |
# GCC |
700 |
MOD_LD="$CC -fPIC -shared" |
701 |
SHLIB_CC="$CC -fPIC" |
702 |
fi |
703 |
SHLIB_LD="ld -b" |
704 |
;; |
705 |
dell) |
706 |
SHLIB_STRIP="touch" |
707 |
MOD_LD="$CC -lelf -lucb" |
708 |
;; |
709 |
IRIX) |
710 |
SHLIB_LD="ld -n32 -shared -rdata_shared" |
711 |
IRIX="yes" |
712 |
SHLIB_STRIP="touch" |
713 |
;; |
714 |
Ultrix) |
715 |
SHLIB_STRIP="touch" |
716 |
DEFAULT_MAKE="static" |
717 |
SHELL="/bin/sh5" |
718 |
;; |
719 |
SINIX*) |
720 |
SHLIB_STRIP="touch" |
721 |
SHLIB_CC="cc -G" |
722 |
;; |
723 |
BeOS) |
724 |
# do nothing |
725 |
;; |
726 |
Linux) |
727 |
LINUX="yes" |
728 |
MOD_LD="$CC" |
729 |
SHLIB_CC="$CC -fPIC" |
730 |
SHLIB_LD="$CC -shared -nostartfiles" |
731 |
;; |
732 |
Lynx) |
733 |
# do nothing |
734 |
;; |
735 |
QNX) |
736 |
SHLIB_LD="ld -shared" |
737 |
;; |
738 |
OSF1) |
739 |
case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in |
740 |
V*) |
741 |
# Digital OSF uses an ancient version of gawk |
742 |
if test "$AWK" = gawk; then |
743 |
AWK="awk" |
744 |
fi |
745 |
SHLIB_LD="ld -shared -expect_unresolved \"'*'\"" |
746 |
SHLIB_STRIP="touch" |
747 |
;; |
748 |
1.0|1.1|1.2) |
749 |
SHLIB_LD="ld -R -export $@:" |
750 |
;; |
751 |
1.*) |
752 |
SHLIB_CC="$CC -fpic" |
753 |
SHLIB_LD="ld -shared" |
754 |
;; |
755 |
esac |
756 |
AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions regardless of HAVE_SNPRINTF.]) |
757 |
AC_DEFINE(STOP_UAC, 1, [Define if running on OSF/1 platform.]) |
758 |
;; |
759 |
SunOS) |
760 |
if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 5; then |
761 |
# Solaris |
762 |
if test -n "$GCC"; then |
763 |
SHLIB_CC="$CC -fPIC" |
764 |
SHLIB_LD="$CC -shared" |
765 |
else |
766 |
SHLIB_CC="$CC -KPIC" |
767 |
SHLIB_LD="$CC -G -z text" |
768 |
fi |
769 |
else |
770 |
# SunOS 4 |
771 |
SUNOS="yes" |
772 |
SHLIB_LD="ld" |
773 |
SHLIB_CC="$CC -PIC" |
774 |
fi |
775 |
;; |
776 |
*BSD) |
777 |
# FreeBSD/OpenBSD/NetBSD |
778 |
SHLIB_CC="$CC -fPIC" |
779 |
SHLIB_LD="ld -Bshareable -x" |
780 |
;; |
781 |
Darwin) |
782 |
# Mac OS X |
783 |
SHLIB_CC="$CC -fPIC" |
784 |
SHLIB_LD="ld -bundle -undefined error" |
785 |
AC_DEFINE(BIND_8_COMPAT, 1, [Define if running on Mac OS X with dns.mod.]) |
786 |
;; |
787 |
*) |
788 |
if test -r /mach; then |
789 |
# At this point, we're guessing this is NeXT Step. |
790 |
AC_DEFINE(BORGCUBES, 1, [Define if running on NeXT Step.]) |
791 |
else |
792 |
if test -r /cmds; then |
793 |
# Probably QNX. |
794 |
SHLIB_LD="ld -shared" |
795 |
SHLIB_STRIP="touch" |
796 |
fi |
797 |
fi |
798 |
;; |
799 |
esac |
800 |
|
801 |
AC_SUBST(MOD_LD) |
802 |
AC_SUBST(MOD_CC) |
803 |
AC_SUBST(MOD_STRIP) |
804 |
AC_SUBST(SHLIB_LD) |
805 |
AC_SUBST(SHLIB_CC) |
806 |
AC_SUBST(SHLIB_STRIP) |
807 |
]) |
808 |
|
809 |
|
810 |
dnl |
811 |
dnl Library tests. |
812 |
dnl |
813 |
|
814 |
|
815 |
dnl EGG_CHECK_LIBS() |
816 |
dnl |
817 |
AC_DEFUN([EGG_CHECK_LIBS], |
818 |
[ |
819 |
# FIXME: this needs to be fixed so that it works on IRIX |
820 |
if test "$IRIX" = yes; then |
821 |
AC_MSG_WARN([Skipping library tests because they CONFUSE IRIX.]) |
822 |
else |
823 |
AC_CHECK_LIB(socket, socket) |
824 |
AC_CHECK_LIB(nsl, connect) |
825 |
AC_CHECK_LIB(dns, gethostbyname) |
826 |
AC_CHECK_LIB(dl, dlopen) |
827 |
AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm") |
828 |
|
829 |
# This is needed for Tcl libraries compiled with thread support |
830 |
AC_CHECK_LIB(pthread, pthread_mutex_init, [ |
831 |
ac_cv_lib_pthread_pthread_mutex_init="yes" |
832 |
ac_cv_lib_pthread="-lpthread" |
833 |
], [ |
834 |
AC_CHECK_LIB(pthread, __pthread_mutex_init, [ |
835 |
ac_cv_lib_pthread_pthread_mutex_init="yes" |
836 |
ac_cv_lib_pthread="-lpthread" |
837 |
], [ |
838 |
AC_CHECK_LIB(pthreads, pthread_mutex_init, [ |
839 |
ac_cv_lib_pthread_pthread_mutex_init="yes" |
840 |
ac_cv_lib_pthread="-lpthreads" |
841 |
], [ |
842 |
AC_CHECK_FUNC(pthread_mutex_init, [ |
843 |
ac_cv_lib_pthread_pthread_mutex_init="yes" |
844 |
ac_cv_lib_pthread="" |
845 |
], [ |
846 |
ac_cv_lib_pthread_pthread_mutex_init="no" |
847 |
] |
848 |
)] |
849 |
)] |
850 |
)]) |
851 |
|
852 |
if test "$SUNOS" = yes; then |
853 |
# For suns without yp |
854 |
AC_CHECK_LIB(dl, main) |
855 |
else |
856 |
if test "$HPUX" = yes; then |
857 |
AC_CHECK_LIB(dld, shl_load) |
858 |
fi |
859 |
fi |
860 |
fi |
861 |
]) |
862 |
|
863 |
|
864 |
dnl EGG_ARG_HANDLEN() |
865 |
dnl |
866 |
AC_DEFUN([EGG_ARG_HANDLEN], [ |
867 |
AC_ARG_WITH(handlen, [ --with-handlen=VALUE set the maximum length a handle on the bot can be], [ |
868 |
if test -n $withval && test $withval -ge 9 && test $withval -le 32; |
869 |
then |
870 |
AC_DEFINE_UNQUOTED(EGG_HANDLEN, $withval, [ |
871 |
Define the maximum length of handles on the bot. |
872 |
]) |
873 |
else |
874 |
AC_MSG_WARN([Invalid handlen given (must be a number between 9 and 32), defaulting to 9.]) |
875 |
fi |
876 |
]) |
877 |
]) |
878 |
|
879 |
dnl |
880 |
dnl Misc checks. |
881 |
dnl |
882 |
|
883 |
|
884 |
dnl EGG_EXEEXT() |
885 |
dnl |
886 |
dnl Test for executable suffix and define Eggdrop's executable name accordingly. |
887 |
dnl |
888 |
AC_DEFUN([EGG_EXEEXT], [ |
889 |
EGGEXEC="eggdrop" |
890 |
AC_EXEEXT |
891 |
if test "x$EXEEXT" != x; then |
892 |
EGGEXEC="eggdrop${EXEEXT}" |
893 |
fi |
894 |
AC_SUBST(EGGEXEC) |
895 |
]) |
896 |
|
897 |
|
898 |
dnl |
899 |
dnl Tcl checks. |
900 |
dnl |
901 |
|
902 |
|
903 |
dnl EGG_TCL_ARG_WITH() |
904 |
dnl |
905 |
AC_DEFUN([EGG_TCL_ARG_WITH], |
906 |
[ |
907 |
AC_ARG_WITH(tcllib, [ --with-tcllib=PATH full path to Tcl library], [tcllibname="$withval"]) |
908 |
AC_ARG_WITH(tclinc, [ --with-tclinc=PATH full path to Tcl header], [tclincname="$withval"]) |
909 |
|
910 |
WARN=0 |
911 |
# Make sure either both or neither $tcllibname and $tclincname are set |
912 |
if test "x$tcllibname" != x; then |
913 |
if test "x$tclincname" = x; then |
914 |
WARN=1 |
915 |
tcllibname="" |
916 |
TCLLIB="" |
917 |
TCLINC="" |
918 |
fi |
919 |
else |
920 |
if test "x$tclincname" != x; then |
921 |
WARN=1 |
922 |
tclincname="" |
923 |
TCLLIB="" |
924 |
TCLINC="" |
925 |
fi |
926 |
fi |
927 |
|
928 |
if test "$WARN" = 1; then |
929 |
cat << 'EOF' >&2 |
930 |
configure: WARNING: |
931 |
|
932 |
You must specify both --with-tcllib and --with-tclinc for either to work. |
933 |
|
934 |
configure will now attempt to autodetect both the Tcl library and header. |
935 |
|
936 |
EOF |
937 |
fi |
938 |
]) |
939 |
|
940 |
|
941 |
dnl EGG_TCL_ENV() |
942 |
dnl |
943 |
AC_DEFUN([EGG_TCL_ENV], |
944 |
[ |
945 |
WARN=0 |
946 |
# Make sure either both or neither $TCLLIB and $TCLINC are set |
947 |
if test "x$TCLLIB" != x; then |
948 |
if test "x$TCLINC" = x; then |
949 |
WARN=1 |
950 |
WVAR1=TCLLIB |
951 |
WVAR2=TCLINC |
952 |
TCLLIB="" |
953 |
fi |
954 |
else |
955 |
if test "x$TCLINC" != x; then |
956 |
WARN=1 |
957 |
WVAR1=TCLINC |
958 |
WVAR2=TCLLIB |
959 |
TCLINC="" |
960 |
fi |
961 |
fi |
962 |
|
963 |
if test "$WARN" = 1; then |
964 |
cat << EOF >&2 |
965 |
configure: WARNING: |
966 |
|
967 |
Environment variable $WVAR1 was set, but I did not detect ${WVAR2}. |
968 |
Please set both TCLLIB and TCLINC correctly if you wish to use them. |
969 |
|
970 |
configure will now attempt to autodetect both the Tcl library and header. |
971 |
|
972 |
EOF |
973 |
fi |
974 |
]) |
975 |
|
976 |
|
977 |
dnl EGG_TCL_WITH_TCLLIB() |
978 |
dnl |
979 |
AC_DEFUN([EGG_TCL_WITH_TCLLIB], |
980 |
[ |
981 |
# Look for Tcl library: if $tcllibname is set, check there first |
982 |
if test "x$tcllibname" != x; then |
983 |
if test -f "$tcllibname" && test -r "$tcllibname"; then |
984 |
TCLLIB=`echo $tcllibname | sed 's%/[[^/]][[^/]]*$%%'` |
985 |
TCLLIBFN=`$BASENAME $tcllibname | cut -c4-` |
986 |
TCLLIBEXT=".`echo $TCLLIBFN | $AWK '{j=split([$]1, i, "."); print i[[j]]}'`" |
987 |
TCLLIBFNS=`$BASENAME $tcllibname $TCLLIBEXT | cut -c4-` |
988 |
else |
989 |
cat << EOF >&2 |
990 |
configure: WARNING: |
991 |
|
992 |
The file '$tcllibname' given to option --with-tcllib is not valid. |
993 |
|
994 |
configure will now attempt to autodetect both the Tcl library and header. |
995 |
|
996 |
EOF |
997 |
tcllibname="" |
998 |
tclincname="" |
999 |
TCLLIB="" |
1000 |
TCLLIBFN="" |
1001 |
TCLINC="" |
1002 |
TCLINCFN="" |
1003 |
fi |
1004 |
fi |
1005 |
]) |
1006 |
|
1007 |
|
1008 |
dnl EGG_TCL_WITH_TCLINC() |
1009 |
dnl |
1010 |
AC_DEFUN([EGG_TCL_WITH_TCLINC], |
1011 |
[ |
1012 |
# Look for Tcl header: if $tclincname is set, check there first |
1013 |
if test "x$tclincname" != x; then |
1014 |
if test -f "$tclincname" && test -r "$tclincname"; then |
1015 |
TCLINC=`echo $tclincname | sed 's%/[[^/]][[^/]]*$%%'` |
1016 |
TCLINCFN=`$BASENAME $tclincname` |
1017 |
else |
1018 |
cat << EOF >&2 |
1019 |
configure: WARNING: |
1020 |
|
1021 |
The file '$tclincname' given to option --with-tclinc is not valid. |
1022 |
|
1023 |
configure will now attempt to autodetect both the Tcl library and header. |
1024 |
|
1025 |
EOF |
1026 |
tcllibname="" |
1027 |
tclincname="" |
1028 |
TCLLIB="" |
1029 |
TCLLIBFN="" |
1030 |
TCLINC="" |
1031 |
TCLINCFN="" |
1032 |
fi |
1033 |
fi |
1034 |
]) |
1035 |
|
1036 |
|
1037 |
dnl EGG_TCL_FIND_LIBRARY() |
1038 |
dnl |
1039 |
AC_DEFUN([EGG_TCL_FIND_LIBRARY], |
1040 |
[ |
1041 |
# Look for Tcl library: if $TCLLIB is set, check there first |
1042 |
if test "x$TCLLIBFN" = x && test "x$TCLLIB" != x; then |
1043 |
if test -d "$TCLLIB"; then |
1044 |
for tcllibfns in $tcllibnames; do |
1045 |
for tcllibext in $tcllibextensions; do |
1046 |
if test -r "${TCLLIB}/lib${tcllibfns}${tcllibext}"; then |
1047 |
TCLLIBFN="${tcllibfns}${tcllibext}" |
1048 |
TCLLIBEXT="$tcllibext" |
1049 |
TCLLIBFNS="$tcllibfns" |
1050 |
break 2 |
1051 |
fi |
1052 |
done |
1053 |
done |
1054 |
fi |
1055 |
|
1056 |
if test "x$TCLLIBFN" = x; then |
1057 |
cat << 'EOF' >&2 |
1058 |
configure: WARNING: |
1059 |
|
1060 |
Environment variable TCLLIB was set, but incorrectly. |
1061 |
Please set both TCLLIB and TCLINC correctly if you wish to use them. |
1062 |
|
1063 |
configure will now attempt to autodetect both the Tcl library and header. |
1064 |
|
1065 |
EOF |
1066 |
TCLLIB="" |
1067 |
TCLLIBFN="" |
1068 |
TCLINC="" |
1069 |
TCLINCFN="" |
1070 |
fi |
1071 |
fi |
1072 |
]) |
1073 |
|
1074 |
|
1075 |
dnl EGG_TCL_FIND_HEADER() |
1076 |
dnl |
1077 |
AC_DEFUN([EGG_TCL_FIND_HEADER], |
1078 |
[ |
1079 |
# Look for Tcl header: if $TCLINC is set, check there first |
1080 |
if test "x$TCLINCFN" = x && test "x$TCLINC" != x; then |
1081 |
if test -d "$TCLINC"; then |
1082 |
for tclheaderfn in $tclheadernames; do |
1083 |
if test -r "${TCLINC}/${tclheaderfn}"; then |
1084 |
TCLINCFN="$tclheaderfn" |
1085 |
break |
1086 |
fi |
1087 |
done |
1088 |
fi |
1089 |
|
1090 |
if test "x$TCLINCFN" = x; then |
1091 |
cat << 'EOF' >&2 |
1092 |
configure: WARNING: |
1093 |
|
1094 |
Environment variable TCLINC was set, but incorrectly. |
1095 |
Please set both TCLLIB and TCLINC correctly if you wish to use them. |
1096 |
|
1097 |
configure will now attempt to autodetect both the Tcl library and header. |
1098 |
|
1099 |
EOF |
1100 |
TCLLIB="" |
1101 |
TCLLIBFN="" |
1102 |
TCLINC="" |
1103 |
TCLINCFN="" |
1104 |
fi |
1105 |
fi |
1106 |
]) |
1107 |
|
1108 |
|
1109 |
dnl EGG_TCL_CHECK_LIBRARY() |
1110 |
dnl |
1111 |
AC_DEFUN([EGG_TCL_CHECK_LIBRARY], |
1112 |
[ |
1113 |
AC_MSG_CHECKING([for Tcl library]) |
1114 |
|
1115 |
# Attempt autodetect for $TCLLIBFN if it's not set |
1116 |
if test "x$TCLLIBFN" != x; then |
1117 |
AC_MSG_RESULT([using ${TCLLIB}/lib${TCLLIBFN}]) |
1118 |
else |
1119 |
for tcllibfns in $tcllibnames; do |
1120 |
for tcllibext in $tcllibextensions; do |
1121 |
for tcllibpath in $tcllibpaths; do |
1122 |
if test -r "${tcllibpath}/lib${tcllibfns}${tcllibext}"; then |
1123 |
AC_MSG_RESULT([found ${tcllibpath}/lib${tcllibfns}${tcllibext}]) |
1124 |
TCLLIB="$tcllibpath" |
1125 |
TCLLIBFN="${tcllibfns}${tcllibext}" |
1126 |
TCLLIBEXT="$tcllibext" |
1127 |
TCLLIBFNS="$tcllibfns" |
1128 |
break 3 |
1129 |
fi |
1130 |
done |
1131 |
done |
1132 |
done |
1133 |
fi |
1134 |
|
1135 |
# Show if $TCLLIBFN wasn't found |
1136 |
if test "x$TCLLIBFN" = x; then |
1137 |
AC_MSG_RESULT([not found]) |
1138 |
fi |
1139 |
|
1140 |
AC_SUBST(TCLLIB) |
1141 |
AC_SUBST(TCLLIBFN) |
1142 |
]) |
1143 |
|
1144 |
|
1145 |
dnl EGG_TCL_CHECK_HEADER() |
1146 |
dnl |
1147 |
AC_DEFUN([EGG_TCL_CHECK_HEADER], |
1148 |
[ |
1149 |
AC_MSG_CHECKING([for Tcl header]) |
1150 |
|
1151 |
# Attempt autodetect for $TCLINCFN if it's not set |
1152 |
if test "x$TCLINCFN" != x; then |
1153 |
AC_MSG_RESULT([using ${TCLINC}/${TCLINCFN}]) |
1154 |
else |
1155 |
for tclheaderpath in $tclheaderpaths; do |
1156 |
for tclheaderfn in $tclheadernames; do |
1157 |
if test -r "${tclheaderpath}/${tclheaderfn}"; then |
1158 |
AC_MSG_RESULT([found ${tclheaderpath}/${tclheaderfn}]) |
1159 |
TCLINC="$tclheaderpath" |
1160 |
TCLINCFN="$tclheaderfn" |
1161 |
break 2 |
1162 |
fi |
1163 |
done |
1164 |
done |
1165 |
|
1166 |
# FreeBSD hack ... |
1167 |
if test "x$TCLINCFN" = x; then |
1168 |
for tcllibfns in $tcllibnames; do |
1169 |
for tclheaderpath in $tclheaderpaths; do |
1170 |
for tclheaderfn in $tclheadernames; do |
1171 |
if test -r "${tclheaderpath}/${tcllibfns}/${tclheaderfn}"; then |
1172 |
AC_MSG_RESULT([found ${tclheaderpath}/${tcllibfns}/${tclheaderfn}]) |
1173 |
TCLINC="${tclheaderpath}/${tcllibfns}" |
1174 |
TCLINCFN="$tclheaderfn" |
1175 |
break 3 |
1176 |
fi |
1177 |
done |
1178 |
done |
1179 |
done |
1180 |
fi |
1181 |
fi |
1182 |
|
1183 |
if test "x$TCLINCFN" = x; then |
1184 |
AC_MSG_RESULT([not found]) |
1185 |
fi |
1186 |
|
1187 |
AC_SUBST(TCLINC) |
1188 |
AC_SUBST(TCLINCFN) |
1189 |
]) |
1190 |
|
1191 |
|
1192 |
dnl EGG_CACHE_UNSET(CACHE-ID) |
1193 |
dnl |
1194 |
dnl Unsets a certain cache item. Typically called before using the AC_CACHE_*() |
1195 |
dnl macros. |
1196 |
dnl |
1197 |
AC_DEFUN([EGG_CACHE_UNSET], [unset $1]) |
1198 |
|
1199 |
|
1200 |
dnl EGG_TCL_DETECT_CHANGE() |
1201 |
dnl |
1202 |
dnl Detect whether the Tcl system has changed since our last configure run. |
1203 |
dnl Set egg_tcl_changed accordingly. |
1204 |
dnl |
1205 |
dnl Tcl related feature and version checks should re-run their checks as soon |
1206 |
dnl as egg_tcl_changed is set to "yes". |
1207 |
dnl |
1208 |
AC_DEFUN([EGG_TCL_DETECT_CHANGE], |
1209 |
[ |
1210 |
dnl NOTE: autoconf 2.50+ disables config.cache by default. |
1211 |
dnl These checks don't do us much good if cache is disabled. |
1212 |
AC_MSG_CHECKING([whether the Tcl system has changed]) |
1213 |
egg_tcl_changed="yes" |
1214 |
egg_tcl_id="${TCLLIB}:${TCLLIBFN}:${TCLINC}:${TCLINCFN}" |
1215 |
if test "$egg_tcl_id" != ":::"; then |
1216 |
egg_tcl_cached="yes" |
1217 |
AC_CACHE_VAL(egg_cv_var_tcl_id, [ |
1218 |
egg_cv_var_tcl_id="$egg_tcl_id" |
1219 |
egg_tcl_cached="no" |
1220 |
]) |
1221 |
if test "$egg_tcl_cached" = yes; then |
1222 |
if test "x$egg_cv_var_tcl_id" = "x$egg_tcl_id"; then |
1223 |
egg_tcl_changed="no" |
1224 |
else |
1225 |
egg_cv_var_tcl_id="$egg_tcl_id" |
1226 |
fi |
1227 |
fi |
1228 |
fi |
1229 |
|
1230 |
if test "$egg_tcl_changed" = yes; then |
1231 |
AC_MSG_RESULT([yes]) |
1232 |
else |
1233 |
AC_MSG_RESULT([no]) |
1234 |
fi |
1235 |
]) |
1236 |
|
1237 |
|
1238 |
dnl EGG_TCL_CHECK_VERSION() |
1239 |
dnl |
1240 |
AC_DEFUN([EGG_TCL_CHECK_VERSION], |
1241 |
[ |
1242 |
# Both TCLLIBFN & TCLINCFN must be set, or we bail |
1243 |
TCL_FOUND=0 |
1244 |
if test "x$TCLLIBFN" != x && test "x$TCLINCFN" != x; then |
1245 |
TCL_FOUND=1 |
1246 |
|
1247 |
# Check Tcl's version |
1248 |
if test "$egg_tcl_changed" = yes; then |
1249 |
EGG_CACHE_UNSET(egg_cv_var_tcl_version) |
1250 |
fi |
1251 |
|
1252 |
AC_MSG_CHECKING([for Tcl version]) |
1253 |
AC_CACHE_VAL(egg_cv_var_tcl_version, [ |
1254 |
egg_cv_var_tcl_version=`grep TCL_VERSION $TCLINC/$TCLINCFN | $HEAD_1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'` |
1255 |
]) |
1256 |
|
1257 |
if test "x$egg_cv_var_tcl_version" != x; then |
1258 |
AC_MSG_RESULT([$egg_cv_var_tcl_version]) |
1259 |
else |
1260 |
AC_MSG_RESULT([not found]) |
1261 |
TCL_FOUND=0 |
1262 |
fi |
1263 |
|
1264 |
# Check Tcl's patch level (if available) |
1265 |
if test "$egg_tcl_changed" = yes; then |
1266 |
EGG_CACHE_UNSET(egg_cv_var_tcl_patch_level) |
1267 |
fi |
1268 |
AC_MSG_CHECKING([for Tcl patch level]) |
1269 |
AC_CACHE_VAL(egg_cv_var_tcl_patch_level, [ |
1270 |
eval "egg_cv_var_tcl_patch_level=`grep TCL_PATCH_LEVEL $TCLINC/$TCLINCFN | $HEAD_1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'`" |
1271 |
]) |
1272 |
|
1273 |
if test "x$egg_cv_var_tcl_patch_level" != x; then |
1274 |
AC_MSG_RESULT([$egg_cv_var_tcl_patch_level]) |
1275 |
else |
1276 |
egg_cv_var_tcl_patch_level="unknown" |
1277 |
AC_MSG_RESULT([unknown]) |
1278 |
fi |
1279 |
fi |
1280 |
|
1281 |
# Check if we found Tcl's version |
1282 |
if test "$TCL_FOUND" = 0; then |
1283 |
cat << 'EOF' >&2 |
1284 |
configure: error: |
1285 |
|
1286 |
Tcl cannot be found on this system. |
1287 |
|
1288 |
Eggdrop requires Tcl to compile. If you already have Tcl installed on |
1289 |
this system, and I just wasn't looking in the right place for it, re-run |
1290 |
./configure using the --with-tcllib='/path/to/libtcl.so' and |
1291 |
--with-tclinc='/path/to/tcl.h' options. |
1292 |
|
1293 |
See doc/COMPILE-GUIDE's 'Tcl Detection and Installation' section for more |
1294 |
information. |
1295 |
|
1296 |
EOF |
1297 |
exit 1 |
1298 |
fi |
1299 |
]) |
1300 |
|
1301 |
|
1302 |
dnl EGG_TCL_CHECK_PRE70() |
1303 |
dnl |
1304 |
AC_DEFUN([EGG_TCL_CHECK_PRE70], |
1305 |
[ |
1306 |
# Is this version of Tcl too old for us to use ? |
1307 |
TCL_VER_PRE70=`echo $egg_cv_var_tcl_version | $AWK '{split([$]1, i, "."); if (i[[1]] < 7) print "yes"; else print "no"}'` |
1308 |
if test "$TCL_VER_PRE70" = yes; then |
1309 |
cat << EOF >&2 |
1310 |
configure: error: |
1311 |
|
1312 |
Your Tcl version is much too old for Eggdrop to use. You should |
1313 |
download and compile a more recent version. The most reliable |
1314 |
current version is $tclrecommendver and can be downloaded from |
1315 |
${tclrecommendsite}. |
1316 |
|
1317 |
See doc/COMPILE-GUIDE's 'Tcl Detection and Installation' section |
1318 |
for more information. |
1319 |
|
1320 |
EOF |
1321 |
exit 1 |
1322 |
fi |
1323 |
]) |
1324 |
|
1325 |
|
1326 |
dnl EGG_TCL_TESTLIBS() |
1327 |
dnl |
1328 |
AC_DEFUN([EGG_TCL_TESTLIBS], |
1329 |
[ |
1330 |
# Set variables for Tcl library tests |
1331 |
TCL_TEST_LIB="$TCLLIBFNS" |
1332 |
TCL_TEST_OTHERLIBS="-L$TCLLIB $EGG_MATH_LIB" |
1333 |
if test "x$ac_cv_lib_pthread" != x; then |
1334 |
TCL_TEST_OTHERLIBS="$TCL_TEST_OTHERLIBS $ac_cv_lib_pthread" |
1335 |
fi |
1336 |
]) |
1337 |
|
1338 |
|
1339 |
dnl EGG_TCL_CHECK_FREE() |
1340 |
dnl |
1341 |
AC_DEFUN([EGG_TCL_CHECK_FREE], |
1342 |
[ |
1343 |
if test "$egg_tcl_changed" = yes; then |
1344 |
EGG_CACHE_UNSET(egg_cv_var_tcl_free) |
1345 |
fi |
1346 |
|
1347 |
# Check for Tcl_Free() |
1348 |
AC_CHECK_LIB($TCL_TEST_LIB, Tcl_Free, [egg_cv_var_tcl_free="yes"], [egg_cv_var_tcl_free="no"], $TCL_TEST_OTHERLIBS) |
1349 |
|
1350 |
if test "$egg_cv_var_tcl_free" = yes; then |
1351 |
AC_DEFINE(HAVE_TCL_FREE, 1, [Define for Tcl that has Tcl_Free() (7.5p1 and later).]) |
1352 |
fi |
1353 |
]) |
1354 |
|
1355 |
|
1356 |
dnl EGG_TCL_CHECK_GETCURRENTTHREAD |
1357 |
dnl |
1358 |
AC_DEFUN([EGG_TCL_CHECK_GETCURRENTTHREAD], |
1359 |
[ |
1360 |
if test "$egg_tcl_changed" = yes; then |
1361 |
EGG_CACHE_UNSET(egg_cv_var_tcl_getcurrentthread) |
1362 |
fi |
1363 |
|
1364 |
# Check for Tcl_GetCurrentThread() |
1365 |
AC_CHECK_LIB($TCL_TEST_LIB, Tcl_GetCurrentThread, [egg_cv_var_tcl_getcurrentthread="yes"], [egg_cv_var_tcl_getcurrentthread="no"], $TCL_TEST_OTHERLIBS) |
1366 |
if test "$egg_cv_var_tcl_getcurrentthread" = yes; then |
1367 |
AC_DEFINE(HAVE_TCL_GETCURRENTTHREAD, 1, [Define for Tcl that has Tcl_GetCurrentThread() (8.1a2 and later).]) |
1368 |
|
1369 |
# Add pthread library to $LIBS if we need it for threaded Tcl |
1370 |
if test "x$ac_cv_lib_pthread" != x; then |
1371 |
EGG_APPEND_VAR(LIBS, $ac_cv_lib_pthread) |
1372 |
fi |
1373 |
fi |
1374 |
]) |
1375 |
|
1376 |
|
1377 |
dnl EGG_TCL_CHECK_GETTHREADDATA |
1378 |
dnl |
1379 |
AC_DEFUN([EGG_TCL_CHECK_GETTHREADDATA], |
1380 |
[ |
1381 |
if test "$egg_tcl_changed" = yes; then |
1382 |
EGG_CACHE_UNSET(egg_cv_var_tcl_getthreaddata) |
1383 |
fi |
1384 |
|
1385 |
# Check for Tcl_GetThreadData() |
1386 |
AC_CHECK_LIB($TCL_TEST_LIB, Tcl_GetThreadData, [egg_cv_var_tcl_getthreaddata="yes"], [egg_cv_var_tcl_getthreaddata="no"], $TCL_TEST_OTHERLIBS) |
1387 |
if test "$egg_cv_var_tcl_getthreaddata" = yes; then |
1388 |
AC_DEFINE(HAVE_TCL_GETTHREADDATA, 1, [Define for Tcl that has Tcl_GetThreadData() (8.1a2 and later).]) |
1389 |
fi |
1390 |
]) |
1391 |
|
1392 |
|
1393 |
dnl EGG_TCL_CHECK_SETNOTIFIER |
1394 |
dnl |
1395 |
AC_DEFUN([EGG_TCL_CHECK_SETNOTIFIER], |
1396 |
[ |
1397 |
if test "$egg_tcl_changed" = yes; then |
1398 |
EGG_CACHE_UNSET(egg_cv_var_tcl_setnotifier) |
1399 |
fi |
1400 |
|
1401 |
# Check for Tcl_SetNotifier() |
1402 |
AC_CHECK_LIB($TCL_TEST_LIB, Tcl_SetNotifier, [egg_cv_var_tcl_setnotifier="yes"], [egg_cv_var_tcl_setnotifier="no"], $TCL_TEST_OTHERLIBS) |
1403 |
if test "$egg_cv_var_tcl_setnotifier" = yes; then |
1404 |
AC_DEFINE(HAVE_TCL_SETNOTIFIER, 1, [Define for Tcl that has Tcl_SetNotifier() (8.2b1 and later).]) |
1405 |
fi |
1406 |
]) |
1407 |
|
1408 |
|
1409 |
dnl EGG_TCL_LIB_REQS() |
1410 |
dnl |
1411 |
AC_DEFUN([EGG_TCL_LIB_REQS], |
1412 |
[ |
1413 |
if test "$EGG_CYGWIN" = yes; then |
1414 |
TCL_REQS="${TCLLIB}/lib${TCLLIBFN}" |
1415 |
TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB" |
1416 |
else |
1417 |
if test "$TCLLIBEXT" != ".a"; then |
1418 |
TCL_REQS="${TCLLIB}/lib${TCLLIBFN}" |
1419 |
TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB" |
1420 |
else |
1421 |
# Set default make as static for unshared Tcl library |
1422 |
if test "$DEFAULT_MAKE" != static; then |
1423 |
cat << 'EOF' >&2 |
1424 |
configure: WARNING: |
1425 |
|
1426 |
Your Tcl library is not a shared lib. |
1427 |
configure will now set default make type to static. |
1428 |
|
1429 |
EOF |
1430 |
DEFAULT_MAKE="static" |
1431 |
AC_SUBST(DEFAULT_MAKE) |
1432 |
fi |
1433 |
|
1434 |
# Are we using a pre 7.4 Tcl version ? |
1435 |
TCL_VER_PRE74=`echo $egg_cv_var_tcl_version | $AWK '{split([$]1, i, "."); if (((i[[1]] == 7) && (i[[2]] < 4)) || (i[[1]] < 7)) print "yes"; else print "no"}'` |
1436 |
if test "$TCL_VER_PRE74" = no; then |
1437 |
|
1438 |
# Was the --with-tcllib option given ? |
1439 |
if test "x$tcllibname" != x; then |
1440 |
TCL_REQS="${TCLLIB}/lib${TCLLIBFN}" |
1441 |
TCL_LIBS="${TCLLIB}/lib${TCLLIBFN} $EGG_MATH_LIB" |
1442 |
else |
1443 |
TCL_REQS="${TCLLIB}/lib${TCLLIBFN}" |
1444 |
TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB" |
1445 |
fi |
1446 |
else |
1447 |
cat << EOF >&2 |
1448 |
configure: WARNING: |
1449 |
|
1450 |
Your Tcl version ($egg_cv_var_tcl_version) is older than 7.4. |
1451 |
There are known problems, but we will attempt to work around them. |
1452 |
|
1453 |
EOF |
1454 |
TCL_REQS="libtcle.a" |
1455 |
TCL_LIBS="-L`pwd` -ltcle $EGG_MATH_LIB" |
1456 |
fi |
1457 |
fi |
1458 |
fi |
1459 |
|
1460 |
AC_SUBST(TCL_REQS) |
1461 |
AC_SUBST(TCL_LIBS) |
1462 |
]) |
1463 |
|
1464 |
|
1465 |
dnl EGG_SUBST_EGGVERSION() |
1466 |
dnl |
1467 |
AC_DEFUN([EGG_SUBST_EGGVERSION], |
1468 |
[ |
1469 |
EGGVERSION=`grep 'char.egg_version' $srcdir/src/main.c | $AWK '{gsub(/(\"|\;)/, "", [$]4); print [$]4}'` |
1470 |
egg_version_num=`echo $EGGVERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", [$]1, [$]2, [$]3)}'` |
1471 |
AC_SUBST(EGGVERSION) |
1472 |
AC_DEFINE_UNQUOTED(EGG_VERSION, $egg_version_num, [Defines the current Eggdrop version.]) |
1473 |
]) |
1474 |
|
1475 |
|
1476 |
dnl EGG_SUBST_DEST() |
1477 |
AC_DEFUN([EGG_SUBST_DEST], |
1478 |
[ |
1479 |
if test "x$DEST" = x; then |
1480 |
DEST=\${prefix} |
1481 |
fi |
1482 |
AC_SUBST(DEST) |
1483 |
]) |
1484 |
|
1485 |
|
1486 |
dnl EGG_SUBST_MOD_UPDIR() |
1487 |
dnl |
1488 |
dnl Since module's Makefiles aren't generated by configure, some paths in |
1489 |
dnl src/mod/Makefile.in take care of them. For correct path "calculation", we |
1490 |
dnl need to keep absolute paths in mind (which don't need a "../" prepended). |
1491 |
dnl |
1492 |
AC_DEFUN([EGG_SUBST_MOD_UPDIR], [ |
1493 |
case "$srcdir" in |
1494 |
[[\\/]]* | ?:[[\\/]]*) |
1495 |
MOD_UPDIR="" |
1496 |
;; |
1497 |
*) |
1498 |
MOD_UPDIR="../" |
1499 |
;; |
1500 |
esac |
1501 |
AC_SUBST(MOD_UPDIR) |
1502 |
]) |
1503 |
|
1504 |
|
1505 |
dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS) |
1506 |
dnl |
1507 |
dnl Replace FILE-NAME if the newly created contents differs from the existing |
1508 |
dnl file contents. Otherwise, leave the file alone. This avoids needless |
1509 |
dnl recompiles. |
1510 |
dnl |
1511 |
m4_define(EGG_REPLACE_IF_CHANGED, |
1512 |
[ |
1513 |
AC_CONFIG_COMMANDS([replace-if-changed], [[ |
1514 |
egg_replace_file="$1" |
1515 |
$2 |
1516 |
if test -f "$egg_replace_file" && cmp -s conftest.out $egg_replace_file; then |
1517 |
echo "$1 is unchanged" |
1518 |
else |
1519 |
echo "creating $1" |
1520 |
mv conftest.out $egg_replace_file |
1521 |
fi |
1522 |
rm -f conftest.out |
1523 |
]], |
1524 |
[[$3]]) |
1525 |
]) |
1526 |
|
1527 |
|
1528 |
dnl EGG_TCL_LUSH() |
1529 |
dnl |
1530 |
AC_DEFUN([EGG_TCL_LUSH], |
1531 |
[ |
1532 |
EGG_REPLACE_IF_CHANGED(lush.h, [ |
1533 |
cat > conftest.out << EOF |
1534 |
|
1535 |
/* Ignore me but do not erase me. I am a kludge. */ |
1536 |
|
1537 |
#include "${egg_tclinc}/${egg_tclincfn}" |
1538 |
|
1539 |
EOF |
1540 |
], [ |
1541 |
egg_tclinc="$TCLINC" |
1542 |
egg_tclincfn="$TCLINCFN" |
1543 |
]) |
1544 |
]) |
1545 |
|
1546 |
|
1547 |
dnl EGG_DEBUG_ENABLE() |
1548 |
dnl |
1549 |
AC_DEFUN([EGG_DEBUG_ENABLE], |
1550 |
[ |
1551 |
AC_ARG_ENABLE(debug, [ --enable-debug enable generic debug code (default for 'make debug')], [enable_debug="$enableval"], [enable_debug="auto"]) |
1552 |
AC_ARG_ENABLE(debug, [ --disable-debug disable generic debug code], [enable_debug="$enableval"], [enable_debug="auto"]) |
1553 |
AC_ARG_ENABLE(debug-assert, [ --enable-debug-assert enable assert debug code (default for 'make debug')], [enable_debug_assert="$enableval"], [enable_debug_assert="auto"]) |
1554 |
AC_ARG_ENABLE(debug-assert, [ --disable-debug-assert disable assert debug code], [enable_debug_assert="$enableval"], [enable_debug_assert="auto"]) |
1555 |
AC_ARG_ENABLE(debug-mem, [ --enable-debug-mem enable memory debug code (default for 'make debug')], [enable_debug_mem="$enableval"], [enable_debug_mem="auto"]) |
1556 |
AC_ARG_ENABLE(debug-mem, [ --disable-debug-mem disable memory debug code], [enable_debug_mem="$enableval"], [enable_debug_mem="auto"]) |
1557 |
AC_ARG_ENABLE(debug-dns, [ --enable-debug-dns enable dns.mod debug messages (default for 'make debug')], [enable_debug_dns="$enableval"], [enable_debug_dns="auto"]) |
1558 |
AC_ARG_ENABLE(debug-dns, [ --disable-debug-dns disable dns.mod debug messages], [enable_debug_dns="$enableval"], [enable_debug_dns="auto"]) |
1559 |
AC_ARG_ENABLE(debug-context, [ --enable-debug-context enable context debug code (default)], [enable_debug_context="$enableval"], [enable_debug_context="auto"]) |
1560 |
AC_ARG_ENABLE(debug-context, [ --disable-debug-context disable context debug code], [enable_debug_context="$enableval"], [enable_debug_context="auto"]) |
1561 |
]) |
1562 |
|
1563 |
|
1564 |
dnl EGG_DEBUG_DEFAULTS() |
1565 |
dnl |
1566 |
AC_DEFUN([EGG_DEBUG_DEFAULTS], |
1567 |
[ |
1568 |
# Defaults: |
1569 |
|
1570 |
# make: 'eggdrop' or 'static' |
1571 |
default_std_debug="no" |
1572 |
default_std_debug_assert="no" |
1573 |
default_std_debug_mem="no" |
1574 |
default_std_debug_context="yes" |
1575 |
default_std_debug_dns="no" |
1576 |
|
1577 |
# make: 'debug' or 'sdebug' |
1578 |
default_deb_debug="yes" |
1579 |
default_deb_debug_assert="yes" |
1580 |
default_deb_debug_mem="yes" |
1581 |
default_deb_debug_context="yes" |
1582 |
default_deb_debug_dns="yes" |
1583 |
|
1584 |
if test "$DEFAULT_MAKE" = eggdrop || test "$DEFAULT_MAKE" = static; then |
1585 |
default_debug="$default_std_debug" |
1586 |
default_debug_assert="$default_std_debug_assert" |
1587 |
default_debug_mem="$default_std_debug_mem" |
1588 |
default_debug_context="$default_std_debug_context" |
1589 |
default_debug_dns="$default_std_debug_dns" |
1590 |
else |
1591 |
default_debug="$default_deb_debug" |
1592 |
default_debug_assert="$default_deb_debug_assert" |
1593 |
default_debug_mem="$default_deb_debug_mem" |
1594 |
default_debug_context="$default_deb_debug_context" |
1595 |
default_debug_dns="$default_deb_debug_dns" |
1596 |
fi |
1597 |
|
1598 |
debug_options="debug debug_assert debug_mem debug_dns" |
1599 |
|
1600 |
debug_cflags_debug="-g3 -DDEBUG" |
1601 |
debug_cflags_debug_assert="-DDEBUG_ASSERT" |
1602 |
debug_cflags_debug_mem="-DDEBUG_MEM" |
1603 |
debug_cflags_debug_dns="-DDEBUG_DNS" |
1604 |
debug_stdcflags_debug="" |
1605 |
debug_stdcflags_debug_assert="" |
1606 |
debug_stdcflags_debug_mem="" |
1607 |
debug_stdcflags_debug_dns="" |
1608 |
debug_debcflags_debug="" |
1609 |
debug_debcflags_debug_assert="" |
1610 |
debug_debcflags_debug_mem="" |
1611 |
debug_debcflags_debug_dns="" |
1612 |
]) |
1613 |
|
1614 |
|
1615 |
dnl EGG_DEBUG_OPTIONS() |
1616 |
dnl |
1617 |
AC_DEFUN([EGG_DEBUG_OPTIONS], |
1618 |
[ |
1619 |
for enable_option in $debug_options; do |
1620 |
|
1621 |
eval enable_value=\$enable_$enable_option |
1622 |
|
1623 |
# Check if either --enable-<opt> or --disable-<opt> was used |
1624 |
if test "$enable_value" != auto; then |
1625 |
# Make sure an invalid option wasn't passed as --enable-<opt>=foo |
1626 |
if test "$enable_value" != yes && test "$enable_value" != no; then |
1627 |
opt_name=`echo $enable_option | sed 's/_/-/g'` |
1628 |
eval opt_default=\$default_$enable_option |
1629 |
AC_MSG_WARN([Invalid option '$enable_value' passed to --enable-${opt_name}, defaulting to '$opt_default']) |
1630 |
eval enable_$enable_option="auto" |
1631 |
fi |
1632 |
fi |
1633 |
|
1634 |
if test "$enable_value" = auto; then |
1635 |
# Note: options generally should not end up in both std and deb but |
1636 |
# there may be options in the future where this behavior is desired. |
1637 |
if test `eval echo '${'default_std_$enable_option'}'` = yes; then |
1638 |
eval `echo debug_stdcflags_$enable_option`=\$debug_cflags_$enable_option |
1639 |
fi |
1640 |
if test `eval echo '${'default_deb_$enable_option'}'` = yes; then |
1641 |
eval `echo debug_debcflags_$enable_option`=\$debug_cflags_$enable_option |
1642 |
fi |
1643 |
else |
1644 |
if test "$enable_value" = yes; then |
1645 |
# If option defaults to 'yes' for debug, always put it in stdcflags |
1646 |
# when the option is forced on because someone may want it enabled |
1647 |
# for a non-debug build. |
1648 |
if test `eval echo '${'default_deb_$enable_option'}'` = yes; then |
1649 |
eval `echo debug_stdcflags_$enable_option`=\$debug_cflags_$enable_option |
1650 |
else |
1651 |
# option defaulted to 'no' so put it in debcflags |
1652 |
eval `echo debug_debcflags_$enable_option`=\$debug_cflags_$enable_option |
1653 |
fi |
1654 |
fi |
1655 |
fi |
1656 |
done |
1657 |
]) |
1658 |
|
1659 |
|
1660 |
dnl EGG_DEBUG_CFLAGS() |
1661 |
dnl |
1662 |
AC_DEFUN([EGG_DEBUG_CFLAGS], |
1663 |
[ |
1664 |
for cflg_option in $debug_options; do |
1665 |
eval stdcflg_value=\$debug_stdcflags_$cflg_option |
1666 |
EGG_APPEND_VAR(CFLGS, $stdcflg_value) |
1667 |
|
1668 |
eval debcflg_value=\$debug_debcflags_$cflg_option |
1669 |
EGG_APPEND_VAR(DEBCFLGS, $debcflg_value) |
1670 |
done |
1671 |
|
1672 |
# Disable debug symbol stripping if compiled with --enable-debug |
1673 |
# This will result in core dumps that are actually useful. |
1674 |
if test "x$debug_stdcflags_debug" != x; then |
1675 |
STRIP="touch" |
1676 |
MOD_STRIP="touch" |
1677 |
SHLIB_STRIP="touch" |
1678 |
fi |
1679 |
|
1680 |
AC_SUBST(CFLGS) |
1681 |
AC_SUBST(DEBCFLGS) |
1682 |
]) |
1683 |
|
1684 |
|
1685 |
dnl EGG_ENABLE_DEBUG_CONTEXT() |
1686 |
dnl |
1687 |
AC_DEFUN([EGG_ENABLE_DEBUG_CONTEXT], |
1688 |
[ |
1689 |
# Check if either --enable-debug-context or --disable-debug-context was used |
1690 |
if test "$enable_debug_context" != auto; then |
1691 |
|
1692 |
# Make sure an invalid option wasn't passed as --enable-debug-context=foo |
1693 |
if test "$enable_debug_context" != yes && test "$enable_debug_context" != no; then |
1694 |
AC_MSG_WARN([Invalid option '$enable_debug_context' passed to --enable-debug-context, defaulting to '$default_debug_context']) |
1695 |
enable_debug_context="$default_debug_context" |
1696 |
fi |
1697 |
else |
1698 |
enable_debug_context="$default_debug_context" |
1699 |
fi |
1700 |
|
1701 |
if test "$enable_debug_context" = yes; then |
1702 |
AC_DEFINE(DEBUG_CONTEXT, 1, [Define for context debugging.]) |
1703 |
else |
1704 |
cat << 'EOF' >&2 |
1705 |
configure: WARNING: |
1706 |
|
1707 |
You have disabled context debugging. |
1708 |
|
1709 |
Eggdrop will not be able to provide context information if it crashes. |
1710 |
Bug reports without context are less helpful when tracking down bugs. |
1711 |
|
1712 |
EOF |
1713 |
fi |
1714 |
]) |
1715 |
|
1716 |
|
1717 |
dnl EGG_CATCH_MAKEFILE_REBUILD() |
1718 |
dnl |
1719 |
AC_DEFUN([EGG_CATCH_MAKEFILE_REBUILD], |
1720 |
[ |
1721 |
AC_CONFIG_COMMANDS([catch-make-rebuild], [[ |
1722 |
if test -f .modules; then |
1723 |
$srcdir/misc/modconfig --top_srcdir="$srcdir/src" Makefile |
1724 |
fi |
1725 |
]]) |
1726 |
]) |
1727 |
|
1728 |
|
1729 |
dnl EGG_SAVE_PARAMETERS() |
1730 |
dnl |
1731 |
dnl Remove --cache-file and --srcdir arguments so they do not pile up. |
1732 |
dnl |
1733 |
AC_DEFUN([EGG_SAVE_PARAMETERS], |
1734 |
[ |
1735 |
egg_ac_parameters= |
1736 |
ac_prev= |
1737 |
for ac_arg in $ac_configure_args; do |
1738 |
if test -n "$ac_prev"; then |
1739 |
ac_prev= |
1740 |
continue |
1741 |
fi |
1742 |
case $ac_arg in |
1743 |
-cache-file | --cache-file | --cache-fil | --cache-fi | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) |
1744 |
ac_prev=cache_file ;; |
1745 |
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) |
1746 |
;; |
1747 |
--config-cache | -C) |
1748 |
;; |
1749 |
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr) |
1750 |
ac_prev=srcdir ;; |
1751 |
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) |
1752 |
;; |
1753 |
*) egg_ac_parameters="$egg_ac_parameters $ac_arg" ;; |
1754 |
esac |
1755 |
done |
1756 |
|
1757 |
AC_SUBST(egg_ac_parameters) |
1758 |
]) |
1759 |
|
1760 |
|
1761 |
dnl AC_PROG_CC_WIN32() |
1762 |
dnl |
1763 |
AC_DEFUN([AC_PROG_CC_WIN32], |
1764 |
[ |
1765 |
AC_MSG_CHECKING([how to access the Win32 API]) |
1766 |
WIN32FLAGS= |
1767 |
AC_COMPILE_IFELSE([[ |
1768 |
#ifndef WIN32 |
1769 |
# ifndef _WIN32 |
1770 |
# error WIN32 or _WIN32 not defined |
1771 |
# endif |
1772 |
#endif |
1773 |
]], [ |
1774 |
AC_MSG_RESULT([present by default]) |
1775 |
], [ |
1776 |
ac_compile_save="$ac_compile" |
1777 |
save_CC="$CC" |
1778 |
ac_compile="$ac_compile -mwin32" |
1779 |
CC="$CC -mwin32" |
1780 |
AC_COMPILE_IFELSE([[ |
1781 |
#ifndef WIN32 |
1782 |
# ifndef _WIN32 |
1783 |
# error WIN32 or _WIN32 not defined |
1784 |
# endif |
1785 |
#endif |
1786 |
]], [ |
1787 |
AC_MSG_RESULT([found via -mwin32]) |
1788 |
ac_compile="$ac_compile_save" |
1789 |
CC="$save_CC" |
1790 |
WIN32FLAGS="-mwin32" |
1791 |
], [ |
1792 |
ac_compile="$ac_compile_save" |
1793 |
CC="$save_CC" |
1794 |
AC_MSG_RESULT([not found]) |
1795 |
]) |
1796 |
]) |
1797 |
]) |