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

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
# Configuration for the GGZ client libraries
# ==========================================

AC_INIT([GGZ client libraries], [0.0.14], [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_VERSION(0, 0, 14)
AC_GGZ_INTL

# Check for what to build
# =======================
AC_ARG_ENABLE([ggzwrap],
              AS_HELP_STRING([--disable-ggzwrap], [Don't build ggz wrapper]),
              [enable_ggzwrap=$enableval], [enable_ggzwrap="yes"])
AM_CONDITIONAL([COND_GGZWRAP], [test "$enable_ggzwrap" = yes])

# 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, [LIB_EXPAT="-lexpat"],
             [AC_MSG_ERROR(cannot find expat library)])
AC_CHECK_HEADER(expat.h, [],
                [AC_MSG_ERROR(cannot find expat.h header)])
AC_SUBST(LIB_EXPAT)


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

# Library settings
# ================
AM_CONDITIONAL(INSTALL_GGZMOD, true)
AM_CONDITIONAL(INSTALL_GGZCORE, true)

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 ""
echo "Compile options"
echo "    GGZ Wrapper........$enable_ggzwrap"
echo ""
echo "Debugging 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."