1dnl @(#)configure.in	1.309 21/08/16 Copyright 1998-2021 J. Schilling
2dnl Process this file with autoconf to produce a configure script.
3AC_REVISION(1.309)dnl
4
5dnl AC_INIT(xconfig.h.in)
6AC_INIT(config.guess)
7AC_CONFIG_HEADER(xconfig.h)
8AC_CANONICAL_HOST
9
10dnl Checks for programs.
11AC_SHELL_BASH
12AC_BIN_SHELL_BASH
13AC_SHELL_CE_BROKEN
14AC_BIN_SHELL_CE_BROKEN
15AC_BIN_SHELL_BOSH
16AC_OPT_SCHILY_BIN_SHELL_BOSH
17dnl CC=${CC-cc}
18dnl AC_PROG_CC
19AC_CHECK_PROG(CC, cc, cc, gcc)	dnl we default to cc not gcc
20dnl The cross compile concepts from GNU autoconf are not usable.
21dnl We permit to execute test programs on a remote machine while
22dnl running "configure" in a cross compile environment.
23AC_PROG_CC			dnl now check for cross compiling
24dnl cross_compiling=remote	dnl disable GNU cross compile "defaults"
25dnl rmtcall="$CONFIG_RMTCALL"	dnl enable script for remote execution
26dnl remote execution of test programs may be set up with:
27dnl CONFIG_RMTCALL=script-path
28dnl and
29dnl CONFIG_RMTHOST=host or CONFIG_RMTHOST=user@host
30dnl If AC_PROG_CC detects a cross compiler and CONFIG_RMTCALL is set, then
31dnl all test programs are automatically transferred to the test machine
32dnl and run on that machine.
33AC_REMOTE_PARMS			dnl check for correct remote parameters
34AC_OBJEXT
35AC_EXEEXT
36AC_PROG_CPP
37AC_PROG_CPPX
38AC_SUN_CC64_OPT
39AC_HP_CC_ANSI_OPT
40AC_HP_CC_OPT_OPT
41AC_HP_CC_GPROF_OPT
42dnl AC_PROG_INSTALL
43AC_PROG_RANLIB
44AC_PROG_MAKE_SET
45AC_CHECK_PROGS(YACC, yacc 'bison -y' byacc, noyacc)
46AC_CHECK_PROGS(BISON, bison, nobison)
47#
48# We need both tsort/lorder or none of them
49#
50AC_PATH_PROG(LORDER, lorder, echo, $PATH:/usr/ccs/bin)
51if test "$LORDER" = echo; then
52	TSORT=cat
53else
54	AC_PATH_PROG(TSORT, tsort, cat, $PATH:/usr/ccs/bin)
55	if test "$TSORT" = cat; then
56		LORDER=echo
57	fi
58fi
59
60#
61# patch(1) needs the PATH to ed(1) and red(1)
62#
63AC_PATH_PROG(path_ed, ed, false, $PATH)
64AC_PATH_PROG(path_red, red, $path_ed, $PATH)
65if test "$cross_compiling" = remote ; then
66path_ed=/bin/ed
67path_red=/bin/red
68AC_MSG_RESULT(cross compiling is not yet supported using /bin/ed and /bin/red)
69fi
70AC_DEFINE_UNQUOTED_STRING(CNF_PATH_ED,$path_ed)
71AC_DEFINE_UNQUOTED_STRING(CNF_PATH_RED,$path_red)
72
73dnl Checks for header files.
74AC_HEADER_STDC
75AC_CHECK_HEADERS(stdarg.h stdlib.h string.h float.h)	dnl AC_HEADER_STDC in particular
76AC_HEADER_INTTYPES
77AC_HEADER_STDINT
78ac_xsave_LIBS="$LIBS"
79LIBS=""
80AC_HEADER_DIRENT
81lib_dir="$LIBS"
82LIBS="$ac_xsave_LIBS"
83AC_HEADER_STAT
84AC_HEADER_TIME
85AC_HEADER_SYS_WAIT
86dnl check whether select() needs sys/select.h
87AC_HEADER_SYS_SELECT
88dnl check whether select() needs sys/socket.h (BeOS)
89AC_HEADER_SELECT2
90AC_CHECK_HEADERS(ar.h)
91AC_CHECK_HEADERS(assert.h)
92AC_CHECK_HEADERS(stdio.h varargs.h stdarg.h stdlib.h stddef.h string.h strings.h unistd.h fcntl.h io.h sys/file.h)
93AC_CHECK_HEADERS(conio.h)
94AC_CHECK_HEADERS(getopt.h)
95AC_CHECK_HEADERS(limits.h)
96AC_CHECK_HEADERS(a.out.h aouthdr.h elf.h)
97AC_CHECK_HEADERS(sysexits.h)
98AC_CHECK_HEADERS(malloc.h posix/malloc.h sgtty.h termios.h termio.h)
99AC_CHECK_HEADERS(pwd.h grp.h sys/acl.h aclutils.h acllib.h acl/libacl.h)
100AC_CHECK_HEADERS(signal.h siginfo.h sys/siginfo.h ucontext.h)
101AC_CHECK_HEADERS(shadow.h syslog.h)
102AC_CHECK_HEADERS(sys/time.h sys/times.h utime.h sys/utime.h sys/ioctl.h sys/filio.h sys/param.h sys/systeminfo.h sys/sysctl.h)
103AC_CHECK_HEADERS(sys/loadavg.h)
104AC_CHECK_HEADERS(sys/syscall.h)
105AC_CHECK_HEADERS(mach/machine.h)
106AC_CHECK_HEADERS(mntent.h sys/mntent.h sys/mnttab.h sys/mount.h)
107AC_CHECK_HEADERS(sys/fork.h vfork.h wait.h sys/wait.h sys/resource.h sys/dbx_plugin.h procfs.h sys/procfs.h libproc.h)
108AC_CHECK_HEADERS(ulimit.h)
109AC_CHECK_HEADERS(process.h)
110AC_CHECK_HEADERS(sys/utsname.h sys/priocntl.h sys/rtpriocntl.h sys/procset.h sys/auxv.h)
111AC_CHECK_HEADERS(sys/mtio.h sys/tape.h sys/mman.h linux/pg.h camlib.h)
112AC_CHECK_HEADERS(sys/shm.h sys/sem.h sys/ipc.h semaphore.h)
113AC_CHECK_HEADERS(sys/dkio.h sys/dklabel.h sun/dkio.h sun/dklabel.h)
114AC_CHECK_HEADERS(sys/types.h sys/stat.h types.h stat.h)
115AC_CHECK_HEADERS(sys/stypes.h sys/filedesc.h)
116AC_CHECK_HEADERS(sys/acct.h)
117AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h)
118AC_CHECK_HEADERS(poll.h sys/poll.h sys/select.h)
119AC_CHECK_HEADERS(netdb.h arpa/aixrcmds.h sys/socket.h netinet/in.h stropts.h)
120AC_CHECK_HEADERS(ieeefp.h fp.h)
121AC_CHECK_HEADERS(values.h float.h math.h)
122AC_CHECK_HEADERS(arpa/inet.h)
123AC_CHECK_HEADERS(rpc/rpc.h)
124AC_CHECK_HEADERS(bsd/dev/scsireg.h)
125dnl Check for HP-UX sys/bsdtty.h (needed for TIOCGPGRP)
126AC_CHECK_HEADERS(sys/bsdtty.h)
127dnl Check for Linux kernel definitions
128AC_CHECK_HEADERS(scsi/scsi.h scsi/sg.h linux/scsi.h linux.sg.h)
129AC_CHECK_HEADERS(linux/types.h linux/gfp.h asm/types.h)
130AC_CHECK_HEADERS(sys/capability.h)
131AC_CHECK_HEADERS(selinux/selinux.h)
132dnl Check for BeOS kernel definitions (e.g. B_PAGE_SIZE)
133AC_CHECK_HEADERS(OS.h)
134dnl needed for newer OS/2 versions of EMX
135AC_CHECK_HEADERS(os2.h)
136AC_CHECK_HEADERS(os2me.h)
137dnl Check for MS-Win's junkyard
138AC_CHECK_HEADERS(windows.h)
139dnl Check for moving Linux targets caused by missing concepts
140AC_CHECK_HEADERS(linux/fs.h ext2fs/ext2_fs.h)
141dnl Check for Linux Extended File Attributes definitions
142AC_CHECK_HEADERS(sys/xattr.h)
143AC_CHECK_HEADERS(attr/xattr.h)
144dnl Check for Mas OS X ac, av, env delarations
145AC_CHECK_HEADERS(crt_externs.h)
146AC_CHECK_HEADERS(fnmatch.h)
147AC_CHECK_HEADERS(libintl.h locale.h langinfo.h nl_types.h)
148AC_CHECK_HEADERS(ctype.h wctype.h wchar.h iconv.h)
149AC_CHECK_HEADERS(priv.h sys/priv.h)
150AC_CHECK_HEADERS(exec_attr.h secdb.h)
151AC_CHECK_HEADERS(direct.h)
152AC_CHECK_HEADERS(pthread.h thread.h)
153AC_CHECK_HEADERS(libgen.h)
154AC_CHECK_HEADERS(regex.h regexp.h regexpr.h)
155AC_CHECK_HEADERS(dlfcn.h link.h dl.h libelf.h)
156AC_CHECK_HEADERS(ranlib.h)
157AC_CHECK_HEADERS(expat.h)
158
159dnl from aclocal.m4 (uses AC_TRY_COMPILE)
160AC_HEADER_MAKEDEV
161
162dnl don't use GNU original
163dnl from GNU acspecific.m4 (uses AC_CHECK_HEADER)
164dnl AC_HEADER_MAJOR
165
166AC_CHECK_MINOR_BITS
167AC_CHECK_MINOR_NONCONTIG
168
169AC_HEADER_USG_STDIO
170AC_HEADER_ERRNO_DEF
171AC_HEADER_ENVIRON_DEF
172AC_HEADER_SYS_SIGLIST_DEF
173AC_WNOWAIT_WAITPID
174
175dnl Checks for typedefs, structures, and compiler characteristics.
176AC_C_CONST
177AC_C_BIGENDIAN
178AC_C_BITFIELDS
179AC_C_STRINGIZE
180AC_C_INLINE
181AC_C_NOINLINE
182AC_TYPE_SIGNAL
183AC_TYPE_GETGROUPS
184AC_TYPE_LONGLONG
185AC_TYPE___INT64
186AC_TYPE_LONGDOUBLE
187AC_TYPE_PROTOTYPES
188dnl AC_USER_MALLOC must be past AC_CHECK_FUNCS(strdup)
189AC_DYN_ARRAYS
190AC_PRAGMA_WEAK
191AC_SIGSTKSZ_CONST
192
193dnl This is a hack to compile two files and to check whether a weak alias from
194dnl one file can be seen in another file. The reason for this test is to detect
195dnl a bug on Cygwin that causes waek symbols to become "local" symbols that
196dnl are useless because they would be invisible for other parts of the code.
197
198if test $ac_cv_pragma_weak = yes; then
199AC_TRY_COMPILE2([#pragma weak weakname = conffunc],[],[true],[true])
200ac_save_LIBS="$LIBS"
201LIBS="conftest2.$ac_cv_objext"
202AC_CACHE_CHECK([if linker allows pragma weak], ac_cv_link_weak,
203                [AC_TRY_LINK([extern int weakname();],
204[return weakname();],
205                [ac_cv_link_weak=yes],
206                [ac_cv_link_weak=no])])
207LIBS="$ac_save_LIBS"
208if test $ac_cv_link_weak = yes; then
209  AC_DEFINE(HAVE_LINK_WEAK)
210fi
211rm -f conftest2.*
212fi
213
214AC_TYPE_UID_T
215AC_TYPE_SIZE_T
216AC_CHECK_TYPE(ssize_t, int)
217AC_CHECK_TYPE(ptrdiff_t, int)
218AC_TYPE_PID_T
219AC_TYPE_OFF_T
220AC_TYPE_MODE_T
221AC_TYPE_TIME_T
222AC_CHECK_TYPE(caddr_t, char *)
223AC_CHECK_TYPE(daddr_t, long)
224AC_CHECK_TYPE(dev_t, unsigned short)
225AC_CHECK_TYPE(major_t, dev_t)
226AC_CHECK_TYPE(minor_t, dev_t)
227AC_CHECK_TYPE(ino_t, unsigned long)
228AC_CHECK_TYPE(nlink_t, unsigned long)
229AC_CHECK_TYPE(blksize_t, long)
230AC_CHECK_TYPE(blkcnt_t, Intmax_t)
231AC_TYPE_CLOCK_T
232AC_TYPE_SOCKLEN_T
233AC_HAVE_TYPE([#include <sys/frame.h>], greg_t)
234AC_HAVE_TYPE([#include <sys/resource.h>], rlim_t)
235dnl NetBSD-5 has an idtype_t that is in conflict with POSIX
236dnl AC_HAVE_TYPE([#include <sys/wait.h>], idtype_t)
237AC_TYPE_IDTYPE_T
238AC_HAVE_TYPE([#include <sys/wait.h>], siginfo_t)
239AC_TYPE_STACK_T
240AC_TYPE_SIGINFO_T
241
242dnl These types are present on all UNIX systems but should be avoided
243dnl for portability.
244dnl On Apollo/Domain OS we don't have them....
245dnl Better include <utypes.h> and use Uchar, Uint & Ulong
246AC_CHECK_TYPE(u_char, unsigned char)
247AC_CHECK_TYPE(u_short, unsigned short)
248AC_CHECK_TYPE(u_int, unsigned int)
249AC_CHECK_TYPE(u_long, unsigned long)
250
251AC_INCL_CHECK_TYPE(
252[#ifdef	HAVE_INTTYPES_H
253#include <inttypes.h>
254#endif
255#ifdef	HAVE_STDINT_H
256#include <stdint.h>
257#endif
258], int8_t, Int8_t)
259
260AC_INCL_CHECK_TYPE(
261[#ifdef	HAVE_INTTYPES_H
262#include <inttypes.h>
263#endif
264#ifdef	HAVE_STDINT_H
265#include <stdint.h>
266#endif
267], int16_t, Int16_t)
268
269AC_INCL_CHECK_TYPE(
270[#ifdef	HAVE_INTTYPES_H
271#include <inttypes.h>
272#endif
273#ifdef	HAVE_STDINT_H
274#include <stdint.h>
275#endif
276], int32_t, Int32_t)
277
278AC_INCL_CHECK_TYPE(
279[#ifdef	HAVE_INTTYPES_H
280#include <inttypes.h>
281#endif
282#ifdef	HAVE_STDINT_H
283#include <stdint.h>
284#endif
285], int64_t, Int64_t)
286
287AC_INCL_CHECK_TYPE(
288[#ifdef	HAVE_INTTYPES_H
289#include <inttypes.h>
290#endif
291#ifdef	HAVE_STDINT_H
292#include <stdint.h>
293#endif
294], intmax_t, Intmax_t)
295
296AC_INCL_CHECK_TYPE(
297[#ifdef	HAVE_INTTYPES_H
298#include <inttypes.h>
299#endif
300#ifdef	HAVE_STDINT_H
301#include <stdint.h>
302#endif
303], intptr_t, Intptr_t)
304
305AC_INCL_CHECK_TYPE(
306[#ifdef	HAVE_INTTYPES_H
307#include <inttypes.h>
308#endif
309#ifdef	HAVE_STDINT_H
310#include <stdint.h>
311#endif
312], uint8_t, UInt8_t)
313
314AC_INCL_CHECK_TYPE(
315[#ifdef	HAVE_INTTYPES_H
316#include <inttypes.h>
317#endif
318#ifdef	HAVE_STDINT_H
319#include <stdint.h>
320#endif
321], uint16_t, UInt16_t)
322
323AC_INCL_CHECK_TYPE(
324[#ifdef	HAVE_INTTYPES_H
325#include <inttypes.h>
326#endif
327#ifdef	HAVE_STDINT_H
328#include <stdint.h>
329#endif
330], uint32_t, UInt32_t)
331
332AC_INCL_CHECK_TYPE(
333[#ifdef	HAVE_INTTYPES_H
334#include <inttypes.h>
335#endif
336#ifdef	HAVE_STDINT_H
337#include <stdint.h>
338#endif
339], uint64_t, UInt64_t)
340
341AC_INCL_CHECK_TYPE(
342[#ifdef	HAVE_INTTYPES_H
343#include <inttypes.h>
344#endif
345#ifdef	HAVE_STDINT_H
346#include <stdint.h>
347#endif
348], uintmax_t, UIntmax_t)
349
350AC_INCL_CHECK_TYPE(
351[#ifdef	HAVE_INTTYPES_H
352#include <inttypes.h>
353#endif
354#ifdef	HAVE_STDINT_H
355#include <stdint.h>
356#endif
357], uintptr_t, UIntptr_t)
358
359AC_INCL_CHECK_TYPE(
360[#ifdef	HAVE_WCHAR_H
361#include <wchar.h>
362#endif
363#ifdef	HAVE_WCTYPE_H
364#include <wctype.h>
365#endif
366], wctype_t, int)
367
368AC_INCL_CHECK_TYPE(
369[#ifdef	HAVE_WCHAR_H
370#include <wchar.h>
371#endif
372#ifdef	HAVE_WCTYPE_H
373#include <wctype.h>
374#endif
375#include <sys/types.h>
376], wint_t, int)
377
378AC_INCL_CHECK_TYPE(
379[#ifdef	HAVE_WCHAR_H
380#include <wchar.h>
381#endif
382#ifdef	HAVE_WCTYPE_H
383#include <wctype.h>
384#endif
385], mbstate_t, int)
386
387AC_INCL_CHECK_TYPE(
388#ifdef	HAVE_SYS_STAT_H
389[#include <sys/stat.h>
390#endif
391#ifdef	HAVE_STAT_H
392#include <stat.h>
393#endif
394], timestruc_t, struct timespec)
395
396AC_CHECK_SIZEOF(char)
397AC_CHECK_SIZEOF(short int)
398AC_CHECK_SIZEOF(int)
399AC_CHECK_SIZEOF(long int)
400AC_CHECK_SIZEOF(long long)
401AC_CHECK_SIZEOF(__int64)
402AC_CHECK_SIZEOF(char *)
403
404AC_CHECK_SIZEOF(unsigned char)
405AC_CHECK_SIZEOF(unsigned short int)
406AC_CHECK_SIZEOF(unsigned int)
407AC_CHECK_SIZEOF(unsigned long int)
408AC_CHECK_SIZEOF(unsigned long long)
409AC_CHECK_SIZEOF(unsigned __int64)
410AC_CHECK_SIZEOF(unsigned char *)
411AC_CHECK_SIZEOF(float)
412AC_CHECK_SIZEOF(double)
413AC_CHECK_SIZEOF(long double)
414
415AC_CHECK_SIZEOF(size_t)
416AC_CHECK_SIZEOF(ssize_t)
417AC_CHECK_SIZEOF(ptrdiff_t)
418
419AC_CHECK_SIZEOF(mode_t)
420AC_CHECK_SIZEOF(uid_t)
421AC_CHECK_SIZEOF(gid_t)
422AC_CHECK_SIZEOF(pid_t)
423
424AC_CHECK_SIZEOF(dev_t)
425AC_CHECK_SIZEOF(major_t)
426AC_CHECK_SIZEOF(minor_t)
427
428dnl This call must be past AC_CHECK_SIZEOF(long int)
429AC_CHECK_SIZE_TIME_T
430AC_CHECK_SIZE_WCHAR
431AC_CHECK_SIZE_WCHAR_T
432
433dnl # AC_TYPE_SIZE_T_		# Defines HAVE_SIZE_T / NO_SIZE_T
434AC_TYPE_CHAR
435AC_TYPE_VA_LIST
436AC_HEADER_FILE__FLAGS
437AC_HEADER_FILE__IO_BUF_BASE
438AC_STRUCT_TIMEVAL
439AC_STRUCT_TIMEZONE
440AC_STRUCT_TIMESPEC
441AC_STRUCT_MTGET_TYPE
442AC_STRUCT_MTGET_MODEL
443AC_STRUCT_MTGET_DSREG
444AC_STRUCT_MTGET_DSREG1
445AC_STRUCT_MTGET_DSREG2
446AC_STRUCT_MTGET_GSTAT
447AC_STRUCT_MTGET_ERREG
448AC_STRUCT_MTGET_RESID
449AC_STRUCT_MTGET_FILENO
450AC_STRUCT_MTGET_BLKNO
451AC_STRUCT_MTGET_FLAGS
452AC_STRUCT_MTGET_BF
453AC_STRUCT_RUSAGE
454AC_STRUCT_SI_UTIME
455AC_STRUCT_SOCKADDR_STORAGE
456AC_STRUCT_UNION_SEMUN
457AC_STRUCT_UNION_WAIT
458AC_USE_STRUCT_UNION_WAIT
459AC_STRUCT_ST_SPARE1
460AC_STRUCT_ST_ATIMENSEC
461AC_STRUCT_ST_ATIME_N
462AC_STRUCT_ST_NSEC
463AC_STRUCT_ST__TIM
464AC_STRUCT_ST_ATIMESPEC
465AC_STRUCT_ST_BLKSIZE
466AC_STRUCT_ST_BLOCKS
467AC_STRUCT_ST_FSTYPE
468AC_STRUCT_ST_ACLCNT
469AC_STRUCT_ST_RDEV
470AC_STRUCT_ST_FLAG
471AC_STRUCT_ST_FLAGS
472AC_STRUCT_DIRENT_D_INO
473AC_STRUCT_DIRENT_D_TYPE
474AC_STRUCT_DIR_DD_FD
475AC_STRUCT_UTSNAME_ARCH
476AC_STRUCT_UTSNAME_PROCESSOR
477AC_STRUCT_UTSNAME_SYSNAME_HOST
478AC_STRUCT_UTSNAME_RELEASE_HOST
479AC_STRUCT_UTSNAME_VERSION_HOST
480AC_STRUCT_PW_PASSWD
481
482dnl Check whether iconv() uses const char ** arguments
483AC_ICONV_CONST
484
485dnl Check whether we are able to get the address of a function
486dnl or whether the symbol is declared and usable as rhs
487AC_CHECK_DECLARE([
488#include <sys/types.h>
489#include <sys/stat.h>], stat)
490AC_CHECK_DECLARE([
491#include <sys/types.h>
492#include <sys/stat.h>], lstat)
493
494dnl Checks for library functions.
495AC_FUNC_WAIT3
496AC_FUNC_MLOCK
497AC_FUNC_MLOCKALL
498AC_FUNC_VA_COPY
499AC_FUNC__VA_COPY
500AC_FUNC_ECVT
501AC_FUNC_FCVT
502AC_FUNC_GCVT
503AC_FUNC_DTOA
504AC_FUNC_DTOA_R
505AC_FUNC_GETPAGESIZE
506jsAC_FUNC_MMAP
507AC_MMAP_SIZEP
508AC_FUNC_SMMAP
509AC_FUNC_SHMGET
510AC_FUNC_ALLOCA
511AC_FUNC_QUOTAIOCTL
512AC_FUNC_FCNTL_LOCKF
513AC_FUNC_UNAME
514AC_CHECK_FUNCS(execl)
515AC_FUNC_VFORK
516AC_FUNC_SYS_SIGLIST
517AC_FUNC_BSD_GETPGRP
518AC_FUNC_BSD_SETPGRP
519AC_FUNC_C99_ISINF
520AC_FUNC_C99_ISNAN
521AC_FUNC_SIGSETJMP
522AC_FUNC_SIGLONGJMP
523AC_FUNC_PRINTF_J
524AC_FUNC_PRINTF_Z
525AC_FUNC_PRINTF_LL
526AC_FUNC_REALLOC_NULL
527AC_FUNC_WAITID
528AC_CHECK_FUNCS(access eaccess euidaccess)
529AC_CHECK_FUNCS(memchr memcmp memcpy memccpy memmove memset)
530AC_CHECK_FUNCS(brk sbrk strerror nice flock lockf fchdir statvfs quotactl)
531AC_CHECK_FUNCS(realpath resolvepath)
532AC_CHECK_FUNCS(dup dup2)
533AC_CHECK_FUNCS(getcwd shmat semget)
534AC_CHECK_FUNCS(lstat readlink symlink link rename mkfifo mknod)
535AC_CHECK_FUNCS(setreuid setresuid seteuid setuid)
536AC_CHECK_FUNCS(setregid setresgid setegid setgid)
537AC_CHECK_FUNCS(getuid geteuid getgid getegid)
538AC_CHECK_FUNCS(getpid getppid)
539AC_CHECK_FUNCS(getpgid setpgid getsid setsid)
540AC_CHECK_FUNCS(getpgrp setpgrp)
541AC_CHECK_FUNCS(getpwnam getpwent getpwuid setpwent endpwent)
542AC_CHECK_FUNCS(getgrnam getgrent getgrgid setgrent endgrent)
543dnl			getspwnam() on HP-UX is in libsec.a
544AC_CHECK_FUNCS(getspnam getspwnam)
545AC_CHECK_FUNCS(getlogin)
546dnl Cannot simply include "waitid" here as the so called POSIX compliant
547dnl Mac OS X comes with a completely broken waitid() implementation.
548AC_CHECK_FUNCS(sync fsync fork forkx vforkx forkall forkallx wait wait4 wait6 waitpid getrusage getrlimit setrlimit ulimit)
549AC_CHECK_FUNCS(execl execle execlp execv execve execvp)
550AC_CHECK_FUNCS(spawnl spawnle spawnlp spawnlpe)
551AC_CHECK_FUNCS(spawnv spawnve spawnvp spawnvpe)
552AC_CHECK_FUNCS(cwait)
553AC_CHECK_FUNCS(getexecname)
554AC_CHECK_FUNCS(getprogname setprogname)
555AC_CHECK_FUNCS(proc_pidpath getauxval elf_aux_info)
556AC_CHECK_FUNCS(getloadavg)
557AC_CHECK_FUNCS(gethostid gethostname getdomainname getdtablesize)
558AC_CHECK_FUNCS(gettimeofday settimeofday time stime gethrtime)
559AC_CHECK_FUNCS(ftime tzset mktime gmtime localtime timegm timelocal)
560AC_CHECK_FUNCS(ctime cftime ascftime strftime)
561AC_CHECK_FUNCS(poll select isastream)
562AC_CHECK_FUNCS(chown fchown lchown chmod fchmod lchmod times utime utimes futimes lutimes)
563AC_CHECK_FUNCS(utimens lutimens)
564AC_CHECK_FUNCS(futimens utimensat)
565AC_CHECK_FUNCS(ioctl fcntl)
566dnl AC_CHECK_FUNCS(ecvt fcvt gcvt)
567AC_CHECK_FUNCS(qecvt qfcvt qgcvt)
568AC_CHECK_FUNCS(_qecvt _qfcvt _qgcvt)
569AC_CHECK_FUNCS(_qecvt_r _qfcvt_r _qgcvt_r)
570AC_CHECK_FUNCS(_ldecvt _ldfcvt _ldgcvt)
571AC_CHECK_FUNCS(ecvt_r fcvt_r gcvt_r)
572AC_CHECK_FUNCS(_ldecvt_r _ldfcvt_r _ldgcvt_r)
573AC_CHECK_FUNCS(econvert fconvert gconvert)
574AC_CHECK_FUNCS(qeconvert qfconvert qgconvert)
575AC_CHECK_FUNCS(isinf isnan)
576AC_CHECK_FUNCS(getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked)
577AC_CHECK_FUNCS(flockfile funlockfile ftrylockfile)
578AC_CHECK_FUNCS(rand drand48)
579AC_CHECK_FUNCS(strtol strtoll strtoul strtoull strtod)
580AC_CHECK_FUNCS(setpriority DosSetPriority)
581AC_CHECK_FUNCS(DosAllocSharedMem)
582AC_CHECK_FUNCS(getdelim)
583AC_CHECK_FUNCS(seekdir fdopendir)
584dnl These are POSIX.1 functions (syscalls on Solaris)
585AC_CHECK_FUNCS(openat fstatat fchownat futimesat renameat unlinkat)
586dnl This is a library function for the Solaris extended attr interface
587AC_CHECK_FUNCS(attropen)
588dnl This appeared on Solaris 11 Build 63
589AC_CHECK_FUNCS(__accessat)
590dnl This appeared not yet in POSIX
591AC_CHECK_FUNCS(accessat)
592dnl This are POSIX extensions not found on Solaris 10
593AC_CHECK_FUNCS(mkdirat faccessat fchmodat linkat mkfifoat mknodat readlinkat symlinkat)
594AC_CHECK_FUNCS(pipe _pipe)
595AC_CHECK_FUNCS(popen pclose _popen _pclose)
596AC_CHECK_FUNCS(closefrom)
597AC_CHECK_FUNCS(strsignal str2sig sig2str)
598AC_CHECK_FUNCS(kill killpg)
599AC_CHECK_FUNCS(signal sighold sigrelse sigignore sigpause sigprocmask sigsetmask sigset sigaltstack sigblock)
600AC_CHECK_FUNCS(alarm sleep usleep yield)
601AC_CHECK_FUNCS(atexit on_exit)
602dnl tcgetattr and tcsetattr are a inline functions in termios.h on Android
603AC_CHECK_DFUNC([
604#ifdef	HAVE_TERMIOS_H
605#include <termios.h>
606#endif
607], tcgetattr)
608AC_CHECK_DFUNC([
609#ifdef	HAVE_TERMIOS_H
610#include <termios.h>
611#endif
612], tcsetattr)
613AC_CHECK_FUNCS(tcgetpgrp tcsetpgrp tcgetsid)
614AC_CHECK_FUNCS(getenv putenv setenv unsetenv)
615AC_CHECK_FUNCS(snprintf strcasecmp strncasecmp)
616AC_CHECK_FUNCS(vprintf vfprintf vsprintf vsnprintf)
617
618AC_CHECK_DFUNCS([
619#ifdef	HAVE_STRING_H
620#include <string.h>
621#endif
622], strcat strncat strcmp strncmp strcpy strlcat strlcpy strncpy strdup strndup strlen strnlen strchr strrchr strstr strspn strcspn)
623AC_CHECK_DFUNCS([
624#ifdef	HAVE_WCHAR_H
625#include <wchar.h>
626#endif
627], wcscat wcsncat wcscmp wcsncmp wcscpy wcslcat wcslcpy wcsncpy wcsdup wcsndup wcslen wcsnlen wcschr wcsrchr wcsstr wcsspn wcscspn)
628
629AC_CHECK_FUNCS(wcwidth wcswidth wctype iswctype wcstol wcstoll wcstoul wcstoull)
630AC_CHECK_FUNCS(fgetws)
631AC_CHECK_FUNCS(basename dirname)
632AC_CHECK_FUNCS(pathconf fpathconf lpathconf)
633AC_CHECK_FUNCS(malloc calloc valloc realloc memalign posix_memalign)
634AC_CHECK_FUNCS(madvise)
635AC_CHECK_FUNCS(mktemp mkstemp)
636AC_CHECK_FUNCS(chflags fchflags fflagstostr strtofflags)
637AC_CHECK_FUNCS(fnmatch)
638AC_CHECK_FUNCS(truncate ftruncate)
639AC_CHECK_FUNCS(getppriv setppriv priv_set)
640AC_CHECK_FUNCS(issetugid)
641AC_CHECK_FUNCS(getroles privbit_set)
642AC_CHECK_FUNCS(setlocale localeconv nl_langinfo)
643AC_CHECK_FUNCS(setbuf setvbuf)
644AC_CHECK_FUNCS(clone_area create_area delete_area)
645
646dnl The official POSIX rule is not to define "new" interfaces that
647dnl are in conflict with older interfaces of the same name.
648dnl Our interfaces fexec*() have been defined and published in 1982.
649dnl The new POSIX interfaces define a different interface and the
650dnl new POSIX interfaces even use names that are not compatible with
651dnl POSIX rules. The new POSIX interfaces in question should be called
652dnl fdexec*() to follow the rules of other similar POSIX functions.
653dnl
654dnl We use AC_RCHECK_FUNCS() because some Linux distros define a
655dnl fexecve() that returns ENOSYS an AC_CHECK_FUNCS() would return FALSE
656dnl
657echo Checking for POSIX violations by the POSIX.1-2008 standard:
658AC_RCHECK_FUNCS(fexecl fexecle fexecv fexecve)
659AC_RCHECK_FUNCS(fspawnv fspawnl fspawnv_nowait)
660
661dnl A similar problem exists with the new POSIX.1-2008 interfaces
662dnl getline() and fgetline(). These interfaces are also incompatible
663dnl with our interfaces defined in 1982.
664AC_RCHECK_FUNCS(getline fgetline)
665echo End of tests for POSIX violations by the POSIX.1-2008 standard.
666
667dnl Check whether a symbol is either defined in an include file or
668dnl otherwise usable (e.g. as function)
669AC_CHECK_DFUNC([#include <dirent.h>], dirfd)
670
671AC_CHECK_DFUNC([
672#ifdef	HAVE_WCHAR_H
673#include <wchar.h>
674#endif
675#ifdef	HAVE_WCTYPE_H
676#include <wctype.h>
677#endif
678], iswprint)
679
680AC_CHECK_DFUNC([
681#ifdef	HAVE_WCHAR_H
682#include <wchar.h>
683#endif
684#ifdef	HAVE_WCTYPE_H
685#include <wctype.h>
686#endif
687], iswblank)
688
689AC_CHECK_DFUNC([
690#ifdef	HAVE_CTYPE_H
691#include <ctype.h>
692#endif
693], isblank)
694
695AC_CHECK_DFUNC([
696#ifdef	HAVE_WCHAR_H
697#include <wchar.h>
698#endif
699#ifdef	HAVE_WCTYPE_H
700#include <wctype.h>
701#endif
702], mbsinit)
703
704AC_CHECK_DFUNC([
705#ifdef	HAVE_STDLIB_H
706#include <stdlib.h>
707#endif
708], mbtowc)
709
710AC_CHECK_DFUNC([
711#ifdef	HAVE_STDLIB_H
712#include <stdlib.h>
713#endif
714], wctomb)
715
716AC_CHECK_DFUNC([
717#ifdef	HAVE_WCHAR_H
718#include <wchar.h>
719#endif
720#ifdef	HAVE_WCTYPE_H
721#include <wctype.h>
722#endif
723], mbrtowc)
724
725AC_CHECK_DFUNC([
726#ifdef	HAVE_WCHAR_H
727#include <wchar.h>
728#endif
729#ifdef	HAVE_WCTYPE_H
730#include <wctype.h>
731#endif
732], wcrtomb)
733
734AC_CHECK_DFUNC([#include <ieeefp.h>], finite)
735AC_CHECK_DFUNC([#include <ieeefp.h>], isnand)
736
737dnl Checks for typedefs, structures, and compiler characteristics.
738dnl that need results from the AC_CHECK_FUNCS() calls.
739AC_USER_MALLOC
740dnl AC_USER_XCVT test macro does not yet work
741AC_VAR_TIMEZONE
742AC_VAR_TIMEZONE_DEF
743AC_VAR___PROGNAME
744AC_VAR___PROGNAME_FULL
745
746dnl Checks for OS characteristics.
747AC_HARD_SYMLINKS
748AC_LINK_NOFOLLOW
749AC_ACCESS_E_OK
750AC_FNMATCH_IGNORECASE
751
752dnl Need to check this in default compilation mode to find out
753dnl whether this platform supports both functions by default too.
754dnl We cannot use the standard tests because they would find
755dnl that fseeko()/ftello() are present in small file mode on
756dnl Limnux while there is no prototype for these functions.
757AC_SMALL_FSEEKO
758AC_SMALL_FTELLO
759
760AC_CHECK_LIB(c, dlopen, lib_dl="",
761  [AC_CHECK_LIB(dl, dlopen, lib_dl="-ldl")])
762ac_save_LIBS="$LIBS"
763LIBS="$LIBS $lib_dl"
764AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror dlinfo)
765AC_CHECK_FUNCS(shl_load shl_unload shl_gethandle)
766LIBS="$ac_save_LIBS"
767if test ."$lib_dl" = .""; then
768	AC_DEFINE(HAVE_DLOPEN_IN_LIBC)
769fi
770
771AC_CHECK_DFUNCS([
772#ifdef	HAVE_WINDOWS_H
773#undef	u_char
774#undef	u_short
775#undef	u_int
776#undef	u_long
777#include <windows.h>
778#endif
779], LoadLibrary FreeLibrary GetProcAddress)
780
781dnl ??? AC_CHECK_LIB(socket, socket, lib_socket="-lsocket")
782dnl
783ac_save_LIBS="$LIBS"
784AC_CHECK_LIB(c, socket, lib_socket="",
785  [AC_CHECK_LIB(socket, socket, lib_socket="-lsocket")])
786LIBS="$ac_save_LIBS"
787AC_CHECK_LIB(c, gethostbyname, lib_nsl="",
788  [AC_CHECK_LIB(nsl, gethostbyname, lib_nsl="-lnsl",
789    [AC_CHECK_LIB(network, gethostbyname, lib_nsl="-lnetwork")])])
790LIBS="$ac_save_LIBS"
791LIBS="$LIBS $lib_nsl $lib_socket"
792AC_CHECK_FUNCS(rcmd socket socketpair)
793AC_CHECK_FUNCS(getservbyname inet_ntoa)
794AC_CHECK_FUNCS(getaddrinfo getnameinfo)
795AC_CHECK_FUNCS(host2netname netname2host)
796LIBS="$ac_save_LIBS"
797
798ac_save_LIBS="$LIBS"
799AC_CHECK_LIB(c, res_init, lib_resolv="",
800  [AC_CHECK_LIB(resolv, res_init, lib_resolv="-lresolv")])
801LIBS="$ac_save_LIBS"
802if test ."$lib_resolv" = .""; then
803	AC_DEFINE(HAVE_RESOLV_IN_LIBC)
804fi
805
806dnl Check for largefile support
807dnl Do this last to make sure that no large file definition
808dnl in confdefs.h will modify our results
809AC_SYS_LARGEFILE
810dnl Warning do not run this test. it interferes with the test
811dnl AC_CHECK_FUNCS(fseeko ftello) from above.
812dnl The test AC_HAVE_LARGEFILES will check whether ftello/fseeko
813dnl are available in Large File mode
814dnl AC_FUNC_FSEEKO
815AC_HAVE_LARGEFILES
816
817AC_DEFINE_UNQUOTED_STRING(HOST_ALIAS,$host_alias)
818AC_DEFINE_UNQUOTED_STRING(HOST_SUB,$host)
819AC_DEFINE_UNQUOTED_STRING(HOST_CPU,$host_cpu)
820AC_DEFINE_UNQUOTED_STRING(HOST_VENDOR,$host_vendor)
821AC_DEFINE_UNQUOTED_STRING(HOST_OS,$host_os)
822
823dnl AC_CHECK_LIB(crypt, crypt, lib_crypt="-lcrypt")
824
825AC_CHECK_LIB(c, crypt, lib_crypt="",
826  [AC_CHECK_LIB(crypt, crypt, lib_crypt="-lcrypt")])
827if test ."$lib_crypt" = .""; then
828	AC_DEFINE(HAVE_CRYPT_IN_LIBC)
829fi
830
831ac_save_LIBS="$LIBS"
832LIBS="$LIBS $lib_crypt"
833AC_CHECK_FUNCS(crypt)
834LIBS="$ac_save_LIBS"
835
836AC_CHECK_ILIB([#include <libintl.h>], c, gettext, lib_intl="",
837  [AC_CHECK_ILIB([#include <libintl.h>], intl, gettext, lib_intl="-lintl")])
838if test ."$lib_intl" = .""; then
839	AC_DEFINE(HAVE_GETTEXT_IN_LIBC)
840fi
841
842ac_save_LIBS="$LIBS"
843LIBS="$LIBS $lib_intl"
844AC_CHECK_DFUNC([#include <libintl.h>], gettext)
845LIBS="$ac_save_LIBS"
846
847AC_CHECK_ILIB([#include <iconv.h>], c, iconv_open, lib_iconv="",
848    [AC_CHECK_ILIB([#include <iconv.h>], iconv, iconv_open, lib_iconv="-liconv")])
849if test ."$lib_iconv" = .""; then
850	AC_DEFINE(HAVE_ICONV_IN_LIBC)
851fi
852
853ac_save_LIBS="$LIBS"
854LIBS="$LIBS $lib_iconv"
855AC_CHECK_DFUNC([#include <iconv.h>], iconv)
856AC_CHECK_DFUNC([#include <iconv.h>], iconv_open)
857AC_CHECK_DFUNC([#include <iconv.h>], iconv_close)
858dnl GNU libiconv on Linux and Cygwin may make "configure" fail :-(
859AC_CHECK_DFUNC([#include <iconv.h>], libiconv)
860AC_CHECK_DFUNC([#include <iconv.h>], libiconv_open)
861AC_CHECK_DFUNC([#include <iconv.h>], libiconv_close)
862LIBS="$ac_save_LIBS"
863
864AC_CHECK_LIB(c, XML_Parse, lib_expat="",
865  [AC_CHECK_LIB(expat, XML_Parse, lib_expat="-lexpat")])
866if test ."$lib_expat" = ."" -a "$ac_cv_lib_c_XML_Parse" = yes ; then
867	AC_DEFINE(HAVE_EXPAT_IN_LIBC)
868fi
869ac_save_LIBS="$LIBS"
870LIBS="$LIBS $lib_expat"
871AC_CHECK_FUNCS(XML_Parse)
872LIBS="$ac_save_LIBS"
873
874if test "$CC" = cl.exe; then
875	echo configure does not yet support library checks for cl.exe:
876	echo checking for SCardEstablishContext in -lwinscard... we know it is present
877	lib_pcsc="-lwinscard"
878	AC_DEFINE(HAVE_SCARDESTABLISHCONTEXT)
879else
880	AC_CHECK_LIB(c, SCardEstablishContext, lib_pcsc="",
881	  [AC_CHECK_LIB(winscard, SCardEstablishContext, lib_pcsc="-lwinscard",
882	  [AC_CHECK_LIB(pcsclite, SCardEstablishContext, lib_pcsc="-lpcsclite")])])
883	if test ."$lib_pcsc" = ."" -a "$ac_cv_lib_c_SCardEstablishContext" = yes ; then
884		AC_DEFINE(HAVE_PCSC_IN_LIBC)
885	fi
886	ac_save_LIBS="$LIBS"
887	LIBS="$LIBS $lib_pcsc"
888	AC_CHECK_FUNCS(SCardEstablishContext)
889	LIBS="$ac_save_LIBS"
890fi
891
892if test "$CC" = cl.exe; then
893	echo configure does not yet support library checks for cl.exe:
894	echo checking for CRYPTO_free in -llibeay32... we know it is present
895	echo checking for SSL_free in -lssleay32... we know it is present
896	lib_crypto="-llibeay32"
897	lib_ssl="-lssleay32"
898else
899	AC_CHECK_LIB(c, CRYPTO_free, lib_crypto="",
900	  [AC_CHECK_LIB(crypto, CRYPTO_free, lib_crypto="-lcrypto")])
901	if test ."$lib_crypto" = ."" -a "$ac_cv_lib_c_CRYPTO_free" = yes ; then
902		AC_DEFINE(HAVE_CRYPTO_IN_LIBC)
903	fi
904	ac_save_LIBS="$LIBS"
905	LIBS="$LIBS $lib_crypto"
906	AC_CHECK_FUNCS(CRYPTO_free)
907	LIBS="$ac_save_LIBS"
908	AC_CHECK_LIB(c, SSL_free, lib_ssl="",
909	  [AC_CHECK_LIB(ssl, SSL_free, lib_ssl="-lssl")])
910	if test ."$lib_ssl" = ."" -a "$ac_cv_lib_c_SSL_free" = yes ; then
911		AC_DEFINE(HAVE_SSL_IN_LIBC)
912	fi
913	ac_save_LIBS="$LIBS"
914	LIBS="$LIBS $lib_ssl"
915	AC_CHECK_FUNCS(SSL_free)
916	LIBS="$ac_save_LIBS"
917fi
918
919if test $ac_cv_header_camlib_h = yes; then
920  scsi_lib=-lcam
921  lib_scsi=-lcam
922fi
923
924if test "$ac_cv_header_sys_acl_h" = yes; then
925
926  AC_CHECKING(for withdrawn Posix draft Access Control List support)
927  AC_CHECK_LIB(acl, acl_get_file, lib_acl="-lacl")
928  AC_CHECK_LIB(pacl, acl_get_file, lib_acl="-lpacl")
929
930	dnl If $lib_acl is nonempty, save it in $lib_acl_test
931
932	if test ".$lib_acl" != .; then
933		lib_acl_test="$lib_acl"
934	fi
935
936  ac_save_LIBS="$LIBS"
937  LIBS="$LIBS $lib_acl"
938  AC_CHECK_FUNCS(acl_get_file acl_set_file acl_from_text acl_to_text acl_free acl_delete_def_file)
939  AC_CHECK_FUNCS(acl_extended_file)
940  AC_CHECK_FUNCS(acl_get_entry)
941  AC_CHECK_FUNCS(acl_to_text_np acl_get_brand_np acl_is_trivial_np acl_strip_np)
942  LIBS="$ac_save_LIBS"
943
944  AC_CHECKING(for Solaris UFS Access Control List support)
945  AC_CHECK_LIB(sec, acltotext, lib_acl="-lsec")
946  ac_save_LIBS="$LIBS"
947  LIBS="$LIBS $lib_acl"
948  AC_CHECK_FUNCS(acl facl aclfromtext acltotext)
949
950  AC_CHECKING(for NFSv4 Access Control List support)
951  dnl These functions support NFSv4 ACLs
952  dnl Do not check for acl_free because of a name clash with the withdrawn POSIX draft
953  AC_CHECK_FUNCS(acl_get acl_set facl_get facl_set acl_fromtext acl_totext)
954  LIBS="$ac_save_LIBS"
955
956  dnl On Solaris, there is no need for lib_acl_test as acl(2) is in -libc
957
958  AC_CHECKING(for HP-UX Access Control List support)
959  AC_CHECK_FUNCS(getacl fgetacl setacl fsetacl strtoacl acltostr cpacl fcpacl chownacl setaclentry fsetaclentry)
960
961  dnl XXX lib_acl_test: How do we test for ACLs on HP-UX?
962
963fi
964
965if test "$ac_cv_header_attr_xattr_h" = yes || test "$ac_cv_header_sys_xattr_h" = yes; then
966  AC_CHECKING(for Linux flavor Extended Attribute support)
967  AC_CHECK_LIB(c, getxattr, lib_rt="",
968	[AC_CHECK_LIB(attr, getxattr, lib_attr="-lattr")])
969  ac_save_LIBS="$LIBS"
970  LIBS="$LIBS $lib_attr"
971  AC_CHECK_FUNCS(getxattr setxattr listxattr lgetxattr lsetxattr llistxattr)
972  LIBS="$ac_save_LIBS"
973fi
974
975AC_CHECKING(for RBAC support)
976AC_CHECK_LIB(secdb, getuserattr, lib_secdb="-lsecdb")
977ac_save_LIBS="$LIBS"
978LIBS="$LIBS $lib_secdb"
979AC_CHECK_FUNCS(getauthattr getuserattr getexecattr getprofattr)
980LIBS="$ac_save_LIBS"
981
982AC_CHECKING(for gmatch() support)
983AC_CHECK_LIB(gen, gmatch, lib_gen="-lgen")
984ac_save_LIBS="$LIBS"
985LIBS="$LIBS $lib_gen"
986AC_CHECK_FUNCS(gmatch)
987LIBS="$ac_save_LIBS"
988
989AC_CHECKING(for ELF support)
990AC_CHECK_LIB(elf, elf_begin, lib_elf="-lelf")
991ac_save_LIBS="$LIBS"
992LIBS="$LIBS $lib_elf"
993AC_CHECK_FUNCS(elf_begin)
994LIBS="$ac_save_LIBS"
995
996AC_CHECK_FUNCS(thr_yield)
997
998dnl AC_CHECK_LIB(c, sem_post, lib_sem="",
999dnl   [AC_CHECK_LIB(pthread, sem_post, lib_sem="-lpthread")])
1000dnl ac_save_LIBS="$LIBS"
1001dnl LIBS="$LIBS $lib_sem"
1002dnl AC_CHECK_FUNCS(sem_post)
1003dnl LIBS="$ac_save_LIBS"
1004
1005AC_CHECK_LIB(c, pthread_create, lib_pthread="",
1006  [AC_CHECK_LIB(pthread, pthread_create, lib_pthread="-lpthread")])
1007
1008ac_save_LIBS="$LIBS"
1009LIBS="$LIBS $lib_pthread"
1010AC_CHECK_FUNCS(pthread_create pthread_kill)
1011AC_CHECK_FUNCS(pthread_mutex_lock pthread_cond_wait pthread_spin_lock)
1012LIBS="$ac_save_LIBS"
1013
1014AC_CHECK_LIB(c, clock_gettime, lib_rt="",
1015  [AC_CHECK_LIB(rt, clock_gettime, lib_rt="-lrt",
1016  [AC_CHECK_LIB(posix4, clock_gettime, lib_rt="-lposix4")])])
1017if test ."$lib_rt" = .""; then
1018	AC_DEFINE(HAVE_CLOCK_GETTIME_IN_LIBC)
1019fi
1020
1021ac_save_LIBS="$LIBS"
1022LIBS="$LIBS $lib_rt"
1023AC_CHECK_FUNCS(clock_gettime clock_settime clock_getres)
1024AC_CHECK_FUNCS(sched_getparam sched_setparam sched_getscheduler sched_setscheduler)
1025AC_CHECK_FUNCS(sched_yield)
1026AC_CHECK_FUNCS(nanosleep)
1027LIBS="$ac_save_LIBS"
1028
1029AC_CHECK_LIB(cap, cap_get_proc, lib_cap="-lcap")
1030ac_save_LIBS="$LIBS"
1031LIBS="$LIBS $lib_cap"
1032AC_CHECK_FUNCS(cap_get_proc cap_set_proc cap_set_flag cap_clear_flag)
1033LIBS="$ac_save_LIBS"
1034
1035if test "$ac_cv_header_selinux_selinux_h" = yes; then
1036	AC_CHECKING(for SELinux support)
1037	ac_save_LIBS="$LIBS"
1038	LIBS="$LIBS $lib_attr"
1039	AC_CHECK_LIB(selinux, is_selinux_enabled, lib_selinux="-lselinux")
1040	LIBS="$ac_save_LIBS"
1041	LIBS="$LIBS $lib_selinux $lib_attr"
1042	AC_CHECK_FUNCS(is_selinux_enabled)
1043	LIBS="$ac_save_LIBS"
1044fi
1045
1046dnl Misc OS checks.
1047dnl
1048dnl WARNING: AC_CHECK_FILES uses "test -r file" and bash on Haiku returns wrong results
1049dnl for /dev/stdin /dev/stdout /dev/stderr /dev/fd/0 /dev/fd/1 /dev/fd/2
1050dnl For this reason, we rather use AC_STAT_FILES
1051dnl AC_CHECK_FILES(/dev/tty /dev/null /dev/zero)
1052dnl AC_CHECK_FILES(/dev/stdin /dev/stdout /dev/stderr)
1053dnl AC_CHECK_FILES(/dev/fd/0 /dev/fd/1 /dev/fd/2)
1054dnl AC_CHECK_FILES(/usr/src/linux/include)
1055
1056AC_STAT_FILES(/dev/tty /dev/null /dev/zero)
1057AC_STAT_FILES(/dev/stdin /dev/stdout /dev/stderr)
1058AC_STAT_FILES(/dev/fd/0 /dev/fd/1 /dev/fd/2)
1059AC_STAT_FILES(/usr/src/linux/include)
1060
1061AC_STAT_SYMLINK_FILES(/bin)
1062AC_STAT_FILES(/bin/sh /usr/bin/sh /usr/xpg4/bin/sh /bin/posix/sh /opt/schily/xpg4/bin/sh)
1063
1064dnl Checks for OS madness.
1065UNAME=`uname || true`
1066
1067if test ."$UNAME" = .Linux; then
1068
1069dnl Linux madness tests:
1070
1071AC_BROKEN_LINUX_EXT2_FS_H
1072AC_BROKEN_SRC_LINUX_EXT2_FS_H
1073if test .$ac_cv_broken_linux_ext2_fs_h = .no -o .$ac_cv_broken_src_linux_ext2_fs_h = .no; then
1074	#
1075	# If either /usr/include/linux/ex2_fs.h works or
1076	# /usr/src/linux/include/linux/ex2_fs.h works, we will
1077	# #define HAVE_USABLE_LINUX_EXT2_FS_H
1078	#
1079	# If HAVE_USABLE_LINUX_EXT2_FS_H is defined, a simple
1080	# #include <linux/ex2_fs.h> will work.
1081	#
1082	ac_cv_usable_linux_ext2_fs_h=yes
1083	AC_DEFINE(HAVE_USABLE_LINUX_EXT2_FS_H)
1084else
1085	ac_cv_usable_linux_ext2_fs_h=no
1086fi
1087AC_BROKEN_SCSI_SCSI_H
1088AC_BROKEN_SRC_SCSI_SCSI_H
1089AC_BROKEN_SCSI_SG_H
1090AC_BROKEN_SRC_SCSI_SG_H
1091
1092if test .$ac_cv_broken_src_scsi_scsi_h = .yes; then
1093	may_linux_src_include=no
1094fi
1095if test .$ac_cv_broken_src_linux_ext2_fs_h = .yes; then
1096	may_linux_src_include=no
1097fi
1098if test .$ac_cv_file__usr_src_linux_include = .yes; then # only warn if there is /usr/src/linux/include
1099if test .$may_linux_src_include = .no; then
1100	echo
1101	echo "Warning: *** /usr/src/linux/include contains broken include files ***"
1102	echo "Warning: *** /usr/src/linux/include is not used this reason ***"
1103	echo "Warning: This may result in the inability to use recent Linux kernel interfaces"
1104	echo
1105fi
1106fi
1107if test .$ac_cv_header_ext2fs_ext2_fs_h = .no; then # only if there is no <ext2fs/ext2_fs.h>
1108if test .$ac_cv_usable_linux_ext2_fs_h = .no; then
1109	echo
1110	echo "Warning: *** linux/ext2_fs.h is not usable at all ***"
1111	echo "Warning: *** This makes it impossible to support Linux file flags ***"
1112	echo "You may try to compile using 'make COPTX=-DTRY_EXT2_FS'"
1113	echo
1114	echo "Better install the ext2 developer package"
1115	echo
1116	sleep 10
1117fi
1118fi	# <ext2fs/ext2_fs.h> was missing
1119fi	# Linux only tests
1120
1121AC_SUBST(may_linux_src_include)
1122
1123AC_SUBST(largefile_cc_opt)
1124AC_SUBST(sun_cc64_opt)
1125AC_SUBST(hp_cc_ansi_opt)
1126AC_SUBST(hp_cc_opt_opt)
1127AC_SUBST(hp_cc_gprof_opt)
1128
1129AC_SUBST(lib_crypt)
1130AC_SUBST(lib_resolv)
1131AC_SUBST(lib_intl)
1132AC_SUBST(lib_iconv)
1133AC_SUBST(lib_expat)
1134AC_SUBST(lib_pcsc)
1135AC_SUBST(lib_crypto)
1136AC_SUBST(lib_ssl)
1137AC_SUBST(lib_nsl)
1138AC_SUBST(scsi_lib)
1139AC_SUBST(lib_scsi)
1140AC_SUBST(lib_acl)
1141AC_SUBST(lib_acl_test)
1142AC_SUBST(lib_attr)
1143AC_SUBST(lib_secdb)
1144AC_SUBST(lib_gen)
1145AC_SUBST(lib_elf)
1146AC_SUBST(lib_pthread)
1147AC_SUBST(lib_rt)
1148AC_SUBST(lib_dl)
1149AC_SUBST(lib_dir)
1150AC_SUBST(lib_cap)
1151AC_SUBST(lib_selinux)
1152
1153AC_OUTPUT(rules.cnf)
1154