source: libcaca/trunk/configure.ac @ 344

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