1
dnl ======================================
2
dnl GGZ Gaming Zone - Configuration Macros
3
dnl ======================================
5
dnl Copyright (C) 2005, 2006 Josef Spillner, josef@ggzgamingzone.org
6
dnl This file has been derived from libggz configuration macros.
7
dnl It is published under the conditions of the GNU General Public License.
9
dnl ======================================
11
dnl This file contains operating system specific checks such as for system
12
dnl libraries, header file flavours and non-POSIX/Unix handling.
13
dnl Macros defined herein are allowed to modify LDADD and LDFLAGS.
14
dnl Optional (advanced) checks go to system.m4 and should use LIB_* variables.
16
dnl ======================================
19
dnl 2005-09-14: created from libggz's configure.ac file
21
dnl ------------------------------------------------------------------------
22
dnl Content of this file:
23
dnl ------------------------------------------------------------------------
24
dnl AC_GGZ_PLATFORM_BASE - minimal required call
25
dnl AC_GGZ_PLATFORM_POSIX - checks for various types and functions
26
dnl AC_GGZ_PLATFORM_POSIX_NET - network-related checks
27
dnl AC_GGZ_PLATFORM_POSIX_LIBC - system libraries in addition to libc
28
dnl AC_GGZ_PLATFORM_WIN32 - for cross-compilation on win32 systems
29
dnl AC_GGZ_PLATFORM - convenience macro to call all of the above
30
dnl (except for _BASE which MUST be called before AC_PROG_LIBTOOL)
33
dnl ------------------------------------------------------------------------
34
dnl AC_GGZ_PLATFORM_BASE
35
dnl ------------------------------------------------------------------------
37
AC_DEFUN([AC_GGZ_PLATFORM_BASE],
45
#AC_PROG_LIBTOOL # bug!
50
dnl ------------------------------------------------------------------------
51
dnl AC_GGZ_PLATFORM_WIN32
52
dnl ------------------------------------------------------------------------
54
AC_DEFUN([AC_GGZ_PLATFORM_WIN32],
65
if test "$MINGW32" = "yes"; then
66
LDFLAGS="$LDFLAGS -no-undefined"
67
LDADD="$LDADD -lws2_32"
70
AC_CHECK_HEADERS([winsock2.h])
73
dnl ------------------------------------------------------------------------
74
dnl AC_GGZ_PLATFORM_POSIX
75
dnl ------------------------------------------------------------------------
77
AC_DEFUN([AC_GGZ_PLATFORM_POSIX],
79
# Check for header files
80
# ======================
81
#AC_CHECK_HEADERS([fcntl.h sys/param.h],
83
# [AC_MSG_ERROR([cannot find required header file])])
84
#AC_CHECK_HEADERS([netdb.h sys/shm.h sys/socket.h])
85
#AC_CHECK_HEADERS([sys/uio.h sys/un.h sys/wait.h])
86
AC_CHECK_HEADERS([arpa/inet.h sys/types.h netinet/in.h])
90
#AC_CHECK_FUNCS([getpagesize memmove memset mkdir stat strcasecmp strerror strstr strchr],
92
# [AC_MSG_ERROR([cannot find required function])])
93
#AC_CHECK_FUNCS([gethostbyname socket]) # These fail; dunno why
94
#AC_CHECK_FUNCS([alarm getuid inet_pton])
96
# Check for more functions
97
# ========================
99
##AC_FUNC_MALLOC # use ggz_malloc() always
103
#FUNC_MKDIR_TAKES_ONE_ARG # FIXME: external
105
# Check for typedefs, structures, and compiler characteristics
106
# ============================================================
112
AC_C99_VARIABLE_ARRAYS # FIXME: external
114
# Check for debug types in syslog.h
115
# =================================
116
# If syslog is present, we take the log types from it.
117
# If not, define our own enumeration.
118
AC_CHECK_HEADER([syslog.h],
120
AC_DEFINE([GGZ_HAVE_SYSLOG_H], 1, [Check if syslog is present])
125
dnl ------------------------------------------------------------------------
126
dnl AC_GGZ_PLATFORM_POSIX_NET
127
dnl ------------------------------------------------------------------------
129
AC_DEFUN([AC_GGZ_PLATFORM_POSIX_NET],
133
# If sendmsg() is present, we can send file descriptors over a local socket
134
# via ggz_write_fd. If not we disable this functionality.
135
#AC_MSG_CHECKING([for network feature: sendmsg])
136
AC_CHECK_FUNC([sendmsg],
138
AC_DEFINE([GGZ_HAVE_SENDMSG], 1, [Check if file descriptors can be sent])
142
# Check for PF_LOCAL/PF_UNIX
143
# ==========================
144
# There should be an autoconf macro to check this???
145
AC_MSG_CHECKING([for network feature: PF_LOCAL])
148
AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[int a = PF_LOCAL;]]),
149
[have_localsockets=1],
152
AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[int a = PF_UNIX;]]),
154
AC_DEFINE([PF_LOCAL], PF_UNIX, [PF_LOCAL is available via PF_UNIX])
155
AC_DEFINE([AF_LOCAL], AF_UNIX, [AF_LOCAL is available via AF_UNIX])
160
if test "x$have_localsockets" = "x1"; then
161
AC_DEFINE([GGZ_HAVE_PF_LOCAL], 1, [Check if local sockets are supported])
169
AC_MSG_CHECKING([for network feature: SUN_LEN])
173
#include<sys/types.h>
176
[[struct sockaddr_un su; int i = SUN_LEN(&su);]]),
179
AC_DEFINE([HAVE_SUN_LEN], 1, [Define if the SUN_LEN macro exists])
183
# Check for msghdr member msg_controllen and friends
184
# ==================================================
185
AC_MSG_CHECKING([for network feature: msg_controllen])
188
AC_LANG_PROGRAM([[#include <sys/socket.h>]],
189
[[struct msghdr m; m.msg_controllen = 0;]]),
193
if test "x$have_controllen" = "x1"; then
194
AC_DEFINE([HAVE_MSGHDR_MSG_CONTROL], 1, [Define if msghdr has a msg_controllen member])
197
AC_MSG_CHECKING([for network feature: CMSG_ALIGN])
201
#include<sys/types.h>
202
#include<sys/socket.h>
204
[[int i = CMSG_ALIGN(0);]]),
207
AC_DEFINE([HAVE_CMSG_ALIGN], 1, [Define if CMSG_ALIGN is available])
211
AC_MSG_CHECKING([for network feature: CMSG_LEN])
215
#include<sys/types.h>
216
#include<sys/socket.h>
218
[[int i = CMSG_LEN(0);]]),
221
AC_DEFINE([HAVE_CMSG_LEN], 1, [Define if CMSG_LEN is available])
225
AC_MSG_CHECKING([for network feature: CMSG_SPACE])
229
#include<sys/types.h>
230
#include<sys/socket.h>
232
[[int i = CMSG_SPACE(0);]]),
235
AC_DEFINE([HAVE_CMSG_SPACE], 1, [Define if CMSG_SPACE is available])
243
dnl ------------------------------------------------------------------------
244
dnl AC_GGZ_PLATFORM_POSIX_LIBC
245
dnl ------------------------------------------------------------------------
247
AC_DEFUN([AC_GGZ_PLATFORM_POSIX_LIBC],
249
# Check for library functions
250
# ===========================
251
# On some systems additional libraries may be needed. Simply include them
253
AC_CHECK_LIB(socket, socket, [LDADD="$LDADD -lsocket"])
254
AC_CHECK_LIB(nsl, gethostbyname, [LDADD="$LDADD -lnsl"])
257
dnl ------------------------------------------------------------------------
259
dnl ------------------------------------------------------------------------
261
AC_DEFUN([AC_GGZ_PLATFORM],
263
#AC_GGZ_PLATFORM_BASE
264
AC_GGZ_PLATFORM_POSIX
265
AC_GGZ_PLATFORM_POSIX_NET
266
AC_GGZ_PLATFORM_POSIX_LIBC
267
AC_GGZ_PLATFORM_WIN32