source: libcaca/trunk/configure.ac @ 747

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