source: libcaca/trunk/configure.ac @ 335

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