~ubuntu-branches/ubuntu/intrepid/gnome-games/intrepid

« back to all changes in this revision

Viewing changes to m4/platform.m4

  • Committer: Package Import Robot
  • Author(s): Daniel Holbach
  • Date: 2007-02-13 08:40:20 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: package-import@ubuntu.com-20070213084020-zewbmxapszr0alkc
Tags: upstream-2.17.91
ImportĀ upstreamĀ versionĀ 2.17.91

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl ======================================
 
2
dnl GGZ Gaming Zone - Configuration Macros
 
3
dnl ======================================
 
4
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.
 
8
dnl
 
9
dnl ======================================
 
10
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.
 
15
dnl
 
16
dnl ======================================
 
17
dnl
 
18
dnl History:
 
19
dnl 2005-09-14: created from libggz's configure.ac file
 
20
 
 
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)
 
31
dnl
 
32
 
 
33
dnl ------------------------------------------------------------------------
 
34
dnl AC_GGZ_PLATFORM_BASE
 
35
dnl ------------------------------------------------------------------------
 
36
dnl
 
37
AC_DEFUN([AC_GGZ_PLATFORM_BASE],
 
38
[
 
39
AC_PROG_CC
 
40
AC_PROG_CXX
 
41
AC_PROG_INSTALL
 
42
AC_PROG_LN_S
 
43
AC_PROG_CPP
 
44
AC_LIBTOOL_WIN32_DLL
 
45
#AC_PROG_LIBTOOL # bug!
 
46
AC_PROG_RANLIB
 
47
AC_PROG_MAKE_SET
 
48
])
 
49
 
 
50
dnl ------------------------------------------------------------------------
 
51
dnl AC_GGZ_PLATFORM_WIN32
 
52
dnl ------------------------------------------------------------------------
 
53
dnl
 
54
AC_DEFUN([AC_GGZ_PLATFORM_WIN32],
 
55
[
 
56
  case $host_os in
 
57
    *mingw32* )
 
58
      MINGW32=yes
 
59
      ;;
 
60
    * )
 
61
      MINGW32=no
 
62
      ;;
 
63
  esac
 
64
 
 
65
  if test "$MINGW32" = "yes"; then
 
66
    LDFLAGS="$LDFLAGS -no-undefined"
 
67
    LDADD="$LDADD -lws2_32"
 
68
  fi
 
69
 
 
70
  AC_CHECK_HEADERS([winsock2.h])
 
71
])
 
72
 
 
73
dnl ------------------------------------------------------------------------
 
74
dnl AC_GGZ_PLATFORM_POSIX
 
75
dnl ------------------------------------------------------------------------
 
76
dnl
 
77
AC_DEFUN([AC_GGZ_PLATFORM_POSIX],
 
78
[
 
79
# Check for header files
 
80
# ======================
 
81
#AC_CHECK_HEADERS([fcntl.h sys/param.h],
 
82
#  [],
 
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])
 
87
 
 
88
# Check for functions
 
89
# ===================
 
90
#AC_CHECK_FUNCS([getpagesize memmove memset mkdir stat strcasecmp strerror strstr strchr],
 
91
#  [],
 
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])
 
95
 
 
96
# Check for more functions
 
97
# ========================
 
98
#AC_FUNC_FORK
 
99
##AC_FUNC_MALLOC # use ggz_malloc() always
 
100
#AC_FUNC_MEMCMP
 
101
#AC_FUNC_REALLOC
 
102
#AC_FUNC_STAT
 
103
#FUNC_MKDIR_TAKES_ONE_ARG # FIXME: external
 
104
 
 
105
# Check for typedefs, structures, and compiler characteristics
 
106
# ============================================================
 
107
#AC_C_CONST
 
108
#AC_TYPE_MODE_T
 
109
#AC_TYPE_PID_T
 
110
#AC_TYPE_SIGNAL
 
111
#AC_TYPE_SIZE_T
 
112
AC_C99_VARIABLE_ARRAYS # FIXME: external
 
113
 
 
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],
 
119
  [
 
120
    AC_DEFINE([GGZ_HAVE_SYSLOG_H], 1, [Check if syslog is present])
 
121
  ],
 
122
  [])
 
123
])
 
124
 
 
125
dnl ------------------------------------------------------------------------
 
126
dnl AC_GGZ_PLATFORM_POSIX_NET
 
127
dnl ------------------------------------------------------------------------
 
128
dnl
 
129
AC_DEFUN([AC_GGZ_PLATFORM_POSIX_NET],
 
130
[
 
131
# Check for sendmsg
 
132
# =================
 
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],
 
137
  [
 
138
    AC_DEFINE([GGZ_HAVE_SENDMSG], 1, [Check if file descriptors can be sent])
 
139
  ],
 
140
  [])
 
141
 
 
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])
 
146
have_localsockets=0
 
147
AC_COMPILE_IFELSE(
 
148
  AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[int a = PF_LOCAL;]]),
 
149
  [have_localsockets=1],
 
150
  [
 
151
    AC_COMPILE_IFELSE(
 
152
      AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[int a = PF_UNIX;]]),
 
