source: libcaca/trunk/configure.ac @ 338

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