File: configure.in

package info (click to toggle)
adonthell 0.3.5-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,228 kB
  • ctags: 4,563
  • sloc: cpp: 44,102; sh: 9,553; python: 1,902; makefile: 212; lex: 51; sed: 16
file content (468 lines) | stat: -rw-r--r-- 12,334 bytes parent folder | download | duplicates (4)
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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
dnl **************************************************************
dnl Process this file with autoconf to produce a configure script.
dnl **************************************************************

AC_PREREQ(2.59)
AC_INIT([adonthell],[0.3.5],[adonthell-devel@nongnu.org],[adonthell])
dnl AC_PREFIX_PROGRAM(adonthell)

dnl Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

AM_INIT_AUTOMAKE([])
AC_CONFIG_HEADERS([config.h])

CFLAGS="-g -Wall -fno-exceptions"
CPPFLAGS=""
DEFS=""

dnl ********************
dnl Checks for programs.
dnl ********************

AC_PROG_CC
AC_PROG_CXX
AC_LANG([C])
AC_PROG_CXXCPP
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET

dnl ****
dnl i18n
dnl ****

AM_GNU_GETTEXT([external])

dnl ********************
dnl Additional arguments
dnl ********************

AC_ARG_ENABLE(unix-install,
[  --disable-unix-install Disable a Unix-like install (enabled by default)],
	unixinst=$enableval, unixinst=yes)
AC_ARG_ENABLE(memleaks,
[  --enable-memleaks      Enable check for memory leaks (disabled by default)],
	memleaks=$enableval, memleaks=no)
AC_ARG_ENABLE(doc,
[  --enable-doc           Build the Adonthell developer documentation (disabled by default)],
	builddoc=$enableval, builddoc=no)
AC_ARG_ENABLE(py-debug,
[  --disable-py-debug     Disable debugging of Python scripts (enabled by default)],
	pydebug=$enableval, pydebug=yes)
AC_ARG_WITH(ogg,
[  --with-ogg=DIR         Set where the Ogg library is located]) 
AC_ARG_WITH(vorbis,
[  --with-vorbis=DIR      Set where the Vorbis library is located])
AC_ARG_WITH(data-dir,
[  --with-data-dir=DIR    Directory where datas will be installed],
            gamedatadir="$withval", gamedatadir=none)
AC_ARG_WITH(py-libs,
[  --with-py-libs=DIR     Override Python libraries auto-detection],
            pylibs="$withval", pylibs=none)
AC_ARG_WITH(py-cflags,
[  --with-py-cflags=DIR   Override Python cflags auto-detection],
            pycflags="$withval", pycflags=none)

dnl **********************
dnl Set the data directory
dnl **********************

if test x$gamedatadir = xnone; then
  if test x$unixinst = xno; then
    gamedatadir=""
    DEFS="$DEFS -DSINGLE_DIR_INST"
    case "$target" in
      *-*-darwin*)
        makebundle="yes"
        DEFS="$DEFS -Wno-long-double"
      ;;
    esac        
  else
    case "$target" in
      *-*-cygwin* | *-*-mingw32*)
        gamedatadir=""
        DEFS="$DEFS -DSINGLE_DIR_INST"
      ;;
      *-*-beos*)
        gamedatadir="/boot/home/config/share/adonthell"
        DEFS="$DEFS -DDATA_DIR=\"\\\"$gamedatadir\\\"\""
      ;;
      *)
        gamedatadir="${datadir}/adonthell"
        DEFS="$DEFS -DDATA_DIR=\"\\\"$gamedatadir\\\"\""
      ;;
    esac
  fi
else
  DEFS="$DEFS -DDATA_DIR=\"\\\"$gamedatadir\\\"\""
fi

AM_CONDITIONAL(MAKE_BUNDLE, test x$makebundle = xyes)

dnl **********************
dnl Check for memory leaks
dnl **********************

if test x$memleaks = xyes; then
    DEFS="$DEFS -DMEMORY_LEAKS"
fi

dnl ********************
dnl Check for libraries.
dnl ********************

