summaryrefslogtreecommitdiff
path: root/mit-pthreads/config/configure.in
blob: c623ddc4343da79161a6d38d6ac0f40412dd670c (plain)
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
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
dnl Some reminders:
dnl	"dnl" is a "delete to newline" command for m4 - the remainder of the
dnl		line it's on, including the newline, will be discarded
dnl	"#" comments will usually be copied through
dnl	"[]" are quoting characters; use changequote around code that really
dnl		needs to use them, but try not to invoke autoconf macros
dnl		within such code
dnl
dnl When you change this file, re-run "autoreconf" -- that'll automatically
dnl re-run both autoconf and autoheader.
dnl
dnl
dnl To do:
dnl	CLOCKS_PER_SEC	(default 100, Ultrix differs)
dnl	CLK_TCK		(default 100, Ultrix differs)
dnl	clockid_t	(not on all systems)
dnl	timer_t		(not on all systems)
dnl
dnl
dnl	Now, the real stuff.
dnl
dnl This must be first.
AC_INIT(config.flags.in)
dnl
dnl This file does require autoconf 2.0 or better...
dnl
AC_PREREQ(2.0)dnl
dnl
dnl Hook for the "--enable-dce-compat" option, when Chris actually
dnl implements it.
dnl
AC_ARG_ENABLE(dce-compat,
    --enable-dce-compat	  DCE compatibility,
[dnl "true" action
  AC_MSG_ERROR([Actually, DCE compatibility doesn't work yet...])
],
[dnl "false" action
  true
])

dnl What C compiler?
AC_PROG_CC
AC_PROG_CXX
dnl Apparently autoconf doesn't test to see if the C compiler it locates
dnl actually works... oops!
AC_MSG_CHECKING(compiler availability and simple error detection)
AC_TRY_COMPILE(,[ exit(0); ],[
  dnl true
  AC_TRY_COMPILE(,[ syntax errors galore! ],
    dnl true
    AC_MSG_ERROR(Can't detect syntax errors!  Is CC set right?),
    dnl false
    true)],
  dnl false
  AC_MSG_ERROR(Can't compile test program!  Is CC set right?))

AC_TRY_COMPILE(,[
  typedef int Integer;
  extern int i;
  extern Integer i;
], , AC_MSG_ERROR(Can't redeclare variables with this compiler??))
AC_TRY_COMPILE(,[
  typedef long Long;
  extern int i;
  extern Long i;
], AC_MSG_ERROR(Compiler doesn't detect conflicting declarations.))
AC_MSG_RESULT(ok)

if test $ac_cv_prog_gcc = yes ; then
  CFLAGS="$CFLAGS -Werror"
fi

AC_PROG_CPP

AC_PROG_RANLIB

dnl Default value of prefix should be /usr/local/pthreads, not /usr/local.
AC_PREFIX_DEFAULT(/usr/local/pthreads)

dnl Determine $host, by guessing if necessary.
AC_CANONICAL_SYSTEM

syscall=NONE
sysincludes=NONE
extraincludes=NONE

# Treat all x86 machines the same.
# (Yet below, we pretend we can distinguish between the MIPS r2000 and r4000?)
# (What about 680x0 machines?)
changequote(,)dnl
case $host in
    i[456]86-*)
	host=`echo $host | sed 's/^i[456]86/i386/'`
	host_cpu=i386
	;;
esac
changequote([,])dnl

# Here, you should set the following variables:
#  name
#	The "name" of this configuration.  Used for "engine-*.c" file name,
#	default for syscall file names.  Chris seems to have a thing for
#	putting "-" between OS and version number, but the configure script
#	will already have $host_cpu and $host_os available for you to use
#	in constructing a name.
#  sysincludes
#	Name of machdep directory with "sys" include file
#	replacements, if any.  This directory is optional;
#	if you don't provide it, don't set this variable.
#  except
#	Names of any syscalls that shouldn't be generated
#	from the template, if any.
#  syscall
#	Base name of the syscall template files, if not the
#	same as <name>.  If they're the same, omit this.
#
# Also, you may define random symbols and update CFLAGS if
# necessary.  However, for ease of porting to new machines,
# it's best if you can create portable autoconf tests for
# whatever you're trying to do, rather than hard-coding it
# here based on the OS name.  So please, try to keep this
# section as minimal as possible.

except=""
name=$host_cpu-$host_os

case $host in
changequote(,)dnl
    alpha-*-netbsd1.3[H-Z]|alpha-*-netbsd1.4*)
	name=alpha-netbsd-1.3
	sysincludes=netbsd-1.1
	except="fork lseek pipe fstat"
	available_syscalls="sigsuspend sigprocmask"
	;;
changequote([,])dnl
    alpha-*-netbsd1.3*)
	name=alpha-netbsd-1.3
	sysincludes=netbsd-1.1
	except="fork lseek pipe sigsuspend sigprocmask fstat"
	;;
    alpha-*-netbsd1.1* | alpha-*-netbsd1.2*)
	name=alpha-netbsd-1.1
	sysincludes=netbsd-1.1
	except="fork lseek pipe sigsuspend sigprocmask"
	;;
    alpha-*-osf*)
	name=alpha-osf1
	sysincludes=alpha-osf1
	except="fork sigsuspend"
	if test $ac_cv_prog_gcc = no ; then
	  CFLAGS="$CFLAGS -std"
	fi
	;;
changequote(,)dnl
    arm32-*-netbsd1.3[H-Z]|arm32-*-netbsd1.4*)
	name=arm32-netbsd-1.3
	sysincludes=netbsd-1.1
	except="fork pipe lseek ftruncate fstat"
	available_syscalls="sigsuspend sigprocmask"
	;;
changequote([,])dnl
    arm32-*-netbsd1.3*)
	name=arm32-netbsd-1.3
	sysincludes=netbsd-1.1
	except="fork pipe lseek ftruncate sigsuspend sigprocmask fstat"
	;;
    hppa1.0-*-hpux10.20 | hppa1.1-*-hpux10.20)
	name=hppa-hpux-10.20
	sysincludes=hpux-10.20
	except="fork"
	;;
    hppa1.1-*-hpux*9.*)
	name=hppa-hpux-9.03
	sysincludes=hpux-9.03
	# hpux-9.03.mk seems to be missing; what should this be?
	except="fork"
	;;
    sparc-*-sunos4.1.3* | sparc-*-sunos4.1.4*)
	name=sparc-sunos-4.1.3
	sysincludes=sunos-4.1.3
	syscall=sparc-sunos4
	except="fork pipe getpgrp getdirentries"
	AC_DEFINE(sunos4)	# is this really needed??
	;;
    sparc-*-solaris2.3* | sparc-*-solaris2.4*)
	name=sparc-sunos-5.3
	sysincludes=sunos-5.3
	except="fork sigaction"
	# Should really come up with a test for this...
	AC_DEFINE(LD_LINKS_STATIC_DATA)
	AC_DEFINE(BROKEN_SIGNALS)
	;;
    sparc-*-solaris2*)
	name=sparc-sunos-5.3
	sysincludes=sunos-5.5
	except="fork sigaction"
	# Should really come up with a test for this...
	AC_DEFINE(LD_LINKS_STATIC_DATA)
	AC_DEFINE(BROKEN_SIGNALS)
	;;
