File: configure.ac

package info (click to toggle)
xscorch 0.2.1~pre2-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,848 kB
  • ctags: 3,514
  • sloc: ansic: 30,552; sh: 9,843; makefile: 472; perl: 16
file content (415 lines) | stat: -rw-r--r-- 12,510 bytes parent folder | download
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
dnl $Header: /fridge/cvs/xscorch/configure.ac,v 1.13 2009-05-25 04:15:15 jacob Exp $
dnl
dnl
dnl Process this file with autoconf to produce a configure script.
dnl Copyright(c) 2001-2004 Justin David Smith
dnl
AC_PREREQ(2.50)
AC_INIT(xscorch.c)
AM_INIT_AUTOMAKE(xscorch, 0.2.1-pre2)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE


dnl Watch out for problems with prefix, datadir
dnl
test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"
test "x$datarootdir" = 'x${prefix}/share' && datarootdir="${prefix}/share"
test "x$datarootdir" = 'x${datarootdir}' && datarootdir="${prefix}/share"
dnl
test "x$datadir" = 'x${prefix}/share' && datadir="${prefix}/share"
test "x$datadir" = 'x${datarootdir}' && datadir="${prefix}/share"
test "x$mandir" = 'x${prefix}/man' && mandir="${prefix}/man"
test "x$mandir" = 'x${datarootdir}/man' && mandir="${prefix}/man"


dnl Checks for basic programs.
dnl
LIBJ_CONF_EMBEDDED
AM_PROG_CC_C_O
AC_PROG_INSTALL
AM_PROG_LIBTOOL
AC_PROG_LN_S

dnl This is a very ugly hack.  So is libtool...  ;)
LIBTOOL="$LIBTOOL --preserve-dup-deps"
AC_SUBST(LIBTOOL)


dnl Use/enable network support?
dnl
AC_MSG_CHECKING([for --enable-network flag])
AC_ARG_ENABLE(network, [  --enable-network        Enable network gameplay [yes]], , enable_network=yes)
if test "x$enable_network" != "xyes"; then
   AC_MSG_RESULT([Network play not enabled])
   NETWORK=0
else
   AC_MSG_RESULT([Network enabled])
   NETWORK=1
fi
AC_SUBST(NETWORK)
AM_CONDITIONAL(NETWORK, test "x$NETWORK" != "x0")


