~ubuntu-branches/ubuntu/vivid/postfix/vivid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
#!/bin/sh

#++
# NAME
#	makedefs 1
# SUMMARY
#	makefile configuration utility
# SYNOPSIS
#	\fBmake makefiles \fIname=value...\fR
# DESCRIPTION
#	The \fBmakedefs\fR command identifies the compilation
#	environment, and emits macro definitions on the standard output
#	stream that can be prepended to template Makefiles.
#
#	Default settings can be overruled by specifying them as
#	environment variables. Use quotes if variables contain
#	whitespace or shell meta characters.
# .IP \fBAUXLIBS=\fIobject_library...\fR
#	Specifies one or more non-default object libraries.
# .IP \fBCC=\fIcompiler_command\fR
#	Specifies a non-default compiler. On many systems, the default
#	is \fBgcc\fR.
# .IP \fBCCARGS=\fIcompiler_arguments\fR
#	Specifies non-default compiler arguments, for example, a non-default
#	\fIinclude\fR directory.
#	The following directives are special:
# .RS
# .IP \fB-DNO_DB\fR
#	Do not build with Berkeley DB support.
# .IP \fB-DNO_DEVPOLL\fR
#	Do not build with Solaris /dev/poll support.
#	By default, /dev/poll support is compiled in on platforms that
#	are known to support it.
# .IP \fB-DNO_EPOLL\fR
#	Do not build with Linux EPOLL support.
#	By default, EPOLL support is compiled in on platforms that
#	are known to support it.
# .IP \fB-DNO_IPV6\fR
#	Do not build with IPv6 support.
#	By default, IPv6 support is compiled in on platforms that
#	are known to have IPv6 support.
#
#	Note: this directive is for debugging and testing only. It
#	is not guaranteed to work on all platforms.
# .IP \fB-DNO_KQUEUE\fR
#	Do not build with FreeBSD/NetBSD/OpenBSD/MacOSX KQUEUE support.
#	By default, KQUEUE support is compiled in on platforms that
#	are known to support it.
# .IP \fB-DNO_NIS\fR
#	Do not build with NIS or NISPLUS support. Support for NIS
#	is unavailable on some recent Linux distributions.
# .IP \fB-DNO_NISPLUS\fR
#	Do not build with NISPLUS support. Support for NISPLUS
#	is unavailable on some recent Solaris distributions.
# .IP \fB-DNO_PCRE\fR
#	Do not build with PCRE support.
#	By default, PCRE support is compiled in when the \fBpcre-config\fR
#	utility is installed.
# .IP \fB-DNO_POSIX_GETPW_R\fR
#	Disable support for POSIX getpwnam_r/getpwuid_r.
# .IP \fB-DNO_SIGSETJMP\fR
#	Use setjmp()/longjmp() instead of sigsetjmp()/siglongjmp().
#	By default, Postfix uses sigsetjmp()/siglongjmp() when they
#	appear to work.
# .RE
# .IP \fBDEBUG=\fIdebug_level\fR
#	Specifies a non-default debugging level. The default is \fB-g\fR.
#	Specify \fBDEBUG=\fR to turn off debugging.
# .IP \fBOPT=\fIoptimization_level\fR
#	Specifies a non-default optimization level. The default is \fB-O\fR.
#	Specify \fBOPT=\fR to turn off optimization.
# .IP \fBWARN=\fIwarning_flags\fR
#	Specifies non-default gcc compiler warning options for use when
#	"make" is invoked in a source subdirectory only.
# LICENSE
# .ad
# .fi
#	The Secure Mailer license must be distributed with this software.
# AUTHOR(S)
#	Wietse Venema
#	IBM T.J. Watson Research
#	P.O. Box 704
#	Yorktown Heights, NY 10598, USA
#--

# Emit system-dependent Makefile macro definitions to standard output.

# Defaults for most sane systems

RANLIB=ranlib
SYSLIBS=
AR=ar
ARFL=rv

# Ugly function to make our error message more visible among the
# garbage that is output by some versions of make(1).

# By now all shells must have functions.

error() {
   # Alas, tput(1) is not portable so we can't use visual effects.
   echo "ATTENTION:" 1>&2;
   echo "ATTENTION:" $* 1>&2;
   echo "ATTENTION:" 1>&2;
   exit 1
}

