source: libcaca/trunk/configure.ac @ 483

Last change on this file since 483 was 483, checked in by Jean-Yves Lamoureux, 15 years ago

OpenGL support.

  • Property svn:keywords set to Id
File size: 7.6 KB
Line 
1# $Id: configure.ac 483 2005-06-21 13:28:51Z jylam $
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.9)
10AM_CONFIG_HEADER(config.h)
11
12AM_PROG_CC_C_O
13AC_PROG_CPP
14
15AC_LIBTOOL_WIN32_DLL
16AC_DISABLE_SHARED
17AM_PROG_LIBTOOL
18
19AC_C_CONST
20AC_C_INLINE
21AC_TYPE_SIGNAL
22
23dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
24dnl now otherwise it might be set in an obscure if statement.
25AC_EGREP_CPP(foo, foo)
26
27dnl output driver features
28AC_ARG_ENABLE(slang,
29  [  --enable-slang          slang graphics support (autodetected)])
30AC_ARG_ENABLE(ncurses,
31  [  --enable-ncurses        ncurses graphics support (autodetected)])
32AC_ARG_ENABLE(win32,
33  [  --enable-win32          Windows console support (autodetected)])
34AC_ARG_ENABLE(conio,
35  [  --enable-conio          DOS conio.h graphics support (autodetected)])
36AC_ARG_ENABLE(x11,
37  [  --enable-x11            X11 support (autodetected)])
38AC_ARG_ENABLE(gl,
39  [  --enable-gl             OpenGL support (autodetected)])
40
41dnl example programs features
42AC_ARG_ENABLE(imlib2,
43  [  --enable-imlib2         Imlib2 graphics support (default enabled)])
44
45dnl conditional builds
46AC_ARG_ENABLE(doc,
47  [  --enable-doc            build documentation (needs doxygen and LaTeX)])
48
49AC_CHECK_HEADERS(signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h)
50AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp)
51AC_CHECK_FUNCS(usleep gettimeofday)
52
53AC_MSG_CHECKING(for Sleep)
54AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
55 [AC_MSG_RESULT(yes)
56  AC_DEFINE(HAVE_SLEEP, 1, [Define if you have Windows' Sleep])],
57 [AC_MSG_RESULT(no)])
58AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
59
60CACA_DRIVERS=""
61
62if test "${enable_conio}" != "no"; then
63  ac_cv_my_have_conio="no"
64  AC_CHECK_HEADERS(conio.h,
65   [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
66    AC_EGREP_HEADER(ScreenUpdate, pc.h,
67     [ac_cv_my_have_conio="yes"
68      AC_MSG_RESULT(yes)
69      AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
70                Define if <pc.h> defines ScreenUpdate.)
71      AC_DEFINE(USE_CONIO, 1, Define to activate the conio.h backend driver)
72      CACA_DRIVERS="${CACA_DRIVERS} conio"],
73     [AC_MSG_RESULT(no)])])
74  if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
75    AC_MSG_ERROR([cannot find conio.h])
76  fi
77fi
78
79if test "${enable_win32}" != "no"; then
80  ac_cv_my_have_win32="no"
81  AC_CHECK_HEADERS(windows.h,
82   [AC_MSG_CHECKING(for AllocConsole in windows.h)
83    AC_EGREP_HEADER(AllocConsole, windows.h,
84     [ac_cv_my_have_win32="yes"
85      AC_MSG_RESULT(yes)
86      AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
87                Define if <windows.h> defines AllocConsole.)
88      AC_DEFINE(USE_WIN32, 1, Define to activate the win32 backend driver)
89      CACA_DRIVERS="${CACA_DRIVERS} win32"],
90     [AC_MSG_RESULT(no)])])
91  if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
92    AC_MSG_ERROR([cannot find win32 console development files])
93  fi
94fi
95
96if test "${enable_slang}" != "no"; then
97  ac_cv_my_have_slang="no"
98  AC_CHECK_HEADERS(slang.h slang/slang.h,
99   [AC_CHECK_LIB(slang, SLkp_init,
100     [ac_cv_my_have_slang="yes"
101      AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver)
102      CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
103      CACA_LIBS="${CACA_LIBS} -lslang"
104      CACA_DRIVERS="${CACA_DRIVERS} slang"])])
105  if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
106    AC_MSG_ERROR([cannot find slang development files])
107  fi
108fi
109
110if test "${enable_x11}" != "no"; then
111  AC_PATH_X
112  AC_CHECK_LIB(X11, XOpenDisplay,
113   [ac_cv_my_have_x11="yes"
114    if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
115    if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi
116    AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver)
117    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
118    CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
119    CACA_DRIVERS="${CACA_DRIVERS} x11"],
120   [ac_cv_my_have_x11="no"],
121   [[-lXt -L${x_libraries}]])
122  AC_CHECK_HEADERS(X11/XKBlib.h)
123  if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
124    AC_MSG_ERROR([cannot find X11 development files])
125  fi
126fi
127
128if test "${enable_gl}" != "no"; then
129  ac_cv_my_have_gl="no"
130  AC_CHECK_HEADERS(GL/gl.h GL/glut.h,
131   [AC_CHECK_LIB(glut, glutMainLoopEvent,
132     [ac_cv_my_have_gl="yes"
133      AC_DEFINE(USE_GL, 1, Define to activate the OpenGL backend driver)
134      CACA_LIBS="${CACA_LIBS} -lGL -lglut"
135      CACA_DRIVERS="${CACA_DRIVERS} gl"])])
136  if test "${ac_cv_my_have_gl}" = "no" -a "${enable_gl}" = "yes"; then
137    AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
138  fi
139fi
140
141if test "${enable_ncurses}" != "no"; then
142  ac_cv_my_have_ncurses="no"
143  AC_CHECK_HEADERS(curses.h ncurses.h,
144   [AC_CHECK_LIB(ncurses, initscr,
145     [ac_cv_my_have_ncurses="yes"
146      AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
147      CACA_LIBS="${CACA_LIBS} -lncurses"
148      CACA_DRIVERS="${CACA_DRIVERS} ncurses"
149      dnl  Check for resizeterm or resize_term
150      SAVED_LIBS="${LIBS}"
151      LIBS="${LIBS} -lncurses"
152      AC_CHECK_FUNCS(resizeterm resize_term)
153      LIBS="${SAVED_LIBS}"])])
154  if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
155    AC_MSG_ERROR([cannot find ncurses development files])
156  fi
157fi
158
159AC_MSG_CHECKING(valid output drivers)
160if test -z "${CACA_DRIVERS}"; then
161  AC_MSG_RESULT(no)
162  AC_MSG_ERROR([no output drivers were selected!])
163else
164  AC_MSG_RESULT([${CACA_DRIVERS}])
165fi
166
167AC_SUBST(MATH_LIBS)
168AC_SUBST(CACA_LIBS)
169
170# Optimizations
171CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
172# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
173# [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
174# (Comme quoi on est pas les seuls porcs)
175CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
176
177# Build the PIC library?
178case "${target_os}" in
179  *mingw32* | *cygwin* | *djgpp*)
180    NEED_PIC=false
181    ;;
182  *)
183    NEED_PIC=:
184    ;;
185esac
186AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
187
188# Use Imlib2?
189ac_cv_my_have_imlib2="no"
190save_CPPFLAGS="${CPPFLAGS}"
191if test "${enable_imlib2}" != "no"; then
192  AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
193  if test "${IMLIB2_CONFIG}" != "no"; then
194    CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
195  fi
196  AC_CHECK_HEADERS(Imlib2.h,
197    ac_cv_my_have_imlib2="yes",
198   [ac_cv_my_have_imlib2="no"
199    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'.]])])
200  CPPFLAGS="${save_CPPFLAGS}"
201fi
202AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
203
204# Build documentation?
205DOXYGEN="no"
206LATEX="no"
207if test "${enable_doc}" != "no"; then
208  AC_PATH_PROG(DOXYGEN, doxygen, no)
209  if test "${DOXYGEN}" = "no"; then
210    AC_MSG_ERROR([[cannot find doxygen, which is needed to build the libcaca documentation; if this is really what you want, re-run configure with '--disable-doc'.]])
211  fi
212
213  # Build LaTeX documentation?
214  AC_PATH_PROG(LATEX, latex, no)
215  AC_PATH_PROG(DVIPS, dvips, no)
216  if test "${DVIPS}" = "no"; then
217    LATEX="no"
218  fi
219  AC_MSG_CHECKING(for a4wide.sty)
220  if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
221    AC_MSG_RESULT(yes)
222  else
223    LATEX="no"
224    AC_MSG_RESULT(no)
225  fi
226fi
227AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
228AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
229
230AC_CONFIG_FILES([
231  Makefile
232  src/Makefile
233  examples/Makefile
234  test/Makefile
235  doc/Makefile
236  doc/doxygen.cfg
237  autotools/Makefile
238  debian/Makefile
239  msvc/Makefile
240])
241AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
242AC_OUTPUT
243
Note: See TracBrowser for help on using the repository browser.