29
29
AC_PATH_PROG(RM, rm)
30
30
AC_PATH_PROG(PERL, perl)
31
31
AC_PATH_PROG(AR, ar)
32
AC_PATH_PROG(PKG_CONFIG, pkg-config)
34
dnl Check if svnversion is avaliable to get the rev number
35
AC_PATH_PROG(SVNVERSION, svnversion)
33
37
dnl Put this early on, since gtk may rely on it.
37
pkg_modules="gtk+-2.0 >= 2.0.0"
38
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules], CF_SUBDIRS="$CF_SUBDIRS gtk-v2",
39
AC_MSG_WARN(GTK v2 libraries not found - will not build gtkv2 client) )
42
AC_SUBST(PACKAGE_LIBS)
45
AC_CHECK_LIB(glut, main, OPENGL_LIBS="-lglut")
47
if eval "test x$OPENGL_LIBS != x"; then
48
AC_DEFINE(HAVE_OPENGL)
50
dnl end of gtk-v2 stuff
54
40
SOUNDDIR="${datadir}/crossfire-client/sounds"
56
42
dnl Add some options to 'configure'.
89
75
EXTRA_INC="$withval")
92
AC_ARG_ENABLE(gtk, [ --disable-gtk make x11 client [default=make gtk client if available]],
93
gtk=$enableval, gtk=yes )
95
AC_ARG_ENABLE(sdl, [ --disable-sdl Disable linking with the SDL library, default is to use it if available ],
78
AC_ARG_WITH(loglevel, [ --with-logevel=level sets default loglevel ],
79
MINLOGLEVEL="$withval", MINLOGLEVEL=0)
82
AC_ARG_ENABLE(gtkv1, [ --disable-gtkv1 do not make original gtk client [default=make it if available]],
83
gtkv1=$enableval, gtkv1=yes )
85
AC_ARG_ENABLE(gtkv2, [ --disable-gtkv2 do not make gtk-v2 client [default=make it if available]],
86
gtkv2=$enableval, gtkv2=yes )
88
AC_ARG_ENABLE(cfgtk2, [ --enable-cfgtk2 enable building the original gtkv1 client with GTK+ 2],
89
cfgtk2=$enableval, cfgtk2=no)
91
AC_ARG_ENABLE(sdl, [ --disable-sdl disable linking with the SDL library, default is to use it if available ],
96
92
use_sdl=$enableval, use_sdl=yes)
98
AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc Enable checking for dmalloc library, default is to use it if available ],
94
AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc enable checking for dmalloc library, default is to use it if available ],
99
95
use_dmalloc=$enableval, use_dmalloc=no)
126
122
need_r_flag="yes"
126
# -mms-bitfields is needed for GTK+ in windows. It is set automatically
127
# by pkg-config, but it's also needed in common, so we explicitely set it
128
CFLAGS="$CFLAGS -mms-bitfields"
129
WIN32_LIBS="-lwsock32 -lwinmm"
136
dnl Check for what clients we are going to build in order of x, gtk-v1, gtk-v2
138
dnl Check to see if X client will be built - no_x is set by AC_CHECK_XTRA if
139
dnl X11 isn't found on the machine
140
if eval "test x$no_x = xyes" ; then
141
AC_MSG_WARN(X11 not found - will not build X client)
144
AC_MSG_NOTICE(X11 found - will build X client)
145
X_LIBS="$X_LIBS -lX11"
146
CF_SUBDIRS="$CF_SUBDIRS x11"
148
echo Extras: $X_EXTRA_LIBS
149
echo Xpre: $X_PRE_LIBS
151
dnl End of X client check
153
dnl Check to see if gtk-v1 client will be built
154
if eval "test x$gtkv1 = xyes" ; then
155
if eval "test x$cfgtk2 = xyes" ; then
156
PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.0, [HAVE_GTK2=yes], [HAVE_GTK2=no])
157
if eval "test x$HAVE_GTK2 = xyes" ; then
158
GTK_CFLAGS="`$PKG_CONFIG --cflags gtk+-2.0` -DCFGTK2 -DGTK_ENABLE_BROKEN -DGTK_WINDOW_DIALOG=GTK_WINDOW_TOPLEVEL"
159
GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
160
CF_SUBDIRS="$CF_SUBDIRS gtk"
162
AC_MSG_NOTICE(GTK+ 2 found - building original gtk-v1 client with GTK+ 2.0.0)
164
AC_MSG_WARN(GTK2 not found and --enable-cfgtk2 is set - cannot original gtk-v1 client)
167
AM_PATH_GTK(1.0.0,CFGTK="yes",CFGTK="no")
168
if eval "test x$CFGTK = xyes"; then
169
AC_MSG_NOTICE(GTK 1 found - building gtk client)
171
GTK_CFLAGS="$GTK_CFLAGS"
174
CF_SUBDIRS="$CF_SUBDIRS gtk"
175
dnl AC_DEFINE(GTK_CLIENT)
177
AC_MSG_WARN(GTK 1 not found - not building building gtk-v1 client)
181
AC_MSG_NOTICE(gtkv1 client build disabled)
184
dnl End of gtk-v1 client check
186
dnl Check to see if gtk-v2 client will be built
187
if eval "test x$gtkv2 = xyes" ; then
188
PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0], [CF_SUBDIRS="$CF_SUBDIRS gtk-v2"], [gtkv2="no"])
189
dnl Check if gtkv2 is still "yes" as is cleaner than putting all the messages in the PKG_CHECK
190
if eval "test x$gtkv2 = xyes" ; then
191
AC_MSG_NOTICE(GTK+ 2 found - will build gtk-v2 client)
193
AC_MSG_WARN(GTK+ 2 libraries not found - will not build gtk-v2 client)
196
AC_MSG_NOTICE(gtkv2 client disabled)
198
dnl End of gtk-v2 client check
200
dnl Future check for Gnome client
201
dnl AC_PATH_PROG(GNOMECONFIG, gnome-config)
203
dnl if test -z "$GNOMECONFIG" ; then
205
dnl echo "Can't find gnome-config, not building Gnome client."
208
dnl if eval "test x$gnome = xyes"; then
210
dnl GNOME_COMPILE_WARNINGS
212
dnl AM_PATH_GDK_PIXBUF(0.11.0, , echo "gdk-pixbuf 0.11.0 or higher is needed for the Gnome client so I'm not building it." ; gnome=no)
213
dnl if eval "test x$gnome = xyes"; then
214
dnl CF_SUBDIRS="$CF_SUBDIRS gnome"
217
dnl End of future check for Gnome client
219
dnl End of client checks
222
AC_SUBST(PACKAGE_LIBS)
226
AC_CHECK_LIB(GL, main)
227
AC_CHECK_LIB(GLU, main)
228
AC_CHECK_LIB(opengl32, main)
229
AC_CHECK_LIB(glu32, main)
230
AC_CHECK_LIB(glut, main, opengl="yes"; AC_DEFINE(HAVE_OPENGL))
231
if eval "test x$opengl = xyes" ; then
232
if eval "test x$win32 = xyes" ; then
233
OPENGL_LIBS="-lopengl32 -lglu32 -lglut"
235
OPENGL_LIBS="-lGL -lGLU -lglut"
237
AC_SUBST(OPENGL_LIBS)
239
dnl End of OpenGL checks
133
241
dnl Checks for programs.
140
dnl Check for GTK >= 1.0.0.
141
dnl The XLib client (without GTK) should use AC_PATH_X instead of this.
143
dnl Simple hack - if we want standard x11 client, don't check for the gtk
144
dnl libraries. Then we fall through below
146
if eval "test x$gtk = xyes"; then
147
AM_PATH_GTK(1.0.0,CFGTK="yes",CFGTK="no")
153
if eval "test x$CFGTK = xyes"; then
154
AC_MSG_RESULT(GTK found - building both gtk and x11 client)
156
GTK_CFLAGS="$GTK_CFLAGS"
159
CF_SUBDIRS="$CF_SUBDIRS gtk"
160
dnl AC_DEFINE(GTK_CLIENT)
162
AC_MSG_RESULT(GTK not found - building xlib client)
164
dnl common to everything
166
X_LIBS="$X_LIBS -lX11"
168
249
AC_SUBST(X_CFLAGS)
170
echo Extras: $X_EXTRA_LIBS
171
echo Xpre: $X_PRE_LIBS
173
251
CPPFLAGS="$CPPFLAGS $EXTRA_INC"
174
252
LDFLAGS="$LDFLAGS $EXTRA_LIB"
244
322
CF_SUBDIRS="$CF_SUBDIRS $SOUND_SRC";
247
dnl AC_PATH_PROG(GNOMECONFIG, gnome-config)
249
dnl if test -z "$GNOMECONFIG" ; then
251
dnl echo "Can't find gnome-config, not building Gnome client."
254
dnl if eval "test x$gnome = xyes"; then
256
dnl GNOME_COMPILE_WARNINGS
258
dnl AM_PATH_GDK_PIXBUF(0.11.0, , echo "gdk-pixbuf 0.11.0 or higher is needed for the Gnome client so I'm not building it." ; gnome=no)
259
dnl if eval "test x$gnome = xyes"; then
260
dnl CF_SUBDIRS="$CF_SUBDIRS gnome"
264
325
AC_SUBST(GUI_OBJS)
265
326
AC_SUBST(GUI_SRCS)
266
327
AC_SUBST(SND_LIBS)
400
461
nbindir=`eval echo ${bindir}`
401
462
nbindir=`eval echo ${nbindir}`
464
dnl Datadir should be working directory in Windows, as there is no set
465
dnl installation directory (choosable at installation time)
466
if eval "test x$win32 = xyes" ; then
467
AC_DEFINE_UNQUOTED(DATADIR, ".")
403
469
AC_DEFINE_UNQUOTED(DATADIR, "${ndatadir}/crossfire-client")
404
471
AC_DEFINE_UNQUOTED(BINDIR, "${nbindir}")
472
AC_DEFINE_UNQUOTED(MINLOGLEVEL, ${MINLOGLEVEL})
406
474
AC_SUBST(DATADIR)