/[svn]/vendor/ircservices-5.1.24/configure
ViewVC logotype

Contents of /vendor/ircservices-5.1.24/configure

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3389 - (show annotations)
Fri Apr 25 14:12:15 2014 UTC (6 years, 2 months ago) by michael
File size: 87209 byte(s)
- Imported ircservices-5.1.24

1 #!/bin/sh
2 #
3 # Configuration script for Services.
4 #
5 # IRC Services is copyright (c) 1996-2009 Andrew Church.
6 # E-mail: <achurch@achurch.org>
7 # Parts written by Andrew Kempe and others.
8 # This program is free but copyrighted software; see the file GPL.txt for
9 # details.
10
11 ###########################################################################
12
13 # Temporary directory to use for various things.
14 CONFTMP=conf-tmp
15
16 ###########################################################################
17
18 # Nifty handy functions.
19
20 # Echo something and stay on the same line.
21 echo2 () {
22 $ECHO2 "$*$ECHO2SUF" # these are defined below
23 }
24
25 # Write a line to the log file, including the current test mode.
26 log () {
27 echo >&3 "$MODE: $*"
28 }
29
30 # Run a command, writing the command, output, and exit status (if nonzero)
31 # to the log.
32 run () {
33 echo >&3 "$MODE: >>> $*"
34 ("$@") >&3 2>&3 </dev/null
35 xxres=$?
36 if [ $xxres -ne 0 ] ; then
37 echo >&3 "$MODE: *** Command failed (exit code $xxres)"
38 fi
39 return $xxres
40 }
41
42 # Test whether a file exists (some shells don't have "test -e").
43 exists () {
44 if [ -f $1 -o -d $1 -o -p $1 -o -c $1 -o -b $1 ] ; then
45 return 0
46 else
47 return 1
48 fi
49 }
50
51 # Run grep without any output.
52 grep_q () {
53 grep >/dev/null 2>&1 "$@"
54 }
55
56 ###########################################################################
57
58 # How can we echo something without going to the next line?
59
60 ECHO2SUF=''
61 if [ "`echo -n a ; echo -n b`" = "ab" ] ; then
62 ECHO2='echo -n'
63 elif [ "`echo 'a\c' ; echo 'b\c'`" = "ab" ] ; then
64 ECHO2='echo' ; ECHO2SUF='\c'
65 elif [ "`printf 'a' 2>&1 ; printf 'b' 2>&1`" = "ab" ] ; then
66 ECHO2='printf "%s"'
67 else
68 # oh well...
69 ECHO2='echo'
70 fi
71 export ECHO2 ECHO2SUF
72
73 ###########################################################################
74
75 # Kludge around GNU coreutils stuffiness. (Some versions of `head' refused
76 # to recognize the standard "head -1" syntax, insisting on "head -n 1".)
77
78 head_is_broken=""
79 if [ x`echo test | head -1 2>/dev/null` != xtest ] ; then
80 head_is_broken=broken
81 elif [ "x`echo test | head -1 2>&1 >/dev/null`" != x ] ; then
82 head_is_broken=broken
83 fi
84 HEAD () {
85 if test "$head_is_broken" ; then
86 count=$1; shift
87 head -n`echo x$count | cut -c3-` "$@"
88 else
89 head "$@"
90 fi
91 }
92
93 ###########################################################################
94
95 # Return the default flags for the given C compiler.
96
97 def_cc_flags () {
98 GCC=no
99 a=`echo "x$1" | cut -c1-4`
100 if [ "$a" = "xgcc" -o "x$1" = "xkgc" ] ; then
101 GCC=yes
102 elif "$1" --version 2>/dev/null | grep_q '(GCC)' ; then
103 GCC=yes
104 fi
105 if [ $GCC = yes ] ; then
106 echo "-O2 -fno-strict-aliasing"
107 elif [ "X$1" = "Xicc" ] ; then
108 echo "-O0 -wd144,167,556"
109 fi
110 }
111
112 ###########################################################################
113
114 # Test for the presence of a given include file or function. If the
115 # variable TEST is non-empty, it contains code to be placed at the end of
116 # main(), and should return 0 if everything is okay, else 1.
117 #
118 # For includes: Pass the include filename as an argument. The variable
119 # HAVE_include_name, where "include_name" is the name of the include file
120 # with letters uppercased and non-alphanumerics replaced by underscores, is
121 # set to 1 if the include file is present, else 0.
122 #
123 # For functions: Pass the return type, function name, and prototype as
124 # arguments. The variable HAVE_function, where "function" is the name
125 # of the function with letters uppercased, is set to 1 if the function is
126 # available, else 0.
127 #
128 # For both: The result code of the function will be 0 (true) if the entity
129 # is present, else 1 (false).
130
131 test_include () {
132 include="$1"
133 inc2="`echo $include | sed 'y+abcdefghijklmnopqrstuvwxyz/.-+ABCDEFGHIJKLMNOPQRSTUVWXYZ___+'`"
134 if [ -f "/usr/include/$include" ] ; then
135 eval "HAVE_${inc2}=1"
136 log "found $include in /usr/include"
137 return 0
138 fi
139 cat >$CONFTMP/test.c <<EOT
140 #include <$include>
141 int main() { return 0; }
142 EOT
143 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
144 eval "HAVE_${inc2}=1"
145 log "found $include"
146 return 0
147 else
148 eval "HAVE_${inc2}=0"
149 log "didn't find $include"
150 return 1
151 fi
152 }
153
154
155 test_function () {
156 rettype="$1"
157 func="$2"
158 proto="$3"
159 if [ ! "$rettype" -o ! "$func" ] ; then
160 log "test_function: missing parameter(s)"
161 return 1
162 fi
163 if [ ! "$proto" ] ; then
164 proto="(...)"
165 fi
166 func2=`echo $func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
167 if [ ! "$TEST" ] ; then
168 TEST="return 0;"
169 fi
170 cat >$CONFTMP/test.c <<EOT
171 int main() {
172 extern $rettype $func$proto;
173 $TEST
174 }
175 EOT
176 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test && (run $CONFTMP/test) 2>&1 ; then
177 eval "HAVE_${func2}=1"
178 log "found $func"
179 return 0
180 else
181 eval "HAVE_${func2}=0"
182 log "didn't find $func"
183 return 1
184 fi
185 }
186
187 ###########################################################################
188
189 # If something happens that really shouldn't:
190
191 whoa_there () {
192 cat <<EOT
193
194 *** WHOA THERE! ***
195
196 We suddenly couldn't compile using the C compiler we already tested!
197 The command line we used was:
198 $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test
199 Please try to fix this; if you can't, mail achurch@achurch.org
200 with information about your system, the output from this script,
201 and the \`configure.log' file generated by this script.
202
203 Configuration aborted.
204
205 EOT
206 exit 4
207 }
208
209 ###########################################################################
210 ###########################################################################
211
212 # Start of actual script.
213
214 ###########################################################################
215
216 # Create a temporary directory for our use.
217
218 if exists $CONFTMP ; then
219 rm -rf $CONFTMP
220 fi
221 if mkdir $CONFTMP ; then : ; else
222 echo "Failed to create temporary directory! Exiting."
223 exit 2
224 fi
225 if chmod u+rwx $CONFTMP ; then : ; else
226 echo "Cannot write to temporary directory! Exiting."
227 exit 2
228 fi
229
230 ###########################################################################
231
232 # Variable initialization.
233
234 MY_CONFIG_VERSION=105
235 CONFIG_VERSION=
236
237 PROGRAM=ircservices
238 PREFIX=
239 BINDEST=/usr/local/sbin
240 DATDEST=/usr/local/lib/ircservices
241
242 TEST_NT=
243 INSTALL=
244 MKDIR=
245 CP_ALL=
246
247 CC=
248 CC_FLAGS=bonkle
249 CC_LFLAGS=bonkle
250 CC_LIBS=bonkle
251 EXE_SUFFIX=bonkle
252 NEED_GCC3_HACK=0
253 SYMS_NEED_UNDERSCORES=0
254
255 SORTED_LISTS=1
256 CLEAN_COMPILE=1
257 DUMPCORE=0
258 MEMCHECKS=0
259 SHOWALLOCS=0
260
261 STATIC_MODULES=
262 CC_SHARED=
263 CC_DYN_LFLAGS=
264 CC_DYN_LIBS=
265 RANLIB=
266
267 TYPE_INT8=
268 TYPE_INT16=
269 TYPE_INT32=
270 TYPE_INT64=
271 SIZEOF_INT=
272 SIZEOF_LONG=
273 SIZEOF_PTR=
274 SIZEOF_TIME_T=
275 MAX_TIME_T=
276 SIZEOF_GID_T=bonkle
277 HAVE_SOCKLEN_T=
278
279 HAVE_STDINT_H=
280 HAVE_STRINGS_H=
281 HAVE_SYS_SELECT_H=
282 HAVE_SYS_SYSPROTO_H=
283
284 HAVE_STRERROR=
285 HAVE_SYS_ERRLIST=0
286 HAVE_HSTRERROR=
287
288 HAVE_SNPRINTF=
289 BAD_SNPRINTF=
290 HAVE_STRTOK=
291 HAVE_STRICMP=
292 HAVE_STRCASECMP=
293 HAVE_STRDUP=
294 HAVE_STRSPN=
295 HAVE_STRSIGNAL=
296 HAVE_GETTIMEOFDAY=
297 HAVE_SETGRENT=
298 HAVE_SETREGID=
299 HAVE_UMASK=
300 HAVE_FORK=
301 HAVE_GETHOSTBYNAME=
302 HAVE_GETSETRLIMIT=
303 HAVE_CRYPT=
304 MISSING=bonkle
305
306 ###########################################################################
307
308 # Command-line parsing.
309
310 OPT_OS2=
311 OPT_BINDEST=
312 OPT_DATDEST=
313 OPT_SORTED_LISTS=bonkle
314 OPT_CLEAN_COMPILE=bonkle
315 OPT_MEMCHECKS=bonkle
316 OPT_SHOWALLOCS=bonkle
317 OPT_DUMPCORE=bonkle
318 IGNORE_CACHE=
319 USE_LOCAL_FUNCS=
320 NO_USE_LOCAL_FUNCS=
321 USE_STATIC_MODULES=
322 USE_DYNAMIC_MODULES=
323
324 USER_CC=
325 USER_CC_FLAGS=bonkle
326 USER_CC_LFLAGS=bonkle
327 USER_CC_LIBS=
328
329 export OPT_OS2 OPT_BINDEST OPT_DATDEST IGNORE_CACHE
330 export USE_LOCAL_FUNCS NO_USE_LOCAL_FUNCS USE_STATIC_MODULES
331 export USE_DYNAMIC_MODULES OPT_SORTED_LISTS OPT_CLEAN_COMPILE
332 export OPT_DUMPCORE OPT_MEMCHECKS OPT_SHOWALLOCS
333 export USER_CC USER_CC_FLAGS USER_CC_LFLAGS USER_CC_LIBS
334
335 while [ $# -gt 0 ] ; do
336 if echo "$1" | grep_q '^-' ; then
337 option=`echo "$1" | cut -c2-`
338 shift
339 if echo "$option" | grep_q '^-' ; then
340 option=`echo "$option" | cut -c2-`
341 if echo "$option" | grep_q '=' ; then
342 value=`echo "$option" | sed 's/^[^=]*=//'`
343 option=`echo "$option" | sed 's/=.*$//'`
344 set -- "$value" "$@"
345 fi
346 fi
347 if [ "$option" = "check" ] ; then
348 rm -rf $CONFTMP
349 if [ -f config.cache ] ; then
350 CACHEVER=`grep '^CONFIG_VERSION=' config.cache | cut -d= -f2`
351 if [ "x$CACHEVER" = "x$MY_CONFIG_VERSION" ] ; then
352 exit 0
353 else
354 exit 1
355 fi
356 else
357 exit 1
358 fi
359 elif [ "$option" = "ignore-cache" ] ; then
360 IGNORE_CACHE=bonkle
361 elif [ "$option" = "cc" ] ; then
362 USER_CC="$1"
363 shift
364 elif [ "$option" = "cflags" ] ; then
365 USER_CC_FLAGS="$1"
366 shift
367 elif [ "$option" = "lflags" ] ; then
368 USER_CC_LFLAGS="$1"
369 shift
370 elif [ "$option" = "libs" ] ; then
371 USER_CC_LIBS="$1"
372 shift
373 elif [ "$option" = "os2" ] ; then
374 OPT_OS2=1
375 elif [ "$option" = "program" ] ; then
376 if echo "x$1" | grep_q / ; then
377 echo >&2 "Error: -program parameter must not contain a slash"
378 exit 1
379 elif [ "$1" = "modules" ] ; then
380 echo >&2 'Error: "modules" cannot be used as the program name'
381 exit 1
382 else
383 PROGRAM="$1"
384 fi
385 shift
386 elif [ "$option" = "bindest" ] ; then
387 OPT_BINDEST="$1"
388 shift
389 elif [ "$option" = "datdest" ] ; then
390 OPT_DATDEST="$1"
391 shift
392 elif [ "$option" = "prefix" ] ; then
393 PREFIX="$1"
394 shift
395 elif [ "$option" = "use-local-funcs" ] ; then
396 USE_LOCAL_FUNCS=bonkle
397 NO_USE_LOCAL_FUNCS=
398 elif [ "$option" = "no-use-local-funcs" ] ; then
399 USE_LOCAL_FUNCS=
400 NO_USE_LOCAL_FUNCS=bonkle
401 elif [ "$option" = "use-static-modules" ] ; then
402 USE_DYNAMIC_MODULES=
403 USE_STATIC_MODULES=bonkle
404 elif [ "$option" = "no-use-static-modules" ] ; then
405 USE_DYNAMIC_MODULES=bonkle
406 USE_STATIC_MODULES=
407 elif [ "$option" = "sorted-lists" ] ; then
408 OPT_SORTED_LISTS=1
409 elif [ "$option" = "no-sorted-lists" ] ; then
410 OPT_SORTED_LISTS=0
411 elif [ "$option" = "clean-compile" ] ; then
412 OPT_CLEAN_COMPILE=y
413 elif [ "$option" = "no-clean-compile" ] ; then
414 OPT_CLEAN_COMPILE=
415 elif [ "$option" = "memchecks" ] ; then
416 OPT_MEMCHECKS=y
417 elif [ "$option" = "no-memchecks" ] ; then
418 OPT_MEMCHECKS=
419 elif [ "$option" = "showallocs" ] ; then
420 OPT_SHOWALLOCS=y
421 elif [ "$option" = "no-showallocs" ] ; then
422 OPT_SHOWALLOCS=
423 elif [ "$option" = "dumpcore" ] ; then
424 OPT_DUMPCORE=y
425 elif [ "$option" = "no-dumpcore" ] ; then
426 OPT_DUMPCORE=
427 else
428 if [ "$option" != "help" -a "$option" != "h" ]; then
429 echo >&2 "Unknown option/parameter: $option"
430 exitval=1
431 else
432 exitval=0
433 fi
434 cat >&2 <<EOT
435
436 Available options:
437
438 *** Controlling the configure script ***
439
440 -help Display list of command-line options
441 -ignore-cache Don't use cache file if it exists
442
443 *** Controlling compilation ***
444
445 -cc PROGRAM Specify C compiler to use (overrides cache and
446 check; also clears cached CFLAGS/LFLAGS values)
447 -cflags FLAGS Specify compilation flags (overrides cache/check)
448 -lflags FLAGS Specify link flags for C compiler (default: none)
449 -libs LIBS Specify extra libraries to use (default: none)
450 -os2 Indicate that this is an OS/2 system
451
452 *** Controlling installation ***
453
454 -program NAME Specify name to use for executable file (default
455 "ircservices"); "ircservices-chk" script will
456 also be renamed to "NAME-chk"
457 -bindest DIR Specify directory for program file installation
458 -datdest DIR Specify directory for data file installation
459 -prefix DIR Specify GNU-style installation prefix (program
460 will be installed in DIR/sbin, data in
461 DIR/lib/<program>); overrides -bindest/-datdest
462
463 *** Controlling Services features ***
464
465 Note that the following functions can be disabled by adding "no-" before
466 the option name; for example, "-no-use-local-funcs". For options with a
467 * before the option name, the option is on by default, and you must
468 explicitly give -no-option-name to disable it.
469
470 -use-local-funcs Force the use of compatibility functions over
471 system library functions (for debugging)
472 -use-static-modules Force modules to be compiled statically, even if
473 dynamic modules could be used
474 * -sorted-lists Keep nickname/channel lists sorted (causes a
475 performance penalty on large networks)
476 * -clean-compile Attempt to compile with no warnings (causes a
477 slight performance penalty)
478 -memchecks Perform extra checks on memory allocation (for
479 debugging only; causes a significant
480 performance penalty)
481 -showallocs Log all memory allocation activity (for
482 debugging only; ignored unless -memchecks
483 is enabled)
484 -dumpcore Causes Services to attempt to write a core
485 file if it crashes (for debugging)
486
487 *** Other options ***
488
489 -check Check whether this script has already been run
490 and whether the cache is up-to-date. Exits
491 with status 0 if up-to-date, 1 if not.
492
493
494 GNU-style long options (--option[=value]) may also be used.
495
496 Note that environment variables such as CC and CFLAGS are ignored; use
497 the corresponding command-line options (-cc, -cflags, etc.) instead.
498 EOT
499 exit $exitval
500 fi
501 fi
502 done
503
504 ###########################################################################
505
506 echo ""
507 echo "Beginning IRC Services configuration."
508 echo ""
509
510 ###########################################################################
511
512 # First, test for the presence of a config.cache file. If found, either
513 # don't use it (-ignore-cache), or let the user know how to not use it and
514 # then use it.
515
516 if [ -f config.cache -a -r config.cache -a ! "$IGNORE_CACHE" ] ; then
517 cat <<EOT
518 Using defaults from config.cache. To ignore, either remove config.cache or
519 give the command-line option "-ignore-cache".
520
521 EOT
522 . ./config.cache
523 # Clear list of missing functions if either a relevant HAVE_* variable
524 # is missing or -no-use-local-funcs was specified.
525 if [ "$NO_USE_LOCAL_FUNCS" \
526 -o ! "$HAVE_SNPRINTF" \
527 -o ! "$BAD_SNPRINTF" \
528 -o ! "$HAVE_STRTOK" \
529 -o ! "$HAVE_STRICMP" \
530 -o ! "$HAVE_STRCASECMP" \
531 -o ! "$HAVE_STRDUP" \
532 -o ! "$HAVE_STRSPN" \
533 -o ! "$HAVE_STRSIGNAL" \
534 -o ! "$HAVE_GETTIMEOFDAY" \
535 -o ! "$HAVE_SETGRENT" \
536 -o ! "$HAVE_SETREGID" \
537 -o ! "$HAVE_UMASK" \
538 -o ! "$HAVE_FORK" \
539 -o ! "$HAVE_GETHOSTBYNAME" \
540 -o ! "$HAVE_GETSETRLIMIT" \
541 -o ! "$HAVE_CRYPT" \
542 ] ; then
543 MISSING=bonkle
544 fi
545 if [ ! "$CONFIG_VERSION" ] ; then
546 CONFIG_VERSION=0
547 CC_LFLAGS=bonkle
548 CC_LIBS=bonkle
549 fi
550 if [ $CONFIG_VERSION -lt 2 ] ; then
551 # missing -fno-strict-aliasing
552 CC=
553 CC_FLAGS=bonkle
554 fi
555 if [ $CONFIG_VERSION -lt 4 ] ; then
556 # socklen_t test broken on FreeBSD
557 HAVE_SOCKLEN_T=
558 fi
559 if [ $CONFIG_VERSION -lt 6 ] ; then
560 # deprecated GCC < 3.2, so recheck compiler
561 CC=
562 fi
563 if [ $CONFIG_VERSION -lt 7 ] ; then
564 # Added -fstack-protector avoidance, so recheck compiler flags
565 CC=
566 fi
567 if [ $CONFIG_VERSION -lt 8 ] ; then
568 # Added __builtin_xxx() bug check and fixed -fstack-protector
569 # avoidance, so recheck compiler and flags
570 CC=
571 fi
572 if [ $CONFIG_VERSION -lt 100 ] ; then
573 # Initial 5.1 version: remove support for pre-C99 compilers;
574 # use 0/1 instead of y/"" for compilation options
575 CC=
576 if [ "x$SORTED_LISTS" = "xy" ] ; then
577 SORTED_LISTS=1
578 else
579 SORTED_LISTS=0
580 fi
581 if [ "x$CLEAN_COMPILE" = "xy" ] ; then
582 CLEAN_COMPILE=1
583 else
584 CLEAN_COMPILE=0
585 fi
586 if [ "x$DUMPCORE" = "xy" ] ; then
587 DUMPCORE=1
588 else
589 DUMPCORE=0
590 fi
591 if [ "x$MEMCHECKS" = "xy" ] ; then
592 MEMCHECKS=1
593 else
594 MEMCHECKS=0
595 fi
596 if [ "x$SHOWALLOCS" = "xy" ] ; then
597 SHOWALLOCS=1
598 else
599 SHOWALLOCS=0
600 fi
601 fi
602 if [ $CONFIG_VERSION -lt 101 ] ; then
603 # Add checks for -lcrypt and crypt()
604 CC_LIBS=bonkle
605 MISSING=bonkle
606 fi
607 if [ $CONFIG_VERSION -lt 102 ] ; then
608 # Add check for -lm
609 CC_LIBS=bonkle
610 fi
611 if [ $CONFIG_VERSION -lt 103 ] ; then
612 # Modify checks for int8/int16/etc
613 TYPE_INT8=
614 TYPE_INT16=
615 TYPE_INT32=
616 TYPE_INT64= # not present in this version, but clear it anyway
617 fi
618 if [ $CONFIG_VERSION -lt 104 ] ; then
619 # Add symbol resolution test to dynamic module check
620 STATIC_MODULES=
621 fi
622 if [ "$USE_DYNAMIC_MODULES" ] ; then
623 STATIC_MODULES=
624 RANLIB=
625 fi
626 if [ "$USE_STATIC_MODULES" ] ; then
627 RANLIB=
628 fi
629 if [ "x$USER_CC" != "x" -o "x$CC" = "x" ] ; then
630 # don't mix old flags and new compiler
631 CC_FLAGS=bonkle
632 CC_LFLAGS=bonkle
633 fi
634 fi
635
636 if [ "$OPT_SORTED_LISTS" != bonkle ] ; then
637 if [ "$OPT_SORTED_LISTS" = y ] ; then
638 SORTED_LISTS=1
639 else
640 SORTED_LISTS=0
641 fi
642 fi
643 if [ "$OPT_CLEAN_COMPILE" != bonkle ] ; then
644 if [ "$OPT_CLEAN_COMPILE" = y ] ; then
645 CLEAN_COMPILE=1
646 else
647 CLEAN_COMPILE=0
648 fi
649 fi
650 if [ "$OPT_DUMPCORE" != bonkle ] ; then
651 if [ "$OPT_DUMPCORE" = y ] ; then
652 DUMPCORE=1
653 else
654 DUMPCORE=0
655 fi
656 fi
657 if [ "$OPT_MEMCHECKS" != bonkle ] ; then
658 if [ "$OPT_MEMCHECKS" = y ] ; then
659 MEMCHECKS=1
660 else
661 MEMCHECKS=0
662 fi
663 fi
664 if [ "$OPT_SHOWALLOCS" != bonkle ] ; then
665 if [ "$OPT_SHOWALLOCS" = y ] ; then
666 SHOWALLOCS=1
667 else
668 SHOWALLOCS=0
669 fi
670 fi
671
672 ###########################################################################
673
674 # Determine installation directories.
675
676 default=""
677
678 if [ "$PREFIX" ] ; then
679 OPT_BINDEST="$PREFIX/sbin"
680 OPT_DATDEST="$PREFIX/lib/$PROGRAM"
681 else
682 if [ ! "$OPT_BINDEST" ] ; then
683 OPT_BINDEST="$BINDEST"
684 default=1
685 fi
686 if [ ! "$OPT_DATDEST" ] ; then
687 if [ "$default" ] ; then
688 OPT_DATDEST="$DATDEST"
689 else
690 if [ x`echo "$OPT_BINDEST" | grep -c '/\(sbin\|bin\)$'` = x1 ] ; then
691 OPT_DATDEST=`echo "$OPT_BINDEST" | sed 's,\(sbin\|bin\)$,lib/$PROGRAM,'`
692 else
693 OPT_DATDEST=`echo "$OPT_BINDEST" | sed s,/*$,,`/lib
694 fi
695 fi
696 fi
697 fi
698
699
700 BINDEST="$OPT_BINDEST"
701 echo "Executable (program) files will be installed in $BINDEST"
702 if exists "$BINDEST/services.h" ; then
703 echo "$BINDEST appears to contain a Services source code distribution; aborting."
704 exit 1
705 fi
706
707
708 DATDEST="$OPT_DATDEST"
709 echo "Data files will be installed in $DATDEST"
710 if exists "$DATDEST/services.h" ; then
711 echo "$DATDEST appears to contain a Services source code distribution; aborting."
712 exit 1
713 fi
714
715 ###########################################################################
716
717 # Set up log file for automated tests, so we have a clue what's going on if
718 # something dies.
719
720 exec 3>configure.log
721
722 MODE=" "
723 TEST=""
724 export MODE TEST
725
726 ###########################################################################
727
728 # Check whether we have a working "test FILE_A -nt FILE_B".
729
730 MODE="check_test_nt "
731 if [ "$TEST_NT" ] ; then
732 log "cache says $TEST_NT"
733 else
734 echo2 "Checking sanity of /bin/sh... "
735 touch $CONFTMP/file1
736 sleep 2 # just in case sleep 1 really does a sleep 0.997 or some such
737 touch $CONFTMP/file2
738 if run /bin/sh -c "test $CONFTMP/file2 -nt $CONFTMP/file1" ; then
739 TEST_NT=test
740 log "test works"
741 echo "high."
742 elif run /bin/test $CONFTMP/file2 -nt $CONFTMP/file1 ; then
743 TEST_NT=/bin/test
744 log "/bin/test works"
745 echo "medium."
746 elif run /usr/bin/test $CONFTMP/file2 -nt $CONFTMP/file1 ; then
747 TEST_NT=/usr/bin/test
748 log "/usr/bin/test works"
749 echo "medium."
750 else
751 log "neither test nor /bin/test nor /usr/bin/test work!"
752 echo "low."
753 echo " Warning: Compilation may fail unless you pass a saner shell to make:"
754 echo " make [or gmake] SHELL=/usr/local/bin/bash ..."
755 fi
756 fi
757
758 ###########################################################################
759
760 # Search for a compiler.
761
762 MODE="find_cc "
763 # Don't use the cached flags unless we use the cached compiler as well
764 CACHED_CC_FLAGS=$CC_FLAGS
765 CC_FLAGS=bonkle
766 echo2 "Searching for a suitable compiler... "
767 if [ "$USER_CC" ] ; then
768 CC="$USER_CC"
769 echo "(supplied) using $CC."
770 log user supplied \`"$CC'"
771 elif [ "$CC" ] ; then
772 echo "(cached) using $CC."
773 log cache supplied \`"$CC'"
774 CC_FLAGS=$CACHED_CC_FLAGS
775 elif run gcc --version ; then
776 version=`gcc --version 2>&1 | HEAD -1 | sed 's/[^0-9]*[^0-9.]\([0-9][0-9.]*\).*/\1/'`
777 vmajor=`echo "x.$version.0" | cut -d. -f2`
778 vminor=`echo "x.$version.0" | cut -d. -f3`
779 if test "x$version" = x || (echo "x$vmajor" | cut -c2- | grep '[^0-9]' >/dev/null 2>&1) || (echo "x$vminor" | cut -c2- | grep '[^0-9]' >/dev/null 2>&1) ; then
780 log "unparseable version string: $version"
781 cat <<EOT
782
783
784 *** WHOA THERE! ***
785
786 Unable to determine the version of GCC installed on your system. Please
787 make certain you are using an official GCC distribution. If you are
788 certain \`gcc' is the correct compiler on your system and it is a recent
789 version of GCC, re-run this script with the option \`-cc gcc' (or
790 \`--cc=gcc').
791
792 Configuration aborted.
793
794 EOT
795 exit 1
796 elif test $vmajor -lt 3 || test $vmajor = 3 -a $vminor -lt 2 ; then
797 cat <<EOT
798
799
800 *** WHOA THERE! ***
801
802 Your version of GCC was detected as \`$version'. As of Services 5.1,
803 versions of GCC earlier than 3.2 are no longer supported, as they do not
804 understand certain features of the C99 standard used by Services. Please
805 upgrade your compiler to GCC 3.2 or later.
806
807 Configuration aborted.
808
809 EOT
810 log "found \`gcc', but bad version: $version"
811 exit 1
812 else # version okay
813 echo "great, found gcc!"
814 log using \`gcc\'
815 CC=gcc
816 fi
817 else
818 echo "gcc not found."
819 echo2 " Looking for alternatives... "
820 echo >$CONFTMP/test.c "int main(){return 1;}"
821 if run icc $CONFTMP/test.c -o $CONFTMP/test ; then
822 CC=icc
823 elif run cc $CONFTMP/test.c -o $CONFTMP/test ; then
824 CC=cc
825 else
826 echo "no C compiler found!"
827 echo " Use the -cc command line option to specify your C compiler."
828 log "automatic tests failed"
829 exit 1
830 fi
831 # See if it handles ANSI.
832 cat >$CONFTMP/test.c <<EOT
833 int main(int argc, char **argv) {
834 extern void foo(int bar);
835 }
836 EOT
837 log "test for ANSI..."
838 if run $CC $CONFTMP/test.c -o $CONFTMP/test ; then
839 echo "using $CC."
840 if [ "x`def_cc_flags $CC`" = "x" -a "x$USER_CC_FLAGS" = "x" ] ; then
841 echo " Defaulting to no compiler flags. Use the -cflags option"
842 echo " if you need to specify any."
843 fi
844 log using \`"$CC'"
845 else
846 echo "found $CC, but it's not ANSI-compliant!"
847 echo " Use the -cc command line option to specify your C compiler."
848 log \`"$CC' not ANSI-compliant"
849 exit 1
850 fi
851 fi
852
853
854 # See whether compiler supports various C99 features.
855
856 log "test vararg macros..."
857 cat >$CONFTMP/test.c <<EOT
858 #define foo(a,...) int a() {printf("hello %s\n" , ##__VA_ARGS__); return 69;}
859 foo(main,"world")
860 EOT
861 if run $CC $CONFTMP/test.c -o $CONFTMP/test && (run $CONFTMP/test; test $? = 69) ; then
862 log "vararg macros ok."
863 else
864 log "vararg macros NG! Aborting."
865 cat <<EOT
866
867 *** WHOA THERE! ***
868
869 Your C compiler is not compliant with modern C standards. Services 5.1
870 requires a C compiler that understands the C99 standard, such as GCC
871 (version 3.2 or later).
872
873 Configuration aborted.
874
875 EOT
876 exit 1
877 fi
878
879 log "test va_copy..."
880 cat >$CONFTMP/test.c <<EOT
881 #include <stdarg.h>
882 void foo(int a,...) {
883 va_list args, args2;
884 va_start(args,a);
885 va_copy(args2, args);
886 va_end(args);
887 va_end(args2);
888 }
889 int main() {
890 foo(1,2);
891 return 0;
892 }
893 EOT
894 if run $CC $CONFTMP/test.c -o $CONFTMP/test && run $CONFTMP/test ; then
895 log "va_copy ok."
896 else
897 log "va_copy NG! Aborting."
898 cat <<EOT
899
900 *** WHOA THERE! ***
901
902 Your C compiler is not compliant with modern C standards. Services 5.1
903 requires a C compiler that understands the C99 standard, such as GCC
904 (version 3.2 or later).
905
906 Configuration aborted.
907
908 EOT
909 exit 1
910 fi
911
912
913 # Test compiler options.
914
915 MODE="find_ccopts "
916 if [ "$USER_CC_FLAGS" != bonkle ] ; then
917 CC_FLAGS="$USER_CC_FLAGS"
918 echo "Compiler flags supplied: $CC_FLAGS"
919 log user supplied flags: \`"$CC_FLAGS'"
920 elif [ "$CC_FLAGS" != bonkle ] ; then
921 echo "Compiler flags: (cached) $CC_FLAGS"
922 log cache supplied flags: \`"$CC_FLAGS'"
923 else
924
925 CC_FLAGS=`def_cc_flags $CC`
926
927 # Test for GCC stack-protector patch (generates broken code).
928 log "check for SSP"
929 cat >$CONFTMP/test.c <<EOT
930 void bar(int hogehoge) { printf("%d", hogehoge); }
931 void foo(int xyzzy) { __builtin_apply(bar,__builtin_apply_args(),64); }
932 int main(int ac, char **av) { foo(ac>1 ? 24 : 42); return 0; }
933 EOT
934 if run $CC $CC_FLAGS -fstack-protector $CONFTMP/test.c -o $CONFTMP/test
935 then
936 log "SSP present"
937 # See if the bug exists; if so, disable stack protection. Test
938 # twice just in case the bug exists but the stack happens to
939 # randomly contain 42.
940 a=`$CONFTMP/test`
941 b=`$CONFTMP/test x`
942 log "test results: a=[$a] b=[$b]"
943 if [ "$a" != 42 -o "$b" != 24 ] ; then
944 CC_FLAGS="$CC_FLAGS -fno-stack-protector"
945 log "SSP bug found, disabling"
946 else
947 log "SSP bug not detected"
948 fi
949 else
950 log "SSP not present"
951 fi
952
953 echo2 "Testing default compiler flags ($CC_FLAGS)... "
954 cat >$CONFTMP/test.c <<EOT
955 int main(int argc, char **argv) {
956 extern void foo(int bar);
957 }
958 EOT
959 if run $CC $CC_FLAGS -c $CONFTMP/test.c -o $CONFTMP/test.o ; then
960 echo "looks good."
961 else
962 echo "no luck! Using no flags."
963 echo " If you know what flags you want, use the -cflags option to configure."
964 CC_FLAGS=
965 fi
966 log using flags: \`"$CC_FLAGS'"
967 fi
968 # If -fstack-protector isn't disabled, test once more to make sure
969 # __builtin_apply() is working--but watch out for the __builtin_apply()
970 # bugs below, as well as http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20076
971 if ! echo "$CC_FLAGS" | grep_q fno-stack-protector ; then
972 log "-fstack-protector check"
973 cat >$CONFTMP/test.c <<EOT
974 #include <stdio.h>
975 #if defined(__sparc__)
976 # define APPLY __builtin_apply((void *)bar,__builtin_apply_args(),64); asm("ld [%sp-128],%i0")
977 #elif defined(__POWERPC__)
978 # define APPLY __builtin_apply((void *)bar,__builtin_apply_args(),64); asm("mr r0,r3")
979 #else
980 # define APPLY __builtin_return(__builtin_apply((void *)bar,__builtin_apply_args(),64))
981 #endif
982 int bar(int hogehoge) { return printf("%d", hogehoge); }
983 int foo(int xyzzy) { APPLY; }
984 int main(int ac, char **av) { printf(" %d",foo(ac>1?9:42)); return 0; }
985 EOT
986 if run $CC $CC_FLAGS -fno-inline-functions $CONFTMP/test.c -o $CONFTMP/test
987 then
988 run $CONFTMP/test # to get the output into the log file
989 a=`$CONFTMP/test`
990 b=`$CONFTMP/test x`
991 log "test results: a=[$a] b=[$b]"
992 if [ "$a" != "42 2" -o "$b" != "9 1" ] ; then
993 log "-fstack-protector check failed!"
994 cat <<EOT
995
996 *** WHOA THERE! ***
997
998 Your compiler is not compiling certain code correctly; this will result in
999 crashes when running Services. If you have specified compiler flags, please
1000 add "-fno-stack-protector" to the flags, or remove "-fstack-protector" if it
1001 is present. If this does not help, please reinstall or upgrade your
1002 compiler. See section 2-1 of the manual for details.
1003
1004 Configuration aborted.
1005
1006 EOT
1007 exit 1
1008 fi
1009 else
1010 # For whatever reason, the compilation failed; maybe the compiler
1011 # isn't a GCC flavor and doesn't understand -fno-inline-functions
1012 # or __builtin_apply(). Assume things are okay.
1013 log "-fstack-protector check compilation failed, ignoring"
1014 fi
1015 fi
1016
1017 ###########################################################################
1018
1019 # Check for the GCC __builtin_apply() and __builtin_return() bugs:
1020 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8028
1021 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11151
1022
1023 MODE="check_gcc_builtin "
1024
1025 # Check whether this is actually GCC--if it doesn't understand
1026 # __builtin_apply, then probably not.
1027 cat >$CONFTMP/test.c <<EOT
1028 int foo(int n)
1029 {
1030 return n;
1031 }
1032
1033 int bar(int n)
1034 {
1035 return n*n+1;
1036 }
1037
1038 int quux(int n)
1039 {
1040 foo(0);
1041 __builtin_return(__builtin_apply((void *)bar, __builtin_apply_args(), 64));
1042 }
1043
1044 int main(int argc, char **argv)
1045 {
1046 return quux(2)==5 && quux(3)==10 ? 0 : 1;
1047 }
1048 EOT
1049 # As with the SSP check, avoid Bugzilla bug 20076 with -fno-inline-functions
1050 if run $CC $CC_FLAGS -fno-inline-functions $CONFTMP/test.c -o $CONFTMP/test ; then
1051 log "checking for __builtin_apply()/__builtin_return() bugs"
1052 # This is GCC--see if it runs correctly.
1053 if run $CONFTMP/test ; then
1054 log "bugs not detected"
1055 else
1056 case `uname -m` in
1057 i?86|sparc|powerpc|"Power Macintosh")
1058 log "bugs detected, applying workaround"
1059 NEED_GCC3_HACK=1
1060 ;;
1061 *)
1062 cat <<EOT
1063
1064 *** WHOA THERE! ***
1065
1066 Your C compiler has a bug which causes Services to be compiled incorrectly,
1067 and no workaround is available for your hardware. Please try upgrading
1068 your compiler to the most recent version available (if you are using GCC,
1069 check http://gcc.gnu.org/ for the latest version). See FAQ B.1.5 for
1070 details.
1071
1072 Configuration aborted.
1073
1074 EOT
1075 exit 1
1076 ;;
1077 esac
1078 fi # if bug detected
1079 fi # if GCC
1080
1081 ###########################################################################
1082
1083 # Set linker flags.
1084
1085 MODE="find_lflags "
1086 if [ "$USER_CC_LFLAGS" != "bonkle" ] ; then
1087 CC_LFLAGS=$USER_CC_LFLAGS
1088 log user supplied \`"$CC_LFLAGS'"
1089 elif [ "$CC_LFLAGS" != "bonkle" ] ; then
1090 log cache supplied \`"$CC_LFLAGS'"
1091 else
1092 log using none
1093 CC_LFLAGS=""
1094 fi
1095
1096 ###########################################################################
1097
1098 # Find executable suffix.
1099
1100 MODE="find_exe_suffix "
1101 if [ "$OPT_OS2" ] ; then
1102 log "-os2 option given, using \`.exe'"
1103 EXE_SUFFIX=.exe
1104 else
1105 rm -f $CONFTMP/test $CONFTMP/test.exe
1106 echo >$CONFTMP/test.c "int main(){return 1;}"
1107 if run $CC $CC_FLAGS $CC_LFLAGS $CONFTMP/test.c -o $CONFTMP/test ; then
1108 if [ -f $CONFTMP/test.exe ] ; then
1109 log using .exe
1110 EXE_SUFFIX=.exe
1111 elif [ -f $CONFTMP/test ] ; then
1112 log using nothing
1113 EXE_SUFFIX=""
1114 else
1115 log "can't find executable, assuming nothing"
1116 EXE_SUFFIX=
1117 fi
1118 else
1119 log "can't link test program, assuming nothing"
1120 EXE_SUFFIX=
1121 fi
1122 fi
1123
1124 ###########################################################################
1125
1126 # See what libraries we have that we might need.
1127
1128 MODE="find_libs "
1129 echo2 "Let's see what libraries we need..."
1130 if [ "$CC_LIBS" != bonkle ] ; then
1131 if [ "$CC_LIBS" ] ; then
1132 echo " (cached) $CC_LIBS"
1133 else
1134 echo " (cached) none"
1135 fi
1136 log cache supplied \`"$CC_LIBS'"
1137 else
1138 CC_LIBS=
1139 HAVE_RESOLV=0
1140 cat >$CONFTMP/test.c <<EOT
1141 int main(int argc, char **argv) {
1142 extern void foo(int bar);
1143 }
1144 EOT
1145 cat >$CONFTMP/test-pow.c <<EOT
1146 int main(int argc, char **argv) {
1147 extern double pow(double, double);
1148 return pow(argc,argc);
1149 }
1150 EOT
1151 cat >$CONFTMP/test-socket.c <<EOT
1152 int main(int argc, char **argv) {
1153 extern void socket();
1154 socket();
1155 }
1156 EOT
1157 cat >$CONFTMP/test-gethost.c <<EOT
1158 int main(int argc, char **argv) {
1159 extern void gethostbyname();
1160 gethostbyname();
1161 }
1162 EOT
1163 cat >$CONFTMP/test-hstrerror.c <<EOT
1164 int main(int argc, char **argv) {
1165 extern void hstrerror();
1166 hstrerror();
1167 }
1168 EOT
1169 cat >$CONFTMP/test-crypt.c <<EOT
1170 int main(int argc, char **argv) {
1171 extern void crypt();
1172 crypt();
1173 }
1174 EOT
1175 if run $CC $CC_FLAGS $CONFTMP/test-pow.c $CC_LIBS -o $CONFTMP/test ; then
1176 :
1177 elif run $CC $CC_FLAGS $CONFTMP/test-pow.c $CC_LIBS -lm -o $CONFTMP/test ; then
1178 CC_LIBS="$CC_LIBS -lm"
1179 echo2 " -lm"
1180 fi
1181 if run $CC $CC_FLAGS $CONFTMP/test-socket.c $CC_LIBS -o $CONFTMP/test ; then
1182 :
1183 elif run $CC $CC_FLAGS $CONFTMP/test-socket.c $CC_LIBS -lsocket -o $CONFTMP/test ; then
1184 CC_LIBS="$CC_LIBS -lsocket"
1185 echo2 " -lsocket"
1186 fi
1187 if run $CC $CC_FLAGS $CONFTMP/test-gethost.c $CC_LIBS -o $CONFTMP/test ; then
1188 :
1189 elif run $CC $CC_FLAGS $CONFTMP/test-gethost.c $CC_LIBS -lresolv -o $CONFTMP/test ; then
1190 CC_LIBS="$CC_LIBS -lresolv"
1191 HAVE_RESOLV=1
1192 echo2 " -lresolv"
1193 elif run $CC $CC_FLAGS $CONFTMP/test-gethost.c $CC_LIBS -lnsl -o $CONFTMP/test ; then
1194 CC_LIBS="$CC_LIBS -lnsl"
1195 echo2 " -lnsl"
1196 elif run $CC $CC_FLAGS $CONFTMP/test-gethost.c $CC_LIBS -lnsl -lresolv -o $CONFTMP/test ; then
1197 CC_LIBS="$CC_LIBS -lnsl -lresolv"
1198 HAVE_RESOLV=1
1199 echo2 " -lnsl -lresolv"
1200 fi
1201 if [ $HAVE_RESOLV = 0 ] ; then
1202 if run $CC $CC_FLAGS $CONFTMP/test-hstrerror.c $CC_LIBS -o $CONFTMP/test ; then
1203 :
1204 elif run $CC $CC_FLAGS $CONFTMP/test-hstrerror.c $CC_LIBS -lresolv -o $CONFTMP/test ; then
1205 CC_LIBS="$CC_LIBS -lresolv"
1206 HAVE_RESOLV=1
1207 echo2 " -lresolv"
1208 fi
1209 fi
1210 if run $CC $CC_FLAGS $CONFTMP/test-crypt.c $CC_LIBS -o $CONFTMP/test ; then
1211 :
1212 elif run $CC $CC_FLAGS $CONFTMP/test-crypt.c $CC_LIBS -lcrypt -o $CONFTMP/test ; then
1213 CC_LIBS="$CC_LIBS -lcrypt"
1214 echo2 " -lcrypt"
1215 fi
1216 echo ""
1217 CC_LIBS="`echo $CC_LIBS | sed 's/^ *//'`"
1218 fi
1219 if [ "$USER_CC_LIBS" ] ; then
1220 CC_LIBS="$CC_LIBS $USER_CC_LIBS"
1221 echo "Additional user-supplied libraries: $USER_CC_LIBS"
1222 log user added \`"$USER_CC_LIBS'"
1223 fi
1224
1225 ###########################################################################
1226
1227 MODE="check_shared "
1228 if [ "$USE_STATIC_MODULES" ] ; then
1229 echo "Modules will be compiled statically (-use-static-modules option)."
1230 STATIC_MODULES=1
1231 CC_SHARED=
1232 CC_DYN_LFLAGS=
1233 CC_DYN_LIBS=
1234 log "static modules selected (-use-static-modules)"
1235 else
1236 echo2 "Checking whether we can use dynamic modules... "
1237 if [ "$STATIC_MODULES" = 0 ] ; then
1238 echo "(cached) yes."
1239 log "dynamic modules selected (cache)"
1240 elif [ "$STATIC_MODULES" = 1 ] ; then
1241 echo "(cached) no."
1242 log "static modules selected (cache)"
1243 else
1244 OK=
1245 dlfcn_ok=0
1246 if test_include dlfcn.h ; then
1247 dlfcn_ok=1
1248 else
1249 log "dlfcn.h not found, skipping dlfcn test"
1250 fi
1251 if [ $dlfcn_ok = 1 ] ; then
1252 log "testing dlfcn method"
1253 OK=ok
1254 cat >$CONFTMP/test-dlopen.c <<EOT
1255 #include <dlfcn.h>
1256 int main(int argc, char **argv) {
1257 void *lib1 = dlopen("$CONFTMP/test-lib.so",
1258 RTLD_NOW | RTLD_GLOBAL);
1259 void *lib2 = dlopen("$CONFTMP/test-lib2.so",
1260 RTLD_NOW | RTLD_GLOBAL);
1261 printf("%d %d %d\n", lib1 ? 1 : 0,
1262 lib2 ? (dlsym(lib2,"foo") ? 1 : 2) : 0,
1263 lib2 ? (dlsym(0,"foo") ? 1 : 2) : 0);
1264 if (lib1)
1265 dlclose(lib1);
1266 if (lib2)
1267 dlclose(lib2);
1268 return 0;
1269 }
1270 EOT
1271 cat >$CONFTMP/test-lib.c <<EOT
1272 int foo() {no_such_symbol();}
1273 EOT
1274 cat >$CONFTMP/test-lib2.c <<EOT
1275 int foo() {return 1;}
1276 EOT
1277 if run $CC $CC_FLAGS $CC_LIBS $CONFTMP/test-dlopen.c -o $CONFTMP/test ; then
1278 CC_DYN_LIBS=""
1279 log "dlopen() found (no libs)"
1280 elif run $CC $CC_FLAGS $CC_LIBS $CONFTMP/test-dlopen.c -ldl -o $CONFTMP/test
1281 then
1282 CC_DYN_LIBS=" -ldl"
1283 log "dlopen() found (libdl)"
1284 else
1285 log "dlopen() not found"
1286 OK=
1287 fi
1288 if [ "$OK" ] ; then
1289 if run $CC -rdynamic $CC_FLAGS $CC_LIBS $CC_DYN_LIBS $CONFTMP/test-dlopen.c -o $CONFTMP/test ; then
1290 log "-rdynamic works"
1291 CC_DYN_LFLAGS=" -rdynamic"
1292 else
1293 log "no -rdynamic, aborting dlfcn test"
1294 OK=
1295 fi
1296 fi
1297 if [ "$OK" ] ; then
1298 if [ "x`uname -s`" = "xOSF1" ] ; then
1299 CC_SHARED="$CC -shared -Wl,-expect_unresolved"
1300 else
1301 CC_SHARED="$CC -shared"
1302 fi
1303 if run $CC_SHARED $CC_FLAGS $CC_LIBS $CONFTMP/test-lib.c -o $CONFTMP/test-lib.so && run $CC_SHARED $CC_FLAGS $CC_LIBS $CONFTMP/test-lib2.c -o $CONFTMP/test-lib2.so ; then
1304 log "-shared works"
1305 else
1306 log "no -shared, aborting dlfcn test"
1307 CC_SHARED=
1308 OK=
1309 fi
1310 fi
1311 if [ "$OK" ] ; then
1312 if run $CONFTMP/test ; then
1313 a=`$CONFTMP/test 2>/dev/null`
1314 log "symbol resolution test: $CONFTMP/test => $a"
1315 if [ "x$a" = "x0 1 1" ] ; then
1316 log "symbol resolution test succeeded"
1317 else
1318 log "symbol resolution test failed"
1319 OK=
1320 fi
1321 else
1322 log "couldn't run symbol resolution test program"
1323 OK=
1324 fi
1325 fi
1326 if [ "$OK" ] ; then
1327 cat >$CONFTMP/test-dynamic2.c <<EOT
1328 #include <stdio.h>
1329 int main(int argc, char **argv) {
1330 printf("%d\n", foo(atoi(argv[1])));
1331 }
1332 int quux(int xyzzy) {
1333 return xyzzy+1;
1334 }
1335 EOT
1336 cat >$CONFTMP/test-dynamic.c <<EOT
1337 int foo(int bar) {
1338 return quux(bar)*2;
1339 }
1340 EOT
1341 if run $CC_SHARED $CC_FLAGS $CC_LIBS $CONFTMP/test-dynamic.c -o $CONFTMP/test.so \
1342 && run $CC $CC_FLAGS $CC_DYN_LFLAGS $CC_LIBS $CC_DYN_LIBS $CONFTMP/test-dynamic2.c $CONFTMP/test.so -o $CONFTMP/test
1343 then
1344 a=`$CONFTMP/test 1`
1345 log "symbol resolution test: $CONFTMP/test 1 => $a"
1346 if [ "x$a" = "x4" ] ; then
1347 log "symbol resolution test: succeeded => using dynamic modules (dlfcn)"
1348 else
1349 log "symbol resolution test: bad output (expected 4)"
1350 OK=
1351 fi
1352 else
1353 log "symbol resolution test: dynamic compile failed"
1354 OK=
1355 fi
1356 fi
1357 fi # dlfcn test
1358 if [ "$OK" ] ; then
1359 log "checking for underscores in symbols"
1360 cat >$CONFTMP/test-dynamic2.c <<EOT
1361 #include <stdio.h>
1362 #include <dlfcn.h>
1363 int main(int argc, char **argv) {
1364 void *handle = dlopen(NULL, 0);
1365 printf("%d%d\n", dlsym(handle,"foo")!=NULL ? 1 : 0,
1366 dlsym(handle,"_foo")!=NULL ? 1 : 0);
1367 return 0;
1368 }
1369 int quux(int x) {return x;}
1370 EOT
1371 if run $CC $CC_FLAGS $CC_DYN_LFLAGS $CC_LIBS $CC_DYN_LIBS $CONFTMP/test-dynamic2.c $CONFTMP/test.so -o $CONFTMP/test
1372 then
1373 a=`$CONFTMP/test`
1374 log "underscore test: $CONFTMP/test => $a"
1375 with_underscore=`echo "$a" | cut -c2`
1376 without_underscore=`echo "$a" | cut -c1`
1377 if [ "x$with_underscore" = "x1" ] ; then
1378 log "underscore test: succeeded with preceding underscore"
1379 SYMS_NEED_UNDERSCORES=1
1380 elif [ "x$without_underscore" = "x1" ] ; then
1381 log "underscore test: succeeded with no preceding underscore"
1382 SYMS_NEED_UNDERSCORES=0
1383 else
1384 log "underscore test: failed?! (bizarre output)"
1385 OK=
1386 fi
1387 else
1388 log "underscore test: dynamic compile failed"
1389 OK=
1390 fi
1391 fi # underscore test
1392 if [ "$OK" ] ; then
1393 echo "yes."
1394 STATIC_MODULES=0
1395 else
1396 log "static modules selected"
1397 echo "no."
1398 STATIC_MODULES=1
1399 CC_SHARED=
1400 CC_DYN_LFLAGS=
1401 CC_DYN_LIBS=
1402 SYMS_NEED_UNDERSCORES=
1403 fi
1404 fi
1405 fi
1406
1407 # Also check for ranlib, and use it if found.
1408 MODE="check_ranlib "
1409 echo2 "Checking whether ranlib exists... "
1410 if [ "$RANLIB" ] ; then
1411 if [ "x$RANLIB" = xranlib ] ; then
1412 log "cache says yes"
1413 echo "(cached) yes."
1414 else
1415 log "cache says no"
1416 echo "(cached) no."
1417 fi
1418 else
1419 if run echo test >$CONFTMP/testfile ; then : ; else
1420 log "couldn't create temp file!"
1421 echo ""
1422 echo ""
1423 echo "*** WHOA THERE! ***"
1424 echo ""
1425 echo "Unable to create a temporary file!"
1426 echo "Are you out of disk space?"
1427 exit 4
1428 fi
1429 if run ar -rc $CONFTMP/test.a $CONFTMP/testfile ; then
1430 if run ranlib $CONFTMP/test.a ; then
1431 log "ranlib found"
1432 RANLIB=ranlib
1433 echo "yes."
1434 else
1435 log "ranlib not found"
1436 RANLIB='echo >/dev/null'
1437 echo "no."
1438 fi
1439 else # no ar
1440 log "couldn't run ar!"
1441 if [ $STATIC_MODULES = 1 ] ; then
1442 echo ""
1443 cat <<EOT
1444
1445 *** WHOA THERE! ***
1446
1447 The \`ar' program could not be executed. This program is needed to
1448 compile Services, and is installed on most systems by default; make
1449 certain it is in your executable search path (for example, Solaris users
1450 may need to add /usr/ccs/bin to the search path) and re-run this script.
1451
1452 Configuration aborted.
1453
1454 EOT
1455 exit 4
1456 else
1457 log "ar not found, assuming no ranlib"
1458 RANLIB='echo >/dev/null'
1459 echo "no."
1460 cat <<EOT
1461
1462 NOTICE: The \`ar' command was not found on your system. This is not an
1463 immediate problem, but it will prevent you from compiling
1464 Services using static modules. Please check and make certain
1465 your executable search path is correct.
1466
1467 EOT
1468 fi
1469 fi
1470 fi
1471
1472 ###########################################################################
1473
1474 # Look for include files that might or might not be here.
1475 echo "Checking for presence of include files (it's okay if some aren't there):"
1476
1477 MODE="check_stdint "
1478 echo2 " stdint.h... "
1479 if [ "$HAVE_STDINT_H" ] ; then
1480 if [ "$HAVE_STDINT_H" = 1 ] ; then
1481 echo "(cached) present"
1482 log "cache says present"
1483 else
1484 echo "(cached) not present"
1485 log "cache says not present"
1486 fi
1487 else
1488 if test_include stdint.h ; then
1489 echo "present"
1490 else
1491 echo "not present"
1492 fi
1493 fi
1494
1495 MODE="check_strings "
1496 echo2 " strings.h... "
1497 if [ "$HAVE_STRINGS_H" ] ; then
1498 if [ "$HAVE_STRINGS_H" = 1 ] ; then
1499 echo "(cached) present"
1500 log "cache says present"
1501 else
1502 echo "(cached) not present"
1503 log "cache says not present"
1504 fi
1505 else
1506 if test_include strings.h ; then
1507 echo "present"
1508 else
1509 echo "not present"
1510 fi
1511 fi
1512
1513 MODE="check_sysselect "
1514 echo2 " sys/select.h... "
1515 if [ "$HAVE_SYS_SELECT_H" ] ; then
1516 if [ "$HAVE_SYS_SELECT_H" = 1 ] ; then
1517 echo "(cached) present"
1518 log "cache says present"
1519 else
1520 echo "(cached) not present"
1521 log "cache says not present"
1522 fi
1523 else
1524 if test_include sys/select.h ; then
1525 echo "present"
1526 else
1527 echo "not present"
1528 fi
1529 fi
1530
1531 MODE="check_sysproto "
1532 echo2 " sys/sysproto.h... "
1533 if [ "$HAVE_SYS_SYSPROTO_H" ] ; then
1534 if [ "$HAVE_SYS_SYSPROTO_H" = 1 ] ; then
1535 echo "(cached) present"
1536 log "cache says present"
1537 else
1538 echo "(cached) not present"
1539 log "cache says not present"
1540 fi
1541 else
1542 if test_include sys/sysproto.h ; then
1543 echo "present"
1544 else
1545 echo "not present"
1546 fi
1547 fi
1548
1549 ###########################################################################
1550
1551 # See what sizes various types are.
1552
1553 MODE="check_int8 "
1554 echo2 "Looking for an 8-bit integer type... "
1555 if [ "$TYPE_INT8" ] ; then
1556 echo "(cached) $TYPE_INT8"
1557 log "cache supplied $TYPE_INT8"
1558 else
1559 if [ "$HAVE_STDINT_H" = 1 ] ; then
1560 cat >$CONFTMP/test.c <<EOT
1561 #include <stdint.h>
1562 #include <stdio.h>
1563 int main() {
1564 char a;
1565 int8_t b;
1566 printf("%d,%d", sizeof(a), sizeof(b));
1567 return 0;
1568 }
1569 EOT
1570 else
1571 cat >$CONFTMP/test.c <<EOT
1572 #include <stdio.h>
1573 int main() {
1574 char a;
1575 printf("%d,0", sizeof(a));
1576 return 0;
1577 }
1578 EOT
1579 fi
1580 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
1581 a="`$CONFTMP/test`"
1582 log "test program output (sizeof(char),sizeof(int8_t)): $a"
1583 b=`echo "$a" | cut -d, -f1`
1584 c=`echo "$a" | cut -d, -f2`
1585 if [ ! "$a" ] ; then
1586 echo "test program failed! Assuming char."
1587 log "assuming char"
1588 TYPE_INT8=char
1589 elif [ "$c" = 1 ] ; then
1590 echo int8_t
1591 log "int8_t is 8 bits"
1592 TYPE_INT8=int8_t
1593 elif [ "$b" = 1 ] ; then
1594 echo char
1595 log "char is 8 bits"
1596 TYPE_INT8=char
1597 else
1598 cat >$CONFTMP/test.c <<EOT
1599 #include <stdio.h>
1600 int main() {
1601 byte a;
1602 printf("%d", sizeof(a));
1603 return 0;
1604 }
1605 EOT
1606 if run $CC $CC_FLAGS $CONFTMP/tset.c $CC_LIBS -o $CONFTMP/test ; then
1607 a="`$CONFTMP/test`"
1608 log "test program 2 output (sizeof(byte)): $a"
1609 if [ "$a" = 1 ] ; then
1610 echo byte
1611 log "byte is 8 bits"
1612 TYPE_INT8=byte
1613 fi
1614 else
1615 log "couldn't compile test program 2, assuming no byte type"
1616 fi
1617 if [ ! "$TYPE_INT8" ] ; then
1618 echo "none found?!"
1619 cat <<EOF
1620 Services requires an 8-bit integer type. Please check your system
1621 configuration.
1622
1623 Configuration aborted.
1624
1625 EOF
1626 exit 1
1627 fi
1628 fi
1629 else
1630 whoa_there
1631 fi
1632 fi
1633
1634 MODE="check_int16 "
1635 echo2 "Looking for a 16-bit integer type... "
1636 if [ "$TYPE_INT16" ] ; then
1637 echo "(cached) $TYPE_INT16"
1638 log "cache supplied $TYPE_INT16"
1639 else
1640 if [ "$HAVE_STDINT_H" = 1 ] ; then
1641 cat >$CONFTMP/test.c <<EOT
1642 #include <stdint.h>
1643 #include <stdio.h>
1644 int main() {
1645 int a;
1646 short b;
1647 int16_t c;
1648 printf("%d,%d,%d", sizeof(a), sizeof(b), sizeof(c));
1649 return 0;
1650 }
1651 EOT
1652 else
1653 cat >$CONFTMP/test.c <<EOT
1654 #include <stdio.h>
1655 int main() {
1656 int a;
1657 short b;
1658 printf("%d,%d,0", sizeof(a), sizeof(b));
1659 return 0;
1660 }
1661 EOT
1662 fi
1663 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
1664 a="`$CONFTMP/test`"
1665 log "test program output (sizeof(int),sizeof(short),sizeof(int16_t)): $a"
1666 if [ ! "$a" ] ; then
1667 echo "test program failed! Assuming short."
1668 log "assuming short"
1669 TYPE_INT16=short
1670 else
1671 size_int=`echo $a | cut -d, -f1`
1672 size_short=`echo $a | cut -d, -f2`
1673 size_int16_t=`echo $a | cut -d, -f3`
1674 if [ "$size_int16_t" = 2 ] ; then
1675 echo int16_t
1676 log "int16_t is 16 bits"
1677 TYPE_INT16=int16_t
1678 elif [ $size_int = 2 ] ; then
1679 echo int
1680 log "int is 16 bits"
1681 TYPE_INT16=int
1682 elif [ $size_short = 2 ] ; then
1683 echo short
1684 log "short is 16 bits"
1685 TYPE_INT16=short
1686 else
1687 echo "none found?!"
1688 cat <<EOF
1689 Services requires a 16-bit integer type. Please check your system
1690 configuration.
1691
1692 Configuration aborted.
1693
1694 EOF
1695 exit 1
1696 fi
1697 fi
1698 else
1699 whoa_there
1700 fi
1701 fi
1702
1703 MODE="check_int32 "
1704 echo2 "Looking for a 32-bit integer type... "
1705 if [ "$TYPE_INT32" ] ; then
1706 echo "(cached) $TYPE_INT32"
1707 log "cache supplied $TYPE_INT32"
1708 else
1709 if [ "$HAVE_STDINT_H" = 1 ] ; then
1710 cat >$CONFTMP/test.c <<EOT
1711 #include <stdint.h>
1712 #include <stdio.h>
1713 int main() {
1714 int a;
1715 long b;
1716 int32_t c;
1717 printf("%d,%d,%d", sizeof(a), sizeof(b), sizeof(c));
1718 return 0;
1719 }
1720 EOT
1721 else
1722 cat >$CONFTMP/test.c <<EOT
1723 #include <stdio.h>
1724 int main() {
1725 int a;
1726 long b;
1727 printf("%d,%d,0", sizeof(a), sizeof(b));
1728 return 0;
1729 }
1730 EOT
1731 fi
1732 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
1733 a="`$CONFTMP/test`"
1734 log "test program output (sizeof(int),sizeof(long),sizeof(int32_t)): $a"
1735 if [ ! "$a" ] ; then
1736 echo "test program failed! Assuming long."
1737 log "assuming long"
1738 TYPE_INT32=long
1739 else
1740 size_int=`echo $a | cut -d, -f1`
1741 size_long=`echo $a | cut -d, -f2`
1742 size_int32_t=`echo $a | cut -d, -f3`
1743 if [ "$size_int32_t" = 4 ] ; then
1744 echo int32_t
1745 log "int32_t is 32 bits"
1746 TYPE_INT32=int32_t
1747 elif [ $size_int = 4 ] ; then
1748 echo int
1749 log "int is 32 bits"
1750 TYPE_INT32=int
1751 elif [ $size_long = 4 ] ; then
1752 echo long
1753 log "long is 32 bits"
1754 TYPE_INT32=long
1755 else
1756 echo "none found?!"
1757 cat <<EOF
1758 Services requires a 32-bit integer type. Please check your system
1759 configuration.
1760
1761 Configuration aborted.
1762
1763 EOF
1764 exit 1
1765 fi
1766 fi
1767 else
1768 whoa_there
1769 fi
1770 fi
1771
1772 MODE="check_int64 "
1773 echo2 "Looking for a 64-bit integer type... "
1774 if [ "$TYPE_INT64" ] ; then
1775 echo "(cached) $TYPE_INT64"
1776 log "cache supplied $TYPE_INT64"
1777 else
1778 ran=0
1779 if [ "$HAVE_STDINT_H" = 1 ] ; then
1780 cat >$CONFTMP/test.c <<EOT
1781 #include <stdint.h>
1782 #include <stdio.h>
1783 int main() {
1784 long a;
1785 long long b;
1786 int64_t c;
1787 printf("%d,%d,%d", sizeof(a), sizeof(b), sizeof(c));
1788 return 0;
1789 }
1790 EOT
1791 else
1792 cat >$CONFTMP/test.c <<EOT
1793 #include <stdio.h>
1794 int main() {
1795 long a;
1796 long long b;
1797 printf("%d,%d,0", sizeof(a), sizeof(b));
1798 return 0;
1799 }
1800 EOT
1801 fi
1802 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
1803 ran=1
1804 else
1805 if [ "$HAVE_STDINT_H" = 1 ] ; then
1806 cat >$CONFTMP/test.c <<EOT
1807 #include <stdint.h>
1808 #include <stdio.h>
1809 int main() {
1810 long a;
1811 int64_t c;
1812 printf("%d,0,%d", sizeof(a), sizeof(c));
1813 return 0;
1814 }
1815 EOT
1816 else
1817 cat >$CONFTMP/test.c <<EOT
1818 #include <stdio.h>
1819 int main() {
1820 long a;
1821 printf("%d,0,0", sizeof(a));
1822 return 0;
1823 }
1824 EOT
1825 fi
1826 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
1827 ran=1
1828 fi
1829 fi
1830 if test $ran = 1 ; then
1831 a="`$CONFTMP/test`"
1832 log "test program output (sizeof(long),sizeof(long long),sizeof(int64_t)): $a"
1833 if [ ! "$a" ] ; then
1834 echo "test program failed! Assuming long long."
1835 log "assuming long long"
1836 TYPE_INT64="long long"
1837 else
1838 size_long=`echo $a | cut -d, -f1`
1839 size_long_long=`echo $a | cut -d, -f2`
1840 size_int64_t=`echo $a | cut -d, -f3`
1841 if [ "$size_int64_t" = 8 ] ; then
1842 echo int64_t
1843 log "int64_t is 64 bits"
1844 TYPE_INT64=int64_t
1845 elif [ $size_long = 8 ] ; then
1846 echo long
1847 log "long is 64 bits"
1848 TYPE_INT64=long
1849 elif [ $size_long_long = 8 ] ; then
1850 echo "long long"
1851 log "long long is 64 bits"
1852 TYPE_INT64="long long"
1853 else
1854 echo "none found?!"
1855 cat <<EOF
1856 Services requires a 64-bit integer type. Please check your system
1857 configuration.
1858
1859 Configuration aborted.
1860
1861 EOF
1862 exit 1
1863 fi
1864 fi
1865 else
1866 whoa_there
1867 fi
1868 fi
1869
1870 MODE="check_int_size "
1871 echo2 "Checking the size of int... "
1872 if [ "$SIZEOF_INT" ] ; then
1873 echo "(cached) `expr $SIZEOF_INT \* 8` bits"
1874 log "cache supplied `expr $SIZEOF_INT \* 8` bits"
1875 else
1876 cat >$CONFTMP/test.c <<EOT
1877 #include <stdio.h>
1878 int main() {
1879 int a = 0;
1880 printf("%d", sizeof(a));
1881 return 0;
1882 }
1883 EOT
1884 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
1885 a="`$CONFTMP/test`"
1886 log "test program output (sizeof(int)): $a"
1887 if [ ! "$a" ] ; then
1888 echo "test program failed! Assuming 16 bits."
1889 log "assuming 16 bits"
1890 SIZEOF_INT=2
1891 else
1892 SIZEOF_INT="$a"
1893 if [ $SIZEOF_INT -lt 2 ] ; then
1894 echo "`expr $SIZEOF_INT \* 8` bits... huh?"
1895 cat <<EOF
1896 \`int' must be at least 16 bits. Please check your compiler
1897 settings.
1898
1899 Configuration aborted.
1900
1901 EOF
1902 exit 1
1903 else
1904 echo `expr $SIZEOF_INT \* 8` bits
1905 log "`expr $SIZEOF_INT \* 8` bits"
1906 fi
1907 fi
1908 else
1909 whoa_there
1910 fi
1911 fi
1912
1913 MODE="check_long_size "
1914 echo2 "Checking the size of long... "
1915 if [ "$SIZEOF_LONG" ] ; then
1916 echo "(cached) `expr $SIZEOF_LONG \* 8` bits"
1917 log "cache supplied `expr $SIZEOF_LONG \* 8` bits"
1918 else
1919 cat >$CONFTMP/test.c <<EOT
1920 #include <stdio.h>
1921 int main() {
1922 long a = 0;
1923 printf("%d", sizeof(a));
1924 return 0;
1925 }
1926 EOT
1927 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
1928 a="`$CONFTMP/test`"
1929 log "test program output (sizeof(long)): $a"
1930 if [ ! "$a" ] ; then
1931 echo "test program failed! Assuming 32 bits."
1932 log "assuming 32 bits"
1933 SIZEOF_LONG=4
1934 else
1935 SIZEOF_LONG="$a"
1936 if [ $SIZEOF_LONG -lt 4 ] ; then
1937 echo "`expr $SIZEOF_LONG \* 8` bits... huh?"
1938 cat <<EOF
1939 \`long' must be at least 32 bits. Please check your compiler
1940 settings.
1941
1942 Configuration aborted.
1943
1944 EOF
1945 exit 1
1946 else
1947 echo `expr $SIZEOF_LONG \* 8` bits
1948 log "`expr $SIZEOF_LONG \* 8` bits"
1949 fi
1950 fi
1951 else
1952 whoa_there
1953 fi
1954 fi
1955
1956 MODE="check_ptr_size "
1957 echo2 "Checking the size of pointers... "
1958 if [ "$SIZEOF_PTR" ] ; then
1959 echo "(cached) `expr $SIZEOF_PTR \* 8` bits"
1960 log "cache supplied `expr $SIZEOF_PTR \* 8` bits"
1961 else
1962 cat >$CONFTMP/test.c <<EOT
1963 #include <stdio.h>
1964 int main() {
1965 void *a = 0;
1966 printf("%d", sizeof(a));
1967 return 0;
1968 }
1969 EOT
1970 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
1971 a="`$CONFTMP/test`"
1972 log "test program output (sizeof(void *)): $a"
1973 if [ ! "$a" ] ; then
1974 echo "test program failed! Assuming 32 bits."
1975 log "assuming 32 bits"
1976 SIZEOF_PTR=4
1977 else
1978 SIZEOF_PTR="$a"
1979 if [ $SIZEOF_PTR -lt $SIZEOF_INT ] ; then
1980 echo "`expr $SIZEOF_PTR \* 8` bits... oops!"
1981 cat <<EOF
1982 Your compiler has a pointer type smaller than its integer type!
1983 This may cause problems compiling or running Services. Please check
1984 your compiler settings.
1985
1986 Configuration aborted.
1987
1988 EOF
1989 exit 1
1990 else
1991 echo `expr $SIZEOF_PTR \* 8` bits
1992 log "`expr $SIZEOF_PTR \* 8` bits"
1993 fi
1994 fi
1995 else
1996 whoa_there
1997 fi
1998 fi
1999
2000 MODE="check_time_t "
2001 echo2 "Checking the size of time_t... "
2002 if [ "$SIZEOF_TIME_T" -a "$MAX_TIME_T" ] ; then
2003 echo "(cached) `expr $SIZEOF_TIME_T \* 8` bits"
2004 log "cache supplied `expr $SIZEOF_TIME_T \* 8` bits, max $MAX_TIME_T"
2005 else
2006 cat >$CONFTMP/test.c <<EOT
2007 #include <stdio.h>
2008 #include <time.h>
2009 int main() {
2010 time_t a = 0;
2011 printf("%d ", sizeof(a));
2012 if (a-1 > 0)
2013 printf("(~(time_t)0)");
2014 else
2015 printf("(((time_t)1<<(sizeof(time_t)*8-2))+(((time_t)1<<(sizeof(time_t)*8-2))-1))");
2016 return 0;
2017 }
2018 EOT
2019 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
2020 a="`$CONFTMP/test`"
2021 log "test program output (sizeof(time_t) MAX_TIME_T): $a"
2022 if [ ! "$a" ] ; then
2023 echo "test program failed! Assuming 32 bits."
2024 log "assuming 32 bits"
2025 SIZEOF_TIME_T=4
2026 else
2027 SIZEOF_TIME_T=`echo "$a" | cut -d\ -f1`
2028 MAX_TIME_T=`echo "$a" | cut -d\ -f2`
2029 if [ $SIZEOF_TIME_T = 4 ] ; then
2030 echo 32 bits
2031 log "32 bits"
2032 elif [ $SIZEOF_TIME_T = 8 ] ; then
2033 echo "64 bits (nifty!)"
2034 log "64 bits"
2035 elif [ $SIZEOF_TIME_T -gt 4 ] ; then
2036 echo "`expr $SIZEOF_TIME_T \* 8` bits... huh?"
2037 echo " If you experience any problems compiling or running Services, please"
2038 echo " report this."
2039 log "`expr $SIZEOF_TIME_T \* 8` bits"
2040 else
2041 echo "`expr $SIZEOF_TIME_T \* 8` bits... huh?"
2042 cat <<EOT
2043 Services requires a \`time_t' of at least 32 bits. Please check your
2044 system configuration.
2045
2046 Configuration aborted.
2047
2048 EOT
2049 log "`expr $SIZEOF_TIME_T \* 8` bits -- too small, aborting"
2050 exit 1
2051 fi
2052 fi
2053 else
2054 whoa_there
2055 fi
2056 fi
2057
2058 MODE="check_gid_t "
2059 echo2 "Checking the size of gid_t... "
2060 if [ "$SIZEOF_GID_T" != bonkle ] ; then
2061 if [ "$SIZEOF_GID_T" ] ; then
2062 echo "(cached) `expr $SIZEOF_GID_T \* 8` bits"
2063 log "cache supplied `expr $SIZEOF_GID_T \* 8` bits"
2064 else
2065 echo "(cached) no gid_t"
2066 log "cache said no gid_t"
2067 fi
2068 else
2069 cat >$CONFTMP/test.c <<EOT
2070 #include <stdio.h>
2071 #include <sys/types.h>
2072 int main() {
2073 gid_t a;
2074 printf("%d", sizeof(a));
2075 return 0;
2076 }
2077 EOT
2078 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
2079 a="`$CONFTMP/test`"
2080 log "test program output (sizeof(gid_t)): $a"
2081 if [ ! "$a" ] ; then
2082 echo "test program failed! Assuming 16 bits."
2083 log "assuming 16 bits"
2084 SIZEOF_GID_T=2
2085 else
2086 SIZEOF_GID_T=$a
2087 if [ $SIZEOF_GID_T = 4 ] ; then
2088 echo 32 bits
2089 log "32 bits"
2090 elif [ $SIZEOF_GID_T = 2 ] ; then
2091 echo "16 bits"
2092 log "16 bits"
2093 else
2094 echo "`expr $SIZEOF_GID_T \* 8` bits... huh?"
2095 echo " If you experience any problems compiling or running Services, please"
2096 echo " report this."
2097 log "`expr $SIZEOF_GID_T \* 8` bits"
2098 fi
2099 fi
2100 else
2101 echo "no gid_t found."
2102 log "couldn't compile test program, assuming no gid_t"
2103 SIZEOF_GID_T=
2104 HAVE_SETREGID=0
2105 fi
2106 fi
2107
2108 MODE="check_socklen_t "
2109 echo2 "Checking for socklen_t... "
2110 if [ "$HAVE_SOCKLEN_T" ] ; then
2111 if [ $HAVE_SOCKLEN_T = 1 ] ; then
2112 echo "(cached) present."
2113 log "cache said present"
2114 else
2115 echo "(cached) not present."
2116 log "cache said not present"
2117 fi
2118 else
2119 cat >$CONFTMP/test.c <<EOT
2120 #include <unistd.h>
2121 #include <sys/socket.h>
2122 int main() {
2123 socklen_t a;
2124 return 0;
2125 }
2126 EOT
2127 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
2128 log "socklen_t found"
2129 echo "present."
2130 HAVE_SOCKLEN_T=1
2131 else
2132 log "socklen_t not found"
2133 echo "not present."
2134 HAVE_SOCKLEN_T=0
2135 fi
2136 fi
2137
2138 ###########################################################################
2139
2140 # AIX workaround.
2141
2142 MODE="check_aix_intNN "
2143 echo2 "Seeing if your system defines int16/int32... "
2144 res="`run egrep int16\|int32 /usr/include/sys/systypes.h`"
2145 if [ "$res" ] ; then
2146 echo "found."
2147 echo " (This is bad, but we can work around it.)"
2148 log "int16/int32 types found, enabling workaround"
2149 INTTYPE_WORKAROUND=1
2150 else
2151 echo "not found (this is good)."
2152 log "int16/int32 types not found"
2153 INTTYPE_WORKAROUND=0
2154 fi
2155
2156 ###########################################################################
2157
2158 # Look for missing/broken built-in routines, and similar compatibility
2159 # stuff.
2160
2161 MODE="check_strerror "
2162 if [ "$USE_LOCAL_FUNCS" ] ; then
2163 log "not checking (-use-local-funcs)"
2164 echo "Not checking for presence of strerror (-use-local-funcs specified)."
2165 HAVE_STRERROR=0
2166 HAVE_SYS_ERRLIST=0
2167 else
2168 echo2 "How to complain when something goes wrong... "
2169 if [ "$HAVE_STRERROR" ] ; then
2170 if [ "$HAVE_STRERROR" = 1 ] ; then
2171 echo "(cached) strerror()."
2172 log "cache supplied strerror()"
2173 elif [ "$HAVE_SYS_ERRLIST" = 1 ] ; then
2174 echo "(cached) sys_errlist."
2175 log "cache supplied sys_errlist"
2176 else
2177 HAVE_SYS_ERRLIST=0 # just in case... you never know.
2178 echo "(cached) pseudo sys_errlist."
2179 log "cache supplied pseudo sys_errlist"
2180 fi
2181 else
2182 cat >$CONFTMP/test.c <<EOT
2183 int main() {
2184 extern void strerror(void);
2185 strerror();
2186 }
2187 EOT
2188 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
2189 HAVE_STRERROR=1
2190 echo "ah, strerror() is here."
2191 log "using strerror()"
2192 else
2193 HAVE_STRERROR=0
2194 echo "no strerror()."
2195 cat >$CONFTMP/test.c <<EOT
2196 int main() {
2197 extern char *sys_errlist[];
2198 char *s;
2199 s = sys_errlist[0];
2200 }
2201 EOT
2202 log "trying sys_errlist..."
2203 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
2204 HAVE_SYS_ERRLIST=1
2205 echo " But you have sys_errlist, which will do nicely."
2206 log "using sys_errlist"
2207 else
2208 HAVE_SYS_ERRLIST=0
2209 echo " You don't have sys_errlist either, so we'll have to make do."
2210 log "using pseudo sys_errlist"
2211 fi
2212 fi
2213 fi
2214 fi # -use-local-funcs
2215
2216
2217 MODE="check_compat "
2218
2219 if [ "$USE_LOCAL_FUNCS" ] ; then
2220 echo "Enabling compatibility functions: hstrerror snprintf strtok str[n]icmp strdup str[c]spn strsignal"
2221 HAVE_HSTRERROR=0
2222 HAVE_SNPRINTF=0
2223 BAD_SNPRINTF=0
2224 HAVE_STRTOK=0
2225 HAVE_STRICMP=0
2226 HAVE_STRCASECMP=0
2227 HAVE_STRDUP=0
2228 HAVE_STRSPN=0
2229 HAVE_STRSIGNAL=0
2230 fi
2231
2232 echo2 "Looking for other functions we want that you don't have... "
2233
2234 if [ "$MISSING" != bonkle -a ! "$USE_LOCAL_FUNCS" ] ; then
2235 if [ ! "$MISSING" ] ; then
2236 echo "(cached) none"
2237 log "cache supplied: (none)"
2238 else
2239 echo "(cached)$MISSING"
2240 log "cache supplied:$MISSING"
2241 fi
2242 else
2243
2244 if [ "$USE_LOCAL_FUNCS" ] ; then
2245
2246 MISSING=" hstrerror snprintf strtok str[n]icmp strdup str[c]spn strsignal"
2247
2248 else
2249
2250 MISSING=
2251
2252 MODE="check_hstrerror "
2253 TEST="(void) hstrerror(1); return 0;"
2254 if test_function "const char *" hstrerror "(int)" ; then : ; else
2255 MISSING="$MISSING hstrerror"
2256 echo2 "hstrerror "
2257 fi
2258
2259 MODE="check_snprintf "
2260 TEST=' extern int printf(const char *, ...);
2261 extern unsigned int strlen(const char *);
2262 char buf[16];
2263 int res;
2264 buf[0] = 0;
2265 res = snprintf(buf, 8, "%d", 123456789);
2266 if (strcmp(buf, "1234567") != 0) {
2267 printf("test: snprintf broken (bad result in buffer: wanted 1234567, got \"%s\")\n", buf);
2268 if (strlen(buf) > 7)
2269 printf("test: your snprintf does not check buffer size!\n");
2270 return 1;
2271 } else if (res != 7) {
2272 printf("test: snprintf broken (wrong return value: wanted 7, got %d)\n", res);
2273 return 1;
2274 } else
2275 return 0;'
2276 if test_function int snprintf "(char *, int, const char *, ...)" ; then
2277 BAD_SNPRINTF=0
2278 else
2279 tmp="`$CONFTMP/test 2>&1`"
2280 res="`echo $tmp | cut -d\ -f10 2>&1`"
2281 if [ "$res" = "-1)" ] ; then
2282 BAD_SNPRINTF=1
2283 log "found, but returns -1 if string too long"
2284 elif [ "$res" = "9)" ] ; then
2285 BAD_SNPRINTF=2
2286 log "found, but returns large value if string too long"
2287 else
2288 BAD_SNPRINTF=0
2289 MISSING="$MISSING snprintf"
2290 echo2 "snprintf "
2291 fi
2292 fi
2293
2294 # Common failings with strtok() implementations:
2295 # - strtok(NULL, ...) crashes after a NULL is returned
2296 # - strtok(NULL, " ") returns NULL but a subsequent
2297 # strtok(NULL, "") doesn't
2298 MODE="check_strtok "
2299 TEST=' char buf1[1];
2300 char buf2[] = "1 2 3";
2301 char buf3[] = "4 5 6";
2302 char buf4[] = " ";
2303 buf1[0] = 0;
2304 buf3[0] = 0;
2305 if (strtok(buf1, " ") != (char *)0)
2306 return 1;
2307 if (strtok((char *)0, " ") != (char *)0)
2308 return 2;
2309 if (strtok(buf2, " ") != buf2)
2310 return 3;
2311 if (strtok((char *)0, " ") != buf2+2)
2312 return 4;
2313 if (strtok(buf3, " ") != (char *)0)
2314 return 5;
2315 if (strtok((char *)0, " ") != (char *)0)
2316 return 6;
2317 if (strtok(buf4, " ") != (char *)0)
2318 return 7;
2319 if (strtok((char *)0, "") != (char *)0)
2320 return 8;
2321 return 0;'
2322 if test_function "char *" strtok "(char *, const char *)" ; then : ; else
2323 MISSING="$MISSING strtok"
2324 echo2 "strtok "
2325 fi
2326
2327 # stricmp() (STRing case-Insensitive CoMPare) is another name, used
2328 # by at least the Amiga DICE C compiler, for what POSIX calls
2329 # strcasecmp(). I prefer the former because the latter (1) is
2330 # unnecessarily long and (2) implies a case-sensitive compare when
2331 # it's really a case-INsensitive compare. If this system doesn't
2332 # have stricmp() but does have strcasecmp(), we use a #define in
2333 # defs.h to rename the latter to the former.
2334 MODE="check_stricmp "
2335 TEST='extern int strnicmp(const char *, const char *, int); return stricmp("ABC","abc")==0 && strnicmp("ABC","abd",2)==0 ? 0 : 1;'
2336 if test_function int stricmp "(const char *, const char *)" ; then
2337 HAVE_STRCASECMP=0 # doesn't really matter
2338 else
2339 TEST='extern int strncasecmp(const char *, const char *, int); return strcasecmp("ABC","abc")==0 && strncasecmp("ABC","abd",2)==0 ? 0 : 1;'
2340 if test_function int strcasecmp "(const char *, const char *)" ; then : ; else
2341 MISSING="$MISSING str[n]icmp"
2342 echo2 "str[n]icmp "
2343 fi
2344 fi
2345
2346 MODE="check_strdup "
2347 TEST=' char *s, *t;
2348 s = "ABC";
2349 t = strdup(s);'"
2350 return (t != (char *)0 && t[0]=='A' && t[1]=='B' && t[2]=='C' && t[3]==0) ? 0 : 1;"
2351 if test_function "char *" strdup "(const char *)" ; then : ; else
2352 MISSING="$MISSING strdup"
2353 echo2 "strdup "
2354 fi
2355
2356 MODE="check_strspn "
2357 TEST=' extern int strcspn(const char *, const char *);
2358 return (strspn("ABCBA","BA")==2 && strspn("123","123")==3
2359 && strcspn("ABCBA","C")==2 && strcspn("123","4")==3) ? 0 : 1;'
2360 if test_function int strspn "(const char *, const char *)" ; then : ; else
2361 MISSING="$MISSING str[c]spn"
2362 echo2 "str[c]spn "
2363 fi
2364
2365 MODE="check_strsignal "
2366 TEST="(void) strsignal(1); return 0;"
2367 if test_function "char *" strsignal "(int)" ; then : ; else
2368 MISSING="$MISSING strsignal"
2369 echo2 "strsignal "
2370 fi
2371
2372 fi # -use-local-funcs
2373
2374 MODE="check_gettimeofday "
2375 TEST="char buf[256]; (void) gettimeofday((void *)buf, (void *)buf); return 0;"
2376 if test_function "char *" gettimeofday "(void *, void *)" ; then : ; else
2377 MISSING="$MISSING gettimeofday"
2378 echo2 "gettimeofday "
2379 fi
2380
2381 MODE="check_setgrent "
2382 if [ "$SIZEOF_GID_T" ] ; then
2383 TEST="(void) setgrent(); return 0;"
2384 if test_function int setgrent "(void)" ; then : ; else
2385 MISSING="$MISSING setgrent"
2386 echo2 "setgrent "
2387 fi
2388 else
2389 log "skipped (no gid_t)"
2390 HAVE_SETGRENT=0
2391 fi
2392
2393 MODE="check_setregid "
2394 if [ "$SIZEOF_GID_T" ] ; then
2395 TEST="(void) setregid(-1,-1); return 0;"
2396 if test_function int setregid "(int,int)" ; then : ; else
2397 MISSING="$MISSING setregid"
2398 echo2 "setregid "
2399 fi
2400 else
2401 log "skipped (no gid_t)"
2402 HAVE_SETREGID=0
2403 fi
2404
2405 MODE="check_umask "
2406 TEST="(void) umask(1); return 0;"
2407 if test_function int umask "(int)" ; then : ; else
2408 MISSING="$MISSING umask"
2409 echo2 "umask "
2410 fi
2411
2412 MODE="check_fork "
2413 TEST="(void) fork(); return 0;"
2414 if test_function int fork "(void)" ; then : ; else
2415 MISSING="$MISSING fork"
2416 echo2 "fork "
2417 fi
2418
2419 MODE="check_gethostbyname"
2420 TEST='(void) gethostbyname("localhost"); return 0;'
2421 if test_function "struct hostent *" gethostbyname "(const char *)" ; then : ; else
2422 MISSING="$MISSING gethostbyname"
2423 echo2 "gethostbyname "
2424 fi
2425
2426 MODE="check_getsetrlimit "
2427 cat >$CONFTMP/test.c <<EOT
2428 int main() {
2429 extern void getrlimit(), setrlimit();
2430 getrlimit();
2431 setrlimit();
2432 }
2433 EOT
2434 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then
2435 log "found getrlimit/setrlimit"
2436 HAVE_GETSETRLIMIT=1
2437 else
2438 log "didn't find getrlimit/setrlimit"
2439 HAVE_GETSETRLIMIT=0
2440 MISSING="$MISSING get/setrlimit"
2441 echo2 "get/setrlimit "
2442 fi
2443
2444 MODE="check_crypt "
2445 TEST="(void) crypt(\"a\",\"bb\"); return 0;"
2446 if test_function "char *" crypt "(char *, char *)" ; then : ; else
2447 MISSING="$MISSING crypt"
2448 echo2 "crypt "
2449 fi
2450
2451 echo ""
2452 fi
2453
2454 if [ "$MISSING" -a "$MISSING" != " gethostbyname" ] ; then
2455 echo " Services will use its own versions of the functions listed above."
2456 fi
2457
2458 if [ "$HAVE_GETHOSTBYNAME" = 0 ] ; then
2459 cat <<EOT
2460
2461 NOTICE: Your system does not seem to have the gethostbyname() function.
2462 This function is used to translate hostnames into IP addresses.
2463 Since you don't have it (or we can't find it), you will need to
2464 use IP addresses instead of hostnames when setting server addresses
2465 in the configuration files (ircservices.conf and modules.conf).
2466
2467 EOT
2468 fi
2469
2470 ###########################################################################
2471
2472 MODE="check_install "
2473 echo2 "Checking how to install files... "
2474
2475 if [ "$INSTALL" ] ; then
2476 if [ "`echo $INSTALL | cut -c1`" = "$" ] ; then
2477 echo '(cached) using our own "install".'
2478 log "cache says use our own"
2479 else
2480 echo '(cached) this system'\''s "install" works.'
2481 log "cache says use regular "\`"install'"
2482 fi
2483 else
2484 cat >$CONFTMP/test.c <<EOT
2485 int main() { return 0; }
2486 EOT
2487 if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then : ; else
2488 whoa_there
2489 fi
2490 if run cp -p $CONFTMP/test$EXE_SUFFIX $CONFTMP/test3$EXE_SUFFIX ; then : ; else
2491 echo ""
2492 echo ""
2493 echo "*** WHOA THERE! ***"
2494 echo ""
2495 echo "A simple "\`"cp -p' failed!"
2496 echo "Are you out of disk space?"
2497 exit 4
2498 fi
2499
2500 if run install -m 500 $CONFTMP/test$EXE_SUFFIX $CONFTMP/test2$EXE_SUFFIX && test -f $CONFTMP/test$EXE_SUFFIX && run cmp $CONFTMP/test$EXE_SUFFIX $CONFTMP/test2$EXE_SUFFIX ; then
2501 echo 'looks like "install" will work.'
2502 INSTALL="install"
2503 elif run cp -p $CONFTMP/test3$EXE_SUFFIX $CONFTMP/test$EXE_SUFFIX ; run install -c -m 500 $CONFTMP/test$EXE_SUFFIX $CONFTMP/test2$EXE_SUFFIX && test -f $CONFTMP/test$EXE_SUFFIX && run cmp $CONFTMP/test$EXE_SUFFIX $CONFTMP/test2$EXE_SUFFIX ; then
2504 echo 'looks like "install -c" will work.'
2505 INSTALL="install -c"
2506 elif run cp -p $CONFTMP/test3$EXE_SUFFIX $CONFTMP/test$EXE_SUFFIX ; run ginstall -m 500 $CONFTMP/test$EXE_SUFFIX $CONFTMP/test2$EXE_SUFFIX && test -f $CONFTMP/test$EXE_SUFFIX && run cmp $CONFTMP/test$EXE_SUFFIX $CONFTMP/test2$EXE_SUFFIX ; then
2507 echo 'looks like "ginstall" will work.'
2508 INSTALL="ginstall"
2509 else
2510 echo \"install\"" doesn't seem to work."
2511 echo " But we can still use cp and friends, so we'll roll our own "\"install\".
2512 INSTALL='$(TOPDIR)/install-script'
2513 fi
2514 log "using: $INSTALL"
2515 fi
2516
2517 ###########################################################################
2518
2519 MODE="check_install-d "
2520
2521 if [ "$INSTALL" = '$(TOPDIR)/install-script' ] ; then
2522 MKDIR='$(INSTALL) -d'
2523 else
2524 tmp=`echo $INSTALL | cut -d\ -f1`
2525 echo2 "Seeing if \"$tmp\" will create directories... "
2526 if [ "$MKDIR" ] ; then
2527 if [ "$MKDIR" = '$(TOPDIR)/install-script' ] ; then
2528 echo "(cached) no"
2529 log "cache says no"
2530 else
2531 echo "(cached) yes"
2532 log "cache says yes"
2533 fi
2534 else
2535 MKDIR=$tmp
2536 log "trying $MKDIR"
2537 if run $MKDIR -d -m 700 $CONFTMP/testdir && test -d $CONFTMP/testdir ; then
2538 echo "OK."
2539 log "successful"
2540 else
2541 echo "nope, using workaround."
2542 log "failed"
2543 MKDIR='$(TOPDIR)/install-script'
2544 fi
2545 fi
2546 fi
2547
2548 ###########################################################################
2549
2550 MODE="check_copy_recurse "
2551 echo2 "Checking how to copy directories... "
2552
2553 if [ "$CP_ALL" ] ; then
2554 echo "(cached) $CP_ALL"
2555 log "cache supplied $CP_ALL"
2556 else
2557 sysname=`/bin/uname -s 2>&1`
2558 log "sysname: $sysname"
2559 case $sysname in
2560 *Linux) CP_ALL="/bin/cp -dpr";
2561 log "guessing: cp -dpr";;
2562 CYGWIN) CP_ALL="/bin/cp -dpr";
2563 log "guessing: cp -dpr";;
2564 *) CP_ALL="/bin/cp -pr";
2565 log "guessing: cp -pr";;
2566 esac
2567 run rm -rf $CONFTMP/test*
2568 run echo test >$CONFTMP/test
2569 run cp $CONFTMP/test $CONFTMP/test2
2570 if run /bin/mkdir $CONFTMP/testA && run /bin/mkdir $CONFTMP/testB && run /bin/mv $CONFTMP/test2 $CONFTMP/testA ; then
2571 :
2572 else
2573 echo ""
2574 echo ""
2575 echo "*** WHOA THERE! ***"
2576 echo ""
2577 echo "A few simple mkdir's and mv's failed!"
2578 echo "Are you out of disk space?"
2579 exit 4
2580 fi
2581 if run $CP_ALL $CONFTMP/testA $CONFTMP/testB/testC && run cmp $CONFTMP/testA/test2 $CONFTMP/testB/testC/test2 ; then
2582 echo "$CP_ALL"
2583 log \`"$CP_ALL' works"
2584 else
2585 log \`"$CP_ALL' doesn't work"
2586 run /bin/rm -rf $CONFTMP/testB/*
2587 if run sh -c '/bin/tar Ccf $CONFTMP/testA - . | /bin/tar Cxf $CONFTMP/testB -'
2588 then
2589 echo "tar (yuck)"
2590 CP_ALL='$(TOPDIR)/cp-recursive -t'
2591 log "using tar"
2592 else
2593 log "tar failed(!)"
2594 echo ""
2595 echo " Neither cp nor tar work! I give up."
2596 exit 2
2597 fi
2598 fi
2599 fi
2600
2601 ###########################################################################
2602
2603 # Create files.
2604
2605 echo2 "Creating config.h... "
2606 rm -f config.h.new
2607 cat >config.h.new <<EOT
2608 /*
2609 * This file is generated automatically by "configure". Any changes made
2610 * to it will be erased next time "configure" is run.
2611 */
2612
2613 #define PROGRAM "$PROGRAM"
2614 #define SERVICES_BIN "$BINDEST/$PROGRAM"
2615 #define SERVICES_DIR "$DATDEST"
2616
2617 #define GCC3_HACK $NEED_GCC3_HACK
2618 #define HASH_SORTED $SORTED_LISTS
2619 #define CLEAN_COMPILE $CLEAN_COMPILE
2620 #define DUMPCORE $DUMPCORE
2621 #ifndef CONVERT_DB
2622 # define MEMCHECKS $MEMCHECKS
2623 # define SHOWALLOCS $SHOWALLOCS
2624 #endif
2625
2626 #define STATIC_MODULES $STATIC_MODULES
2627 EOT
2628 if [ "$SYMS_NEED_UNDERSCORES" ] ; then cat >>config.h.new <<EOT ; fi
2629 #define SYMS_NEED_UNDERSCORES $SYMS_NEED_UNDERSCORES
2630 EOT
2631 cat >>config.h.new <<EOT
2632
2633 #define HAVE_STDINT_H $HAVE_STDINT_H
2634 #define HAVE_STRINGS_H $HAVE_STRINGS_H
2635 #define HAVE_SYS_SELECT_H $HAVE_SYS_SELECT_H
2636 #define HAVE_SYS_SYSPROTO_H $HAVE_SYS_SYSPROTO_H
2637
2638 EOT
2639 if [ "$TYPE_INT8" = int8_t ] ; then
2640 cat >>config.h.new <<EOT
2641 #define int8 int8_t
2642 #define uint8 uint8_t
2643 EOT
2644 else
2645 cat >>config.h.new <<EOT
2646 typedef signed $TYPE_INT8 int8;
2647 typedef unsigned $TYPE_INT8 uint8;
2648 EOT
2649 fi
2650 if [ "$TYPE_INT16" = int16_t ] ; then
2651 cat >>config.h.new <<EOT
2652 #define int16 int16_t
2653 #define uint16 uint16_t
2654 EOT
2655 else
2656 cat >>config.h.new <<EOT
2657 typedef signed $TYPE_INT16 int16;
2658 typedef unsigned $TYPE_INT16 uint16;
2659 EOT
2660 fi
2661 if [ "$TYPE_INT32" = int32_t ] ; then
2662 cat >>config.h.new <<EOT
2663 #define int32 int32_t
2664 #define uint32 uint32_t
2665 EOT
2666 else
2667 cat >>config.h.new <<EOT
2668 typedef signed $TYPE_INT32 int32;
2669 typedef unsigned $TYPE_INT32 uint32;
2670 EOT
2671 fi
2672 if [ "$TYPE_INT64" = int64_t ] ; then
2673 cat >>config.h.new <<EOT
2674 #define int64 int64_t
2675 #define uint64 uint64_t
2676 EOT
2677 else
2678 cat >>config.h.new <<EOT
2679 typedef signed $TYPE_INT64 int64;
2680 typedef unsigned $TYPE_INT64 uint64;
2681 EOT
2682 fi
2683 cat >>config.h.new <<EOT
2684
2685 #define SIZEOF_INT $SIZEOF_INT
2686 #define SIZEOF_LONG $SIZEOF_LONG
2687 #define SIZEOF_PTR $SIZEOF_PTR
2688 #define SIZEOF_TIME_T $SIZEOF_TIME_T
2689 #define MAX_TIME_T $MAX_TIME_T
2690 EOT
2691 if [ "$SIZEOF_GID_T" ] ; then cat >>config.h.new <<EOT ; fi
2692 #define SIZEOF_GID_T $SIZEOF_GID_T
2693 EOT
2694 cat >>config.h.new <<EOT
2695 #define HAVE_SOCKLEN_T $HAVE_SOCKLEN_T
2696
2697 #define HAVE_STRERROR $HAVE_STRERROR
2698 #define HAVE_SYS_ERRLIST $HAVE_SYS_ERRLIST
2699 #define HAVE_HSTRERROR $HAVE_HSTRERROR
2700 #define HAVE_SNPRINTF $HAVE_SNPRINTF
2701 #define BAD_SNPRINTF $BAD_SNPRINTF
2702 #define HAVE_STRTOK $HAVE_STRTOK
2703 #define HAVE_STRICMP $HAVE_STRICMP
2704 #define HAVE_STRCASECMP $HAVE_STRCASECMP
2705 #define HAVE_STRDUP $HAVE_STRDUP
2706 #define HAVE_STRSPN $HAVE_STRSPN
2707 #define HAVE_STRSIGNAL $HAVE_STRSIGNAL
2708 #define HAVE_GETTIMEOFDAY $HAVE_GETTIMEOFDAY
2709 #define HAVE_SETGRENT $HAVE_SETGRENT
2710 #define HAVE_SETREGID $HAVE_SETREGID
2711 #define HAVE_UMASK $HAVE_UMASK
2712 #define HAVE_FORK $HAVE_FORK
2713 #define HAVE_GETHOSTBYNAME $HAVE_GETHOSTBYNAME
2714 #define HAVE_GETSETRLIMIT $HAVE_GETSETRLIMIT
2715 #define HAVE_CRYPT $HAVE_CRYPT
2716 EOT
2717
2718 if cmp config.h config.h.new >/dev/null 2>&1 ; then
2719 rm -f config.h.new
2720 echo "done (unchanged)."
2721 else
2722 mv -f config.h.new config.h
2723 echo "done."
2724 fi
2725
2726 ###########################################################################
2727
2728 INSTEXEFLAGS="-m 750"
2729 INSTDATFLAGS="-m 640"
2730 MKDIRFLAGS="-m 750"
2731
2732 echo2 "Creating Makefile.inc... "
2733 rm -f Makefile.inc.new
2734 cat >Makefile.inc.new <<EOT
2735 # This file is generated automatically by "configure". Any changes made
2736 # to it will be erased next time "configure" is run.
2737
2738 CC=$CC
2739 BASE_CFLAGS=$CC_FLAGS
2740 CDEFS=$CDEFS
2741 LFLAGS=$CC_LFLAGS$CC_DYN_LFLAGS
2742 LIBS=$CC_LIBS$CC_DYN_LIBS
2743 EXE_SUFFIX=$EXE_SUFFIX
2744 EOT
2745 if [ $STATIC_MODULES = 1 ] ; then
2746 cat >>Makefile.inc.new <<EOT
2747 STATIC_MODULES=1
2748 EOT
2749 else
2750 cat >>Makefile.inc.new <<EOT
2751 CC_SHARED=$CC_SHARED
2752 EOT
2753 fi
2754 if [ $HAVE_SNPRINTF = 0 -a $BAD_SNPRINTF = 0 ] ; then
2755 cat >>Makefile.inc.new <<EOT
2756
2757 VSNPRINTF_O=vsnprintf.o
2758 EOT
2759 fi
2760 cat >>Makefile.inc.new <<EOT
2761 RANLIB=$RANLIB
2762
2763 PROGRAM=$PROGRAM
2764 BINDEST=$BINDEST
2765 DATDEST=$DATDEST
2766
2767 TEST_NT=$TEST_NT
2768 INSTALL_EXE=$INSTALL $INSTEXEFLAGS
2769 INSTALL_DAT=$INSTALL $INSTDATFLAGS
2770 MKDIR=$MKDIR -d $MKDIRFLAGS
2771 CP_ALL=$CP_ALL
2772 EOT
2773
2774 if cmp Makefile.inc Makefile.inc.new >/dev/null 2>&1 ; then
2775 rm -f Makefile.inc.new
2776 echo "done (unchanged)."
2777 else
2778 mv -f Makefile.inc.new Makefile.inc
2779 echo "done."
2780 fi
2781
2782 ###########################################################################
2783
2784 # Save results in cache for next time around.
2785
2786 echo2 "Saving configuration results in config.cache... "
2787
2788 cat <<EOT >config.cache
2789 CONFIG_VERSION=$MY_CONFIG_VERSION
2790
2791 BINDEST='$BINDEST'
2792 DATDEST='$DATDEST'
2793
2794 TEST_NT='$TEST_NT'
2795 INSTALL='$INSTALL'
2796 MKDIR='$MKDIR'
2797 CP_ALL='$CP_ALL'
2798
2799 CC='$CC'
2800 CC_FLAGS='$CC_FLAGS'
2801 CC_LFLAGS='$CC_LFLAGS'
2802 CC_LIBS='$CC_LIBS'
2803
2804 SORTED_LISTS=$SORTED_LISTS
2805 CLEAN_COMPILE=$CLEAN_COMPILE
2806 MEMCHECKS=$MEMCHECKS
2807 SHOWALLOCS=$SHOWALLOCS
2808 DUMPCORE=$DUMPCORE
2809
2810 STATIC_MODULES=$STATIC_MODULES
2811 CC_SHARED='$CC_SHARED'
2812 CC_DYN_LFLAGS='$CC_DYN_LFLAGS'
2813 CC_DYN_LIBS='$CC_DYN_LIBS'
2814 SYMS_NEED_UNDERSCORES=$SYMS_NEED_UNDERSCORES
2815 RANLIB='$RANLIB'
2816
2817 TYPE_INT8=$TYPE_INT8
2818 TYPE_INT16=$TYPE_INT16
2819 TYPE_INT32=$TYPE_INT32
2820 TYPE_INT64=$TYPE_INT64
2821 SIZEOF_INT=$SIZEOF_INT
2822 SIZEOF_LONG=$SIZEOF_LONG
2823 SIZEOF_PTR=$SIZEOF_PTR
2824 SIZEOF_TIME_T=$SIZEOF_TIME_T
2825 MAX_TIME_T='$MAX_TIME_T'
2826 SIZEOF_GID_T=$SIZEOF_GID_T
2827 HAVE_SOCKLEN_T=$HAVE_SOCKLEN_T
2828
2829 HAVE_STDINT_H=$HAVE_STDINT_H
2830 HAVE_STRINGS_H=$HAVE_STRINGS_H
2831 HAVE_SYS_SELECT_H=$HAVE_SYS_SELECT_H
2832 HAVE_SYS_SYSPROTO_H=$HAVE_SYS_SYSPROTO_H
2833
2834 HAVE_STRERROR=$HAVE_STRERROR
2835 HAVE_SYS_ERRLIST=$HAVE_SYS_ERRLIST
2836
2837 HAVE_SNPRINTF=$HAVE_SNPRINTF
2838 BAD_SNPRINTF=$BAD_SNPRINTF
2839 HAVE_HSTRERROR=$HAVE_HSTRERROR
2840 HAVE_STRTOK=$HAVE_STRTOK
2841 HAVE_STRICMP=$HAVE_STRICMP
2842 HAVE_STRCASECMP=$HAVE_STRCASECMP
2843 HAVE_STRDUP=$HAVE_STRDUP
2844 HAVE_STRSPN=$HAVE_STRSPN
2845 HAVE_STRSIGNAL=$HAVE_STRSIGNAL
2846 HAVE_GETTIMEOFDAY=$HAVE_GETTIMEOFDAY
2847 HAVE_SETGRENT=$HAVE_SETGRENT
2848 HAVE_SETREGID=$HAVE_SETREGID
2849 HAVE_UMASK=$HAVE_UMASK
2850 HAVE_FORK=$HAVE_FORK
2851 HAVE_GETHOSTBYNAME=$HAVE_GETHOSTBYNAME
2852 HAVE_GETSETRLIMIT=$HAVE_GETSETRLIMIT
2853 HAVE_CRYPT=$HAVE_CRYPT
2854 MISSING='$MISSING'
2855 EOT
2856
2857 echo "done."
2858
2859 ###########################################################################
2860
2861 # Delete the temporary directory we created.
2862
2863 rm -rf $CONFTMP
2864
2865 ###########################################################################
2866
2867 # All done!
2868
2869 cat <<EOT
2870
2871 All done! Now edit defs.h as needed, and run "make" (or possibly "gmake")
2872 to compile Services. See the README and FAQ if you have any problems.
2873
2874 EOT
2875
2876 exit 0
2877
2878 ###########################################################################
2879
2880 # Local variables:
2881 # indent-tabs-mode: nil
2882 # End:
2883 #
2884 # vim: expandtab shiftwidth=4:

Properties

Name Value
svn:executable

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28