source: libcaca/trunk/configure.ac @ 285

Last change on this file since 285 was 285, checked in by Sam Hocevar, 16 years ago
  • src/caca.c: + Prefer the X11 driver if $DISPLAY is set. + The slang driver is now preferred over the ncurses driver.
  • configure.ac: + Autodetect conio.h.
  • Property svn:keywords set to Id
File size: 4.7 KB
Line 
1# $Id: configure.ac 285 2003-12-25 23:59:48Z 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.5)
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(conio,
25  [  --enable-conio          DOS conio.h graphics support (default disabled)])
26AC_ARG_ENABLE(x11,
27  [  --enable-x11            X11 support (autodetected)])
28
29AC_CHECK_HEADERS(inttypes.h endian.h)
30AC_CHECK_FUNCS(vsnprintf getenv putenv strcasecmp)
31
32CACA_DRIVERS=""
33
34if test "${enable_conio}" != "no"; then
35  AC_CHECK_HEADERS(conio.h,
36   [ac_cv_my_have_conio="yes"
37    AC_MSG_CHECKING(for ScreenUpdate in pc.h)
38    AC_EGREP_HEADER(ScreenUpdate,pc.h,
39     [AC_MSG_RESULT(yes)
40      AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
41                Define if <pc.h> defines ScreenUpdate.)],
42     [AC_MSG_RESULT(no)])
43    AC_DEFINE(USE_CONIO, 1, Define to activate the conio.h backend driver)
44    CACA_DRIVERS="${CACA_DRIVERS} conio"],
45   [ac_cv_my_have_conio="no"])
46  if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
47    AC_MSG_ERROR([cannot find conio.h])
48  fi
49fi
50
51if test "${enable_slang}" != "no"; then
52  AC_CHECK_HEADERS(slang.h,
53   [AC_CHECK_LIB(slang, SLkp_init,
54     [ac_cv_my_have_slang="yes"
55      AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver)
56      CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
57      CACA_LIBS="${CACA_LIBS} -lslang"
58      CACA_DRIVERS="${CACA_DRIVERS} slang"],
59     [ac_cv_my_have_slang="no"])],
60   [ac_cv_my_have_slang="no"])
61  if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
62    AC_MSG_ERROR([cannot find slang development files])
63  fi
64fi
65
66if test "${enable_x11}" != "no"; then
67  AC_PATH_X
68  AC_CHECK_LIB(X11, XOpenDisplay,
69   [ac_cv_my_have_x11="yes"
70    if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
71    if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi
72    AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver)
73    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
74    CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
75    CACA_DRIVERS="${CACA_DRIVERS} x11"],
76   [ac_cv_my_have_x11="no"],
77   [[-lXt -L${x_libraries}]])
78  if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
79    AC_MSG_ERROR([cannot find X11 development files])
80  fi
81fi
82
83if test "${enable_ncurses}" != "no"; then
84  AC_CHECK_HEADERS(ncurses.h,
85   [AC_CHECK_LIB(ncurses, initscr,
86     [ac_cv_my_have_ncurses="yes"
87      AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
88      CACA_LIBS="${CACA_LIBS} -lncurses"
89      CACA_DRIVERS="${CACA_DRIVERS} ncurses"],
90     [ac_cv_my_have_ncurses="no"])],
91   [ac_cv_my_have_ncurses="no"])
92  if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
93    AC_MSG_ERROR([cannot find ncurses development files])
94  fi
95fi
96
97AC_MSG_CHECKING(valid output drivers)
98if test -z "${CACA_DRIVERS}"; then
99  AC_MSG_RESULT(no)
100  AC_MSG_ERROR([no output drivers were selected!])
101else
102  AC_MSG_RESULT([${CACA_DRIVERS}])
103fi
104
105AC_SUBST(CACA_LIBS)
106
107# Optimizations
108CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
109# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
110CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
111
112# Build the PIC library?
113case "${target_os}" in
114  *mingw32* | *cygwin* | *djgpp*)
115    NEED_PIC=false
116    ;;
117  *)
118    NEED_PIC=:
119    ;;
120esac
121AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
122
123# Build cacaview?
124save_CPPFLAGS="${CPPFLAGS}"
125AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
126if test "${IMLIB2_CONFIG}" != "no"; then
127  CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
128fi
129AC_CHECK_HEADERS(Imlib2.h, USE_IMLIB2=:, USE_IMLIB2=false)
130CPPFLAGS="${save_CPPFLAGS}"
131AM_CONDITIONAL(USE_IMLIB2, ${USE_IMLIB2})
132
133# Build documentation?
134AC_PATH_PROG(DOXYGEN, doxygen, no)
135AM_CONDITIONAL(DOXYGEN, test "${DOXYGEN}" != "no")
136
137# Build LaTeX documentation?
138AC_PATH_PROG(LATEX, latex, no)
139AC_MSG_CHECKING(for a4wide.sty)
140if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
141  AC_MSG_RESULT(yes)
142else
143  LATEX=no
144  AC_MSG_RESULT(no)
145fi
146AM_CONDITIONAL(LATEX, test "${LATEX}" != "no")
147
148AC_CONFIG_FILES([
149  Makefile
150  src/Makefile
151  examples/Makefile
152  doc/Makefile
153  doc/doxygen.cfg
154  autotools/Makefile
155  debian/Makefile
156])
157AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
158AC_OUTPUT
159
Note: See TracBrowser for help on using the repository browser.