1 | # $Id: configure.ac 362 2004-02-02 02:54:43Z sam $ |
---|
2 | |
---|
3 | AC_INIT(src/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.9) |
---|
10 | AM_CONFIG_HEADER(config.h) |
---|
11 | |
---|
12 | AM_PROG_CC_C_O |
---|
13 | AC_PROG_CPP |
---|
14 | AC_PROG_RANLIB |
---|
15 | |
---|
16 | AC_C_CONST |
---|
17 | AC_C_INLINE |
---|
18 | AC_TYPE_SIGNAL |
---|
19 | |
---|
20 | dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right |
---|
21 | dnl now otherwise it might be set in an obscure if statement. |
---|
22 | AC_EGREP_CPP(foo, foo) |
---|
23 | |
---|
24 | dnl output driver features |
---|
25 | AC_ARG_ENABLE(slang, |
---|
26 | [ --enable-slang slang graphics support (autodetected)]) |
---|
27 | AC_ARG_ENABLE(ncurses, |
---|
28 | [ --enable-ncurses ncurses graphics support (autodetected)]) |
---|
29 | AC_ARG_ENABLE(win32, |
---|
30 | [ --enable-win32 Windows console support (autodetected)]) |
---|
31 | AC_ARG_ENABLE(conio, |
---|
32 | [ --enable-conio DOS conio.h graphics support (autodetected)]) |
---|
33 | AC_ARG_ENABLE(x11, |
---|
34 | [ --enable-x11 X11 support (autodetected)]) |
---|
35 | |
---|
36 | dnl example programs features |
---|
37 | AC_ARG_ENABLE(imlib2, |
---|
38 | [ --enable-imlib2 Imlib2 graphics support (default enabled)]) |
---|
39 | |
---|
40 | dnl conditional builds |
---|
41 | AC_ARG_ENABLE(doc, |
---|
42 | [ --enable-doc build documentation (needs doxygen and LaTeX)]) |
---|
43 | |
---|
44 | AC_CHECK_HEADERS(signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h) |
---|
45 | AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp) |
---|
46 | AC_CHECK_FUNCS(usleep gettimeofday) |
---|
47 | |
---|
48 | AC_MSG_CHECKING(for Sleep) |
---|
49 | AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);], |
---|
50 | [AC_MSG_RESULT(yes) |
---|
51 | AC_DEFINE(HAVE_SLEEP, 1, [Define if you have Windows' Sleep])], |
---|
52 | [AC_MSG_RESULT(no)]) |
---|
53 | AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm") |
---|
54 | |
---|
55 | CACA_DRIVERS="" |
---|
56 | |
---|
57 | if test "${enable_conio}" != "no"; then |
---|
58 | ac_cv_my_have_conio="no" |
---|
59 | AC_CHECK_HEADERS(conio.h, |
---|
60 | [AC_MSG_CHECKING(for ScreenUpdate in pc.h) |
---|
61 | AC_EGREP_HEADER(ScreenUpdate, pc.h, |
---|
62 | [ac_cv_my_have_conio="yes" |
---|
63 | AC_MSG_RESULT(yes) |
---|
64 | AC_DEFINE(SCREENUPDATE_IN_PC_H, 1, |
---|
65 | Define if <pc.h> defines ScreenUpdate.) |
---|
66 | AC_DEFINE(USE_CONIO, 1, Define to activate the conio.h backend driver) |
---|
67 | CACA_DRIVERS="${CACA_DRIVERS} conio"], |
---|
68 | [AC_MSG_RESULT(no)])]) |
---|
69 | if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then |
---|
70 | AC_MSG_ERROR([cannot find conio.h]) |
---|
71 | fi |
---|
72 | fi |
---|
73 | |
---|
74 | if test "${enable_win32}" != "no"; then |
---|
75 | ac_cv_my_have_win32="no" |
---|
76 | AC_CHECK_HEADERS(windows.h, |
---|
77 | [AC_MSG_CHECKING(for AllocConsole in windows.h) |
---|
78 | AC_EGREP_HEADER(AllocConsole, windows.h, |
---|
79 | [ac_cv_my_have_win32="yes" |
---|
80 | AC_MSG_RESULT(yes) |
---|
81 | AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1, |
---|
82 | Define if <windows.h> defines AllocConsole.) |
---|
83 | AC_DEFINE(USE_WIN32, 1, Define to activate the win32 backend driver) |
---|
84 | CACA_DRIVERS="${CACA_DRIVERS} win32"], |
---|
85 | [AC_MSG_RESULT(no)])]) |
---|
86 | if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then |
---|
87 | AC_MSG_ERROR([cannot find win32 console development files]) |
---|
88 | fi |
---|
89 | fi |
---|
90 | |
---|
91 | if test "${enable_slang}" != "no"; then |
---|
92 | ac_cv_my_have_slang="no" |
---|
93 | AC_CHECK_HEADERS(slang.h slang/slang.h, |
---|
94 | [AC_CHECK_LIB(slang, SLkp_init, |
---|
95 | [ac_cv_my_have_slang="yes" |
---|
96 | AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver) |
---|
97 | CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1" |
---|
98 | CACA_LIBS="${CACA_LIBS} -lslang" |
---|
99 | CACA_DRIVERS="${CACA_DRIVERS} slang"])]) |
---|
100 | if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then |
---|
101 | AC_MSG_ERROR([cannot find slang development files]) |
---|
102 | fi |
---|
103 | fi |
---|
104 | |
---|
105 | if test "${enable_x11}" != "no"; then |
---|
106 | AC_PATH_X |
---|
107 | AC_CHECK_LIB(X11, XOpenDisplay, |
---|
108 | [ac_cv_my_have_x11="yes" |
---|
109 | if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi |
---|
110 | if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi |
---|
111 | AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver) |
---|
112 | CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}" |
---|
113 | CACA_LIBS="${CACA_LIBS} ${X_LIBS}" |
---|
114 | CACA_DRIVERS="${CACA_DRIVERS} x11"], |
---|
115 | [ac_cv_my_have_x11="no"], |
---|
116 | [[-lXt -L${x_libraries}]]) |
---|
117 | AC_CHECK_HEADERS(X11/XKBlib.h) |
---|
118 | if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then |
---|
119 | AC_MSG_ERROR([cannot find X11 development files]) |
---|
120 | fi |
---|
121 | fi |
---|
122 | |
---|
123 | if test "${enable_ncurses}" != "no"; then |
---|
124 | ac_cv_my_have_ncurses="no" |
---|
125 | AC_CHECK_HEADERS(curses.h ncurses.h, |
---|
126 | [AC_CHECK_LIB(ncurses, initscr, |
---|
127 | [ac_cv_my_have_ncurses="yes" |
---|
128 | AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver) |
---|
129 | CACA_LIBS="${CACA_LIBS} -lncurses" |
---|
130 | CACA_DRIVERS="${CACA_DRIVERS} ncurses"])]) |
---|
131 | if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then |
---|
132 | AC_MSG_ERROR([cannot find ncurses development files]) |
---|
133 | fi |
---|
134 | fi |
---|
135 | |
---|
136 | AC_MSG_CHECKING(valid output drivers) |
---|
137 | if test -z "${CACA_DRIVERS}"; then |
---|
138 | AC_MSG_RESULT(no) |
---|
139 | AC_MSG_ERROR([no output drivers were selected!]) |
---|
140 | else |
---|
141 | AC_MSG_RESULT([${CACA_DRIVERS}]) |
---|
142 | fi |
---|
143 | |
---|
144 | AC_SUBST(MATH_LIBS) |
---|
145 | AC_SUBST(CACA_LIBS) |
---|
146 | |
---|
147 | # Optimizations |
---|
148 | CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" |
---|
149 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
---|
150 | CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare" |
---|
151 | |
---|
152 | # Build the PIC library? |
---|
153 | case "${target_os}" in |
---|
154 | *mingw32* | *cygwin* | *djgpp*) |
---|
155 | NEED_PIC=false |
---|
156 | ;; |
---|
157 | *) |
---|
158 | NEED_PIC=: |
---|
159 | ;; |
---|
160 | esac |
---|
161 | AM_CONDITIONAL(NEED_PIC, ${NEED_PIC}) |
---|
162 | |
---|
163 | # Use Imlib2? |
---|
164 | ac_cv_my_have_imlib2="no" |
---|
165 | save_CPPFLAGS="${CPPFLAGS}" |
---|
166 | if test "${enable_imlib2}" != "no"; then |
---|
167 | AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no) |
---|
168 | if test "${IMLIB2_CONFIG}" != "no"; then |
---|
169 | CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1" |
---|
170 | fi |
---|
171 | AC_CHECK_HEADERS(Imlib2.h, |
---|
172 | ac_cv_my_have_imlib2="yes", |
---|
173 | [ac_cv_my_have_imlib2="no" |
---|
174 | 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'.]])]) |
---|
175 | CPPFLAGS="${save_CPPFLAGS}" |
---|
176 | fi |
---|
177 | AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes") |
---|
178 | |
---|
179 | # Build documentation? |
---|
180 | DOXYGEN="no" |
---|
181 | LATEX="no" |
---|
182 | if test "${enable_doc}" != "no"; then |
---|
183 | AC_PATH_PROG(DOXYGEN, doxygen, no) |
---|
184 | if test "${DOXYGEN}" = "no"; then |
---|
185 | 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'.]]) |
---|
186 | fi |
---|
187 | |
---|
188 | # Build LaTeX documentation? |
---|
189 | AC_PATH_PROG(LATEX, latex, no) |
---|
190 | AC_PATH_PROG(DVIPS, dvips, no) |
---|
191 | if test "${DVIPS}" = "no"; then |
---|
192 | LATEX="no" |
---|
193 | fi |
---|
194 | AC_MSG_CHECKING(for a4wide.sty) |
---|
195 | if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then |
---|
196 | AC_MSG_RESULT(yes) |
---|
197 | else |
---|
198 | LATEX="no" |
---|
199 | AC_MSG_RESULT(no) |
---|
200 | fi |
---|
201 | fi |
---|
202 | AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no") |
---|
203 | AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no") |
---|
204 | |
---|
205 | AC_CONFIG_FILES([ |
---|
206 | Makefile |
---|
207 | src/Makefile |
---|
208 | examples/Makefile |
---|
209 | test/Makefile |
---|
210 | doc/Makefile |
---|
211 | doc/doxygen.cfg |
---|
212 | autotools/Makefile |
---|
213 | debian/Makefile |
---|
214 | msvc/Makefile |
---|
215 | ]) |
---|
216 | AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config]) |
---|
217 | AC_OUTPUT |
---|
218 | |
---|