dnl Check for --with-readline flags
dnl
READLINE="0"
LIBREADLINE_LIBS=""
if test "x$NETWORK" = "x1"; then
   AC_MSG_CHECKING([for --with-readline flag])
   AC_ARG_WITH(readline,
   [  --with-readline         support fancy command line editing],
   WITH_READLINE=$withval, dnl yes/no - required to use / never use
   WITH_READLINE="maybe"   dnl maybe  - use if found [default]
   )
   AC_MSG_RESULT([$WITH_READLINE])
   if test "$WITH_READLINE" = "yes"; then
      AC_CHECK_LIB(readline, rl_callback_handler_install,
         [READLINE="1", LIBREADLINE_LIBS="-lreadline -ltermcap"],
         AC_MSG_ERROR([Specified --with-readline but did not find library.]))
         AC_CHECK_HEADER(readline/readline.h, ,
      AC_MSG_ERROR([Specified --with-readline; found library but not header file.
   You may need to install a readline \"development\" package.]))
   elif test "$WITH_READLINE" = "maybe"; then
      AC_CHECK_HEADER(readline/readline.h, have_readline_h=1, have_readline_h=0)
      if test "$have_readline_h" = "1"; then
         AC_CHECK_LIB(readline, rl_callback_handler_install,
                      have_readline_lib=1, have_readline_lib=0)
         if test "$have_readline_lib" = "1"; then
            FC_CHECK_READLINE_RUNTIME("", [LIBREADLINE_LIBS="-lreadline"])
         fi
      fi
   fi
else
   echo "No network support, not checking for libreadline."
fi

AM_CONDITIONAL(READLINE, test "x$READLINE" = "x1")
AC_SUBST(READLINE)
AC_SUBST(LIBREADLINE_LIBS)


dnl Check for --with-gtk flags
dnl
AC_MSG_CHECKING([for --with-gtk-12 flag])
AC_ARG_WITH(gtk-12, [  --with-gtk-12           Use GTK 1.2 instead of 2.0 [yes]], , with_gtk_12=no)
if test "x$with_gtk_12" = "xyes"; then

   AC_MSG_RESULT([using GTK 1.2])

   dnl
   dnl   BEGIN of old GTK 1.2 logic
   dnl

   dnl Disable GTK 2.0 support
   GTK20=0

   AC_MSG_CHECKING([for --with-gtk flag])
   AC_ARG_WITH(gtk, [  --with-gtk[=prefix]     Use GTK [yes]], , with_gtk=yes)
   if test "x$with_gtk" = "xno"; then
      AC_MSG_RESULT([without GTK])
      GTK_CONFIG=no
   elif test "x$with_gtk" != "xyes"; then
      GTK_SEARCH_PATH="${with_gtk}:${with_gtk}/bin/:$PATH"
      AC_MSG_RESULT("$with_gtk")
      AC_PATH_PROG(GTK_CONFIG, gtk-config, no, "$GTK_SEARCH_PATH")
   else
      dnl Check for GTK in default path to decide whether or not to build GTK frontend
      AC_MSG_RESULT([search for gtk-config])
      AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
   fi


   dnl Decide whether or not to build GTK
   dnl
   if test "x$GTK_CONFIG" = "xno"; then
      echo "gtk-config not found, disabling GTK frontend"
      GTK12=0
      GTK_LIBS=""
      GTK_CFLAGS=""
   else
      GTK12=1
      GTK_VERSION=`$GTK_CONFIG --version`
      GTK_LIBS=`$GTK_CONFIG --libs`
      GTK_CFLAGS=`$GTK_CONFIG --cflags`
      echo "GTK frontend will be built, $GTK_CONFIG, version $GTK_VERSION"
      echo "GTK link flags: $GTK_LIBS"
      echo "GTK compile flags: $GTK_CFLAGS"
   fi


   dnl Check for --with-gnome flags
   dnl
   if test "x$GTK12" = "x1"; then
      AC_MSG_CHECKING([for --with-gnome flag])
      AC_ARG_WITH(gnome, [  --with-gnome[=prefix]   Use GNOME [yes]], , with_gnome=yes)
      if test "x$with_gnome" = "xno"; then
         AC_MSG_RESULT([without GNOME])
         GNOME_CONFIG=no
      elif test "x$with_gnome" != "xyes"; then
         GNOME_SEARCH_PATH="${with_gnome}:${with_gnome}/bin/:$PATH"
         AC_MSG_RESULT("$with_gnome")
         AC_PATH_PROG(GNOME_CONFIG, gnome-config, no, "$GNOME_SEARCH_PATH")
      else
         dnl Check for GNOME in default path
         AC_MSG_RESULT([search for gnome-config])
         AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
      fi
   else
      echo "GTK missing, so disabling GNOME support."
      GNOME_CONFIG=no
   fi


   dnl Decide whether to implement GNOME-specific stuff
   dnl
   if test "x$GNOME_CONFIG" = "xno"; then
      echo "gnome-config not found, disabling GNOME-specific features"
      GNOME=0
      GNOME_DESKTOP=""
      GNOME_PIXMAPS=""
   else
      GNOME=1
      GNOME_DESKTOP=`$GNOME_CONFIG --datadir`/gnome/apps/Games/
      GNOME_PIXMAPS=`$GNOME_CONFIG --datadir`/pixmaps/
      echo "GNOME features enabled"
      echo "GNOME desktop directory:  $GNOME_DESKTOP"
      echo "GNOME pixmaps directory:  $GNOME_PIXMAPS"
   fi

   dnl
   dnl   END of old GTK 1.2 logic
   dnl

else  dnl Use GTK 2.0...

   AC_MSG_RESULT([using GTK 2.0])

   dnl
   dnl   BEGIN of new GTK 2.0 logic
   dnl

   dnl Disable old GTK and GNOME subsystems
   GTK12=0
   GNOME=0

   AM_PATH_GTK_2_0(2.2.0, [GTK20=1;
                           echo "GTK libs:  $GTK_LIBS"
                           echo "GTK flags:  $GTK_CFLAGS"],
                          [GTK20=0;
                           echo "GTK 2.0 not found, but you can ignore the errors above if you do not want an interface"])
   LIBS=

   dnl
   dnl   END of new GTK 2.0 logic
   dnl

fi    dnl Use GTK 1.2 or 2.0?


dnl Figure out if ANY GTK interface is being used.
dnl
if test "x$GTK12" = "x1" -o "x$GTK20" = "x1"; then
   ANYGTK=1
else
   ANYGTK=0
fi


dnl GTK substitutions
dnl
AM_CONDITIONAL(GTK12, test "x$GTK12" = "x1")
AM_CONDITIONAL(GTK20, test "x$GTK20" = "x1")
AM_CONDITIONAL(ANYGTK, test "x$ANYGTK" = "x1")
AC_SUBST(GTK12)
AC_SUBST(GTK20)
AC_SUBST(ANYGTK)
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)

dnl GNOME substitutions
dnl
AM_CONDITIONAL(GNOME, test "x$GNOME" = "x1")
AC_SUBST(GNOME)
AC_SUBST(GNOME_DESKTOP)
AC_SUBST(GNOME_PIXMAPS)


dnl Check for --enable-sound flag
dnl
if test "x$ANYGTK" = "x1"; then
   AC_MSG_CHECKING([for --enable-sound flag])
   AC_ARG_ENABLE(sound, [  --enable-sound          Enable sound/music [yes]], , enable_sound=yes)
   if test "x$enable_sound" != "xyes"; then
      AC_MSG_RESULT([Sound/music not enabled])
      MIKMOD=0
   else
      AC_MSG_RESULT([Sound/music enabled])
      MIKMOD=1
   fi
else
   echo "No client being built, so disabling MikMod support."
   MIKMOD=0
fi


dnl Check for --with-mikmod flags
dnl
if test "x$MIKMOD" = "x1"; then
   AM_PATH_LIBMIKMOD(3.1.5, [MIKMOD=1;
                             echo "libmikmod libs:  $LIBMIKMOD_LIBS"
                             echo "libmikmod flags:  $LIBMIKMOD_CFLAGS"],
                            [MIKMOD=0;
                             echo "libmikmod not found, but you can ignore the errors above if you do not want sound support"])
   LIBS=
fi

AM_CONDITIONAL(MIKMOD, test "x$MIKMOD" = "x1")
AC_SUBST(MIKMOD)


dnl Make sure we're building something at all...
dnl
if test "x$ANYGTK" = "x0" -a "x$NETWORK" = "x0"; then
   AC_MSG_ERROR([GTK and network support disabled. Nothing left to build!])
fi


dnl Check C structures that we will rely on later
dnl
critical_failure=0
AC_CHECK_HEADERS(sys/time.h, , critical_failure=1)
AC_CHECK_HEADERS(sys/stat.h, , critical_failure=1)
AC_CHECK_HEADERS(unistd.h, , critical_failure=1)
if test "x$critical_failure" = "x1"; then
   AC_MSG_ERROR([Required header missing, aborting.])
fi
AC_HEADER_TIME
if test "x$NETWORK" = "x1"; then
   AC_CHECK_HEADERS(sys/types.h, , critical_failure=1)
   AC_CHECK_HEADERS(sys/socket.h, , critical_failure=1)
   AC_CHECK_HEADERS(netdb.h, , critical_failure=1)
   AC_CHECK_HEADERS(netinet/in.h, , critical_failure=1)
   AC_CHECK_HEADERS(arpa/inet.h, , critical_failure=1)
   AC_CHECK_HEADERS(errno.h, , critical_failure=1)
   AC_CHECK_HEADERS(fcntl.h, , critical_failure=1)
   AC_CHECK_HEADERS(string.h, , critical_failure=1)
   if test "x$critical_failure" = "x1"; then
      AC_MSG_ERROR([Required network header missing, aborting.])
   fi
fi


dnl Checks for library functions.
dnl
AC_CHECK_FUNCS(gettimeofday, , [AC_MSG_ERROR([gettimeofday() not found, aborting.])])
AC_CHECK_FUNCS(usleep, , [AC_MSG_ERROR([usleep() not found, aborting.])])
AC_CHECK_FUNCS(memcpy, , [AC_MSG_ERROR([memcpy() not found, aborting.])])
AC_CHECK_FUNCS(memset, , [AC_MSG_ERROR([memset() not found, aborting.])])
AC_CHECK_FUNCS(vsnprintf, , [AC_MSG_ERROR([vsnprintf() not found, aborting.])])
AC_CHECK_FUNCS(stat, , [AC_MSG_ERROR([stat() not found, aborting.])])
AC_CHECK_FUNCS(strnlen)


dnl Check if we should use the built-in getopt
dnl
AC_CHECK_FUNCS(getopt_long, NEED_GETOPT=0, NEED_GETOPT=1)
AM_CONDITIONAL(NEED_GETOPT, test "x$NEED_GETOPT" = "x1")


dnl Checks for network library functions
dnl
NET_LIBS=""
AC_SUBST(NET_LIBS)
if test "x$NETWORK" = "x1"; then
   AC_CHECK_FUNCS(gethostbyname, ,
      [AC_CHECK_LIB(nsl, gethostbyname, NET_LIBS="$NET_LIBS -lnsl",
         [AC_MSG_ERROR([gethostbyname() network function not found, aborting.])])])
   AC_CHECK_FUNCS(socket, ,
      [AC_CHECK_LIB(socket, socket, NET_LIBS="$NET_LIBS -lsocket",
         [AC_MSG_ERROR([socket() network function not found, aborting.])])])
   echo "Network libraries we're linking against: "`if test "x$NET_LIBS" = "x"; then echo "(none)"; else echo "$NET_LIBS"; fi`
fi


dnl A random check
dnl
AC_CHECK_LIB(reality, convolution, , , )


dnl Checks for X Windows
dnl
if test "x$ANYGTK" = "x1"; then
   AC_PATH_XTRA
   AC_CHECK_LIB(X11, XOpenDisplay, , [AC_MSG_ERROR([libX11 is required for GTK interface, aborting.])], $X_LIBS)
   LIBS=
fi
AC_SUBST(X_LIBS)


LIBJ_PROG_CC_CFLAGS


dnl Output the makefiles and headers
dnl
AC_OUTPUT([ Makefile
            xscorch.h
            libj/libj.h
            sai/Makefile
            sconsole/Makefile
            sgame/Makefile
            sgtk/Makefile
            sgtk/swidgets/Makefile
            snet/Makefile
            snet/tcpnet/Makefile
            ssound/Makefile
            sutil/Makefile
            libj/Makefile
            libj/jreg/Makefile
            libj/jstr/Makefile
            data/Makefile
            doc/Makefile
            img/Makefile
            snd/Makefile
          ])


dnl Display final configure status
dnl
echo ""
echo "$PACKAGE $VERSION Configuration:"
echo "   Prefix:        $prefix"
echo "   Datadir:       $datadir"
echo "   Mandir:        $mandir"
echo "   CFLAGS:        $CFLAGS"
echo -n "   Sound:         "
LIBJ_PRINT_YES_NO($MIKMOD)
echo -n "   Network:       "
LIBJ_PRINT_YES_NO($NETWORK)
echo -n "   Readline:      "
LIBJ_PRINT_YES_NO($READLINE)
echo -n "   GTK 1.2:       "
LIBJ_PRINT_YES_NO($GTK12)
echo -n "   GTK 2.0:       "
LIBJ_PRINT_YES_NO($GTK20)
echo -n "   GNOME:         "
LIBJ_PRINT_YES_NO($GNOME)
echo ""

if test "x$NETWORK" = "x1"; then
   echo "*** WARNING ***"
   echo "Network games are UNSTABLE.  PLEASE read doc/NETWORK before sending in bug"
   echo "reports.  Also, check out the document if you are interested in network"
   echo "development.  We appreciate any feedback/bugfixes on the networking code."
   echo ""
fi

if test "x$MIKMOD" = "x1"; then
   echo "*** NOTE ***"
   echo "You have enabled sound support, but currently there is no music, nor are"
   echo "there sound effects in the game.  xscorch will be linked to mikmod but the"
   echo "sound options will currently do nothing.  We are currently looking for"
   echo "volunteers to create music for xscorch.  If you'd like to write us some"
   echo "tracks, please drop us an e-mail!"
   echo ""
fi