~ubuntu-branches/debian/squeeze/freeciv/squeeze

« back to all changes in this revision

Viewing changes to .pc/99_build_without_ggzd.diff/m4/ggz.m4

  • Committer: Bazaar Package Importer
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2010-02-23 22:09:02 UTC
  • mfrom: (1.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20100223220902-kiyrmr9i4152cka5
Tags: 2.2.0-1
[ Karl Goetz ]
* Remove civserver files in /etc/ggzd/ (Closes: 523772, 517787)
* Adding ${misc:Depends} to all binary packages (lintian warnings)

[ Clint Adams ]
* New upstream version.
  - Drop data_dsc_use_bindir.diff (binary pathnames have changed).

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) 2001 - 2007 Josef Spillner, josef@ggzgamingzone.org
 
6
dnl This file has heavily been inspired by KDE's acinclude :)
 
7
dnl It is published under the conditions of the GNU General Public License.
 
8
dnl
 
9
dnl ======================================
 
10
dnl
 
11
dnl This file is common to most GGZ modules, and should be kept in sync
 
12
dnl between them all.  The master copy resides with libggz.
 
13
dnl Currently the following modules use it:
 
14
dnl   kde-games, kde-client, gtk-games, gtk-client, utils, grubby,
 
15
dnl   ggz-client-libs, ggzd, gnome-client, txt-client, sdl-games, libggz
 
16
dnl See /docs/ggz-project/buildsystem for documentation.
 
17
dnl
 
18
dnl ======================================
 
19
dnl
 
20
dnl History:
 
21
dnl   See the SVN log for a full history.
 
22
dnl
 
23
dnl ------------------------------------------------------------------------
 
24
dnl Content of this file:
 
25
dnl ------------------------------------------------------------------------
 
26
dnl High-level macros:
 
27
dnl   AC_GGZ_CHECK - Checks for presence of GGZ client and server libraries.
 
28
dnl                  GGZ users can call this macro to determine at compile
 
29
dnl                  time whether to include GGZ support.  Server and client
 
30
dnl                  are checked separately.  GGZ_SERVER and GGZ_CLIENT are
 
31
dnl                  defined in config.h, and created as conditionals in
 
32
dnl                  the Makefiles.
 
33
dnl   AC_GGZ_CHECK_SERVER - The same, but server libs only.
 
34
dnl
 
35
dnl Low-level macros:
 
36
dnl   AC_GGZ_INIT - initialization and paths/options setup
 
37
dnl   AC_GGZ_VERSION - ensure a minimum version of GGZ
 
38
dnl   AC_GGZ_LIBGGZ - find the libggz headers and libraries
 
39
dnl   AC_GGZ_GGZCORE - find the ggzcore headers and libraries
 
40
dnl   AC_GGZ_CONFIG - find the ggz-config tool and set up configuration
 
41
dnl   AC_GGZ_GGZMOD - find the ggzmod library
 
42
dnl   AC_GGZ_GGZDMOD - find the ggzdmod library
 
43
dnl   AC_GGZ_SERVER - set up game and room path for ggzd game servers
 
44
dnl
 
45
dnl   Each macro takes two arguments:
 
46
dnl     1.  Action-if-found (or empty for no action).
 
47
dnl     2.  Action-if-not-found (or empty for error, or "ignore" to ignore).
 
48
dnl
 
49
dnl Internal functions:
 
50
dnl   AC_GGZ_ERROR - user-friendly error messages
 
51
dnl   AC_GGZ_FIND_FILE - macro for convenience (thanks kde)
 
52
dnl   AC_GGZ_REMOVEDUPS - eliminate duplicate list elements
 
53
dnl
 
54
 
 
55
# Version number of this script.
 
56
# First part is upstream (ggz) version and second Freeciv modifications.
 
57
# serial 0014.2
 
58
 
 
59
dnl ------------------------------------------------------------------------
 
60
dnl Find a directory containing a single file
 
61
dnl Synopsis: AC_GGZ_FIND_FILE(file, directorylist, <returnvar>)
 
62
dnl ------------------------------------------------------------------------
 
63
dnl
 
64
AC_DEFUN([AC_GGZ_FIND_FILE],
 
65
[
 
66
$3=NO
 
67
for i in $2;
 
68
do
 
69
  for j in $1;
 
70
  do
 
71
    echo "configure: __oline__: $i/$j" >&AC_FD_CC
 
72
    if test -r "$i/$j"; then
 
73
      echo "taking that" >&AC_FD_CC
 
74
      $3=$i
 
75
      break 2
 
76
    fi
 
77
  done
 
78
done
 
79
])
 
80
 
 
81
dnl ------------------------------------------------------------------------
 
82
dnl Remove duplicate entries in a list, and remove all NO's
 
83
dnl Synopsis: AC_GGZ_REMOVEDUPS(list, <returnlist>)
 
84
dnl ------------------------------------------------------------------------
 
85
dnl
 
86
AC_DEFUN([AC_GGZ_REMOVEDUPS],
 
87
[
 
88
ret=""
 
89
for i in $1; do
 
90
  add=yes
 
91
  for j in $ret; do
 
92
    if test "x$i" = "x$j"; then
 
93
      add=no
 
94
    fi
 
95
  done
 
96
  if test "x$i" = "xNO"; then
 
97
    add=no
 
98
  fi
 
99
  if test "x$add" = "xyes"; then
 
100
  ret="$ret $i"
 
101
  fi
 
102
done
 
103
$2=$ret
 
104
])
 
105
 
 
106
dnl ------------------------------------------------------------------------
 
107
dnl User-friendly error messages
 
108
dnl Synopsis: AC_GGZ_ERROR(libraryname, headerdirlist, libdirlist)
 
109
dnl ------------------------------------------------------------------------
 
110
dnl
 
111
AC_DEFUN([AC_GGZ_ERROR],
 
112
[
 
113
  AC_MSG_WARN([no
 
114
  The library '$1' does not seem to be installed correctly.
 
115
  Headers searched in: $2
 
116
  Libraries searched in: $3
 
117
  Please read QuickStart.GGZ in order to fix this.
 
118
  ])
 
119
  exit 1
 
120
])
 
121
 
 
122
dnl ------------------------------------------------------------------------
 
123
dnl Initialization, common values and such
 
124
dnl Synopsis: AC_GGZ_INIT([export], [defaults])
 
125
dnl ------------------------------------------------------------------------
 
126
dnl
 