case $# in
 # Officially supported usage.
 0) SYSTEM=`(uname -s) 2>/dev/null`
    RELEASE=`(uname -r) 2>/dev/null`
    VERSION=`(uname -v) 2>/dev/null`
    case "$VERSION" in
     dcosx*) SYSTEM=$VERSION;;
    esac;;
 # Unsupported debug-only mode. Not suitable for cross-platform tests.
 2) SYSTEM="$1"; RELEASE="$2";;
 *) echo usage: $0 [system release] 1>&2; exit 1;;
esac

case "$SYSTEM.$RELEASE" in
   SCO_SV.3.2)	SYSTYPE=SCO5
		# Use the native compiler by default
		: ${CC="/usr/bin/cc -b elf"}
		CCARGS="$CCARGS -DPIPES_CANT_FIONREAD $CCARGS"
		SYSLIBS="-lsocket -ldbm"
		RANLIB=echo
		;;
  UnixWare.5*)	SYSTYPE=UW7
		# Use the native compiler by default
		: ${CC=/usr/bin/cc}
		RANLIB=echo
		SYSLIBS="-lresolv -lsocket -lnsl"
		;;
  UNIX_SV.4.2*)	case "`uname -v`" in
	      2.1*) SYSTYPE=UW21
		    # Use the native compiler by default
		    : ${CC=/usr/bin/cc}
		    RANLIB=echo
		    SYSLIBS="-lresolv -lsocket -lnsl -lc -L/usr/ucblib -lucb"
		    ;;
	      *) error "Seems to be UnixWare`uname -v`. Untested.";;
		esac
		;;
  FreeBSD.2*)	SYSTYPE=FREEBSD2
		;;
  FreeBSD.3*)	SYSTYPE=FREEBSD3
		;;
  FreeBSD.4*)	SYSTYPE=FREEBSD4
		;;
  FreeBSD.5*)	SYSTYPE=FREEBSD5
		;;
  FreeBSD.6*)	SYSTYPE=FREEBSD6
		;;
  FreeBSD.7*)	SYSTYPE=FREEBSD7
		;;
  FreeBSD.8*)	SYSTYPE=FREEBSD8
		;;
  FreeBSD.9*)	SYSTYPE=FREEBSD9
		;;
 DragonFly.*)	SYSTYPE=DRAGONFLY
		;;
  OpenBSD.2*)	SYSTYPE=OPENBSD2
		;;
  OpenBSD.3*)	SYSTYPE=OPENBSD3
		;;
  OpenBSD.4*)	SYSTYPE=OPENBSD4
		;;
  OpenBSD.5*)	SYSTYPE=OPENBSD5
		;;
  ekkoBSD.1*)	SYSTYPE=EKKOBSD1
		;;
   NetBSD.1*)	SYSTYPE=NETBSD1
		;;
   NetBSD.2*)	SYSTYPE=NETBSD2
		;;
   NetBSD.3*)	SYSTYPE=NETBSD3
		;;
   NetBSD.4*)	SYSTYPE=NETBSD4
		;;
   NetBSD.5*)	SYSTYPE=NETBSD5
		;;
   NetBSD.6*)	SYSTYPE=NETBSD6
		;;
   BSD/OS.2*)	SYSTYPE=BSDI2
		;;
   BSD/OS.3*)	SYSTYPE=BSDI3
		;;
   BSD/OS.4*)	SYSTYPE=BSDI4
		;;
 OSF1.V[3-5].*)	SYSTYPE=OSF1
		# Use the native compiler by default
		: ${CC=cc}
		: ${DEBUG="-g3"}
		case $RELEASE in
		V[0-4].*) CCARGS="$CCARGS -DNO_IPV6";;
		esac
		;;
    SunOS.4*)	SYSTYPE=SUNOS4
		SYSLIBS=-lresolv
		;;
    SunOS.5*)	SYSTYPE=SUNOS5
		RANLIB=echo
		SYSLIBS="-lresolv -lsocket -lnsl -ldl"
		# Stock awk breaks with >10 files.
		test -x /usr/xpg4/bin/awk && AWK=/usr/xpg4/bin/awk
		# Solaris 2.5 added usleep(), POSIX regexp, POSIX getpwnam/uid_r
		case $RELEASE in
		    5.[0-4]) CCARGS="$CCARGS -DMISSING_USLEEP -DNO_POSIX_REGEXP -DNO_POSIX_GETPW_R";;
		esac
		# Solaris 8 added IPv6 and /dev/poll
		case $RELEASE in
		    5.[0-7]|5.[0-7].*) CCARGS="$CCARGS -DNO_IPV6 -DNO_DEVPOLL";;
		esac
		# Solaris 9 added closefrom(), futimesat() and /dev/*random
		# and appears to have solid UNIX-domain sockets.
		case $RELEASE in
		    5.[0-8]|5.[0-8].*) CCARGS="$CCARGS -DNO_CLOSEFROM -DNO_DEV_URANDOM -DNO_FUTIMESAT -DSTREAM_CONNECTIONS";;
		esac
		# Somewhere NISPLUS went away.
		case $RELEASE in
		    5.[0-9][0-9]*) CCARGS="$CCARGS -DNO_NISPLUS";;
		esac
		# Work around broken str*casecmp(). Do it all here instead
		# of having half the solution in the sys_defs.h file.
		CCARGS="$CCARGS -Dstrcasecmp=fix_strcasecmp \
		    -Dstrncasecmp=fix_strncasecmp"
		STRCASE="strcasecmp.o"
		# Avoid common types of braindamage
		case "$LD_LIBRARY_PATH" in
		?*) error "Don't set LD_LIBRARY_PATH";;
		esac
		case "${CC}" in
		*" "*) ;;
		*ucb*) error "Don't use /usr/ucb/cc or ucblib";;
		  cc*) case `which ${CC}` in
		*ucb*) error "Don't use /usr/ucb/cc or ucblib";;
		  esac;;
		esac
		;;
   ULTRIX.4*)	SYSTYPE=ULTRIX4
		if [ -f /usr/local/lib/libdb.a ]; then
		    SYSLIBS="$SYSLIBS -ldb"
		    CCARGS="$CCARGS -DHAS_DB"
		    if [ -d /usr/local/include/db ]; then
			CCARGS="$CCARGS -I/usr/local/include/db"
		    fi
		fi
		for l in syslog resolv; do
		    if [ -f /usr/local/lib/lib$l.a ]; then
			SYSLIBS="$SYSLIBS -l$l"
		    fi
		done
		;;
       AIX.*)	case "`uname -v`" in
		6)	SYSTYPE=AIX6
			case "$CC" in
			cc|*/cc|xlc|*/xlc) CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
			esac
			CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
			;;
		5)	SYSTYPE=AIX5
			case "$CC" in
			cc|*/cc|xlc|*/xlc) CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
			esac
			CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
			;;
		4)	SYSTYPE=AIX4
			# How embarrassing...
			case "$CC" in
			cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
			esac
			CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
			;;
		3)	SYSTYPE=AIX3
			# How embarrassing...
			case "$CC" in
			cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w";;
			esac
			CCARGS="$CCARGS -D_ALL_SOURCE"
			;;
		*)	error "Unknown AIX version: `uname -v`.";;
		esac;;
		# Tested with RedHat 3.03 on 20020729.
    Linux.1*)	SYSTYPE=LINUX1
		case "$CCARGS" in
		 *-DNO_DB*) ;;
		 *-DHAS_DB*) ;;
		 *) SYSLIBS="-ldb";;
		esac
		;;
    Linux.2*)	SYSTYPE=LINUX2
		case "$CCARGS" in
		 *-DNO_DB*) ;;
		 *-DHAS_DB*) ;;
		 *) if [ -f /usr/include/db.h ]
		    then
			: we are all set
		    elif [ -f /usr/include/db/db.h ]
		    then
			CCARGS="$CCARGS -I/usr/include/db"
		    else
			# No, we're not going to try db1 db2 db3 etc.
			# On a properly installed system, Postfix builds
			# by including <db.h> and by linking with -ldb
			echo "No <db.h> include file found." 1>&2
			echo "Install the appropriate db*-devel package first." 1>&2
			exit 1
		    fi
		    SYSLIBS="-ldb"
		    SEARCHDIRS=$(${CC-gcc} -print-search-dirs 2>/dev/null |
			    sed -n '/^libraries: =/s/libraries: =//p' |
			    sed -e 's/:/\n/g' | xargs -n1 readlink -f |
			    grep -v 'gcc\|/[0-9.]\+$' | sort -u)
		    if [ -z "$SEARCHDIRS" ]; then
			    SEARCHDIRS="/usr/lib64 /lib64 /usr/lib /lib"
		    fi
		    ;;
		esac
		for name in nsl resolv $GDBM_LIBS
		do
		    for lib in $SEARCHDIRS
		    do
			test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
			    SYSLIBS="$SYSLIBS -l$name"
			    break
			}
		    done
		done
		# Kernel 2.4 added IPv6
		case "$RELEASE" in
		2.[0-3].*) CCARGS="$CCARGS -DNO_IPV6";;
		esac
		# Kernel 2.6 added EPOLL
		case "$RELEASE" in
		2.[0-5].*) CCARGS="$CCARGS -DNO_EPOLL";;
		    # Workaround for retarded libc 
		    2.6.*)
		       if [ `expr "X$CCARGS" : "X.*-DNO_EPOLL"` -gt 0 ]
		       then
			   :
		       elif [ ! -e /usr/include/sys/epoll.h ]
		       then
			   echo CCARGS="$CCARGS -DNO_EPOLL"
		       else
			   trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
			   cat >makedefs.test.c <<'EOF'
