source: libcaca/trunk/configure.ac @ 830

Last change on this file since 830 was 830, checked in by Sam Hocevar, 14 years ago
  • Set library names to lib*.so.0.10.0.
  • Property svn:keywords set to Id
File size: 10.7 KB
Line 
1# $Id: configure.ac 830 2006-04-21 19:26:54Z 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.10)
10LT_VERSION="10:0:10"
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()
33
34dnl output driver features
35AC_ARG_ENABLE(slang,
36  [  --enable-slang          slang graphics support (autodetected)])
37AC_ARG_ENABLE(ncurses,
38  [  --enable-ncurses        ncurses graphics support (autodetected)])
39AC_ARG_ENABLE(win32,
40  [  --enable-win32          Windows console support (autodetected)])
41AC_ARG_ENABLE(conio,
42  [  --enable-conio          DOS conio.h graphics support (autodetected)])
43AC_ARG_ENABLE(x11,
44  [  --enable-x11            X11 support (autodetected)])
45AC_ARG_ENABLE(gl,
46  [  --enable-gl             OpenGL support (autodetected)])
47AC_ARG_ENABLE(network,
48  [  --enable-network        Network support (autodetected)])
49AC_ARG_ENABLE(vga,
50  [  --enable-vga            VGA support (default disabled)])
51
52dnl language bindings
53AC_ARG_ENABLE(cpp,
54  [  --enable-cpp            C++ bindings (autodetected)])
55
56dnl example programs features
57AC_ARG_ENABLE(imlib2,
58  [  --enable-imlib2         Imlib2 graphics support (default enabled)])
59
60dnl conditional builds
61AC_ARG_ENABLE(doc,
62  [  --enable-doc            build documentation (needs doxygen and LaTeX)])
63
64AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h)
65AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp)
66AC_CHECK_FUNCS(usleep gettimeofday)
67
68AC_MSG_CHECKING(for Sleep)
69AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
70 [AC_MSG_RESULT(yes)
71  AC_DEFINE(HAVE_SLEEP, 1, [Define to 1 if you have the `Sleep' function.])],
72 [AC_MSG_RESULT(no)])
73
74AC_MSG_CHECKING(for fsin/fcos)
75AC_TRY_COMPILE([],[asm("fsin\n\tfcos");],
76 [AC_MSG_RESULT(yes)
77  AC_DEFINE(HAVE_FSIN_FCOS, 1, [Define to 1 if you have the `fsin' and `fcos' operands.])],
78 [AC_MSG_RESULT(no)])
79
80AC_MSG_CHECKING(for fldln2/fxch/fyl2x)
81AC_TRY_COMPILE([],[asm("fldln2; fldln2; fxch; fyl2x");],
82 [AC_MSG_RESULT(yes)
83  AC_DEFINE(HAVE_FLDLN2, 1, [Define to 1 if you have the `fldln2' and other floating points operands.])],
84 [AC_MSG_RESULT(no)])
85
86AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
87
88
89if test "${enable_cpp}" != "no"; then
90  ac_cv_my_have_cpp="yes"
91  AC_DEFINE(USE_CPP, 1,
92                Define to 1 to enable C++ bindigs)
93fi
94
95CACA_DRIVERS=""
96
97if test "${enable_conio}" != "no"; then
98  ac_cv_my_have_conio="no"
99  AC_CHECK_HEADERS(conio.h,
100   [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
101    AC_EGREP_HEADER(ScreenUpdate, pc.h,
102     [ac_cv_my_have_conio="yes"
103      AC_MSG_RESULT(yes)
104      AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
105                Define to 1 if <pc.h> defines ScreenUpdate.)
106      AC_DEFINE(USE_CONIO, 1, Define to 1 to activate the conio.h backend driver)
107      CACA_DRIVERS="${CACA_DRIVERS} conio"],
108     [AC_MSG_RESULT(no)])])
109  if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
110    AC_MSG_ERROR([cannot find conio.h])
111  fi
112fi
113
114if test "${enable_win32}" != "no"; then
115  ac_cv_my_have_win32="no"
116  AC_CHECK_HEADERS(windows.h,
117   [AC_MSG_CHECKING(for AllocConsole in windows.h)
118    AC_EGREP_HEADER(AllocConsole, windows.h,
119     [ac_cv_my_have_win32="yes"
120      AC_MSG_RESULT(yes)
121      AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
122                Define to 1 if <windows.h> defines AllocConsole.)
123      AC_DEFINE(USE_WIN32, 1, Define to 1 to activate the win32 backend driver)
124      CACA_DRIVERS="${CACA_DRIVERS} win32"],
125     [AC_MSG_RESULT(no)])])
126  if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
127    AC_MSG_ERROR([cannot find win32 console development files])
128  fi
129fi
130
131if test "${enable_slang}" != "no"; then
132  ac_cv_my_have_slang="no"
133  AC_CHECK_HEADERS(slang.h slang/slang.h,
134   [ac_cv_my_have_slang="yes"
135    AC_DEFINE(USE_SLANG, 1, Define to 1 to activate the slang backend driver)
136    AC_CHECK_LIB(slang, SLsmg_utf8_enable,
137     [AC_DEFINE(HAVE_SLSMG_UTF8_ENABLE, 1, Define to 1 if you have the `SLsmg_utf8_enable' function.)])
138    CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
139    CACA_LIBS="${CACA_LIBS} -lslang"
140    CACA_DRIVERS="${CACA_DRIVERS} slang"
141    break])
142  if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
143    AC_MSG_ERROR([cannot find slang development files])
144  fi
145fi
146
147if test "${enable_x11}" != "no"; then
148  AC_PATH_X
149  AC_CHECK_LIB(X11, XOpenDisplay,
150   [ac_cv_my_have_x11="yes"
151    if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
152    if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi
153    AC_DEFINE(USE_X11, 1, Define to 1 to activate the X11 backend driver)
154    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
155    CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
156    CACA_DRIVERS="${CACA_DRIVERS} x11"],
157   [ac_cv_my_have_x11="no"],
158   [[-lXt `if test -n "${x_libraries}"; then echo -L${x_libraries}; fi`]])
159  AC_CHECK_HEADERS(X11/XKBlib.h)
160  if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
161    AC_MSG_ERROR([cannot find X11 development files])
162  fi
163fi
164
165if test "${enable_gl}" != "no"; then
166  ac_cv_my_have_gl="no"
167  AC_CHECK_HEADERS(GL/gl.h OpenGL/gl.h,
168   [AC_CHECK_HEADERS(GL/glut.h,
169     [AC_CHECK_LIB(glut, glutCloseFunc,
170       [AC_DEFINE(HAVE_GLUTCLOSEFUNC, 1, Define to 1 if you have the `glutCloseFunc' function.)])
171      AC_CHECK_LIB(glut, glutMainLoopEvent,
172       [ac_cv_my_have_gl="yes"])
173      AC_CHECK_LIB(glut, glutCheckLoop,
174       [ac_cv_my_have_gl="yes"
175        AC_DEFINE(HAVE_GLUTCHECKLOOP, 1, Define to 1 if you have the `glutCheckLoop' function.)])])
176      break])
177  if test "${ac_cv_my_have_gl}" = "yes"; then
178    AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver)
179    CACA_LIBS="${CACA_LIBS} -lGL -lglut"
180    CACA_DRIVERS="${CACA_DRIVERS} gl"
181  elif test "${enable_gl}" = "yes"; then
182    AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
183  fi
184fi
185
186if test "${enable_network}" != "no"; then
187  ac_cv_my_have_network="no"
188  AC_CHECK_HEADERS(sys/socket.h,
189     [ac_cv_my_have_network="yes"
190      AC_DEFINE(USE_NETWORK, 1, Define to 1 to activate the network backend driver)
191      CACA_DRIVERS="${CACA_DRIVERS} network"])
192  if test "${ac_cv_my_have_network}" = "no" -a "${enable_network}" = "yes"; then
193    AC_MSG_ERROR([cannot find standard networking socket files])
194  fi
195fi
196
197if test "${enable_ncurses}" != "no"; then
198  ac_cv_my_have_ncurses="no"
199  AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h,
200   [ncurses="no"
201    AC_CHECK_LIB(ncursesw, initscr,
202     [ncurses="-lncursesw"],
203     [AC_CHECK_LIB(ncurses, initscr,
204       [ncurses="-lncurses"])])
205    if test "${ncurses}" = "no"; then
206      continue
207    fi
208    ac_cv_my_have_ncurses="yes"
209    AC_DEFINE(USE_NCURSES, 1, Define to 1 to activate the ncurses backend driver)
210    CACA_LIBS="${CACA_LIBS} ${ncurses}"
211    CACA_DRIVERS="${CACA_DRIVERS} ncurses"
212    dnl  Check for resizeterm or resize_term
213    SAVED_LIBS="${LIBS}"
214    LIBS="${LIBS} ${ncurses}"
215    AC_CHECK_FUNCS(resizeterm resize_term)
216    LIBS="${SAVED_LIBS}"
217    break])
218  if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
219    AC_MSG_ERROR([cannot find ncurses development files])
220  fi
221fi
222
223if test "${enable_vga}" = "yes"; then
224  ac_cv_my_have_vga="yes"
225  CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/kernel.h"
226  CFLAGS="${CFLAGS} -fno-builtin -O2 -Wall"
227  CCASFLAGS="${CCASFLAGS} -I."
228  LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000"
229  AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
230  CACA_DRIVERS="${CACA_DRIVERS} vga"
231fi
232AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_vga}" = "yes")
233
234AC_MSG_CHECKING(valid output drivers)
235if test -z "${CACA_DRIVERS}"; then
236  AC_MSG_RESULT(no)
237  AC_MSG_ERROR([no output drivers were selected!])
238else
239  AC_MSG_RESULT([${CACA_DRIVERS}])
240fi
241
242AC_SUBST(MATH_LIBS)
243AC_SUBST(CACA_LIBS)
244AC_SUBST(CUCUL_LIBS)
245
246# Optimizations
247CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
248# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
249# [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
250# (Comme quoi on est pas les seuls porcs)
251CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
252
253# Build the PIC library?
254case "${target_os}" in
255  *mingw32* | *cygwin* | *djgpp*)
256    NEED_PIC=false
257    ;;
258  *)
259    NEED_PIC=:
260    ;;
261esac
262AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
263
264# Use Imlib2?
265ac_cv_my_have_imlib2="no"
266save_CPPFLAGS="${CPPFLAGS}"
267if test "${enable_imlib2}" != "no"; then
268  AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
269  if test "${IMLIB2_CONFIG}" != "no"; then
270    CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
271  fi
272  AC_CHECK_HEADERS(Imlib2.h,
273    ac_cv_my_have_imlib2="yes",
274   [ac_cv_my_have_imlib2="no"
275    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'.]])])
276  CPPFLAGS="${save_CPPFLAGS}"
277fi
278AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
279
280# Build development tools?
281PANGOFT2="no"
282  PKG_CHECK_MODULES(pangoft2, pangoft2,
283   [PANGOFT2="yes"])
284AM_CONDITIONAL(USE_PANGO, test "${PANGO}" != "no")
285
286# Build documentation?
287DOXYGEN="no"
288LATEX="no"
289if test "${enable_doc}" != "no"; then
290  AC_PATH_PROG(DOXYGEN, doxygen, no)
291  if test "${DOXYGEN}" = "no"; then
292    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'.]])
293  fi
294
295  # Build LaTeX documentation?
296  AC_PATH_PROG(LATEX, pdflatex, no)
297  AC_PATH_PROG(DVIPS, dvips, no)
298  if test "${DVIPS}" = "no"; then
299    LATEX="no"
300  fi
301  AC_MSG_CHECKING(for a4wide.sty)
302  if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
303    AC_MSG_RESULT(yes)
304  elif test -f /usr/share/texmf-tetex/tex/latex/a4wide/a4wide.sty; then
305    AC_MSG_RESULT(yes)
306  else
307    LATEX="no"
308    AC_MSG_RESULT(no)
309  fi
310fi
311AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
312AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
313
314AC_CONFIG_FILES([
315  Makefile
316  kernel/Makefile
317  cucul/Makefile
318  caca/Makefile
319  src/Makefile
320  test/Makefile
321  tools/Makefile
322  cpp/Makefile
323  doc/Makefile
324  autotools/Makefile
325  debian/Makefile
326  msvc/Makefile
327])
328AC_CONFIG_FILES([
329  cucul/cucul.pc
330  caca/caca.pc
331  doc/doxygen.cfg
332])
333AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
334AC_OUTPUT
335
Note: See TracBrowser for help on using the repository browser.