127
AC_DEFUN([AC_GGZ_INIT],
 
128
[
 
129
if test "x$prefix" = "xNONE"; then
 
130
  prefix="${ac_default_prefix}"
 
131
fi
 
132
if test "x$exec_prefix" = "xNONE"; then
 
133
  exec_prefix='${prefix}'
 
134
fi
 
135
 
 
136
ac_ggz_prefix=""
 
137
AC_ARG_WITH(ggz-dir,
 
138
    AC_HELP_STRING([--with-ggz-dir=DIR], [Path to GGZ Gaming Zone]),
 
139
    [  ac_ggz_prefix="$withval"
 
140
    ])
 
141
 
 
142
if test "x$ac_ggz_prefix" != "xno" ; then
 
143
  if test "x${prefix}" = "xNONE"; then
 
144
    ac_ggz_prefix_incdir="${ac_default_prefix}/include"
 
145
    ac_ggz_prefix_libdir="${ac_default_prefix}/lib"
 
146
    ac_ggz_prefix_bindir="${ac_default_prefix}/bin"
 
147
    ac_ggz_prefix_etcdir="${ac_default_prefix}/etc"
 
148
  else
 
149
    unq_includedir="${includedir}"
 
150
    unq_libdir="${libdir}"
 
151
    unq_bindir="${bindir}"
 
152
    unq_sysconfdir="${sysconfdir}"
 
153
 
 
154
    eval unq_includedir=`echo $unq_includedir`
 
155
    eval unq_includedir=`echo $unq_includedir`
 
156
    eval unq_libdir=`echo $unq_libdir`
 
157
    eval unq_libdir=`echo $unq_libdir`
 
158
    eval unq_bindir=`echo $unq_bindir`
 
159
    eval unq_bindir=`echo $unq_bindir`
 
160
    eval unq_sysconfdir=`echo $unq_sysconfdir`
 
161
    eval unq_sysconfdir=`echo $unq_sysconfdir`
 
162
 
 
163
    ac_ggz_prefix_incdir="${unq_includedir}"
 
164
    ac_ggz_prefix_libdir="${unq_libdir}"
 
165
    ac_ggz_prefix_bindir="${unq_bindir}"
 
166
    ac_ggz_prefix_etcdir="${unq_sysconfdir}"
 
167
  fi
 
168
  ac_ggz_stdinc="$ac_ggz_prefix_incdir"
 
169
  ac_ggz_stdlib="$ac_ggz_prefix_libdir"
 
170
  ac_ggz_stdbin="$ac_ggz_prefix_bindir"
 
171
  ac_ggz_stdetc="$ac_ggz_prefix_etcdir/ggzd"
 
172
  if test "x$ac_ggz_prefix" != "x"; then
 
173
    ac_ggz_stdinc="$ac_ggz_stdinc $ac_ggz_prefix/include"
 
174
    ac_ggz_stdlib="$ac_ggz_stdlib $ac_ggz_prefix/lib $ac_ggz_prefix/lib64"
 
175
    ac_ggz_stdbin="$ac_ggz_stdbin $ac_ggz_prefix/bin"
 
176
    ac_ggz_stdetc="$ac_ggz_stdetc $ac_ggz_prefix/etc/ggzd"
 
177
  fi
 
178
  if test "x$1" = "xdefaults" || test "x$2" = "xdefaults"; then
 
179
    ac_ggz_stdinc="$ac_ggz_stdinc /usr/local/include /usr/include"
 
180
    ac_ggz_stdlib="$ac_ggz_stdlib /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64"
 
181
    ac_ggz_stdbin="$ac_ggz_stdbin /usr/local/bin /usr/bin"
 
182
    ac_ggz_stdetc="$ac_ggz_stdetc /usr/local/etc/ggzd /etc/ggzd"
 
183
  fi
 
184
  if test "x$1" = "xexport" || test "x$2" = "xexport"; then
 
185
    CPPFLAGS="$CPPFLAGS -I ${ac_ggz_prefix_incdir} -I /usr/local/include"
 
186
    LDFLAGS="$LDFLAGS -L${ac_ggz_prefix_libdir} -L/usr/local/lib"
 
187
  fi
 
188
 
 
189
  save_cflags=$CFLAGS
 
190
  save_cxxflags=$CXXFLAGS
 
191
  if test "x$GCC" = xyes; then
 
192
        CFLAGS="-Wall -Werror"
 
193
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 
194
                [[void signedness(void){char c;if(c==-1)c=0;}]])],
 
195
                [],
 
196
                [save_cflags="$save_cflags -fsigned-char"
 
197
                 save_cxxflags="$save_cxxflags -fsigned-char"])
 
198
  else
 
199
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 
200
                [[#if defined(__SUNPRO_C) || (__SUNPRO_C >= 0x550)
 
201
                #else
 
202
                # include "Error: Only GCC and Sun Studio are supported compilers."
 
203
                #endif]], [[]])],
 
204
                [save_cflags="$save_cflags -xchar=signed"
 
205
                 save_cxxflags="$save_cxxflags -xchar=signed"],
 
206
                [])
 
207
 
 
208
  fi
 
209
  CFLAGS=$save_cflags
 
210
  CXXFLAGS=$save_cxxflags
 
211
fi
 
212
])
 
213
 
 
214
dnl ------------------------------------------------------------------------
 
215
dnl Ensure that a minimum version of GGZ is present
 
216
dnl Synopsis: AC_GGZ_VERSION(major, minor, micro,
 
217
dnl                          action-if-found, action-if-not-found)
 
218
dnl ------------------------------------------------------------------------
 
219
dnl
 
220
AC_DEFUN([AC_GGZ_VERSION],
 
221
[
 
222
        major=$1
 
223
        minor=$2
 
224
        micro=$3
 
225
 
 
226
        testprologue="#include <ggz.h>"
 
227
        testbody=""
 
228
        testbody="$testbody if(LIBGGZ_VERSION_MAJOR > $major) return 0;"
 
229
        testbody="$testbody if(LIBGGZ_VERSION_MAJOR < $major) return -1;"
 
230
        testbody="$testbody if(LIBGGZ_VERSION_MINOR > $minor) return 0;"
 
231
        testbody="$testbody if(LIBGGZ_VERSION_MINOR < $minor) return -1;"
 
232
        testbody="$testbody if(LIBGGZ_VERSION_MICRO > $micro) return 0;"
 
233
        testbody="$testbody if(LIBGGZ_VERSION_MICRO < $micro) return -1;"
 
234
        testbody="$testbody return 0;"
 
235
 
 
236
        save_libs=$LIBS
 
237
        save_ldflags=$LDFLAGS
 
238
        save_cppflags=$CPPFLAGS
 
239
        save_ldlibrary_path=$LD_LIBRARY_PATH
 
240
        LDFLAGS=$LIBGGZ_LDFLAGS
 
241
        LIBS=$LIB_GGZ
 
242
        CPPFLAGS=$LIBGGZ_INCLUDES
 
243
        LD_LIBRARY_PATH=$save_ldlibrary_path:$libggz_libraries
 
244
        export LD_LIBRARY_PATH
 
245
 
 
246
        AC_MSG_CHECKING([for GGZ library version: $major.$minor.$micro])
 
247
        AC_RUN_IFELSE(
 
248
                [AC_LANG_PROGRAM([[$testprologue]], [[$testbody]])],
 
249
                [ac_ggz_version_check=yes],
 
250
                [ac_ggz_version_check=no],
 
251
                [ac_ggz_version_check="skipped due to cross-compiling"]
 
252
        )
 
253
        if test "$ac_ggz_version_check" = "no"; then
 
254
                AC_MSG_RESULT([no])
 
255
                if test "x$5" = "x"; then
 
256
                        AC_MSG_ERROR([The GGZ version is too old. Version $major.$minor.$micro is required.])
 
257
                fi
 
258
                $5
 
259
        else
 
260
                AC_MSG_RESULT($ac_ggz_version_check)
 
261
                $4
 
262
        fi
 
263
 
 
264
        LIBS=$save_libs
 
265
        LDFLAGS=$save_ldflags
 
266
        CPPFLAGS=$save_cppflags
 
267
        LD_LIBRARY_PATH=$save_ldlibrary_path
 
268
])
 
