1# Process this file with autoconf to produce a configure script.
2AC_INIT(freedroid, 1.0.2)
3
4dnl Setup for automake
5SDL_VERSION=1.2.3
6
7dnl Detect the canonical host and target build environment
8
9# check for windows cross-compilation tools
10AC_CANONICAL_HOST
11AC_CANONICAL_TARGET
12
13AM_INIT_AUTOMAKE
14
15AM_CONFIG_HEADER(config.h)
16
17# Checks for programs.
18#AC_PROG_AWK
19AC_PROG_CC
20AC_PROG_MAKE_SET
21
22# Checks for libraries.
23AC_CHECK_LIB([m], [sin],,
24	AC_MSG_ERROR([libm not found!!
25No maths library?? What kinda crazy system is that??]))
26
27##AC_CHECK_LIB([c], [printf],, AC_MSG_ERROR([libc not found!! ]))
28
29AC_PATH_X
30AC_PATH_XTRA
31if test x$have_x = xyes; then
32	CFLAGS="$CFLAGS $X_CFLAGS"
33fi
34
35## Check for SDL
36AC_MSG_NOTICE([[Checking for compulsory SDL libraries:]])
37
38AM_PATH_SDL($SDL_VERSION,
39            :,
40	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
41)
42CFLAGS="$CFLAGS $SDL_CFLAGS"
43LIBS="$LIBS $SDL_LIBS"
44
45AC_CHECK_LIB([SDL], [SDL_Init],, AC_MSG_ERROR([
46--------------------------------------------------
47SDL library needed for Freedroid!
48see http://www.libsdl.org/
49--------------------------------------------------]))
50
51AC_CHECK_LIB([jpeg], [jpeg_start_compress],,AC_MSG_ERROR([
52--------------------------------------------------
53libjpeg needed to run Freedroid!
54see http://www.ijg.org/
55--------------------------------------------------]))
56
57AC_CHECK_LIB([z], [compress],, AC_MSG_ERROR([
58--------------------------------------------------
59zlib is needed to run Freedroid!
60see http://www.gzip.org/zlib/
61--------------------------------------------------]))
62
63
64AC_CHECK_LIB([png], [png_read_png],, AC_MSG_ERROR([
65--------------------------------------------------
66libpng needed to run Freedroid
67see http://www.libpng.org/pub/png/libpng.html
68--------------------------------------------------]))
69
70AC_CHECK_LIB([SDL_image], [IMG_LoadJPG_RW],, AC_MSG_ERROR([
71--------------------------------------------------
72SDL_image library needed for Freedroid!
73see http://www.libsdl.org/
74--------------------------------------------------]))
75
76AC_MSG_NOTICE([[Checking for optional SDL libraries:]])
77AC_CHECK_LIB([SDL_mixer], [Mix_OpenAudio],, AC_MSG_WARN([
78--------------------------------------------------
79libSDL_mixer not found!
80you need the SDL_mixer library if you want sound!
81(see see http://www.libsdl.org/)
82--> compiling without sound support
83--------------------------------------------------]))
84
85AC_CHECK_LIB([vorbis], [ov_open],, AC_MSG_WARN([
86--------------------------------------------------
87libvorbis not found!
88You need the Vorbis libs installed if you want
89Freedroid to be able to play Ogg files (e.g. the Intro theme)
90--------------------------------------------------]))
91
92
93# Checks for header files.
94AC_HEADER_STDC
95AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/ioctl.h sys/time.h time.h \
96			  unistd.h dirent.h sys/soundcard.h])
97
98# Checks for typedefs, structures, and compiler characteristics.
99AC_C_CONST
100AC_TYPE_SIZE_T
101AC_HEADER_TIME
102
103# Checks for library functions.
104AC_TYPE_SIGNAL
105AC_CHECK_FUNCS([memset sqrt strstr strtok strcspn strspn rand])
106
107dnl Don't Check for getopt_long
108dnl just use bundled version like hello does, and gnuchess
109
110
111case "$target" in
112     *-*-cygwin* | *-*-mingw32*)
113     CFLAGS="$CFLAGS  -DFD_DATADIR='\".\"'"
114     win32=true
115     ;;
116
117     *)
118     CFLAGS="$CFLAGS  -DFD_DATADIR='\"\$(pkgdatadir)\"'"   #avoid expansion of $pkgdatadir !
119     win32=false
120     ;;
121esac
122
123dnl send a signal to automake if we're compiling for win32
124AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
125
126
127AC_CONFIG_FILES([Makefile src/Makefile])
128
129AC_OUTPUT
130