1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT(SDL_gfxPrimitives.c)
4AC_CONFIG_MACRO_DIR([m4])
5
6dnl SDL version required
7
8SDL_VERSION=1.2.0
9AC_SUBST(SDL_VERSION)
10
11dnl Setup for automake
12
13# Making releases:
14#   MICRO_VERSION += 1;
15#   INTERFACE_AGE += 1;
16#   BINARY_AGE += 1;
17# if any functions have been added, set INTERFACE_AGE to 0.
18# if backwards compatibility has been broken,
19# set BINARY_AGE and INTERFACE_AGE to 0.
20
21MAJOR_VERSION=2
22MINOR_VERSION=0
23MICRO_VERSION=25
24INTERFACE_AGE=1
25BINARY_AGE=10
26VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
27
28AC_SUBST(MAJOR_VERSION)
29AC_SUBST(MINOR_VERSION)
30AC_SUBST(MICRO_VERSION)
31AC_SUBST(INTERFACE_AGE)
32AC_SUBST(BINARY_AGE)
33AC_SUBST(VERSION)
34
35# libtool versioning
36LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
37LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
38LT_REVISION=$INTERFACE_AGE
39LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
40
41AC_SUBST(LT_RELEASE)
42AC_SUBST(LT_CURRENT)
43AC_SUBST(LT_REVISION)
44AC_SUBST(LT_AGE)
45
46dnl Detect the canonical host and target build environment
47AC_CANONICAL_HOST
48AC_CANONICAL_TARGET
49
50AM_INIT_AUTOMAKE(SDL_gfx, $VERSION)
51
52dnl Check for compilers
53AC_LIBTOOL_WIN32_DLL
54AM_PROG_LIBTOOL
55AC_PROG_MAKE_SET
56AC_PROG_CC
57AC_PROG_CXX
58AC_PROG_INSTALL
59
60dnl Check for compiler environment
61AC_C_CONST
62
63dnl Set for C compiler by default
64AC_LANG_C
65
66dnl Setup target flagsw
67case "$target" in
68    *-*-cygwin* | *-*-mingw32*)
69	CFLAGS="$CFLAGS -DWIN32"
70        if test "$build" != "$target"; then # cross-compiling
71            ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
72        fi
73        ;;
74    *)
75	dnl nothing to do
76        ;;
77esac
78
79dnl Figure out which math library to use
80case "$target" in
81    *-*-cygwin* | *-*-mingw32*)
82        MATHLIB=""
83        ;;
84    *-*-beos* | *-*-haiku*)
85        MATHLIB=""
86        ;;
87    *-*-darwin*)
88        MATHLIB=""
89        ;;
90    *-*-aix*)
91	MATHLIB="-lm"
92        if test x$ac_cv_prog_gcc = xyes; then
93            CFLAGS="-mthreads"
94	fi
95        ;;
96    *)
97        MATHLIB="-lm"
98        AC_PATH_X
99        AC_PATH_XTRA
100        ;;
101esac
102AC_SUBST(MATHLIB)
103LIBS="$LIBS $MATHLIB"
104
105dnl Check for NASM (for x86 assembly blit routines)
106AC_ARG_ENABLE(mmx,[  --enable-mmx            use mmx assembly on x86 [default=yes], disable this on non-x86 platforms],, enable_mmx=yes)
107
108if test x$enable_mmx = xyes; then
109  CFLAGS="$CFLAGS -O -DUSE_MMX"
110  dnl MMX enabled by default in GCC on x86_64, but not i386:
111  AC_CHECK_SIZEOF([long])
112  if test "$ac_cv_sizeof_long" = "4"; then
113          CFLAGS="$CFLAGS -mmmx"
114  fi
115fi
116
117dnl Check for SDL
118AM_PATH_SDL($SDL_VERSION,
119            :,
120	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
121)
122CFLAGS="$CFLAGS $SDL_CFLAGS"
123# Remove dependencies from 'sdl-config' not meant for us libraries:
124SDL_LIBS=$(echo "$SDL_LIBS" | sed -e 's/-lmingw32//' -e 's/-lSDLmain//')
125LIBS="$LIBS $SDL_LIBS"
126
127# Finally create all the generated files
128AC_OUTPUT([
129Makefile
130SDL_gfx.pc
131])
132
133echo
134echo "Options summary:"
135echo "* --enable-mmx: $enable_mmx"
136