269
 
 
270
dnl ------------------------------------------------------------------------
 
271
dnl Try to find the libggz headers and libraries.
 
272
dnl $(LIBGGZ_LDFLAGS) will be -L ... (if needed)
 
273
dnl and $(LIBGGZ_INCLUDES) will be -I ... (if needed)
 
274
dnl ------------------------------------------------------------------------
 
275
dnl
 
276
AC_DEFUN([AC_GGZ_LIBGGZ],
 
277
[
 
278
AC_MSG_CHECKING([for GGZ library: libggz])
 
279
 
 
280
ac_libggz_includes=NO ac_libggz_libraries=NO
 
281
libggz_libraries=""
 
282
libggz_includes=""
 
283
 
 
284
AC_ARG_WITH(libggz-dir,
 
285
    AC_HELP_STRING([--with-libggz-dir=DIR],[libggz installation prefix]),
 
286
    [  ac_libggz_includes="$withval"/include
 
287
       ac_libggz_libraries="$withval"/lib
 
288
    ])
 
289
AC_ARG_WITH(libggz-includes,
 
290
    AC_HELP_STRING([--with-libggz-includes=DIR],
 
291
                   [where the libggz includes are]),
 
292
    [  ac_libggz_includes="$withval"
 
293
    ])
 
294
AC_ARG_WITH(libggz-libraries,
 
295
    AC_HELP_STRING([--with-libggz-libraries=DIR],[where the libggz libs are]),
 
296
    [  ac_libggz_libraries="$withval"
 
297
    ])
 
298
 
 
299
AC_CACHE_VAL(ac_cv_have_libggz,
 
300
[
 
301
libggz_incdirs="$ac_libggz_includes $ac_ggz_stdinc"
 
302
AC_GGZ_REMOVEDUPS($libggz_incdirs, libggz_incdirs)
 
303
libggz_header=ggz.h
 
304
 
 
305
AC_GGZ_FIND_FILE($libggz_header, $libggz_incdirs, libggz_incdir)
 
306
ac_libggz_includes="$libggz_incdir"
 
307
 
 
308
libggz_libdirs="$ac_libggz_libraries $ac_ggz_stdlib"
 
309
AC_GGZ_REMOVEDUPS($libggz_libdirs, libggz_libdirs)
 
310
 
 
311
libggz_libdir=NO
 
312
for dir in $libggz_libdirs; do
 
313
  try="ls -1 $dir/libggz.la $dir/libggz.so"
 
314
  if test -n "`$try 2> /dev/null`"; then libggz_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
 
315
done
 
316
 
 
317
ac_libggz_libraries="$libggz_libdir"
 
318
 
 
319
if test "$ac_libggz_includes" = NO || test "$ac_libggz_libraries" = NO; then
 
320
  ac_cv_have_libggz="have_libggz=no"
 
321
  ac_libggz_notfound=""
 
322
else
 
323
  have_libggz="yes"
 
324
fi
 
325
])
 
326
 
 
327
eval "$ac_cv_have_libggz"
 
328
 
 
329
if test "$have_libggz" != yes; then
 
330
  if test "x$2" = "xignore"; then
 
331
    AC_MSG_RESULT([$have_libggz (ignored)])
 
332
  else
 
333
    AC_MSG_RESULT([$have_libggz])
 
334
    if test "x$2" = "x"; then
 
335
      AC_GGZ_ERROR(libggz, $libggz_incdirs, $libggz_libdirs)
 
336
    fi
 
337
 
 
338
    # perform actions given by argument 2.
 
339
    $2
 
340
  fi
 
341
else
 
342
  ac_cv_have_libggz="have_libggz=yes \
 
343
    ac_libggz_includes=$ac_libggz_includes ac_libggz_libraries=$ac_libggz_libraries"
 
344
  AC_MSG_RESULT([$have_libggz (libraries $ac_libggz_libraries, headers $ac_libggz_includes)])
 
345
 
 
346
  libggz_libraries="$ac_libggz_libraries"
 
347
  libggz_includes="$ac_libggz_includes"
 
348
 
 
349
  AC_SUBST(libggz_libraries)
 
350
  AC_SUBST(libggz_includes)
 
351
 
 
352
  LIBGGZ_INCLUDES="-I $libggz_includes"
 
353
  LIBGGZ_LDFLAGS="-L$libggz_libraries"
 
354
 
 
355
  AC_SUBST(LIBGGZ_INCLUDES)
 
356
  AC_SUBST(LIBGGZ_LDFLAGS)
 
357
 
 
358
  LIB_GGZ='-lggz'
 
359
  AC_SUBST(LIB_GGZ)
 
360
 
 
361
  # perform actions given by argument 1.
 
362
  $1
 
363
fi
 
364
 
 
365
])
 
366
 
 
367
dnl ------------------------------------------------------------------------
 
368
dnl Try to find the ggzcore headers and libraries.
 
369
dnl $(GGZCORE_LDFLAGS) will be -L ... (if needed)
 
370
dnl and $(GGZCORE_INCLUDES) will be -I ... (if needed)
 
371
dnl ------------------------------------------------------------------------
 
372
dnl
 
