1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(src/process.cpp)
3
4
5AC_ARG_ENABLE(small-code,
6	[  --enable-small-code     optimize for small code size],
7	SMALLCODE="-O -Os -fno-exceptions",
8	SMALLCODE="")
9AC_ARG_ENABLE(debug,
10	[  --enable-debug          compile with -g option],
11	DEBUG="yes",
12	DEBUG="")
13AC_ARG_ENABLE(profiling,
14	[  --enable-profiling      compile with -pg option],
15	CXXFLAGS="$CXXFLAGS -pg",
16	CXXFLAGS="$CXXFLAGS")
17AC_ARG_ENABLE(fortify,
18	[  --enable-fortify        compile with various gcc fortification options],
19	CXXFLAGS="$CXXFLAGS -O -D_FORTIFY_SOURCE=2 -fstack-protector-strong",
20	CXXFLAGS="$CXXFLAGS")
21AC_ARG_ENABLE(wall,
22	[  --disable-wall          compile without -Wall, even if supported],
23	ENABLE_WALL="",
24	ENABLE_WALL="yes")
25AC_ARG_ENABLE(werror,
26	[  --disable-werror        compile without -Werror, even if supported],
27	ENABLE_WERROR="",
28	ENABLE_WERROR="yes")
29AC_ARG_ENABLE(enosys-notify,
30	[  --enable-enosys-notify  enable runtime notification of methods that set ENOSYS],
31	RUDIMENTS_ENOSYS_NOTIFY="yes",
32	RUDIMENTS_ENOSYS_NOTIFY="")
33AC_ARG_WITH(system-libtool,
34	[  --with-system-libtool   use system libtool instead of ./libtool],
35	USE_SYSTEM_LIBTOOL=$withval,
36	USE_SYSTEM_LIBTOOL="no")
37AC_ARG_ENABLE(inlines,
38	[  --enable-inlines        use inline methods],
39	ENABLE_RUDIMENTS_INLINES="yes",
40	ENABLE_RUDIMENTS_INLINES="no")
41AC_ARG_WITH(pthread-prefix,
42	[  --with-pthread-prefix   Location of pthread library],
43	PTHREADPATH="$withval",
44	PTHREADPATH="")
45AC_ARG_ENABLE(libedit,
46	[  --disable-libedit       Disable libedit support],
47	ENABLE_RUDIMENTS_LIBEDIT="no",
48	ENABLE_RUDIMENTS_LIBEDIT="yes")
49AC_ARG_WITH(libedit-includes,
50	[  --with-libedit-includes libedit includes],
51	LIBEDITINCLUDES="$withval",
52	LIBEDITINCLUDES="")
53AC_ARG_WITH(libedit-libs,
54	[  --with-libedit-libs     libedit libraries],
55	LIBEDITLIBS="$withval",
56	LIBEDITLIBS="")
57AC_ARG_ENABLE(ssl,
58	[  --disable-ssl           Disable TLS/SSL support],
59	ENABLE_RUDIMENTS_SSL="no",
60	ENABLE_RUDIMENTS_SSL="yes")
61AC_ARG_WITH(ssl-includes,
62	[  --with-ssl-includes     TLS/SSL includes],
63	SSLINCLUDES="$withval",
64	SSLINCLUDES="")
65AC_ARG_WITH(ssl-libs,
66	[  --with-ssl-libs         TLS/SSL libraries],
67	SSLLIBS="$withval",
68	SSLLIBS="")
69AC_ARG_ENABLE(gss,
70	[  --disable-gss           Disable GSS support],
71	ENABLE_RUDIMENTS_GSS="no",
72	ENABLE_RUDIMENTS_GSS="yes")
73AC_ARG_WITH(gss-includes,
74	[  --with-gss-includes     GSS includes],
75	GSSINCLUDES="$withval",
76	GSSINCLUDES="")
77AC_ARG_WITH(gss-libs,
78	[  --with-gss-libs         GSS libraries],
79	GSSLIBS="$withval",
80	GSSLIBS="")
81AC_ARG_ENABLE(pcre,
82	[  --disable-pcre          Don't use PCRE for regular expressions],
83	ENABLE_RUDIMENTS_PCRE="no",
84	ENABLE_RUDIMENTS_PCRE="yes")
85AC_ARG_WITH(pcre-includes,
86	[  --with-pcre-includes    PCRE includes],
87	PCREINCLUDES="$withval",
88	PCREINCLUDES="")
89AC_ARG_WITH(pcre-libs,
90	[  --with-pcre-libs        PCRE libraries],
91	PCRELIBS="$withval",
92	PCRELIBS="")
93AC_ARG_ENABLE(libcurl,
94	[  --disable-libcurl       Disable libcurl support],
95	ENABLE_RUDIMENTS_LIBCURL="no",
96	ENABLE_RUDIMENTS_LIBCURL="yes")
97AC_ARG_WITH(libcurl-includes,
98	[  --with-libcurl-includes libcurl includes],
99	LIBCURLINCLUDES="$withval",
100	LIBCURLINCLUDES="")
101AC_ARG_WITH(libcurl-libs,
102	[  --with-libcurl-libs     libcurl libraries],
103	LIBCURLLIBS="$withval",
104	LIBCURLLIBS="")
105AC_ARG_ENABLE(built-in-regex,
106	[  --enable-built-in-regex Use the built-in regex],
107	USE_BUILT_IN_REGULAREXPRESSION="1",
108	USE_BUILT_IN_REGULAREXPRESSION="0")
109AC_ARG_ENABLE(threads,
110	[  --disable-threads       Disable thread support],
111	ENABLE_RUDIMENTS_THREADS="no"; INCLUDE_THREAD="0",
112	ENABLE_RUDIMENTS_THREADS="yes")
113
114dnl   options to disable building various classes
115AC_ARG_ENABLE(character,
116	[  --disable-character     Don't build character class],
117	INCLUDE_CHARACTER="0",
118	INCLUDE_CHARACTER="1")
119AC_ARG_ENABLE(charstring,
120	[  --disable-charstring    Don't build charstring class],
121	INCLUDE_CHARSTRING="0",
122	INCLUDE_CHARSTRING="1")
123AC_ARG_ENABLE(chat,
124	[  --disable-chat           Build chat class],
125	INCLUDE_CHAT="0",
126	INCLUDE_CHAT="1")
127AC_ARG_ENABLE(client,
128	[  --disable-client        Don't build client class],
129	INCLUDE_CLIENT="0",
130	INCLUDE_CLIENT="1")
131AC_ARG_ENABLE(commandline,
132	[  --disable-commandline   Don't build commandline class],
133	INCLUDE_COMMANDLINE="0",
134	INCLUDE_COMMANDLINE="1")
135AC_ARG_ENABLE(crypt,
136	[  --disable-crypt         Don't build crypt class],
137	INCLUDE_CRYPT="0",
138	INCLUDE_CRYPT="1")
139AC_ARG_ENABLE(datetime,
140	[  --disable-datetime      Don't build datetime class],
141	INCLUDE_DATETIME="0",
142	INCLUDE_DATETIME="1")
143AC_ARG_ENABLE(device,
144	[  --disable-device        Don't build device class],
145	INCLUDE_DEVICE="0",
146	INCLUDE_DEVICE="1")
147AC_ARG_ENABLE(directory,
148	[  --disable-directory     Don't build directory class],
149	INCLUDE_DIRECTORY="0",
150	INCLUDE_DIRECTORY="1")
151AC_ARG_ENABLE(dynamiclib,
152	[  --disable-dynamiclib    Don't build dynamiclib class],
153	INCLUDE_DYNAMICLIB="0",
154	INCLUDE_DYNAMICLIB="1")
155AC_ARG_ENABLE(environment,
156	[  --disable-environment   Don't build environment class],
157	INCLUDE_ENVIRONMENT="0",
158	INCLUDE_ENVIRONMENT="1")
159AC_ARG_ENABLE(error,
160	[  --disable-error         Don't build error],
161	INCLUDE_ERROR="0",
162	INCLUDE_ERROR="1")
163AC_ARG_ENABLE(filedescriptor,
164	[  --disable-filedescriptor       Don't build filedescriptor class],
165	INCLUDE_FILEDESCRIPTOR="0",
166	INCLUDE_FILEDESCRIPTOR="1")
167AC_ARG_ENABLE(file,
168	[  --disable-file          Don't build file class],
169	INCLUDE_FILE="0",
170	INCLUDE_FILE="1")
171AC_ARG_ENABLE(url,
172	[  --disable-url           Don't build url class],
173	INCLUDE_URL="0",
174	INCLUDE_URL="1")
175AC_ARG_ENABLE(filesystem,
176	[  --disable-filesystem    Don't build filesystem class],
177	INCLUDE_FILESYSTEM="0",
178	INCLUDE_FILESYSTEM="1")
179AC_ARG_ENABLE(groupentry,
180	[  --disable-groupentry    Don't build groupentry class],
181	INCLUDE_GROUPENTRY="0",
182	INCLUDE_GROUPENTRY="1")
183AC_ARG_ENABLE(hostentry,
184	[  --disable-hostentry     Don't build hostentry class],
185	INCLUDE_HOSTENTRY="0",
186	INCLUDE_HOSTENTRY="1")
187AC_ARG_ENABLE(inetclient,
188	[  --disable-inetclient    Don't build inetclient class],
189	INCLUDE_INETCLIENT="0",
190	INCLUDE_INETCLIENT="1")
191AC_ARG_ENABLE(inetserver,
192	[  --disable-inetserver    Don't build inetserver class],
193	INCLUDE_INETSERVER="0",
194	INCLUDE_INETSERVER="1")
195AC_ARG_ENABLE(listener,
196	[  --disable-listener      Don't build listener class],
197	INCLUDE_LISTENER="0",
198	INCLUDE_LISTENER="1")
199AC_ARG_ENABLE(logger,
200	[  --disable-logger        Don't build logger class],
201	INCLUDE_LOGGER="0",
202	INCLUDE_LOGGER="1")
203AC_ARG_ENABLE(math,
204	[  --disable-math          Don't build math class],
205	INCLUDE_MATH="0",
206	INCLUDE_MATH="1")
207dnl force disable math class for now
208INCLUDE_MATH="0"
209AC_ARG_ENABLE(memorymap,
210	[  --disable-memorymap     Don't build memorymap class],
211	INCLUDE_MEMORYMAP="0",
212	INCLUDE_MEMORYMAP="1")
213AC_ARG_ENABLE(memorypool,
214	[  --disable-memorypool    Don't build memorypool class],
215	INCLUDE_MEMORYPOOL="0",
216	INCLUDE_MEMORYPOOL="1")
217AC_ARG_ENABLE(modemclient,
218	[  --enable-modemclient    Build modemclient class (disabled by default)],
219	INCLUDE_MODEMCLIENT="1",
220	INCLUDE_MODEMCLIENT="0")
221AC_ARG_ENABLE(modemserver,
222	[  --enable-modemserver    Build modemserver class (disabled by default)],
223	INCLUDE_MODEMSERVER="1",
224	INCLUDE_MODEMSERVER="0")
225AC_ARG_ENABLE(thread,
226	[  --disable-thread        Don't build thread class],
227	INCLUDE_THREAD="0",
228	INCLUDE_THREAD="1")
229AC_ARG_ENABLE(threadmutex,
230	[  --disable-threadmutex   Don't build threadmutex class],
231	INCLUDE_THREADMUTEX="0",
232	INCLUDE_THREADMUTEX="1")
233AC_ARG_ENABLE(parameterstring,
234	[  --disable-parameterstring      Don't build parameterstring class],
235	INCLUDE_PARAMETERSTRING="0",
236	INCLUDE_PARAMETERSTRING="1")
237AC_ARG_ENABLE(userentry,
238	[  --disable-userentry     Don't build userentry class],
239	INCLUDE_USERENTRY="0",
240	INCLUDE_USERENTRY="1")
241AC_ARG_ENABLE(permissions,
242	[  --disable-permissions   Don't build permissions],
243	INCLUDE_PERMISSIONS="0",
244	INCLUDE_PERMISSIONS="1")
245AC_ARG_ENABLE(process,
246	[  --disable-process       Don't build process],
247	INCLUDE_PROCESS="0",
248	INCLUDE_PROCESS="1")
249AC_ARG_ENABLE(protocolentry,
250	[  --disable-protocolentry Don't build protocolentry class],
251	INCLUDE_PROTOCOLENTRY="0",
252	INCLUDE_PROTOCOLENTRY="1")
253AC_ARG_ENABLE(randomnumber,
254	[  --disable-randomnumber  Don't build randomnumber],
255	INCLUDE_RANDOMNUMBER="0",
256	INCLUDE_RANDOMNUMBER="1")
257AC_ARG_ENABLE(bytestring,
258	[  --disable-bytestring    Don't build bytestring class],
259	INCLUDE_BYTESTRING="0",
260	INCLUDE_BYTESTRING="1")
261AC_ARG_ENABLE(regularexpression,
262	[  --disable-regularexpression    Don't build regularexpression],
263	INCLUDE_REGULAREXPRESSION="0",
264	INCLUDE_REGULAREXPRESSION="1")
265AC_ARG_ENABLE(semaphoreset,
266	[  --disable-semaphoreset  Don't build semaphoreset],
267	INCLUDE_SEMAPHORESET="0",
268	INCLUDE_SEMAPHORESET="1")
269AC_ARG_ENABLE(serialport,
270	[  --enable-serialport     Build serialport class (disabled by default)],
271	INCLUDE_SERIALPORT="1",
272	INCLUDE_SERIALPORT="0")
273AC_ARG_ENABLE(serialportprofile,
274	[  --enable-serialportprofile     Build serialportprofile class (disabled by default)],
275	INCLUDE_SERIALPORTPROFILE="1",
276	INCLUDE_SERIALPORTPROFILE="0")
277AC_ARG_ENABLE(server,
278	[  --disable-server        Don't build server class],
279	INCLUDE_SERVER="0",
280	INCLUDE_SERVER="1")
281AC_ARG_ENABLE(serviceentry,
282	[  --disable-serviceentry  Don't build serviceentry class],
283	INCLUDE_SERVICEENTRY="0",
284	INCLUDE_SERVICEENTRY="1")
285AC_ARG_ENABLE(sharedmemory,
286	[  --disable-sharedmemory  Don't build sharedmemory],
287	INCLUDE_SHAREDMEMORY="0",
288	INCLUDE_SHAREDMEMORY="1")
289AC_ARG_ENABLE(signalclasses,
290	[  --disable-signalclasses Don't build signalclasses],
291	INCLUDE_SIGNALCLASSES="0",
292	INCLUDE_SIGNALCLASSES="1")
293AC_ARG_ENABLE(snooze,
294	[  --disable-snooze        Don't build snooze class],
295	INCLUDE_SNOOZE="0",
296	INCLUDE_SNOOZE="1")
297AC_ARG_ENABLE(stringbuffer,
298	[  --disable-stringbuffer  Don't build stringbuffer class],
299	INCLUDE_STRINGBUFFER="0",
300	INCLUDE_STRINGBUFFER="1")
301AC_ARG_ENABLE(sys,
302	[  --disable-sys           Don't build sys class],
303	INCLUDE_SYSTEM="0",
304	INCLUDE_SYSTEM="1")
305AC_ARG_ENABLE(unixclient,
306	[  --disable-unixclient    Don't build unixclient class],
307	INCLUDE_UNIXCLIENT="0",
308	INCLUDE_UNIXCLIENT="1")
309AC_ARG_ENABLE(unixserver,
310	[  --disable-unixserver    Don't build unixserver class],
311	INCLUDE_UNIXSERVER="0",
312	INCLUDE_UNIXSERVER="1")
313AC_ARG_ENABLE(bytebuffer,
314	[  --disable-bytebuffer    Don't build bytebuffer class],
315	INCLUDE_BYTEBUFFER="0",
316	INCLUDE_BYTEBUFFER="1")
317AC_ARG_ENABLE(xmldom,
318	[  --disable-xmldom        Don't build xmldom class],
319	INCLUDE_XMLDOM="0",
320	INCLUDE_XMLDOM="1")
321AC_ARG_ENABLE(xmlsax,
322	[  --disable-xmlsax        Don't build xmlsax class],
323	INCLUDE_XMLSAX="0",
324	INCLUDE_XMLSAX="1")
325AC_ARG_ENABLE(domevents,
326	[  --disable-domevents  Don't build domevents class],
327	INCLUDE_DOMEVENTS="0",
328	INCLUDE_DOMEVENTS="1")
329AC_ARG_ENABLE(codetree,
330	[  --disable-codetree      Don't build codetree class],
331	INCLUDE_CODETREE="0",
332	INCLUDE_CODETREE="1")
333AC_ARG_ENABLE(compiler,
334	[  --disable-compiler      Don't build compiler class],
335	INCLUDE_COMPILER="0",
336	INCLUDE_COMPILER="1")
337AC_ARG_ENABLE(prompt,
338	[  --disable-prompt        Don't build prompt class],
339	INCLUDE_PROMPT="0",
340	INCLUDE_PROMPT="1")
341AC_ARG_ENABLE(templateengine,
342	[  --disable-templateengine Don't build templateengine class],
343	INCLUDE_TEMPLATEENGINE="0",
344	INCLUDE_TEMPLATEENGINE="1")
345AC_ARG_ENABLE(csvsax,
346	[  --disable-csvsax        Don't build csvsax class],
347	INCLUDE_CSVSAX="0",
348	INCLUDE_CSVSAX="1")
349AC_ARG_ENABLE(csvdom,
350	[  --disable-csvdom        Don't build csvdom class],
351	INCLUDE_CSVDOM="0",
352	INCLUDE_CSVDOM="1")
353AC_ARG_ENABLE(jsonsax,
354	[  --disable-jsonsax       Don't build jsonsax class],
355	INCLUDE_JSONSAX="0",
356	INCLUDE_JSONSAX="1")
357AC_ARG_ENABLE(jsondom,
358	[  --disable-jsondom       Don't build jsondom class],
359	INCLUDE_JSONDOM="0",
360	INCLUDE_JSONDOM="1")
361AC_ARG_ENABLE(cursordomnode,
362	[  --disable-cursordomnode Don't build cursordomnode class],
363	INCLUDE_CURSORDOMNODE="0",
364	INCLUDE_CURSORDOMNODE="1")
365
366if ( test -n "$SMALLCODE" ); then
367	AC_DEFINE_UNQUOTED(RUDIMENTS_SMALL_CODE,1,Use small rather than fast code)
368fi
369
370
371
372dnl Additional defines.
373if ( test "$ENABLE_RUDIMENTS_INLINES" = "yes" ); then
374	AC_DEFINE_UNQUOTED(ENABLE_RUDIMENTS_INLINES,1,Use inline functions or not)
375fi
376
377if ( test "$RUDIMENTS_ENOSYS_NOTIFY" = "yes" ); then
378	AC_DEFINE_UNQUOTED(RUDIMENTS_ENOSYS_NOTIFY,1,Enable runtime notification of methods that set ENOSYS)
379fi
380
381
382dnl Checks for programs.
383echo
384echo "***** Programs ***************"
385AC_PROG_CXX
386AC_PROG_CPP
387AC_PROG_INSTALL
388AC_PROG_LN_S
389AC_PROG_MAKE_SET
390AC_LANG(C++)
391echo "******************************"
392
393CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D__EXTENSIONS__ $CPPFLAGS"
394CXXFLAGS="$SMALLCODE $CXXFLAGS"
395EXTRALIBS=""
396
397dnl Checks for libtool.
398echo
399echo "***** Libtool ****************"
400AC_LIBTOOL_WIN32_DLL
401AC_PROG_LIBTOOL
402FW_CHECK_USE_SYSTEM_LIBTOOL
403
404dnl have to set ar here because libtool (currently) fails
405dnl to use the correct one when cross-compiling
406AC_CHECK_PROG(AR,$host_alias-ar,$host_alias-ar,ar)
407AC_SUBST(AR)
408echo "******************************"
409
410
411dnl Checks for platform-specific stuff
412echo
413echo "***** Platform ***************"
414FW_CHECK_MULTIARCH
415FW_CHECK_MICROSOFT
416
417dnl for mingw32, disable serial-related classes
418if ( test -n "$MINGW32" )
419then
420	INCLUDE_SERIALPORT="0"
421	INCLUDE_SERIALPORTPROFILE="0"
422	INCLUDE_MODEMCLIENT="0"
423	INCLUDE_MODEMSERVER="0"
424fi
425
426FW_CHECK_OSX
427FW_CHECK_MINIX
428FW_CHECK_HAIKU
429FW_CHECK_SYLLABLE
430FW_CHECK_SCO_OSR
431
432FW_CHECK_SO_EXT
433FW_CHECK_LIBDIR
434
435FW_CHECK_PIPE
436FW_CHECK_DEBUG
437
438FW_CHECK_WERROR
439FW_CHECK_WALL
440
441FW_CHECK_WNOFORMAT
442FW_CHECK_WNOOVERLOADEDVIRTUAL
443FW_CHECK_WNODEPRECATEDDECLARATIONS
444
445dnl Remove -Wall and -Werror from CPPFLAGS/CXXFLAGS as they cause way to many
446dnl problems with the test programs.  They will be reincluded later if
447dnl appropriate.
448CPPFLAGS=`echo $CPPFLAGS | sed -e "s|-Werror[[^ ]]*||g" -e "s|-Wall||g"`
449CXXFLAGS=`echo $CXXFLAGS | sed -e "s|-Werror[[^ ]]*||g" -e "s|-Wall||g"`
450
451dnl If the c++ compiler allows undefined functions, then add -Werror back.
452FW_CHECK_UNDEFINED_FUNCTIONS
453
454AC_SUBST(CPPFLAGS)
455AC_SUBST(CXXFLAGS)
456
457FW_CHECK_NULL_REDEFINE
458FW_CHECK_F_NO_BUILTIN
459
460dnl if LDFLAGS contains -Wl,-z,relro the CPPFLAGS requires -fPIC
461dnl libtool adds it at compile time but we need it for configure tests too
462if ( test -n "`echo $LDFLAGS | grep '\-Wl,\-z,relro'`" )
463then
464	CPPFLAGS="-fPIC $CPPFLAGS"
465fi
466
467echo "******************************"
468
469dnl Checks for header files.
470echo
471echo "***** Headers ****************"
472
473AC_MSG_CHECKING(for stdlib.h)
474AC_TRY_COMPILE([#include <stdlib.h>],
475[],AC_DEFINE(RUDIMENTS_HAVE_STDLIB_H, 1, Some systems have stdlib.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
476
477AC_MSG_CHECKING(for stdarg.h)
478AC_TRY_COMPILE([#include <stdarg.h>],
479[],AC_DEFINE(RUDIMENTS_HAVE_STDARG_H, 1, Some systems have stdarg.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
480
481AC_MSG_CHECKING(for string.h)
482AC_TRY_COMPILE([#include <string.h>],
483[],AC_DEFINE(RUDIMENTS_HAVE_STRING_H, 1, Some systems have string.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
484
485AC_MSG_CHECKING(for dlfcn.h)
486AC_TRY_COMPILE([#include <dlfcn.h>],
487[],AC_DEFINE(RUDIMENTS_HAVE_DLFCN_H, 1, Some systems have dlfcn.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
488
489AC_MSG_CHECKING(for poll.h)
490AC_TRY_COMPILE([#include <poll.h>],
491[],AC_DEFINE(RUDIMENTS_HAVE_POLL_H, 1, Some systems have poll.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
492
493AC_MSG_CHECKING(for sys/poll.h)
494AC_TRY_COMPILE([#include <sys/poll.h>],
495[],AC_DEFINE(RUDIMENTS_HAVE_SYS_POLL_H, 1, Some systems have sys/poll.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
496
497AC_MSG_CHECKING(for sys/epoll.h)
498AC_TRY_COMPILE([#include <sys/epoll.h>],
499[],AC_DEFINE(RUDIMENTS_HAVE_SYS_EPOLL_H, 1, Some systems have sys/epoll.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
500
501AC_MSG_CHECKING(for sys/devpoll.h)
502AC_TRY_COMPILE([#include <sys/devpoll.h>],
503[],AC_DEFINE(RUDIMENTS_HAVE_SYS_DEVPOLL_H, 1, Some systems have sys/devpoll.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
504
505AC_MSG_CHECKING(for port.h)
506AC_TRY_COMPILE([#include <port.h>],
507[],AC_DEFINE(RUDIMENTS_HAVE_PORT_H, 1, Some systems have port.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
508
509AC_MSG_CHECKING(for sys/stat.h)
510AC_TRY_COMPILE([#include <sys/stat.h>],
511[],AC_DEFINE(RUDIMENTS_HAVE_SYS_STAT_H, 1, Some systems have sys/stat.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
512
513AC_MSG_CHECKING(for sys/types.h)
514AC_TRY_COMPILE([#include <sys/types.h>],
515[],AC_DEFINE(RUDIMENTS_HAVE_SYS_TYPES_H, 1, Some systems have sys/types.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
516
517AC_MSG_CHECKING(for sys/event.h)
518AC_TRY_COMPILE([
519#if defined(RUDIMENTS_HAVE_SYS_TYPES_H)
520	#include <sys/types.h>
521#endif
522#include <sys/event.h>],
523[],AC_DEFINE(RUDIMENTS_HAVE_SYS_EVENT_H, 1, Some systems have sys/event.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
524
525AC_MSG_CHECKING(for ctype.h)
526AC_TRY_COMPILE([#include <ctype.h>],
527[],AC_DEFINE(RUDIMENTS_HAVE_CTYPE_H, 1, Some systems have ctype.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
528
529AC_MSG_CHECKING(for sys/wait.h)
530AC_TRY_COMPILE([#include <sys/wait.h>],
531[],AC_DEFINE(RUDIMENTS_HAVE_SYS_WAIT_H, 1, Some systems have sys/wait.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
532
533AC_MSG_CHECKING(for dirent.h)
534AC_TRY_COMPILE([#include <dirent.h>],
535[],AC_DEFINE(RUDIMENTS_HAVE_DIRENT_H, 1, Some systems have dirent.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
536
537AC_MSG_CHECKING(for direct.h)
538AC_TRY_COMPILE([#include <direct.h>],
539[],AC_DEFINE(RUDIMENTS_HAVE_DIRECT_H, 1, Some systems have direct.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
540
541AC_MSG_CHECKING(for strings.h)
542AC_TRY_COMPILE([#include <strings.h>],
543[],AC_DEFINE(RUDIMENTS_HAVE_STRINGS_H, 1, Some systems have strings.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
544
545AC_MSG_CHECKING(for unistd.h)
546AC_TRY_COMPILE([#include <unistd.h>],
547[],AC_DEFINE(RUDIMENTS_HAVE_UNISTD_H, 1, Some systems have unistd.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
548
549AC_MSG_CHECKING(for grp.h)
550AC_TRY_COMPILE([
551#if defined(RUDIMENTS_HAVE_SYS_TYPES_H)
552	#include <sys/types.h>
553#endif
554#include <grp.h>],
555[],AC_DEFINE(RUDIMENTS_HAVE_GRP_H, 1, Some systems have grp.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
556
557FW_CHECK_SCO_CFRONT_HACK
558
559AC_MSG_CHECKING(for utime.h)
560AC_TRY_COMPILE([#include <utime.h>],
561[],AC_DEFINE(RUDIMENTS_HAVE_UTIME_H, 1, Some systems have utime.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
562
563AC_MSG_CHECKING(for netdb.h)
564AC_TRY_COMPILE([#include <netdb.h>],
565[],AC_DEFINE(RUDIMENTS_HAVE_NETDB_H, 1, Some systems have netdb.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
566
567AC_MSG_CHECKING(for netinet/in.h)
568AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
569	#include <sys/types.h>
570#endif
571#include <netinet/in.h>],
572[],AC_DEFINE(RUDIMENTS_HAVE_NETINET_IN_H, 1, Some systems have netinet/in.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
573
574AC_MSG_CHECKING(for sys/un.h)
575AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
576	#include <sys/types.h>
577#endif
578#include <sys/un.h>],
579[],AC_DEFINE(RUDIMENTS_HAVE_SYS_UN_H, 1, Some systems have sys/un.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
580
581AC_MSG_CHECKING(for sys/param.h)
582AC_TRY_COMPILE([#include <sys/param.h>],
583[],AC_DEFINE(RUDIMENTS_HAVE_SYS_PARAM_H, 1, Some systems have sys/param.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
584
585AC_MSG_CHECKING(for time.h)
586AC_TRY_COMPILE([#include <time.h>],
587[],AC_DEFINE(RUDIMENTS_HAVE_TIME_H, 1, Some systems have time.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
588
589AC_MSG_CHECKING(for sys/time.h)
590AC_TRY_COMPILE([#include <sys/time.h>],
591[],AC_DEFINE(RUDIMENTS_HAVE_SYS_TIME_H, 1, Some systems have sys/time.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
592
593AC_MSG_CHECKING(for byteswap.h)
594AC_TRY_COMPILE([#include <byteswap.h>],
595[],AC_DEFINE(RUDIMENTS_HAVE_BYTESWAP_H, 1, Some systems have byteswap.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
596
597AC_MSG_CHECKING(whether safe to include byteswap.h after netinet/in.h)
598AC_TRY_COMPILE([#include <netinet/in.h>
599#include <byteswap.h>],
600[],AC_DEFINE(RUDIMENTS_HAVE_SAFE_BYTESWAP_H_AFTER_NETINET_IN_H, 1, On some systems you cant include byteswap.h after netinet/in.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
601
602AC_MSG_CHECKING(for machine/endian.h)
603AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
604	#include <sys/types.h>
605#endif
606#include <machine/endian.h>],
607[],AC_DEFINE(RUDIMENTS_HAVE_MACHINE_ENDIAN_H, 1, Some systems have machine/endian.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
608
609AC_MSG_CHECKING(for sys/select.h)
610AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
611	#include <sys/types.h>
612#endif
613#include <sys/select.h>],
614[],AC_DEFINE(RUDIMENTS_HAVE_SYS_SELECT_H, 1, Some systems have sys/select.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
615
616AC_MSG_CHECKING(for netinet/in.h)
617AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
618	#include <sys/types.h>
619#endif
620#include <netinet/in.h>],
621[],AC_DEFINE(RUDIMENTS_HAVE_NETINET_IN_H, 1, Some systems have netinet/in.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
622
623AC_MSG_CHECKING(for netinet/tcp.h)
624AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
625	#include <sys/types.h>
626#endif
627#include <netinet/tcp.h>],
628[],AC_DEFINE(RUDIMENTS_HAVE_NETINET_TCP_H, 1, Some systems have netinet/tcp.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
629
630AC_MSG_CHECKING(for sys/socket.h)
631AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
632	#include <sys/types.h>
633#endif
634#include <sys/socket.h>],
635[],AC_DEFINE(RUDIMENTS_HAVE_SYS_SOCKET_H, 1, Some systems have sys/socket.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
636
637AC_MSG_CHECKING(for arpa/inet.h)
638AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
639	#include <sys/types.h>
640#endif
641#include <arpa/inet.h>],
642[],AC_DEFINE(RUDIMENTS_HAVE_ARPA_INET_H, 1, Some systems have arpa/inet.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
643
644AC_MSG_CHECKING(for sys/uio.h)
645AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
646	#include <sys/types.h>
647#endif
648#include <sys/uio.h>],
649[],AC_DEFINE(RUDIMENTS_HAVE_SYS_UIO_H, 1, Some systems have sys/uio.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
650
651AC_MSG_CHECKING(for arpa/inet.h)
652AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
653	#include <sys/types.h>
654#endif
655#include <arpa/inet.h>],
656[],AC_DEFINE(RUDIMENTS_HAVE_ARPA_INET_H, 1, Some systems have arpa/inet.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
657
658AC_MSG_CHECKING(for stdint.h)
659AC_TRY_COMPILE([#include <stdint.h>],
660[],AC_DEFINE(RUDIMENTS_HAVE_STDINT_H, 1, Some systems have stdint.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
661
662AC_MSG_CHECKING(for sys/bitypes.h)
663AC_TRY_COMPILE([#include <sys/bitypes.h>],
664[],AC_DEFINE(RUDIMENTS_HAVE_SYS_BITYPES_H, 1, Some systems have sys/bitypes.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
665
666AC_MSG_CHECKING(for inttypes.h)
667AC_TRY_COMPILE([#include <inttypes.h>],
668[],AC_DEFINE(RUDIMENTS_HAVE_INTTYPES_H, 1, Some systems have inttypes.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
669
670AC_MSG_CHECKING(for uchar.h)
671AC_TRY_COMPILE([#include <uchar.h>],
672[],AC_DEFINE(RUDIMENTS_HAVE_UCHAR_H, 1, Some systems have uchar.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
673
674AC_MSG_CHECKING(for limits.h)
675AC_TRY_COMPILE([#include <limits.h>],
676[],AC_DEFINE(RUDIMENTS_HAVE_LIMITS_H, 1, Some systems have limits.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
677
678AC_MSG_CHECKING(for fcntl.h)
679AC_TRY_COMPILE([#include <fcntl.h>],
680[],AC_DEFINE(RUDIMENTS_HAVE_FCNTL_H, 1, Some systems have fcntl.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
681
682AC_MSG_CHECKING(for sys/fcntl.h)
683AC_TRY_COMPILE([#include <sys/fcntl.h>],
684[],AC_DEFINE(RUDIMENTS_HAVE_SYS_FCNTL_H, 1, Some systems have sys/fcntl.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
685
686AC_MSG_CHECKING(for sys/ipc.h)
687AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
688	#include <sys/types.h>
689#endif
690#include <sys/ipc.h>],
691[],AC_DEFINE(RUDIMENTS_HAVE_SYS_IPC_H, 1, Some systems have sys/ipc.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
692
693AC_MSG_CHECKING(for sys/sem.h)
694AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
695	#include <sys/types.h>
696#endif
697#include <sys/sem.h>],
698[],AC_DEFINE(RUDIMENTS_HAVE_SYS_SEM_H, 1, Some systems have sys/sem.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
699
700AC_MSG_CHECKING(for syslog.h)
701AC_TRY_LINK([#include <syslog.h>],
702[],AC_DEFINE(RUDIMENTS_HAVE_SYSLOG_H,1,Some systems have syslog.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
703
704AC_MSG_CHECKING(for errno.h)
705AC_TRY_LINK([#include <errno.h>],
706[],AC_DEFINE(RUDIMENTS_HAVE_ERRNO_H,1,Some systems have errno.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
707
708AC_MSG_CHECKING(for linux/rtc.h)
709AC_TRY_COMPILE([#include <linux/rtc.h>],
710[],AC_DEFINE(RUDIMENTS_HAVE_LINUX_RTC_H, 1, Some systems have linux/rtc.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
711
712AC_MSG_CHECKING(for sys/ioctl.h)
713AC_TRY_LINK([#include <sys/ioctl.h>],
714[],AC_DEFINE(RUDIMENTS_HAVE_SYS_IOCTL_H,1,Some systems have sys/ioctl.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
715
716AC_MSG_CHECKING(for os/kernel/OS.h)
717AC_TRY_LINK([#include <os/kernel/OS.h>],
718[],AC_DEFINE(RUDIMENTS_HAVE_OS_KERNEL_OS_H,1,Some systems have os/kernel/OS.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
719
720AC_MSG_CHECKING(for sys/byteorder.h)
721AC_TRY_LINK([#include <sys/byteorder.h>],
722[],AC_DEFINE(RUDIMENTS_HAVE_SYS_BYTEORDER_H,1,Some systems have sys/byteorder.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
723
724AC_MSG_CHECKING(for os/support/ByteOrder.h)
725AC_TRY_LINK([#include <os/support/ByteOrder.h>],
726[],AC_DEFINE(RUDIMENTS_HAVE_OS_SUPPORT_BYTEORDER_H,1,Some systems have os/support/ByteOrder.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
727
728AC_MSG_CHECKING(for termios.h)
729AC_TRY_COMPILE([#include <termios.h>],
730[],AC_DEFINE(RUDIMENTS_HAVE_TERMIOS_H, 1, Some systems have termios.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
731
732dnl don't even look for these under cygwin, they cause all kinds of trouble
733if ( test -z "$CYGWIN" )
734then
735	AC_MSG_CHECKING(for windows.h)
736	AC_TRY_COMPILE([#include <windows.h>],
737[],AC_DEFINE(RUDIMENTS_HAVE_WINDOWS_H, 1, Some systems have windows.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
738
739	AC_MSG_CHECKING(for winsock2.h)
740	AC_TRY_COMPILE([#include <winsock2.h>],
741[],AC_DEFINE(RUDIMENTS_HAVE_WINSOCK2_H, 1, Some systems have winsock2.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
742
743	AC_MSG_CHECKING(for tlhelp32.h)
744	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
745		#include <windows.h>
746	#endif
747	#include <tlhelp32.h>],
748	[],AC_DEFINE(RUDIMENTS_HAVE_TLHELP32_H, 1, Some systems have tlhelp32.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
749
750	AC_MSG_CHECKING(for sddl.h)
751	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
752		#include <windows.h>
753	#endif
754	#include <sddl.h>],
755	[],AC_DEFINE(RUDIMENTS_HAVE_SDDL_H, 1, Some systems have sddl.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
756
757	AC_MSG_CHECKING(for aclapi.h)
758	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
759		#include <windows.h>
760	#endif
761	#include <aclapi.h>],
762	[],AC_DEFINE(RUDIMENTS_HAVE_ACLAPI_H, 1, Some systems have aclapi.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
763
764	AC_MSG_CHECKING(for accctrl.h)
765	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
766		#include <windows.h>
767	#endif
768	#include <accctrl.h>],
769	[],AC_DEFINE(RUDIMENTS_HAVE_ACCCTRL_H, 1, Some systems have accctrl.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
770
771	AC_MSG_CHECKING(for lm.h)
772	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
773		#include <windows.h>
774	#endif
775	#include <lm.h>],
776	[],AC_DEFINE(RUDIMENTS_HAVE_LM_H, 1, Some systems have lm.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
777
778	AC_MSG_CHECKING(for psapi.h)
779	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
780		#include <windows.h>
781	#endif
782	#include <psapi.h>],
783	[],AC_DEFINE(RUDIMENTS_HAVE_PSAPI_H, 1, Some systems have psapi.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
784fi
785
786AC_MSG_CHECKING(for io.h)
787AC_TRY_COMPILE([#include <io.h>],
788[],AC_DEFINE(RUDIMENTS_HAVE_IO_H, 1, Some systems have io.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
789
790AC_MSG_CHECKING(for process.h)
791AC_TRY_COMPILE([#include <process.h>],
792[],AC_DEFINE(RUDIMENTS_HAVE_PROCESS_H, 1, Some systems have process.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
793
794AC_MSG_CHECKING(for sys/utsname.h)
795AC_TRY_COMPILE([#include <sys/utsname.h>],
796[],AC_DEFINE(RUDIMENTS_HAVE_SYS_UTSNAME_H, 1, Some systems have sys/utsname.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
797
798AC_MSG_CHECKING(for sys/mman.h)
799AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
800	#include <sys/types.h>
801#endif
802#include <sys/mman.h>],
803[],AC_DEFINE(RUDIMENTS_HAVE_SYS_MMAN_H, 1, Some systems have sys/mman.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
804
805AC_MSG_CHECKING(for sys/loadavg.h)
806AC_TRY_COMPILE([#include <sys/loadavg.h>],
807[],AC_DEFINE(RUDIMENTS_HAVE_SYS_LOADAVG_H, 1, Some systems have sys/loadavg.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
808
809AC_MSG_CHECKING(for sys/reboot.h)
810AC_TRY_COMPILE([#include <sys/reboot.h>],
811[],AC_DEFINE(RUDIMENTS_HAVE_SYS_REBOOT_H, 1, Some systems have sys/reboot.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
812
813AC_MSG_CHECKING(for linux/reboot.h)
814AC_TRY_COMPILE([#include <linux/reboot.h>],
815[],AC_DEFINE(RUDIMENTS_HAVE_LINUX_REBOOT_H, 1, Some systems have linux/reboot.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
816
817AC_MSG_CHECKING(for sys/uadmin.h)
818AC_TRY_COMPILE([#include <sys/uadmin.h>],
819[],AC_DEFINE(RUDIMENTS_HAVE_SYS_UADMIN_H, 1, Some systems have sys/uadmin.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
820
821AC_MSG_CHECKING(for prototypes.h)
822AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
823	#include <sys/types.h>
824#endif
825#include <prototypes.h>],
826[],AC_DEFINE(RUDIMENTS_HAVE_PROTOTYPES_H, 1, Some systems have prototypes.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
827
828AC_MSG_CHECKING(for Roster.h)
829AC_TRY_COMPILE([#include <Roster.h>],
830[],AC_DEFINE(RUDIMENTS_HAVE_ROSTER_H, 1, Some systems have Roster.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
831
832AC_MSG_CHECKING(for sys/signal.h)
833AC_TRY_COMPILE([#include <sys/signal.h>],
834[],AC_DEFINE(RUDIMENTS_HAVE_SYS_SIGNAL_H, 1, Some systems have sys/signal.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
835
836AC_MSG_CHECKING(for new)
837AC_TRY_COMPILE([#include <new>],
838[],AC_DEFINE(RUDIMENTS_HAVE_NEW, 1, Some systems have new) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
839
840AC_MSG_CHECKING(for new.h)
841AC_TRY_COMPILE([#include <new.h>],
842[],AC_DEFINE(RUDIMENTS_HAVE_NEW_H, 1, Some systems have new.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
843
844AC_MSG_CHECKING(for execinfo.h)
845AC_TRY_COMPILE([#include <execinfo.h>],
846[],AC_DEFINE(RUDIMENTS_HAVE_EXECINFO_H, 1, Some systems have execinfo.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
847
848AC_MSG_CHECKING(for dbghelp.h)
849AC_TRY_COMPILE([#include <dbghelp.h>],
850[],AC_DEFINE(RUDIMENTS_HAVE_DBGHELP_H, 1, Some systems have dbghelp.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
851
852dnl reenable -Werror (if we don't already have it) because _G_config.h is
853dnl deprecated on some systems and we want to exclude it on those systems
854HADWERROR="yes"
855if ( test -z "`echo $CPPFLAGS | grep Werror`" )
856then
857	CPPFLAGS="$CPPFLAGS $WERROR"
858	CXXFLAGS="$CXXFLAGS $WERROR"
859	HADWERROR="no"
860fi
861AC_MSG_CHECKING(for _G_config.h)
862AC_TRY_COMPILE([#include <_G_config.h>],
863[],AC_DEFINE(RUDIMENTS_HAVE_G_CONFIG_H, 1, Some systems have _G_config.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
864if ( test "$HADWERROR" = "no" )
865then
866	CPPFLAGS=`echo $CPPFLAGS | sed -e "s|-Werror[[^ ]]*||g" -e "s|-Wall||g"`
867	CXXFLAGS=`echo $CXXFLAGS | sed -e "s|-Werror[[^ ]]*||g" -e "s|-Wall||g"`
868fi
869
870AC_MSG_CHECKING(for locale.h)
871AC_TRY_COMPILE([#include <locale.h>],
872[],AC_DEFINE(RUDIMENTS_HAVE_LOCALE_H, 1, Some systems have locale.h) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
873echo "******************************"
874
875
876dnl Checks for thread library.
877echo
878echo "***** Threads ****************"
879FW_CHECK_PTHREAD
880FW_CHECK_THREAD
881FW_CHECK_MUTEX
882FW_CHECK_PTHREAD_SIGMASK
883echo "******************************"
884
885
886dnl Checks for TLS/SSL library.
887echo
888echo "***** TLS/SSL ****************"
889FW_CHECK_SSL
890echo "******************************"
891
892
893dnl Checks for GSS library.
894echo
895echo "***** GSS ********************"
896FW_CHECK_GSS
897AC_DEFUN(RUDIMENTS_HAS_SSPI,Rudiments supports SSPI)
898echo "******************************"
899
900
901dnl Checks for typedefs, structures, and compiler characteristics.
902echo
903echo "***** Structures *************"
904
905AC_C_INLINE
906AC_C_CONST
907
908AC_TYPE_UID_T
909AC_TYPE_MODE_T
910AC_TYPE_PID_T
911AC_TYPE_SIZE_T
912AC_TYPE_SSIZE_T
913AC_CHECK_TYPE([off64_t],[],[AC_DEFINE(off64_t,off_t,Some systems dont have off64_t)])
914AC_CHECK_TYPE([nlink_t],[],[AC_DEFINE(nlink_t,short,Some systems dont have nlink_t)])
915AC_CHECK_TYPE([key_t],[],[AC_DEFINE(key_t,int,Some systems dont have key_t)],[
916#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
917	#include <sys/types.h>
918#endif
919#ifdef RUDIMENTS_HAVE_SYS_IPC_H
920	#include <sys/ipc.h>
921#endif])
922
923
924AC_MSG_CHECKING(for socklen_t)
925AC_EGREP_CPP(socklen_t,[#include <sys/socket.h>],AC_MSG_RESULT(yes),AC_MSG_RESULT(no); AC_DEFINE(socklen_t, int, Some systems dont define socklen_t))
926
927AC_MSG_CHECKING(for union semun)
928AC_EGREP_CPP(union semun,[#include <sys/sem.h>],AC_DEFINE(RUDIMENTS_HAVE_SEMUN,1,Some systems define union semun) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
929
930AC_MSG_CHECKING(for struct msghdr.msg_controllen)
931AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
932	#include <sys/types.h>
933#endif
934#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
935	#include <sys/socket.h>
936#endif],
937struct msghdr m; m.msg_controllen=0;,AC_DEFINE(RUDIMENTS_HAVE_MSGHDR_MSG_CONTROLLEN,1,Some msghdr structs have a msg_controllen member) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
938
939AC_MSG_CHECKING(for struct msghdr.msg_flags)
940AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
941	#include <sys/types.h>
942#endif
943#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
944	#include <sys/socket.h>
945#endif],
946struct msghdr m; m.msg_flags=0;,AC_DEFINE(RUDIMENTS_HAVE_MSGHDR_MSG_FLAGS,1,Some msghdr structs have a msg_flags member) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
947
948AC_MSG_CHECKING(for struct msghdr.msg_accrights)
949AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
950	#include <sys/types.h>
951#endif
952#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
953	#include <sys/socket.h>
954#endif],
955struct msghdr m; m.msg_accrights=0;,AC_DEFINE(RUDIMENTS_HAVE_MSGHDR_MSG_ACCRIGHTS,1,Some msghdr structs have a msg_accrights member) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
956
957AC_MSG_CHECKING(for struct cmsghdr)
958AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
959	#include <sys/types.h>
960#endif
961#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
962	#include <sys/socket.h>
963#endif],
964struct cmsghdr cm; cm.cmsg_len=0;,AC_DEFINE(RUDIMENTS_HAVE_CMSGHDR,1,Some systems have cmsghdr) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
965
966AC_MSG_CHECKING(if struct stat contains st_blksize)
967AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
968	#include <sys/types.h>
969#endif
970#ifdef RUDIMENTS_HAVE_SYS_STAT_H
971	#include <sys/stat.h>
972#endif
973#ifdef RUDIMENTS_HAVE_UNISTD_H
974	#include <unistd.h>
975#endif],
976struct stat st;
977blksize_t s=st.st_blksize;,AC_DEFINE(RUDIMENTS_HAVE_BLKSIZE_T,1,Some systems dont have st_blksize in struct stat) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
978
979AC_MSG_CHECKING(if struct stat contains st_blocks)
980AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
981	#include <sys/types.h>
982#endif
983#ifdef RUDIMENTS_HAVE_SYS_STAT_H
984	#include <sys/stat.h>
985#endif
986#ifdef RUDIMENTS_HAVE_UNISTD_H
987	#include <unistd.h>
988#endif],
989struct stat st;
990blkcnt_t b=st.st_blocks;,AC_DEFINE(RUDIMENTS_HAVE_BLKCNT_T,1,Some systems dont have st_blocks in struct stat) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
991
992AC_MSG_CHECKING(if S_ISSOCK exists)
993AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
994	#include <sys/types.h>
995#endif
996#ifdef RUDIMENTS_HAVE_SYS_STAT_H
997	#include <sys/stat.h>
998#endif
999#ifdef RUDIMENTS_HAVE_UNISTD_H
1000	#include <unistd.h>
1001#endif],
1002S_ISSOCK(0);,AC_DEFINE(RUDIMENTS_HAVE_S_ISSOCK,1,Some systems dont have S_ISSOCK) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1003
1004AC_MSG_CHECKING(if S_ISLNK exists)
1005AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1006	#include <sys/types.h>
1007#endif
1008#ifdef RUDIMENTS_HAVE_SYS_STAT_H
1009	#include <sys/stat.h>
1010#endif
1011#ifdef RUDIMENTS_HAVE_UNISTD_H
1012	#include <unistd.h>
1013#endif],
1014S_ISLNK(0);,AC_DEFINE(RUDIMENTS_HAVE_S_ISLNK,1,Some systems dont have S_ISLNK) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1015
1016AC_MSG_CHECKING(if S_ISBLK exists)
1017AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1018	#include <sys/types.h>
1019#endif
1020#ifdef RUDIMENTS_HAVE_SYS_STAT_H
1021	#include <sys/stat.h>
1022#endif
1023#ifdef RUDIMENTS_HAVE_UNISTD_H
1024	#include <unistd.h>
1025#endif],
1026S_ISBLK(0);,AC_DEFINE(RUDIMENTS_HAVE_S_ISBLK,1,Some systems dont have S_ISBLK) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1027
1028AC_MSG_CHECKING(type of iovec.iov_base)
1029AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1030	#include <sys/types.h>
1031#endif
1032#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1033	#include <sys/socket.h>
1034#endif
1035#ifdef RUDIMENTS_HAVE_SYS_UIO_H
1036	#include <sys/uio.h>
1037#endif],
1038struct iovec iov; iov.iov_base=(void *)" ";,AC_DEFINE(RUDIMENTS_IOV_BASE_TYPE,void *,iov_base is void *) AC_MSG_RESULT(void *), AC_DEFINE(RUDIMENTS_IOV_BASE_TYPE,char *,iov_base is char *) AC_MSG_RESULT(char *))
1039
1040FW_STATFS
1041
1042AC_MSG_CHECKING(for struct timespec in time.h)
1043AC_TRY_COMPILE([#include <time.h>],
1044struct timespec a;,AC_DEFINE(RUDIMENTS_HAVE_STRUCT_TIMESPEC_IN_TIME_H,1,Some systems have struct timespec in time.h) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1045
1046AC_MSG_CHECKING(for struct timespec in sys/time.h)
1047AC_TRY_COMPILE([#include <sys/time.h>],
1048struct timespec a;,AC_DEFINE(RUDIMENTS_HAVE_STRUCT_TIMESPEC_IN_SYS_TIME_H,1,Some systems have struct timespec in sys/time.h) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1049
1050AC_MSG_CHECKING(for struct timespec in sys/siginfo.h)
1051AC_TRY_COMPILE([#include <sys/siginfo.h>],
1052struct timespec a;,AC_DEFINE(RUDIMENTS_HAVE_STRUCT_TIMESPEC_IN_SIGINFO,1,Some systems have struct timespec in sys/siginfo.h) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1053
1054AC_MSG_CHECKING(for struct timespec in pthread.h)
1055AC_TRY_COMPILE([#include <pthread.h>],
1056struct timespec a;,AC_DEFINE(RUDIMENTS_HAVE_STRUCT_TIMESPEC_IN_PTHREAD,1,Some systems have struct timespec in pthread.h) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1057
1058AC_MSG_CHECKING(for in_addr_t type)
1059AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1060	#include <sys/types.h>
1061#endif
1062#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1063	#include <winsock2.h>
1064#endif
1065#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1066	#include <sys/socket.h>
1067#endif
1068#ifdef RUDIMENTS_HAVE_NETINET_IN_H
1069	#include <netinet/in.h>
1070#endif
1071#ifdef RUDIMENTS_HAVE_ARPA_INET_H
1072	#include <arpa/inet.h>
1073#endif],
1074[in_addr_t i=0;],AC_DEFINE(RUDIMENTS_HAVE_IN_ADDR_T,1,Some systems have in_addr_t type) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1075
1076AC_MSG_CHECKING(for sockaddr_un type)
1077AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1078	#include <sys/types.h>
1079#endif
1080#ifdef RUDIMENTS_HAVE_SYS_UN_H
1081	#include <sys/un.h>
1082#endif],
1083[struct sockaddr_un a;],AC_DEFINE(RUDIMENTS_HAVE_SOCKADDR_UN,1,Some systems have sockaddr_un) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1084
1085AC_MSG_CHECKING(for int8_t type)
1086AC_TRY_COMPILE([#if defined(RUDIMENTS_HAVE_STDINT_H)
1087	#include <stdint.h>
1088#elif defined(RUDIMENTS_HAVE_SYS_BITYPES_H)
1089	#include <sys/bitypes.h>
1090#elif defined(RUDIMENTS_HAVE_INTTYPES_H)
1091	#include <inttypes.h>
1092#endif],
1093[int8_t i;],AC_DEFINE(RUDIMENTS_HAVE_INT8_T,1,Some systems have int8_t) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1094
1095AC_MSG_CHECKING(for uint8_t type)
1096AC_TRY_COMPILE([#if defined(RUDIMENTS_HAVE_STDINT_H)
1097	#include <stdint.h>
1098#elif defined(RUDIMENTS_HAVE_SYS_BITYPES_H)
1099	#include <sys/bitypes.h>
1100#elif defined(RUDIMENTS_HAVE_INTTYPES_H)
1101	#include <inttypes.h>
1102#endif],
1103[uint8_t i;],AC_DEFINE(RUDIMENTS_HAVE_UINT8_T,1,Some systems have uint8_t) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1104
1105AC_MSG_CHECKING(for int16_t type)
1106AC_TRY_COMPILE([#if defined(RUDIMENTS_HAVE_STDINT_H)
1107	#include <stdint.h>
1108#elif defined(RUDIMENTS_HAVE_SYS_BITYPES_H)
1109	#include <sys/bitypes.h>
1110#elif defined(RUDIMENTS_HAVE_INTTYPES_H)
1111	#include <inttypes.h>
1112#endif],
1113[int16_t i;],AC_DEFINE(RUDIMENTS_HAVE_INT16_T,1,Some systems have int16_t) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1114
1115AC_MSG_CHECKING(for uint16_t type)
1116AC_TRY_COMPILE([#if defined(RUDIMENTS_HAVE_STDINT_H)
1117	#include <stdint.h>
1118#elif defined(RUDIMENTS_HAVE_SYS_BITYPES_H)
1119	#include <sys/bitypes.h>
1120#elif defined(RUDIMENTS_HAVE_INTTYPES_H)
1121	#include <inttypes.h>
1122#endif],
1123[uint16_t i;],AC_DEFINE(RUDIMENTS_HAVE_UINT16_T,1,Some systems have uint16_t) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1124
1125RUDIMENTS_HAVE_CHAR16_T="no"
1126AC_MSG_CHECKING(for char16_t type)
1127AC_TRY_COMPILE([#if defined(RUDIMENTS_HAVE_STDINT_H)
1128	#include <stdint.h>
1129#elif defined(RUDIMENTS_HAVE_SYS_BITYPES_H)
1130	#include <sys/bitypes.h>
1131#elif defined(RUDIMENTS_HAVE_INTTYPES_H)
1132	#include <inttypes.h>
1133#endif
1134#if defined(RUDIMENTS_HAVE_UCHAR_H)
1135	#include <uchar.h>
1136#endif
1137#if defined(RUDIMENTS_HAVE_NEW)
1138	#include <new>
1139#endif
1140#if defined(RUDIMENTS_HAVE_NEW_H)
1141	#include <new.h>
1142#endif],
1143[char16_t i;],AC_DEFINE(RUDIMENTS_HAVE_CHAR16_T,1,Some systems have char16_t) AC_MSG_RESULT(yes); RUDIMENTS_HAVE_CHAR16_T="yes", AC_MSG_RESULT(no))
1144
1145AC_MSG_CHECKING(for int32_t type)
1146AC_TRY_COMPILE([#if defined(RUDIMENTS_HAVE_STDINT_H)
1147	#include <stdint.h>
1148#elif defined(RUDIMENTS_HAVE_SYS_BITYPES_H)
1149	#include <sys/bitypes.h>
1150#elif defined(RUDIMENTS_HAVE_INTTYPES_H)
1151	#include <inttypes.h>
1152#endif],
1153[int32_t i;],AC_DEFINE(RUDIMENTS_HAVE_INT32_T,1,Some systems have int32_t) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1154
1155AC_MSG_CHECKING(for uint32_t type)
1156AC_TRY_COMPILE([#if defined(RUDIMENTS_HAVE_STDINT_H)
1157	#include <stdint.h>
1158#elif defined(RUDIMENTS_HAVE_SYS_BITYPES_H)
1159	#include <sys/bitypes.h>
1160#elif defined(RUDIMENTS_HAVE_INTTYPES_H)
1161	#include <inttypes.h>
1162#endif],
1163[uint32_t i;],AC_DEFINE(RUDIMENTS_HAVE_UINT32_T,1,Some systems have uint32_t) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1164
1165AC_MSG_CHECKING(for int64_t type)
1166AC_TRY_COMPILE([#if defined(RUDIMENTS_HAVE_STDINT_H)
1167	#include <stdint.h>
1168#elif defined(RUDIMENTS_HAVE_SYS_BITYPES_H)
1169	#include <sys/bitypes.h>
1170#elif defined(RUDIMENTS_HAVE_INTTYPES_H)
1171	#include <inttypes.h>
1172#endif],
1173[int64_t i;],AC_DEFINE(RUDIMENTS_HAVE_INT64_T,1,Some systems have int64_t) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1174
1175AC_MSG_CHECKING(for uint64_t type)
1176AC_TRY_COMPILE([#if defined(RUDIMENTS_HAVE_STDINT_H)
1177	#include <stdint.h>
1178#elif defined(RUDIMENTS_HAVE_SYS_BITYPES_H)
1179	#include <sys/bitypes.h>
1180#elif defined(RUDIMENTS_HAVE_INTTYPES_H)
1181	#include <inttypes.h>
1182#endif],
1183[uint64_t i;],AC_DEFINE(RUDIMENTS_HAVE_UINT64_T,1,Some systems have uint64_t) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1184
1185dnl SCO CC doesn't support long long but throws a warning rather than an error
1186if ( test "$RUDIMENTS_HAVE_SCO" = "yes" -a "$CXX" = "CC" )
1187then
1188AC_MSG_CHECKING(for long long type)
1189AC_MSG_RESULT(no)
1190else
1191AC_MSG_CHECKING(for long long type)
1192AC_TRY_COMPILE([],
1193[long long i;],AC_DEFINE(RUDIMENTS_HAVE_LONG_LONG,1,Most systems have long long) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1194fi
1195
1196AC_MSG_CHECKING(for bool)
1197AC_TRY_COMPILE([],
1198[bool a=1;],AC_DEFINE(RUDIMENTS_HAVE_BOOL,1,Most systems have bool) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1199
1200AC_MSG_CHECKING(for true/false)
1201AC_TRY_COMPILE([],
1202[int a=true;],AC_DEFINE(RUDIMENTS_HAVE_TRUE_FALSE,1,Most systems have true/false) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1203echo "******************************"
1204
1205
1206dnl Checks associated with signal handling
1207echo
1208echo "***** Signal Handling ********"
1209
1210if ( test "$INCLUDE_SIGNALCLASSES" = "1" )
1211then
1212
1213AC_MSG_CHECKING(for sigaction)
1214AC_TRY_COMPILE([#include <signal.h>
1215#ifdef RUDIMENTS_HAVE_STDLIB_H
1216	#include <stdlib.h>
1217#endif],
1218sigaction(0,NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_SIGACTION,1,Some systems have sigaction) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1219
1220AC_MSG_CHECKING(for signal)
1221AC_TRY_COMPILE([#include <signal.h>
1222#ifdef RUDIMENTS_HAVE_STDLIB_H
1223	#include <stdlib.h>
1224#endif],
1225signal(0,NULL);,AC_DEFINE(RUDIMENTS_HAVE_SIGNAL,1,Some systems have signal) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1226
1227AC_MSG_CHECKING(for SetConsoleCtrlHandler)
1228AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
1229	#include <windows.h>
1230#endif],
1231SetConsoleCtrlHandler(0,0);,AC_DEFINE(RUDIMENTS_HAVE_SETCONSOLECTRLHANDLER,1,Some systems have SetConsoleCtrlHandler) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1232
1233AC_MSG_CHECKING(for SetUnhandledExceptionFilter)
1234AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
1235	#include <windows.h>
1236#endif],
1237SetUnhandledExceptionFilter(0);,AC_DEFINE(RUDIMENTS_HAVE_SETUNHANDLEDEXCEPTIONFILTER,1,Some systems have SetUnhandledExceptionFilter) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1238
1239
1240AC_MSG_CHECKING(signal handler parameter)
1241AC_TRY_COMPILE([#include <signal.h>],
1242void (*handler)(int);
1243#if defined(RUDIMENTS_HAVE_SIGACTION)
1244	struct sigaction test;
1245	test.sa_handler=handler;
1246#elif defined(RUDIMENTS_HAVE_SIGNAL)
1247	signal(0,handler);
1248#else
1249	#error neither sigaction nor signal was found
1250#endif
1251,AC_DEFINE(RUDIMENTS_SIGNAL_HANDLER_INT,1,Most systems define signal handlers with an integer parameter) AC_MSG_RESULT(int),AC_MSG_RESULT(void))
1252
1253AC_MSG_CHECKING(for kill)
1254AC_TRY_COMPILE([#include <signal.h>
1255#ifdef RUDIMENTS_HAVE_STDLIB_H
1256	#include <stdlib.h>
1257#endif],
1258kill(0,0);,AC_DEFINE(RUDIMENTS_HAVE_KILL,1,Some systems have kill) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1259
1260AC_MSG_CHECKING(for raise)
1261AC_TRY_COMPILE([#include <signal.h>
1262#ifdef RUDIMENTS_HAVE_STDLIB_H
1263	#include <stdlib.h>
1264#endif],
1265raise(0);,AC_DEFINE(RUDIMENTS_HAVE_RAISE,1,Some systems have raise) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1266
1267AC_MSG_CHECKING(for GenerateConsoleCtrlEvent)
1268AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
1269	#include <windows.h>
1270#endif],
1271GenerateConsoleCtrlEvent(0,0);,AC_DEFINE(RUDIMENTS_HAVE_GENERATECONSOLECTRLEVENT,1,Some systems have GenerateConsoleCtrlEvent) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1272
1273AC_MSG_CHECKING(for sigsuspend)
1274AC_TRY_COMPILE([#include <signal.h>
1275#ifdef RUDIMENTS_HAVE_STDLIB_H
1276	#include <stdlib.h>
1277#endif],
1278sigsuspend(NULL);,AC_DEFINE(RUDIMENTS_HAVE_SIGSUSPEND,1,Some systems have sigsuspend) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1279
1280AC_MSG_CHECKING(for sigpending)
1281AC_TRY_COMPILE([#include <signal.h>
1282#ifdef RUDIMENTS_HAVE_STDLIB_H
1283	#include <stdlib.h>
1284#endif],
1285sigpending(NULL);,AC_DEFINE(RUDIMENTS_HAVE_SIGPENDING,1,Some systems have sigpending) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1286
1287AC_MSG_CHECKING(for alarm)
1288AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
1289	#include <unistd.h>
1290#endif],
1291alarm(0);,AC_DEFINE(RUDIMENTS_HAVE_ALARM,1,Some systems have alarm) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1292
1293AC_MSG_CHECKING(for CreateTimerQueueTimer)
1294AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
1295	#include <windows.h>
1296#endif],
1297CreateTimerQueueTimer(0,0,0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_CREATETIMERQUEUETIMER,1,Some systems have CreateTimerQueueTimer) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1298
1299fi
1300
1301echo "******************************"
1302
1303dnl Checks associated with date and time
1304echo
1305echo "***** Date and Time **********"
1306
1307AC_MSG_CHECKING(for GetSystemTimeAsFileTime)
1308AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
1309	#include <windows.h>
1310#endif
1311#ifdef RUDIMENTS_HAVE_STDLIB_H
1312	#include <stdlib.h>
1313#endif],
1314GetSystemTimeAsFileTime(NULL);,AC_DEFINE(RUDIMENTS_HAVE_GETSYSTEMTIMEASFILETIME,1,Some systems have GetSystemTimeAsFileTime) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1315
1316AC_MSG_CHECKING(for SetSystemTime)
1317AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
1318	#include <windows.h>
1319#endif
1320#ifdef RUDIMENTS_HAVE_STDLIB_H
1321	#include <stdlib.h>
1322#endif],
1323SetSystemTime(NULL);,AC_DEFINE(RUDIMENTS_HAVE_SETSYSTEMTIME,1,Some systems have SetSystemTime) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1324
1325AC_MSG_CHECKING(for tm_zone)
1326AC_TRY_COMPILE([#include <time.h>],
1327struct tm t;  t.tm_zone=0;,AC_DEFINE(RUDIMENTS_HAS_TM_ZONE,1,Some systems define tm_zone in their struct tm) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1328
1329AC_MSG_CHECKING(for tm_gmtoff)
1330AC_TRY_COMPILE([#include <time.h>],
1331struct tm t; t.tm_gmtoff=0;,AC_DEFINE(RUDIMENTS_HAS_TM_GMTOFF,1,Some systems define tm_gmtoff in their struct tm) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1332
1333AC_MSG_CHECKING(for __tm_zone)
1334AC_TRY_COMPILE([#include <time.h>],
1335struct tm t; t.__tm_zone=0;,AC_DEFINE(RUDIMENTS_HAS___TM_ZONE,1,Some systems define __tm_zone in their struct tm) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1336
1337AC_MSG_CHECKING(for __tm_gmtoff)
1338AC_TRY_COMPILE([#include <time.h>],
1339struct tm t; t.__tm_gmtoff=0;,AC_DEFINE(RUDIMENTS_HAS___TM_GMTOFF,1,Some systems define __tm_gmtoff in their struct tm) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1340
1341AC_MSG_CHECKING(for timezone)
1342AC_TRY_COMPILE([#include <time.h>],
1343long	t=-timezone;,AC_DEFINE(RUDIMENTS_HAS_TIMEZONE,1,Some systems have timezone) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1344
1345AC_MSG_CHECKING(for _timezone)
1346AC_TRY_COMPILE([#include <time.h>],
1347long	t=-_timezone;,AC_DEFINE(RUDIMENTS_HAS__TIMEZONE,1,Some systems have _timezone) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1348
1349AC_MSG_CHECKING(for _get_timezone)
1350AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
1351	#include <stdlib.h>
1352#endif
1353#include <time.h>],
1354_get_timezone(NULL);,AC_DEFINE(RUDIMENTS_HAS__GET_TIMEZONE,1,Some systems have _get_timezone) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1355
1356AC_MSG_CHECKING(for tm_name)
1357AC_EGREP_CPP(tm_name,[#include <time.h>],AC_DEFINE(RUDIMENTS_HAS_TM_NAME,1,Some systems define tm_name in their struct tm) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1358
1359dnl OSR5 has this, but it's broken
1360AC_MSG_CHECKING(for tm_tzadj)
1361if ( test -z "$RUDIMENTS_HAVE_SCO_OSR5" )
1362then
1363	AC_EGREP_CPP(tm_tzadj,[#include <time.h>],AC_DEFINE(RUDIMENTS_HAS_TM_TZADJ,1,Some systems define tm_tzadj in their struct tm) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1364else
1365	AC_MSG_RESULT(disabled (broken on SCO OSR5))
1366fi
1367
1368AC_MSG_CHECKING(for real-time-clock RTC_RD_TIME support)
1369AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_LINUX_RTC_H
1370	#include <linux/rtc.h>
1371#endif
1372#ifdef RUDIMENTS_HAVE_SYS_IOCTL_H
1373	#include <sys/ioctl.h>
1374#endif,
1375#ifdef RUDIMENTS_HAVE_UNISTD_H
1376	#include <unistd.h>
1377#endif],
1378ioctl(0,RTC_RD_TIME,0);,AC_DEFINE(RUDIMENTS_HAVE_RTC_RD_TIME,1,Do we have real-time-clock RTC_RD_TIME support) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1379
1380AC_MSG_CHECKING(for real-time-clock RTC_SET_TIME support)
1381AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_LINUX_RTC_H
1382	#include <linux/rtc.h>
1383#endif
1384#ifdef RUDIMENTS_HAVE_SYS_IOCTL_H
1385	#include <sys/ioctl.h>
1386#endif
1387#ifdef RUDIMENTS_HAVE_UNISTD_H
1388	#include <unistd.h>
1389#endif],
1390ioctl(0,RTC_SET_TIME,0);,AC_DEFINE(RUDIMENTS_HAVE_RTC_SET_TIME,1,Do we have real-time-clock RTC_SET_TIME support) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1391
1392AC_MSG_CHECKING(for localtime_r)
1393AC_TRY_COMPILE([#include <time.h>
1394#ifdef RUDIMENTS_HAVE_STDLIB_H
1395	#include <stdlib.h>
1396#endif],
1397localtime_r(NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_LOCALTIME_R,1,Some systems have localtime_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1398
1399AC_MSG_CHECKING(for localtime_s)
1400AC_TRY_COMPILE([#include <time.h>
1401#ifdef RUDIMENTS_HAVE_STDLIB_H
1402	#include <stdlib.h>
1403#endif],
1404localtime_s(NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_LOCALTIME_S,1,Some systems have localtime_s) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1405
1406AC_MSG_CHECKING(for gettimeofday)
1407AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TIME_H
1408extern "C" {
1409	#include <sys/time.h>
1410}
1411#endif
1412#ifdef RUDIMENTS_HAVE_STDLIB_H
1413	#include <stdlib.h>
1414#endif],
1415gettimeofday(NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_GETTIMEOFDAY,1,Some systems have gettimeofday) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1416
1417AC_MSG_CHECKING(for settimeofday)
1418AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TIME_H
1419extern "C" {
1420	#include <sys/time.h>
1421}
1422#endif
1423#ifdef RUDIMENTS_HAVE_STDLIB_H
1424	#include <stdlib.h>
1425#endif],
1426settimeofday(NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_SETTIMEOFDAY,1,Some systems have settimeofday) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1427
1428AC_MSG_CHECKING(for set_real_time_clock)
1429AC_TRY_LINK([#include <os/kernel/OS.h>],
1430set_real_time_clock(0);,AC_DEFINE(RUDIMENTS_HAVE_SET_REAL_TIME_CLOCK,1,Some systems have set_real_time_clock) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1431
1432AC_MSG_CHECKING(for clock_settime)
1433AC_TRY_LINK([#include <time.h>],
1434clock_settime(0,0);,AC_DEFINE(RUDIMENTS_HAVE_CLOCK_SETTIME,1,Some systems have clock_settime) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1435
1436HAS_TSZET=""
1437AC_MSG_CHECKING(for tzset)
1438AC_TRY_COMPILE([#include <time.h>],
1439tzset();,AC_DEFINE(RUDIMENTS_HAS_TZSET,1,Some systems have tzset) AC_MSG_RESULT(yes),AC_MSG_RESULT(no); HAS_TZSET="no")
1440
1441if ( test "$HAS_TZSET" = "no" )
1442then
1443	AC_MSG_CHECKING(for undefined tzset)
1444	AC_TRY_LINK([extern "C" void tzset();],
1445tzset();,AC_DEFINE(RUDIMENTS_HAS_UNDEFINED_TZSET,1,Some systems have tzset but dont define it) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1446fi
1447
1448AC_MSG_CHECKING(for _tzset)
1449AC_TRY_COMPILE([#include <time.h>],
1450_tzset();,AC_DEFINE(RUDIMENTS_HAS__TZSET,1,Some systems have _tzset) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1451
1452AC_MSG_CHECKING(for tzname)
1453AC_TRY_COMPILE([#include <time.h>],
1454const char * const *c=tzname;,AC_DEFINE(RUDIMENTS_HAS_TZNAME,1,Some systems have tzname) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1455
1456AC_MSG_CHECKING(for _tzname)
1457AC_TRY_COMPILE([#include <time.h>],
1458const char * const *c=_tzname;,AC_DEFINE(RUDIMENTS_HAS__TZNAME,1,Some systems have _tzname) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1459
1460AC_MSG_CHECKING(for _get_tzname)
1461AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
1462	#include <stdlib.h>
1463#endif
1464#include <time.h>],
1465_get_tzname(NULL,NULL,0,0);,AC_DEFINE(RUDIMENTS_HAS__GET_TZNAME,1,Some systems have _get_tzname) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1466
1467echo "******************************"
1468
1469
1470dnl Checks for environment functions.
1471echo
1472echo "***** Environment ************"
1473
1474AC_MSG_CHECKING(for setenv)
1475AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1476	#include <stdlib.h>
1477#endif],
1478setenv(NULL,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_SETENV,1,Some systems have setenv) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1479
1480AC_MSG_CHECKING(for putenv)
1481AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1482	#include <stdlib.h>
1483#endif],
1484putenv(NULL);,AC_DEFINE(RUDIMENTS_HAVE_PUTENV,1,Some systems have putenv) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1485
1486AC_MSG_CHECKING(for _putenv)
1487AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1488	#include <stdlib.h>
1489#endif],
1490_putenv(NULL);,AC_DEFINE(RUDIMENTS_HAVE__PUTENV,1,Some systems have _putenv) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1491
1492AC_MSG_CHECKING(for getenv)
1493AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1494	#include <stdlib.h>
1495#endif],
1496getenv(NULL);,AC_DEFINE(RUDIMENTS_HAVE_GETENV,1,Some systems have getenv) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1497
1498AC_MSG_CHECKING(for _dupenv_s)
1499AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
1500	#include <stdlib.h>
1501#endif],
1502_dupenv_s(NULL,NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE__DUPENV_S,1,Some systems have _dupenv_s) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1503
1504AC_MSG_CHECKING(for unsetenv)
1505AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1506	#include <stdlib.h>
1507#endif],
1508unsetenv(NULL);,AC_DEFINE(RUDIMENTS_HAVE_UNSETENV,1,Some systems have unsetenv) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1509
1510AC_MSG_CHECKING(for _NSGetEnviron)
1511AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1512	#include <stdlib.h>
1513#endif
1514#include <crt_externs.h>],
1515char **env=(*_NSGetEnviron());,AC_DEFINE(RUDIMENTS_HAVE_NSGETENVIRON,1,Some systems define _NSGetEnviron in crt_externs.h) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1516
1517AC_MSG_CHECKING(for environ)
1518AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1519	#include <stdlib.h>
1520#endif
1521#ifdef RUDIMENTS_HAVE_UNISTD_H
1522	#include <unistd.h>
1523#endif],
1524char **env=environ;,AC_DEFINE(RUDIMENTS_HAVE_ENVIRON,1,Some systems define environ in unistd.h) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1525
1526AC_MSG_CHECKING(for clearenv)
1527AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1528	#include <stdlib.h>
1529#endif],
1530clearenv();,AC_DEFINE(RUDIMENTS_HAVE_CLEARENV,1,Some systems have clearenv) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1531
1532echo "******************************"
1533
1534
1535dnl Checks for regular expression functions.
1536echo
1537echo "***** Regular Expressions ****"
1538
1539if ( test "$USE_BUILT_IN_REGULAREXPRESSION" = "0" )
1540then
1541
1542	FW_CHECK_PCRE
1543
1544	if ( test -z "$HAVE_PCRE" )
1545	then
1546		HAVE_REGCOMP=""
1547		AC_MSG_CHECKING(for regcomp)
1548		AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1549		#include <stdlib.h>
1550	#endif
1551	#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1552		#include <sys/types.h>
1553	#endif
1554	#include <regex.h>],
1555	regcomp(NULL,NULL,0);,HAVE_REGCOMP="yes"; AC_DEFINE(RUDIMENTS_HAVE_REGCOMP,1,some systems have regcomp) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1556	fi
1557
1558	USE_BUILT_IN_REGULAREXPRESSION="0"
1559fi
1560
1561AC_MSG_CHECKING(for built-in regex)
1562if ( test -z "$HAVE_PCRE" -a -z "$HAVE_REGCOMP" )
1563then
1564	AC_MSG_RESULT(yes)
1565	USE_BUILT_IN_REGULAREXPRESSION="1"
1566else
1567	AC_MSG_RESULT(no)
1568fi
1569
1570echo "******************************"
1571
1572
1573dnl Checks for networking functions.
1574echo
1575echo "***** Networking *************"
1576
1577AC_MSG_CHECKING(for WSAConnect)
1578AC_TRY_COMPILE([
1579#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1580	#include <winsock2.h>
1581#endif],
1582WSAConnect(0,0,0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_WSACONNECT,1,Some systems have WSAConnect) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1583
1584AC_MSG_CHECKING(for WSADuplicateSocket)
1585AC_TRY_COMPILE([
1586#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1587	#include <winsock2.h>
1588#endif],
1589WSADuplicateSocket(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_WSADUPLICATESOCKET,1,Some systems have WSADuplicateSocket) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1590
1591AC_MSG_CHECKING(for closesocket)
1592AC_TRY_COMPILE([
1593#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1594	#include <winsock2.h>
1595#endif],
1596closesocket(0);,AC_DEFINE(RUDIMENTS_HAVE_CLOSESOCKET,1,some systems have closesocket) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1597
1598AC_MSG_CHECKING(if connect has a non-const sockaddr * parameter)
1599AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1600	#include <stdlib.h>
1601#endif
1602#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1603	#include <winsock2.h>
1604#else
1605	#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1606		#include <sys/types.h>
1607	#endif
1608	#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1609		#include <sys/socket.h>
1610	#endif
1611#endif],
1612connect(0,(const sockaddr *)NULL,0);,AC_MSG_RESULT(no),AC_DEFINE(RUDIMENTS_HAVE_CONNECT_WITH_NON_CONST_SOCKADDR,1, connect has a const sockaddr * on most systems ) AC_MSG_RESULT(yes))
1613
1614AC_MSG_CHECKING(if send has a const void * parameter)
1615AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1616	#include <stdlib.h>
1617#endif
1618#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1619	#include <winsock2.h>
1620#else
1621	#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1622		#include <sys/types.h>
1623	#endif
1624	#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1625		#include <sys/socket.h>
1626	#endif
1627#endif],
1628send(0,(const void *)NULL,0,0);,AC_DEFINE(RUDIMENTS_HAVE_SEND_WITH_VOID,1, send has a const void * on most systems ) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1629
1630AC_MSG_CHECKING(if recv has a void * parameter)
1631AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1632	#include <stdlib.h>
1633#endif
1634#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1635	#include <winsock2.h>
1636#else
1637	#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1638		#include <sys/types.h>
1639	#endif
1640	#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1641		#include <sys/socket.h>
1642	#endif
1643#endif],
1644recv(0,(void *)NULL,0,0);,AC_DEFINE(RUDIMENTS_HAVE_RECV_WITH_VOID,1, recv has a void * on most systems ) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1645
1646AC_MSG_CHECKING(if setsockopt has a const void * parameter)
1647AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1648	#include <stdlib.h>
1649#endif
1650#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1651	#include <winsock2.h>
1652#else
1653	#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1654		#include <sys/types.h>
1655	#endif
1656	#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1657		#include <sys/socket.h>
1658	#endif
1659#endif],
1660setsockopt(0,0,0,(const void *)NULL,0);,AC_DEFINE(RUDIMENTS_SETSOCKOPT_OPTVAL_TYPE, const void *, setsockopt has a const void * on most systems ) AC_MSG_RESULT(yes), AC_DEFINE(RUDIMENTS_SETSOCKOPT_OPTVAL_TYPE, const char *, setsockopt has a const void * on most systems ) AC_MSG_RESULT(no))
1661
1662AC_MSG_CHECKING(if getsockopt has a void * parameter)
1663AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1664	#include <stdlib.h>
1665#endif
1666#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1667	#include <winsock2.h>
1668#else
1669	#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1670		#include <sys/types.h>
1671	#endif
1672	#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1673		#include <sys/socket.h>
1674	#endif
1675#endif],
1676void *ptr; getsockopt(0,0,0,ptr,0);,AC_DEFINE(RUDIMENTS_GETSOCKOPT_OPTVAL_TYPE, void *, getsockopt has a void * on most systems ) AC_MSG_RESULT(yes), AC_DEFINE(RUDIMENTS_GETSOCKOPT_OPTVAL_TYPE, char *, getsockopt has a void * on most systems ) AC_MSG_RESULT(no))
1677
1678AC_MSG_CHECKING(for socklen_t vs size_t)
1679AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1680	#include <stdlib.h>
1681#endif
1682#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1683	#include <winsock2.h>
1684#else
1685	#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1686		#include <sys/types.h>
1687	#endif
1688	#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1689		#include <sys/socket.h>
1690	#endif
1691#endif],
1692size_t *ptr; getsockopt(0,0,0,0,ptr);,AC_DEFINE(RUDIMENTS_SOCKLEN_OR_SIZE_T, size_t, getsockopt has a socklen_t * on most systems ) AC_MSG_RESULT(size_t), AC_DEFINE(RUDIMENTS_SOCKLEN_OR_SIZE_T, socklen_t, getsockopt has a socklen_t * on most systems ) AC_MSG_RESULT(socklen_t))
1693
1694HAVE_INET_ATON="no"
1695AC_MSG_CHECKING(for inet_aton)
1696AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1697	#include <sys/types.h>
1698#endif
1699#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1700	#include <winsock2.h>
1701#endif
1702#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1703	#include <sys/socket.h>
1704#endif
1705#ifdef RUDIMENTS_HAVE_NETINET_IN_H
1706	#include <netinet/in.h>
1707#endif
1708#ifdef RUDIMENTS_HAVE_ARPA_INET_H
1709	#include <arpa/inet.h>
1710#endif
1711#ifdef RUDIMENTS_HAVE_STDLIB_H
1712	#include <stdlib.h>
1713#endif],
1714inet_aton(0,NULL);,HAVE_INET_ATON="yes"; AC_DEFINE(RUDIMENTS_HAVE_INET_ATON,1,Some systems have inet_aton) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1715
1716AC_MSG_CHECKING(for inet_addr)
1717AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1718	#include <sys/types.h>
1719#endif
1720#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1721	#include <winsock2.h>
1722#endif
1723#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1724	#include <sys/socket.h>
1725#endif
1726#ifdef RUDIMENTS_HAVE_NETINET_IN_H
1727	#include <netinet/in.h>
1728#endif
1729#ifdef RUDIMENTS_HAVE_ARPA_INET_H
1730	#include <arpa/inet.h>
1731#endif
1732#ifdef RUDIMENTS_HAVE_STDLIB_H
1733	#include <stdlib.h>
1734#endif],
1735inet_addr(0);,AC_DEFINE(RUDIMENTS_HAVE_INET_ADDR,1,Some systems have inet_addr) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1736
1737FW_CHECK_XNET_PROTOTYPES
1738FW_CHECK_SOCKET_LIBS
1739
1740OLDLIBS="$LIBS"
1741LIBS="$LIBS $SOCKETLIBS"
1742
1743if ( test "$HAVE_INET_ATON" = "yes" )
1744then
1745	AC_MSG_CHECKING(whether inet_aton needs -lresolv)
1746	INETATONLIB=""
1747AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1748	#include <sys/types.h>
1749#endif
1750#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1751	#include <winsock2.h>
1752#endif
1753#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1754	#include <sys/socket.h>
1755#endif
1756#ifdef RUDIMENTS_HAVE_NETINET_IN_H
1757	#include <netinet/in.h>
1758#endif
1759#ifdef RUDIMENTS_HAVE_ARPA_INET_H
1760	#include <arpa/inet.h>
1761#endif
1762#ifdef RUDIMENTS_HAVE_STDLIB_H
1763	#include <stdlib.h>
1764#endif],
1765inet_aton(0,NULL);,AC_MSG_RESULT(no), INETATONLIB="-lresolv"; AC_MSG_RESULT(yes))
1766AC_SUBST(INETATONLIB)
1767fi
1768
1769HAS_SENDMSG=""
1770AC_MSG_CHECKING(for sendmsg)
1771AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1772	#include <sys/types.h>
1773#endif
1774#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1775	#include <winsock2.h>
1776#endif
1777#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1778	#include <sys/socket.h>
1779#endif
1780],
1781sendmsg(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_SENDMSG,1,Some systems have sendmsg) AC_MSG_RESULT(yes),AC_MSG_RESULT(no); HAS_SENDMSG="no")
1782
1783if ( test "$HAS_SENDMSG" = "no" )
1784then
1785	AC_MSG_CHECKING(for undefined sendmsg)
1786	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1787	#include <sys/types.h>
1788#endif
1789#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1790	#include <winsock2.h>
1791#endif
1792#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1793	#include <sys/socket.h>
1794#endif
1795extern "C" ssize_t sendmsg(int, const struct msghdr *,int);],
1796sendmsg(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_UNDEFINED_SENDMSG,1,Some systems have sendmsg but dont define it) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1797fi
1798
1799HAS_RECVMSG=""
1800AC_MSG_CHECKING(for recvmsg)
1801AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1802	#include <sys/types.h>
1803#endif
1804#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1805	#include <winsock2.h>
1806#endif
1807#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1808	#include <sys/socket.h>
1809#endif
1810],
1811recvmsg(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_RECVMSG,1,Some systems have recvmsg) AC_MSG_RESULT(yes),AC_MSG_RESULT(no); HAS_RECVMSG="no")
1812
1813if ( test "$HAS_RECVMSG" = "no" )
1814then
1815	AC_MSG_CHECKING(for undefined recvmsg)
1816	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1817	#include <sys/types.h>
1818#endif
1819#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1820	#include <winsock2.h>
1821#endif
1822#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1823	#include <sys/socket.h>
1824#endif
1825extern "C" ssize_t recvmsg(int, struct msghdr *,int);],
1826recvmsg(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_UNDEFINED_RECVMSG,1,Some systems have recvmsg but dont define it) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1827fi
1828
1829HAS_GETPEERNAME=""
1830AC_MSG_CHECKING(for getpeername)
1831AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1832	#include <sys/types.h>
1833#endif
1834#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1835	#include <winsock2.h>
1836#endif
1837#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1838	#include <sys/socket.h>
1839#endif
1840],
1841getpeername(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_GETPEERNAME,1,Some systems have getpeername) AC_MSG_RESULT(yes),AC_MSG_RESULT(no); HAS_GETPEERNAME="no")
1842
1843if ( test "$HAS_GETPEERNAME" = "no" )
1844then
1845	AC_MSG_CHECKING(for undefined getpeername)
1846	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1847	#include <sys/types.h>
1848#endif
1849#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1850	#include <winsock2.h>
1851#endif
1852#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1853	#include <sys/socket.h>
1854#endif
1855extern "C" int getpeername(int, struct sockaddr *,socklen_t *);],
1856getpeername(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_UNDEFINED_GETPEERNAME,1,Some systems have getpeername but dont define it) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1857fi
1858
1859HAS_GETSOCKOPT=""
1860AC_MSG_CHECKING(for getsockopt)
1861AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1862	#include <sys/types.h>
1863#endif
1864#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1865	#include <winsock2.h>
1866#endif
1867#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1868	#include <sys/socket.h>
1869#endif
1870],
1871getsockopt(0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_GETSOCKOPT,1,Some systems have getsockopt) AC_MSG_RESULT(yes),AC_MSG_RESULT(no); HAS_GETSOCKOPT="no")
1872
1873if ( test "$HAS_GETSOCKOPT" = "no" )
1874then
1875	AC_MSG_CHECKING(for undefined getsockopt)
1876	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1877	#include <sys/types.h>
1878#endif
1879#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1880	#include <winsock2.h>
1881#endif
1882#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1883	#include <sys/socket.h>
1884#endif
1885extern "C" int getsockopt(int, int, int, void *, socklen_t *);],
1886getsockopt(0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_UNDEFINED_GETSOCKOPT,1,Some systems have getsockopt but dont define it) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1887fi
1888
1889HAS_SETSOCKOPT=""
1890AC_MSG_CHECKING(for setsockopt)
1891AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1892	#include <sys/types.h>
1893#endif
1894#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1895	#include <winsock2.h>
1896#endif
1897#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1898	#include <sys/socket.h>
1899#endif
1900],
1901setsockopt(0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_SETSOCKOPT,1,Some systems have setsockopt) AC_MSG_RESULT(yes),AC_MSG_RESULT(no); HAS_SETSOCKOPT="no")
1902
1903if ( test "$HAS_SETSOCKOPT" = "no" )
1904then
1905	AC_MSG_CHECKING(for undefined setsockopt)
1906	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1907	#include <sys/types.h>
1908#endif
1909#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1910	#include <winsock2.h>
1911#endif
1912#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1913	#include <sys/socket.h>
1914#endif
1915extern "C" int setsockopt(int, int, int, const void *, socklen_t);],
1916setsockopt(0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_UNDEFINED_SETSOCKOPT,1,Some systems have setsockopt but dont define it) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1917fi
1918
1919HAS_SOCKET=""
1920AC_MSG_CHECKING(for socket)
1921AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1922	#include <sys/types.h>
1923#endif
1924#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1925	#include <winsock2.h>
1926#endif
1927#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1928	#include <sys/socket.h>
1929#endif
1930],
1931socket(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_SOCKET,1,Some systems have socket) AC_MSG_RESULT(yes),AC_MSG_RESULT(no); HAS_SOCKET="no")
1932
1933if ( test "$HAS_SOCKET" = "no" )
1934then
1935	AC_MSG_CHECKING(for undefined socket)
1936	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
1937	#include <sys/types.h>
1938#endif
1939#ifdef RUDIMENTS_HAVE_WINSOCK2_H
1940	#include <winsock2.h>
1941#endif
1942#ifdef RUDIMENTS_HAVE_SYS_SOCKET_H
1943	#include <sys/socket.h>
1944#endif
1945extern "C" int socket(int, int, int);],
1946socket(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_UNDEFINED_SOCKET,1,Some systems have socket but dont define it) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
1947fi
1948
1949echo "******************************"
1950
1951
1952dnl Checks for nss functions.
1953echo
1954echo "***** Name Service Switch ****"
1955
1956FW_CHECK_PWD
1957FW_CHECK_SHADOW
1958FW_CHECK_GRP
1959FW_CHECK_HOST
1960FW_CHECK_PROTO
1961FW_CHECK_SVC
1962
1963echo "******************************"
1964
1965
1966dnl Checks for random number generators
1967echo
1968echo "** Random Number Generators **"
1969
1970AC_MSG_CHECKING(for arc4random)
1971AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1972	#include <stdlib.h>
1973#endif],
1974arc4random();,AC_DEFINE(RUDIMENTS_HAVE_ARC4RANDOM,1,Some systems have arc4random) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1975
1976AC_MSG_CHECKING(for random_r)
1977AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1978	#include <stdlib.h>
1979#endif],
1980random_r(0,0);,AC_DEFINE(RUDIMENTS_HAVE_RANDOM_R,1,Some systems have random_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1981
1982AC_MSG_CHECKING(for rand_r)
1983AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1984	#include <stdlib.h>
1985#endif],
1986rand_r(0);,AC_DEFINE(RUDIMENTS_HAVE_RAND_R,1,Some systems have rand_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1987
1988AC_MSG_CHECKING(for lrand48_r)
1989AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1990	#include <stdlib.h>
1991#endif],
1992lrand48_r(0,0);,AC_DEFINE(RUDIMENTS_HAVE_LRAND48_R,1,Some systems have lrand48_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1993
1994AC_MSG_CHECKING(for random)
1995AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
1996	#include <stdlib.h>
1997#endif],
1998random();,AC_DEFINE(RUDIMENTS_HAVE_RANDOM,1,Some systems have random) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1999
2000AC_MSG_CHECKING(for rand)
2001AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2002	#include <stdlib.h>
2003#endif],
2004rand();,AC_DEFINE(RUDIMENTS_HAVE_RAND,1,Some systems have rand) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2005
2006AC_MSG_CHECKING(for lrand48)
2007AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2008	#include <stdlib.h>
2009#endif],
2010lrand48();,AC_DEFINE(RUDIMENTS_HAVE_LRAND48,1,Some systems have lrand48) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2011
2012AC_MSG_CHECKING(for CryptGenRandom)
2013AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2014	#include <windows.h>
2015#endif],
2016CryptGenRandom(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_CRYPTGENRANDOM,1,Some systems have CryptGenRandom) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2017
2018echo "******************************"
2019
2020
2021dnl Checks for semaphore functions
2022echo
2023echo "***** Semaphore Functions ****"
2024
2025if ( test "$INCLUDE_SEMAPHORESET" = "1" )
2026then
2027
2028	AC_MSG_CHECKING(for CreateSemaphore)
2029	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2030	#include <windows.h>
2031#endif],
2032	CreateSemaphore(NULL,0,0,"");,AC_DEFINE(RUDIMENTS_HAVE_CREATESEMAPHORE,1,Some systems have CreateSemaphore) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2033
2034	AC_MSG_CHECKING(for semget)
2035	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2036	#include <stdlib.h>
2037#endif
2038#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2039	#include <sys/types.h>
2040#endif
2041#ifdef RUDIMENTS_HAVE_SYS_IPC_H
2042	#include <sys/ipc.h>
2043#endif
2044#include <sys/sem.h>],
2045semget(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_SEMGET,1,Some systems have semget) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2046
2047	AC_MSG_CHECKING(for semtimedop)
2048	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2049	#include <stdlib.h>
2050#endif
2051#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2052	#include <sys/types.h>
2053#endif
2054#ifdef RUDIMENTS_HAVE_SYS_IPC_H
2055	#include <sys/ipc.h>
2056#endif
2057#include <sys/sem.h>],
2058semtimedop(0,NULL,0,NULL);,AC_DEFINE(RUDIMENTS_HAVE_SEMTIMEDOP,1,Some systems have semtimedop) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2059
2060fi
2061
2062echo "******************************"
2063
2064
2065dnl Checks for shared memory functions
2066echo
2067echo "*** Shared Memory Functions **"
2068
2069if ( test "$INCLUDE_SHAREDMEMORY" = "1" )
2070then
2071
2072	AC_MSG_CHECKING(for shmget)
2073	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2074	#include <stdlib.h>
2075#endif
2076#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2077	#include <sys/types.h>
2078#endif
2079#ifdef RUDIMENTS_HAVE_SYS_IPC_H
2080	#include <sys/ipc.h>
2081#endif
2082#include <sys/shm.h>],
2083shmget(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_SHMGET,1,Some systems have shmget) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2084
2085fi
2086
2087echo "******************************"
2088
2089
2090dnl Checks for serial port functions
2091echo
2092echo "***** Serial Port Functions **"
2093
2094if ( test "$INCLUDE_SERIALPORT" = "1" -o "$INCLUDE_SERIALPORTPROFILE" = "1" )
2095then
2096
2097	AC_MSG_CHECKING(for tcsetattr)
2098	AC_TRY_COMPILE([#include <termios.h>
2099#ifdef RUDIMENTS_HAVE_UNISTD_H
2100	#include <unistd.h>
2101#endif],
2102tcsetattr(0,0,NULL);,AC_DEFINE(RUDIMENTS_HAVE_TCSETATTR,1,Some systems have tcsetattr) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2103
2104fi
2105
2106echo "******************************"
2107
2108
2109dnl Checks for file functions
2110echo
2111echo "***** Timer Functions ********"
2112
2113FW_CHECK_NANOSLEEP
2114FW_CHECK_CLOCK_NANOSLEEP
2115
2116AC_MSG_CHECKING(for Sleep)
2117AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2118	#include <windows.h>
2119#endif],
2120Sleep(0);,AC_DEFINE(RUDIMENTS_HAVE_WINDOWS_SLEEP,1,Some systems have Sleep) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2121
2122if ( test "$INCLUDE_INTERVALTIMER" = "1" )
2123then
2124	AC_MSG_CHECKING(for setitimer)
2125	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
2126	#include <stdlib.h>
2127#endif
2128#ifdef RUDIMENTS_HAVE_SYS_TIME_H
2129	#include <sys/time.h>
2130#endif],
2131setitimer(0,NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_SETITIMER,1,Some systems have setitimer) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
2132
2133	AC_MSG_CHECKING(for struct itimerval)
2134	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
2135	#include <stdlib.h>
2136#endif
2137#ifdef RUDIMENTS_HAVE_SYS_TIME_H
2138	#include <sys/time.h>
2139#endif],
2140struct itimerval a;,AC_DEFINE(RUDIMENTS_HAVE_STRUCT_ITIMERVAL,1,Some systems have struct itimerval) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
2141
2142	AC_MSG_CHECKING(for struct timeval)
2143	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
2144	#include <stdlib.h>
2145#endif
2146#ifdef RUDIMENTS_HAVE_SYS_TIME_H
2147	#include <sys/time.h>
2148#endif],
2149struct timeval a;,AC_DEFINE(RUDIMENTS_HAVE_STRUCT_TIMEVAL,1,Some systems have struct timeval) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
2150fi
2151
2152echo "******************************"
2153
2154
2155dnl Checks for crypt functions
2156echo
2157echo "***** Crypt Functions ********"
2158
2159FW_CHECK_CRYPT_R
2160
2161echo "******************************"
2162
2163
2164dnl Checks for memory map functions
2165echo
2166echo "***** Memory Map Functions ***"
2167FW_CHECK_MMAP
2168
2169echo "******************************"
2170
2171
2172dnl Checks for error functions
2173echo
2174echo "***** Error Functions ********"
2175
2176AC_MSG_CHECKING(for strerror)
2177AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2178	#include <stdlib.h>
2179#endif
2180#ifdef RUDIMENTS_HAVE_STRINGS_H
2181	#include <strings.h>
2182#endif
2183#ifdef RUDIMENTS_HAVE_STRING_H
2184	#include <string.h>
2185#endif],
2186strerror(0);,AC_DEFINE(RUDIMENTS_HAVE_STRERROR,1,Some systems have strerror) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2187
2188AC_MSG_CHECKING(for XSI strerror_r)
2189AC_TRY_COMPILE([
2190#ifdef RUDIMENTS_HAVE_STDLIB_H
2191	#include <stdlib.h>
2192#endif
2193#undef __USE_GNU
2194#undef __REDIRECT
2195#include <stdio.h>
2196#ifdef RUDIMENTS_HAVE_STRINGS_H
2197	#include <strings.h>
2198#endif
2199#ifdef RUDIMENTS_HAVE_STRING_H
2200	#include <string.h>
2201#endif],
2202int a=strerror_r(0,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_XSI_STRERROR_R,1,Some systems have XSI strerror_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2203
2204AC_MSG_CHECKING(for GNU strerror_r)
2205AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2206	#include <stdlib.h>
2207#endif
2208#undef __REDIRECT
2209#include <stdio.h>
2210#ifdef RUDIMENTS_HAVE_STRINGS_H
2211	#include <strings.h>
2212#endif
2213#ifdef RUDIMENTS_HAVE_STRING_H
2214	#include <string.h>
2215#endif],
2216char *a=strerror_r(0,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_GNU_STRERROR_R,1,Some systems have GNU strerror_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2217
2218AC_MSG_CHECKING(for strerror_s)
2219AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2220	#include <stdlib.h>
2221#endif
2222#ifdef RUDIMENTS_HAVE_STRINGS_H
2223	#include <strings.h>
2224#endif
2225#ifdef RUDIMENTS_HAVE_STRING_H
2226	#include <string.h>
2227#endif],
2228strerror_s(NULL,0,0);,AC_DEFINE(RUDIMENTS_HAVE_STRERROR_S,1,Some systems have strerror_s) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2229
2230AC_MSG_CHECKING(for GetLastError)
2231AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2232	#include <windows.h>
2233#endif],
2234GetLastError();,AC_DEFINE(RUDIMENTS_HAVE_GETLASTERROR,1,Some systems have GetLastError) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2235
2236echo "******************************"
2237
2238
2239dnl Checks for string functions
2240echo
2241echo "***** String Functions *******"
2242
2243AC_MSG_CHECKING(for strcasecmp)
2244AC_TRY_COMPILE([
2245#ifdef RUDIMENTS_HAVE_STDLIB_H
2246	#include <stdlib.h>
2247#endif
2248#ifdef RUDIMENTS_HAVE_STRING_H
2249	#include <string.h>
2250#endif],
2251strcasecmp(NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_STRCASECMP,1,Some systems have strcasecmp) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2252
2253AC_MSG_CHECKING(for strncasecmp)
2254AC_TRY_COMPILE([
2255#ifdef RUDIMENTS_HAVE_STDLIB_H
2256	#include <stdlib.h>
2257#endif
2258#ifdef RUDIMENTS_HAVE_STRING_H
2259	#include <string.h>
2260#endif],
2261strncasecmp(NULL,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_STRNCASECMP,1,Some systems have strncasecmp) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2262
2263AC_MSG_CHECKING(for strtold)
2264AC_TRY_COMPILE([#ifndef __USE_GNU
2265	#define __USE_GNU
2266#endif
2267#ifndef __USE_ISOC9X
2268	#define __USE_ISOC9X
2269#endif
2270#ifdef RUDIMENTS_HAVE_STDLIB_H
2271	#include <stdlib.h>
2272#endif
2273#ifdef RUDIMENTS_HAVE_STRING_H
2274	#include <string.h>
2275#endif],
2276strtold(NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_STRTOLD,1,Some systems have strtold) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2277
2278AC_MSG_CHECKING(for strtoll)
2279AC_TRY_COMPILE([#ifndef __USE_GNU
2280	#define __USE_GNU
2281#endif
2282#ifndef __USE_ISOC9X
2283	#define __USE_ISOC9X
2284#endif
2285#ifdef RUDIMENTS_HAVE_STDLIB_H
2286	#include <stdlib.h>
2287#endif
2288#ifdef RUDIMENTS_HAVE_STRING_H
2289	#include <string.h>
2290#endif],
2291strtoll(NULL,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_STRTOLL,1,Some systems have strtoll) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2292
2293AC_MSG_CHECKING(for strtoull)
2294AC_TRY_COMPILE([#ifndef __USE_GNU
2295	#define __USE_GNU
2296#endif
2297#ifndef __USE_ISOC9X
2298	#define __USE_ISOC9X
2299#endif
2300#ifdef RUDIMENTS_HAVE_STDLIB_H
2301	#include <stdlib.h>
2302#endif
2303#ifdef RUDIMENTS_HAVE_STRING_H
2304	#include <string.h>
2305#endif],
2306strtoull(NULL,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_STRTOULL,1,Some systems have strtoull) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2307
2308AC_MSG_CHECKING(for strspn)
2309AC_TRY_COMPILE([#ifndef __USE_GNU
2310	#define __USE_GNU
2311#endif
2312#ifndef __USE_ISOC9X
2313	#define __USE_ISOC9X
2314#endif
2315#ifdef RUDIMENTS_HAVE_STDLIB_H
2316	#include <stdlib.h>
2317#endif
2318#ifdef RUDIMENTS_HAVE_STRING_H
2319	#include <string.h>
2320#endif],
2321strspn(NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_STRSPN,1,Some systems have strspn) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2322
2323AC_MSG_CHECKING(for strcspn)
2324AC_TRY_COMPILE([#ifndef __USE_GNU
2325	#define __USE_GNU
2326#endif
2327#ifndef __USE_ISOC9X
2328	#define __USE_ISOC9X
2329#endif
2330#ifdef RUDIMENTS_HAVE_STDLIB_H
2331	#include <stdlib.h>
2332#endif
2333#ifdef RUDIMENTS_HAVE_STRING_H
2334	#include <string.h>
2335#endif],
2336strcspn(NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_STRCSPN,1,Some systems have strcspn) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2337
2338AC_MSG_CHECKING(for strpbrk)
2339AC_TRY_COMPILE([#ifndef __USE_GNU
2340	#define __USE_GNU
2341#endif
2342#ifndef __USE_ISOC9X
2343	#define __USE_ISOC9X
2344#endif
2345#ifdef RUDIMENTS_HAVE_STDLIB_H
2346	#include <stdlib.h>
2347#endif
2348#ifdef RUDIMENTS_HAVE_STRING_H
2349	#include <string.h>
2350#endif],
2351char *a=NULL; strpbrk(a,NULL);,AC_DEFINE(RUDIMENTS_HAVE_STRPBRK,1,Some systems have strpbrk) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2352
2353AC_MSG_CHECKING(for strchrnul)
2354AC_TRY_COMPILE([#ifndef __USE_GNU
2355	#define __USE_GNU
2356#endif
2357#ifndef __USE_ISOC9X
2358	#define __USE_ISOC9X
2359#endif
2360#ifdef RUDIMENTS_HAVE_STDLIB_H
2361	#include <stdlib.h>
2362#endif
2363#ifdef RUDIMENTS_HAVE_STRING_H
2364	#include <string.h>
2365#endif],
2366char *a=NULL; strchrnul(a,0);,AC_DEFINE(RUDIMENTS_HAVE_STRCHRNUL,1,Some systems have strchrnul) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2367
2368SWAB_DEFINED=""
2369AC_MSG_CHECKING(whether swab is defined)
2370AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2371	#include <stdlib.h>
2372#endif
2373#ifdef RUDIMENTS_HAVE_UNISTD_H
2374	#include <unistd.h>
2375#endif
2376#ifdef RUDIMENTS_HAVE_STRING_H
2377	#include <string.h>
2378#endif],
2379[swab(NULL,NULL,0);],[SWAB_DEFINED="yes"; AC_MSG_RESULT(yes)],[AC_DEFINE(RUDIMENTS_MUST_DEFINE_SWAB,1,Some systems have swab but dont define it) AC_MSG_RESULT(no)])
2380
2381if ( test -n "$SWAB_DEFINED" )
2382then
2383	AC_MSG_CHECKING(swab const char * argument)
2384	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2385	#include <stdlib.h>
2386#endif
2387#ifdef RUDIMENTS_HAVE_UNISTD_H
2388	#include <unistd.h>
2389#endif
2390#ifdef RUDIMENTS_HAVE_STRING_H
2391	#include <string.h>
2392#endif],
2393const char *from; char *to; swab(from,to,0);, AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_SWAB_CONST_CHAR,1,Some systems have swab with a const char * argument), AC_MSG_RESULT(no))
2394
2395	AC_MSG_CHECKING(swab char * argument)
2396	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2397	#include <stdlib.h>
2398#endif
2399#ifdef RUDIMENTS_HAVE_UNISTD_H
2400	#include <unistd.h>
2401#endif
2402#ifdef RUDIMENTS_HAVE_STRING_H
2403	#include <string.h>
2404#endif],
2405char *from; char *to; swab(from,to,0);, AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_SWAB_CHAR,1,Some systems have swab with a char * argument), AC_MSG_RESULT(no))
2406
2407	AC_MSG_CHECKING(swab const void * argument)
2408	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2409	#include <stdlib.h>
2410#endif
2411#ifdef RUDIMENTS_HAVE_UNISTD_H
2412	#include <unistd.h>
2413#endif
2414#ifdef RUDIMENTS_HAVE_STRING_H
2415	#include <string.h>
2416#endif],
2417const void *from; void *to; swab(from,to,0);, AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_SWAB_CONST_VOID,1,Some systems have swab with a const void * argument), AC_MSG_RESULT(no))
2418
2419	AC_MSG_CHECKING(_swab)
2420	AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2421	#include <stdlib.h>
2422#endif
2423#ifdef RUDIMENTS_HAVE_UNISTD_H
2424	#include <unistd.h>
2425#endif
2426#ifdef RUDIMENTS_HAVE_STRING_H
2427	#include <string.h>
2428#endif],
2429_swab(NULL,NULL,0);, AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE__SWAB,1,Some systems have _swab), AC_MSG_RESULT(no))
2430fi
2431
2432AC_MSG_CHECKING(for vsnprintf)
2433AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDARG_H
2434	#include <stdarg.h>
2435#endif
2436#include <stdio.h>],
2437va_list a; vsnprintf(0,0,0,a);,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_VSNPRINTF,1,Most systems have vsnprintf), AC_MSG_RESULT(no))
2438
2439AC_MSG_CHECKING(for vsnprintf_s)
2440AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDARG_H
2441	#include <stdarg.h>
2442#endif
2443#include <stdio.h>],
2444va_list a; vsnprintf_s(0,0,0,0,a);,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_VSNPRINTF_S,1,Some systems have vsnprintf_s), AC_MSG_RESULT(no))
2445
2446HAVE___VSNPRINTF=""
2447AC_MSG_CHECKING(for __vsnprintf)
2448AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDARG_H
2449	#include <stdarg.h>
2450#endif
2451#include <stdio.h>],
2452va_list a; __vsnprintf(0,0,0,a);,[HAVE___VSNPRINTF="yes"; AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE___VSNPRINTF,1,Some systems have __vsnprintf)], AC_MSG_RESULT(no))
2453
2454if ( test -z "$HAVE___VSNPRINTF" )
2455then
2456AC_MSG_CHECKING(for undefined __vsnprintf)
2457AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDARG_H
2458	#include <stdarg.h>
2459#endif
2460#include <stdio.h>
2461extern "C" int __vsnprintf(char *, size_t, const char *, va_list);],
2462va_list a; __vsnprintf(0,0,0,a);,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_UNDEFINED___VSNPRINTF,1,Some systems have __vsnprintf but its not defined), AC_MSG_RESULT(no))
2463fi
2464
2465AC_MSG_CHECKING(for _vsnprintf)
2466AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDARG_H
2467	#include <stdarg.h>
2468#endif
2469#include <stdio.h>],
2470va_list a; _vsnprintf(0,0,0,a);,[AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE__VSNPRINTF,1,Some systems have _vsnprintf)], AC_MSG_RESULT(no))
2471
2472AC_MSG_CHECKING(for vdprintf)
2473AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDARG_H
2474	#include <stdarg.h>
2475#endif
2476#include <stdio.h>],
2477va_list a; vdprintf(0,0,a);,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_VDPRINTF,1,Some systems have vdprintf), AC_MSG_RESULT(no))
2478
2479AC_MSG_CHECKING(for vasprintf)
2480AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDARG_H
2481	#include <stdarg.h>
2482#endif
2483#include <stdio.h>],
2484va_list a; vasprintf(0,0,a);,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_VASPRINTF,1,Some systems have vasprintf), AC_MSG_RESULT(no))
2485
2486AC_MSG_CHECKING(for va_copy)
2487AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDARG_H
2488	#include <stdarg.h>
2489#endif
2490#include <stdio.h>],
2491va_list a; va_list b; va_copy(a,b);,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_VA_COPY,1,Some systems have va_copy), AC_MSG_RESULT(no))
2492
2493AC_MSG_CHECKING(for llabs)
2494AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
2495	#include <stdlib.h>
2496#endif],
2497long long a; llabs(a);,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_LLABS,1,Some systems have llabs), AC_MSG_RESULT(no))
2498
2499echo "******************************"
2500
2501
2502dnl Checks for file functions
2503echo
2504echo "***** File Functions *********"
2505
2506FW_CHECK_LIBCURL
2507
2508AC_MSG_CHECKING(for open)
2509AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2510	#include <stdlib.h>
2511#endif
2512#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2513	#include <sys/types.h>
2514#endif
2515#ifdef RUDIMENTS_HAVE_SYS_STAT_H
2516	#include <sys/stat.h>
2517#endif
2518#ifdef RUDIMENTS_HAVE_FCNTL_H
2519	#include <fcntl.h>
2520#endif
2521#ifdef RUDIMENTS_HAVE_IO_H
2522	#include <io.h>
2523#endif],
2524open(NULL,0,0);,AC_DEFINE(RUDIMENTS_HAVE_OPEN,1,Some systems have open) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2525
2526AC_MSG_CHECKING(for _open)
2527AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2528	#include <stdlib.h>
2529#endif
2530#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2531	#include <sys/types.h>
2532#endif
2533#ifdef RUDIMENTS_HAVE_SYS_STAT_H
2534	#include <sys/stat.h>
2535#endif
2536#ifdef RUDIMENTS_HAVE_FCNTL_H
2537	#include <fcntl.h>
2538#endif
2539#ifdef RUDIMENTS_HAVE_IO_H
2540	#include <io.h>
2541#endif],
2542_open(NULL,0,0);,AC_DEFINE(RUDIMENTS_HAVE__OPEN,1,Some systems have _open) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2543
2544AC_MSG_CHECKING(for CreateFile)
2545AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2546	#include <windows.h>
2547#endif],
2548CreateFile("",0,0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_CREATEFILE,1,Some systems have CreateFile) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2549
2550AC_MSG_CHECKING(for GetFileType)
2551AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2552	#include <windows.h>
2553#endif
2554#ifdef RUDIMENTS_HAVE_ACLAPI_H
2555	#include <aclapi.h>
2556#endif
2557],
2558GetFileType(0);,AC_DEFINE(RUDIMENTS_HAVE_GETFILETYPE,1,Some systems have GetFileType) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2559
2560AC_MSG_CHECKING(for GetSecurityInfo)
2561AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2562	#include <windows.h>
2563#endif
2564#ifdef RUDIMENTS_HAVE_ACLAPI_H
2565	#include <aclapi.h>
2566#endif
2567],
2568GetSecurityInfo(0,SE_FILE_OBJECT,0,0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_GETSECURITYINFO,1,Some systems have GetSecurityInfo) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2569
2570AC_MSG_CHECKING(for GetFileInformationByHandle)
2571AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2572	#include <windows.h>
2573#endif
2574],
2575GetFileInformationByHandle(0,0);,AC_DEFINE(RUDIMENTS_HAVE_GETFILEINFORMATIONBYHANDLE,1,Some systems have GetFileInformationByHandle) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2576
2577AC_MSG_CHECKING(for close)
2578AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2579	#include <unistd.h>
2580#endif
2581#ifdef RUDIMENTS_HAVE_IO_H
2582	#include <io.h>
2583#endif],
2584close(0);,AC_DEFINE(RUDIMENTS_HAVE_CLOSE,1,Some systems have close) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2585
2586AC_MSG_CHECKING(for _close)
2587AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2588	#include <unistd.h>
2589#endif
2590#ifdef RUDIMENTS_HAVE_IO_H
2591	#include <io.h>
2592#endif],
2593_close(0);,AC_DEFINE(RUDIMENTS_HAVE__CLOSE,1,Some systems have _close) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2594
2595AC_MSG_CHECKING(for read)
2596AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2597	#include <stdlib.h>
2598#endif
2599#ifdef RUDIMENTS_HAVE_UNISTD_H
2600	#include <unistd.h>
2601#endif
2602#ifdef RUDIMENTS_HAVE_IO_H
2603	#include <io.h>
2604#endif],
2605read(0,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_READ,1,Some systems have read) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2606
2607AC_MSG_CHECKING(for _read)
2608AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2609	#include <stdlib.h>
2610#endif
2611#ifdef RUDIMENTS_HAVE_UNISTD_H
2612	#include <unistd.h>
2613#endif
2614#ifdef RUDIMENTS_HAVE_IO_H
2615	#include <io.h>
2616#endif],
2617_read(0,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE__READ,1,Some systems have _read) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2618
2619AC_MSG_CHECKING(for write)
2620AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2621	#include <stdlib.h>
2622#endif
2623#ifdef RUDIMENTS_HAVE_UNISTD_H
2624	#include <unistd.h>
2625#endif
2626#ifdef RUDIMENTS_HAVE_IO_H
2627	#include <io.h>
2628#endif],
2629write(0,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_WRITE,1,Some systems have write) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2630
2631AC_MSG_CHECKING(for _write)
2632AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2633	#include <stdlib.h>
2634#endif
2635#ifdef RUDIMENTS_HAVE_UNISTD_H
2636	#include <unistd.h>
2637#endif
2638#ifdef RUDIMENTS_HAVE_IO_H
2639	#include <io.h>
2640#endif],
2641_write(0,NULL,0);,AC_DEFINE(RUDIMENTS_HAVE__WRITE,1,Some systems have _write) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2642
2643AC_MSG_CHECKING(for unlink)
2644AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2645	#include <unistd.h>
2646#endif
2647#ifdef RUDIMENTS_HAVE_IO_H
2648	#include <io.h>
2649#endif],
2650unlink(0);,AC_DEFINE(RUDIMENTS_HAVE_UNLINK,1,Some systems have unlink) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2651
2652AC_MSG_CHECKING(for _unlink)
2653AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2654	#include <unistd.h>
2655#endif
2656#ifdef RUDIMENTS_HAVE_IO_H
2657	#include <io.h>
2658#endif],
2659_unlink(0);,AC_DEFINE(RUDIMENTS_HAVE__UNLINK,1,Some systems have _unlink) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2660
2661AC_MSG_CHECKING(for lseek)
2662AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2663	#include <sys/types.h>
2664#endif
2665#ifdef RUDIMENTS_HAVE_UNISTD_H
2666	#include <unistd.h>
2667#endif
2668#ifdef RUDIMENTS_HAVE_IO_H
2669	#include <io.h>
2670#endif],
2671lseek(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_LSEEK,1,Some systems have lseek) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2672
2673AC_MSG_CHECKING(for _lseek)
2674AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2675	#include <sys/types.h>
2676#endif
2677#ifdef RUDIMENTS_HAVE_UNISTD_H
2678	#include <unistd.h>
2679#endif
2680#ifdef RUDIMENTS_HAVE_IO_H
2681	#include <io.h>
2682#endif],
2683_lseek(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE__LSEEK,1,Some systems have _lseek) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2684
2685AC_MSG_CHECKING(for dup)
2686AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2687	#include <unistd.h>
2688#endif
2689#ifdef RUDIMENTS_HAVE_IO_H
2690	#include <io.h>
2691#endif],
2692dup(0);,AC_DEFINE(RUDIMENTS_HAVE_DUP,1,Some systems have dup) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2693
2694AC_MSG_CHECKING(for _dup)
2695AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2696	#include <unistd.h>
2697#endif
2698#ifdef RUDIMENTS_HAVE_IO_H
2699	#include <io.h>
2700#endif],
2701_dup(0);,AC_DEFINE(RUDIMENTS_HAVE__DUP,1,Some systems have _dup) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2702
2703AC_MSG_CHECKING(for dup2)
2704AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2705	#include <unistd.h>
2706#endif
2707#ifdef RUDIMENTS_HAVE_IO_H
2708	#include <io.h>
2709#endif],
2710dup2(0,0);,AC_DEFINE(RUDIMENTS_HAVE_DUP2,1,Some systems have dup2) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2711
2712AC_MSG_CHECKING(for _dup2)
2713AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2714	#include <unistd.h>
2715#endif
2716#ifdef RUDIMENTS_HAVE_IO_H
2717	#include <io.h>
2718#endif],
2719_dup2(0,0);,AC_DEFINE(RUDIMENTS_HAVE__DUP2,1,Some systems have _dup2) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2720
2721AC_MSG_CHECKING(for fdatasync)
2722AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
2723	#include <stdlib.h>
2724#endif
2725#ifdef RUDIMENTS_HAVE_UNISTD_H
2726	#include <unistd.h>
2727#endif],
2728fdatasync(0);,AC_DEFINE(RUDIMENTS_HAVE_FDATASYNC,1,Some systems have fdatasync) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2729
2730AC_MSG_CHECKING(for posix_fadvise)
2731AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_FCNTL_H
2732	#include <fcntl.h>
2733#endif],
2734posix_fadvise(0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_POSIX_FADVISE,1,Some systems have posix_fadvise) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2735
2736AC_MSG_CHECKING(for posix_fallocate)
2737AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_FCNTL_H
2738	#include <fcntl.h>
2739#endif],
2740posix_fallocate(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_POSIX_FALLOCATE,1,Some systems have posix_fallocate) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2741
2742AC_MSG_CHECKING(for pselect)
2743AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TIME_H
2744	#include <sys/time.h>
2745#endif
2746#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2747	#include <sys/types.h>
2748#endif
2749#ifdef RUDIMENTS_HAVE_UNISTD_H
2750	#include <unistd.h>
2751#endif
2752#ifdef RUDIMENTS_HAVE_SYS_SELECT_H
2753	#include <sys/select.h>
2754#endif
2755#ifdef RUDIMENTS_HAVE_STDLIB_H
2756	#include <stdlib.h>
2757#endif],
2758pselect(0,NULL,NULL,NULL,NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_PSELECT,1,Some systems have pselect) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2759
2760AC_MSG_CHECKING([for poll])
2761AC_TRY_COMPILE([
2762#if defined(RUDIMENTS_HAVE_POLL_H)
2763	#include <poll.h>
2764#elif defined(RUDIMENTS_HAVE_SYS_POLL_H)
2765	#include <sys/poll.h>
2766#endif
2767],[
2768struct pollfd fds[1];
2769fds[0].fd = 0;
2770fds[0].events = POLLIN | POLLOUT | POLLERR | POLLHUP | POLLNVAL;
2771
2772poll(fds, 1, 1000);
2773],
2774AC_DEFINE(RUDIMENTS_HAVE_POLL,1,Some systems have poll) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2775
2776AC_MSG_CHECKING([for epoll])
2777AC_TRY_COMPILE([
2778#if defined(RUDIMENTS_HAVE_SYS_EPOLL_H)
2779	#include <sys/epoll.h>
2780#endif
2781],[
2782epoll_create1(0);
2783epoll_ctl(0,0,0,0);
2784epoll_wait(0,0,0,-1);
2785],
2786AC_DEFINE(RUDIMENTS_HAVE_EPOLL,1,Some systems have epoll) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2787
2788AC_MSG_CHECKING([for kqueue])
2789AC_TRY_LINK([
2790#if defined(RUDIMENTS_HAVE_SYS_TYPES_H)
2791	#include <sys/types.h>
2792#endif
2793#if defined(RUDIMENTS_HAVE_SYS_EVENT_H)
2794	#include <sys/event.h>
2795#endif
2796#if defined(RUDIMENTS_HAVE_SYS_TIME_H)
2797	#include <sys/time.h>
2798#endif
2799],[
2800kqueue();
2801kevent(0,0,0,0,0,0);
2802],
2803AC_DEFINE(RUDIMENTS_HAVE_KQUEUE,1,Some systems have kqueue) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2804
2805AC_MSG_CHECKING([for void * kqueue user data])
2806AC_TRY_COMPILE([
2807#if defined(RUDIMENTS_HAVE_SYS_TYPES_H)
2808	#include <sys/types.h>
2809#endif
2810#if defined(RUDIMENTS_HAVE_SYS_EVENT_H)
2811	#include <sys/event.h>
2812#endif
2813#if defined(RUDIMENTS_HAVE_SYS_TIME_H)
2814	#include <sys/time.h>
2815#endif
2816],[
2817struct kevent kev; int a; EV_SET(&kev,0,0,0,0,0,(void *)&a);
2818],
2819AC_DEFINE(RUDIMENTS_HAVE_KQUEUE_VOID_UDATA,1,Some systems have void * kqueue user data) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2820
2821AC_MSG_CHECKING([for port_create])
2822AC_TRY_COMPILE([
2823#if defined(RUDIMENTS_HAVE_PORT_H)
2824	#include <port.h>
2825#endif
2826],[
2827port_create();
2828port_associate(0,0,0,0,0);
2829port_getn(0,0,0,0,0);
2830],
2831AC_DEFINE(RUDIMENTS_HAVE_PORT_CREATE,1,Some systems have port_create) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2832
2833AC_MSG_CHECKING([for CreateIoCompletionPort])
2834AC_TRY_COMPILE([
2835#if defined(RUDIMENTS_HAVE_WINDOWS_H)
2836	#include <windows.h>
2837#endif
2838],[
2839CreateIoCompletionPort(0,0,0,0);
2840],
2841AC_DEFINE(RUDIMENTS_HAVE_CREATE_IO_COMPLETION_PORT,1,Some systems have CreateIoCompletionPort) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2842
2843AC_MSG_CHECKING(for ioctlsocket)
2844AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINSOCK2_H
2845	#include <winsock2.h>
2846#endif],
2847ioctlsocket(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_IOCTLSOCKET,1,Some systems have ioctlsocket) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2848
2849AC_MSG_CHECKING(for ioctl)
2850AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
2851	#include <stdlib.h>
2852#endif
2853#ifdef RUDIMENTS_HAVE_SYS_IOCTL_H
2854	#include <sys/ioctl.h>
2855#endif
2856#ifdef RUDIMENTS_HAVE_UNISTD_H
2857	#include <unistd.h>
2858#endif],
2859ioctl(0,0);,AC_DEFINE(RUDIMENTS_HAVE_IOCTL,1,Some systems have ioctl) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2860
2861AC_MSG_CHECKING(for fcntl)
2862AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2863	#include <windows.h>
2864#endif
2865#ifdef RUDIMENTS_HAVE_UNISTD_H
2866	#include <unistd.h>
2867#endif
2868#ifdef RUDIMENTS_HAVE_FCNTL_H
2869	#include <fcntl.h>
2870#endif],
2871fcntl(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_FCNTL,1,Some systems have fcntl) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2872
2873AC_MSG_CHECKING(for LockFileEx)
2874AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2875	#include <windows.h>
2876#endif],
2877	LockFileEx(0,0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_LOCKFILEEX,1,Some systems have LockFileEx) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2878
2879AC_MSG_CHECKING(for FD_CLOEXEC)
2880AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2881	#include <unistd.h>
2882#endif
2883#ifdef RUDIMENTS_HAVE_FCNTL_H
2884	#include <fcntl.h>
2885#endif],
2886long a=FD_CLOEXEC;,AC_DEFINE(RUDIMENTS_HAVE_FD_CLOEXEC,1,Some systems have FD_CLOEXEC) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2887
2888AC_MSG_CHECKING(for HANDLE_FLAG_INHERIT)
2889AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2890	#include <windows.h>
2891#endif],
2892DWORD a=HANDLE_FLAG_INHERIT;,AC_DEFINE(RUDIMENTS_HAVE_HANDLE_FLAG_INHERIT,1,Some systems have HANDLE_FLAG_INHERIT) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2893
2894AC_MSG_CHECKING(for truncate)
2895AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2896	#include <unistd.h>
2897#endif
2898#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2899	#include <sys/types.h>
2900#endif],
2901truncate("",0);,AC_DEFINE(RUDIMENTS_HAVE_TRUNCATE,1,Some systems have truncate) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2902
2903HAS_FTRUNCATE=""
2904AC_MSG_CHECKING(for ftruncate)
2905AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2906	#include <unistd.h>
2907#endif
2908#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2909	#include <sys/types.h>
2910#endif],
2911ftruncate(0,0);,AC_DEFINE(RUDIMENTS_HAVE_FTRUNCATE,1,Some systems have ftruncate) AC_MSG_RESULT(yes), AC_MSG_RESULT(no); HAS_FTRUNCATE="no")
2912
2913if ( test "$HAS_FTRUNCATE" = "no" )
2914then
2915	AC_MSG_CHECKING(for undefined ftruncate)
2916	AC_TRY_LINK([extern "C" int ftruncate(int,int);],
2917ftruncate(0,0);,AC_DEFINE(RUDIMENTS_HAVE_UNDEFINED_FTRUNCATE,1,Some systems have ftruncate but dont define it) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2918fi
2919
2920AC_MSG_CHECKING(for _chsize_s)
2921AC_TRY_COMPILE([
2922#ifdef RUDIMENTS_HAVE_IO_H
2923	#include <io.h>
2924#endif],
2925_chsize_s(0,0);,AC_DEFINE(RUDIMENTS_HAVE__CHSIZE_S,1,Some systems have _chsize_s) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2926
2927AC_MSG_CHECKING(for _chsize_s)
2928AC_TRY_COMPILE([
2929#ifdef RUDIMENTS_HAVE_WINDOWS_H
2930	#include <windows.h>
2931#endif],
2932SetEndOfFile(0);,AC_DEFINE(RUDIMENTS_HAVE_SETENDOFFILE,1,Some systems have SetEndOfFile) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2933
2934AC_MSG_CHECKING(for link)
2935AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2936	#include <unistd.h>
2937#endif],
2938link("","");,AC_DEFINE(RUDIMENTS_HAVE_LINK,1,Some systems have link) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2939
2940AC_MSG_CHECKING(for symlink)
2941AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2942	#include <unistd.h>
2943#endif],
2944symlink("","");,AC_DEFINE(RUDIMENTS_HAVE_SYMLINK,1,Some systems have symlink) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2945
2946AC_MSG_CHECKING(for readlink)
2947AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2948	#include <unistd.h>
2949#endif
2950#ifdef RUDIMENTS_HAVE_STDLIB_H
2951	#include <stdlib.h>
2952#endif],
2953readlink("",NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_READLINK,1,Some systems have readlink) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2954
2955AC_MSG_CHECKING(for fchown)
2956AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2957	#include <unistd.h>
2958#endif],
2959fchown(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_FCHOWN,1,Some systems have fchown) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2960
2961AC_MSG_CHECKING(for chmod)
2962AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_STAT_H
2963	#include <sys/stat.h>
2964#endif
2965#ifdef RUDIMENTS_HAVE_UNISTD_H
2966	#include <unistd.h>
2967#endif],
2968chmod("",0);,AC_DEFINE(RUDIMENTS_HAVE_CHMOD,1,Some systems have chmod) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2969
2970AC_MSG_CHECKING(for fchmod)
2971AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_STAT_H
2972	#include <sys/stat.h>
2973#endif
2974#ifdef RUDIMENTS_HAVE_UNISTD_H
2975	#include <unistd.h>
2976#endif],
2977fchmod(0,0);,AC_DEFINE(RUDIMENTS_HAVE_FCHMOD,1,Some systems have fchmod) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2978
2979AC_MSG_CHECKING(for SetSecurityInfo)
2980AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
2981	#include <windows.h>
2982#endif
2983#ifdef RUDIMENTS_HAVE_ACLAPI_H
2984	#include <aclapi.h>
2985#endif],
2986SetSecurityInfo(0,SE_FILE_OBJECT,0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_SETSECURITYINFO,1,Some systems have SetSecurityInfo) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2987
2988AC_MSG_CHECKING(for mkfifo)
2989AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
2990	#include <sys/types.h>
2991#endif
2992#ifdef RUDIMENTS_HAVE_SYS_STAT_H
2993	#include <sys/stat.h>
2994#endif],
2995mkfifo("",0);,AC_DEFINE(RUDIMENTS_HAVE_MKFIFO,1,Some systems have mkfifo) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
2996
2997AC_MSG_CHECKING(for pipe)
2998AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
2999	#include <unistd.h>
3000#endif],
3001pipe(0);,AC_DEFINE(RUDIMENTS_HAVE_PIPE,1,Some systems have pipe) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3002
3003AC_MSG_CHECKING(for _pipe)
3004AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_IO_H
3005	#include <io.h>
3006#endif],
3007_pipe(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE__PIPE,1,Some systems have _pipe) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3008
3009AC_MSG_CHECKING(for CreateNamedPipe)
3010AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3011	#include <windows.h>
3012#endif],
3013	CreateNamedPipe("",0,0,0,0,0,0,NULL);,AC_DEFINE(RUDIMENTS_HAVE_CREATENAMEDPIPE,1,Some systems have CreateNamedPipe) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3014
3015AC_MSG_CHECKING(for pathconf)
3016AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
3017	#include <unistd.h>
3018#endif],
3019pathconf("",0);,AC_DEFINE(RUDIMENTS_HAVE_PATHCONF,1,Some systems have pathconf) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3020
3021AC_MSG_CHECKING(for fpathconf)
3022AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
3023	#include <unistd.h>
3024#endif],
3025fpathconf(0,0);,AC_DEFINE(RUDIMENTS_HAVE_FPATHCONF,1,Some systems have fpathconf) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3026
3027dnl make sure to link this one, OSR 5.0.0 defines it in
3028dnl the headers but it's not defined in the library
3029AC_MSG_CHECKING(for mkstemp)
3030AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
3031	#include <stdlib.h>
3032#endif],
3033mkstemp(NULL);,AC_DEFINE(RUDIMENTS_HAVE_MKSTEMP,1,Some systems have mkstemp) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3034
3035HAS_FSYNC=""
3036AC_MSG_CHECKING(for fsync)
3037AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_UNISTD_H
3038	#include <unistd.h>
3039#endif],
3040fsync(0);,AC_DEFINE(RUDIMENTS_HAVE_FSYNC,1,Some systems have fsync) AC_MSG_RESULT(yes), AC_MSG_RESULT(no); HAS_FSYNC="no")
3041
3042if ( test "$HAS_FSYNC" = "no" )
3043then
3044	AC_MSG_CHECKING(for undefined fsync)
3045	AC_TRY_LINK([extern "C" int fsync(int);],
3046fsync(0);,AC_DEFINE(RUDIMENTS_HAVE_UNDEFINED_FSYNC,1,Some systems have fsync but dont define it) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3047fi
3048
3049if ( test -n "$MINGW32" )
3050then
3051	AC_MSG_CHECKING(for _commit)
3052	AC_TRY_COMPILE([#include <io.h>],
3053	_commit(0);,AC_DEFINE(RUDIMENTS_HAVE_COMMIT,1,Some systems have _commit) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3054fi
3055
3056AC_MSG_CHECKING(for utime)
3057AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TIME_H
3058	#include <sys/time.h>
3059#endif
3060#ifdef RUDIMENTS_HAVE_UTIME_H
3061	#include <utime.h>
3062#endif],
3063utime("",0);,AC_DEFINE(RUDIMENTS_HAVE_UTIME,1,Some systems have utime) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3064
3065AC_MSG_CHECKING(for utimes with const char * argument)
3066AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TIME_H
3067	#include <sys/time.h>
3068#endif
3069#ifdef RUDIMENTS_HAVE_UTIME_H
3070	#include <utime.h>
3071#endif],
3072const char *a=0; utimes(a,0);,AC_DEFINE(RUDIMENTS_HAVE_UTIMES_CONST_CHAR,1,Some systems have utimes with const char * argument) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3073
3074AC_MSG_CHECKING(for utimes with char * argument)
3075AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TIME_H
3076	#include <sys/time.h>
3077#endif
3078#ifdef RUDIMENTS_HAVE_UTIME_H
3079	#include <utime.h>
3080#endif],
3081char *a=0; utimes(a,0);,AC_DEFINE(RUDIMENTS_HAVE_UTIMES_CHAR,1,Some systems have utimes with char * argument) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3082
3083AC_MSG_CHECKING(for SetFileTime)
3084AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3085	#include <windows.h>
3086#endif],
3087	SetFileTime(0,NULL,NULL,NULL);,AC_DEFINE(RUDIMENTS_HAVE_SETFILETIME,1,Some systems have SetFileTime) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3088
3089AC_MSG_CHECKING(for mknod)
3090AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3091	#include <sys/types.h>
3092#endif
3093#ifdef RUDIMENTS_HAVE_SYS_STAT_H
3094	#include <sys/stat.h>
3095#endif
3096#ifdef RUDIMENTS_HAVE_FCNTL_H
3097	#include <fcntl.h>
3098#endif
3099#ifdef RUDIMENTS_HAVE_UNISTD_H
3100	#include <unistd.h>
3101#endif],
3102mknod("",0,0);,AC_DEFINE(RUDIMENTS_HAVE_MKNOD,1,Some systems have mknod) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3103
3104AC_MSG_CHECKING(for ftok)
3105AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
3106	#include <stdlib.h>
3107#endif
3108#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3109	#include <sys/types.h>
3110#endif
3111#ifdef RUDIMENTS_HAVE_SYS_IPC_H
3112	#include <sys/ipc.h>
3113#endif],
3114ftok(NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_FTOK,1,Most systems have ftok()) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3115
3116AC_MSG_CHECKING(if ftok takes const char * parameter)
3117AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
3118	#include <stdlib.h>
3119#endif
3120#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3121	#include <sys/types.h>
3122#endif
3123#ifdef RUDIMENTS_HAVE_SYS_IPC_H
3124	#include <sys/ipc.h>
3125#endif],
3126const char *var=NULL; ftok(var,0);,AC_DEFINE(RUDIMENTS_HAVE_CONST_CHAR_FTOK,1,Most systems have ftok(const char *, int)) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3127
3128AC_MSG_CHECKING(for access)
3129AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
3130	#include <stdlib.h>
3131#endif
3132#ifdef RUDIMENTS_HAVE_IO_H
3133	#include <io.h>
3134#endif
3135#ifdef RUDIMENTS_HAVE_UNISTD_H
3136	#include <unistd.h>
3137#endif],
3138access(NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_ACCESS,1,Most systems have access()) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3139
3140AC_MSG_CHECKING(for _access_s)
3141AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_STDLIB_H
3142	#include <stdlib.h>
3143#endif
3144#ifdef RUDIMENTS_HAVE_IO_H
3145	#include <io.h>
3146#endif],
3147_access_s(NULL,0);,AC_DEFINE(RUDIMENTS_HAVE__ACCESS_S,1,Some systems have _access_s()) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3148
3149AC_MSG_CHECKING(for DuplicateHandle)
3150AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3151	#include <windows.h>
3152#endif],
3153DuplicateHandle(0,0,0,0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_DUPLICATEHANDLE,1,Some systems have DuplicateHandle) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3154
3155AC_MSG_CHECKING(for GetAce)
3156AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3157	#include <windows.h>
3158#endif],
3159GetAce(0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_GETACE,1,Some systems have GetAce) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3160
3161AC_MSG_CHECKING(for SetEntriesInAcl)
3162AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3163	#include <windows.h>
3164#endif
3165#ifdef RUDIMENTS_HAVE_ACLAPI_H
3166	#include <aclapi.h>
3167#endif],
3168SetEntriesInAcl(0,0,0,0);,AC_DEFINE(RUDIMENTS_HAVE_SETENTRIESINACL,1,Some systems have SetEntriesInAcl) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3169
3170AC_MSG_CHECKING(for fdopen)
3171AC_TRY_LINK([#include <stdio.h>],
3172fdopen(0,"w");,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_FDOPEN,1,Some systems have fdopen), AC_MSG_RESULT(no))
3173
3174AC_MSG_CHECKING(for FILE->_fileno)
3175AC_TRY_LINK([#include <stdio.h>],
3176FILE f; f._fileno=0;,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_FILE_FILENO,1,Some systems have FILE->_fileno), AC_MSG_RESULT(no))
3177
3178AC_MSG_CHECKING(for FILE->_file)
3179AC_TRY_LINK([#include <stdio.h>],
3180FILE f; f._file=0;,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_FILE_FILE,1,Some systems have FILE->_file), AC_MSG_RESULT(no))
3181
3182AC_MSG_CHECKING(for FILE->__file)
3183AC_TRY_LINK([#include <stdio.h>],
3184FILE f; f.__file=0;,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_FILE__FILE,1,Some systems have FILE->__file), AC_MSG_RESULT(no))
3185
3186AC_MSG_CHECKING(for FILE->__filedes)
3187AC_TRY_LINK([#include <stdio.h>],
3188FILE f; f.__filedes=0;,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_FILE_FILEDES,1,Some systems have FILE->__filedes), AC_MSG_RESULT(no))
3189
3190AC_MSG_CHECKING(for FILE->_fd)
3191AC_TRY_LINK([#include <stdio.h>],
3192FILE f; f._fd=0;,AC_MSG_RESULT(yes) AC_DEFINE(RUDIMENTS_HAVE_FILE__FD,1,Some systems have FILE->_fd), AC_MSG_RESULT(no))
3193
3194echo "******************************"
3195
3196if ( test "$INCLUDE_DYNAMICLIB" = "1" )
3197then
3198
3199dnl Checks for dynamic loader functions
3200echo
3201echo "***** Dynamic Loader *********"
3202
3203DLOPEN=""
3204AC_MSG_CHECKING(for dlopen)
3205AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_DLFCN_H
3206	#include <dlfcn.h>
3207#endif],
3208dlopen("",0);,DLOPEN="yes"; AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3209
3210if ( test "$DLOPEN" = "yes" )
3211then
3212	DLLIB=""
3213	AC_MSG_CHECKING(whether we can link against -ldl)
3214	FW_TRY_LINK([#ifdef RUDIMENTS_HAVE_DLFCN_H
3215	#include <dlfcn.h>
3216#endif],[dlopen("",0);],[$CPPFLAGS],[-ldl],[],[DLLIB="-ldl"; AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
3217
3218	if ( test -z "$DLLIB" )
3219	then
3220		AC_MSG_CHECKING(whether we can link without -ldl)
3221		FW_TRY_LINK([#ifdef RUDIMENTS_HAVE_DLFCN_H
3222		#include <dlfcn.h>
3223#endif],[dlopen("",0);],[$CPPFLAGS],[],[],[AC_MSG_RESULT(yes)],[DLOPEN=""; AC_MSG_RESULT(no)])
3224	fi
3225
3226	if ( test -z "$DLOPEN" )
3227	then
3228		AC_MSG_WARN(no dlopen link configuration found - disabling dlopen)
3229	fi
3230
3231	AC_SUBST(DLLIB)
3232fi
3233
3234if ( test "$DLOPEN" = "yes" )
3235then
3236	AC_DEFINE(RUDIMENTS_HAVE_DLOPEN,1,Some systems have dlopen)
3237fi
3238
3239AC_MSG_CHECKING(for LoadLibrary)
3240AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3241	#include <windows.h>
3242#endif],
3243LoadLibrary("");,AC_DEFINE(RUDIMENTS_HAVE_LOADLIBRARY,1,Some systems have LoadLibrary) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3244
3245AC_MSG_CHECKING(for LoadLibraryEx)
3246AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3247	#include <windows.h>
3248#endif],
3249LoadLibraryEx("",NULL,0);,AC_DEFINE(RUDIMENTS_HAVE_LOADLIBRARYEX,1,Some systems have LoadLibraryEx) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3250
3251echo "******************************"
3252
3253fi
3254
3255
3256dnl Checks for byte swap functions
3257echo
3258echo "***** Byte Swap Functions ****"
3259
3260AC_MSG_CHECKING(for htonll)
3261AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3262	#include <sys/types.h>
3263#endif
3264#ifdef RUDIMENTS_HAVE_NETINET_IN_H
3265	#include <netinet/in.h>
3266#endif
3267#ifdef RUDIMENTS_HAVE_INTTYPES_H
3268	#include <inttypes.h>
3269#endif],
3270htonll(0);,AC_DEFINE(RUDIMENTS_HAVE_HTONLL,1,Some systems have htonll) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3271
3272AC_MSG_CHECKING(for ntohll)
3273AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3274	#include <sys/types.h>
3275#endif
3276#ifdef RUDIMENTS_HAVE_NETINET_IN_H
3277	#include <netinet/in.h>
3278#endif
3279#ifdef RUDIMENTS_HAVE_INTTYPES_H
3280	#include <inttypes.h>
3281#endif],
3282ntohll(0);,AC_DEFINE(RUDIMENTS_HAVE_NTOHLL,1,Some systems have ntohll) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3283
3284AC_MSG_CHECKING(for bswap_64)
3285AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
3286	#include <stdlib.h>
3287#endif
3288#ifdef RUDIMENTS_HAVE_BYTESWAP_H
3289	#include <byteswap.h>
3290#endif
3291#ifdef RUDIMENTS_HAVE_MACHINE_ENDIAN_H
3292	#include <machine/endian.h>
3293#endif],
3294bswap_64(0);,AC_DEFINE(RUDIMENTS_HAVE_BSWAP_64,1,Some systems have bswap_64) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3295
3296AC_MSG_CHECKING(for __bswap64)
3297AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
3298	#include <stdlib.h>
3299#endif
3300#ifdef RUDIMENTS_HAVE_MACHINE_ENDIAN_H
3301	#include <machine/endian.h>
3302#endif],
3303__bswap64(0);,AC_DEFINE(RUDIMENTS_HAVE___BSWAP64,1,Some systems have __bswap64) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3304
3305AC_MSG_CHECKING(for bswap64)
3306AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
3307	#include <stdlib.h>
3308#endif
3309#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3310	#include <sys/types.h>
3311#endif
3312#include <machine/bswap.h>],
3313bswap64(0);,AC_DEFINE(RUDIMENTS_HAVE_BSWAP64,1,Some systems have bswap64) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3314
3315AC_MSG_CHECKING(for swap64)
3316AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
3317	#include <stdlib.h>
3318#endif
3319#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3320	#include <sys/types.h>
3321#endif],
3322swap64(0);,AC_DEFINE(RUDIMENTS_HAVE_SWAP64,1,Some systems have swap64) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3323
3324AC_MSG_CHECKING(for OSSwapLittleToHostInt64)
3325AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
3326	#include <stdlib.h>
3327#endif
3328#include <libkern/OSByteOrder.h>],
3329OSSwapLittleToHostInt64(0);,AC_DEFINE(RUDIMENTS_HAVE_OSSWAPLITTLETOHOSTINT64,1,Some systems have OSSwapLittleToHostInt64) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3330
3331AC_MSG_CHECKING(for OSSwapHostToLittleInt64)
3332AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_STDLIB_H
3333	#include <stdlib.h>
3334#endif
3335#include <libkern/OSByteOrder.h>],
3336OSSwapHostToLittleInt64(0);,AC_DEFINE(RUDIMENTS_HAVE_OSSWAPHOSTTOLITTLEINT64,1,Some systems have OSSwapHostToLittleInt64) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3337
3338AC_MSG_CHECKING(for __swap_int64)
3339AC_TRY_LINK([#include <os/support/ByteOrder.h>],
3340__swap_int64(0);,AC_DEFINE(RUDIMENTS_HAVE_SWAP_INT64,1,Some systems have __swap_int64) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3341
3342echo "******************************"
3343
3344
3345dnl Checks for directory functions
3346echo
3347echo "***** Directory Functions ****"
3348
3349AC_MSG_CHECKING(for FindFirstFile)
3350AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3351	#include <windows.h>
3352#endif],
3353FindFirstFile("",0),AC_DEFINE(RUDIMENTS_HAVE_FINDFIRSTFILE,1,Some systems have FindFirstFile) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3354
3355AC_MSG_CHECKING(for dirfd)
3356AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3357	#include <sys/types.h>
3358#endif
3359#if defined(RUDIMENTS_HAVE_DIRENT_H)
3360	#include <dirent.h>
3361#elif defined(RUDIMENTS_HAVE_DIRECT_H)
3362	#include <direct.h>
3363#endif],
3364DIR *d; dirfd(d);,AC_DEFINE(RUDIMENTS_HAVE_DIRFD,1,Some systems have dirfd) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3365
3366AC_MSG_CHECKING(for DIR.dd_fd)
3367AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3368	#include <sys/types.h>
3369#endif
3370#if defined(RUDIMENTS_HAVE_DIRENT_H)
3371	#include <dirent.h>
3372#elif defined(RUDIMENTS_HAVE_DIRECT_H)
3373	#include <direct.h>
3374#endif],
3375DIR d; d.dd_fd=1;,AC_DEFINE(RUDIMENTS_HAVE_DIR_DD_FD,1,Some systems have DIR.dd_fd) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3376
3377AC_MSG_CHECKING(for DIR.d_fd)
3378AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3379	#include <sys/types.h>
3380#endif
3381#if defined(RUDIMENTS_HAVE_DIRENT_H)
3382	#include <dirent.h>
3383#elif defined(RUDIMENTS_HAVE_DIRECT_H)
3384	#include <direct.h>
3385#endif],
3386DIR d; d.d_fd=1;,AC_DEFINE(RUDIMENTS_HAVE_DIR_D_FD,1,Some systems have DIR.d_fd) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3387
3388AC_MSG_CHECKING(for mkdir with 2 arguments)
3389AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_STAT_H
3390	#include <sys/stat.h>
3391#endif
3392#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3393	#include <sys/types.h>
3394#endif
3395#ifdef RUDIMENTS_HAVE_IO_H
3396	#include <io.h>
3397#endif],
3398mkdir("",0),AC_DEFINE(RUDIMENTS_HAVE_MKDIR_2,1,Some systems have mkdir) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3399
3400AC_MSG_CHECKING(for mkdir with 1 argument)
3401AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_STAT_H
3402	#include <sys/stat.h>
3403#endif
3404#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3405	#include <sys/types.h>
3406#endif
3407#ifdef RUDIMENTS_HAVE_IO_H
3408	#include <io.h>
3409#endif],
3410mkdir(""),AC_DEFINE(RUDIMENTS_HAVE_MKDIR_1,1,Some systems have mkdir) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3411
3412AC_MSG_CHECKING(for CreateDirectory)
3413AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3414	#include <windows.h>
3415#endif],
3416CreateDirectory("",0),AC_DEFINE(RUDIMENTS_HAVE_CREATEDIRECTORY,1,Some systems have CreateDirectory) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3417
3418AC_MSG_CHECKING(for RemoveDirectory)
3419AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3420	#include <windows.h>
3421#endif],
3422RemoveDirectory(""),AC_DEFINE(RUDIMENTS_HAVE_REMOVEDIRECTORY,1,Some systems have RemoveDirectory) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3423
3424AC_MSG_CHECKING(for GetCurrentDirectory)
3425AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3426	#include <windows.h>
3427#endif],
3428GetCurrentDirectory(0,0),AC_DEFINE(RUDIMENTS_HAVE_GETCURRENTDIRECTORY,1,Some systems have GetCurrentDirectory) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3429
3430AC_MSG_CHECKING(for SetCurrentDirectory)
3431AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3432	#include <windows.h>
3433#endif],
3434SetCurrentDirectory(""),AC_DEFINE(RUDIMENTS_HAVE_SETCURRENTDIRECTORY,1,Some systems have SetCurrentDirectory) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3435
3436AC_MSG_CHECKING(for chroot)
3437AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_UNISTD_H
3438	#include <unistd.h>
3439#endif],
3440chroot(""),AC_DEFINE(RUDIMENTS_HAVE_CHROOT,1,Some systems have chroot) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3441
3442echo "******************************"
3443
3444
3445dnl Checks for process functions
3446echo
3447echo "***** Process Functions ******"
3448
3449AC_MSG_CHECKING(for umask)
3450AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_STAT_H
3451	#include <sys/stat.h>
3452#endif],
3453umask(0),AC_DEFINE(RUDIMENTS_HAVE_UMASK,1,Some systems have umask) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3454
3455AC_MSG_CHECKING(for getpid)
3456AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3457	#include <sys/types.h>
3458#endif
3459#ifdef RUDIMENTS_HAVE_UNISTD_H
3460	#include <unistd.h>
3461#endif],
3462getpid(),AC_DEFINE(RUDIMENTS_HAVE_GETPID,1,Some systems have getpid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3463
3464AC_MSG_CHECKING(for GetCurrentProcessId)
3465AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3466	#include <windows.h>
3467#endif
3468#ifdef RUDIMENTS_HAVE_PROCESS_H
3469	#include <process.h>
3470#endif],
3471GetCurrentProcessId(),AC_DEFINE(RUDIMENTS_HAVE_GETCURRENTPROCESSID,1,Some systems have GetCurrentProcessId) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3472
3473AC_MSG_CHECKING(for getppid)
3474AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3475	#include <sys/types.h>
3476#endif
3477#ifdef RUDIMENTS_HAVE_UNISTD_H
3478	#include <unistd.h>
3479#endif],
3480getppid(),AC_DEFINE(RUDIMENTS_HAVE_GETPPID,1,Some systems have getppid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3481
3482AC_MSG_CHECKING(for Process32First)
3483AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3484	#include <windows.h>
3485#endif
3486#include <tlhelp32.h>],
3487Process32First(0,NULL),AC_DEFINE(RUDIMENTS_HAVE_PROCESS32FIRST,1,Some systems have Process32First) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3488
3489HAVE_GETPGID=""
3490AC_MSG_CHECKING(for getpgid)
3491AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3492	#include <sys/types.h>
3493#endif
3494#ifdef RUDIMENTS_HAVE_UNISTD_H
3495	#include <unistd.h>
3496#endif],
3497getpgid(0),AC_DEFINE(RUDIMENTS_HAVE_GETPGID,1,Some systems have getpgid) AC_MSG_RESULT(yes); HAVE_GETPGID="yes",AC_MSG_RESULT(no))
3498
3499dnl some linux libc4 systems define getpgid properly in -lg but not in -lc
3500GETPGIDLIB=""
3501if ( test "$HAVE_GETPGID" = "yes" )
3502then
3503SAVECXXFLAGS="$CXXFLAGS"
3504dnl Remove the -g arguments.  If included at link time, they'll pull in -lg.
3505CXXFLAGS=`echo $CXXFLAGS | sed -e "s|-g1||" -e "s|-g2||" -e "s|-g3||" -e "s|-g||"`
3506AC_MSG_CHECKING(whether getpgid needs -lg)
3507AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3508	#include <sys/types.h>
3509#endif
3510#ifdef RUDIMENTS_HAVE_UNISTD_H
3511	#include <unistd.h>
3512#endif],
3513getpgid(0),AC_MSG_RESULT(no),AC_MSG_RESULT(yes); GETPGIDLIB="-lg")
3514CXXFLAGS="$SAVECXXFLAGS"
3515fi
3516AC_SUBST(GETPGIDLIB)
3517
3518AC_MSG_CHECKING(for setpgid)
3519AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3520	#include <sys/types.h>
3521#endif
3522#ifdef RUDIMENTS_HAVE_UNISTD_H
3523	#include <unistd.h>
3524#endif],
3525setpgid(0,0),AC_DEFINE(RUDIMENTS_HAVE_SETPGID,1,Some systems have setpgid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3526
3527AC_MSG_CHECKING(for getsid)
3528AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3529	#include <sys/types.h>
3530#endif
3531#ifdef RUDIMENTS_HAVE_UNISTD_H
3532	#include <unistd.h>
3533#endif],
3534getsid(0),AC_DEFINE(RUDIMENTS_HAVE_GETSID,1,Some systems have getsid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3535
3536AC_MSG_CHECKING(for getuid)
3537AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3538	#include <sys/types.h>
3539#endif
3540#ifdef RUDIMENTS_HAVE_UNISTD_H
3541	#include <unistd.h>
3542#endif],
3543getuid(),AC_DEFINE(RUDIMENTS_HAVE_GETUID,1,Some systems have getuid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3544
3545AC_MSG_CHECKING(for GetUserName)
3546AC_TRY_COMPILE([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3547	#include <windows.h>
3548#endif],
3549GetUserName(0,0);,AC_DEFINE(RUDIMENTS_HAVE_GETUSERNAME,1,Some systems have GetUserName) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
3550
3551AC_MSG_CHECKING(for geteuid)
3552AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3553	#include <sys/types.h>
3554#endif
3555#ifdef RUDIMENTS_HAVE_UNISTD_H
3556	#include <unistd.h>
3557#endif],
3558geteuid(),AC_DEFINE(RUDIMENTS_HAVE_GETEUID,1,Some systems have geteuid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3559
3560AC_MSG_CHECKING(for setuid)
3561AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3562	#include <sys/types.h>
3563#endif
3564#ifdef RUDIMENTS_HAVE_UNISTD_H
3565	#include <unistd.h>
3566#endif],
3567setuid(0),AC_DEFINE(RUDIMENTS_HAVE_SETUID,1,Some systems have setuid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3568
3569AC_MSG_CHECKING(for setgroups)
3570AC_TRY_LINK([
3571#ifdef RUDIMENTS_HAVE_SYS_PARAMS_H
3572	#include <sys/param.h>
3573#endif
3574#if defined(RUDIMENTS_HAVE_SYS_TYPES_H)
3575	#include <sys/types.h>
3576#endif
3577#ifdef RUDIMENTS_HAVE_GRP_H
3578	#include <grp.h>
3579#endif
3580#ifdef RUDIMENTS_HAVE_UNISTD_H
3581	#include <unistd.h>
3582#endif
3583],
3584setgroups(0,0),AC_DEFINE(RUDIMENTS_HAVE_SETGROUPS,1,Some systems have setgroups) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3585
3586SETEUID=""
3587AC_MSG_CHECKING(for seteuid)
3588AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3589	#include <sys/types.h>
3590#endif
3591#ifdef RUDIMENTS_HAVE_UNISTD_H
3592	#include <unistd.h>
3593#endif],
3594seteuid(0),AC_DEFINE(RUDIMENTS_HAVE_SETEUID,1,Some systems have seteuid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no); SETEUID="no")
3595
3596if ( test -n "$SETEUID" )
3597then
3598	AC_MSG_CHECKING(for seteuid (not defined in any header))
3599	AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3600	#include <sys/types.h>
3601#endif
3602#ifdef RUDIMENTS_HAVE_UNISTD_H
3603	#include <unistd.h>
3604#endif
3605extern "C" int seteuid(uid_t euid);
3606],
3607seteuid(0),AC_DEFINE(RUDIMENTS_HAVE_SETEUID_BUT_NOT_DEFINED,1,Some systems have seteuid but dont define it in a header file) AC_DEFINE(RUDIMENTS_HAVE_SETEUID,1,Some systems have seteuid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3608fi
3609
3610AC_MSG_CHECKING(for setreuid)
3611AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3612	#include <sys/types.h>
3613#endif
3614#ifdef RUDIMENTS_HAVE_UNISTD_H
3615	#include <unistd.h>
3616#endif],
3617setreuid(0,0),AC_DEFINE(RUDIMENTS_HAVE_SETREUID,1,Some systems have setreuid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3618
3619AC_MSG_CHECKING(for getgid)
3620AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3621	#include <sys/types.h>
3622#endif
3623#ifdef RUDIMENTS_HAVE_UNISTD_H
3624	#include <unistd.h>
3625#endif],
3626getgid(),AC_DEFINE(RUDIMENTS_HAVE_GETGID,1,Some systems have getgid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3627
3628AC_MSG_CHECKING(for getegid)
3629AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3630	#include <sys/types.h>
3631#endif
3632#ifdef RUDIMENTS_HAVE_UNISTD_H
3633	#include <unistd.h>
3634#endif],
3635getegid(),AC_DEFINE(RUDIMENTS_HAVE_GETEGID,1,Some systems have getegid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3636
3637AC_MSG_CHECKING(for setgid)
3638AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3639	#include <sys/types.h>
3640#endif
3641#ifdef RUDIMENTS_HAVE_UNISTD_H
3642	#include <unistd.h>
3643#endif],
3644setgid(0),AC_DEFINE(RUDIMENTS_HAVE_SETGID,1,Some systems have setgid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3645
3646SETEGID=""
3647AC_MSG_CHECKING(for setegid)
3648AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3649	#include <sys/types.h>
3650#endif
3651#ifdef RUDIMENTS_HAVE_UNISTD_H
3652	#include <unistd.h>
3653#endif],
3654setegid(0),AC_DEFINE(RUDIMENTS_HAVE_SETEGID,1,Some systems have setegid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no); SETEGID="no")
3655
3656if ( test -n "$SETEGID" )
3657then
3658	AC_MSG_CHECKING(for setegid (not defined in any header))
3659AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3660	#include <sys/types.h>
3661#endif
3662#ifdef RUDIMENTS_HAVE_UNISTD_H
3663	#include <unistd.h>
3664#endif
3665extern "C" int setegid(gid_t egid);
3666],
3667setegid(0),AC_DEFINE(RUDIMENTS_HAVE_SETEGID_BUT_NOT_DEFINED,1,Some systems have setegid but dont define it in a header file) AC_DEFINE(RUDIMENTS_HAVE_SETEGID,1,Some systems have setegid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3668fi
3669
3670AC_MSG_CHECKING(for setregid)
3671AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3672	#include <sys/types.h>
3673#endif
3674#ifdef RUDIMENTS_HAVE_UNISTD_H
3675	#include <unistd.h>
3676#endif],
3677setregid(0,0),AC_DEFINE(RUDIMENTS_HAVE_SETREGID,1,Some systems have setregid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3678
3679AC_MSG_CHECKING(for fork)
3680AC_TRY_LINK([
3681#ifdef RUDIMENTS_HAVE_UNISTD_H
3682	#include <unistd.h>
3683#endif],
3684fork(),AC_DEFINE(RUDIMENTS_HAVE_FORK,1,Some systems have fork) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3685
3686AC_MSG_CHECKING(for execvp)
3687AC_TRY_LINK([
3688#ifdef RUDIMENTS_HAVE_STDLIB_H
3689	#include <stdlib.h>
3690#endif
3691#ifdef RUDIMENTS_HAVE_UNISTD_H
3692	#include <unistd.h>
3693#endif],
3694execvp(NULL,NULL),AC_DEFINE(RUDIMENTS_HAVE_EXECVP,1,Some systems have execvp) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3695
3696AC_MSG_CHECKING(for CreateProcess)
3697AC_TRY_LINK([
3698#ifdef RUDIMENTS_HAVE_WINDOWS_H
3699	#include <windows.h>
3700#endif],
3701CreateProcess(0,0,0,0,0,0,0,0,0,0),AC_DEFINE(RUDIMENTS_HAVE_CREATE_PROCESS,1,Some systems have CreateProcess) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3702
3703AC_MSG_CHECKING(for FreeConsole)
3704AC_TRY_LINK([
3705#ifdef RUDIMENTS_HAVE_WINDOWS_H
3706	#include <windows.h>
3707#endif],
3708FreeConsole(),AC_DEFINE(RUDIMENTS_HAVE_FREECONSOLE,1,Some systems have FreeConsole) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3709
3710AC_MSG_CHECKING(for setsid)
3711AC_TRY_LINK([
3712#ifdef RUDIMENTS_HAVE_UNISTD_H
3713	#include <unistd.h>
3714#endif],
3715setsid(),AC_DEFINE(RUDIMENTS_HAVE_SETSID,1,Some systems have setsid) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3716
3717AC_MSG_CHECKING(for atexit)
3718AC_TRY_LINK([
3719#ifdef RUDIMENTS_HAVE_STDLIB_H
3720	#include <stdlib.h>
3721#endif],
3722atexit(0),AC_DEFINE(RUDIMENTS_HAVE_ATEXIT,1,Some systems have atexit) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3723
3724AC_MSG_CHECKING(for backtrace)
3725AC_TRY_LINK([
3726#ifdef RUDIMENTS_HAVE_EXECINFO_H
3727	#include <execinfo.h>
3728#endif],
3729backtrace(0,0),AC_DEFINE(RUDIMENTS_HAVE_BACKTRACE,1,Some systems have backtrace) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3730
3731AC_MSG_CHECKING(for CaptureStackBackTrace)
3732AC_TRY_LINK([
3733#ifdef RUDIMENTS_HAVE_DBGHELP_H
3734	#include <dbghelp.h>
3735#endif],
3736CaptureStackBackTrace(0,0,0,0),AC_DEFINE(RUDIMENTS_HAVE_CAPTURESTACKBACKTRACE,1,Some systems have CaptureStackBackTrace) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3737
3738echo "******************************"
3739
3740
3741dnl Checks for system functions
3742echo
3743echo "***** System Functions *******"
3744
3745AC_MSG_CHECKING(for getpagesize)
3746AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3747	#include <sys/types.h>
3748#endif
3749#ifdef RUDIMENTS_HAVE_UNISTD_H
3750	#include <unistd.h>
3751#endif],
3752getpagesize(),AC_DEFINE(RUDIMENTS_HAVE_GETPAGESIZE,1,Some systems have getpagesize) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3753
3754AC_MSG_CHECKING(for GetSystemInfo)
3755AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3756	#include <windows.h>
3757#endif],
3758GetSystemInfo(NULL),AC_DEFINE(RUDIMENTS_HAVE_GETSYSTEMINFO,1,Some systems have GetSystemInfo) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3759
3760AC_MSG_CHECKING(for GlobalMemoryStatusEx)
3761AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3762	#include <windows.h>
3763#endif],
3764GlobalMemoryStatusEx(NULL),AC_DEFINE(RUDIMENTS_HAVE_GLOBALMEMORYSTATUSEX,1,Some systems have GlobalMemoryStatusEx) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3765
3766AC_MSG_CHECKING(for GetLogicalProcessorInformation)
3767AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3768	#include <windows.h>
3769#endif],
3770GetLogicalProcessorInformation(0,0),AC_DEFINE(RUDIMENTS_HAVE_GETLOGICALPROCESSORINFORMATION,1,Some systems have GetLogicalProcessorInformation) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3771
3772AC_MSG_CHECKING(for uname)
3773AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_UTSNAME_H
3774	#include <sys/utsname.h>
3775#endif],
3776uname(0),AC_DEFINE(RUDIMENTS_HAVE_UNAME,1,Some systems have uname) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3777
3778AC_MSG_CHECKING(for GetVersionEx)
3779AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3780	#include <windows.h>
3781#endif],
3782GetVersionEx(0),AC_DEFINE(RUDIMENTS_HAVE_GETVERSIONEX,1,Some systems have GetVersionEx) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3783
3784AC_MSG_CHECKING(for GetNativeSystemInfo)
3785AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3786	#include <windows.h>
3787#endif],
3788GetNativeSystemInfo(0),AC_DEFINE(RUDIMENTS_HAVE_GETNATIVESYSTEMINFO,1,Some systems have GetNativeSystemInfo) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3789
3790AC_MSG_CHECKING(for getloadavg)
3791AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_LOADAVG_H
3792	#include <sys/loadavg.h>
3793#endif
3794#ifdef RUDIMENTS_HAVE_STDLIB_H
3795	#include <stdlib.h>
3796#endif],
3797getloadavg(0,0),AC_DEFINE(RUDIMENTS_HAVE_GETLOADAVG,1,Some systems have getloadavg) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3798
3799AC_MSG_CHECKING(for gethostname)
3800AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_UNISTD_H
3801	#include <unistd.h>
3802#endif
3803#ifdef RUDIMENTS_HAVE_WINSOCK2_H
3804	#include <winsock2.h>
3805#endif],
3806gethostname(0,0),AC_DEFINE(RUDIMENTS_HAVE_GETHOSTNAME,1,Some systems have gethostname) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3807
3808HAVE_SETHOSTNAME="no"
3809AC_MSG_CHECKING(for sethostname)
3810AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_UNISTD_H
3811	#include <unistd.h>
3812#endif
3813#ifdef RUDIMENTS_HAVE_WINSOCK2_H
3814	#include <winsock2.h>
3815#endif],
3816sethostname(0,0),HAVE_SETHOSTNAME="yes"; AC_DEFINE(RUDIMENTS_HAVE_SETHOSTNAME,1,Some systems have sethostname) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3817
3818if ( test "$HAVE_SETHOSTNAME" = "no" )
3819then
3820	AC_MSG_CHECKING(for missing sethostname declaration)
3821	AC_TRY_LINK([extern "C" { extern int sethostname(char *name, int namelen); }],
3822sethostname(0,0),AC_DEFINE(RUDIMENTS_HAVE_MISSING_SETHOSTNAME_DECLARATION,1,Some systems have sethostname but forgot to declare it) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3823fi
3824
3825AC_MSG_CHECKING(for sync)
3826AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_UNISTD_H
3827	#include <unistd.h>
3828#endif],
3829sync(),AC_DEFINE(RUDIMENTS_HAVE_SYNC,1,Some systems have sync) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3830
3831AC_MSG_CHECKING(for FlushFileBuffers)
3832AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3833	#include <windows.h>
3834#endif],
3835FlushFileBuffers(0),AC_DEFINE(RUDIMENTS_HAVE_FLUSHFILEBUFFERS,1,Some systems have FlushFileBuffers) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3836
3837AC_MSG_CHECKING(for sysconf)
3838AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_UNISTD_H
3839	#include <unistd.h>
3840#endif],
3841sysconf(0),AC_DEFINE(RUDIMENTS_HAVE_SYSCONF,1,Some systems have sysconf) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3842
3843AC_MSG_CHECKING(for reboot with 1 argument)
3844AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_UNISTD_H
3845	#include <unistd.h>
3846#endif
3847#ifdef RUDIMENTS_HAVE_SYS_REBOOT_H
3848	#include <sys/reboot.h>
3849#endif],
3850reboot(0),AC_DEFINE(RUDIMENTS_HAVE_REBOOT_1,1,Some systems have reboot with 1 argument) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3851
3852AC_MSG_CHECKING(for reboot with 2 arguments)
3853AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_UNISTD_H
3854	#include <unistd.h>
3855#endif
3856#ifdef RUDIMENTS_HAVE_SYS_REBOOT_H
3857	#include <sys/reboot.h>
3858#endif],
3859reboot(0,0),AC_DEFINE(RUDIMENTS_HAVE_REBOOT_2,1,Some systems have reboot with 2 argument) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3860
3861AC_MSG_CHECKING(for RB_HALT)
3862AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_UNISTD_H
3863	#include <unistd.h>
3864#endif
3865#ifdef RUDIMENTS_HAVE_SYS_REBOOT_H
3866	#include <sys/reboot.h>
3867#endif],
3868int a=(int)RB_HALT;,AC_DEFINE(RUDIMENTS_HAVE_RB_HALT,1,Some systems have RB_HALT) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3869
3870AC_MSG_CHECKING(for RB_AUTOBOOT)
3871AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_UNISTD_H
3872	#include <unistd.h>
3873#endif
3874#ifdef RUDIMENTS_HAVE_SYS_REBOOT_H
3875	#include <sys/reboot.h>
3876#endif],
3877int a=(int)RB_AUTOBOOT;,AC_DEFINE(RUDIMENTS_HAVE_RB_AUTOBOOT,1,Some systems have RB_AUTOBOOT) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3878
3879AC_MSG_CHECKING(for uadmin with char * argument)
3880AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3881	#include <sys/types.h>
3882#endif
3883#ifdef RUDIMENTS_HAVE_PROTOTYPES_H
3884	#include <prototypes.h>
3885#endif
3886#ifdef RUDIMENTS_HAVE_SYS_UADMIN_H
3887	#include <sys/uadmin.h>
3888#endif],
3889uadmin(0,0,""),AC_DEFINE(RUDIMENTS_HAVE_UADMIN_CHAR,1,Some systems have uadmin with a char * argument) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3890
3891AC_MSG_CHECKING(for uadmin with integer)
3892AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_SYS_TYPES_H
3893	#include <sys/types.h>
3894#endif
3895#ifdef RUDIMENTS_HAVE_PROTOTYPES_H
3896	#include <prototypes.h>
3897#endif
3898#ifdef RUDIMENTS_HAVE_SYS_UADMIN_H
3899	#include <sys/uadmin.h>
3900#endif],
3901uadmin(0,0,0),AC_DEFINE(RUDIMENTS_HAVE_UADMIN_INT,1,Some systems have uadmin with a integer argument) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3902
3903AC_MSG_CHECKING(for BRoster::_ShutDown)
3904FW_TRY_LINK([#ifdef RUDIMENTS_HAVE_ROSTER_H
3905	#include <Roster.h>
3906#endif
3907
3908class BRoster::Private {
3909	public:
3910		Private(BRoster *r) : roster(r) {};
3911		status_t ShutDown(bool reboot, bool confirm, bool sync) {
3912			return roster->_ShutDown(reboot,confirm,sync);
3913		};
3914	private:
3915		BRoster	*roster;
3916};
3917],
3918[BRoster r; BRoster::Private rp(&r); rp.ShutDown(0,0,0);],[$CPPFLAGS],[$BELIB],[],[AC_DEFINE(RUDIMENTS_HAVE_BROSTER__SHUTDOWN,1,Some systems have BRoster::_ShutDown) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
3919
3920AC_MSG_CHECKING(for InitiateSystemShutdownEx)
3921AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3922	#include <windows.h>
3923#endif],
3924InitiateSystemShutdownEx("","",0,0,0,0),AC_DEFINE(RUDIMENTS_HAVE_INITIATESYSTEMSHUTDOWNEX,1,Some systems have InitiateSystemShutdownEx) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3925
3926AC_MSG_CHECKING(for ExitWindowsEx)
3927AC_TRY_LINK([#ifdef RUDIMENTS_HAVE_WINDOWS_H
3928	#include <windows.h>
3929#endif],
3930ExitWindowsEx(0,0),AC_DEFINE(RUDIMENTS_HAVE_EXITWINDOWSEX,1,Some systems have ExitWindowsEx) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
3931
3932echo "******************************"
3933
3934
3935dnl Checks for prompt functions
3936echo
3937echo "***** Prompt Libraries *******"
3938
3939if ( test "$INCLUDE_PROMPT" = "1" -a "$ENABLE_RUDIMENTS_LIBEDIT" = "yes" )
3940then
3941
3942	if ( test -z "$LIBEDITLIBS" -a -z "$LIBEDITINCLUDES" )
3943	then
3944
3945		AC_MSG_CHECKING(for termcap)
3946		FW_CHECK_HEADERS_AND_LIBS([/usr],[termcap],[termcap.h],[termcap],[""],[""],[TERMCAPINCLUDES],[TERMCAPLIBS],[TERMCAPLIBPATH],[TERMCAPSTATIC])
3947		if ( test -n "$TERMCAPLIBS" )
3948		then
3949			AC_MSG_RESULT(yes)
3950		else
3951			AC_MSG_RESULT(no)
3952		fi
3953
3954		AC_MSG_CHECKING(for libedit)
3955		FW_CHECK_HEADERS_AND_LIBS([/usr],[editline],[editline/readline.h],[edit],[""],[""],[LIBEDITINCLUDES],[LIBEDITLIBS],[LIBEDITLIBPATH],[LIBEDITSTATIC])
3956		if ( test -n "$LIBEDITLIBS" )
3957		then
3958			LIBEDITLIBS="$LIBEDITLIBS"
3959			AC_MSG_RESULT(yes)
3960		else
3961			AC_MSG_RESULT(no)
3962		fi
3963
3964		LIBEDITINCLUDES="$LIBEDITINCLUDES $TERMCAPINCLUDES"
3965
3966		LIBEDITLIBS="$LIBEDITLIBS $TERMCAPLIBS"
3967
3968		AC_MSG_CHECKING(whether libedit works)
3969		FW_TRY_LINK([#include <stdio.h>
3970#include <editline/readline.h>
3971],[add_history(NULL); read_history(NULL); write_history(NULL); readline(NULL);],[$LIBEDITINCLUDES],[$LIBEDITLIBS],[],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no); LIBEDITLIBS=""])
3972
3973		if ( test -n "$LIBEDITLIBS" )
3974		then
3975			AC_MSG_CHECKING(for history_truncate_file)
3976			FW_TRY_LINK([#include <stdio.h>
3977#include <editline/readline.h>
3978],[history_truncate_file(NULL,0);],[$LIBEDITINCLUDES],[$LIBEDITLIBS],[],[AC_MSG_RESULT(yes); AC_DEFINE_UNQUOTED(RUDIMENTS_LIBEDIT_HAS_HISTORY_TRUNCATE_FILE,1,Modern versions of libedit provide history_truncate_file)],[AC_MSG_RESULT(no)])
3979		fi
3980	fi
3981
3982	AC_SUBST(LIBEDITINCLUDES)
3983	AC_SUBST(LIBEDITLIBS)
3984
3985	if ( test -n "$LIBEDITLIBS" )
3986	then
3987		AC_DEFINE_UNQUOTED(RUDIMENTS_HAVE_LIBEDIT,1,Do we have libedit)
3988	fi
3989
3990	case $host_os in
3991		*haiku* )
3992                	AC_DEFINE(ADD_NEWLINE_AFTER_READ_FROM_STDIN,1,On some platforms, you have to add a newline after reading from stdin)
3993			;;
3994		* )
3995			;;
3996	esac
3997fi
3998
3999echo "******************************"
4000
4001
4002
4003dnl Semantic Versioning
4004dnl Given a version number MAJOR.MINOR.PATCH, increment the:
4005dnl 1. MAJOR when you make backwards-incompatible API changes
4006dnl    (and set MINOR and PATCH to 0)
4007dnl 2. MINOR when you add backwards-compatible features
4008dnl    (and set PATCH to 0)
4009dnl 3. PATCH when you make backwards-compatible fixes
4010RUDIMENTS_VERSION="1.2.1"
4011AC_SUBST(RUDIMENTS_VERSION)
4012AC_DEFINE_UNQUOTED(RUDIMENTS_VERSION,"$RUDIMENTS_VERSION",Version)
4013
4014dnl Libtool Versioning
4015dnl For CURRENT:REVISION:AGE version info, apply the following rules in order:
4016dnl if library source changed at all,         c:r:a -> c:r+1:a
4017dnl if interfaces added, removed, or changed, c:r:a -> c+1:0:a
4018dnl if interfaces added,                      c:r:a -> c:r:a+1
4019dnl if interfaces removed,                    c:r:a -> c:r:0
4020SONAME_VERSION_INFO="6:1:0"
4021AC_SUBST(SONAME_VERSION_INFO)
4022
4023
4024AC_PREFIX_DEFAULT(/usr/local/firstworks)
4025
4026dnl perform substitutions for disable options
4027HEADERS0="resultcodes.h debugprint.h"
4028HEADERS1="linkedlist.h singlylinkedlist.h avltree.h"
4029HEADERS2="dictionary.h hash.h sha1.h sha256.h md5.h"
4030HEADERS3="dynamicarray.h staticarray.h output.h input.h"
4031PRIVATEHEADERS0="config.h debugprint.h"
4032PRIVATEHEADERS1="inttypes.h new.h"
4033PRIVATEHEADERS2="winsock.h dll.h"
4034PRIVATEHEADERS3="linkedlist.h linkedlistincludes.h linkedlistinlines.h linkedlistnode.h nodeinlines.h avltree.h avltreeincludes.h avltreeinlines.h avltreenode.h"
4035PRIVATEHEADERS4="singlylinkedlist.h singlylinkedlistincludes.h singlylinkedlistinlines.h singlylinkedlistnode.h"
4036PRIVATEHEADERS5="dictionary.h dictionaryincludes.h dictionaryinlines.h dictionarynode.h hashincludes.h sha1.h sha1includes.h sha256.h sha256includes.h md5.h md5includes.h"
4037PRIVATEHEADERS6="dynamicarray.h dynamicarrayincludes.h dynamicarrayinlines.h"
4038PRIVATEHEADERS7="staticarray.h staticarrayinlines.h outputincludes.h inputincludes.h"
4039SRCS="winsock.cpp sha1.cpp sha256.cpp md5.cpp output.cpp input.cpp"
4040LOBJS="winsock.lo sha1.lo sha256.lo md5.lo output.lo input.lo"
4041EXTRACPPFLAGS=""
4042
4043if ( test "$INCLUDE_CHARACTER" = "1" )
4044then
4045	HEADERS1="$HEADERS1 character.h"
4046	PRIVATEHEADERS1="$PRIVATEHEADERS1 characterincludes.h"
4047	SRCS="$SRCS character.cpp"
4048	LOBJS="$LOBJS character.lo"
4049fi
4050
4051if ( test "$INCLUDE_CHARSTRING" = "1" )
4052then
4053	HEADERS1="$HEADERS1 charstring.h"
4054	PRIVATEHEADERS1="$PRIVATEHEADERS1 charstring.h charstringincludes.h"
4055	SRCS="$SRCS charstring.cpp"
4056	LOBJS="$LOBJS charstring.lo"
4057fi
4058
4059if ( test "$INCLUDE_CHAT" = "1" )
4060then
4061	HEADERS1="$HEADERS1 chat.h"
4062	PRIVATEHEADERS1="$PRIVATEHEADERS1 chat.h chatincludes.h"
4063	SRCS="$SRCS chat.cpp"
4064	LOBJS="$LOBJS chat.lo"
4065fi
4066
4067if ( test "$INCLUDE_CLIENT" = "1" )
4068then
4069	HEADERS1="$HEADERS1 client.h"
4070	PRIVATEHEADERS1="$PRIVATEHEADERS1 client.h clientincludes.h"
4071	SRCS="$SRCS client.cpp"
4072	LOBJS="$LOBJS client.lo"
4073fi
4074
4075if ( test "$INCLUDE_COMMANDLINE" = "1" )
4076then
4077	HEADERS1="$HEADERS1 commandline.h"
4078	PRIVATEHEADERS1="$PRIVATEHEADERS1 commandline.h commandlineincludes.h"
4079	SRCS="$SRCS commandline.cpp"
4080	LOBJS="$LOBJS commandline.lo"
4081fi
4082
4083if ( test "$INCLUDE_CRYPT" = "1" )
4084then
4085	HEADERS1="$HEADERS1 crypt.h"
4086	PRIVATEHEADERS1="$PRIVATEHEADERS1 cryptincludes.h"
4087	SRCS="$SRCS crypt.cpp"
4088	LOBJS="$LOBJS crypt.lo"
4089fi
4090
4091if ( test "$INCLUDE_DATETIME" = "1" )
4092then
4093	HEADERS1="$HEADERS1 datetime.h"
4094	PRIVATEHEADERS1="$PRIVATEHEADERS1 datetime.h datetimeincludes.h"
4095	SRCS="$SRCS datetime.cpp"
4096	LOBJS="$LOBJS datetime.lo"
4097fi
4098
4099if ( test "$INCLUDE_DEVICE" = "1" )
4100then
4101	HEADERS1="$HEADERS1 device.h"
4102	PRIVATEHEADERS1="$PRIVATEHEADERS1 device.h deviceincludes.h"
4103	SRCS="$SRCS device.cpp"
4104	LOBJS="$LOBJS device.lo"
4105fi
4106
4107if ( test "$INCLUDE_DIRECTORY" = "1" )
4108then
4109	HEADERS1="$HEADERS1 directory.h"
4110	PRIVATEHEADERS1="$PRIVATEHEADERS1 directory.h directoryincludes.h"
4111	SRCS="$SRCS directory.cpp"
4112	LOBJS="$LOBJS directory.lo"
4113fi
4114
4115if ( test "$INCLUDE_DYNAMICLIB" = "1" )
4116then
4117	HEADERS1="$HEADERS1 dynamiclib.h"
4118	PRIVATEHEADERS2="$PRIVATEHEADERS2 dynamiclib.h dynamiclibincludes.h"
4119	SRCS="$SRCS dynamiclib.cpp"
4120	LOBJS="$LOBJS dynamiclib.lo"
4121fi
4122
4123if ( test "$INCLUDE_ENVIRONMENT" = "1" )
4124then
4125	HEADERS1="$HEADERS1 environment.h"
4126	PRIVATEHEADERS2="$PRIVATEHEADERS2 environment.h environmentincludes.h"
4127	SRCS="$SRCS environment.cpp"
4128	LOBJS="$LOBJS environment.lo"
4129fi
4130
4131if ( test "$INCLUDE_ERROR" = "1" )
4132then
4133	HEADERS1="$HEADERS1 error.h"
4134	PRIVATEHEADERS2="$PRIVATEHEADERS2 errorincludes.h"
4135	SRCS="$SRCS error.cpp"
4136	LOBJS="$LOBJS error.lo"
4137fi
4138
4139if ( test "$INCLUDE_FILE" = "1" )
4140then
4141	HEADERS1="$HEADERS1 file.h"
4142	PRIVATEHEADERS2="$PRIVATEHEADERS2 file.h fileincludes.h"
4143	SRCS="$SRCS file.cpp"
4144	LOBJS="$LOBJS file.lo"
4145fi
4146
4147if ( test "$INCLUDE_URL" = "1" )
4148then
4149	HEADERS1="$HEADERS1 url.h"
4150	PRIVATEHEADERS2="$PRIVATEHEADERS2 url.h urlincludes.h"
4151	SRCS="$SRCS url.cpp"
4152	LOBJS="$LOBJS url.lo"
4153fi
4154
4155if ( test "$INCLUDE_FILEDESCRIPTOR" = "1" )
4156then
4157	HEADERS1="$HEADERS1 filedescriptor.h stdio.h"
4158	PRIVATEHEADERS2="$PRIVATEHEADERS2 filedescriptor.h filedescriptorincludes.h stdio.h"
4159	SRCS="$SRCS filedescriptor.cpp stdio.cpp"
4160	LOBJS="$LOBJS filedescriptor.lo stdio.lo"
4161
4162	#include security too
4163	HEADERS3="$HEADERS3 security.h"
4164
4165	# include GSS too
4166	HEADERS3="$HEADERS3 gss.h"
4167	PRIVATEHEADERS7="$PRIVATEHEADERS7 gss.h gssmechanism.h gsscredentials.h gsscontext.h gssincludes.h"
4168	SRCS="$SRCS gss.cpp"
4169	LOBJS="$LOBJS gss.lo"
4170
4171	# include TLS too
4172	HEADERS3="$HEADERS3 tls.h"
4173	PRIVATEHEADERS7="$PRIVATEHEADERS7 tls.h tlscontext.h tlscertificate.h tlsincludes.h"
4174	SRCS="$SRCS tls.cpp"
4175	LOBJS="$LOBJS tls.lo"
4176
4177	# include websocket too
4178	HEADERS3="$HEADERS3 websocket.h"
4179	PRIVATEHEADERS7="$PRIVATEHEADERS7 websocket.h websocketincludes.h"
4180	SRCS="$SRCS websocket.cpp"
4181	LOBJS="$LOBJS websocket.lo"
4182fi
4183
4184if ( test "$INCLUDE_FILESYSTEM" = "1" )
4185then
4186	HEADERS1="$HEADERS1 filesystem.h"
4187	PRIVATEHEADERS2="$PRIVATEHEADERS2 filesystem.h filesystemincludes.h"
4188	SRCS="$SRCS filesystem.cpp"
4189	LOBJS="$LOBJS filesystem.lo"
4190fi
4191
4192if ( test "$INCLUDE_GROUPENTRY" = "1" )
4193then
4194	HEADERS1="$HEADERS1 groupentry.h"
4195	PRIVATEHEADERS2="$PRIVATEHEADERS2 groupentry.h groupentryincludes.h"
4196	SRCS="$SRCS groupentry.cpp"
4197	LOBJS="$LOBJS groupentry.lo"
4198fi
4199
4200if ( test "$INCLUDE_HOSTENTRY" = "1" )
4201then
4202	HEADERS1="$HEADERS1 hostentry.h"
4203	PRIVATEHEADERS2="$PRIVATEHEADERS2 hostentry.h hostentryincludes.h"
4204	SRCS="$SRCS hostentry.cpp"
4205	LOBJS="$LOBJS hostentry.lo"
4206fi
4207
4208if ( test "$INCLUDE_INETCLIENT" = "1" )
4209then
4210	HEADERS1="$HEADERS1 inetsocketclient.h"
4211	PRIVATEHEADERS2="$PRIVATEHEADERS2 inetsocketclient.h inetsocketclientincludes.h"
4212	SRCS="$SRCS inetsocketclient.cpp"
4213	LOBJS="$LOBJS inetsocketclient.lo"
4214	EXTRACPPFLAGS="$EXTRACPPFLAGS -DINCLUDE_INETCLIENT"
4215fi
4216
4217if ( test "$INCLUDE_INETSERVER" = "1" )
4218then
4219	HEADERS1="$HEADERS1 inetsocketserver.h"
4220	PRIVATEHEADERS2="$PRIVATEHEADERS2 inetsocketserver.h inetsocketserverincludes.h"
4221	SRCS="$SRCS inetsocketserver.cpp"
4222	LOBJS="$LOBJS inetsocketserver.lo"
4223	EXTRACPPFLAGS="$EXTRACPPFLAGS -DINCLUDE_INETSERVER"
4224fi
4225
4226if ( test "$INCLUDE_LISTENER" = "1" )
4227then
4228	HEADERS1="$HEADERS1 listener.h"
4229	PRIVATEHEADERS3="$PRIVATEHEADERS3 listener.h listenerincludes.h"
4230	SRCS="$SRCS listener.cpp"
4231	LOBJS="$LOBJS listener.lo"
4232fi
4233
4234if ( test "$INCLUDE_LOGGER" = "1" )
4235then
4236	HEADERS1="$HEADERS1 logger.h"
4237	PRIVATEHEADERS3="$PRIVATEHEADERS3 filedestination.h logdestination.h logger.h stderrdestination.h stdoutdestination.h syslogdestination.h loggerincludes.h"
4238	SRCS="$SRCS logger.cpp"
4239	LOBJS="$LOBJS logger.lo"
4240fi
4241
4242if ( test "$INCLUDE_MATH" = "1" )
4243then
4244	HEADERS1="$HEADERS1 math.h"
4245	PRIVATEHEADERS3="$PRIVATEHEADERS3 mathincludes.h mathinlines.h"
4246	SRCS="$SRCS math.cpp"
4247	LOBJS="$LOBJS math.lo"
4248fi
4249
4250if ( test "$INCLUDE_MEMORYMAP" = "1" )
4251then
4252	HEADERS1="$HEADERS1 memorymap.h"
4253	PRIVATEHEADERS3="$PRIVATEHEADERS3 memorymap.h memorymapincludes.h"
4254	SRCS="$SRCS memorymap.cpp"
4255	LOBJS="$LOBJS memorymap.lo"
4256fi
4257
4258if ( test "$INCLUDE_MEMORYPOOL" = "1" )
4259then
4260	HEADERS1="$HEADERS1 memorypool.h"
4261	PRIVATEHEADERS3="$PRIVATEHEADERS3 memorypool.h memorypoolincludes.h"
4262	SRCS="$SRCS memorypool.cpp"
4263	LOBJS="$LOBJS memorypool.lo"
4264fi
4265
4266if ( test "$INCLUDE_MODEMCLIENT" = "1" )
4267then
4268	HEADERS1="$HEADERS1 modemclient.h"
4269	PRIVATEHEADERS3="$PRIVATEHEADERS3 modemclient.h modemclientincludes.h"
4270	SRCS="$SRCS modemclient.cpp"
4271	LOBJS="$LOBJS modemclient.lo"
4272	EXTRACPPFLAGS="$EXTRACPPFLAGS -DINCLUDE_MODEMCLIENT"
4273fi
4274
4275if ( test "$INCLUDE_MODEMSERVER" = "1" )
4276then
4277	HEADERS1="$HEADERS1 modemserver.h"
4278	PRIVATEHEADERS3="$PRIVATEHEADERS3 modemserver.h modemserverincludes.h"
4279	SRCS="$SRCS modemserver.cpp"
4280	LOBJS="$LOBJS modemserver.lo"
4281	EXTRACPPFLAGS="$EXTRACPPFLAGS -DINCLUDE_MODEMSERVER"
4282fi
4283
4284if ( test "$INCLUDE_THREAD" = "1" )
4285then
4286	HEADERS1="$HEADERS1 thread.h"
4287	PRIVATEHEADERS3="$PRIVATEHEADERS3 thread.h threadincludes.h"
4288	SRCS="$SRCS thread.cpp"
4289	LOBJS="$LOBJS thread.lo"
4290fi
4291
4292if ( test "$INCLUDE_THREADMUTEX" = "1" )
4293then
4294	HEADERS1="$HEADERS1 threadmutex.h"
4295	PRIVATEHEADERS3="$PRIVATEHEADERS3 threadmutex.h threadmutexincludes.h"
4296	SRCS="$SRCS threadmutex.cpp"
4297	LOBJS="$LOBJS threadmutex.lo"
4298fi
4299
4300if ( test "$INCLUDE_PARAMETERSTRING" = "1" )
4301then
4302	HEADERS2="$HEADERS2 parameterstring.h"
4303	PRIVATEHEADERS4="$PRIVATEHEADERS4 parameterstring.h parameterstringincludes.h"
4304	SRCS="$SRCS parameterstring.cpp"
4305	LOBJS="$LOBJS parameterstring.lo"
4306fi
4307
4308if ( test "$INCLUDE_USERENTRY" = "1" )
4309then
4310	HEADERS2="$HEADERS2 userentry.h"
4311	PRIVATEHEADERS4="$PRIVATEHEADERS4 userentry.h userentryincludes.h"
4312	SRCS="$SRCS userentry.cpp"
4313	LOBJS="$LOBJS userentry.lo"
4314fi
4315
4316if ( test "$INCLUDE_PERMISSIONS" = "1" )
4317then
4318	HEADERS2="$HEADERS2 permissions.h"
4319	PRIVATEHEADERS4="$PRIVATEHEADERS4 permissions.h permissionsincludes.h"
4320	SRCS="$SRCS permissions.cpp"
4321	LOBJS="$LOBJS permissions.lo"
4322fi
4323
4324if ( test "$INCLUDE_PROCESS" = "1" )
4325then
4326	HEADERS2="$HEADERS2 process.h"
4327	PRIVATEHEADERS4="$PRIVATEHEADERS4 process.h processincludes.h"
4328	SRCS="$SRCS process.cpp"
4329	LOBJS="$LOBJS process.lo"
4330fi
4331
4332if ( test "$INCLUDE_PROTOCOLENTRY" = "1" )
4333then
4334	HEADERS2="$HEADERS2 protocolentry.h"
4335	PRIVATEHEADERS4="$PRIVATEHEADERS4 protocolentry.h protocolentryincludes.h"
4336	SRCS="$SRCS protocolentry.cpp"
4337	LOBJS="$LOBJS protocolentry.lo"
4338fi
4339
4340if ( test "$INCLUDE_RANDOMNUMBER" = "1" )
4341then
4342	HEADERS2="$HEADERS2 randomnumber.h"
4343	PRIVATEHEADERS4="$PRIVATEHEADERS4 randomnumber.h randomnumberincludes.h"
4344	SRCS="$SRCS randomnumber.cpp"
4345	LOBJS="$LOBJS randomnumber.lo"
4346fi
4347
4348if ( test "$INCLUDE_BYTESTRING" = "1" )
4349then
4350	HEADERS2="$HEADERS2 bytestring.h"
4351	PRIVATEHEADERS4="$PRIVATEHEADERS4 bytestringincludes.h"
4352	SRCS="$SRCS bytestring.cpp"
4353	LOBJS="$LOBJS bytestring.lo"
4354fi
4355
4356if ( test "$INCLUDE_REGULAREXPRESSION" = "1" )
4357then
4358	HEADERS2="$HEADERS2 regularexpression.h"
4359	PRIVATEHEADERS4="$PRIVATEHEADERS4 regularexpression.h regularexpressionincludes.h"
4360	SRCS="$SRCS regularexpression.cpp"
4361	LOBJS="$LOBJS regularexpression.lo"
4362fi
4363
4364if ( test "$USE_BUILT_IN_REGULAREXPRESSION" = "1" )
4365then
4366	SRCS="$SRCS regex.cpp"
4367	LOBJS="$LOBJS regex.lo"
4368fi
4369
4370if ( test "$INCLUDE_SEMAPHORESET" = "1" )
4371then
4372	HEADERS2="$HEADERS2 semaphoreset.h"
4373	PRIVATEHEADERS4="$PRIVATEHEADERS4 semaphoreset.h semaphoresetincludes.h"
4374	SRCS="$SRCS semaphoreset.cpp"
4375	LOBJS="$LOBJS semaphoreset.lo"
4376fi
4377
4378if ( test "$INCLUDE_SERIALPORT" = "1" )
4379then
4380	HEADERS2="$HEADERS2 serialport.h"
4381	PRIVATEHEADERS5="$PRIVATEHEADERS5 serialport.h serialportincludes.h"
4382	SRCS="$SRCS serialport.cpp"
4383	LOBJS="$LOBJS serialport.lo"
4384fi
4385
4386if ( test "$INCLUDE_SERIALPORTPROFILE" = "1" )
4387then
4388	HEADERS2="$HEADERS2 serialportprofile.h"
4389	PRIVATEHEADERS5="$PRIVATEHEADERS5 serialportprofile.h serialportprofileincludes.h"
4390	SRCS="$SRCS serialportprofile.cpp"
4391	LOBJS="$LOBJS serialportprofile.lo"
4392fi
4393
4394if ( test "$INCLUDE_SERVER" = "1" )
4395then
4396	HEADERS2="$HEADERS2 server.h"
4397	PRIVATEHEADERS5="$PRIVATEHEADERS5 server.h serverincludes.h"
4398	SRCS="$SRCS server.cpp"
4399	LOBJS="$LOBJS server.lo"
4400fi
4401
4402if ( test "$INCLUDE_SERVICEENTRY" = "1" )
4403then
4404	HEADERS2="$HEADERS2 serviceentry.h"
4405	PRIVATEHEADERS5="$PRIVATEHEADERS5 serviceentry.h serviceentryincludes.h"
4406	SRCS="$SRCS serviceentry.cpp"
4407	LOBJS="$LOBJS serviceentry.lo"
4408fi
4409
4410if ( test "$INCLUDE_SHAREDMEMORY" = "1" )
4411then
4412	HEADERS2="$HEADERS2 sharedmemory.h"
4413	PRIVATEHEADERS5="$PRIVATEHEADERS5 sharedmemory.h sharedmemoryincludes.h"
4414	SRCS="$SRCS sharedmemory.cpp"
4415	LOBJS="$LOBJS sharedmemory.lo"
4416fi
4417
4418if ( test "$INCLUDE_SIGNALCLASSES" = "1" )
4419then
4420	HEADERS2="$HEADERS2 signalclasses.h"
4421	PRIVATEHEADERS5="$PRIVATEHEADERS5 signalhandler.h signalset.h signalclassesincludes.h"
4422	SRCS="$SRCS signalclasses.cpp"
4423	LOBJS="$LOBJS signalclasses.lo"
4424fi
4425
4426if ( test "$INCLUDE_SNOOZE" = "1" )
4427then
4428	HEADERS2="$HEADERS2 snooze.h"
4429	PRIVATEHEADERS5="$PRIVATEHEADERS5 snooze.h snoozeincludes.h"
4430	SRCS="$SRCS snooze.cpp"
4431	LOBJS="$LOBJS snooze.lo"
4432fi
4433
4434if ( test "$INCLUDE_STRINGBUFFER" = "1" )
4435then
4436	HEADERS2="$HEADERS2 stringbuffer.h"
4437	PRIVATEHEADERS5="$PRIVATEHEADERS5 stringbufferincludes.h stringbufferinlines.h"
4438fi
4439
4440if ( test "$INCLUDE_SYSTEM" = "1" )
4441then
4442	HEADERS2="$HEADERS2 sys.h"
4443	PRIVATEHEADERS5="$PRIVATEHEADERS5 sys.h sysincludes.h"
4444	SRCS="$SRCS sys.cpp"
4445	LOBJS="$LOBJS sys.lo"
4446fi
4447
4448if ( test "$INCLUDE_UNIXCLIENT" = "1" )
4449then
4450	HEADERS3="$HEADERS3 unixsocketclient.h"
4451	PRIVATEHEADERS6="$PRIVATEHEADERS6 unixsocketclient.h unixsocketclientincludes.h"
4452	SRCS="$SRCS unixsocketclient.cpp"
4453	LOBJS="$LOBJS unixsocketclient.lo"
4454	EXTRACPPFLAGS="$EXTRACPPFLAGS -DINCLUDE_UNIXCLIENT"
4455fi
4456
4457if ( test "$INCLUDE_UNIXSERVER" = "1" )
4458then
4459	HEADERS3="$HEADERS3 unixsocketserver.h"
4460	PRIVATEHEADERS6="$PRIVATEHEADERS6 unixsocketserver.h unixsocketserverincludes.h"
4461	SRCS="$SRCS unixsocketserver.cpp"
4462	LOBJS="$LOBJS unixsocketserver.lo"
4463	EXTRACPPFLAGS="$EXTRACPPFLAGS -DINCLUDE_UNIXSERVER"
4464fi
4465
4466if ( test "$INCLUDE_BYTEBUFFER" = "1" )
4467then
4468	HEADERS3="$HEADERS3 bytebuffer.h"
4469	PRIVATEHEADERS6="$PRIVATEHEADERS6 bytebuffer.h bytebufferincludes.h"
4470	SRCS="$SRCS bytebuffer.cpp"
4471	LOBJS="$LOBJS bytebuffer.lo"
4472fi
4473
4474if ( test "$INCLUDE_XMLDOM" = "1" -o "$INCLUDE_CSVDOM" = "1" -o "$INCLUDE_JSONDOM" = "1" )
4475then
4476	HEADERS3="$HEADERS3 dom.h domnode.h"
4477	PRIVATEHEADERS6="$PRIVATEHEADERS6 dom.h domincludes.h domnode.h domnodeincludes.h"
4478	SRCS="$SRCS dom.cpp domnode.cpp"
4479	LOBJS="$LOBJS dom.lo domnode.lo"
4480fi
4481
4482if ( test "$INCLUDE_XMLDOM" = "1" )
4483then
4484	HEADERS3="$HEADERS3 xmldom.h"
4485	PRIVATEHEADERS6="$PRIVATEHEADERS6 xmldom.h xmldomincludes.h"
4486	SRCS="$SRCS xmldom.cpp"
4487	LOBJS="$LOBJS xmldom.lo"
4488fi
4489
4490if ( test "$INCLUDE_XMLSAX" = "1" -o "$INCLUDE_CSVSAX" = "1" -o "$INCLUDE_JSONSAX" = "1" )
4491then
4492	HEADERS3="$HEADERS3 sax.h"
4493	PRIVATEHEADERS6="$PRIVATEHEADERS6 sax.h saxincludes.h"
4494	SRCS="$SRCS sax.cpp"
4495	LOBJS="$LOBJS sax.lo"
4496fi
4497
4498if ( test "$INCLUDE_XMLSAX" = "1" )
4499then
4500	HEADERS3="$HEADERS3 xmlsax.h"
4501	PRIVATEHEADERS6="$PRIVATEHEADERS6 xmlsax.h xmlsaxincludes.h"
4502	SRCS="$SRCS xmlsax.cpp"
4503	LOBJS="$LOBJS xmlsax.lo"
4504fi
4505
4506if ( test "$INCLUDE_DOMEVENTS" = "1" )
4507then
4508	HEADERS3="$HEADERS3 domevents.h"
4509	PRIVATEHEADERS6="$PRIVATEHEADERS6 domevents.h domeventsincludes.h"
4510	SRCS="$SRCS domevents.cpp"
4511	LOBJS="$LOBJS domevents.lo"
4512fi
4513
4514if ( test "$INCLUDE_CODETREE" = "1" )
4515then
4516	HEADERS3="$HEADERS3 codetree.h"
4517	PRIVATEHEADERS6="$PRIVATEHEADERS6 codetree.h codetreeincludes.h codetreegrammar.h"
4518	SRCS="$SRCS codetree.cpp"
4519	LOBJS="$LOBJS codetree.lo"
4520fi
4521
4522if ( test "$INCLUDE_COMPILER" = "1" )
4523then
4524	HEADERS3="$HEADERS3 compiler.h"
4525	PRIVATEHEADERS6="$PRIVATEHEADERS6 compiler.h compilerincludes.h"
4526	SRCS="$SRCS compiler.cpp"
4527	LOBJS="$LOBJS compiler.lo"
4528fi
4529
4530if ( test "$INCLUDE_INETSERVER" = "1" -o "$INCLUDE_INETCLIENT" = "1" )
4531then
4532	HEADERS3="$HEADERS3 inetsocketutil.h"
4533	PRIVATEHEADERS6="$PRIVATEHEADERS6 inetsocketutil.h inetsocketutilincludes.h"
4534	SRCS="$SRCS inetsocketutil.cpp"
4535	LOBJS="$LOBJS inetsocketutil.lo"
4536fi
4537
4538if ( test "$INCLUDE_UNIXSERVER" = "1" -o "$INCLUDE_UNIXCLIENT" = "1" )
4539then
4540	HEADERS3="$HEADERS3 unixsocketutil.h"
4541	PRIVATEHEADERS6="$PRIVATEHEADERS6 unixsocketutil.h unixsocketutilincludes.h"
4542	SRCS="$SRCS unixsocketutil.cpp"
4543	LOBJS="$LOBJS unixsocketutil.lo"
4544fi
4545
4546if ( test "$INCLUDE_INETSERVER" = "1" -o "$INCLUDE_UNIXSERVER" = "1" )
4547then
4548	HEADERS3="$HEADERS3 socketserver.h"
4549	PRIVATEHEADERS6="$PRIVATEHEADERS6 socketserver.h socketserverincludes.h"
4550	SRCS="$SRCS socketserver.cpp"
4551	LOBJS="$LOBJS socketserver.lo"
4552fi
4553
4554if ( test "$INCLUDE_INETCLIENT" = "1" -o "$INCLUDE_UNIXCLIENT" = "1" )
4555then
4556	HEADERS3="$HEADERS3 socketclient.h"
4557	PRIVATEHEADERS6="$PRIVATEHEADERS6 socketclient.h socketclientincludes.h"
4558	SRCS="$SRCS socketclient.cpp"
4559	LOBJS="$LOBJS socketclient.lo"
4560fi
4561
4562if ( test "$INCLUDE_MODEMCLIENT" = "1" -o  "$INCLUDE_MODEMSERVER" = "1" )
4563then
4564	PRIVATEHEADERS6="$PRIVATEHEADERS6 modemutil.h"
4565	SRCS="$SRCS modemutil.cpp"
4566	LOBJS="$LOBJS modemutil.lo"
4567fi
4568
4569if ( test "$INCLUDE_PROMPT" = "1" )
4570then
4571	HEADERS3="$HEADERS3 prompt.h"
4572	PRIVATEHEADERS6="$PRIVATEHEADERS6 prompt.h promptincludes.h"
4573	SRCS="$SRCS prompt.cpp"
4574	LOBJS="$LOBJS prompt.lo"
4575fi
4576
4577if ( test "$INCLUDE_TEMPLATEENGINE" = "1" )
4578then
4579	HEADERS3="$HEADERS3 templateengine.h"
4580	PRIVATEHEADERS7="$PRIVATEHEADERS7 templateengine.h templateengineincludes.h"
4581	SRCS="$SRCS templateengine.cpp"
4582	LOBJS="$LOBJS templateengine.lo"
4583fi
4584
4585if ( test "$INCLUDE_CSVSAX" = "1" )
4586then
4587	HEADERS3="$HEADERS3 csvsax.h"
4588	PRIVATEHEADERS7="$PRIVATEHEADERS7 csvsax.h csvsaxincludes.h"
4589	SRCS="$SRCS csvsax.cpp"
4590	LOBJS="$LOBJS csvsax.lo"
4591fi
4592
4593if ( test "$INCLUDE_CSVDOM" = "1" )
4594then
4595	HEADERS3="$HEADERS3 csvdom.h"
4596	PRIVATEHEADERS7="$PRIVATEHEADERS7 csvdom.h csvdomincludes.h"
4597	SRCS="$SRCS csvdom.cpp"
4598	LOBJS="$LOBJS csvdom.lo"
4599fi
4600
4601if ( test "$INCLUDE_JSONSAX" = "1" )
4602then
4603	HEADERS3="$HEADERS3 jsonsax.h"
4604	PRIVATEHEADERS7="$PRIVATEHEADERS7 jsonsax.h jsonsaxincludes.h"
4605	SRCS="$SRCS jsonsax.cpp"
4606	LOBJS="$LOBJS jsonsax.lo"
4607fi
4608
4609if ( test "$INCLUDE_JSONDOM" = "1" )
4610then
4611	HEADERS3="$HEADERS3 jsondom.h"
4612	PRIVATEHEADERS7="$PRIVATEHEADERS7 jsondom.h jsondomincludes.h"
4613	SRCS="$SRCS jsondom.cpp"
4614	LOBJS="$LOBJS jsondom.lo"
4615fi
4616
4617if ( test "$INCLUDE_CURSORDOMNODE" = "1" )
4618then
4619	HEADERS3="$HEADERS3 cursordomnode.h"
4620	PRIVATEHEADERS6="$PRIVATEHEADERS6 cursordomnode.h cursordomnodeincludes.h"
4621	SRCS="$SRCS cursordomnode.cpp"
4622	LOBJS="$LOBJS cursordomnode.lo"
4623fi
4624
4625
4626AC_SUBST(HEADERS0)
4627AC_SUBST(HEADERS1)
4628AC_SUBST(HEADERS2)
4629AC_SUBST(HEADERS3)
4630AC_SUBST(PRIVATEHEADERS0)
4631AC_SUBST(PRIVATEHEADERS1)
4632AC_SUBST(PRIVATEHEADERS2)
4633AC_SUBST(PRIVATEHEADERS3)
4634AC_SUBST(PRIVATEHEADERS4)
4635AC_SUBST(PRIVATEHEADERS5)
4636AC_SUBST(PRIVATEHEADERS6)
4637AC_SUBST(PRIVATEHEADERS7)
4638AC_SUBST(SRCS)
4639AC_SUBST(LOBJS)
4640AC_SUBST(EXTRACPPFLAGS)
4641
4642
4643# prepend DESTDIR where appropriate
4644if ( test "`echo $ac_default_prefix | cut -c1`" = "/" )
4645then
4646	ac_default_prefix='${DESTDIR}'"$ac_default_prefix"
4647fi
4648if ( test "`echo $prefix | cut -c1`" = "/" )
4649then
4650	prefix='${DESTDIR}'"$prefix"
4651fi
4652if ( test "`echo $exec_prefix | cut -c1`" = "/" )
4653then
4654	exec_prefix='${DESTDIR}'"$exec_prefix"
4655fi
4656if ( test "`echo $includedir | cut -c1`" = "/" )
4657then
4658	includedir='${DESTDIR}'"$includedir"
4659fi
4660if ( test "`echo $libdir | cut -c1`" = "/" )
4661then
4662	libdir='${DESTDIR}'"$libdir"
4663fi
4664if ( test "`echo $libexecdir | cut -c1`" = "/" )
4665then
4666	libexecdir='${DESTDIR}'"$libexecdir"
4667fi
4668if ( test "`echo $bindir | cut -c1`" = "/" )
4669then
4670	bindir='${DESTDIR}'"$bindir"
4671fi
4672if ( test "`echo $localstatedir | cut -c1`" = "/" )
4673then
4674	localstatedir='${DESTDIR}'"$localstatedir"
4675fi
4676if ( test "`echo $sysconfdir | cut -c1`" = "/" )
4677then
4678	sysconfdir='${DESTDIR}'"$sysconfdir"
4679fi
4680if ( test "`echo $mandir | cut -c1`" = "/" )
4681then
4682	mandir='${DESTDIR}'"$mandir"
4683fi
4684if ( test "`echo $datadir | cut -c1`" = "/" )
4685then
4686	datadir='${DESTDIR}'"$datadir"
4687fi
4688
4689
4690dnl Output files.
4691echo
4692echo "***** Output Files ***********"
4693AC_CONFIG_HEADER(include/rudiments/private/config.h)
4694AC_CONFIG_FILES(config.mk src/Makefile include/Makefile bin/rudiments-config rudiments.pc test/certificates/config/ca.cnf)
4695AC_OUTPUT
4696chmod 755 bin/rudiments-config
4697echo "******************************"
4698echo
4699
4700
4701
4702dnl Some versions of NetBSD create a libtool with -lgcc_s -lgcc in it, but don't
4703dnl provide a shared libgcc.
4704dnl Also, some versions of NetBSD create a libtool with -lgcc_s_pic in it, but
4705dnl don't provide a shraed libgcc_s_pic.
4706dnl These cause all kinds of link failures.  Fix them
4707if ( test -r "libtool" )
4708then
4709	sed -e "s|-lgcc_s -lgcc |-lgcc_s |g" \
4710		-e "s|-lgcc_s -lgcc\"|-lgcc_s\"|g" \
4711		-e "s|-lgcc_s_pic|-lgcc_s|g" \
4712		libtool > libtool.new
4713	mv libtool.new libtool
4714fi
4715
4716
4717
4718dnl Summary.
4719echo
4720echo "***** Summary ****************"
4721
4722echo " Version      : $RUDIMENTS_VERSION"
4723
4724PCREBUILD="no "
4725if ( test -n "$HAVE_PCRE" )
4726then
4727	PCREBUILD="yes"
4728fi
4729
4730LIBCURLBUILD="no "
4731if ( test -n "$HAVE_LIBCURL" )
4732then
4733	LIBCURLBUILD="yes"
4734fi
4735
4736SSLBUILD="no "
4737if ( test -n "$SSLLIBS" )
4738then
4739	SSLBUILD="yes"
4740fi
4741
4742GSSBUILD="no "
4743if ( test -n "$HAVE_GSS" )
4744then
4745	GSSBUILD="yes"
4746fi
4747LIBEDITBUILD="no"
4748if ( test -n "$LIBEDITLIBS" )
4749then
4750	LIBEDITBUILD="yes"
4751fi
4752
4753echo " Features     : Threads  $HAS_THREADS"
4754echo "                PCRE     $PCREBUILD"
4755echo "                libcurl  $LIBCURLBUILD"
4756echo "                TLS/SSL  $SSLBUILD"
4757echo "                GSS      $GSSBUILD"
4758echo "                libedit  $LIBEDITBUILD"
4759echo "*******************************"
4760echo
4761echo "If you expected a feature that doesn't show up in the Summary"
4762echo "then the configure script probably couldn't find a package it needed to"
4763echo "build it.  You can manually specify package locations using command line"
4764echo "options."
4765echo
4766echo "Type:  configure --help   for a list of options."
4767echo
4768