source: libcaca/trunk/configure.ac @ 1961

Last change on this file since 1961 was 1954, checked in by Sam Hocevar, 15 years ago
  • Autotoolified the .NET bindings. Use --enable-dotnet.
  • Property svn:keywords set to Id
File size: 13.9 KB
RevLine 
[71]1# $Id: configure.ac 1954 2007-11-13 23:55:07Z sam $
[17]2
[536]3AC_INIT(caca/caca.c)
[17]4
5AC_PREREQ(2.50)
[39]6AC_CONFIG_AUX_DIR(autotools)
[17]7AC_CANONICAL_SYSTEM
8
[1824]9AM_INIT_AUTOMAKE(libcaca, 0.99.beta12)
[835]10LT_VERSION="99:0:99"
[830]11AC_SUBST(LT_VERSION)
[17]12AM_CONFIG_HEADER(config.h)
13
14AM_PROG_CC_C_O
15AC_PROG_CPP
[781]16AC_PROG_CXX
[801]17AC_PROG_CXXCPP
[1396]18_AM_DEPENDENCIES([OBJC])
[1449]19OBJC="${CC}"
[1396]20AC_SUBST(OBJC)
21AC_SUBST(OBJCFLAGS)
[568]22AM_PROG_AS
[17]23
[475]24AC_LIBTOOL_WIN32_DLL
25AM_PROG_LIBTOOL
[781]26AC_LIBTOOL_CXX
[475]27
[344]28AC_C_CONST
29AC_C_INLINE
[348]30AC_TYPE_SIGNAL
[344]31
[157]32dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
[747]33dnl now otherwise it might be set in an obscure if statement. Same thing for
34dnl PKG_PROG_PKG_CONFIG which needs to be called first.
[781]35AC_EGREP_CPP(yes, foo)
[747]36PKG_PROG_PKG_CONFIG()
[867]37m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
[1198]38if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
[867]39  export PKG_CONFIG_LIBDIR=/dev/null
40fi
[157]41
[346]42dnl output driver features
[284]43AC_ARG_ENABLE(slang,
[285]44  [  --enable-slang          slang graphics support (autodetected)])
[231]45AC_ARG_ENABLE(ncurses,
[285]46  [  --enable-ncurses        ncurses graphics support (autodetected)])
[331]47AC_ARG_ENABLE(win32,
48  [  --enable-win32          Windows console support (autodetected)])
[155]49AC_ARG_ENABLE(conio,
[331]50  [  --enable-conio          DOS conio.h graphics support (autodetected)])
[251]51AC_ARG_ENABLE(x11,
[285]52  [  --enable-x11            X11 support (autodetected)])
[483]53AC_ARG_ENABLE(gl,
54  [  --enable-gl             OpenGL support (autodetected)])
[1396]55AC_ARG_ENABLE(cocoa,
56  [  --enable-cocoa          Cocoa support (autodetected)])
[554]57AC_ARG_ENABLE(network,
58  [  --enable-network        Network support (autodetected)])
[568]59AC_ARG_ENABLE(vga,
60  [  --enable-vga            VGA support (default disabled)])
[17]61
[801]62dnl language bindings
[899]63AC_ARG_ENABLE(cxx,
[1953]64  [  --enable-cxx            C++ bindings (default enabled)])
[1954]65AC_ARG_ENABLE(dotnet,
66  [  --enable-dotnet         .NET bindings (autodetected)])
[1951]67AC_ARG_ENABLE(ruby,
[1953]68  [  --enable-ruby           Ruby bindings (autodetected)])
[781]69
[346]70dnl example programs features
71AC_ARG_ENABLE(imlib2,
[1398]72  [  --enable-imlib2         Imlib2 graphics support (autodetected)])
[346]73
74dnl conditional builds
[1360]75AC_ARG_ENABLE(debug,
76  [  --enable-debug          build debug versions of the library])
[1208]77AC_ARG_ENABLE(plugins,
78  [  --enable-plugins        build X11 and GL drivers as plugins])
[346]79AC_ARG_ENABLE(doc,
80  [  --enable-doc            build documentation (needs doxygen and LaTeX)])
81
[1851]82AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h termios.h)
[859]83AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp htons)
[1086]84AC_CHECK_FUNCS(usleep gettimeofday)
[348]85
[1207]86AC_CHECK_FUNCS(getopt_long,
87 [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)],
88 [AC_CHECK_LIB(gnugetopt, getopt_long,
89   [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
90    GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
91AC_SUBST(GETOPT_LIBS)
92
[338]93AC_MSG_CHECKING(for Sleep)
94AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
95 [AC_MSG_RESULT(yes)
[610]96  AC_DEFINE(HAVE_SLEEP, 1, [Define to 1 if you have the `Sleep' function.])],
[338]97 [AC_MSG_RESULT(no)])
[657]98
[652]99AC_MSG_CHECKING(for fsin/fcos)
100AC_TRY_COMPILE([],[asm("fsin\n\tfcos");],
101 [AC_MSG_RESULT(yes)
102  AC_DEFINE(HAVE_FSIN_FCOS, 1, [Define to 1 if you have the `fsin' and `fcos' operands.])],
103 [AC_MSG_RESULT(no)])
[657]104
105AC_MSG_CHECKING(for fldln2/fxch/fyl2x)
106AC_TRY_COMPILE([],[asm("fldln2; fldln2; fxch; fyl2x");],
107 [AC_MSG_RESULT(yes)
108  AC_DEFINE(HAVE_FLDLN2, 1, [Define to 1 if you have the `fldln2' and other floating points operands.])],
109 [AC_MSG_RESULT(no)])
110
[333]111AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
[222]112
[284]113CACA_DRIVERS=""
114
[285]115if test "${enable_conio}" != "no"; then
[330]116  ac_cv_my_have_conio="no"
[285]117  AC_CHECK_HEADERS(conio.h,
[330]118   [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
[331]119    AC_EGREP_HEADER(ScreenUpdate, pc.h,
[330]120     [ac_cv_my_have_conio="yes"
121      AC_MSG_RESULT(yes)
[285]122      AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
[610]123                Define to 1 if <pc.h> defines ScreenUpdate.)
124      AC_DEFINE(USE_CONIO, 1, Define to 1 to activate the conio.h backend driver)
[330]125      CACA_DRIVERS="${CACA_DRIVERS} conio"],
126     [AC_MSG_RESULT(no)])])
[285]127  if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
128    AC_MSG_ERROR([cannot find conio.h])
129  fi
[265]130fi
131
[331]132if test "${enable_win32}" != "no"; then
133  ac_cv_my_have_win32="no"
134  AC_CHECK_HEADERS(windows.h,
135   [AC_MSG_CHECKING(for AllocConsole in windows.h)
136    AC_EGREP_HEADER(AllocConsole, windows.h,
137     [ac_cv_my_have_win32="yes"
138      AC_MSG_RESULT(yes)
139      AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
[610]140                Define to 1 if <windows.h> defines AllocConsole.)
141      AC_DEFINE(USE_WIN32, 1, Define to 1 to activate the win32 backend driver)
[331]142      CACA_DRIVERS="${CACA_DRIVERS} win32"],
143     [AC_MSG_RESULT(no)])])
144  if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
145    AC_MSG_ERROR([cannot find win32 console development files])
146  fi
147fi
148
[284]149if test "${enable_slang}" != "no"; then
[330]150  ac_cv_my_have_slang="no"
[309]151  AC_CHECK_HEADERS(slang.h slang/slang.h,
[610]152   [ac_cv_my_have_slang="yes"
153    AC_DEFINE(USE_SLANG, 1, Define to 1 to activate the slang backend driver)
154    AC_CHECK_LIB(slang, SLsmg_utf8_enable,
155     [AC_DEFINE(HAVE_SLSMG_UTF8_ENABLE, 1, Define to 1 if you have the `SLsmg_utf8_enable' function.)])
156    CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
157    CACA_LIBS="${CACA_LIBS} -lslang"
158    CACA_DRIVERS="${CACA_DRIVERS} slang"
159    break])
[284]160  if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
161    AC_MSG_ERROR([cannot find slang development files])
162  fi
[265]163fi
164
[284]165if test "${enable_x11}" != "no"; then
[251]166  AC_PATH_X
167  AC_CHECK_LIB(X11, XOpenDisplay,
[284]168   [ac_cv_my_have_x11="yes"
[277]169    if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
[994]170    if test -n "${x_libraries}"; then X_LIBS="-L${x_libraries}"; fi
[610]171    AC_DEFINE(USE_X11, 1, Define to 1 to activate the X11 backend driver)
[284]172    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
[1208]173    X11_LIBS="${X11_LIBS} -lX11 ${X_LIBS}"
[284]174    CACA_DRIVERS="${CACA_DRIVERS} x11"],
175   [ac_cv_my_have_x11="no"],
[955]176   [[`if test -n "${x_libraries}"; then echo -L${x_libraries}; fi`]])
[324]177  AC_CHECK_HEADERS(X11/XKBlib.h)
[284]178  if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
[251]179    AC_MSG_ERROR([cannot find X11 development files])
180  fi
[265]181fi
182
[483]183if test "${enable_gl}" != "no"; then
184  ac_cv_my_have_gl="no"
[697]185  AC_CHECK_HEADERS(GL/gl.h OpenGL/gl.h,
[610]186   [AC_CHECK_HEADERS(GL/glut.h,
[799]187     [AC_CHECK_LIB(glut, glutCloseFunc,
188       [AC_DEFINE(HAVE_GLUTCLOSEFUNC, 1, Define to 1 if you have the `glutCloseFunc' function.)])
189      AC_CHECK_LIB(glut, glutMainLoopEvent,
190       [ac_cv_my_have_gl="yes"])
191      AC_CHECK_LIB(glut, glutCheckLoop,
[694]192       [ac_cv_my_have_gl="yes"
[697]193        AC_DEFINE(HAVE_GLUTCHECKLOOP, 1, Define to 1 if you have the `glutCheckLoop' function.)])])
194      break])
195  if test "${ac_cv_my_have_gl}" = "yes"; then
196    AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver)
[1208]197    GL_LIBS="${GL_LIBS} -lGL -lglut"
[697]198    CACA_DRIVERS="${CACA_DRIVERS} gl"
199  elif test "${enable_gl}" = "yes"; then
[483]200    AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
201  fi
202fi
203
[1396]204if test "${enable_cocoa}" != "no"; then
205  ac_cv_my_have_cocoa="no"
206  AC_CHECK_HEADERS(Cocoa/Cocoa.h,
207   [ac_cv_my_have_cocoa="yes"])
208  if test "${ac_cv_my_have_cocoa}" = "yes"; then
[1449]209    case x${target} in
210    xpowerpc*darwin*)
211      # 10.3 needed to link with X11
212      MACOSX_SDK=/Developer/SDKs/MacOSX10.3.9.sdk
213      GCC_VERSION=3.3
214      ARCH="-arch ppc"
215      MACOSX_SDK_CFLAGS="-nostdinc -isystem ${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOSX_SDK}/usr/include"
216      MACOSX_SDK_CXXFLAGS="-nostdinc++ -I${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward"
217      MACOSX_SDK_LDFLAGS="-L${MACOSX_SDK}/usr/lib/gcc/darwin -L${MACOSX_SDK}/usr/lib/gcc/darwin/${GCC_VERSION} -L${MACOSX_SDK}/usr/lib"
218      ;;
219    x*86*darwin*)
220      MACOSX_SDK=/Developer/SDKs/MacOSX10.4u.sdk
221      GCC_VERSION=4.0
222      ARCH="-arch i386"
223      MACOSX_SDK_CFLAGS="-isysroot ${MACOSX_SDK}"
224      MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CFLAGS}"
225      ;;
226    esac
227    CC=gcc-${GCC_VERSION}
228    CXX=g++-${GCC_VERSION}
229    MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
230    CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}"
231    CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS}"
232    CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
233    OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
234    LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
[1396]235    AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
[1449]236    CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
[1396]237    CACA_DRIVERS="${CACA_DRIVERS} cocoa"
238  elif test "${enable_cocoa}" = "yes"; then
239    AC_MSG_ERROR([cannot find Cocoa development files])
240  fi
241fi
242AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
243
[265]244if test "${enable_ncurses}" != "no"; then
[330]245  ac_cv_my_have_ncurses="no"
[629]246  AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h,
247   [ncurses="no"
248    AC_CHECK_LIB(ncursesw, initscr,
249     [ncurses="-lncursesw"],
250     [AC_CHECK_LIB(ncurses, initscr,
251       [ncurses="-lncurses"])])
252    if test "${ncurses}" = "no"; then
253      continue
254    fi
255    ac_cv_my_have_ncurses="yes"
256    AC_DEFINE(USE_NCURSES, 1, Define to 1 to activate the ncurses backend driver)
257    CACA_LIBS="${CACA_LIBS} ${ncurses}"
258    CACA_DRIVERS="${CACA_DRIVERS} ncurses"
259    dnl  Check for resizeterm or resize_term
260    SAVED_LIBS="${LIBS}"
261    LIBS="${LIBS} ${ncurses}"
262    AC_CHECK_FUNCS(resizeterm resize_term)
263    LIBS="${SAVED_LIBS}"
[610]264    break])
[284]265  if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
266    AC_MSG_ERROR([cannot find ncurses development files])
267  fi
[17]268fi
269
[568]270if test "${enable_vga}" = "yes"; then
271  ac_cv_my_have_vga="yes"
272  CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/kernel.h"
[1056]273  CFLAGS="${CFLAGS} -fno-builtin -O2 -Wall"
[568]274  CCASFLAGS="${CCASFLAGS} -I."
[1056]275  LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000"
[610]276  AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
[568]277  CACA_DRIVERS="${CACA_DRIVERS} vga"
278fi
[570]279AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_vga}" = "yes")
[568]280
[1360]281if test "${enable_debug}" = "yes"; then
282  AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
283fi
284
[1208]285if test "${enable_plugins}" = "yes"; then
286  ac_cv_my_have_plugins="yes"
287  AC_DEFINE(USE_PLUGINS, 1, Define to 1 to activate plugins)
288  CACA_LIBS="${CACA_LIBS} -ldl"
289else
290  CACA_LIBS="${CACA_LIBS} ${X11_LIBS} ${GL_LIBS}"
291fi
292AM_CONDITIONAL(USE_PLUGINS, test "${ac_cv_my_have_plugins}" = "yes")
293
[284]294AC_MSG_CHECKING(valid output drivers)
295if test -z "${CACA_DRIVERS}"; then
296  AC_MSG_RESULT(no)
297  AC_MSG_ERROR([no output drivers were selected!])
298else
[1198]299  CACA_DRIVERS="${CACA_DRIVERS# *}"
[284]300  AC_MSG_RESULT([${CACA_DRIVERS}])
301fi
302
[1048]303
[333]304AC_SUBST(MATH_LIBS)
[1074]305AC_SUBST(GETOPT_LIBS)
[244]306AC_SUBST(CACA_LIBS)
[1208]307AC_SUBST(X11_LIBS)
308AC_SUBST(GL_LIBS)
[17]309
[125]310# Optimizations
311CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
312# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
[483]313# [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
[1449]314# (Comme quoi on n'est pas les seuls porcs)
[1439]315CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
[125]316
[837]317# Build the C++ bindings?
[899]318ac_cv_my_have_cxx="no"
[1953]319if test "${enable_cxx}" != "no"; then
[899]320  ac_cv_my_have_cxx="yes"
[837]321fi
[899]322AM_CONDITIONAL(USE_CXX, test "${ac_cv_my_have_cxx}" = "yes")
[202]323
[1954]324# Build the DotNet bindings?
325ac_cv_my_have_dotnet="no"
326if test "${enable_dotnet}" != "no"; then
327  AC_PATH_PROG(GMCS, gmcs, no)
328  if test "${GMCS}" != "no"; then
329    ac_cv_my_have_dotnet="yes"
330  fi
331fi
332AM_CONDITIONAL(USE_DOTNET, test "${ac_cv_my_have_dotnet}" = "yes")
333
[1951]334# Build the Ruby bindings?
335ac_cv_my_have_ruby="no"
[1953]336if test "${enable_ruby}" != "no"; then
[1951]337  AC_PATH_PROG(RUBY, ruby, no)
338  if test "${RUBY}" != "no"; then
339    AC_MSG_CHECKING(for mkmf.rb)
340    if "${RUBY}" -e 'require "mkmf"' >/dev/null 2>&1; then
341      AC_MSG_RESULT(yes)
342      ac_cv_my_have_ruby="yes"
343    else
344      AC_MSG_RESULT(no)
345    fi
346  fi
347fi
348AM_CONDITIONAL(USE_RUBY, test "${ac_cv_my_have_ruby}" = "yes")
349
[866]350# Build cacaserver?
[976]351ac_cv_my_have_network="no"
352AC_CHECK_HEADERS(sys/socket.h,
353 [ac_cv_my_have_network="yes"])
354AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
[866]355
[288]356# Use Imlib2?
357if test "${enable_imlib2}" != "no"; then
[1198]358  IMLIB2="no"
[1208]359  PKG_CHECK_MODULES(IMLIB2, imlib2, [IMLIB2="yes"], [AC_MSG_RESULT(no)])
[1398]360  if test "${IMLIB2}" != "no"; then
361    AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
[288]362  fi
[224]363fi
[217]364
[747]365# Build development tools?
366PANGOFT2="no"
[1208]367PKG_CHECK_MODULES(PANGOFT2, pangoft2, [PANGOFT2="yes"], [AC_MSG_RESULT(no)])
[856]368AM_CONDITIONAL(USE_PANGO, test "${PANGOFT2}" != "no")
[747]369
[207]370# Build documentation?
[346]371DOXYGEN="no"
372LATEX="no"
373if test "${enable_doc}" != "no"; then
374  AC_PATH_PROG(DOXYGEN, doxygen, no)
[1398]375  if test "${DOXYGEN}" != "no"; then
376    # Build LaTeX documentation?
377    AC_PATH_PROG(LATEX, pdflatex, no)
[1912]378    AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
[1398]379    AC_PATH_PROG(DVIPS, dvips, no)
[1912]380    if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
[1398]381      LATEX="no"
382    fi
[1912]383    if test "${LATEX}" != "no"; then
384      AC_MSG_CHECKING(for a4.sty and a4wide.sty)
385      if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
386        if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
387          AC_MSG_RESULT(yes)
388        else
389          LATEX="no"
390          AC_MSG_RESULT(no)
391        fi
[1829]392      else
393        LATEX="no"
394        AC_MSG_RESULT(no)
395      fi
[1398]396    fi
[346]397  fi
[313]398fi
[346]399AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
400AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
[207]401
[245]402AC_CONFIG_FILES([
[17]403  Makefile
[568]404  kernel/Makefile
[536]405  cucul/Makefile
406  caca/Makefile
[538]407  src/Makefile
[292]408  test/Makefile
[742]409  tools/Makefile
[899]410  cxx/Makefile
[1954]411  DotNet/Makefile
[1951]412  ruby/Makefile
[207]413  doc/Makefile
[344]414  msvc/Makefile
[17]415])
[729]416AC_CONFIG_FILES([
417  cucul/cucul.pc
418  caca/caca.pc
419  doc/doxygen.cfg
420])
[245]421AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
422AC_OUTPUT
[17]423
Note: See TracBrowser for help on using the repository browser.