#include <sys/types.h>
#include <sys/epoll.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

int     main(int argc, char **argv)
{
    int     epoll_handle;

    if ((epoll_handle = epoll_create(1)) < 0) {
	perror("epoll_create");
	exit(1);
    }
    exit(0);
}
EOF
			   ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
			   ./makedefs.test 2>/dev/null ||
				CCARGS="$CCARGS -DNO_EPOLL"
			   rm -f makedefs.test makedefs.test.[co]
		       fi;;
		esac
		;;
    Linux.3*)	SYSTYPE=LINUX3
		case "$CCARGS" in
		 *-DNO_DB*) ;;
		 *-DHAS_DB*) ;;
		 *) if [ -f /usr/include/db.h ]
		    then
			: we are all set
		    elif [ -f /usr/include/db/db.h ]
		    then
			CCARGS="$CCARGS -I/usr/include/db"
		    else
			# On a properly installed system, Postfix builds
			# by including <db.h> and by linking with -ldb
			echo "No <db.h> include file found." 1>&2
			echo "Install the appropriate db*-devel package first." 1>&2
			exit 1
		    fi
		    SYSLIBS="-ldb"
		    SEARCHDIRS=$(${CC-gcc} -print-search-dirs 2>/dev/null |
			    sed -n '/^libraries: =/s/libraries: =//p' |
			    sed -e 's/:/\n/g' | xargs -n1 readlink -f |
			    grep -v 'gcc\|/[0-9.]\+$' | sort -u)
		    if [ -z "$SEARCHDIRS" ]; then
			    SEARCHDIRS="/usr/lib64 /lib64 /usr/lib /lib"
		    fi
		    ;;
		esac
		for name in nsl resolv
		do
		    for lib in $SEARCHDIRS
		    do
			test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
			    SYSLIBS="$SYSLIBS -l$name"
			    break
			}
		    done
		done
		;;
     GNU.0*|GNU/kFreeBSD.*)
     		SYSTYPE=GNU0
		case "$CCARGS" in
		 *-DNO_DB*) ;;
		 *) if [ -f /usr/include/db.h ]
		    then
			: we are all set
		    elif [ -f /usr/include/db/db.h ]
		    then
			CCARGS="$CCARGS -I/usr/include/db"
		    else
			# On a properly installed system, Postfix builds
			# by including <db.h> and by linking with -ldb
			echo "No <db.h> include file found." 1>&2
			echo "Install the appropriate db*-devel package first." 1>&2
			exit 1
		    fi
		    SYSLIBS="-ldb"
		    SEARCHDIRS=$(${CC-gcc} -print-search-dirs 2>/dev/null |
			    sed -n '/^libraries: =/s/libraries: =//p' |
			    sed -e 's/:/\n/g' | xargs -n1 readlink -f |
			    grep -v 'gcc\|/[0-9.]\+$' | sort -u)
		    if [ -z "$SEARCHDIRS" ]; then
			    SEARCHDIRS="/usr/lib64 /lib64 /usr/lib /lib"
		    fi
		    ;;
		esac
		for name in nsl resolv
		do
		    for lib in $SEARCHDIRS
		    do
			test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
			    SYSLIBS="$SYSLIBS -l$name"
			    break
			}
		    done
		done
		case "`uname -s`" in
		GNU)
			# currently no IPv6 support on Hurd
			CCARGS="$CCARGS -DNO_IPV6"
			;;
		esac
		;;
     IRIX*.5.*)	SYSTYPE=IRIX5
		# Use the native compiler by default
		: ${CC=cc} ${DEBUG="-g3"}
		RANLIB=echo
		;;
     IRIX*.6.*)	SYSTYPE=IRIX6
		# Use the native compiler by default, and allow nested comments.
		: ${CC="cc -woff 1009,1116,1412"}
		RANLIB=echo
		;;