AC_CHECK_LIB(pthread, main,
    PTHREADS=yes,
    PTHREADS=no)

AC_CHECK_LIB(z, main,,echo "Adonthell requires Zlib. Exitting...";exit 1)

dnl *************
dnl Check for SDL
dnl *************

SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION,
    :,
	AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
)

AC_CHECK_LIB([SDL_mixer], 
	[Mix_OpenAudio], 
	[LIBS="$LIBS -lSDL_mixer"], 
	[AC_MSG_ERROR([*** SDL_mixer is required])]
)

AC_CHECK_LIB([SDL_ttf], 
	[TTF_Init], 
	[LIBS="$LIBS -lSDL_ttf"], 
	[AC_MSG_ERROR([*** SDL_ttfis required])]
)

dnl *******************
dnl Check for FreeType2
dnl *******************

AC_CHECK_FT2(6.0.0,
    :,
    AC_MSG_ERROR([*** Freetype version >= 6.0.0 not found!])
)

dnl *******************
dnl Check for OggVorbis
dnl *******************

OGG_VORBIS=no
XIPH_PATH_VORBIS(
        OGG_VORBIS="yes"
        ogg_music="enabled"
        OGG_LIBS="$VORBISFILE_LIBS $VORBIS_LIBS"
        OGG_DEFS="-DOGG_MUSIC"
        OGG_CFLAGS="$VORBIS_CFLAGS",
        AC_MSG_RESULT(Disabling OggVorbis support)
        ogg_music="disabled"
)

dnl ********************
dnl Check for Python. 
dnl ********************

if test x$pylibs = xnone; then
   
   dnl Find Python executable
   AC_PATH_PROGS(PYPACKAGE, python)

   dnl Extract the version using Python, check against 2.2+

   changequote(<<, >>)
   PYTHON_VERSION=`$PYPACKAGE -c 'import sys ; print (int(sys.version[0]) * 10 + int(sys.version[2]))'`
   PY_VERSION=`$PYPACKAGE -c 'import sys ; print sys.version[0:3]'`
   changequote([, ])

   if test $PYTHON_VERSION -lt 22; then
	echo "Sorry, you need to have Python 2.2+ installed - update your version!"
	AC_MSG_ERROR([*** Python 2.2 or better required])
   fi

   dnl Find the Python.h header file

   AC_MSG_CHECKING(for Python header files)
   changequote(<<, >>)
   PYINCLUDE=`$PYPACKAGE -c 'import sys ; print "%s/include/python%s" % (sys.prefix, sys.version[:3])'`
   changequote([, ])

   if test -r "$PYINCLUDE/Python.h"; then
      PY_CFLAGS="-I$PYINCLUDE"
   else
      AC_MSG_ERROR([Could not find Python.h in $PYINCLUDE])
   fi
   AC_MSG_RESULT(found)


   dnl Find the Python library
   AC_MSG_CHECKING(for Python library)
   PYLIB=""
   changequote(<<, >>)
   PYPREFIX=`$PYPACKAGE -c 'import sys; print sys.prefix'`
   PYLIBVER=`$PYPACKAGE -c 'import sys; print sys.version[:3]'`
   changequote([, ])

   dnl look for a framework build of python first
   fw=`echo "$PYPREFIX" | sed 's/.*\(Python\.framework\).*/\1/;'`
   if test "x$fw" == "xPython.framework"; then       
      PY_LIBS="-framework Python"
      PY_FWDIR="$PYPREFIX/lib/python$PYLIBVER/site-packages"
      PY_SPDIR="$libdir/python$PYLIBVER/site-packages"
      AC_SUBST(PY_FWDIR)
      AC_SUBST(PY_SPDIR)
      AC_MSG_RESULT(found)
   else
     py_paths="$PYPREFIX/lib64/python$PYLIBVER/config $PYPREFIX/lib64 \
	$PYPREFIX/lib/python$PYLIBVER/config $PYPREFIX/lib"
   
     dnl Try for specific version first, then the generic version, then panic

     for ppath in $py_paths ; do
       if test -r "$ppath/libpython$PYLIBVER.so" -o \
	       -r "$ppath/libpython$PYLIBVER.a"; then
         PYLIB="-L$ppath -lpython$PYLIBVER"
         break
       fi
       if test -r "$ppath/libpython.so" -o \
               -r "$ppath/libpython.a"; then
         PYLIB="-L$ppath -lpython"
         break
       fi
     done

     if test "x$PYLIB" != x ; then
       PY_LIBS="$PYLIB $PY_LIBS"
       AC_MSG_RESULT(found)
     else
       AC_MSG_ERROR([*** Python library not found])
     fi
   fi
   dnl Get the libraries that python depends on

   AC_PATH_PROG(haveldd, ldd)
   AC_MSG_CHECKING(for Python's dependencies)

   if test x$haveldd != x ; then
       changequote(<<, >>)
       py_deps=`ldd $PYPACKAGE | sed 's/\( *.*lib\([^\/]*\)\.so.*=.*$\)/-l\2/p; d' | grep -v 'stdc++'`
       for py_lib in $py_deps ; do
         if test "$py_lib" != "-lm" && test "$py_lib" != "-lc" ; then
            PY_DEPS="$PY_DEPS $py_lib"
         fi
      done
      changequote([, ])
   fi

   case $target in
       *-sun-solaris*)
         PY_DEPS="$PY_DEPS -lsocket -lnsl -ldl"
           ;;
   esac

   AC_MSG_RESULT($PY_DEPS)

   dnl only GNU ld seems to know -E flag
   if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
       PY_LIBS="-Wl,-E $PY_LIBS $PY_DEPS"
   else
       PY_LIBS="$PY_LIBS $PY_DEPS"
   fi