373
AC_DEFUN([AC_GGZ_GGZCORE],
 
374
[
 
375
AC_MSG_CHECKING([for GGZ library: ggzcore])
 
376
 
 
377
ac_ggzcore_includes=NO ac_ggzcore_libraries=NO
 
378
ggzcore_libraries=""
 
379
ggzcore_includes=""
 
380
 
 
381
AC_ARG_WITH(ggzcore-dir,
 
382
    AC_HELP_STRING([--with-ggzcore-dir=DIR],[ggzcore installation prefix]),
 
383
    [  ac_ggzcore_includes="$withval"/include
 
384
       ac_ggzcore_libraries="$withval"/lib
 
385
    ])
 
386
AC_ARG_WITH(ggzcore-includes,
 
387
    AC_HELP_STRING([--with-ggzcore-includes=DIR],
 
388
                   [where the ggzcore includes are]),
 
389
    [  ac_ggzcore_includes="$withval"
 
390
    ])
 
391
AC_ARG_WITH(ggzcore-libraries,
 
392
    AC_HELP_STRING([--with-ggzcore-libraries=DIR],
 
393
                   [where the ggzcore libs are]),
 
394
    [  ac_ggzcore_libraries="$withval"
 
395
    ])
 
396
 
 
397
AC_CACHE_VAL(ac_cv_have_ggzcore,
 
398
[
 
399
ggzcore_incdirs="$ac_ggzcore_includes $ac_ggz_stdinc"
 
400
AC_GGZ_REMOVEDUPS($ggzcore_incdirs, ggzcore_incdirs)
 
401
ggzcore_header=ggzcore.h
 
402
 
 
403
AC_GGZ_FIND_FILE($ggzcore_header, $ggzcore_incdirs, ggzcore_incdir)
 
404
ac_ggzcore_includes="$ggzcore_incdir"
 
405
 
 
406
ggzcore_libdirs="$ac_ggzcore_libraries $ac_ggz_stdlib"
 
407
AC_GGZ_REMOVEDUPS($ggzcore_libdirs, ggzcore_libdirs)
 
408
 
 
409
ggzcore_libdir=NO
 
410
for dir in $ggzcore_libdirs; do
 
411
  try="ls -1 $dir/libggzcore.la $dir/libggzcore.so"
 
412
  if test -n "`$try 2> /dev/null`"; then ggzcore_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
 
413
done
 
414
 
 
415
ac_ggzcore_libraries="$ggzcore_libdir"
 
416
 
 
417
if test "$ac_ggzcore_includes" = NO || test "$ac_ggzcore_libraries" = NO; then
 
418
  ac_cv_have_ggzcore="have_ggzcore=no"
 
419
  ac_ggzcore_notfound=""
 
420
else
 
421
  have_ggzcore="yes"
 
422
fi
 
423
])
 
424
 
 
425
eval "$ac_cv_have_ggzcore"
 
426
 
 
427
if test "$have_ggzcore" != yes; then
 
428
  if test "x$2" = "xignore"; then
 
429
    AC_MSG_RESULT([$have_ggzcore (intentionally ignored)])
 
430
  else
 
431
    AC_MSG_RESULT([$have_ggzcore])
 
432
    if test "x$2" = "x"; then
 
433
      AC_GGZ_ERROR(ggzcore, $ggzcore_incdirs, $ggzcore_libdirs)
 
434
    fi
 
435
 
 
436
    # Perform actions given by argument 2.
 
437
    $2
 
438
  fi
 
439
else
 
440
  ac_cv_have_ggzcore="have_ggzcore=yes \
 
441
    ac_ggzcore_includes=$ac_ggzcore_includes ac_ggzcore_libraries=$ac_ggzcore_libraries"
 
442
  AC_MSG_RESULT([$have_ggzcore (libraries $ac_ggzcore_libraries, headers $ac_ggzcore_includes)])
 
443
 
 
444
  ggzcore_libraries="$ac_ggzcore_libraries"
 
445
  ggzcore_includes="$ac_ggzcore_includes"
 
446
 
 
447
  AC_SUBST(ggzcore_libraries)
 
448
  AC_SUBST(ggzcore_includes)
 
449
 
 
450
  GGZCORE_INCLUDES="-I $ggzcore_includes"
 
451
  GGZCORE_LDFLAGS="-L$ggzcore_libraries"
 
452
 
 
453
  AC_SUBST(GGZCORE_INCLUDES)
 
454
  AC_SUBST(GGZCORE_LDFLAGS)
 
455
 
 
456
  LIB_GGZCORE='-lggzcore'
 
457
  AC_SUBST(LIB_GGZCORE)
 
458
 
 
459
  # Perform actions given by argument 1.
 
460
  $1
 
461
fi
 
462
 
 
463
])
 
464
 
 
465
dnl ------------------------------------------------------------------------
 
466
dnl Try to find the ggz-config binary.
 
467
dnl Sets GGZ_CONFIG to the path/name of the program.
 
468
dnl Sets also: ggz_gamedir, ggz_datadir etc.
 
469
dnl ------------------------------------------------------------------------
 
470
dnl
 
471
AC_DEFUN([AC_GGZ_CONFIG],
 
472
[
 
473
AC_MSG_CHECKING([for GGZ configuration tool: ggz-config])
 
474
 
 
475
ac_ggz_config=NO
 
476
ggz_config=""
 
477
 
 
478
AC_ARG_WITH(ggzconfig,
 
479
    AC_HELP_STRING([--with-ggzconfig=DIR],[path to ggz-config]),
 
480
    [  ac_ggz_config="$withval"
 
481
    ])
 
482
 
 
483
ac_ggz_config_orig=$ac_ggz_config
 
484
 
 
485
AC_CACHE_VAL(ac_cv_have_ggzconfig,
 
486
[
 
487
ggz_config_dirs="$ac_ggz_config $ac_ggz_stdbin"
 
488
 
 
489
AC_GGZ_FIND_FILE(ggz-config, $ggz_config_dirs, ggz_config_dir)
 
490
ac_ggz_config="$ggz_config_dir"
 
491
 
 
492
if test "$ac_ggz_config" = NO; then
 
493
  ac_cv_have_ggzcore="have_ggz_config=no"
 
494
  ac_ggz_config_notfound=""
 
495
  have_ggz_config="no"
 
496
else
 
497
  have_ggz_config="yes"
 
498
fi
 
499
])
 
500
 
 
501
eval "$ac_cv_have_ggz_config"
 
502
 
 
503
if test "$have_ggz_config" != yes; then
 
504
  if test "x$2" = "xignore"; then
 
505
    AC_MSG_RESULT([$have_ggz_config (intentionally ignored)])
 
506
    GGZ_CONFIG="true"
 
507
    ggzexecmoddir="\${libdir}/ggz"
 
508
    ggzdatadir="\${datadir}/ggz"
 
509
    AC_SUBST(GGZ_CONFIG)
 
510
    AC_SUBST(ggzexecmoddir)
 
511
    AC_SUBST(ggzdatadir)
 
512
    AC_DEFINE_UNQUOTED(GAMEDIR, "${libdir}/ggz", [Path where to install the games])
 
513
    AC_DEFINE_UNQUOTED(GGZDATADIR, "${datadir}/ggz", [Path where the games should look for their data files])
 
514
  else
 
515
    AC_MSG_RESULT([$have_ggz_config])
 
516
    if test "x$2" = "x"; then
 
517
      AC_MSG_ERROR([ggz-config not found. Please check your installation! ])
 
518
    fi
 
519
 
 
520
    # Perform actions given by argument 2.
 
521
    $2
 
522
  fi
 
523
else
 
524
  pathto_app=`echo $prefix/bin/ | tr -s "/"`
 
525
  pathto_ggz=`echo $ac_ggz_config/ | tr -s "/"`
 
526
 
 
527
  if test "$ac_ggz_config_orig" != "NO"; then
 
528
    pathto_app=$pathto_ggz
 
529
  fi
 
530
 
 
531
  if test "x$pathto_app" != "x$pathto_ggz"; then
 
532
    AC_MSG_RESULT([$have_ggz_config (dismissed due to different prefix)])
 
533
    GGZ_CONFIG="true"
 
534
    ggzexecmoddir="\${libdir}/ggz"
 
535
    ggzdatadir="\${datadir}/ggz"
 
536
    AC_SUBST(GGZ_CONFIG)
 
537
    AC_SUBST(ggzexecmoddir)
 
538
    AC_SUBST(ggzdatadir)
 
539
    AC_DEFINE_UNQUOTED(GGZMODULECONFDIR, "${prefix}/etc", [Path where the game registry is located])
 
540
    AC_DEFINE_UNQUOTED(GAMEDIR, "${libdir}/ggz", [Path where to install the games])
 
541
    AC_DEFINE_UNQUOTED(GGZDATADIR, "${datadir}/ggz", [Path where the games should look for their data files])
 
542
  else
 
543
    ac_cv_have_ggz_config="have_ggz_config=yes \
 
544
      ac_ggz_config=$ac_ggz_config"
 
545
    AC_MSG_RESULT([$ac_ggz_config/ggz-config])
 
546
 
 
547
    ggz_config="$ac_ggz_config"
 
548
    AC_SUBST(ggz_config)
 
549
 
 
550
    AC_ARG_ENABLE([noregistry],
 
551
      AC_HELP_STRING([--enable-noregistry], [Do not register game modules.]),
 
552
      [enable_noregistry=yes], [enable_noregistry=no])
 
553
 
 
554
    GGZ_CONFIG="${ggz_config}/ggz-config"
 
555
    if test "$enable_noregistry" = yes; then
 
556
      GGZ_CONFIG="$GGZ_CONFIG --noregistry=$enableval"
 
557
    fi
 
558
    AC_SUBST(GGZ_CONFIG)
 
559
 
 
560
    ggzmoduleconfdir=`$GGZ_CONFIG --configdir`
 
561
    AC_DEFINE_UNQUOTED(GGZMODULECONFDIR, "${ggzmoduleconfdir}", [Path where the game registry is located])
 
562
    ggzexecmoddir=`$GGZ_CONFIG --gamedir`
 
563
    AC_DEFINE_UNQUOTED(GAMEDIR, "${ggzexecmoddir}", [Path where to install the games])
 
564
    ggzdatadir=`$GGZ_CONFIG --datadir`
 
565
    AC_DEFINE_UNQUOTED(GGZDATADIR, "${ggzdatadir}", [Path where the games should look for their data files])
 
566
    packagesrcdir=`cd $srcdir && pwd`
 
567
    AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [Path where the source is located])
 
568
 
 
569
    if test "$ggzmoduleconfdir" = ""; then
 
570
      AC_MSG_ERROR([ggz-config is unusable. Maybe LD_LIBRARY_PATH needs to be set.])
 
571
    fi
 
572
 
 
573
    AC_SUBST(ggzmoduleconfdir)
 
574
    AC_SUBST(ggzexecmoddir)
 
575
    AC_SUBST(ggzdatadir)
 
576
    AC_SUBST(packagesrcdir)
 
577
 
 
578
    # Perform actions given by argument 1.
 
579
    $1
 
580
  fi
 
581
fi
 
582
 
 
583
])
 
