AC_CONFIG_SRCDIR(src/htparser.c)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
+AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AM_PROG_CC_C_O
AC_MSG_ERROR([*** cannot find libmagic on this system])
fi
+AH_TEMPLATE(HAVE_GLIBC_STDIO, [define to indicate system support for glibc cookie streams])
+
+HAS_FOPENCOOKIE=yes
+AC_CHECK_FUNC(fopencookie, [], [HAS_FOPENCOOKIE=no])
+AC_CHECK_MEMBER([cookie_io_functions_t.read], [], [HAS_FOPENCOOKIE=no])
+
+if test "$HAS_FOPENCOOKIE" = yes; then
+ AC_DEFINE(HAVE_GLIBC_STDIO)
+else
+ AC_MSG_ERROR([*** libc support for custom stdio streams is required])
+fi
+
AH_TEMPLATE(HAVE_VALGRIND, [define to include debugging support for Valgrind])
AC_CHECK_HEADER(valgrind/memcheck.h, [AC_DEFINE(HAVE_VALGRIND)], [])
libht_a_SOURCES = utils.c mt.c log.c req.c proc.c mtio.c resp.c cf.c
libht_a_CFLAGS = -fPIC
-libht_a_CPPFLAGS = -D_GNU_SOURCE
if USE_EPOLL
libht_a_SOURCES += mtio-epoll.c
else
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include <log.h>
#include <utils.h>
#include <mt.h>
return(0);
}
+#ifdef HAVE_GLIBC_STDIO
static cookie_io_functions_t iofuns = {
.read = mtread,
.write = mtwrite,
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
return(ret);
}
+#else
+#error "No stdio implementation for this system"
+#endif