else
   PY_CFLAGS=${pycflags}
   AC_MSG_CHECKING(for Python cflags)
   AC_MSG_RESULT($PY_CFLAGS)
   PY_LIBS=${pylibs}
   AC_MSG_CHECKING(for Python library flags)
   AC_MSG_RESULT($PY_LIBS)
   PY_VERSION="Manually specified"   
fi

dnl See whether we should enable python debugging

AC_MSG_CHECKING(whether to enable Python debugging)
if test x$pydebug = xno; then
    AC_MSG_RESULT(no)
else
    PY_CFLAGS="$PY_CFLAGS -DPY_DEBUG"
    AC_MSG_RESULT(yes)
fi

dnl **************
dnl Check for SWIG
dnl **************

SWIG_MINVER=1.3.20
haveswig=no

AC_PATH_PROG(P_SWIG,swig,no)
if test "$P_SWIG" != "no" ; then
    $P_SWIG -version &> swig.ver

    changequote(<<, >>)
    swig_major_ver=`more swig.ver | sed 's/.* \([0-9]*\)\.[0-9]*\.[0-9]*.*/\1/p; d'`
    swig_minor_ver=`more swig.ver | sed 's/.* [0-9]*\.\([0-9]*\)\.[0-9]*.*/\1/p; d'`
    swig_micro_ver=`more swig.ver | sed 's/.* [0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p; d'`
    changequote([, ])

    rm -f swig.ver

    SWIG_VERSION="$swig_major_ver.$swig_minor_ver.$swig_micro_ver"

    if test $swig_major_ver -gt 1 -o \
            $swig_major_ver -eq 1 -a $swig_minor_ver -gt 3 -o \
            $swig_major_ver -eq 1 -a $swig_minor_ver -eq 3 -a $swig_micro_ver -gt 13 ;
    then
        haveswig=yes
    fi
fi

dnl SWIG is needed to compile the code from CVS
dnl or after making changes to the distributed code

if test x$haveswig = xno ; then
    if test -d "CVS"; then
        echo "*** To compile Adonthell from CVS, you will need SWIG ${SWIG_MINVER} or higher."
        echo "*** You can obtain the most recent version from http://www.swig.org."
        exit 1;
    else
        echo "*** NOTE: If you plan to make changes to the code you will need"
        echo "*** SWIG ${SWIG_MINVER} or higher. SWIG can be found at http://www.swig.org."
    fi
