1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT(src/armdis.h)
4
5AC_CANONICAL_HOST
6AC_CANONICAL_TARGET
7
8case "$target" in
9  i?86-*-*)
10    VBA_USE_C_CORE=no
11    VBA_USE_MMX=yes
12    ;;
13  *)
14    VBA_USE_C_CORE=yes
15    VBA_USE_MMX=no
16    ;;
17esac
18
19AM_INIT_AUTOMAKE(VisualBoyAdvance, 1.7.2)
20
21AC_ARG_ENABLE(c-core,
22  AC_HELP_STRING([--enable-c-core],[enable C core (default is no on x86 targets)]),
23  , enable_c_core=$VBA_USE_C_CORE)
24
25AC_ARG_ENABLE(profiling,
26  AC_HELP_STRING([--enable-profiling],[enable profiling (default is yes)]),
27  , enable_profiling=yes)
28
29AC_ARG_WITH(mmx,
30  AC_HELP_STRING([--with-mmx],[use MMX (default is yes on x86 targets)]),
31  , with_mmx=$VBA_USE_MMX)
32
33AC_ARG_ENABLE(sdl,
34  AC_HELP_STRING([--enable-sdl],[build the SDL interface (default is yes)]),
35  , enable_sdl=yes)
36
37AC_ARG_ENABLE(gtk,
38[  --enable-gtk=[[VERSION]]  build the GTK+ interface (default is no)],[
39if test "x$enable_gtk" != xno; then
40  enable_gtk=yes
41  if test "x$enableval" = xyes; then
42    gtk_version=2.0
43  else
44    gtk_version=$enableval
45  fi
46fi
47],[
48enable_gtk=no
49])
50
51AC_ARG_ENABLE(dev,
52  AC_HELP_STRING([--enable-dev],[enable development features (default is yes)]),
53  , enable_dev=yes)
54
55dnl Checks for programs.
56AC_PROG_CC
57AC_PROG_YACC
58AM_PROG_LEX
59AC_PROG_CXX
60AC_PROG_RANLIB
61AC_PATH_PROG(NASM, nasm)
62
63dnl Checks for libraries.
64AC_CHECK_LIB(z, gzopen,
65  , AC_MSG_ERROR([*** Cannot compile without zlib.]))
66AC_CHECK_LIB(png, png_create_write_struct,
67  , AC_MSG_ERROR([*** Cannot compile without libpng.]), [-lz])
68AC_CHECK_LIB(pthread, pthread_yield)
69
70dnl Checks for header files.
71AC_PATH_X
72AC_HEADER_STDC
73AC_CHECK_HEADERS(malloc.h strings.h unistd.h arpa/inet.h netinet/in.h zutil.h)
74
75dnl Checks for typedefs, structures, and compiler characteristics.
76AC_C_CONST
77AC_C_INLINE
78AC_TYPE_SIZE_T
79AC_STRUCT_TM
80AC_MSG_CHECKING(for socklen_t)
81AC_TRY_COMPILE([
82#include <sys/socket.h>
83socklen_t x;
84],[
85],[
86AC_MSG_RESULT(yes)
87],[
88AC_TRY_COMPILE([
89#include <sys/socket.h>
90int accept (int, struct sockaddr *, size_t *);
91],[
92],[
93AC_MSG_RESULT(size_t)
94AC_DEFINE(socklen_t,size_t)
95],[
96AC_MSG_RESULT(int)
97AC_DEFINE(socklen_t,int)
98])
99])
100
101AC_C_BIGENDIAN
102
103VBA_LIBS="../gb/libgb.a"
104
105if test "x$enable_c_core" = xyes; then
106  CXXFLAGS="$CXXFLAGS -DC_CORE"
107fi
108
109if test "x$enable_profiling" = xyes; then
110  CXXFLAGS="$CXXFLAGS -DPROFILING"
111  VBA_SRC_EXTRA="$VBA_SRC_EXTRA prof"
112  VBA_LIBS="$VBA_LIBS ../prof/libprof.a"
113fi
114
115if test "x$with_mmx" = xyes; then
116  if test "x$NASM" = x; then
117    AC_MSG_ERROR([*** Couldn't find nasm program.])
118  fi
119  CXXFLAGS="$CXXFLAGS -DMMX"
120  VBA_SRC_EXTRA="$VBA_SRC_EXTRA i386"
121  VBA_LIBS="$VBA_LIBS ../i386/lib386.a"
122fi
123
124if test "x$enable_sdl" = xyes || test "x$enable_gtk" = xyes; then
125  SDL_VERSION=1.2.2
126  AM_PATH_SDL($SDL_VERSION,[
127  ],[
128  AC_MSG_ERROR([*** Couldn't find SDL library (version >= $SDL_VERSION).])
129  ])
130fi
131
132if test "x$enable_sdl" = xyes; then
133  VBA_SRC_EXTRA="$VBA_SRC_EXTRA sdl"
134fi
135
136if test "x$enable_gtk" = xyes; then
137  dnl Internationalisation support.
138  ALL_LINGUAS="fr"
139  AM_GNU_GETTEXT(external)
140  AC_CHECK_HEADERS(libintl.h)
141  GETTEXT_PACKAGE=vba-1.7.2
142  AC_SUBST(GETTEXT_PACKAGE)
143
144  PKG_CHECK_MODULES(GTKMM, gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0)
145  AC_SUBST(GTKMM_CFLAGS)
146  AC_SUBST(GTKMM_LIBS)
147  if test "x$gtk_version" = x2.0; then
148    GTKMM_CPPFLAGS="-DGTKMM20"
149  fi
150  AC_SUBST(GTKMM_CPPFLAGS)
151  VBA_EXTRA="$VBA_EXTRA po"
152  VBA_SRC_EXTRA="$VBA_SRC_EXTRA gtk"
153fi
154
155if test "x$enable_dev" = xyes; then
156  CXXFLAGS="$CXXFLAGS -DDEV_VERSION"
157fi
158
159if test "x$enable_sdl" != xyes && test "x$enable_gtk" != xyes; then
160  AC_MSG_WARN([*** You have chosen not to build any frontend.])
161fi
162
163AC_SUBST(VBA_EXTRA)
164AC_SUBST(VBA_SRC_EXTRA)
165AC_SUBST(VBA_LIBS)
166
167dnl Generated files.
168AC_CONFIG_FILES([
169Makefile
170m4/Makefile
171po/Makefile.in
172src/Makefile
173src/gb/Makefile
174src/gtk/Makefile
175src/gtk/images/Makefile
176src/i386/Makefile
177src/prof/Makefile
178src/sdl/Makefile
179win32/Makefile
180])
181AC_OUTPUT
182