source: libcaca/trunk/configure.ac @ 1370

Last change on this file since 1370 was 1370, checked in by Sam Hocevar, 13 years ago
  • Set version to 0.99.beta10.
  • Updated NEWS and ChangeLog?.
  • Property svn:keywords set to Id
File size: 11.2 KB
Line 
1# $Id: configure.ac 1370 2006-11-12 18:26:40Z sam $
2
3AC_INIT(caca/caca.c)
4
5AC_PREREQ(2.50)
6AC_CONFIG_AUX_DIR(autotools)
7AC_CANONICAL_SYSTEM
8
9AM_INIT_AUTOMAKE(libcaca, 0.99.beta10)
10LT_VERSION="99:0:99"
11AC_SUBST(LT_VERSION)
12AM_CONFIG_HEADER(config.h)
13
14AM_PROG_CC_C_O
15AC_PROG_CPP
16AC_PROG_CXX
17AC_PROG_CXXCPP
18AM_PROG_AS
19
20AC_LIBTOOL_WIN32_DLL
21AM_PROG_LIBTOOL
22AC_LIBTOOL_CXX
23
24AC_C_CONST
25AC_C_INLINE
26AC_TYPE_SIGNAL
27
28dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
29dnl now otherwise it might be set in an obscure if statement. Same thing for
30dnl PKG_PROG_PKG_CONFIG which needs to be called first.
31AC_EGREP_CPP(yes, foo)
32PKG_PROG_PKG_CONFIG()
33m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
34if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
35  export PKG_CONFIG_LIBDIR=/dev/null
36fi
37
38dnl output driver features
39AC_ARG_ENABLE(slang,
40  [  --enable-slang          slang graphics support (autodetected)])
41AC_ARG_ENABLE(ncurses,
42  [  --enable-ncurses        ncurses graphics support (autodetected)])
43AC_ARG_ENABLE(win32,
44  [  --enable-win32          Windows console support (autodetected)])
45AC_ARG_ENABLE(conio,
46  [  --enable-conio          DOS conio.h graphics support (autodetected)])
47AC_ARG_ENABLE(x11,
48  [  --enable-x11            X11 support (autodetected)])
49AC_ARG_ENABLE(gl,
50  [  --enable-gl             OpenGL support (autodetected)])
51AC_ARG_ENABLE(network,
52  [  --enable-network        Network support (autodetected)])
53AC_ARG_ENABLE(vga,
54  [  --enable-vga            VGA support (default disabled)])
55
56dnl language bindings
57AC_ARG_ENABLE(cxx,
58  [  --enable-cxx            C++ bindings (default disabled)])
59
60dnl example programs features
61AC_ARG_ENABLE(imlib2,
62  [  --enable-imlib2         Imlib2 graphics support (default enabled)])
63
64dnl conditional builds
65AC_ARG_ENABLE(debug,
66  [  --enable-debug          build debug versions of the library])
67AC_ARG_ENABLE(plugins,
68  [  --enable-plugins        build X11 and GL drivers as plugins])
69AC_ARG_ENABLE(doc,
70  [  --enable-doc            build documentation (needs doxygen and LaTeX)])
71
72AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h)
73AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp htons)
74AC_CHECK_FUNCS(usleep gettimeofday)
75
76AC_CHECK_FUNCS(getopt_long,
77 [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)],
78 [AC_CHECK_LIB(gnugetopt, getopt_long,
79   [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
80    GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
81AC_SUBST(GETOPT_LIBS)
82
83AC_MSG_CHECKING(for Sleep)
84AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
85 [AC_MSG_RESULT(yes)
86  AC_DEFINE(HAVE_SLEEP, 1, [Define to 1 if you have the `Sleep' function.])],
87 [AC_MSG_RESULT(no)])
88
89AC_MSG_CHECKING(for fsin/fcos)
90AC_TRY_COMPILE([],[asm("fsin\n\tfcos");],
91 [AC_MSG_RESULT(yes)
92  AC_DEFINE(HAVE_FSIN_FCOS, 1, [Define to 1 if you have the `fsin' and `fcos' operands.])],
93 [AC_MSG_RESULT(no)])
94
95AC_MSG_CHECKING(for fldln2/fxch/fyl2x)
96AC_TRY_COMPILE([],[asm("fldln2; fldln2; fxch; fyl2x");],
97 [AC_MSG_RESULT(yes)
98  AC_DEFINE(HAVE_FLDLN2, 1, [Define to 1 if you have the `fldln2' and other floating points operands.])],
99 [AC_MSG_RESULT(no)])
100
101AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
102
103CACA_DRIVERS=""
104
105if test "${enable_conio}" != "no"; then
106  ac_cv_my_have_conio="no"
107  AC_CHECK_HEADERS(conio.h,
108   [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
109    AC_EGREP_HEADER(ScreenUpdate, pc.h,
110     [ac_cv_my_have_conio="yes"
111      AC_MSG_RESULT(yes)
112      AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
113                Define to 1 if <pc.h> defines ScreenUpdate.)
114      AC_DEFINE(USE_CONIO, 1, Define to 1 to activate the conio.h backend driver)
115      CACA_DRIVERS="${CACA_DRIVERS} conio"],
116     [AC_MSG_RESULT(no)])])
117  if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
118    AC_MSG_ERROR([cannot find conio.h])
119  fi
120fi
121
122if test "${enable_win32}" != "no"; then
123  ac_cv_my_have_win32="no"
124  AC_CHECK_HEADERS(windows.h,
125   [AC_MSG_CHECKING(for AllocConsole in windows.h)
126    AC_EGREP_HEADER(AllocConsole, windows.h,
127     [ac_cv_my_have_win32="yes"
128      AC_MSG_RESULT(yes)
129      AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
130                Define to 1 if <windows.h> defines AllocConsole.)
131      AC_DEFINE(USE_WIN32, 1, Define to 1 to activate the win32 backend driver)
132      CACA_DRIVERS="${CACA_DRIVERS} win32"],
133     [AC_MSG_RESULT(no)])])
134  if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
135    AC_MSG_ERROR([cannot find win32 console development files])
136  fi
137fi
138
139if test "${enable_slang}" != "no"; then
140  ac_cv_my_have_slang="no"
141  AC_CHECK_HEADERS(slang.h slang/slang.h,
142   [ac_cv_my_have_slang="yes"
143    AC_DEFINE(USE_SLANG, 1, Define to 1 to activate the slang backend driver)
144    AC_CHECK_LIB(slang, SLsmg_utf8_enable,
145     [AC_DEFINE(HAVE_SLSMG_UTF8_ENABLE, 1, Define to 1 if you have the `SLsmg_utf8_enable' function.)])
146    CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
147    CACA_LIBS="${CACA_LIBS} -lslang"
148    CACA_DRIVERS="${CACA_DRIVERS} slang"
149    break])
150  if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
151    AC_MSG_ERROR([cannot find slang development files])
152  fi
153fi
154
155if test "${enable_x11}" != "no"; then
156  AC_PATH_X
157  AC_CHECK_LIB(X11, XOpenDisplay,
158   [ac_cv_my_have_x11="yes"
159    if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
160    if test -n "${x_libraries}"; then X_LIBS="-L${x_libraries}"; fi
161    AC_DEFINE(USE_X11, 1, Define to 1 to activate the X11 backend driver)
162    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
163    X11_LIBS="${X11_LIBS} -lX11 ${X_LIBS}"
164    CACA_DRIVERS="${CACA_DRIVERS} x11"],
165   [ac_cv_my_have_x11="no"],
166   [[`if test -n "${x_libraries}"; then echo -L${x_libraries}; fi`]])
167  AC_CHECK_HEADERS(X11/XKBlib.h)
168  if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
169    AC_MSG_ERROR([cannot find X11 development files])
170  fi
171fi
172
173if test "${enable_gl}" != "no"; then
174  ac_cv_my_have_gl="no"
175  AC_CHECK_HEADERS(GL/gl.h OpenGL/gl.h,
176   [AC_CHECK_HEADERS(GL/glut.h,
177     [AC_CHECK_LIB(glut, glutCloseFunc,
178       [AC_DEFINE(HAVE_GLUTCLOSEFUNC, 1, Define to 1 if you have the `glutCloseFunc' function.)])
179      AC_CHECK_LIB(glut, glutMainLoopEvent,
180       [ac_cv_my_have_gl="yes"])
181      AC_CHECK_LIB(glut, glutCheckLoop,
182       [ac_cv_my_have_gl="yes"
183        AC_DEFINE(HAVE_GLUTCHECKLOOP, 1, Define to 1 if you have the `glutCheckLoop' function.)])])
184      break])
185  if test "${ac_cv_my_have_gl}" = "yes"; then
186    AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver)
187    GL_LIBS="${GL_LIBS} -lGL -lglut"
188    CACA_DRIVERS="${CACA_DRIVERS} gl"
189  elif test "${enable_gl}" = "yes"; then
190    AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
191  fi
192fi
193
194if test "${enable_ncurses}" != "no"; then
195  ac_cv_my_have_ncurses="no"
196  AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h,
197   [ncurses="no"
198    AC_CHECK_LIB(ncursesw, initscr,
199     [ncurses="-lncursesw"],
200     [AC_CHECK_LIB(ncurses, initscr,
201       [ncurses="-lncurses"])])
202    if test "${ncurses}" = "no"; then
203      continue
204    fi
205    ac_cv_my_have_ncurses="yes"
206    AC_DEFINE(USE_NCURSES, 1, Define to 1 to activate the ncurses backend driver)
207    CACA_LIBS="${CACA_LIBS} ${ncurses}"
208    CACA_DRIVERS="${CACA_DRIVERS} ncurses"
209    dnl  Check for resizeterm or resize_term
210    SAVED_LIBS="${LIBS}"
211    LIBS="${LIBS} ${ncurses}"
212    AC_CHECK_FUNCS(resizeterm resize_term)
213    LIBS="${SAVED_LIBS}"
214    break])
215  if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
216    AC_MSG_ERROR([cannot find ncurses development files])
217  fi
218fi
219
220if test "${enable_vga}" = "yes"; then
221  ac_cv_my_have_vga="yes"
222  CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/kernel.h"
223  CFLAGS="${CFLAGS} -fno-builtin -O2 -Wall"
224  CCASFLAGS="${CCASFLAGS} -I."
225  LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000"
226  AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
227  CACA_DRIVERS="${CACA_DRIVERS} vga"
228fi
229AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_vga}" = "yes")
230
231if test "${enable_debug}" = "yes"; then
232  AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
233fi
234
235if test "${enable_plugins}" = "yes"; then
236  ac_cv_my_have_plugins="yes"
237  AC_DEFINE(USE_PLUGINS, 1, Define to 1 to activate plugins)
238  CACA_LIBS="${CACA_LIBS} -ldl"
239else
240  CACA_LIBS="${CACA_LIBS} ${X11_LIBS} ${GL_LIBS}"
241fi
242AM_CONDITIONAL(USE_PLUGINS, test "${ac_cv_my_have_plugins}" = "yes")
243
244AC_MSG_CHECKING(valid output drivers)
245if test -z "${CACA_DRIVERS}"; then
246  AC_MSG_RESULT(no)
247  AC_MSG_ERROR([no output drivers were selected!])
248else
249  CACA_DRIVERS="${CACA_DRIVERS# *}"
250  AC_MSG_RESULT([${CACA_DRIVERS}])
251fi
252
253
254AC_SUBST(MATH_LIBS)
255AC_SUBST(GETOPT_LIBS)
256AC_SUBST(CACA_LIBS)
257AC_SUBST(X11_LIBS)
258AC_SUBST(GL_LIBS)
259
260# Optimizations
261CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
262# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
263# [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
264# (Comme quoi on est pas les seuls porcs)
265CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
266
267# Build the C++ bindings?
268ac_cv_my_have_cxx="no"
269if test "${enable_cxx}" = "yes"; then
270  ac_cv_my_have_cxx="yes"
271fi
272AM_CONDITIONAL(USE_CXX, test "${ac_cv_my_have_cxx}" = "yes")
273
274# Build cacaserver?
275ac_cv_my_have_network="no"
276AC_CHECK_HEADERS(sys/socket.h,
277 [ac_cv_my_have_network="yes"])
278AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
279
280# Use Imlib2?
281if test "${enable_imlib2}" != "no"; then
282  IMLIB2="no"
283  PKG_CHECK_MODULES(IMLIB2, imlib2, [IMLIB2="yes"], [AC_MSG_RESULT(no)])
284  if test "${IMLIB2}" = no; then
285    AC_MSG_ERROR([[cannot find Imlib2 development files. Without Imlib2, cacaview will only open BMP files; if this is really what you want, re-run configure with '--disable-imlib2'.]])
286  fi
287  AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
288fi
289
290# Build development tools?
291PANGOFT2="no"
292PKG_CHECK_MODULES(PANGOFT2, pangoft2, [PANGOFT2="yes"], [AC_MSG_RESULT(no)])
293AM_CONDITIONAL(USE_PANGO, test "${PANGOFT2}" != "no")
294
295# Build documentation?
296DOXYGEN="no"
297LATEX="no"
298if test "${enable_doc}" != "no"; then
299  AC_PATH_PROG(DOXYGEN, doxygen, no)
300  if test "${DOXYGEN}" = "no"; then
301    AC_MSG_ERROR([[cannot find doxygen, which is needed to build the libcaca documentation; if this is really what you want, re-run configure with '--disable-doc'.]])
302  fi
303
304  # Build LaTeX documentation?
305  AC_PATH_PROG(LATEX, pdflatex, no)
306  AC_PATH_PROG(DVIPS, dvips, no)
307  if test "${DVIPS}" = "no"; then
308    LATEX="no"
309  fi
310  AC_MSG_CHECKING(for a4wide.sty)
311  if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
312    AC_MSG_RESULT(yes)
313  elif test -f /usr/share/texmf-tetex/tex/latex/a4wide/a4wide.sty; then
314    AC_MSG_RESULT(yes)
315  else
316    LATEX="no"
317    AC_MSG_RESULT(no)
318  fi
319fi
320AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
321AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
322
323AC_CONFIG_FILES([
324  Makefile
325  kernel/Makefile
326  cucul/Makefile
327  caca/Makefile
328  src/Makefile
329  test/Makefile
330  tools/Makefile
331  cxx/Makefile
332  doc/Makefile
333  autotools/Makefile
334  msvc/Makefile
335])
336AC_CONFIG_FILES([
337  cucul/cucul.pc
338  caca/caca.pc
339  doc/doxygen.cfg
340])
341AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
342AC_OUTPUT
343
Note: See TracBrowser for help on using the repository browser.