summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in153
1 files changed, 153 insertions, 0 deletions
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..0931b5a
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,153 @@
+dnl
+dnl autoconf input file to generate MCONFIG
+dnl
+
+AC_PREREQ(2.61)
+AC_INIT(MCONFIG.in)
+AC_PREFIX_DEFAULT(/usr)
+
+AC_USE_SYSTEM_EXTENSIONS
+AC_ISC_POSIX
+AC_PROG_CC
+
+AC_C_CONST
+AC_C_INLINE
+
+PA_ADD_CFLAGS(-O3)
+PA_ADD_CFLAGS(-W)
+PA_ADD_CFLAGS(-Wall)
+PA_ADD_CFLAGS(-Wpointer-arith)
+PA_ADD_CFLAGS(-Wbad-function-cast)
+PA_ADD_CFLAGS(-Wcast-equal)
+PA_ADD_CFLAGS(-Wstrict-prototypes)
+PA_ADD_CFLAGS(-Wmissing-prototypes)
+PA_ADD_CFLAGS(-Wmissing-declarations)
+PA_ADD_CFLAGS(-Wnested-externs)
+PA_ADD_CFLAGS(-Winline)
+PA_ADD_CFLAGS(-Wwrite-strings)
+PA_ADD_CFLAGS(-Wundef)
+PA_ADD_CFLAGS(-Wshadow)
+PA_ADD_CFLAGS(-Wsign-compare)
+PA_ADD_CFLAGS(-pipe)
+PA_ADD_CFLAGS(-fno-strict-aliasing)
+
+AC_HEADER_STDC
+AC_CHECK_HEADERS(inttypes.h)
+AC_CHECK_HEADERS(stdint.h)
+AC_CHECK_HEADERS(stdbool.h)
+PA_CHECK_INTTYPES_H_SANE
+AC_CHECK_HEADERS(fcntl.h)
+AC_CHECK_HEADERS(stddef.h)
+AC_CHECK_HEADERS(stdlib.h)
+AC_CHECK_HEADERS(string.h)
+AC_CHECK_HEADERS(sysexits.h)
+AC_CHECK_HEADERS(time.h)
+AC_CHECK_HEADERS(unistd.h)
+AC_CHECK_HEADERS(sys/stat.h)
+AC_CHECK_HEADERS(sys/time.h)
+AC_CHECK_HEADERS(sys/types.h)
+AC_CHECK_HEADERS(arpa/inet.h)
+AC_CHECK_HEADERS(netdb.h)
+AC_HEADER_TIME
+dnl This is needed on some versions of FreeBSD...
+AC_CHECK_HEADERS(machine/param.h)
+AC_CHECK_HEADERS(sys/socket.h)
+AC_CHECK_HEADERS(winsock2.h)
+AC_CHECK_HEADERS(winsock.h)
+
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_TYPE_MODE_T
+AC_TYPE_SIZE_T
+AC_CHECK_TYPES(uint16_t)
+AC_CHECK_TYPES(uint32_t)
+AC_CHECK_TYPES(u_short)
+AC_CHECK_TYPES(u_long)
+
+dnl
+dnl <sys/socket.h> isn't among the list of standard headers that
+dnl autoconf checks, but POSIX requires <sys/socket.h> for socklen_t
+dnl to be defined.
+dnl
+AC_CHECK_TYPES(socklen_t,,,
+[
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+])
+
+AC_SEARCH_LIBS(socket, [socket ws2_32 wsock32], ,
+ [AC_MSG_ERROR(socket library not found)])
+
+AC_CHECK_FUNCS(fcntl)
+AC_CHECK_FUNCS(setsid)
+AC_CHECK_FUNCS(recvmsg)
+
+PA_MSGHDR_MSG_CONTROL
+PA_STRUCT_IN_PKTINFO
+PA_STRUCT_ADDRINFO
+
+dnl
+dnl Get common paths
+dnl
+SRCROOT=`cd $srcdir && pwd`
+OBJROOT=`pwd`
+
+XTRA=false
+AC_CHECK_LIB(cygwin, getopt_long)
+PA_SEARCH_LIBS_AND_ADD(getopt_long, [getopt cygwin iberty], getopt_long)
+PA_SEARCH_LIBS_AND_ADD(getaddrinfo, [nsl resolv])
+if $pa_add_getaddrinfo
+then
+ AC_SEARCH_LIBS(gethostbyname, [nsl resolv],
+ [AC_SEARCH_LIBS(herror, [nsl resolv], ,
+ [AC_MSG_ERROR(herror not found)])],
+ [AC_MSG_ERROR(gethostbyname not found)])
+else
+ AC_SEARCH_LIBS(freeaddrinfo, [nsl resolv], ,
+ [AC_MSG_ERROR(getaddrinfo but not freeaddrinfo found)])
+ AC_SEARCH_LIBS(gai_strerror, [nsl resolv], ,
+ [AC_MSG_ERROR(getaddrinfo but not gai_strerror found)])
+fi
+
+AC_CHECK_FUNCS(daemon)
+
+AC_SUBST(SRCROOT)
+AC_SUBST(OBJROOT)
+
+AC_CONFIG_HEADERS(aconfig.h)
+AC_OUTPUT(MCONFIG)