153
      [
 
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])
 
156
        have_localsockets=1
 
157
      ],
 
158
      [])
 
159
  ])
 
160
if test "x$have_localsockets" = "x1"; then
 
161
  AC_DEFINE([GGZ_HAVE_PF_LOCAL], 1, [Check if local sockets are supported])
 
162
  AC_MSG_RESULT(yes)
 
163
else
 
164
  AC_MSG_RESULT(no)
 
165
fi
 
166
 
 
167
# Check for SUN_LEN
 
168
# =================
 
169
AC_MSG_CHECKING([for network feature: SUN_LEN])
 
170
AC_LINK_IFELSE(
 
171
  AC_LANG_PROGRAM(
 
172
    [[
 
173
      #include<sys/types.h>
 
174
      #include<sys/un.h>
 
175
    ]],
 
176
    [[struct sockaddr_un su; int i = SUN_LEN(&su);]]),
 
177
  [
 
178
    AC_MSG_RESULT(yes)
 
179
    AC_DEFINE([HAVE_SUN_LEN], 1, [Define if the SUN_LEN macro exists])
 
180
  ],
 
181
  [AC_MSG_RESULT(no)])
 
182
 
 
183
# Check for msghdr member msg_controllen and friends
 
184
# ==================================================
 
185
AC_MSG_CHECKING([for network feature: msg_controllen])
 
186
have_controllen=0
 
187
AC_COMPILE_IFELSE(
 
188
  AC_LANG_PROGRAM([[#include <sys/socket.h>]],
 
189
    [[struct msghdr m; m.msg_controllen = 0;]]),
 
190
  [have_controllen=1],
 
191
  [])
 
192
 
 
193
if test "x$have_controllen" = "x1"; then
 
194
  AC_DEFINE([HAVE_MSGHDR_MSG_CONTROL], 1, [Define if msghdr has a msg_controllen member])
 
195
  AC_MSG_RESULT(yes)
 
196
 
 
197
  AC_MSG_CHECKING([for network feature: CMSG_ALIGN])
 
198
  AC_LINK_IFELSE(
 
199
    AC_LANG_PROGRAM(
 
200
      [[
 
201
        #include<sys/types.h>
 
202
        #include<sys/socket.h>
 
203
      ]],
 
204
      [[int i = CMSG_ALIGN(0);]]),
 
205
    [
 
206
      AC_MSG_RESULT(yes)
 
207
      AC_DEFINE([HAVE_CMSG_ALIGN], 1, [Define if CMSG_ALIGN is available])
 
208
    ],
 
209
    [AC_MSG_RESULT(no)])
 
210
 
 
211
  AC_MSG_CHECKING([for network feature: CMSG_LEN])
 
212
  AC_LINK_IFELSE(
 
213
    AC_LANG_PROGRAM(
 
214
      [[
 
215
        #include<sys/types.h>
 
216
        #include<sys/socket.h>
 
217
      ]],
 
218
      [[int i = CMSG_LEN(0);]]),
 
219
    [
 
220
      AC_MSG_RESULT(yes)
 
221
      AC_DEFINE([HAVE_CMSG_LEN], 1, [Define if CMSG_LEN is available])
 
222
    ],
 
223
    [AC_MSG_RESULT(no)])
 
224
 
 
225
  AC_MSG_CHECKING([for network feature: CMSG_SPACE])
 
226
  AC_LINK_IFELSE(
 
227
    AC_LANG_PROGRAM(
 
228
      [[
 
229
        #include<sys/types.h>
 
230
        #include<sys/socket.h>
 
231
      ]],
 
232
      [[int i = CMSG_SPACE(0);]]),
 
233
    [
 
234
      AC_MSG_RESULT(yes)
 
235
      AC_DEFINE([HAVE_CMSG_SPACE], 1, [Define if CMSG_SPACE is available])
 
236
    ],
 
237
    [AC_MSG_RESULT(no)])
 
238
else
 
239
  AC_MSG_RESULT(no)
 
240
fi
 
241
])
 
242
 
 
243
dnl ------------------------------------------------------------------------
 
244
dnl AC_GGZ_PLATFORM_POSIX_LIBC
 
245
dnl ------------------------------------------------------------------------
 
246
dnl
 
247
AC_DEFUN([AC_GGZ_PLATFORM_POSIX_LIBC],
 
248
[
 
249
# Check for library functions
 
250
# ===========================
 
251
# On some systems additional libraries may be needed.  Simply include them
 
252
# if they're there.
 
253
AC_CHECK_LIB(socket, socket, [LDADD="$LDADD -lsocket"])
 
254
AC_CHECK_LIB(nsl, gethostbyname, [LDADD="$LDADD -lnsl"])
 
255
])
 
256
 
 
257
dnl ------------------------------------------------------------------------
 
258
dnl AC_GGZ_PLATFORM
 
259
dnl ------------------------------------------------------------------------
 
260
dnl
 
261
AC_DEFUN([AC_GGZ_PLATFORM],
 
262
[
 
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
 
268
])
 
269