Implemented a new fixed version of the bitmap loading module which was tested and...
[neuro.git] / configure.ac
blobd196575db11f2ff24aba3b4b1fd321c540b1ad82
2 AC_PREREQ(2.59)
4 AC_INIT(README)
7 # NEURO_MICRO_VERSION += 1      when bug fixes were done or small changes
8 # NEURO_MINOR_VERSION += 1      when new functions and or modules were added, anything more than mere bug fixes or small changes
9 # NEURO_MAJOR_VERSION += 1      when set goals for the whole projects are met, example when neuro will be done, we will raise that by 1. After it is 1, it only raise when most(like more than half) of the code was changes.
11 NEURO_MAJOR_VERSION=0
12 NEURO_MINOR_VERSION=49
13 NEURO_MICRO_VERSION=33
14 NEURO_INTERFACE_AGE=3
15 NEURO_REVISION=7
16 NEURO_BINARY_AGE=3
17 NEURO_VERSION=$NEURO_MAJOR_VERSION.$NEURO_MINOR_VERSION.$NEURO_MICRO_VERSION
19 AC_SUBST(NEURO_MAJOR_VERSION)
20 AC_SUBST(NEURO_MINOR_VERSION)
21 AC_SUBST(NEURO_MICRO_VERSION)
22 AC_SUBST(NEURO_INTERFACE_AGE)
23 AC_SUBST(NEURO_BINARY_AGE)
24 AC_SUBST(NEURO_VERSION)
27 # libtool versioning
28 LT_CURRENT=$NEURO_INTERFACE_AGE
29 LT_REVISION=$NEURO_REVISION
30 LT_AGE=$NEURO_BINARY_AGE
32 AC_SUBST(LT_CURRENT)
33 AC_SUBST(LT_REVISION)
34 AC_SUBST(LT_AGE)
36 #AC_INIT(Neuro, $NEURO_VERSION)
37 AC_CONFIG_SRCDIR([src/neuro_main.c])
38 AC_CONFIG_HEADERS([include/neuro/config.h])
40 # init automake
41 AM_INIT_AUTOMAKE(neuro, $NEURO_VERSION)
43 # call canonical host to get valuable informations about the current system
44 AC_CANONICAL_HOST
45 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
46 AC_MSG_RESULT($host)
48 #dnl ----- set some variables ------
50 # check for programs
52 # ANSI C compiler check
53 AC_PROG_CC
55 # C preprocessor check
56 AC_PROG_CPP
57 AC_PROG_INSTALL
58 AC_PROG_LN_S
59 AC_PROG_MAKE_SET
60 AC_PROG_RANLIB
62 # check for cygwin stuff
63 AC_LIBTOOL_WIN32_DLL
65 # libtool setup
66 AM_PROG_LIBTOOL
69 # set the flags
70 CFLAGS="$CFLAGS -std=iso9899:1990 -Wall -pedantic -I\$(top_srcdir)/src" 
71 NEUROFLAGS="-D__USE_GNU -I\${top_srcdir}/include -I\${top_srcdir}/include/neuro"
72 NEUROLDFLAGS="-export-symbols \$(top_srcdir)/include/libneuro.sym"
73 SDLFLAGS="`sdl-config --libs`" 
75 dnl ------ Configure Arguments ------
77 AC_ARG_ENABLE(Debug, [  --enable-Debug  enable the debugging of this program [[default=no]]], , enable_Debug=no)
79 AC_ARG_WITH(lowlib, 
80 [ --with-lowlib=<lowlib>     the low library Neuro will use;]
81 [                          only a single value is valid here;]
82 [                          Default is "sdl";]
83 [                          Possible low libraries are :]
84 [                            dummy, X11, sdl ],
85 lowlib="$withval", lowlib="sdl")
87 AC_ARG_ENABLE(video, [  --disable-video disables all the video particularities of this library [[default=no]]], enable_Video=no, enable_Video=yes)
89 AC_ARG_ENABLE(neuronet, [  --disable-neuronet disables the neuronet library from being built [[default=no]]], enable_Neuronet=no, enable_Neuronet=yes)
91 freetype_enable=no
93 # host related checkings
95 AC_MSG_CHECKING([if we need -no-undefined])
96 case $host in
97         *-*-cygwin | *-*-mingw* | *-*-pw32*)
98                 NEUROFLAGS="$NEUROFLAGS -DWIN32"
99                 NEUROLDFLAGS="$NEUROLIBFLAGS -no-undefined"
100                 need_no_undefined=yes
101                 targ=w32
102                 #LIBS="$LIBS -lc -lgcc_s -ldl"
103                 ;;
104         *)
105 #by default we now compile against X11 on POSIX machines
106                 lowlib=X11
107                 targ=unix
108                 need_no_undefined=no
109                 ;;
110 esac
111 AC_MSG_RESULT($need_no_undefined)
112 AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
114 case $targ in
115         w32)
116                 AC_CHECK_HEADERS([windows.h], , [AC_MSG_ERROR([the required header windows is missing.])])
117                 #AC_CHECK_FUNCS([GetTickCount], , [AC_MSG_ERROR([a required function is missing.])])
118         
120         ;;
122         unix)
123                 AC_FUNC_MALLOC
124                 AC_FUNC_REALLOC
125                 AC_FUNC_VPRINTF
126                 AC_CHECK_HEADERS([unistd.h], , [AC_MSG_ERROR([the required header unistd is missing.])])
127                 AC_CHECK_FUNCS([gettimeofday], , [AC_MSG_ERROR([a required function is missing.])])
128         ;;
129 esac
131 dnl --------- Checks -------------
133 dnl ----------------
134 dnl check for header files.
135 dnl ----------------
136 AC_PATH_X
137 AC_HEADER_STDC
138 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h], , [AC_MSG_ERROR([a required header is missing.])])
140 # Checks for typedefs, structures, and compiler characteristics.
142 AC_C_CONST
143 AC_TYPE_SIZE_T
144 AC_HEADER_TIME
146 # Checks for library functions.
147 AC_FUNC_VPRINTF
148 AC_CHECK_FUNCS([memchr memset strchr], , [AC_MSG_ERROR([a required function is missing.])])
150 dnl ----------------
151 dnl List of libraries Neuro can use
152 dnl ----------------
153 SELECTED_LOWLIB=`echo $lowlib`
155 dnl ----------------
156 dnl Video check
157 dnl ----------------
158 AM_CONDITIONAL(USE_VIDEO, test x$enable_Video = xyes)
159 if test $enable_Video = no; then
160 # we disable the low library by putting it to the dummy driver
161         SELECTED_LOWLIB=dummy
164 dnl ----------------
165 dnl SDL check
166 dnl ----------------
167 AM_CONDITIONAL(USE_SDL, test x$SELECTED_LOWLIB = xsdl)
168 if test $SELECTED_LOWLIB = sdl; then
169         if test $targ = unix; then
170                 AC_CHECK_LIB(SDL, SDL_Init, 
171                      [AC_DEFINE(USE_SDL, 1, ["SDL main flag"]) LIBS="$LIBS $SDLFLAGS"
172                       NEUROFLAGS="$NEUROFLAGS `sdl-config --cflags`"], 
173                      [AC_MSG_ERROR(You don't have libSDL you can get it from http://www.libsdl.org)
176                 
177         else
178                 AC_CHECK_LIB(SDL, SDL_Init, 
179                      [AC_DEFINE(USE_SDL, 1, ["SDL main flag"]) LIBS="$LIBS -lSDL"], 
180                      [AC_MSG_ERROR(You don't have libSDL you can get it from http://www.libsdl.org)
183                 
184         fi
186         freetype_enable=yes
188 dnl ----------------
189 dnl Zlib check
190 dnl ----------------
191 AC_CHECK_LIB(z, gzgetc, 
192              [AC_DEFINE(USE_ZLIB, , ["ZLIB main flag"])] LIBS="$LIBS -lz", 
193              [AC_MSG_ERROR(You don't have the Z library)])
196 dnl ----------------
197 dnl X11 check
198 dnl ----------------
199 AM_CONDITIONAL(USE_X11, test x$SELECTED_LOWLIB = xX11)
200 if test $SELECTED_LOWLIB = X11; then
201         AC_PATH_X
202         AC_PATH_XTRA
203         LDFLAGS="$CFLAGS $X_LIBS"
204         CFLAGS="$CFLAGS $X_CFLAGS"
205         AC_CHECK_LIB(X11, XCreateGC, 
206                      [AC_DEFINE(USE_X11, 1, ["X11 main flag"]) LIBS="$LIBS -lX11 $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"], 
207                      [AC_MSG_ERROR(You don't have libX11)])
208 #       LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
209 #       NEUROFLAGS="$NEUROFLAGS $X_CFLAGS"
211         freetype_enable=yes
214 dnl ----------------
215 dnl libmath check
216 dnl ----------------
217 AC_CHECK_LIB(m, log10, , [AC_MSG_ERROR(You don't have libm -- math)])
220 dnl ----------------
221 dnl Freetype2 Check
222 dnl ----------------
223 if test x$freetype_enable = xyes; then
224         AC_CHECK_LIB(freetype, FT_New_Face,
225                      [LIBS="$LIBS `freetype-config --libs`" CFLAGS="$CFLAGS `freetype-config --cflags`"], 
226                      [AC_MSG_ERROR(You don't have the libfreetype2 library you can get it from freetype.sourceforge.net)])
230 dnl ----------------
231 dnl Debug toggle
232 dnl ----------------
233 if test x$enable_Debug = xyes; then
234         #NEUROFLAGS="$NEUROFLAGS -g"
235         CFLAGS="$CFLAGS -g"
236 else
237         #NEUROFLAGS="$NEUROFLAGS -O2 -s"
238         CFLAGS="$CFLAGS -Os -s"
241 AC_SUBST(NEUROFLAGS)
242 AC_SUBST(NEUROLDFLAGS)
244 # set the installation path for the headers
245 includedir=$includedir/neuro
247 echo 
249 # enumerate the Makefiles to be created
250 AC_CONFIG_FILES([
251 Makefile
252 include/Makefile
253 include/neuro/Makefile
254 src/Makefile
255 src/memory/Makefile
256 src/video/Makefile
257 src/events/Makefile
258 src/extlib/Makefile
259 src/misc/Makefile
260 src/misc/bitmap/Makefile
261 docs/Makefile
264 # if the neuronet project is in the house, we handle it
265 AM_CONDITIONAL(USE_NEURONET, test x$enable_Neuronet = xyes)
266 if test x$enable_Neuronet = xyes; then
267         if test -d src/neuronet/src; then
268                 AC_CONFIG_LINKS(src/neuronet/include/ebuf.h:include/neuro/ebuf.h)
269                 AC_CONFIG_SUBDIRS([src/neuronet])
270         fi
273 #AC_MSG_NOTICE([This is the low library Neuro will use : $SELECTED_LOWLIB])
275 AC_OUTPUT
277 echo " "
278 echo "This is the low library Neuro will use : $SELECTED_LOWLIB"
279 echo " "