584
 
 
585
dnl ------------------------------------------------------------------------
 
586
dnl Try to find the ggzmod headers and libraries.
 
587
dnl $(GGZMOD_LDFLAGS) will be -L ... (if needed)
 
588
dnl and $(GGZMOD_INCLUDES) will be -I ... (if needed)
 
589
dnl ------------------------------------------------------------------------
 
590
dnl
 
591
AC_DEFUN([AC_GGZ_GGZMOD],
 
592
[
 
593
AC_MSG_CHECKING([for GGZ library: ggzmod])
 
594
 
 
595
ac_ggzmod_includes=NO ac_ggzmod_libraries=NO
 
596
ggzmod_libraries=""
 
597
ggzmod_includes=""
 
598
 
 
599
AC_ARG_WITH(ggzmod-dir,
 
600
    AC_HELP_STRING([--with-ggzmod-dir=DIR],[ggzmod installation prefix]),
 
601
    [  ac_ggzmod_includes="$withval"/include
 
602
       ac_ggzmod_libraries="$withval"/lib
 
603
    ])
 
604
AC_ARG_WITH(ggzmod-includes,
 
605
    AC_HELP_STRING([--with-ggzmod-includes=DIR],
 
606
                   [where the ggzmod includes are]),
 
607
    [  ac_ggzmod_includes="$withval"
 
608
    ])
 
609
AC_ARG_WITH(ggzmod-libraries,
 
610
    AC_HELP_STRING([--with-ggzmod-libraries=DIR],
 
611
                   [where the ggzmod libs are]),
 
612
    [  ac_ggzmod_libraries="$withval"
 
613
    ])
 
614
 
 
615
AC_CACHE_VAL(ac_cv_have_ggzmod,
 
616
[
 
617
ggzmod_incdirs="$ac_ggzmod_includes $ac_ggz_stdinc"
 
618
AC_GGZ_REMOVEDUPS($ggzmod_incdirs, ggzmod_incdirs)
 
619
ggzmod_header=ggzmod.h
 
620
 
 
621
AC_GGZ_FIND_FILE($ggzmod_header, $ggzmod_incdirs, ggzmod_incdir)
 
622
ac_ggzmod_includes="$ggzmod_incdir"
 
623
 
 
624
ggzmod_libdirs="$ac_ggzmod_libraries $ac_ggz_stdlib"
 
625
AC_GGZ_REMOVEDUPS($ggzmod_libdirs, ggzmod_libdirs)
 
626
 
 
627
ggzmod_libdir=NO
 
628
for dir in $ggzmod_libdirs; do
 
629
  try="ls -1 $dir/libggzmod.la $dir/libggzmod.so"
 
630
  if test -n "`$try 2> /dev/null`"; then ggzmod_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
 
631
done
 
632
 
 
633
ac_ggzmod_libraries="$ggzmod_libdir"
 
634
 
 
635
if test "$ac_ggzmod_includes" = NO || test "$ac_ggzmod_libraries" = NO; then
 
636
  ac_cv_have_ggzmod="have_ggzmod=no"
 
637
  ac_ggzmod_notfound=""
 
638
else
 
639
  have_ggzmod="yes"
 
640
fi
 
641
])
 
642
 
 
643
eval "$ac_cv_have_ggzmod"
 
644
 
 
645
if test "$have_ggzmod" != yes; then
 
646
  if test "x$2" = "xignore"; then
 
647
    AC_MSG_RESULT([$have_ggzmod (intentionally ignored)])
 
648
  else
 
649
    AC_MSG_RESULT([$have_ggzmod])
 
650
    if test "x$2" = "x"; then
 
651
      AC_GGZ_ERROR(ggzmod, $ggzmod_incdirs, $ggzmod_libdirs)
 
652
    fi
 
653
 
 
654
    # Perform actions given by argument 2.
 
655
    $2
 
656
  fi
 
657
else
 
658
  ac_cv_have_ggzmod="have_ggzmod=yes \
 
659
    ac_ggzmod_includes=$ac_ggzmod_includes ac_ggzmod_libraries=$ac_ggzmod_libraries"
 
660
  AC_MSG_RESULT([$have_ggzmod (libraries $ac_ggzmod_libraries, headers $ac_ggzmod_includes)])
 
661
 
 
662
  ggzmod_libraries="$ac_ggzmod_libraries"
 
663
  ggzmod_includes="$ac_ggzmod_includes"
 
664
 
 
665
  AC_SUBST(ggzmod_libraries)
 
666
  AC_SUBST(ggzmod_includes)
 
667
 
 
668
  GGZMOD_INCLUDES="-I $ggzmod_includes"
 
669
  GGZMOD_LDFLAGS="-L$ggzmod_libraries"
 
670
 
 
671
  AC_SUBST(GGZMOD_INCLUDES)
 
672
  AC_SUBST(GGZMOD_LDFLAGS)
 
673
 
 
674
  LIB_GGZMOD='-lggzmod'
 
675
  AC_SUBST(LIB_GGZMOD)
 
676
 
 
677
  # Perform actions given by argument 1.
 
678
  $1
 
679
fi
 
680
 
 
681
])
 
682
 
 
683
dnl ------------------------------------------------------------------------
 
684
dnl Try to find the ggzdmod headers and libraries.
 
