1 |
dnl aclocal.m4: macros autoconf uses when building configure from configure.ac |
2 |
dnl |
3 |
dnl Copyright (C) 1999 - 2006 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.5 2006-11-20 13:20:24 tothwolf Exp $ |
20 |
dnl |
21 |
|
22 |
|
23 |
dnl |
24 |
dnl Message functions. |
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 sufficiant ammount 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 experiance 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 |
95 |
dnl Compiler checks. |
96 |
dnl |
97 |
|
98 |
|
99 |
dnl EGG_CHECK_CC() |
100 |
dnl |
101 |
dnl Check for a working C compiler. |
102 |
dnl |
103 |
AC_DEFUN([EGG_CHECK_CC], |
104 |
[ |
105 |
if test "${cross_compiling-x}" = "x"; then |
106 |
cat << 'EOF' >&2 |
107 |
configure: error: |
108 |
|
109 |
This system does not appear to have a working C compiler. |
110 |
A working C compiler is required to compile Eggdrop. |
111 |
|
112 |
EOF |
113 |
exit 1 |
114 |
fi |
115 |
]) |
116 |
|
117 |
|
118 |
dnl EGG_HEADER_STDC() |
119 |
dnl |
120 |
AC_DEFUN([EGG_HEADER_STDC], |
121 |
[ |
122 |
if test "$ac_cv_header_stdc" = "no"; then |
123 |
cat << 'EOF' >&2 |
124 |
configure: error: |
125 |
|
126 |
Your system must support ANSI C Header files. |
127 |
These are required for the language support. Sorry. |
128 |
|
129 |
EOF |
130 |
exit 1 |
131 |
fi |
132 |
]) |
133 |
|
134 |
|
135 |
dnl EGG_CHECK_CCPIPE() |
136 |
dnl |
137 |
dnl This function checks whether or not the compiler supports the `-pipe' flag, |
138 |
dnl which speeds up the compilation. |
139 |
dnl |
140 |
AC_DEFUN([EGG_CHECK_CCPIPE], |
141 |
[ |
142 |
if test -n "$GCC" && test -z "$no_pipe"; then |
143 |
AC_CACHE_CHECK([whether the compiler understands -pipe], egg_cv_var_ccpipe, [ |
144 |
ac_old_CC="$CC" |
145 |
CC="$CC -pipe" |
146 |
AC_COMPILE_IFELSE([[ |
147 |
int main () |
148 |
{ |
149 |
return(0); |
150 |
} |
151 |
]], [ |
152 |
egg_cv_var_ccpipe="yes" |
153 |
], [ |
154 |
egg_cv_var_ccpipe="no" |
155 |
]) |
156 |
CC="$ac_old_CC" |
157 |
]) |
158 |
|
159 |
if test "$egg_cv_var_ccpipe" = "yes"; then |
160 |
CC="$CC -pipe" |
161 |
fi |
162 |
fi |
163 |
]) |
164 |
|
165 |
|
166 |
dnl EGG_CHECK_CCWALL() |
167 |
dnl |
168 |
dnl See if the compiler supports -Wall. |
169 |
dnl |
170 |
AC_DEFUN([EGG_CHECK_CCWALL], |
171 |
[ |
172 |
if test -n "$GCC" && test -z "$no_wall"; then |
173 |
AC_CACHE_CHECK([whether the compiler understands -Wall], egg_cv_var_ccwall, [ |
174 |
ac_old_CFLAGS="$CFLAGS" |
175 |
CFLAGS="$CFLAGS -Wall" |
176 |
AC_COMPILE_IFELSE([[ |
177 |
int main () |
178 |
{ |
179 |
return(0); |
180 |
} |
181 |
]], [ |
182 |
egg_cv_var_ccwall="yes" |
183 |
], [ |
184 |
egg_cv_var_ccwall="no" |
185 |
]) |
186 |
CFLAGS="$ac_old_CFLAGS" |
187 |
]) |
188 |
|
189 |
if test "$egg_cv_var_ccwall" = "yes"; then |
190 |
CFLAGS="$CFLAGS -Wall" |
191 |
fi |
192 |
fi |
193 |
]) |
194 |
|
195 |
|
196 |
dnl |
197 |
dnl Checks for types and functions. |
198 |
dnl |
199 |
|
200 |
|
201 |
dnl EGG_CHECK_SOCKLEN_T() |
202 |
dnl |
203 |
dnl Check for the socklen_t type. |
204 |
dnl |
205 |
AC_DEFUN([EGG_CHECK_SOCKLEN_T], |
206 |
[ |
207 |
AC_CACHE_CHECK([for socklen_t], egg_cv_socklen_t, [ |
208 |
AC_RUN_IFELSE([[ |
209 |
#include <unistd.h> |
210 |
#include <sys/param.h> |
211 |
#include <sys/types.h> |
212 |
#include <sys/socket.h> |
213 |
#include <netinet/in.h> |
214 |
#include <arpa/inet.h> |
215 |
|
216 |
int main() |
217 |
{ |
218 |
socklen_t test = 55; |
219 |
|
220 |
if (test != 55) |
221 |
exit(1); |
222 |
|
223 |
return(0); |
224 |
} |
225 |
]], [ |
226 |
egg_cv_socklen_t="yes" |
227 |
], [ |
228 |
egg_cv_socklen_t="no" |
229 |
], [ |
230 |
egg_cv_socklen_t="cross" |
231 |
]) |
232 |
]) |
233 |
|
234 |
if test "$egg_cv_socklen_t" = "yes"; then |
235 |
AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define to 1 if you have the `socklen_t' type.]) |
236 |
fi |
237 |
]) |
238 |
|
239 |
|
240 |
dnl EGG_FUNC_VPRINTF() |
241 |
dnl |
242 |
AC_DEFUN([EGG_FUNC_VPRINTF], |
243 |
[ |
244 |
AC_FUNC_VPRINTF |
245 |
if test "$ac_cv_func_vprintf" = "no"; then |
246 |
cat << 'EOF' >&2 |
247 |
configure: error: |
248 |
|
249 |
Your system does not have the vprintf/vsprintf/sprintf libraries. |
250 |
These are required to compile almost anything. Sorry. |
251 |
|
252 |
EOF |
253 |
exit 1 |
254 |
fi |
255 |
]) |
256 |
|
257 |
|
258 |
dnl |
259 |
dnl Checks for programs. |
260 |
dnl |
261 |
|
262 |
|
263 |
dnl EGG_PROG_HEAD_1() |
264 |
dnl |
265 |
dnl This function checks for the proper 'head -1' command variant to use. |
266 |
dnl |
267 |
AC_DEFUN([EGG_PROG_HEAD_1], |
268 |
[ |
269 |
cat << 'EOF' > conftest.head |
270 |
a |
271 |
b |
272 |
c |
273 |
EOF |
274 |
|
275 |
for ac_prog in 'head -n 1' 'head -1' 'sed 1q'; do |
276 |
AC_MSG_CHECKING([whether $ac_prog works]) |
277 |
AC_CACHE_VAL([ac_cv_prog_HEAD_1], [ |
278 |
if test -n "$HEAD_1"; then |
279 |
# Let the user override the test. |
280 |
ac_cv_prog_HEAD_1="$HEAD_1" |
281 |
else |
282 |
if test "`cat conftest.head | $ac_prog`" = "a"; then |
283 |
AC_MSG_RESULT([yes]) |
284 |
ac_cv_prog_HEAD_1="$ac_prog" |
285 |
else |
286 |
AC_MSG_RESULT([no]) |
287 |
fi |
288 |
fi |
289 |
]) |
290 |
test -n "$ac_cv_prog_HEAD_1" && break |
291 |
done |
292 |
|
293 |
if test "${ac_cv_prog_HEAD_1-x}" = "x"; then |
294 |
cat << 'EOF' >&2 |
295 |
configure: error: |
296 |
|
297 |
This system seems to lack a working 'head -1' or 'head -n 1' command. |
298 |
A working 'head -1' (or equivalent) command is required to compile Eggdrop. |
299 |
|
300 |
EOF |
301 |
exit 1 |
302 |
fi |
303 |
|
304 |
rm -f conftest.head |
305 |
HEAD_1="$ac_cv_prog_HEAD_1" |
306 |
AC_SUBST(HEAD_1) |
307 |
]) |
308 |
|
309 |
|
310 |
dnl EGG_PROG_STRIP() |
311 |
dnl |
312 |
AC_DEFUN([EGG_PROG_STRIP], |
313 |
[ |
314 |
AC_ARG_ENABLE([strip], |
315 |
[ --enable-strip enable stripping of executables ], |
316 |
[enable_strip="$enableval"], |
317 |
[enable_strip="no"]) |
318 |
if test "$enable_strip" = "yes"; then |
319 |
AC_CHECK_PROG(STRIP, strip, strip) |
320 |
if test "${STRIP-x}" = "x"; then |
321 |
STRIP=touch |
322 |
else |
323 |
AC_DEFINE(ENABLE_STRIP, 1, [Define if stripping is enabled.]) |
324 |
cat << 'EOF' >&2 |
325 |
configure: warning: |
326 |
|
327 |
Stripping the executable, while saving some disk space, will make bug |
328 |
reports nearly worthless. If Eggdrop crashes and you wish to report |
329 |
a bug, you will need to recompile with stripping disabled. |
330 |
|
331 |
EOF |
332 |
fi |
333 |
else |
334 |
STRIP=touch |
335 |
fi |
336 |
]) |
337 |
|
338 |
|
339 |
dnl EGG_PROG_AWK() |
340 |
dnl |
341 |
AC_DEFUN([EGG_PROG_AWK], |
342 |
[ |
343 |
AC_PROG_AWK |
344 |
if test "${AWK-x}" = "x"; then |
345 |
cat << 'EOF' >&2 |
346 |
configure: error: |
347 |
|
348 |
This system seems to lack a working 'awk' command. |
349 |
A working 'awk' command is required to compile Eggdrop. |
350 |
|
351 |
EOF |
352 |
exit 1 |
353 |
fi |
354 |
]) |
355 |
|
356 |
|
357 |
dnl EGG_PROG_BASENAME() |
358 |
dnl |
359 |
AC_DEFUN([EGG_PROG_BASENAME], |
360 |
[ |
361 |
AC_CHECK_PROG(BASENAME, basename, basename) |
362 |
if test "${BASENAME-x}" = "x"; then |
363 |
cat << 'EOF' >&2 |
364 |
configure: error: |
365 |
|
366 |
This system seems to lack a working 'basename' command. |
367 |
A working 'basename' command is required to compile Eggdrop. |
368 |
|
369 |
EOF |
370 |
exit 1 |
371 |
fi |
372 |
]) |
373 |
|
374 |
|
375 |
dnl |
376 |
dnl Checks for operating system and module support. |
377 |
dnl |
378 |
|
379 |
|
380 |
dnl EGG_OS_VERSION() |
381 |
dnl |
382 |
AC_DEFUN([EGG_OS_VERSION], |
383 |
[ |
384 |
AC_CACHE_CHECK([system type], egg_cv_var_system_type, [egg_cv_var_system_type=`$UNAME -s`]) |
385 |
AC_CACHE_CHECK([system release], egg_cv_var_system_release, [egg_cv_var_system_release=`$UNAME -r`]) |
386 |
]) |
387 |
|
388 |
|
389 |
dnl EGG_CYGWIN_BINMODE |
390 |
dnl |
391 |
dnl Check for binmode.o on Cygwin. |
392 |
dnl |
393 |
AC_DEFUN([EGG_CYGWIN_BINMODE], |
394 |
[ |
395 |
if test $EGG_CYGWIN = "yes"; then |
396 |
AC_MSG_CHECKING([for /usr/lib/binmode.o]) |
397 |
if test -r /usr/lib/binmode.o; then |
398 |
AC_MSG_RESULT([yes]) |
399 |
LIBS="$LIBS /usr/lib/binmode.o" |
400 |
else |
401 |
AC_MSG_RESULT([no]) |
402 |
AC_MSG_WARN([Make sure the directory Eggdrop is installed into is mounted in binary mode.]) |
403 |
fi |
404 |
fi |
405 |
]) |
406 |
|
407 |
|
408 |
dnl EGG_DARWIN_BUNDLE |
409 |
dnl |
410 |
dnl Locate bundle1.o on Darwin. Test systems seem to have it in /usr/lib, |
411 |
dnl however the official docs say /lib. |
412 |
dnl |
413 |
AC_DEFUN([EGG_DARWIN_BUNDLE], |
414 |
[ |
415 |
BUNDLE="" |
416 |
for bundlepath in "/lib" "/usr/lib" "/usr/local/lib"; do |
417 |
AC_MSG_CHECKING([for bundle1.o in ${bundlepath}]) |
418 |
if test -r "${bundlepath}/bundle1.o"; then |
419 |
AC_MSG_RESULT([yes]) |
420 |
BUNDLE="${bundlepath}/bundle1.o" |
421 |
break |
422 |
else |
423 |
AC_MSG_RESULT([no]) |
424 |
fi |
425 |
done |
426 |
|
427 |
if test "x${BUNDLE}" = "x"; then |
428 |
cat << 'EOF' >&2 |
429 |
configure: warning: |
430 |
|
431 |
bundle1.o cannot be located. A module build might not compile correctly. |
432 |
|
433 |
EOF |
434 |
fi |
435 |
]) |
436 |
|
437 |
|
438 |
dnl EGG_CHECK_MODULE_SUPPORT() |
439 |
dnl |
440 |
dnl Checks for module support. This should be run after EGG_OS_VERSION. |
441 |
dnl |
442 |
AC_DEFUN([EGG_CHECK_MODULE_SUPPORT], |
443 |
[ |
444 |
MODULES_OK="yes" |
445 |
MOD_EXT="so" |
446 |
DEFAULT_MAKE="debug" |
447 |
LOAD_METHOD="dl" |
448 |
WEIRD_OS="yes" |
449 |
UNKNOWN_OS="no" |
450 |
MODULE_XLIBS="" |
451 |
|
452 |
AC_MSG_CHECKING([module loading capabilities]) |
453 |
AC_MSG_RESULT |
454 |
AC_CHECK_HEADERS([dl.h dlfcn.h loader.h rld.h mach-o/dyld.h mach-o/rld.h]) |
455 |
AC_CHECK_FUNCS([dlopen load NSLinkModule shl_load rld_load]) |
456 |
|
457 |
case "$egg_cv_var_system_type" in |
458 |
BSD/OS) |
459 |
if test "`echo $egg_cv_var_system_release | cut -d . -f 1`" = "2"; then |
460 |
MODULES_OK="no" |
461 |
fi |
462 |
;; |
463 |
CYGWI*) |
464 |
WEIRD_OS="no" |
465 |
MOD_EXT="dll" |
466 |
;; |
467 |
HP-UX) |
468 |
LOAD_METHOD="shl" |
469 |
;; |
470 |
dell) |
471 |
# Fallthrough. |
472 |
;; |
473 |
IRIX) |
474 |
# Fallthrough. |
475 |
;; |
476 |
Ultrix) |
477 |
# No dlopen() or similar on Ultrix. We can't use modules. |
478 |
MODULES_OK="no" |
479 |
;; |
480 |
BeOS) |
481 |
# We don't yet support BeOS's dynamic linking interface. |
482 |
MODULES_OK="no" |
483 |
;; |
484 |
Linux) |
485 |
WEIRD_OS="no" |
486 |
;; |
487 |
Lynx) |
488 |
# Fallthrough. |
489 |
;; |
490 |
QNX) |
491 |
# Fallthrough. |
492 |
# QNX (recent versions at least) support dlopen(). |
493 |
;; |
494 |
OSF1) |
495 |
case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in |
496 |
1.*) LOAD_METHOD="loader" ;; |
497 |
esac |
498 |
;; |
499 |
SunOS) |
500 |
if test "`echo $egg_cv_var_system_release | cut -d . -f 1`" = "5"; then |
501 |
# We've had quite a bit of testing on Solaris. |
502 |
WEIRD_OS="no" |
503 |
else |
504 |
# SunOS 4 |
505 |
AC_DEFINE(DLOPEN_1, 1, [Define if running on SunOS 4.0.]) |
506 |
fi |
507 |
;; |
508 |
*BSD) |
509 |
# FreeBSD/OpenBSD/NetBSD all support dlopen() and have had plenty of |
510 |
# testing with Eggdrop. |
511 |
WEIRD_OS="no" |
512 |
;; |
513 |
Darwin) |
514 |
# We should support Mac OS X (at least 10.1 and later) now. |
515 |
# Use rld on < 10.1. |
516 |
if test "$ac_cv_func_NSLinkModule" = "no"; then |
517 |
LOAD_METHOD="rld" |
518 |
fi |
519 |
LOAD_METHOD="dyld" |
520 |
EGG_DARWIN_BUNDLE |
521 |
MODULE_XLIBS="${BUNDLE} ${MODULE_XLIBS}" |
522 |
;; |
523 |
*) |
524 |
if test -r /mach; then |
525 |
# At this point, we're guessing this is NeXT Step. We support rld, so |
526 |
# modules will probably work on NeXT now, but we have absolutly no way |
527 |
# to test this. I've never even seen a NeXT box, let alone do I know of |
528 |
# one I can test this on. |
529 |
LOAD_METHOD="rld" |
530 |
else |
531 |
# QNX apparently supports dlopen()... Fallthrough. |
532 |
if test -r /cmds; then |
533 |
UNKNOWN_OS="yes" |
534 |
MODULES_OK="no" |
535 |
fi |
536 |
fi |
537 |
;; |
538 |
esac |
539 |
|
540 |
if test "$MODULES_OK" = "yes"; then |
541 |
AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.]) |
542 |
case $LOAD_METHOD in |
543 |
dl) |
544 |
AC_DEFINE(MOD_USE_DL, 1, [Define if modules should be loaded using the dl*() functions.]) |
545 |
;; |
546 |
shl) |
547 |
AC_DEFINE(MOD_USE_SHL, 1, [Define if modules should be loaded using the shl_*() functions.]) |
548 |
;; |
549 |
dyld) |
550 |
AC_DEFINE(MOD_USE_DYLD, 1, [Define if modules should be loaded using the NS*() functions.]) |
551 |
;; |
552 |
loader) |
553 |
AC_DEFINE(MOD_USE_LOADER, 1, [Define if modules should be loaded using the ldr*() and *load() functions.]) |
554 |
;; |
555 |
rld) |
556 |
AC_DEFINE(MOD_USE_RLD, 1, [Define if modules should be loaded using the rld_*() functions.]) |
557 |
;; |
558 |
esac |
559 |
else |
560 |
DEFAULT_MAKE="static" |
561 |
fi |
562 |
|
563 |
if test "$WEIRD_OS" = "yes"; then |
564 |
# Default to "make static" for 'weird' operating systems. Will print a |
565 |
# note at the end of configure explaining. This way, Eggdrop should compile |
566 |
# "out of the box" on most every operating system we know of, and they can |
567 |
# do a "make eggdrop" if they want to use(/try to use) module support. - Wcc |
568 |
DEFAULT_MAKE="static" |
569 |
fi |
570 |
|
571 |
AC_SUBST(DEFAULT_MAKE) |
572 |
AC_SUBST(MOD_EXT) |
573 |
AC_SUBST(MODULE_XLIBS) |
574 |
AC_DEFINE_UNQUOTED(EGG_MOD_EXT, "$MOD_EXT", [Defines the extension of Eggdrop modules.]) |
575 |
]) |
576 |
|
577 |
|
578 |
dnl EGG_CHECK_OS() |
579 |
dnl |
580 |
dnl Various operating system tests. |
581 |
dnl |
582 |
AC_DEFUN([EGG_CHECK_OS], |
583 |
[ |
584 |
MOD_CC="$CC" |
585 |
MOD_LD="$CC" |
586 |
MOD_STRIP="$STRIP" |
587 |
SHLIB_CC="$CC" |
588 |
SHLIB_LD="$CC" |
589 |
SHLIB_STRIP="$STRIP" |
590 |
LINUX="no" |
591 |
IRIX="no" |
592 |
SUNOS="no" |
593 |
HPUX="no" |
594 |
EGG_CYGWIN="no" |
595 |
RANDMAX="RAND_MAX" |
596 |
|
597 |
case "$egg_cv_var_system_type" in |
598 |
BSD/OS) |
599 |
case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in |
600 |
2) |
601 |
# Fallthrough. |
602 |
;; |
603 |
3) |
604 |
MOD_CC="shlicc" |
605 |
MOD_LD="shlicc" |
606 |
if test ! "$STRIP" = "touch"; then |
607 |
MOD_STRIP="$STRIP -d" |
608 |
fi |
609 |
SHLIB_LD="shlicc -r" |
610 |
SHLIB_STRIP="touch" |
611 |
;; |
612 |
*) |
613 |
if test ! "$STRIP" = "touch"; then |
614 |
MOD_STRIP="$STRIP -d" |
615 |
fi |
616 |
SHLIB_CC="$CC -export-dynamic -fPIC" |
617 |
SHLIB_LD="$CC -shared -nostartfiles" |
618 |
;; |
619 |
esac |
620 |
;; |
621 |
CYGWI*) |
622 |
AC_PROG_CC_WIN32 |
623 |
SHLIB_LD="$CC -shared" |
624 |
CC="$CC $WIN32FLAGS" |
625 |
MOD_CC="$CC" |
626 |
MOD_LD="$CC" |
627 |
EGG_CYGWIN="yes" |
628 |
EGG_CYGWIN_BINMODE |
629 |
AC_DEFINE(CYGWIN_HACKS, 1, [Define if running under Cygwin.]) |
630 |
;; |
631 |
HP-UX) |
632 |
HPUX="yes" |
633 |
if test "$CC" = "cc"; then |
634 |
# HP-UX ANSI C Compiler. |
635 |
MOD_LD="$CC +z" |
636 |
SHLIB_CC="$CC +z" |
637 |
else |
638 |
# GCC |
639 |
MOD_LD="$CC -fPIC -shared" |
640 |
SHLIB_CC="$CC -fPIC" |
641 |
fi |
642 |
SHLIB_LD="ld -b" |
643 |
;; |
644 |
dell) |
645 |
SHLIB_STRIP="touch" |
646 |
MOD_LD="$CC -lelf -lucb" |
647 |
;; |
648 |
IRIX) |
649 |
SHLIB_LD="ld -n32 -shared -rdata_shared" |
650 |
IRIX="yes" |
651 |
SHLIB_STRIP="touch" |
652 |
;; |
653 |
Ultrix) |
654 |
SHLIB_STRIP="touch" |
655 |
DEFAULT_MAKE="static" |
656 |
SHELL="/bin/sh5" |
657 |
;; |
658 |
SINIX*) |
659 |
SHLIB_STRIP="touch" |
660 |
SHLIB_CC="cc -G" |
661 |
;; |
662 |
BeOS) |
663 |
# Fallthrough. |
664 |
;; |
665 |
Linux) |
666 |
LINUX="yes" |
667 |
MOD_LD="$CC" |
668 |
SHLIB_CC="$CC -fPIC" |
669 |
SHLIB_LD="$CC -shared -nostartfiles" |
670 |
;; |
671 |
Lynx) |
672 |
# Fallthrough. |
673 |
;; |
674 |
QNX) |
675 |
SHLIB_LD="ld -shared" |
676 |
;; |
677 |
OSF1) |
678 |
case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in |
679 |
V*) |
680 |
# Digital OSF uses an ancient version of gawk |
681 |
if test "$AWK" = "gawk"; then |
682 |
AWK="awk" |
683 |
fi |
684 |
SHLIB_LD="ld -shared -expect_unresolved \"'*'\"" |
685 |
SHLIB_STRIP="touch" |
686 |
;; |
687 |
1.0|1.1|1.2) |
688 |
SHLIB_LD="ld -R -export $@:" |
689 |
;; |
690 |
1.*) |
691 |
SHLIB_CC="$CC -fpic" |
692 |
SHLIB_LD="ld -shared" |
693 |
;; |
694 |
esac |
695 |
AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions regardless of HAVE_SNPRINTF.]) |
696 |
AC_DEFINE(STOP_UAC, 1, [Define if running on OSF/1 platform.]) |
697 |
;; |
698 |
SunOS) |
699 |
if test "`echo $egg_cv_var_system_release | cut -d . -f 1`" = "5"; then |
700 |
# Solaris |
701 |
if test -n "$GCC"; then |
702 |
SHLIB_CC="$CC -fPIC" |
703 |
SHLIB_LD="$CC -shared" |
704 |
else |
705 |
SHLIB_CC="$CC -KPIC" |
706 |
SHLIB_LD="$CC -G -z text" |
707 |
fi |
708 |
else |
709 |
# SunOS 4 |
710 |
SUNOS="yes" |
711 |
SHLIB_LD="ld" |
712 |
SHLIB_CC="$CC -PIC" |
713 |
fi |
714 |
# Solaris defines (231)-1 as the limit for random() rather than RAND_MAX. |
715 |
RANDMAX="0x7FFFFFFF" |
716 |
;; |
717 |
*BSD) |
718 |
# FreeBSD/OpenBSD/NetBSD |
719 |
SHLIB_CC="$CC -fPIC" |
720 |
SHLIB_LD="ld -Bshareable -x" |
721 |
;; |
722 |
Darwin) |
723 |
# Mac OS X |
724 |
SHLIB_CC="$CC -fPIC" |
725 |
SHLIB_LD="ld -bundle -undefined error" |
726 |
AC_DEFINE(BIND_8_COMPAT, 1, [Define if running on Mac OS X with dns.mod.]) |
727 |
;; |
728 |
*) |
729 |
if test -r /mach; then |
730 |
# At this point, we're guessing this is NeXT Step. |
731 |
AC_DEFINE(NEXT_HACKS, 1, [Define if running on NeXT Step.]) |
732 |
else |
733 |
if test -r /cmds; then |
734 |
# Probably QNX. |
735 |
SHLIB_LD="ld -shared" |
736 |
SHLIB_STRIP="touch" |
737 |
fi |
738 |
fi |
739 |
;; |
740 |
esac |
741 |
|
742 |
AC_SUBST(MOD_LD) |
743 |
AC_SUBST(MOD_CC) |
744 |
AC_SUBST(MOD_STRIP) |
745 |
AC_SUBST(SHLIB_LD) |
746 |
AC_SUBST(SHLIB_CC) |
747 |
AC_SUBST(SHLIB_STRIP) |
748 |
AC_DEFINE_UNQUOTED(RANDOM_MAX, $RANDMAX, [Define limit of random() function.]) |
749 |
]) |
750 |
|
751 |
|
752 |
dnl |
753 |
dnl Library tests. |
754 |
dnl |
755 |
|
756 |
|
757 |
dnl EGG_CHECK_LIBS() |
758 |
dnl |
759 |
AC_DEFUN([EGG_CHECK_LIBS], |
760 |
[ |
761 |
# FIXME: this needs to be fixed so that it works on IRIX |
762 |
if test "$IRIX" = "yes"; then |
763 |
AC_MSG_WARN([Skipping library tests because they CONFUSE IRIX.]) |
764 |
else |
765 |
AC_CHECK_LIB(socket, socket) |
766 |
AC_CHECK_LIB(nsl, connect) |
767 |
AC_CHECK_LIB(dns, gethostbyname) |
768 |
AC_CHECK_LIB(dl, dlopen) |
769 |
AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm") |
770 |
|
771 |
# This is needed for Tcl libraries compiled with thread support |
772 |
AC_CHECK_LIB(pthread, pthread_mutex_init, [ |
773 |
ac_cv_lib_pthread_pthread_mutex_init="yes" |
774 |
ac_cv_lib_pthread="-lpthread" |
775 |
], [ |
776 |
AC_CHECK_LIB(pthread, __pthread_mutex_init, [ |
777 |
ac_cv_lib_pthread_pthread_mutex_init="yes" |
778 |
ac_cv_lib_pthread="-lpthread" |
779 |
], [ |
780 |
AC_CHECK_LIB(pthreads, pthread_mutex_init, [ |
781 |
ac_cv_lib_pthread_pthread_mutex_init="yes" |
782 |
ac_cv_lib_pthread="-lpthreads" |
783 |
], [ |
784 |
AC_CHECK_FUNC(pthread_mutex_init, [ |
785 |
ac_cv_lib_pthread_pthread_mutex_init="yes" |
786 |
ac_cv_lib_pthread="" |
787 |
], [ |
788 |
ac_cv_lib_pthread_pthread_mutex_init="no" |
789 |
] |
790 |
)] |
791 |
)] |
792 |
)]) |
793 |
|
794 |
if test "$SUNOS" = "yes"; then |
795 |
# For suns without yp |
796 |
AC_CHECK_LIB(dl, main) |
797 |
else |
798 |
if test "$HPUX" = "yes"; then |
799 |
AC_CHECK_LIB(dld, shl_load) |
800 |
fi |
801 |
fi |
802 |
fi |
803 |
]) |
804 |
|
805 |
|
806 |
dnl EGG_CHECK_LIBSAFE_SSCANF() |
807 |
dnl |
808 |
AC_DEFUN([EGG_CHECK_LIBSAFE_SSCANF], |
809 |
[ |
810 |
AC_CACHE_CHECK([for broken libsafe sscanf], egg_cv_var_libsafe_sscanf, [ |
811 |
AC_RUN_IFELSE([[ |
812 |
#include <stdio.h> |
813 |
|
814 |
int main() |
815 |
{ |
816 |
char *src = "0x001,guppyism\n", dst[10]; |
817 |
int idx; |
818 |
|
819 |
if (sscanf(src, "0x%x,%10c", &idx, dst) == 1) |
820 |
exit(1); |
821 |
|
822 |
return(0); |
823 |
} |
824 |
]], [ |
825 |
egg_cv_var_libsafe_sscanf="no" |
826 |
], [ |
827 |
egg_cv_var_libsafe_sscanf="yes" |
828 |
], [ |
829 |
egg_cv_var_libsafe_sscanf="cross" |
830 |
]) |
831 |
]) |
832 |
|
833 |
if test "$egg_cv_var_libsafe_sscanf" = "yes"; then |
834 |
AC_DEFINE(LIBSAFE_HACKS, 1, [Define if you have a version of libsafe with a broken sscanf().]) |
835 |
fi |
836 |
]) |
837 |
|
838 |
|
839 |
dnl |
840 |
dnl Misc checks. |
841 |
dnl |
842 |
|
843 |
|
844 |
dnl EGG_EXEEXT() |
845 |
dnl |
846 |
dnl Test for executable suffix and define Eggdrop's executable name accordingly. |
847 |
dnl |
848 |
AC_DEFUN([EGG_EXEEXT], [ |
849 |
EGGEXEC="eggdrop" |
850 |
AC_EXEEXT |
851 |
if test ! "${EXEEXT-x}" = "x"; then |
852 |
EGGEXEC="eggdrop${EXEEXT}" |
853 |
fi |
854 |
AC_SUBST(EGGEXEC) |
855 |
]) |
856 |
|
857 |
|
858 |
dnl |
859 |
dnl Tcl checks. |
860 |
dnl |
861 |
|
862 |
|
863 |
dnl EGG_TCL_ARG_WITH() |
864 |
dnl |
865 |
AC_DEFUN([EGG_TCL_ARG_WITH], |
866 |
[ |
867 |
AC_ARG_WITH(tcllib, [ --with-tcllib=PATH full path to Tcl library], [tcllibname="$withval"]) |
868 |
AC_ARG_WITH(tclinc, [ --with-tclinc=PATH full path to Tcl header], [tclincname="$withval"]) |
869 |
|
870 |
WARN=0 |
871 |
# Make sure either both or neither $tcllibname and $tclincname are set |
872 |
if test ! "${tcllibname-x}" = "x"; then |
873 |
if test "${tclincname-x}" = "x"; then |
874 |
WARN=1 |
875 |
tcllibname="" |
876 |
TCLLIB="" |
877 |
TCLINC="" |
878 |
fi |
879 |
else |
880 |
if test ! "${tclincname-x}" = "x"; then |
881 |
WARN=1 |
882 |
tclincname="" |
883 |
TCLLIB="" |
884 |
TCLINC="" |
885 |
fi |
886 |
fi |
887 |
|
888 |
if test "$WARN" = 1; then |
889 |
cat << 'EOF' >&2 |
890 |
configure: warning: |
891 |
|
892 |
You must specify both --with-tcllib and --with-tclinc for either to work. |
893 |
|
894 |
configure will now attempt to autodetect both the Tcl library and header. |
895 |
|
896 |
EOF |
897 |
fi |
898 |
]) |
899 |
|
900 |
|
901 |
dnl EGG_TCL_ENV() |
902 |
dnl |
903 |
AC_DEFUN([EGG_TCL_ENV], |
904 |
[ |
905 |
WARN=0 |
906 |
# Make sure either both or neither $TCLLIB and $TCLINC are set |
907 |
if test ! "${TCLLIB-x}" = "x"; then |
908 |
if test "${TCLINC-x}" = "x"; then |
909 |
WARN=1 |
910 |
WVAR1=TCLLIB |
911 |
WVAR2=TCLINC |
912 |
TCLLIB="" |
913 |
fi |
914 |
else |
915 |
if test ! "${TCLINC-x}" = "x"; then |
916 |
WARN=1 |
917 |
WVAR1=TCLINC |
918 |
WVAR2=TCLLIB |
919 |
TCLINC="" |
920 |
fi |
921 |
fi |
922 |
|
923 |
if test "$WARN" = 1; then |
924 |
cat << EOF >&2 |
925 |
configure: warning: |
926 |
|
927 |
Environment variable $WVAR1 was set, but I did not detect ${WVAR2}. |
928 |
Please set both TCLLIB and TCLINC correctly if you wish to use them. |
929 |
|
930 |
configure will now attempt to autodetect both the Tcl library and header. |
931 |
|
932 |
EOF |
933 |
fi |
934 |
]) |
935 |
|
936 |
|
937 |
dnl EGG_TCL_WITH_TCLLIB() |
938 |
dnl |
939 |
AC_DEFUN([EGG_TCL_WITH_TCLLIB], |
940 |
[ |
941 |
# Look for Tcl library: if $tcllibname is set, check there first |
942 |
if test ! "${tcllibname-x}" = "x"; then |
943 |
if test -f "$tcllibname" && test -r "$tcllibname"; then |
944 |
TCLLIB=`echo $tcllibname | sed 's%/[[^/]][[^/]]*$%%'` |
945 |
TCLLIBFN=`$BASENAME $tcllibname | cut -c4-` |
946 |
TCLLIBEXT=".`echo $TCLLIBFN | $AWK '{j=split([$]1, i, "."); print i[[j]]}'`" |
947 |
TCLLIBFNS=`$BASENAME $tcllibname $TCLLIBEXT | cut -c4-` |
948 |
else |
949 |
cat << EOF >&2 |
950 |
configure: warning: |
951 |
|
952 |
The file '$tcllibname' given to option --with-tcllib is not valid. |
953 |
|
954 |
configure will now attempt to autodetect both the Tcl library and header. |
955 |
|
956 |
EOF |
957 |
tcllibname="" |
958 |
tclincname="" |
959 |
TCLLIB="" |
960 |
TCLLIBFN="" |
961 |
TCLINC="" |
962 |
TCLINCFN="" |
963 |
fi |
964 |
fi |
965 |
]) |
966 |
|
967 |
|
968 |
dnl EGG_TCL_WITH_TCLINC() |
969 |
dnl |
970 |
AC_DEFUN([EGG_TCL_WITH_TCLINC], |
971 |
[ |
972 |
# Look for Tcl header: if $tclincname is set, check there first |
973 |
if test ! "${tclincname-x}" = "x"; then |
974 |
if test -f "$tclincname" && test -r "$tclincname"; then |
975 |
TCLINC=`echo $tclincname | sed 's%/[[^/]][[^/]]*$%%'` |
976 |
TCLINCFN=`$BASENAME $tclincname` |
977 |
else |
978 |
cat << EOF >&2 |
979 |
configure: warning: |
980 |
|
981 |
The file '$tclincname' given to option --with-tclinc is not valid. |
982 |
|
983 |
configure will now attempt to autodetect both the Tcl library and header. |
984 |
|
985 |
EOF |
986 |
tcllibname="" |
987 |
tclincname="" |
988 |
TCLLIB="" |
989 |
TCLLIBFN="" |
990 |
TCLINC="" |
991 |
TCLINCFN="" |
992 |
fi |
993 |
fi |
994 |
]) |
995 |
|
996 |
|
997 |
dnl EGG_TCL_FIND_LIBRARY() |
998 |
dnl |
999 |
AC_DEFUN([EGG_TCL_FIND_LIBRARY], |
1000 |
[ |
1001 |
# Look for Tcl library: if $TCLLIB is set, check there first |
1002 |
if test "${TCLLIBFN-x}" = "x" && test ! "${TCLLIB-x}" = "x"; then |
1003 |
if test -d "$TCLLIB"; then |
1004 |
for tcllibfns in $tcllibnames; do |
1005 |
for tcllibext in $tcllibextensions; do |
1006 |
if test -r "${TCLLIB}/lib${tcllibfns}${tcllibext}"; then |
1007 |
TCLLIBFN="${tcllibfns}${tcllibext}" |
1008 |
TCLLIBEXT="$tcllibext" |
1009 |
TCLLIBFNS="$tcllibfns" |
1010 |
break 2 |
1011 |
fi |
1012 |
done |
1013 |
done |
1014 |
fi |
1015 |
|
1016 |
if test "${TCLLIBFN-x}" = "x"; then |
1017 |
cat << 'EOF' >&2 |
1018 |
configure: warning: |
1019 |
|
1020 |
Environment variable TCLLIB was set, but incorrectly. |
1021 |
Please set both TCLLIB and TCLINC correctly if you wish to use them. |
1022 |
|
1023 |
configure will now attempt to autodetect both the Tcl library and header. |
1024 |
|
1025 |
EOF |
1026 |
TCLLIB="" |
1027 |
TCLLIBFN="" |
1028 |
TCLINC="" |
1029 |
TCLINCFN="" |
1030 |
fi |
1031 |
fi |
1032 |
]) |
1033 |
|
1034 |
|
1035 |
dnl EGG_TCL_FIND_HEADER() |
1036 |
dnl |
1037 |
AC_DEFUN([EGG_TCL_FIND_HEADER], |
1038 |
[ |
1039 |
# Look for Tcl header: if $TCLINC is set, check there first |
1040 |
if test "${TCLINCFN-x}" = "x" && test ! "${TCLINC-x}" = "x"; then |
1041 |
if test -d "$TCLINC"; then |
1042 |
for tclheaderfn in $tclheadernames; do |
1043 |
if test -r "${TCLINC}/${tclheaderfn}"; then |
1044 |
TCLINCFN="$tclheaderfn" |
1045 |
break |
1046 |
fi |
1047 |
done |
1048 |
fi |
1049 |
|
1050 |
if test "${TCLINCFN-x}" = "x"; then |
1051 |
cat << 'EOF' >&2 |
1052 |
configure: warning: |
1053 |
|
1054 |
Environment variable TCLINC was set, but incorrectly. |
1055 |
Please set both TCLLIB and TCLINC correctly if you wish to use them. |
1056 |
|
1057 |
configure will now attempt to autodetect both the Tcl library and header. |
1058 |
|
1059 |
EOF |
1060 |
TCLLIB="" |
1061 |
TCLLIBFN="" |
1062 |
TCLINC="" |
1063 |
TCLINCFN="" |
1064 |
fi |
1065 |
fi |
1066 |
]) |
1067 |
|
1068 |
|
1069 |
dnl EGG_TCL_CHECK_LIBRARY() |
1070 |
dnl |
1071 |
AC_DEFUN([EGG_TCL_CHECK_LIBRARY], |
1072 |
[ |
1073 |
AC_MSG_CHECKING([for Tcl library]) |
1074 |
|
1075 |
# Attempt autodetect for $TCLLIBFN if it's not set |
1076 |
if test ! "${TCLLIBFN-x}" = "x"; then |
1077 |
AC_MSG_RESULT([using ${TCLLIB}/lib${TCLLIBFN}]) |
1078 |
else |
1079 |
for tcllibfns in $tcllibnames; do |
1080 |
for tcllibext in $tcllibextensions; do |
1081 |
for tcllibpath in $tcllibpaths; do |
1082 |
if test -r "${tcllibpath}/lib${tcllibfns}${tcllibext}"; then |
1083 |
AC_MSG_RESULT([found ${tcllibpath}/lib${tcllibfns}${tcllibext}]) |
1084 |
TCLLIB="$tcllibpath" |
1085 |
TCLLIBFN="${tcllibfns}${tcllibext}" |
1086 |
TCLLIBEXT="$tcllibext" |
1087 |
TCLLIBFNS="$tcllibfns" |
1088 |
break 3 |
1089 |
fi |
1090 |
done |
1091 |
done |
1092 |
done |
1093 |
fi |
1094 |
|
1095 |
# Show if $TCLLIBFN wasn't found |
1096 |
if test "${TCLLIBFN-x}" = "x"; then |
1097 |
AC_MSG_RESULT([not found]) |
1098 |
fi |
1099 |
|
1100 |
AC_SUBST(TCLLIB) |
1101 |
AC_SUBST(TCLLIBFN) |
1102 |
]) |
1103 |
|
1104 |
|
1105 |
dnl EGG_TCL_CHECK_HEADER() |
1106 |
dnl |
1107 |
AC_DEFUN([EGG_TCL_CHECK_HEADER], |
1108 |
[ |
1109 |
AC_MSG_CHECKING([for Tcl header]) |
1110 |
|
1111 |
# Attempt autodetect for $TCLINCFN if it's not set |
1112 |
if test ! "${TCLINCFN-x}" = "x"; then |
1113 |
AC_MSG_RESULT([using ${TCLINC}/${TCLINCFN}]) |
1114 |
else |
1115 |
for tclheaderpath in $tclheaderpaths; do |
1116 |
for tclheaderfn in $tclheadernames; do |
1117 |
if test -r "${tclheaderpath}/${tclheaderfn}"; then |
1118 |
AC_MSG_RESULT([found ${tclheaderpath}/${tclheaderfn}]) |
1119 |
TCLINC="$tclheaderpath" |
1120 |
TCLINCFN="$tclheaderfn" |
1121 |
break 2 |
1122 |
fi |
1123 |
done |
1124 |
done |
1125 |
|
1126 |
# FreeBSD hack ... |
1127 |
if test "${TCLINCFN-x}" = "x"; then |
1128 |
for tcllibfns in $tcllibnames; do |
1129 |
for tclheaderpath in $tclheaderpaths; do |
1130 |
for tclheaderfn in $tclheadernames; do |
1131 |
if test -r "${tclheaderpath}/${tcllibfns}/${tclheaderfn}"; then |
1132 |
AC_MSG_RESULT([found ${tclheaderpath}/${tcllibfns}/${tclheaderfn}]) |
1133 |
TCLINC="${tclheaderpath}/${tcllibfns}" |
1134 |
TCLINCFN="$tclheaderfn" |
1135 |
break 3 |
1136 |
fi |
1137 |
done |
1138 |
done |
1139 |
done |
1140 |
fi |
1141 |
fi |
1142 |
|
1143 |
if test "${TCLINCFN-x}" = "x"; then |
1144 |
AC_MSG_RESULT({not found}) |
1145 |
fi |
1146 |
|
1147 |
AC_SUBST(TCLINC) |
1148 |
AC_SUBST(TCLINCFN) |
1149 |
]) |
1150 |
|
1151 |
|
1152 |
dnl EGG_CACHE_UNSET(CACHE-ID) |
1153 |
dnl |
1154 |
dnl Unsets a certain cache item. Typically called before using the AC_CACHE_*() |
1155 |
dnl macros. |
1156 |
dnl |
1157 |
AC_DEFUN([EGG_CACHE_UNSET], [unset $1]) |
1158 |
|
1159 |
|
1160 |
dnl EGG_TCL_DETECT_CHANGE() |
1161 |
dnl |
1162 |
dnl Detect whether the Tcl system has changed since our last configure run. |
1163 |
dnl Set egg_tcl_changed accordingly. |
1164 |
dnl |
1165 |
dnl Tcl related feature and version checks should re-run their checks as soon |
1166 |
dnl as egg_tcl_changed is set to "yes". |
1167 |
dnl |
1168 |
AC_DEFUN([EGG_TCL_DETECT_CHANGE], |
1169 |
[ |
1170 |
AC_MSG_CHECKING([whether the Tcl system has changed]) |
1171 |
egg_tcl_changed="yes" |
1172 |
egg_tcl_id="${TCLLIB}:${TCLLIBFN}:${TCLINC}:${TCLINCFN}" |
1173 |
if test ! "$egg_tcl_id" = ":::"; then |
1174 |
egg_tcl_cached="yes" |
1175 |
AC_CACHE_VAL(egg_cv_var_tcl_id, [ |
1176 |
egg_cv_var_tcl_id="$egg_tcl_id" |
1177 |
egg_tcl_cached="no" |
1178 |
]) |
1179 |
if test "$egg_tcl_cached" = "yes"; then |
1180 |
if test "${egg_cv_var_tcl_id-x}" = "${egg_tcl_id-x}"; then |
1181 |
egg_tcl_changed="no" |
1182 |
else |
1183 |
egg_cv_var_tcl_id="$egg_tcl_id" |
1184 |
fi |
1185 |
fi |
1186 |
fi |
1187 |
|
1188 |
if test "$egg_tcl_changed" = "yes"; then |
1189 |
AC_MSG_RESULT([yes]) |
1190 |
else |
1191 |
AC_MSG_RESULT([no]) |
1192 |
fi |
1193 |
]) |
1194 |
|
1195 |
|
1196 |
dnl EGG_TCL_CHECK_VERSION() |
1197 |
dnl |
1198 |
AC_DEFUN([EGG_TCL_CHECK_VERSION], |
1199 |
[ |
1200 |
# Both TCLLIBFN & TCLINCFN must be set, or we bail |
1201 |
TCL_FOUND=0 |
1202 |
if test ! "${TCLLIBFN-x}" = "x" && test ! "${TCLINCFN-x}" = "x"; then |
1203 |
TCL_FOUND=1 |
1204 |
|
1205 |
# Check Tcl's version |
1206 |
if test "$egg_tcl_changed" = "yes"; then |
1207 |
EGG_CACHE_UNSET(egg_cv_var_tcl_version) |
1208 |
fi |
1209 |
|
1210 |
AC_MSG_CHECKING([for Tcl version]) |
1211 |
AC_CACHE_VAL(egg_cv_var_tcl_version, [ |
1212 |
egg_cv_var_tcl_version=`grep TCL_VERSION $TCLINC/$TCLINCFN | $HEAD_1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'` |
1213 |
]) |
1214 |
|
1215 |
if test ! "${egg_cv_var_tcl_version-x}" = "x"; then |
1216 |
AC_MSG_RESULT([$egg_cv_var_tcl_version]) |
1217 |
else |
1218 |
AC_MSG_RESULT([not found]) |
1219 |
TCL_FOUND=0 |
1220 |
fi |
1221 |
|
1222 |
# Check Tcl's patch level (if available) |
1223 |
if test "$egg_tcl_changed" = "yes"; then |
1224 |
EGG_CACHE_UNSET(egg_cv_var_tcl_patch_level) |
1225 |
fi |
1226 |
AC_MSG_CHECKING([for Tcl patch level]) |
1227 |
AC_CACHE_VAL(egg_cv_var_tcl_patch_level, [ |
1228 |
eval "egg_cv_var_tcl_patch_level=`grep TCL_PATCH_LEVEL $TCLINC/$TCLINCFN | $HEAD_1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'`" |
1229 |
]) |
1230 |
|
1231 |
if test ! "${egg_cv_var_tcl_patch_level-x}" = "x"; then |
1232 |
AC_MSG_RESULT([$egg_cv_var_tcl_patch_level]) |
1233 |
else |
1234 |
egg_cv_var_tcl_patch_level="unknown" |
1235 |
AC_MSG_RESULT([unknown]) |
1236 |
fi |
1237 |
fi |
1238 |
|
1239 |
# Check if we found Tcl's version |
1240 |
if test "$TCL_FOUND" = 0; then |
1241 |
cat << 'EOF' >&2 |
1242 |
configure: error: |
1243 |
|
1244 |
Tcl cannot be found on this system. |
1245 |
|
1246 |
Eggdrop requires Tcl to compile. If you already have Tcl installed on |
1247 |
this system, and I just wasn't looking in the right place for it, re-run |
1248 |
./configure using the --with-tcllib='/path/to/libtcl.so' and |
1249 |
--with-tclinc='/path/to/tcl.h' options. |
1250 |
|
1251 |
See doc/COMPILE-GUIDE's 'Tcl Detection and Installation' section for more |
1252 |
information. |
1253 |
|
1254 |
EOF |
1255 |
exit 1 |
1256 |
fi |
1257 |
]) |
1258 |
|
1259 |
|
1260 |
dnl EGG_TCL_CHECK_PRE70() |
1261 |
dnl |
1262 |
AC_DEFUN([EGG_TCL_CHECK_PRE70], |
1263 |
[ |
1264 |
# Is this version of Tcl too old for us to use ? |
1265 |
TCL_VER_PRE70=`echo $egg_cv_var_tcl_version | $AWK '{split([$]1, i, "."); if (i[[1]] < 7) print "yes"; else print "no"}'` |
1266 |
if test "$TCL_VER_PRE70" = "yes"; then |
1267 |
cat << EOF >&2 |
1268 |
configure: error: |
1269 |
|
1270 |
Your Tcl version is much too old for Eggdrop to use. You should |
1271 |
download and compile a more recent version. The most reliable |
1272 |
current version is $tclrecommendver and can be downloaded from |
1273 |
${tclrecommendsite}. |
1274 |
|
1275 |
See doc/COMPILE-GUIDE's 'Tcl Detection and Installation' section |
1276 |
for more information. |
1277 |
|
1278 |
EOF |
1279 |
exit 1 |
1280 |
fi |
1281 |
]) |
1282 |
|
1283 |
|
1284 |
dnl EGG_TCL_TESTLIBS() |
1285 |
dnl |
1286 |
AC_DEFUN([EGG_TCL_TESTLIBS], |
1287 |
[ |
1288 |
# Set variables for Tcl library tests |
1289 |
TCL_TEST_LIB="$TCLLIBFNS" |
1290 |
TCL_TEST_OTHERLIBS="-L$TCLLIB $EGG_MATH_LIB" |
1291 |
if test ! "${ac_cv_lib_pthread-x}" = "x"; then |
1292 |
TCL_TEST_OTHERLIBS="$TCL_TEST_OTHERLIBS $ac_cv_lib_pthread" |
1293 |
fi |
1294 |
]) |
1295 |
|
1296 |
|
1297 |
dnl EGG_TCL_CHECK_FREE() |
1298 |
dnl |
1299 |
AC_DEFUN([EGG_TCL_CHECK_FREE], |
1300 |
[ |
1301 |
if test "$egg_tcl_changed" = "yes"; then |
1302 |
EGG_CACHE_UNSET(egg_cv_var_tcl_free) |
1303 |
fi |
1304 |
|
1305 |
# Check for Tcl_Free() |
1306 |
AC_CHECK_LIB($TCL_TEST_LIB, Tcl_Free, [egg_cv_var_tcl_free="yes"], [egg_cv_var_tcl_free="no"], $TCL_TEST_OTHERLIBS) |
1307 |
|
1308 |
if test "$egg_cv_var_tcl_free" = "yes"; then |
1309 |
AC_DEFINE(HAVE_TCL_FREE, 1, [Define for Tcl that has Tcl_Free() (7.5p1 and later).]) |
1310 |
fi |
1311 |
]) |
1312 |
|
1313 |
|
1314 |
dnl EGG_TCL_ENABLE_THREADS() |
1315 |
dnl |
1316 |
AC_DEFUN([EGG_TCL_ENABLE_THREADS], |
1317 |
[ |
1318 |
AC_ARG_ENABLE(tcl-threads, [ --disable-tcl-threads disable threaded Tcl support if detected ], [enable_tcl_threads="$enableval"], [enable_tcl_threads="yes"]) |
1319 |
]) |
1320 |
|
1321 |
|
1322 |
dnl EGG_TCL_CHECK_THREADS() |
1323 |
dnl |
1324 |
AC_DEFUN([EGG_TCL_CHECK_THREADS], |
1325 |
[ |
1326 |
if test "$egg_tcl_changed" = "yes"; then |
1327 |
EGG_CACHE_UNSET(egg_cv_var_tcl_threaded) |
1328 |
fi |
1329 |
|
1330 |
# Check for TclpFinalizeThreadData() |
1331 |
AC_CHECK_LIB($TCL_TEST_LIB, TclpFinalizeThreadData, [egg_cv_var_tcl_threaded="yes"], [egg_cv_var_tcl_threaded="no"], $TCL_TEST_OTHERLIBS) |
1332 |
|
1333 |
if test "$egg_cv_var_tcl_threaded" = "yes"; then |
1334 |
if test "$enable_tcl_threads" = "no"; then |
1335 |
|
1336 |
cat << 'EOF' >&2 |
1337 |
configure: warning: |
1338 |
|
1339 |
You have disabled threads support on a system with a threaded Tcl library. |
1340 |
Tcl features that rely on scheduled events may not function properly. |
1341 |
|
1342 |
EOF |
1343 |
else |
1344 |
AC_DEFINE(HAVE_TCL_THREADS, 1, [Define for Tcl that has threads.]) |
1345 |
fi |
1346 |
|
1347 |
# Add pthread library to $LIBS if we need it |
1348 |
if test ! "${ac_cv_lib_pthread-x}" = "x"; then |
1349 |
LIBS="$ac_cv_lib_pthread $LIBS" |
1350 |
fi |
1351 |
fi |
1352 |
]) |
1353 |
|
1354 |
|
1355 |
dnl EGG_TCL_LIB_REQS() |
1356 |
dnl |
1357 |
AC_DEFUN([EGG_TCL_LIB_REQS], |
1358 |
[ |
1359 |
if test "$EGG_CYGWIN" = "yes"; then |
1360 |
TCL_REQS="${TCLLIB}/lib${TCLLIBFN}" |
1361 |
TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB" |
1362 |
else |
1363 |
if test ! "$TCLLIBEXT" = ".a"; then |
1364 |
TCL_REQS="${TCLLIB}/lib${TCLLIBFN}" |
1365 |
TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB" |
1366 |
else |
1367 |
# Set default make as static for unshared Tcl library |
1368 |
if test ! "$DEFAULT_MAKE" = "static"; then |
1369 |
cat << 'EOF' >&2 |
1370 |
configure: warning: |
1371 |
|
1372 |
Your Tcl library is not a shared lib. |
1373 |
configure will now set default make type to static. |
1374 |
|
1375 |
EOF |
1376 |
DEFAULT_MAKE="static" |
1377 |
AC_SUBST(DEFAULT_MAKE) |
1378 |
fi |
1379 |
|
1380 |
# Are we using a pre 7.4 Tcl version ? |
1381 |
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"}'` |
1382 |
if test "$TCL_VER_PRE74" = "no"; then |
1383 |
|
1384 |
# Was the --with-tcllib option given ? |
1385 |
if test ! "${tcllibname-x}" = "x"; then |
1386 |
TCL_REQS="${TCLLIB}/lib${TCLLIBFN}" |
1387 |
TCL_LIBS="${TCLLIB}/lib${TCLLIBFN} $EGG_MATH_LIB" |
1388 |
else |
1389 |
TCL_REQS="${TCLLIB}/lib${TCLLIBFN}" |
1390 |
TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB" |
1391 |
fi |
1392 |
else |
1393 |
cat << EOF >&2 |
1394 |
configure: warning: |
1395 |
|
1396 |
Your Tcl version ($egg_cv_var_tcl_version) is older then 7.4. |
1397 |
There are known problems, but we will attempt to work around them. |
1398 |
|
1399 |
EOF |
1400 |
TCL_REQS="libtcle.a" |
1401 |
TCL_LIBS="-L`pwd` -ltcle $EGG_MATH_LIB" |
1402 |
fi |
1403 |
fi |
1404 |
fi |
1405 |
|
1406 |
AC_SUBST(TCL_REQS) |
1407 |
AC_SUBST(TCL_LIBS) |
1408 |
]) |
1409 |
|
1410 |
|
1411 |
dnl EGG_SUBST_EGGVERSION() |
1412 |
dnl |
1413 |
AC_DEFUN([EGG_SUBST_EGGVERSION], |
1414 |
[ |
1415 |
EGGVERSION=`grep 'char.egg_version' $srcdir/src/main.c | $AWK '{gsub(/(\"|\;)/, "", [$]4); print [$]4}'` |
1416 |
egg_version_num=`echo $EGGVERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", [$]1, [$]2, [$]3)}'` |
1417 |
AC_SUBST(EGGVERSION) |
1418 |
AC_DEFINE_UNQUOTED(EGG_VERSION, $egg_version_num, [Defines the current Eggdrop version.]) |
1419 |
]) |
1420 |
|
1421 |
|
1422 |
dnl EGG_SUBST_DEST() |
1423 |
AC_DEFUN([EGG_SUBST_DEST], |
1424 |
[ |
1425 |
if test "${DEST-x}" = "x"; then |
1426 |
DEST=\${prefix} |
1427 |
fi |
1428 |
AC_SUBST(DEST) |
1429 |
]) |
1430 |
|
1431 |
|
1432 |
dnl EGG_SUBST_MOD_UPDIR() |
1433 |
dnl |
1434 |
dnl Since module's Makefiles aren't generated by configure, some paths in |
1435 |
dnl src/mod/Makefile.in take care of them. For correct path "calculation", we |
1436 |
dnl need to keep absolute paths in mind (which don't need a "../" pre-pended). |
1437 |
dnl |
1438 |
AC_DEFUN([EGG_SUBST_MOD_UPDIR], [ |
1439 |
case "$srcdir" in |
1440 |
[[\\/]]* | ?:[[\\/]]*) |
1441 |
MOD_UPDIR="" |
1442 |
;; |
1443 |
*) |
1444 |
MOD_UPDIR="../" |
1445 |
;; |
1446 |
esac |
1447 |
AC_SUBST(MOD_UPDIR) |
1448 |
]) |
1449 |
|
1450 |
|
1451 |
dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS) |
1452 |
dnl |
1453 |
dnl Replace FILE-NAME if the newly created contents differs from the existing |
1454 |
dnl file contents. Otherwise, leave the file alone. This avoids needless |
1455 |
dnl recompiles. |
1456 |
dnl |
1457 |
m4_define(EGG_REPLACE_IF_CHANGED, |
1458 |
[ |
1459 |
AC_CONFIG_COMMANDS([replace-if-changed], [[ |
1460 |
egg_replace_file="$1" |
1461 |
$2 |
1462 |
if test -f "$egg_replace_file" && cmp -s conftest.out $egg_replace_file; then |
1463 |
echo "$1 is unchanged" |
1464 |
else |
1465 |
echo "creating $1" |
1466 |
mv conftest.out $egg_replace_file |
1467 |
fi |
1468 |
rm -f conftest.out |
1469 |
]], |
1470 |
[[$3]]) |
1471 |
]) |
1472 |
|
1473 |
|
1474 |
dnl EGG_TCL_LUSH() |
1475 |
dnl |
1476 |
AC_DEFUN([EGG_TCL_LUSH], |
1477 |
[ |
1478 |
EGG_REPLACE_IF_CHANGED(lush.h, [ |
1479 |
cat > conftest.out << EOF |
1480 |
|
1481 |
/* Ignore me but do not erase me. I am a kludge. */ |
1482 |
|
1483 |
#include "${egg_tclinc}/${egg_tclincfn}" |
1484 |
|
1485 |
EOF |
1486 |
], [ |
1487 |
egg_tclinc="$TCLINC" |
1488 |
egg_tclincfn="$TCLINCFN" |
1489 |
]) |
1490 |
]) |
1491 |
|
1492 |
|
1493 |
dnl EGG_CATCH_MAKEFILE_REBUILD() |
1494 |
dnl |
1495 |
AC_DEFUN([EGG_CATCH_MAKEFILE_REBUILD], |
1496 |
[ |
1497 |
AC_CONFIG_COMMANDS([catch-make-rebuild], [[ |
1498 |
if test -f .modules; then |
1499 |
$srcdir/misc/modconfig --top_srcdir="$srcdir/src" Makefile |
1500 |
fi |
1501 |
]]) |
1502 |
]) |
1503 |
|
1504 |
|
1505 |
dnl EGG_SAVE_PARAMETERS() |
1506 |
dnl |
1507 |
dnl Remove --cache-file and --srcdir arguments so they do not pile up. |
1508 |
dnl |
1509 |
AC_DEFUN([EGG_SAVE_PARAMETERS], |
1510 |
[ |
1511 |
egg_ac_parameters= |
1512 |
ac_prev= |
1513 |
for ac_arg in $ac_configure_args; do |
1514 |
if test -n "$ac_prev"; then |
1515 |
ac_prev= |
1516 |
continue |
1517 |
fi |
1518 |
case $ac_arg in |
1519 |
-cache-file | --cache-file | --cache-fil | --cache-fi | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) |
1520 |
ac_prev=cache_file ;; |
1521 |
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) |
1522 |
;; |
1523 |
--config-cache | -C) |
1524 |
;; |
1525 |
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr) |
1526 |
ac_prev=srcdir ;; |
1527 |
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) |
1528 |
;; |
1529 |
*) egg_ac_parameters="$egg_ac_parameters $ac_arg" ;; |
1530 |
esac |
1531 |
done |
1532 |
|
1533 |
AC_SUBST(egg_ac_parameters) |
1534 |
]) |
1535 |
|
1536 |
|
1537 |
dnl AC_PROG_CC_WIN32() |
1538 |
dnl |
1539 |
AC_DEFUN([AC_PROG_CC_WIN32], |
1540 |
[ |
1541 |
AC_MSG_CHECKING([how to access the Win32 API]) |
1542 |
WIN32FLAGS= |
1543 |
AC_COMPILE_IFELSE([[ |
1544 |
#ifndef WIN32 |
1545 |
# ifndef _WIN32 |
1546 |
# error WIN32 or _WIN32 not defined |
1547 |
# endif |
1548 |
#endif |
1549 |
]], [ |
1550 |
AC_MSG_RESULT([present by default]) |
1551 |
], [ |
1552 |
ac_compile_save="$ac_compile" |
1553 |
save_CC="$CC" |
1554 |
ac_compile="$ac_compile -mwin32" |
1555 |
CC="$CC -mwin32" |
1556 |
AC_COMPILE_IFELSE([[ |
1557 |
#ifndef WIN32 |
1558 |
# ifndef _WIN32 |
1559 |
# error WIN32 or _WIN32 not defined |
1560 |
# endif |
1561 |
#endif |
1562 |
]], [ |
1563 |
AC_MSG_RESULT([found via -mwin32]) |
1564 |
ac_compile="$ac_compile_save" |
1565 |
CC="$save_CC" |
1566 |
WIN32FLAGS="-mwin32" |
1567 |
], [ |
1568 |
ac_compile="$ac_compile_save" |
1569 |
CC="$save_CC" |
1570 |
AC_MSG_RESULT([not found]) |
1571 |
]) |
1572 |
]) |
1573 |
]) |