File: configure.in

package info (click to toggle)
lgeneral 0.5.0-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,980 kB
  • ctags: 1,290
  • sloc: ansic: 13,133; sh: 327; makefile: 175
file content (77 lines) | stat: -rw-r--r-- 1,936 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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(Makefile.am)

AC_PREFIX_DEFAULT(/usr)
AM_CONFIG_HEADER(config.h)

AM_INIT_AUTOMAKE(lgeneral,0.5.0)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB

dnl various CFLAGS
CFLAGS="$CFLAGS -Wall"

dnl Checks for libraries.

dnl check SDL version
AM_PATH_SDL(1.0.0,, AC_MSG_ERROR(lib SDL is needed))
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
AM_PATH_SDL(1.1.5, CFLAGS="$CFLAGS -DSDL_1_1_5",)

dnl check for pthread
ac_save_LIBS="$LIBS"
thread_flag=""
dnl first look for -pthread
LIBS="$LIBS -pthread"
AC_TRY_LINK(
        [#include <pthread.h>],
        [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
        AC_MSG_RESULT("-pthread used...")
        thread_flag="-pthread",
        dnl now look for -lpthread
        AC_MSG_RESULT("checking for -lpthread...")
        LIBS="$ac_save_LIBS"
        AC_CHECK_LIB(
                pthread,
                pthread_create,
                thread_flag="-lpthread"
		AC_MSG_RESULT(yes),
                AC_MSG_ERROR([lib pthread is needed])
        )
)
LIBS="$ac_save_LIBS"
AC_SUBST(thread_flag)

dnl check sound
sound_flag="-DWITH_SOUND"
mixer_flag="-lSDL_mixer"
AC_ARG_ENABLE( sound,
[  --disable-sound         Disables sound], sound_flag=""; mixer_flag="")

dnl check if SDL_mixer's installed
dnl if not: clear sound_flag and mixer_flag
AC_CHECK_LIB(SDL_mixer, main,
AC_MSG_RESULT("SDL_Mixer found"), 
AC_MSG_RESULT("SDL_Mixer NOT found: Audio disabled"); sound_flag=""; mixer_flag="")

AC_SUBST(sound_flag)
AC_SUBST(mixer_flag)

dnl installation path
inst_dir=$datadir/games/lgeneral
inst_flag="-DSRC_DIR=\\\"$inst_dir\\\""

AC_ARG_ENABLE( install,
[  --disable-install       No installation. Played from the source directory.], 
inst_dir=. inst_flag="-DSRC_DIR=\\\".\\\"" )

AC_SUBST(inst_flag)
AC_SUBST(inst_dir)

bindir=/usr/games
AC_SUBST(bindir)

AC_OUTPUT(Makefile lgeneral/Makefile)