changequote(,)dnl
    sparc-*-netbsd1.3[H-Z]|sparc-*-netbsd1.4*)
	name=sparc-netbsd-1.3
	sysincludes=netbsd-1.1
	except="pipe fork lseek ftruncate fstat"
	available_syscalls="sigprocmask sigsuspend"
	;;
changequote([,])dnl
    sparc-*-netbsd1.3*)
	name=sparc-netbsd-1.3
	sysincludes=netbsd-1.1
	except="pipe fork lseek ftruncate sigprocmask sigsuspend fstat"
	;;
    sparc-*-netbsd1.0A | sparc-*-netbsd1.1* | sparc-*-netbsd1.2*)
	name=sparc-sunos-4.1.3
	sysincludes=netbsd-1.0
	syscall=sparc-netbsd-1.1
	except="pipe fork sigprocmask sigsuspend"
	;;
    i386-*-openbsd2.*)
        name=i386-openbsd-2.0
        sysincludes=openbsd-2.0
        except="fork lseek ftruncate sigsuspend sigprocmask"
        ;;
    i386-*-linux*)
	#name=i386-linux-1.0
	#sysincludes=linux-1.0
	name=i386-linux-2.0
	sysincludes=linux-2.0
	extraincludes="bits"
	;;
    i386-*-bsdi1.1)
	name=i386-bsdi-1.1
	sysincludes=bsdi-1.1
	;;
	i386-*-bsdi2.0* | i386-*-bsdi2.1*)
		name=i386-bsdi-2.0
        sysincludes=bsdi-2.0
        syscall=i386-bsdi-2.0
        except="fork lseek ftruncate sigsuspend"
		;;