fi

dnl ********************************
dnl Check whether to build our tools
dnl ********************************

AM_CONDITIONAL(BUILD_TOOLS, false)

dnl ***************************
dnl For some tools we need GTK+
dnl ***************************

AM_CONDITIONAL(HAVE_GTK, false)

dnl ****************************************
dnl Check whether to build the documentation
dnl ****************************************

AC_MSG_CHECKING(whether to build the developer documentation)
if test x$builddoc = xno; then
	AC_MSG_RESULT(no)
else
	AC_MSG_RESULT(yes)
fi

AM_CONDITIONAL(BUILD_DOC, test x$builddoc = xyes)

dnl *****************************************************
dnl Doxygen and dot are needed to build the documentation
dnl *****************************************************

if test x$builddoc = xyes; then
        AC_PATH_PROG(P_DOXYGEN,doxygen)
        if test x$P_DOXYGEN == x ; then
                echo "Adonthell documentation requires doxygen. Exiting..."
                exit 1
        fi
        AC_PATH_PROG(P_DOT,dot)
        if test x$P_DOT == x ; then
                echo "Adonthell documentation requires dot. Exiting..."
                exit 1
        fi
fi

dnl  **************************
dnl  Check for required headers
dnl  **************************

AC_CHECK_HEADERS([SDL/SDL.h zlib.h])
AC_CHECK_HEADERS([SDL/SDL_mixer.h])
AC_CHECK_HEADERS([SDL/SDL_ttf.h])

if test x$PTHREADS = xyes; then
   AC_CHECK_HEADERS([pthread.h])
fi

if test x$OGG_VORBIS = xyes; then
   AC_CHECK_HEADERS([vorbis/vorbisfile.h]) 
fi 

AM_CONDITIONAL(HAVE_OGG_VORBIS, test x$OGG_VORBIS = xyes)

dnl ********************************
dnl Generate our compiler arguements
dnl ********************************

CXXFLAGS="$CFLAGS $DEFS $INCLUDES"

AC_SUBST(CXX) 
AC_SUBST(CXXFLAGS) 
AC_SUBST(CPPFLAGS)
AC_SUBST(LIBS) 
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
AC_SUBST(SDL_DEFS)
AC_SUBST(OGG_CFLAGS)
AC_SUBST(OGG_LIBS)
AC_SUBST(OGG_DEFS)
AC_SUBST(PY_CFLAGS)
AC_SUBST(PY_LIBS)
AC_SUBST(P_SWIG)
AC_SUBST(gamedatadir)
dnl AC_SUBST(FT2_LIBS)
dnl AC_SUBST(FT2_CFLAGS)

AC_CONFIG_FILES([ 
Makefile
adonthell.spec
doc/Makefile
doc/devel/Makefile
doc/dlgedit/Makefile
doc/dlgedit-api/Makefile
doc/items/Makefile
m4/Makefile
po/Makefile.in 
src/Makefile
src/modules/Makefile
])
AC_OUTPUT

dnl ****************
dnl Configure Status
dnl ****************

echo
echo "Adonthell v$VERSION"
echo
echo "SDL ....................... : `$SDL_CONFIG --version`"
echo "Python .................... : $PY_VERSION"
echo "Python debugging .......... : $pydebug"
echo "Freetype .................. : `freetype-config --version`"
if test x$haveswig = xyes; then
echo "SWIG ...................... : $SWIG_VERSION"
fi
echo "Ogg music ................. : $ogg_music"
echo "Building API doc .......... : $builddoc"
if test x$memleaks = xyes; then
echo "Test for Memory Leaks ..... : enabled"
fi
if test x$unixinst = xno; then
    echo "Data directory ............ : Single Directory install"
else
    echo "Data directory ............ : $gamedatadir"
fi

echo
echo "Now type 'make' to build Adonthell"
echo "Afterwards, 'make install' will install Adonthell in $prefix/bin"
echo