~ubuntu-branches/ubuntu/edgy/ggz-client-libs/edgy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Configuration for the GGZ client libraries
# ==========================================

AC_INIT([GGZ client libraries], [0.0.13], [ggz-dev@mail.ggzgamingzone.org], [ggz-client-libs])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE


# Check for standard build environment
# ====================================
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_CPP

AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_RANLIB

# Special case for compiling on windows
case $host_os in
  *mingw32* ) MINGW32=yes;;
          * ) MINGW32=no;;
esac

# Check for GGZ Requirements
# ==========================
AC_GGZ_INIT(defaults, export)
AC_GGZ_LIBGGZ
AC_GGZ_INTL


# Check for header files
# ======================
AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h time.h \
                  unistd.h], [],
                 [AC_MSG_ERROR([cannot find required header file])])
AC_CHECK_HEADERS([netdb.h sys/socket.h winsock2.h])
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
# We used to check for the presence of WAIT_ANY, and define it as
# (pid_t)(-1) if not present.  Now we just leave it up to AC_HEADER_SYS_WAIT.


# Check for typedefs, structures, and compiler characteristics
# ============================================================
AC_C_CONST
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL


# Check for PF_LOCAL/PF_UNIX
# ==========================
# There should be an autoconf macro to check this???
#
# Not having this is not necessarily a fatal error.  It should mean that
# the WinAPI interface is used instead.
AC_MSG_CHECKING([for PF_LOCAL])
AC_EGREP_CPP(PF_LOCAL,
             [#include <sys/socket.h>
              PF_LOCAL ],
             [AC_MSG_RESULT(no)
              AC_MSG_CHECKING([for PF_UNIX])
              AC_EGREP_CPP(PF_UNIX, [ #include <sys/socket.h>
				      PF_UNIX ],
                           [AC_MSG_RESULT(no)],
                           [AC_MSG_RESULT(yes)
                            AC_DEFINE([PF_LOCAL], PF_UNIX,
				      [PF_UNIX is available])
			    AC_DEFINE([AF_LOCAL], AF_UNIX,
				      [AF_UNIX is available])])], 
             AC_MSG_RESULT(yes))

# Add DLL build support for WIN32
# ===============================

if test "$MINGW32" = "yes"; then
	LDFLAGS="$LDFLAGS -no-undefined -lws2_32"
fi

# Check for library functions
# ===========================
AC_CHECK_FUNCS([dup2 strcasecmp strchr strerror \
                malloc vprintf], [],
               [AC_MSG_ERROR([cannot find required function])])
AC_CHECK_FUNCS([fork select]) # These fail; dunno why
AC_CHECK_FUNCS([close hstrerror kill socketpair alarm getenv setenv])
AC_FUNC_FORK
#AC_FUNC_MALLOC <- this doesn't do what you think it does
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_VPRINTF
FUNC_MKDIR_TAKES_ONE_ARG
if test "$MINGW32" = "yes"; then
	LIBS="$LIBS -lws2_32"
fi


# Check for expat
# ===============
AC_CHECK_LIB(expat, XML_ParserCreate, [LIBEXPAT="-lexpat"],
             [AC_MSG_ERROR(cannot find expat library)])
AC_CHECK_HEADER(expat.h, [],
                [AC_MSG_ERROR(cannot find expat.h header)])
AC_SUBST(LIBEXPAT)


# Debug modes
# ===========
AC_GGZ_DEBUG


# Various dirs
# ============
if test "x${sysconfdir}" = 'x${prefix}/etc'; then
  ggzconfdir="${prefix}/etc"
else
  ggzconfdir="${sysconfdir}"
fi
AC_DEFINE_UNQUOTED([GGZCONFDIR], "${ggzconfdir}",
		   [Directory containing GGZ configuration files])


if test "x${libdir}" = 'x${exec_prefix}/lib'; then
  if test "x${exec_prefix}" = "xNONE"; then
    ggzexecmoddir="${prefix}/lib/ggz"
  else
    ggzexecmoddir="${exec_prefix}/lib/ggz"
  fi
else
  ggzexecmoddir="${libdir}/ggz"
fi
AC_DEFINE_UNQUOTED([GAMEDIR], "${ggzexecmoddir}",
		   [Directory containing GGZ client module executables])


if test "x${datadir}" = 'x${prefix}/share'; then
  ggzdatadir="${prefix}/share/ggz"
else
  ggzdatadir="${datadir}/ggz"
fi
AC_DEFINE_UNQUOTED([GGZDATADIR], "${ggzdatadir}",
		   [Directory containing GGZ shared data])

AC_SUBST(ggzconfdir)
AC_SUBST(ggzexecmoddir)
AC_SUBST(ggzdatadir)
AC_SUBST(packagesrcdir)

AC_CONFIG_FILES([Makefile 
	   ggzcore/Makefile
	   ggzmod/Makefile
	   ggzmod-ggz/Makefile
	   ggz-config/Makefile
	   ggz-wrapper/Makefile
	   ggzwrap/Makefile
	   man/Makefile
	   man/ggz-config.6
	   man/ggz.modules.5
	   man/ggzmod_h.3
	   man/ggzcore_h.3
	   tests/Makefile
	   desktop/Makefile
	   po/Makefile
	   po/ggzcore/Makefile
	   po/ggz-config/Makefile
	   ])
AC_OUTPUT


# Status Output
# =============
echo ""
echo "Options"
echo "    General Debugging..$enable_debug"
echo "    GDB Debugging......$enable_debug_gdb"
echo "    Dmalloc Debugging..$enable_debug_mem"
echo ""
echo "-------------------------"
echo "At the prompt type \"make\" to"
echo "compile ggzcore and ggzmod."
echo ""
echo "When complete, su to root"
echo "and type \"make install\" to"
echo "install the client software."