HP-UX.A.09.*)	SYSTYPE=HPUX9
		SYSLIBS=-ldbm
		CCARGS="$CCARGS -DMISSING_USLEEP"
		if [ -f /usr/lib/libdb.a ]; then
		    CCARGS="$CCARGS -DHAS_DB"
		    SYSLIBS="$SYSLIBS -ldb"
		fi
		;;
HP-UX.B.10.*)	SYSTYPE=HPUX10
		CCARGS="$CCARGS `nm /usr/lib/libc.a 2>/dev/null |
		    (grep usleep >/dev/null || echo '-DMISSING_USLEEP')`"
		if [ -f /usr/lib/libdb.a ]; then
		    CCARGS="$CCARGS -DHAS_DB"
		    SYSLIBS=-ldb
		fi
		;;
HP-UX.B.11.*)	SYSTYPE=HPUX11
		SYSLIBS=-lnsl
		if [ -f /usr/lib/libdb.a ]; then
		    CCARGS="$CCARGS -DHAS_DB"
		    SYSLIBS="$SYSLIBS -ldb"
		fi
		;;
ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
		RANLIB=echo
		SYSLIBS="-lresolv -lsocket -lnsl"
		;;
    Darwin.*)   SYSTYPE=MACOSX
		# Use the native compiler by default
		: ${CC=cc}
		CCARGS="$CCARGS \$(WARN)"
		# Darwin > 1.3 uses awk and flat_namespace
		case $RELEASE in
		 1.[0-3]) AWK=gawk;;
		       *) AWK=awk
			  SYSLIBS="$SYSLIBS -flat_namespace";;
		esac
		# Darwin 7 adds IPv6 support, BIND_8_COMPAT, NO_NETINFO
		case $RELEASE in
		 [1-6].*) CCARGS="$CCARGS -DNO_IPV6";;
		       *) CCARGS="$CCARGS -DBIND_8_COMPAT -DNO_NETINFO";;
		esac
		# Darwin 9.0 (MacOS X 10.5) adds POSIX getpwnam_r/getpwuid_r
		case $RELEASE in
		 [1-8].*) CCARGS="$CCARGS -DNO_POSIX_GETPW_R";;
		esac
		# Darwin 10.3.0 no longer has <nameser8_compat.h>.
		case $RELEASE in
		     ?.*) CCARGS="$CCARGS -DRESOLVE_H_NEEDS_NAMESER8_COMPAT_H";;
		       *) CCARGS="$CCARGS -DRESOLVE_H_NEEDS_ARPA_NAMESER_COMPAT_H";;
		esac
		# Darwin 11.x (MacOS X 10.7.x), maybe earlier, needs libresolv.
		case $RELEASE in
		?.*|10.*) ;;
		       *) SYSLIBS="$SYSLIBS -lresolv";;
		esac
		# kqueue and/or poll are broken in MacOS X 10.5 (Darwin 9).
		# kqueue works in Mac OS X 10.8 (Darwin 12).
		case $RELEASE in
	    ?.*|1[0-1].*) CCARGS="$CCARGS -DNO_KQUEUE";;
		esac
		;;
    dcosx.1*)	SYSTYPE=DCOSX1
		RANLIB=echo
		SYSLIBS="-lresolv -lsocket -lnsl -lc -lrpcsvc -L/usr/ucblib -lucb"
		;;

	 ".")	if [ -d /NextApps ]; then
		    SYSTYPE=`hostinfo | sed -n \
			's/^.*NeXT Mach 3.*$/NEXTSTEP3/;/NEXTSTEP3/{p;q;}'`
		    if [ "$SYSTYPE" = "" ]; then
			SYSTYPE=`hostinfo | sed -n \
			    's/^.*NeXT Mach 4.*$/OPENSTEP4/;/OPENSTEP4/{p;q;}'`
		    fi
		    : ${CC=cc}
		    RANLIB="sleep 5; ranlib"
		else
		    error "Unable to determine your system type."
		fi
		;;
	   *)	error "Unknown system type: $SYSTEM $RELEASE";;
esac

#
# sigsetjmp()/siglongjmp() can be "better" than setjmp()/longjmp()
# if used wisely (that is: almost never, just like signals).
# Unfortunately some implementations have been buggy in the past.
#
case "$CCARGS" in
 *-DNO_SIGSETJMP*) ;;
		*) trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
		   cat >makedefs.test.c <<'EOF'
#include <setjmp.h>
#include <stdlib.h>
#include <stdio.h>

static int count = 0;

int     main(int argc, char **argv)
{
    sigjmp_buf env;
    int     retval;

    switch (retval = sigsetjmp(env, 1)) {
    case 0:
	siglongjmp(env, 12345);
    case 12345:
	break;
    default:
	fprintf(stderr, "Error: siglongjmp ignores second argument\n");
	exit(1);
    }

    switch (retval = sigsetjmp(env, 1)) {
    case 0:
	if (count++ > 0) {
	    fprintf(stderr, "Error: not overriding siglongjmp(env, 0)\n");
	    exit(1);
	}
	siglongjmp(env, 0);
    case 1:
	break;
    default:
	fprintf(stderr, "Error: overriding siglongjmp(env, 0) with %d\n",
		retval);
	exit(1);
    }
    exit(0);
}
EOF
		   ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
		   ./makedefs.test 2>/dev/null ||
			CCARGS="$CCARGS -DNO_SIGSETJMP"
		   rm -f makedefs.test makedefs.test.[co]
esac

#
# OpenSSL has no configuration query utility, but we don't try to
# guess. We assume includes in /usr/include/openssl and libraries in
# /usr/lib, or in their /usr/local equivalents. If the OpenSSL files
# are in a non-standard place, their locations need to be specified.
#
#case "$CCARGS" in
# *-DUSE_TLS*)	;;
#  *-DNO_TLS*)	;;
#           *)	CCARGS="$CCARGS -DUSE_TLS"
#		AUXLIBS="$AUXLIBS -lssl -lcrypto"
#		;;
#esac

#
# PCRE 3.x has a pcre-config utility so we don't have to guess.
#
case "$CCARGS" in
*-DHAS_PCRE*)	;;
 *-DNO_PCRE*)	;;
	   *)	pcre_cflags=`(pcre-config --cflags) 2>/dev/null` &&
		    pcre_libs=`(pcre-config --libs) 2>/dev/null` && {
			CCARGS="$CCARGS -DHAS_PCRE $pcre_cflags"
			AUXLIBS="$AUXLIBS $pcre_libs"
		}
		;;
esac

# Defaults that can be overruled (make makefiles CC=cc OPT=-O6 DEBUG=)
# Disable optimizations by default when compiling for Purify. Disable
# optimizations by default with gcc 2.8, until the compiler is known to
# be OK. Those who dare can still overrule this (make makefiles OPT=-O).

case "$CC" in
 *purify*) : ${OPT=};;
*/gcc|gcc) case `$CC -v` in
	   "gcc version 2.8"*) : ${OPT=};;
	   esac;;
      *CC) error "Don't use CC. That's the C++ compiler";;
	*) : ${OPT='-O'};;
esac
#
# "gcc -W" 3.4.2 no longer reports functions that fail to return a
# result.  Use "gcc -Wall -Wno-comment" instead. We'll figure out
# later if the other -Wmumble options are really redundant. Having
# een burned once by a compiler that lies about what warnings it
# produces, not taking that chance again.

: ${CC='gcc $(WARN)'} ${OPT='-O'} ${DEBUG='-g'} ${AWK=awk} \
${WARN='-Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \
	-Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
	-Wunused -Wno-missing-braces'}

export SYSTYPE AR ARFL RANLIB SYSLIBS CC OPT DEBUG AWK OPTS

# Snapshot only.
#CCARGS="$CCARGS -DSNAPSHOT"

# Non-production: needs thorough testing, or major changes are still
# needed before the code stabilizes.
#CCARGS="$CCARGS -DNONPROD"

# Workaround: prepend Postfix include files before other include files.
CCARGS="-I. -I../../include $CCARGS"

sed 's/  / /g' <<EOF
SYSTYPE	= $SYSTYPE
AR	= $AR
ARFL	= $ARFL
RANLIB	= $RANLIB
SYSLIBS	= $AUXLIBS $SYSLIBS
CC	= $CC $CCARGS
OPT	= $OPT
DEBUG	= $DEBUG
AWK	= $AWK
STRCASE = $STRCASE
EXPORT	= AUXLIBS='$AUXLIBS' CCARGS='$CCARGS' OPT='$OPT' DEBUG='$DEBUG'
WARN	= $WARN
EOF