changequote(,)dnl
    i386-*-netbsd1.3[H-Z]|i386-*-netbsd1.4*)
	name=i386-netbsd-1.3
	sysincludes=netbsd-1.1
	except="fork lseek ftruncate pipe fstat"
	available_syscalls="sigsuspend sigprocmask"
		;;
changequote([,])dnl
    i386-*-netbsd1.3*)
	name=i386-netbsd-1.3
	sysincludes=netbsd-1.1
	except="fork lseek ftruncate pipe sigsuspend sigprocmask fstat"
	;;
    i386-*-netbsd1.1* | i386-*-netbsd1.2*)
	name=i386-netbsd-1.0
	sysincludes=netbsd-1.1
	syscall=i386-netbsd-1.1
	except="fork lseek ftruncate pipe sigsuspend sigprocmask"
	;;
    i386-*-netbsd1.0*)
	name=i386-netbsd-1.0
	sysincludes=netbsd-1.0
	except="fork lseek ftruncate sigsuspend"
	;;
    i386-*-netbsd0.9*)
	name=i386-netbsd-0.9
	sysincludes=netbsd-0.9
	;;
    m68*-*-netbsd*)
	name=m68000-netbsd
	sysincludes=netbsd-1.1
	except="lseek ftruncate pipe fstat"
	available_syscalls="sigsuspend sigprocmask"
	;;
    i386-*-freebsd*)
        name=i386-freebsd-2.0
        sysincludes=freebsd-2.0
        except="fork lseek ftruncate sigsuspend sigprocmask"
        ;;
    romp-*-bsd*)
	name=romp-bsd
	;;
    mips-dec-ultrix*)
	name=r2000-ultrix-4.2
	sysincludes=ultrix-4.2
	except="fork pipe"
	;;
    mips-sgi-irix*)
	name=ip22-irix-5.2
	sysincludes=irix-5.2
	except="fstat stat"
	AC_DEFINE(BROKEN_SIGNALS)
	;;
    i386-*-sco3.2v5*) 
        name=i386-sco3.2.5
        sysincludes=i386-sco3.2.5
	syscall=i386-sco3.2.5
	except="select socketcall accept bind connect getpeername getsockname getsockopt setsockopt listen recv recvfrom recvmsg send sendmsg sendto shutdown socket socketpair fork fcntl dup2 fstat fchmod fchown ftruncate pipe getdirentries sigaction sigpause wait3 waitpid getdtablesize"
	;;
    *)
	AC_MSG_ERROR(System type $host not recognized or not supported.
See $srcdir/configure.in for supported systems.)
	exit 1
	;;
esac

SYSCALL_EXCEPTIONS=$except
AC_SUBST(SYSCALL_EXCEPTIONS)

AC_CHECK_HEADERS(sys/termio.h termios.h termio.h alloc.h)

