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