685
dnl $(GGZDMOD_LDFLAGS) will be -L ... (if needed)
 
686
dnl and $(GGZDMOD_INCLUDES) will be -I ... (if needed)
 
687
dnl ------------------------------------------------------------------------
 
688
dnl
 
689
AC_DEFUN([AC_GGZ_GGZDMOD],
 
690
[
 
691
AC_MSG_CHECKING([for GGZ library: ggzdmod])
 
692
 
 
693
ac_ggzdmod_includes=NO ac_ggzdmod_libraries=NO
 
694
ggzdmod_libraries=""
 
695
ggzdmod_includes=""
 
696
 
 
697
AC_ARG_WITH(ggzdmod-dir,
 
698
    AC_HELP_STRING([--with-ggzdmod-dir=DIR], [ggzdmod installation prefix]),
 
699
    [  ac_ggzdmod_includes="$withval"/include
 
700
       ac_ggzdmod_libraries="$withval"/lib
 
701
    ])
 
702
AC_ARG_WITH(ggzdmod-includes,
 
703
    AC_HELP_STRING([--with-ggzdmod-includes=DIR], 
 
704
                   [where the ggzdmod includes are]),
 
705
    [  ac_ggzdmod_includes="$withval"
 
706
    ])
 
707
AC_ARG_WITH(ggzdmod-libraries,
 
708
    AC_HELP_STRING([--with-ggzdmod-libraries=DIR],
 
709
                   [where the ggzdmod libs are]),
 
710
    [  ac_ggzdmod_libraries="$withval"
 
711
    ])
 
712
 
 
713
AC_CACHE_VAL(ac_cv_have_ggzdmod,
 
714
[
 
715
ggzdmod_incdirs="$ac_ggzdmod_includes $ac_ggz_stdinc"
 
716
AC_GGZ_REMOVEDUPS($ggzdmod_incdirs, ggzdmod_incdirs)
 
717
ggzdmod_header=ggzdmod.h
 
718
 
 
719
AC_GGZ_FIND_FILE($ggzdmod_header, $ggzdmod_incdirs, ggzdmod_incdir)
 
720
ac_ggzdmod_includes="$ggzdmod_incdir"
 
721
 
 
722
ggzdmod_libdirs="$ac_ggzdmod_libraries $ac_ggz_stdlib"
 
723
AC_GGZ_REMOVEDUPS($ggzdmod_libdirs, ggzdmod_libdirs)
 
724
 
 
725
ggzdmod_libdir=NO
 
726
for dir in $ggzdmod_libdirs; do
 
727
  try="ls -1 $dir/libggzdmod.la $dir/libggzdmod.so"
 
728
  if test -n "`$try 2> /dev/null`"; then ggzdmod_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
 
729
done
 
730
 
 
731
ac_ggzdmod_libraries="$ggzdmod_libdir"
 
732
 
 
733
if test "$ac_ggzdmod_includes" = NO || test "$ac_ggzdmod_libraries" = NO; then
 
734
  ac_cv_have_ggzdmod="have_ggzdmod=no"
 
735
  ac_ggzdmod_notfound=""
 
736
else
 
737
  have_ggzdmod="yes"
 
738
fi
 
739
])
 
740
 
 
741
eval "$ac_cv_have_ggzdmod"
 
742
 
 
743
if test "$have_ggzdmod" != yes; then
 
744
  if test "x$2" = "xignore"; then
 
745
    AC_MSG_RESULT([$have_ggzdmod (intentionally ignored)])
 
746
  else
 
747
    AC_MSG_RESULT([$have_ggzdmod])
 
748
    if test "x$2" = "x"; then
 
749
      AC_GGZ_ERROR(ggzdmod, $ggzdmod_incdirs, $ggzdmod_libdirs)
 
750
    fi
 
751
 
 
752
    # Perform actions given by argument 2.
 
753
    $2
 
754
  fi
 
755
else
 
756
  ac_cv_have_ggzdmod="have_ggzdmod=yes \
 
757
    ac_ggzdmod_includes=$ac_ggzdmod_includes ac_ggzdmod_libraries=$ac_ggzdmod_libraries"
 
758
  AC_MSG_RESULT([$have_ggzdmod (libraries $ac_ggzdmod_libraries, headers $ac_ggzdmod_includes)])
 
759
 
 
760
  ggzdmod_libraries="$ac_ggzdmod_libraries"
 
761
  ggzdmod_includes="$ac_ggzdmod_includes"
 
762
 
 
763
  AC_SUBST(ggzdmod_libraries)
 
764
  AC_SUBST(ggzdmod_includes)
 
765
 
 
766
  GGZDMOD_INCLUDES="-I $ggzdmod_includes"
 
767
  GGZDMOD_LDFLAGS="-L$ggzdmod_libraries"
 
768
 
 
769
  AC_SUBST(GGZDMOD_INCLUDES)
 
770
  AC_SUBST(GGZDMOD_LDFLAGS)
 
771
 
 
772
  LIB_GGZDMOD='-lggzdmod'
 
773
  AC_SUBST(LIB_GGZDMOD)
 
774
 
 
775
  # Perform actions given by argument 1.
 
776
  $1
 
777
fi
 
778
 
 
779
])
 
780
 
 
781
dnl ------------------------------------------------------------------------
 
782
dnl Try to find the ggz-gtk headers and libraries.
 
783
dnl $(GGZGTK_LDFLAGS) will be -L ... (if needed)
 
784
dnl and $(GGZGTK_INCLUDES) will be -I ... (if needed)
 
785
dnl ------------------------------------------------------------------------
 
786
dnl
 
