1i#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.57)
5AC_INIT(briquolo, 0.5.7, cedric.bregardis@free.fr)
6
7dnl AC_CONFIG_SRCDIR([config.h.in])
8AC_CONFIG_SRCDIR([src/MenuJeu.h])
9dnl AC_CONFIG_HEADERS([config.h])
10AM_CONFIG_HEADER([config.h])
11
12AC_CANONICAL_TARGET
13
14AM_INIT_AUTOMAKE(dist-bzip2)
15
16# Checks for programs.
17AC_PROG_CXX
18AC_PROG_CC
19AC_PROG_INSTALL
20AC_PROG_RANLIB
21AC_PROG_YACC
22
23# Checks for header files.
24AC_FUNC_ALLOCA
25AC_HEADER_DIRENT
26AC_HEADER_STDC
27AC_CHECK_HEADERS([argz.h fcntl.h langinfo.h libintl.h limits.h locale.h malloc.h stddef.h stdio_ext.h stdlib.h string.h strings.h sys/param.h sys/timeb.h unistd.h])
28
29# Checks for typedefs, structures, and compiler characteristics.
30AC_HEADER_STDBOOL
31AC_C_CONST
32AC_C_INLINE
33AC_TYPE_SIZE_T
34AC_C_VOLATILE
35
36# Checks for library functions.
37
38AC_FUNC_MALLOC
39AC_FUNC_MMAP
40AC_FUNC_REALLOC
41AC_FUNC_STAT
42AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify getcwd mempcpy mkdir munmap nl_langinfo pow setlocale sqrt stpcpy strcasecmp strchr strcspn strdup strstr strtoul])
43
44dnl CXXFLAGS="-Wall -O3 -pipe `sdl-config --cflags` -I./"
45dnl CXXFLAGS="-Wall -Wextra -Wfloat-equal -Wshadow -Wconversion"
46dnl CXXFLAGS="-Wall"
47
48dnl Test de libfreetype
49dnl AC_CHECK_PROG(png_config,libfreetype-config,libfreetype-config,[AC_MSG_ERROR([*** Libfreetype-config not found. You need libfreetype.])])
50AC_PATH_PROG(freetypeconfig, freetype-config, ,$prefix/bin:$PATH)
51if test "x$freetypeconfig" = "x"
52then
53     echo "freetype-config not found"
54else
55     echo "freetype-config found"
56     CXXFLAGS="$CXXFLAGS `$freetypeconfig --cflags`"
57     LIBS="$LIBS `$freetypeconfig --libs`"
58fi
59
60dnl Test de libpng
61dnl AC_CHECK_PROG(png_config,libpng-config,libpng-config,[AC_MSG_ERROR([*** Libpng-config not found. You need libpng.])])
62AC_PATH_PROG(pngconfig, libpng-config, ,$prefix/bin:$PATH)
63if test "x$pngconfig" = "x"
64then
65     echo "libpng-config not found. We search for libpng manually"
66     AC_CHECK_LIB(png, png_access_version_number,,[AC_MSG_ERROR([*** You need libpng])], -lm -lz)
67     LIBS="$LIBS -lpng -lz"
68else
69     CXXFLAGS="$CXXFLAGS `$pngconfig --cppflags` `libpng-config --cflags`"
70     LIBS="$LIBS `$pngconfig --ldflags` `$pngconfig --libs`"
71fi
72
73
74dnl N�cessaire pour le test SDL
75dnl AC_CANONICAL_HOST
76dnl Test de SDL
77SDL_VERSION=1.2.4
78AM_PATH_SDL($SDL_VERSION, :, AC_MSG_ERROR([*** You need libSDL >= $SDL_VERSION ]))
79CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
80LIBS="$LIBS $SDL_LIBS"
81
82dnl On teste gettext
83AM_GNU_GETTEXT
84AM_GNU_GETTEXT_VERSION([0.14.1])
85AM_ICONV
86LIBS="$LIBS $INTLLIBS $LIBICONV"
87dnl On d�finit la variable du r�pertoire des locales
88if test "x$prefix" = "xNONE"
89then
90     LOCALEDIR=$ac_default_prefix/share/locale
91else
92     LOCALEDIR=$prefix/share/locale
93fi
94AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [R�pertoire des locale])
95
96#check host OS
97AC_MSG_CHECKING(host OS)
98case "${host}" in
99  *-*-cygwin* | *-*-mingw32* )
100    LIB_GL=opengl32
101    LIB_GLU=glu32
102    PROGRAM_EXT=".exe"
103    AC_MSG_RESULT(Host OS is Win32)
104    LIBS="-l$LIB_GL -l$LIB_GLU $LIBS"
105    LIBS="-lSDL_mixer $LIBS"
106    LIBS="-lSDL_ttf $LIBS"
107    LIBS="$LIBS -lwinmm"
108  ;;
109  *)
110    AC_PATH_X
111    if test "x$x_includes" != "x"
112    then
113        CPPFLAGS="$CPPFLAGS -I$x_includes"
114    fi
115
116    if test "x$x_libraries" != "x"
117    then
118        LIBS="$LIBS -L$x_libraries"
119    fi
120
121    LIB_GL=GL
122    LIB_GLU=GLU
123    PROGRAM_EXT=
124    AC_MSG_RESULT(Host OS is not Win32)
125    dnl Test de OpenGL
126    AC_CHECK_LIB($LIB_GL,glVertex3f,,[AC_MSG_ERROR([*** You need OpenGL])])
127
128    dnl Test de glu
129    AC_CHECK_LIB($LIB_GLU,gluLookAt,,[AC_MSG_ERROR([*** You need Glu])],  -lm )
130
131    dnl Test de SDL-mixer
132    AC_CHECK_LIB(SDL_mixer,Mix_OpenAudio,,[AC_MSG_ERROR([SDL-mixer])])
133    LIBS="$LIBS -lSDL_mixer"
134
135    dnl Test de SDL_ttf
136    AC_CHECK_LIB(SDL_ttf,TTF_Init,,[AC_MSG_ERROR([SDL_ttf])])
137    LIBS="$LIBS -lSDL_ttf"
138esac
139
140
141dnl Debugging
142AC_ARG_ENABLE(debug, [  --enable-debug          Enable debugging [default=no]], mogl_debug=1, mogl_debug=0 )
143if test $mogl_debug -eq 1
144then
145        CXXFLAGS="-Wall -g $CXXFLAGS"
146else
147        CXXFLAGS="-Wall $CXXFLAGS"
148fi
149
150CPPFLAGS="-DDATADIR_BRIQUOLO=\\\"$datadir/$PACKAGE\\\" $CPPFLAGS"
151
152AC_CONFIG_FILES([ po/Makefile.in m4/Makefile intl/Makefile
153                 Makefile
154		 desktop/Makefile
155                 data/Makefile
156                 data/data/Makefile
157                 data/tableau/Makefile
158                 data/tableau/old/Makefile
159                 data/tableau/new/Makefile
160                 src/MOGL/Makefile
161                 src/Makefile])
162AC_OUTPUT
163