dnl Don't use AC_CHECK_HEADERS for this one, we want to define a special
dnl symbol name starting with pthread_ if it's found.
AC_CHECK_HEADER(va_list.h, AC_DEFINE(pthread_have_va_list_h))

dnl Generate a list of system calls that we could generate.  We later use
dnl a syscall template .S file to produce a .o file for each syscall.  This
dnl is a bit better for porting and development purposes than having every
dnl syscall listed for every target system; this way we only need the
dnl template, and special hanlding for only those syscalls that can't be
dnl handled by the templates.
AC_CHECK_HEADERS(syscall.h sys/syscall.h sys/filio.h)

PTHREADS_CHECK_SYSCALLS(open write read creat close fcntl lseek dup2 dup pipe
	fchmod fchown execve fstat lstat link unlink chdir chown chmod stat
	rename select getdtablesize ioctl ftruncate flock fstatfs chroot uname
	dnl - signals
		sigsuspend sigaction sigpause sigprocmask ksigaction
	dnl - directory reading
		getdents readdir getdirentries
	dnl - variants of `wait' syscalls
		wait4 wait3 waitpid waitsys
	dnl - BSD socket calls
		socket bind connect accept listen getsockopt setsockopt socketpair
	dnl - SYSV stream calls
		poll putmsg getmsg
	dnl - Linux version uses one syscall
		socketcall

	dnl - Process info
		pgrpsys

	exit
	readv writev send sendto sendmsg recv recvfrom recvmsg
	getpeername getsockname
	shutdown
	getpgrp fork)

AC_SUBST(available_syscalls)
AC_SUBST(missing_syscalls)

dnl Disabled for now -- generates warnings from autoconf.
dnl ## Check some type sizes.
dnl AC_CHECK_SIZEOF(int)
dnl AC_CHECK_SIZEOF(long)
dnl AC_CHECK_SIZEOF(char *)

## Determine some typedef values from the system header files.
dnl
dnl Autoconf provides these automatically.  They provide reasonable
dnl fallbacks if the standard header files don't define the typedef names.
dnl
dnl AC_TYPE_MODE_T
AC_TYPE_OFF_T
dnl AC_TYPE_PID_T
AC_TYPE_SIZE_T
dnl AC_TYPE_UID_T
AC_TYPE_SIGNAL
dnl
dnl Default these types if their definitions can't be found.
dnl
AC_CHECK_TYPE(ssize_t,int)
AC_CHECK_TYPE(time_t,long)
dnl
AC_CHECK_HEADERS(sys/time.h)
AC_HEADER_TIME

dnl
dnl Check for the existence of these types
dnl
dnl struct timespec
dnl
AC_MSG_CHECKING(for struct timespec in sys/time.h)
AC_CACHE_VAL(pthreads_cv_timespec_in_time,
  AC_TRY_COMPILE([#include <sys/time.h>], [struct timespec foo;],
	pthreads_cv_timespec_in_time=yes, pthreads_cv_timespec_in_time=no))
AC_MSG_RESULT($pthreads_cv_timespec_in_time)
if test $pthreads_cv_timespec_in_time = yes ; then
  AC_DEFINE(_OS_HAS_TIMESPEC)
fi

dnl	socklen_t
AC_CACHE_VAL(pthreads_cv_socklen_t,
  AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>], [socklen_t foo;],
	pthreads_cv_socklen_t=yes, pthreads_cv_socklen_t=no))
AC_MSG_RESULT($pthreads_cv_socklen_t)
if test $pthreads_cv_socklen_t = yes ; then
  AC_DEFINE(_OS_HAS_SOCKLEN_T)
fi


dnl
dnl  Usage: PTHREADS_FIND_TYPE(system-typedef-name, new-macro-name,
dnl				list-of-includes-in-square-brackets,
dnl				comma-separated-list-of-types-to-try)
dnl
dnl  PTHREADS_FIND_INTEGRAL_TYPE automatically provides a set of integral
dnl  types, and does not permit specification of additional types.
dnl
dnl  The specified types must all be able to work as prefixes -- i.e., no
dnl  direct specification of array or function types.  If you need such
dnl  types, add typedefs for them to include/pthread/xtypes.h, and include
dnl  that in the set of header files.  For simple struct types, you can
dnl  try including the definition directly here, but it had better not
dnl  contain any commas or square brackets.
dnl
dnl  If necessary, you can include other preprocessing commands and such
dnl  in the `includes' portion.
dnl
dnl  Note:  For now, each of these needs a corresponding entry
dnl  in acconfig.h.
dnl
dnl size_t
dnl
PTHREADS_FIND_INTEGRAL_TYPE(size_t, pthread_size_t, [
#include <stddef.h>
#include <sys/types.h>
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
])
dnl
dnl ssize_t
dnl
PTHREADS_FIND_INTEGRAL_TYPE(ssize_t, pthread_ssize_t, [
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
])
dnl
dnl clock_t ---FIXME I don't know if this is the right set of header files. KR
dnl
PTHREADS_FIND_INTEGRAL_TYPE(clock_t, pthread_clock_t, [
#include <stddef.h>
#if TIME_WITH_SYS_TIME
# include <time.h>
# include <sys/time.h>
#else
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif
])
dnl
dnl time_t
dnl
PTHREADS_FIND_INTEGRAL_TYPE(time_t, pthread_time_t, [
#include <stddef.h>
#if TIME_WITH_SYS_TIME
# include <time.h>
# include <sys/time.h>
#else
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif
])
dnl
dnl fpos_t
dnl
dnl If fpos_t isn't defined in stdio.h, define it to be off_t.  It
dnl looks like AC_CHECK_TYPE won't work for this, because it doesn't
dnl include stdio.h.
dnl
AC_MSG_CHECKING(for fpos_t in stdio.h)
AC_CACHE_VAL(pthreads_cv_fpos_t_in_stdio,
  AC_TRY_COMPILE([#include <stdio.h>], [fpos_t position;],
	pthreads_cv_fpos_t_in_stdio=yes, pthreads_cv_fpos_t_in_stdio=no))
AC_MSG_RESULT($pthreads_cv_fpos_t_in_stdio)
if test $pthreads_cv_fpos_t_in_stdio = yes ; then
  PTHREADS_FIND_INTEGRAL_TYPE(fpos_t, pthread_fpos_t, [
#include <stdio.h>
#include <sys/types.h>
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
])
else
  AC_DEFINE(fpos_t,off_t)
  AC_DEFINE(pthread_fpos_t,pthread_off_t)
fi
dnl
dnl off_t
dnl
PTHREADS_FIND_INTEGRAL_TYPE(off_t, pthread_off_t, [
#include <stdio.h>
#include <sys/types.h>
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
])
dnl
dnl va_list -- This one could be tricky.  Fortunately, on some systems,
dnl we can just include the gcc stdarg.h header file if we can't determine
dnl the type here.  Won't work for non-gcc configurations though.
dnl
PTHREADS_FIND_TYPE(va_list, pthread_va_list, [#include <stdarg.h>],
	char *, char **, void *, void **, int *, long *)
dnl
dnl

arpa_headers="#include <sys/types.h>
#include <arpa/nameser.h>"

dnl
dnl Type for network (IP) addresses, 32 bits.
dnl For now, I'm assuming that the return type from _getlong is it.
dnl
AC_MSG_CHECKING(IP address type)
AC_CACHE_VAL(pthread_cv_type_ipaddr,
  AC_TRY_COMPILE($arpa_headers,[ &_getlong; ],[
    for type in "unsigned long" "unsigned int" ; do
      AC_TRY_COMPILE($arpa_headers, extern $type _getlong ();,[
        pthread_cv_type_ipaddr="$type"
        break
      ])
    done
  ],[ AC_MSG_WARN(Can't compile _getlong reference.) ])
  if test "$pthread_cv_type_ipaddr" = "" ; then
	AC_MSG_WARN(Can't determine _getlong return type.)
	AC_MSG_WARN(Defaulting to unsigned long.)
	pthread_cv_type_ipaddr="unsigned long"
  fi
)
AC_MSG_RESULT($pthread_cv_type_ipaddr)
AC_DEFINE_UNQUOTED(pthread_ipaddr_type,$pthread_cv_type_ipaddr)

dnl
dnl Type for network (IP) ports, 16 bits.
dnl For now, I'm assuming that the return type from _getshort is it.
dnl
AC_MSG_CHECKING(IP port type)
AC_CACHE_VAL(pthread_cv_type_ipport,
  AC_TRY_COMPILE($arpa_headers,[ &_getshort; ],[
    for type in "unsigned short" "unsigned int" ; do
      AC_TRY_COMPILE($arpa_headers, extern $type _getshort ();,[
        pthread_cv_type_ipport="$type"
        break
      ])
    done
  ],[ AC_MSG_WARN(Can't compile _getshort reference.) ])
  if test "$pthread_cv_type_ipport" = "" ; then
	AC_MSG_WARN(Can't determine _getshort return type.)
	AC_MSG_WARN(Defaulting to unsigned short.) 
	pthread_cv_type_ipport="unsigned short"
  fi
)
AC_MSG_RESULT($pthread_cv_type_ipport)
AC_DEFINE_UNQUOTED(pthread_ipport_type,$pthread_cv_type_ipport)

dnl
dnl Guess where terminal devices are stored.  This is for use in the
dnl ttyname() implementation provided here.
dnl
AC_MSG_CHECKING(pathname for terminal devices directory)
AC_CACHE_VAL(pthread_cv_pty_path,
  if test -d /devices/pseudo ; then
    pty_path=/devices/pseudo/
  else
    pty_path=/dev/
  fi
  pthread_cv_pty_path=$pty_path
)
AC_DEFINE_UNQUOTED(_PATH_PTY,"$pthread_cv_pty_path")
AC_MSG_RESULT($pthread_cv_pty_path)

dnl
dnl Look for timezone info, for use in ctime.
dnl
AC_MSG_CHECKING(directory name for time zone info)
tzdir=NONE
for f in /usr/lib/zoneinfo /usr/share/zoneinfo /usr/share/lib/zoneinfo /etc/zoneinfo /usr/local/lib/zoneinfo
do
  if test -d $f ; then
    tzdir=$f
    break
  fi
done
case $tzdir in
NONE)	
	AC_MSG_WARN(Can't find zoneinfo directory.) 
	AC_MSG_WARN(Defaulting zoneinfo directory to NULL.)
	tzdir=NULL
	;;
esac
AC_DEFINE_UNQUOTED(_PATH_TZDIR,"$tzdir")
AC_MSG_RESULT($tzdir)

AC_MSG_CHECKING(filename for local time zone)
tzfile=NONE
for f in $tzdir/localtime /etc/localtime
do
  if test -f $f ; then
    tzfile=$f
    break
  fi
done
case $tzfile in
NONE)	# Should this default to tzdir/localtime?
	AC_MSG_WARN(Can't find local time zone file.) 
	if test tzdir = NULL ; then
		AC_MSG_WARN(Defaulting local time zone file to NULL)
		tzfile=NULL
	else
		AC_MSG_WARN(Defaulting local time zone file to $tzdir/localtime.) 
		tzfile=$tzdir/localtime
	fi
	;;
esac
AC_DEFINE_UNQUOTED(_PATH_TZFILE,"$tzfile")
AC_MSG_RESULT($tzfile)

dnl
dnl Network stuff.  At the moment, I don't think there are any other
dnl values we should expect.  If we find a system that does store these
dnl files elsewhere -- or doesn't have them all -- then run some tests.
dnl
AC_DEFINE(_PATH_RESCONF,	"/etc/resolv.conf")
AC_DEFINE(_PATH_HOSTS,		"/etc/hosts")
AC_DEFINE(_PATH_NETWORKS,	"/etc/networks")
AC_DEFINE(_PATH_PROTOCOLS,	"/etc/protocols")
AC_DEFINE(_PATH_SERVICES,	"/etc/services")

dnl
dnl Other stuff
dnl
AC_DEFINE(_PATH_BSHELL,		"/bin/sh")

dnl If the system provides vfork, autoconf scripts will detect it.
dnl So we should hide it.
AC_CHECK_FUNCS(vfork)

srctop=`cd ${srcdir}/..;pwd`
AC_SUBST(srctop)

# Now we deal with symlinks &c.

test -d include || mkdir include || \
	AC_MSG_ERROR(Can't create include directory.)

test -d include/pthread || mkdir include/pthread || \
	AC_MSG_ERROR(Can't create include/pthread directory.)

test -d lib || mkdir lib || \
	AC_MSG_ERROR(Can't create lib directory.)

test -d lib/libpthreadutil || mkdir lib/libpthreadutil || \
	AC_MSG_ERROR(Can't create lib/libpthreadutil directory.)

test -d bin || mkdir bin || \
	AC_MSG_ERROR(Can't create bin directory.)

test -d bin/finger || mkdir bin/finger || \
	AC_MSG_ERROR(Can't create bin directory.)

test -d tests || mkdir tests || \
	AC_MSG_ERROR(Can't create tests directory.)

if test x$syscall = xNONE ; then
  syscall=$name
fi

links="include/pthread/machdep.h include/pthread/posix.h \
	machdep.c syscall.S"
targets="../machdep/engine-$name.h ../machdep/posix-$sysincludes.h \
	../machdep/engine-$name.c ../machdep/syscall-$syscall.S"

# Both these targets are optional.  (Autoconf-generated configure scripts
# will require the existence of link targets, so check before adding them
# to the list.)
if test x$sysincludes != xNONE ; then
  links="$links include/sys"
  targets="$targets ../machdep/$sysincludes"
fi

if test x$extraincludes != xNONE ; then
  for tmp in $extraincludes
  do
    links="$links include/$tmp"
    targets="$targets ../machdep/$sysincludes/extra/$tmp"
  done
fi  

syscall_file=../machdep/syscall-template-$syscall.S
if test -r $srcdir/$syscall_file ; then
  links="$links syscall-template.S"
  targets="$targets $syscall_file"
  HAVE_SYSCALL_TEMPLATE=yes
else
  # This really isn't a fatal problem.  In fact, it's expected, initially,
  # for some targets.  This is just to persuade people to fix the targets
  # they deal with to provide some sort of template.
  #
  # Eventually this file probably will be required...
  AC_MSG_WARN(No syscall template file syscall-template-$syscall.S found.)
  HAVE_SYSCALL_TEMPLATE=no
fi
AC_SUBST(HAVE_SYSCALL_TEMPLATE)

dnl Now tell it to make the links.
dnl (The links are actually made by config.status.)
AC_LINK_FILES($targets, $links)

if test x$makefile_frag != x ; then
  makefile_frag=${srcdir}/$makefile_frag
else
  makefile_frag=/dev/null
fi
dnl Drop in file indicated by $makefile_frag on *the line after* the
dnl magic @makefile_frag@ sequence.
AC_SUBST_FILE(makefile_frag)


dnl Generate output files...
AC_CONFIG_HEADER(config.h)

dnl This must be last.
AC_OUTPUT(config.flags GNUmakefile Makefile \
	lib/Makefile:../lib/Makefile.in \
	lib/libpthreadutil/Makefile:../lib/libpthreadutil/Makefile.in \
	bin/Makefile:../bin/Makefile.in \
	bin/finger/Makefile:../bin/finger/Makefile.in \
	tests/Makefile:../tests/Makefile.in)