787
AC_DEFUN([AC_GGZ_GTK],
 
788
[
 
789
AC_MSG_CHECKING([for GGZ library: ggz-gtk])
 
790
 
 
791
ac_ggz_gtk_includes=NO ac_ggz_gtk_libraries=NO
 
792
ggz_gtk_libraries=""
 
793
ggz_gtk_includes=""
 
794
 
 
795
AC_ARG_WITH(ggz-gtk-dir,
 
796
    AC_HELP_STRING([--with-ggz-gtk-dir=DIR], [ggz-gtk installation prefix]),
 
797
    [  ac_ggz_gtk_includes="$withval"/include
 
798
       ac_ggz_gtk_libraries="$withval"/lib
 
799
    ])
 
800
AC_ARG_WITH(ggz-gtk-includes,
 
801
    AC_HELP_STRING([--with-ggz-gtk-includes=DIR], 
 
802
                   [where the ggz-gtk includes are]),
 
803
    [  ac_ggz_gtk_includes="$withval"
 
804
    ])
 
805
AC_ARG_WITH(ggz-gtk-libraries,
 
806
    AC_HELP_STRING([--with-ggz-gtk-libraries=DIR],
 
807
                   [where the ggz-gtk libs are]),
 
808
    [  ac_ggz_gtk_libraries="$withval"
 
809
    ])
 
810
 
 
811
AC_CACHE_VAL(ac_cv_have_ggz_gtk,
 
812
[
 
813
ggz_gtk_incdirs="$ac_ggz_gtk_includes $ac_ggz_stdinc"
 
814
AC_GGZ_REMOVEDUPS($ggz_gtk_incdirs, ggz_gtk_incdirs)
 
815
ggz_gtk_header=ggz-gtk.h
 
816
 
 
817
AC_GGZ_FIND_FILE($ggz_gtk_header, $ggz_gtk_incdirs, ggz_gtk_incdir)
 
818
ac_ggz_gtk_includes="$ggz_gtk_incdir"
 
819
 
 
820
ggz_gtk_libdirs="$ac_ggz_gtk_libraries $ac_ggz_stdlib"
 
821
AC_GGZ_REMOVEDUPS($ggz_gtk_libdirs, ggz_gtk_libdirs)
 
822
 
 
823
ggz_gtk_libdir=NO
 
824
for dir in $ggz_gtk_libdirs; do
 
825
  try="ls -1 $dir/libggz-gtk.la $dir/libggz-gtk.so"
 
826
  if test -n "`$try 2> /dev/null`"; then ggz_gtk_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
 
827
done
 
828
 
 
829
ac_ggz_gtk_libraries="$ggz_gtk_libdir"
 
830
 
 
831
if test "$ac_ggz_gtk_includes" = NO || test "$ac_ggz_gtk_libraries" = NO; then
 
832
  ac_cv_have_ggz_gtk="have_ggz_gtk=no"
 
833
  ac_ggz_gtk_notfound=""
 
834
else
 
835
  have_ggz_gtk="yes"
 
836
fi
 
837
])
 
838
 
 
839
eval "$ac_cv_have_ggz_gtk"
 
840
 
 
841
if test "$have_ggz_gtk" != yes; then
 
842
  if test "x$2" = "xignore"; then
 
843
    AC_MSG_RESULT([$have_ggz_gtk (intentionally ignored)])
 
844
  else
 
845
    AC_MSG_RESULT([$have_ggz_gtk])
 
846
    if test "x$2" = "x"; then
 
847
      AC_GGZ_ERROR(ggz-gtk, $ggz_gtk_incdirs, $ggz_gtk_libdirs)
 
848
    fi
 
849
 
 
850
    # Perform actions given by argument 2.
 
851
    $2
 
852
  fi
 
853
else
 
854
  ac_cv_have_ggz_gtk="have_ggz_gtk=yes \
 
855
    ac_ggz_gtk_includes=$ac_ggz_gtk_includes ac_ggz_gtk_libraries=$ac_ggz_gtk_libraries"
 
856
  AC_MSG_RESULT([$have_ggz_gtk (libraries $ac_ggz_gtk_libraries, headers $ac_ggz_gtk_includes)])
 
857
 
 
858
  ggz_gtk_libraries="$ac_ggz_gtk_libraries"
 
859
  ggz_gtk_includes="$ac_ggz_gtk_includes"
 
860
 
 
861
  AC_SUBST(ggz_gtk_libraries)
 
862
  AC_SUBST(ggz_gtk_includes)
 
863
 
 
864
  GGZ_GTK_INCLUDES="-I $ggz_gtk_includes"
 
865
  GGZ_GTK_LDFLAGS="-L$ggz_gtk_libraries"
 
866
 
 
867
  AC_SUBST(GGZ_GTK_INCLUDES)
 
868
  AC_SUBST(GGZ_GTK_LDFLAGS)
 
869
 
 
870
  LIB_GGZ_GTK='-lggz-gtk'
 
871
  AC_SUBST(LIB_GGZ_GTK)
 
872
 
 
873
  # Perform actions given by argument 1.
 
874
  $1
 
875
fi
 
876
])
 
877
 
 
878
dnl ------------------------------------------------------------------------
 
879
dnl Setup the game server configuration.
 
880
dnl Sets ggzdconfdir (ggzd configuration).
 
881
dnl Sets ggzddatadir (for game server data).
 
882
dnl ------------------------------------------------------------------------
 
883
dnl
 
884
AC_DEFUN([AC_GGZ_SERVER],
 
885
[
 
886
AC_MSG_CHECKING([for GGZ server: ggzd])
 
887
AC_ARG_WITH(ggzd-confdir,
 
888
    AC_HELP_STRING([--with-ggzd-confdir=DIR], [directory for room/game data]),
 
889
[ ac_ggzd_confdir="$withval"
 
890
])
 
891
 
 
892
AC_CACHE_VAL(ac_cv_have_ggzdconf,
 
893
[
 
894
        if test "x$1" = "xforce"; then
 
895
                if test "x$ac_ggzd_confdir" = "x"; then
 
896
                        ggzdconfdirs="$ac_ggz_stdetc"
 
897
                else
 
898
                        ggzdconfdirs="$ac_ggzd_confdir"
 
899
                fi
 
900
        else
 
901
                ggzdconfdirs="$ac_ggzd_confdir $ac_ggz_stdetc"
 
902
        fi
 
903
 
 
904
        ggzdconfdir=NONE
 
905
        for dir in $ggzdconfdirs; do
 
906
                if test -n "`ls -d $dir/rooms 2> /dev/null`"; then
 
907
                        if test -n "`ls -d $dir/rooms 2> /dev/null`"; then
 
908
                                ggzdconfdir=$dir; break;
 
909
                        else
 
910
                                echo "tried $dir" >&AC_FD_CC;
 
911
                        fi
 
912
                else
 
913
                        echo "tried $dir" >&AC_FD_CC;
 
914
                fi
 
915
        done
 
916
 
 
917
        if test "x$ggzdconfdir" = "xNONE"; then
 
918
                have_ggzdconf="no"
 
919
        else
 
920
                have_ggzdconf="yes"
 
921
        fi
 
922
])
 
923
 
 
924
eval "$ac_cv_have_ggzdconf"
 
925
 
 
926
if test "$have_ggzdconf" != yes; then
 
927
        if test "x$2" = "xignore"; then
 
928
          AC_MSG_RESULT([$have_ggzdconf (intentionally ignored)])
 
929
        elif test "x$2" = "xforce"; then
 
930
          if test "x$ac_ggzd_confdir" = "x"; then
 
931
            ggzdconfdir="\${prefix}/etc/ggzd"
 
932
          else
 
933
            ggzdconfdir=$ac_ggzd_confdir
 
934
          fi
 
935
          AC_MSG_RESULT([$have_ggzdconf (but forced to ${ggzdconfdir})])
 
936
        else
 
937
          AC_MSG_RESULT([$have_ggzdconf])
 
938
          if test "x$2" = "x"; then
 
939
            AC_MSG_ERROR([GGZ server configuration not found. Please check your installation! ])
 
940
          fi
 
941
 
 
942
          # Perform actions given by argument 2.
 
943
          $2
 
944
        fi
 
945
else
 
946
        prefixed=0
 
947
        if test "x${prefix}" != "xNONE" && test "x${prefix}" != "x${ac_default_prefix}"; then
 
948
                if test "x$ac_ggzd_confdir" = "x"; then
 
949
                        prefixed=1
 
950
                fi
 
951
        fi
 
952
        if test "x$ggzdconfdir" != "x${prefix}/etc/ggzd" && test "x$prefixed" = "x1"; then
 
953
                AC_MSG_RESULT([$have_ggzdconf ($ggzdconfdir, but using ${prefix}/etc/ggzd nevertheless)])
 
954
                ggzdconfdir="\${prefix}/etc/ggzd"
 
955
        else
 
956
                AC_MSG_RESULT([$have_ggzdconf ($ggzdconfdir)])
 
957
        fi
 
958
fi
 
959
 
 
960
if test "$have_ggzdconf" = yes || test "x$2" = "xforce"; then
 
961
        AC_SUBST(ggzdconfdir)
 
962
 
 
963
        ggzddatadir=${datadir}/${PACKAGE}
 
964
        AC_DEFINE_UNQUOTED(GGZDDATADIR, "${ggzddatadir}", [Game server data directory])
 
965
        AC_SUBST(ggzddatadir)
 
966
 
 
967
        if test "x${libdir}" = 'x${exec_prefix}/lib'; then
 
968
          if test "x${exec_prefix}" = "xNONE"; then
 
969
            if test "x${prefix}" = "xNONE"; then
 
970
              ggzdexecmoddir="\${ac_default_prefix}/lib/ggzd"
 
971
              ggzdexecmodpath="${ac_default_prefix}/lib/ggzd"
 
972
            else
 
973
              ggzdexecmoddir="\${prefix}/lib/ggzd"
 
974
              ggzdexecmodpath="${prefix}/lib/ggzd"
 
975
            fi
 
976
          else
 
977
            ggzdexecmoddir="\${exec_prefix}/lib/ggzd"
 
978
            ggzdexecmodpath="${exec_prefix}/lib/ggzd"
 
979
          fi
 
980
        else
 
981
          ggzdexecmoddir="\${libdir}/ggzd"
 
982
          ggzdexecmodpath="${libdir}/ggzd"
 
983
        fi
 
984
        AC_SUBST(ggzdexecmoddir)
 
985
        AC_SUBST(ggzdexecmodpath)
 
986
 
 
987
        # Perform actions given by argument 1.
 
988
        $1
 
989
fi
 
990
 
 
991
])
 
