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