source: libcaca/trunk/configure.ac @ 487

Last change on this file since 487 was 487, checked in by Jean-Yves Lamoureux, 15 years ago
  • Added Null driver and html3 exporter.
  • Property svn:keywords set to Id
File size: 7.9 KB
Line 
1# $Id: configure.ac 487 2005-06-22 22:06:42Z jylam $
2
3AC_INIT(src/caca.c)
4
5AC_PREREQ(2.50)
6AC_CONFIG_AUX_DIR(autotools)
7AC_CANONICAL_SYSTEM
8
9AM_INIT_AUTOMAKE(libcaca, 0.9)
10AM_CONFIG_HEADER(config.h)
11
12AM_PROG_CC_C_O
13AC_PROG_CPP
14
15AC_LIBTOOL_WIN32_DLL
16AC_DISABLE_SHARED
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.
25AC_EGREP_CPP(foo, foo)
26
27dnl output driver features
28AC_ARG_ENABLE(slang,
29  [  --enable-slang          slang graphics support (autodetected)])
30AC_ARG_ENABLE(ncurses,
31  [  --enable-ncurses        ncurses graphics support (autodetected)])
32AC_ARG_ENABLE(win32,
33  [  --enable-win32          Windows console support (autodetected)])
34AC_ARG_ENABLE(conio,
35  [  --enable-conio          DOS conio.h graphics support (autodetected)])
36AC_ARG_ENABLE(x11,
37  [  --enable-x11            X11 support (autodetected)])
38AC_ARG_ENABLE(gl,
39  [  --enable-gl             OpenGL support (autodetected)])
40AC_ARG_ENABLE(null,
41  [  --enable-null           Null driver support (autodetected)])
42
43dnl example programs features
44AC_ARG_ENABLE(imlib2,
45  [  --enable-imlib2         Imlib2 graphics support (default enabled)])
46
47dnl conditional builds
48AC_ARG_ENABLE(doc,
49  [  --enable-doc            build documentation (needs doxygen and LaTeX)])
50
51AC_CHECK_HEADERS(signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h)
52AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp)
53AC_CHECK_FUNCS(usleep gettimeofday)
54
55AC_MSG_CHECKING(for Sleep)
56AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
57 [AC_MSG_RESULT(yes)
58  AC_DEFINE(HAVE_SLEEP, 1, [Define if you have Windows' Sleep])],
59 [AC_MSG_RESULT(no)])
60AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
61
62CACA_DRIVERS=""
63
64if test "${enable_conio}" != "no"; then
65  ac_cv_my_have_conio="no"
66  AC_CHECK_HEADERS(conio.h,
67   [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
68    AC_EGREP_HEADER(ScreenUpdate, pc.h,
69     [ac_cv_my_have_conio="yes"
70      AC_MSG_RESULT(yes)
71      AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
72                Define if <pc.h> defines ScreenUpdate.)
73      AC_DEFINE(USE_CONIO, 1, Define to activate the conio.h backend driver)
74      CACA_DRIVERS="${CACA_DRIVERS} conio"],
75     [AC_MSG_RESULT(no)])])
76  if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
77    AC_MSG_ERROR([cannot find conio.h])
78  fi
79fi
80
81if test "${enable_win32}" != "no"; then
82  ac_cv_my_have_win32="no"
83  AC_CHECK_HEADERS(windows.h,
84   [AC_MSG_CHECKING(for AllocConsole in windows.h)
85    AC_EGREP_HEADER(AllocConsole, windows.h,
86     [ac_cv_my_have_win32="yes"
87      AC_MSG_RESULT(yes)
88      AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
89                Define if <windows.h> defines AllocConsole.)
90      AC_DEFINE(USE_WIN32, 1, Define to activate the win32 backend driver)
91      CACA_DRIVERS="${CACA_DRIVERS} win32"],
92     [AC_MSG_RESULT(no)])])
93  if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
94    AC_MSG_ERROR([cannot find win32 console development files])
95  fi
96fi
97
98if test "${enable_slang}" != "no"; then
99  ac_cv_my_have_slang="no"
100  AC_CHECK_HEADERS(slang.h slang/slang.h,
101   [AC_CHECK_LIB(slang, SLkp_init,
102     [ac_cv_my_have_slang="yes"
103      AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver)
104      CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
105      CACA_LIBS="${CACA_LIBS} -lslang"
106      CACA_DRIVERS="${CACA_DRIVERS} slang"])])
107  if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
108    AC_MSG_ERROR([cannot find slang development files])
109  fi
110fi
111
112if test "${enable_x11}" != "no"; then
113  AC_PATH_X
114  AC_CHECK_LIB(X11, XOpenDisplay,
115   [ac_cv_my_have_x11="yes"
116    if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
117    if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi
118    AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver)
119    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
120    CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
121    CACA_DRIVERS="${CACA_DRIVERS} x11"],
122   [ac_cv_my_have_x11="no"],
123   [[-lXt -L${x_libraries}]])
124  AC_CHECK_HEADERS(X11/XKBlib.h)
125  if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
126    AC_MSG_ERROR([cannot find X11 development files])
127  fi
128fi
129
130if test "${enable_gl}" != "no"; then
131  ac_cv_my_have_gl="no"
132  AC_CHECK_HEADERS(GL/gl.h GL/glut.h,
133   [AC_CHECK_LIB(glut, glutMainLoopEvent,
134     [ac_cv_my_have_gl="yes"
135      AC_DEFINE(USE_GL, 1, Define to activate the OpenGL backend driver)
136      CACA_LIBS="${CACA_LIBS} -lGL -lglut"
137      CACA_DRIVERS="${CACA_DRIVERS} gl"])])
138  if test "${ac_cv_my_have_gl}" = "no" -a "${enable_gl}" = "yes"; then
139    AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
140  fi
141fi
142
143if test "${enable_null}" != "no"; then
144  ac_cv_my_have_null="yes"
145  AC_DEFINE(USE_NULL, 1, Define to activate the Null backend driver)
146  CACA_DRIVERS="${CACA_DRIVERS} null"
147fi
148
149if test "${enable_ncurses}" != "no"; then
150  ac_cv_my_have_ncurses="no"
151  AC_CHECK_HEADERS(curses.h ncurses.h,
152   [AC_CHECK_LIB(ncurses, initscr,
153     [ac_cv_my_have_ncurses="yes"
154      AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
155      CACA_LIBS="${CACA_LIBS} -lncurses"
156      CACA_DRIVERS="${CACA_DRIVERS} ncurses"
157      dnl  Check for resizeterm or resize_term
158      SAVED_LIBS="${LIBS}"
159      LIBS="${LIBS} -lncurses"
160      AC_CHECK_FUNCS(resizeterm resize_term)
161      LIBS="${SAVED_LIBS}"])])
162  if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
163    AC_MSG_ERROR([cannot find ncurses development files])
164  fi
165fi
166
167AC_MSG_CHECKING(valid output drivers)
168if test -z "${CACA_DRIVERS}"; then
169  AC_MSG_RESULT(no)
170  AC_MSG_ERROR([no output drivers were selected!])
171else
172  AC_MSG_RESULT([${CACA_DRIVERS}])
173fi
174
175AC_SUBST(MATH_LIBS)
176AC_SUBST(CACA_LIBS)
177
178# Optimizations
179CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
180# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
181# [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
182# (Comme quoi on est pas les seuls porcs)
183CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
184
185# Build the PIC library?
186case "${target_os}" in
187  *mingw32* | *cygwin* | *djgpp*)
188    NEED_PIC=false
189    ;;
190  *)
191    NEED_PIC=:
192    ;;
193esac
194AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
195
196# Use Imlib2?
197ac_cv_my_have_imlib2="no"
198save_CPPFLAGS="${CPPFLAGS}"
199if test "${enable_imlib2}" != "no"; then
200  AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
201  if test "${IMLIB2_CONFIG}" != "no"; then
202    CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
203  fi
204  AC_CHECK_HEADERS(Imlib2.h,
205    ac_cv_my_have_imlib2="yes",
206   [ac_cv_my_have_imlib2="no"
207    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'.]])])
208  CPPFLAGS="${save_CPPFLAGS}"
209fi
210AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
211
212# Build documentation?
213DOXYGEN="no"
214LATEX="no"
215if test "${enable_doc}" != "no"; then
216  AC_PATH_PROG(DOXYGEN, doxygen, no)
217  if test "${DOXYGEN}" = "no"; then
218    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'.]])
219  fi
220
221  # Build LaTeX documentation?
222  AC_PATH_PROG(LATEX, latex, no)
223  AC_PATH_PROG(DVIPS, dvips, no)
224  if test "${DVIPS}" = "no"; then
225    LATEX="no"
226  fi
227  AC_MSG_CHECKING(for a4wide.sty)
228  if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
229    AC_MSG_RESULT(yes)
230  else
231    LATEX="no"
232    AC_MSG_RESULT(no)
233  fi
234fi
235AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
236AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
237
238AC_CONFIG_FILES([
239  Makefile
240  src/Makefile
241  examples/Makefile
242  test/Makefile
243  doc/Makefile
244  doc/doxygen.cfg
245  autotools/Makefile
246  debian/Makefile
247  msvc/Makefile
248])
249AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
250AC_OUTPUT
251
Note: See TracBrowser for help on using the repository browser.