992
 
 
993
dnl ------------------------------------------------------------------------
 
994
dnl AC_GGZ_CHECK_SERVER
 
995
dnl   Check for presence of GGZ server libraries.
 
996
dnl
 
997
dnl   Simply call this function in programs that use GGZ.  GGZ_SERVER will
 
998
dnl   be #defined in config.h, and created as a conditional
 
999
dnl   in Makefile.am files, if server libraries are present.
 
1000
dnl ------------------------------------------------------------------------
 
1001
dnl
 
1002
AC_DEFUN([AC_GGZ_CHECK_SERVER],
 
1003
[
 
1004
  AC_GGZ_LIBGGZ([try_ggz="yes"], [try_ggz="no"])
 
1005
  if test "$try_ggz" = "yes"; then
 
1006
    # For now, version 0.0.14 is required.  This could be an additional
 
1007
    # parameter.
 
1008
    AC_GGZ_VERSION([0], [99], [4], [], [try_ggz=no])
 
1009
  fi
 
1010
 
 
1011
  ggz_server="no"
 
1012
  AC_ARG_WITH(ggz-server,
 
1013
              AC_HELP_STRING([--with-ggz-server], [Force GGZ server support]),
 
1014
              [try_ggz_server=$withval])
 
1015
 
 
1016
  if test "x$try_ggz_server" != "xno"; then
 
1017
    if test "$try_ggz" = "yes"; then
 
1018
      # Must pass something as the action-if-failed, or the macro will exit
 
1019
      AC_GGZ_GGZDMOD([ggz_server="yes"], [ggz_server="no"])
 
1020
    fi
 
1021
    if test "$ggz_server" = "yes"; then
 
1022
      AC_GGZ_SERVER
 
1023
      AC_DEFINE(GGZ_SERVER, 1, [Server support for GGZ])
 
1024
    else
 
1025
      if test "$try_ggz_server" = "yes"; then
 
1026
        AC_MSG_ERROR([Could not configure GGZ server support. See above messages.])
 
1027
      fi
 
1028
    fi
 
1029
  fi
 
1030
 
 
1031
  AM_CONDITIONAL(GGZ_SERVER, test "$ggz_server" = "yes")
 
1032
])
 
1033
 
 
1034
dnl ------------------------------------------------------------------------
 
1035
dnl AC_GGZ_CHECK
 
1036
dnl   Check for presence of GGZ client and server libraries.
 
1037
dnl
 
1038
dnl   Simply call this function in programs that use GGZ.  GGZ_SERVER and
 
1039
dnl   GGZ_CLIENT will be #defined in config.h, and created as conditionals
 
1040
dnl   in Makefile.am files.
 
1041
dnl
 
1042
dnl   The only argument accepted gives the frontend for client embedding:
 
1043
dnl      "gtk" => means the libggz-gtk library will be checked
 
1044
dnl ------------------------------------------------------------------------
 
1045
dnl
 
1046
AC_DEFUN([AC_GGZ_CHECK],
 
1047
[
 
1048
  AC_GGZ_INIT([defaults])
 
1049
 
 
1050
  if test x$ac_ggz_prefix != xno ; then
 
1051
    AC_GGZ_LIBGGZ([try_ggz="yes"], [try_ggz="no"])
 
1052
  else
 
1053
    try_ggz=no
 
1054
  fi
 
1055
 
 
1056
  if test "$try_ggz" = "yes"; then
 
1057
    # For now, version 0.0.14 is required.  This could be an additional
 
1058
    # parameter.
 
1059
    AC_GGZ_VERSION([0], [0], [14], [], [try_ggz=no])
 
1060
  fi
 
1061
 
 
1062
  ggz_client="no"
 
1063
  AC_ARG_WITH(ggz-client,
 
1064
              AC_HELP_STRING([--with-ggz-client], [Force GGZ client support]),
 
1065
              [try_ggz_client=$withval])
 
1066
 
 
1067
  if test "x$try_ggz_client" != "xno"; then
 
1068
    if test "$try_ggz" = "yes"; then
 
1069
      # Must pass something as the action-if-failed, or the macro will exit
 
1070
      AC_GGZ_GGZMOD([AC_GGZ_CONFIG([ggz_client="yes"], [ggz_client="no"])],
 
1071
                    [ggz_client="no"])
 
1072
    fi
 
1073
    if test "$ggz_client" = "yes"; then
 
1074
      AC_DEFINE(GGZ_CLIENT, 1, [Client support for GGZ])
 
1075
    else
 
1076
      if test "$try_ggz_client" = "yes"; then
 
1077
        AC_MSG_ERROR([Could not configure GGZ client support. See above messages.])
 
1078
      fi
 
1079
    fi
 
1080
  fi
 
1081
 
 
1082
  ggz_gtk="no"
 
1083
  if test "$ggz_client" = "yes"; then
 
1084
    if test "x$1" = "xgtk"; then
 
1085
      AC_GGZ_GTK([ggz_gtk="yes"])
 
1086
      if test $ggz_gtk = "yes"; then
 
1087
        AC_DEFINE(GGZ_GTK, 1, [Support for embedded GGZ through libggz-gtk])
 
1088
      fi
 
1089
    fi
 
1090
  fi
 
1091
 
 
1092
  AM_CONDITIONAL(GGZ_CLIENT, test "$ggz_client" = "yes")
 
1093
  AM_CONDITIONAL(GGZ_GTK, test "$ggz_gtk" = "yes")
 
1094
 
 
1095
  AC_GGZ_CHECK_SERVER
 
1096
])