source: libcaca/trunk/configure.ac @ 337

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