1dnl Process this file with autoconf to produce a configure script.
2AC_PREREQ(2.56)
3AC_INIT([spacejunk], [1.0], [fdomin@fing.edu.uy])
4AC_CONFIG_AUX_DIR(config)
5AC_CONFIG_SRCDIR([src/vector2d.h])
6AC_CONFIG_MACRO_DIR([config])
7
8dnl Detect the canonical host and target build environment
9AC_CANONICAL_HOST
10AC_CANONICAL_TARGET
11
12dnl Check for tools
13
14AC_LIBTOOL_WIN32_DLL
15AC_PROG_LIBTOOL
16AC_PROG_CXX
17AC_PROG_CC
18AM_PROG_CC_C_O
19
20GUICHAN_RELEASE=0.8.1
21AC_SUBST(GUICHAN_RELEASE)
22
23AC_ARG_ENABLE(debug,
24 [  --enable-debug    Turn on debugging (default=no)],
25     [case "${enableval}" in
26       yes)
27	optdbg=true
28	AC_SUBST(CXXFLAGS,[" ${CXXFLAGS}"])
29	AC_SUBST(CFLAGS,[" ${CFLAGS}"])
30	AC_MSG_NOTICE("setting debug!!!!!!!!!!!!!")
31	;;
32       no)
33	optdbg=false
34	AC_SUBST(CXXFLAGS,["-O2 ${CXXFLAGS}"])
35	AC_SUBST(CFLAGS,["-O2 ${CFLAGS}"])
36	AC_MSG_NOTICE("not setting debug!!!!!!!!!!!!!")
37	;;
38       *)
39	AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
40	;;
41     esac],
42 [optdbg=false])
43
44
45AM_INIT_AUTOMAKE([1.7 foreign subdir-objects])
46
47AM_CONDITIONAL(DEBUG, test x$optdbg = xtrue)
48
49AC_CONFIG_HEADER([config.h])
50
51case "${host}" in
52 *mingw* | *MINGW* ) AC_SUBST(mingwincludes,[""])
53                     AC_SUBST(mingwdeps,["icon.o"])
54                     AC_SUBST(mingwsuffixes,[".rc"])
55                     AC_SUBST(mingwldflags,["-mwindows"])
56                     AC_SUBST(sharedsdl,["-lSDL.dll"])
57                     AC_SUBST(mingwldadd,["-lmsvcp60"])
58                     AC_SUBST(mingwltldflags,["-no-undefined"])
59	;;
60 *) AC_SUBST(sharedsdl,["-lSDL"])
61    ;;
62esac
63
64
65AM_PATH_SDL([1.2.0],,[AC_MSG_ERROR([[You can get SDL at http://www.libsdl.org]])])
66AC_CHECK_LIB([SDL], [SDL_Init],,[AC_MSG_ERROR([[You seem to have SDL but we are not able to link it.]])],[`sdl-config --static-libs`])
67AC_CHECK_LIB([SDL_image], [IMG_Load],,[AC_MSG_ERROR([[You can get SDL_image at http://www.libsdl.org/projects/SDL_image]])],[`sdl-config --static-libs`])
68AC_CHECK_LIB([SDL_mixer], [Mix_OpenAudio],,[AC_MSG_ERROR([[Get SDL_mixer at http://www.libsdl.org/projects/SDL_mixer]])],[`sdl-config --static-libs`])
69AC_SUBST(LIBS," ")
70
71# Checks for header files.
72AC_HEADER_DIRENT
73AC_HEADER_STDC
74AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
75
76# Checks for typedefs, structures, and compiler characteristics.
77AC_HEADER_STDBOOL
78AC_C_CONST
79AC_C_INLINE
80AC_STRUCT_TM
81
82# Checks for library functions.
83AC_FUNC_CLOSEDIR_VOID
84AC_FUNC_ERROR_AT_LINE
85#AC_FUNC_MALLOC
86AC_FUNC_MEMCMP
87#AC_FUNC_REALLOC
88AC_FUNC_STRTOD
89AC_CHECK_FUNCS([memset pow sqrt strtol sincosf])
90
91AC_CONFIG_FILES([Makefile
92                 src/Makefile
93                 guichan/Makefile
94				 guichan/widgets/Makefile
95				 guichan/sdl/Makefile
96				 sge030809/Makefile
97                 test/Makefile])
98# Finally create all the generated files
99AC_OUTPUT
100
101case "${optdbg}" in
102       true)
103	AC_MSG_NOTICE([Building with debugging info.])
104	;;
105       *)
106	AC_MSG_NOTICE([Building without debugging info.])
107	;;
108esac
109
110