blob: c9d2903b8bb6724f2e4f75baf6e8498905ec18e1 [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001dnl Copyright (C) 1999-2005 Open Source Telecom Corporation.
2dnl Copyright (C) 2006-2010 David Sugar, Tycho Softworks.
3dnl
4dnl This program is free software; you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation; either version 2 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program; if not, write to the Free Software
16dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17dnl
18dnl As a special exception to the GNU General Public License, if you
19dnl distribute this file as part of a program that contains a configuration
20dnl script generated by Autoconf, you may include it under the same
21dnl distribution terms that you use for the rest of that program.
22
23AC_DEFUN([OST_SYS_POSIX],[
24 AC_REQUIRE([OST_PROG_CC_POSIX])
25 AC_CACHE_CHECK(whether system meets Posix.1,
26 ost_cv_sys_posix1,
27 AC_TRY_COMPILE([
28 #include <sys/types.h>
29 #include <unistd.h>
30 ],[
31 #ifndef _POSIX_VERSION
32 fatal
33 #endif
34 ],
35 ost_cv_sys_posix1=yes,
36 ost_cv_sys_posix1=no
37 )
38 )
39 if test $ost_cv_sys_posix1 = no ; then
40 AC_CHECK_HEADERS(unistd.h)
41 else
42 AC_DEFINE(HAVE_UNISTD_H, [1], [have unix header])
43 fi
44 AC_CHECK_HEADERS(features.h)
45 AH_TOP([
46/* hack for BROKEN autoheader, since it will not predicitably order
47 macros by any obvious means. */
48
49#undef HAVE_UNISTD_H
50#undef HAVE_FEATURES_H
51#undef HAVE_SYS_TYPES_H
52
53#ifdef HAVE_UNISTD_H
54#include <unistd.h>
55#endif
56
57#ifndef WIN32
58#ifdef HAVE_FEATURES_H
59#include <features.h>
60#endif
61#endif
62
63#ifdef HAVE_SYS_TYPES_H
64#include <sys/types.h>
65#endif
66 ])
67])
68
69AC_DEFUN([OST_CC_FCNTL],[
70 AC_REQUIRE([OST_SYS_POSIX])
71 AC_CHECK_HEADERS(fcntl.h sys/fcntl.h)
72AH_BOTTOM([
73
74#ifndef HAVE_FCNTL_H
75#ifdef HAVE_SYS_FCNTL_H
76#include <sys/fcntl.h>
77#endif
78#else
79#include <fcntl.h>
80#ifndef O_NDELAY
81#ifdef HAVE_SYS_FCNTL_H
82#include <sys/fcntl.h>
83#endif
84#endif
85#endif
86 ])
87])
88