source: libcaca/trunk/configure.ac @ 265

Last change on this file since 265 was 265, checked in by Sam Hocevar, 17 years ago
  • src/graphics.c src/caca.c src/io.c: + Support for simultaneously compiled-in drivers. + Honour the CACA_DRIVER environment variable.
  • configure.ac: + Drivers are no longer mutually exclusive.
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1# $Id: configure.ac 265 2003-12-22 15:26:12Z 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.3)
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(ncurses,
21  [  --enable-ncurses        ncurses graphics support (default enabled)])
22AC_ARG_ENABLE(slang,
23  [  --enable-slang          slang graphics support (default disabled)])
24AC_ARG_ENABLE(conio,
25  [  --enable-conio          DOS conio.h graphics support (default disabled)])
26AC_ARG_ENABLE(x11,
27  [  --enable-x11            X11 support (default disabled) (EXPERIMENTAL)])
28
29AC_CHECK_HEADERS(inttypes.h endian.h)
30AC_CHECK_FUNCS(vsnprintf getenv putenv strcasecmp)
31
32if test "${enable_conio}" = "yes"; then
33  AC_CHECK_HEADERS(conio.h,:,AC_MSG_ERROR([cannot find conio.h header]))
34  AC_MSG_CHECKING(for ScreenUpdate in pc.h)
35  AC_EGREP_HEADER(ScreenUpdate,pc.h,[
36    AC_MSG_RESULT(yes)
37    AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
38              Define if <pc.h> defines ScreenUpdate.)],[
39    AC_MSG_RESULT(no)])
40  AC_DEFINE(USE_CONIO, 1, Define to activate the conio.h backend driver)
41fi
42
43if test "${enable_slang}" = "yes"; then
44  AC_CHECK_HEADERS(slang.h,:,AC_MSG_ERROR([cannot find slang headers]))
45  AC_CHECK_LIB(slang,SLkp_init,:,AC_MSG_ERROR([cannot find slang library]))
46  AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver)
47  CACA_LIBS="${CACA_LIBS} -lslang"
48fi
49
50if test "${enable_x11}" = "yes"; then
51  AC_PATH_X
52  AC_CHECK_LIB(X11, XOpenDisplay,
53   [ac_cv_my_have_x11=yes
54    X_CFLAGS="-I${x_includes}"
55    X_LIBS="-lX11 -L${x_libraries}"],
56   [ac_cv_my_have_x11=no],
57   [[-lXt -L${x_libraries}]])
58  if test "${ac_cv_my_have_x11}" != "yes"; then
59    AC_MSG_ERROR([cannot find X11 development files])
60  fi
61  AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver)
62  CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
63  CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
64fi
65
66if test "${enable_ncurses}" != "no"; then
67  AC_CHECK_HEADERS(ncurses.h,:,AC_MSG_ERROR([cannot find ncurses headers]))
68  AC_CHECK_LIB(ncurses,initscr,:,AC_MSG_ERROR([cannot find ncurses library]))
69  AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
70  CACA_LIBS="${CACA_LIBS} -lncurses"
71fi
72
73AC_SUBST(CACA_LIBS)
74
75# Optimizations
76CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
77# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
78CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
79
80# Build the PIC library?
81case "${target_os}" in
82  *mingw32* | *cygwin* | *djgpp*)
83    NEED_PIC=false
84    ;;
85  *)
86    NEED_PIC=:
87    ;;
88esac
89AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
90
91# Build cacaview?
92save_CPPFLAGS="${CPPFLAGS}"
93AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
94if test "${IMLIB2_CONFIG}" != "no"; then
95  CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
96fi
97AC_CHECK_HEADERS(Imlib2.h, USE_IMLIB2=:, USE_IMLIB2=false)
98CPPFLAGS="${save_CPPFLAGS}"
99AM_CONDITIONAL(USE_IMLIB2, ${USE_IMLIB2})
100
101# Build documentation?
102AC_PATH_PROG(DOXYGEN, doxygen, no)
103AM_CONDITIONAL(DOXYGEN, test "${DOXYGEN}" != "no")
104AC_PATH_PROG(LATEX, latex, no)
105AC_MSG_CHECKING(for a4wide.sty)
106if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
107  AC_MSG_RESULT(yes)
108else
109  LATEX=no
110  AC_MSG_RESULT(no)
111fi
112AM_CONDITIONAL(LATEX, test "${LATEX}" != "no")
113
114AC_CONFIG_FILES([
115  Makefile
116  src/Makefile
117  examples/Makefile
118  doc/Makefile
119  autotools/Makefile
120  debian/Makefile
121])
122AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
123AC_OUTPUT
124
Note: See TracBrowser for help on using the repository browser.