You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

516 lines
17 KiB

  1. # $Id$
  2. AC_INIT(libcaca, 0.99.beta16)
  3. AC_PREREQ(2.50)
  4. AC_CONFIG_AUX_DIR(.auto)
  5. AC_CANONICAL_SYSTEM
  6. AM_INIT_AUTOMAKE([no-define tar-ustar])
  7. dnl AM_MAINTAINER_MODE
  8. AM_CONFIG_HEADER(config.h)
  9. LT_MAJOR="0"
  10. LT_MINOR="99"
  11. LT_MICRO="16"
  12. AC_SUBST(LT_MAJOR)
  13. AC_SUBST(LT_MINOR)
  14. AC_SUBST(LT_MICRO)
  15. LT_VERSION="$LT_MAJOR:$LT_MINOR:$LT_MICRO"
  16. AC_SUBST(LT_VERSION)
  17. AM_PROG_CC_C_O
  18. AC_PROG_CPP
  19. AC_PROG_CXX
  20. AC_PROG_CXXCPP
  21. _AM_DEPENDENCIES([OBJC])
  22. OBJC="${CC}"
  23. AC_SUBST(OBJC)
  24. AC_SUBST(OBJCFLAGS)
  25. AM_PROG_AS
  26. AC_LIBTOOL_WIN32_DLL
  27. AM_PROG_LIBTOOL
  28. AC_LIBTOOL_CXX
  29. AC_C_CONST
  30. AC_C_INLINE
  31. AC_TYPE_SIGNAL
  32. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  33. dnl now otherwise it might be set in an obscure if statement. Same thing for
  34. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  35. AC_EGREP_CPP(yes, foo)
  36. PKG_PROG_PKG_CONFIG()
  37. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  38. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  39. export PKG_CONFIG_LIBDIR=/dev/null
  40. fi
  41. AC_MSG_CHECKING(for library suffix)
  42. LT_SUFFIX="`./libtool -n --mode=link gcc -o libTEST.la -no-undefined -version-number 123:666:999 -rpath / | xargs -n 1 | sed -ne 's/.*libTEST\(@<:@^, ()0-9@:>@*\)123\(@<:@^, ()0-9@:>@*\).*/\1'$LT_MAJOR'\2/p' | grep -v '\.$' | head -n 1`"
  43. if test "$LT_SUFFIX" = ""; then
  44. LT_SUFFIX=".so.$LT_MAJOR"
  45. AC_MSG_RESULT([unknown, defaulting to $LT_SUFFIX])
  46. else
  47. AC_MSG_RESULT($LT_SUFFIX)
  48. fi
  49. AC_SUBST(LT_SUFFIX)
  50. dnl output driver features
  51. AC_ARG_ENABLE(slang,
  52. [ --enable-slang slang graphics support (autodetected)])
  53. AC_ARG_ENABLE(ncurses,
  54. [ --enable-ncurses ncurses graphics support (autodetected)])
  55. AC_ARG_ENABLE(win32,
  56. [ --enable-win32 Windows console support (autodetected)])
  57. AC_ARG_ENABLE(conio,
  58. [ --enable-conio DOS conio.h graphics support (autodetected)])
  59. AC_ARG_ENABLE(x11,
  60. [ --enable-x11 X11 support (autodetected)])
  61. AC_ARG_ENABLE(gl,
  62. [ --enable-gl OpenGL support (autodetected)])
  63. AC_ARG_ENABLE(cocoa,
  64. [ --enable-cocoa Cocoa support (autodetected)])
  65. AC_ARG_ENABLE(network,
  66. [ --enable-network Network support (autodetected)])
  67. AC_ARG_ENABLE(vga,
  68. [ --enable-vga VGA support (default disabled)])
  69. dnl language bindings
  70. AC_ARG_ENABLE(csharp,
  71. [ --enable-csharp C# bindings (autodetected)])
  72. AC_ARG_ENABLE(cxx,
  73. [ --enable-cxx C++ bindings (autodetected)])
  74. AC_ARG_ENABLE(ruby,
  75. [ --enable-ruby Ruby bindings (autodetected)])
  76. dnl example programs features
  77. AC_ARG_ENABLE(imlib2,
  78. [ --enable-imlib2 Imlib2 graphics support (autodetected)])
  79. dnl conditional builds
  80. AC_ARG_ENABLE(debug,
  81. [ --enable-debug build debug versions of the library (default no)])
  82. AC_ARG_ENABLE(plugins,
  83. [ --enable-plugins make X11 and GL drivers plugins (default disabled)])
  84. AC_ARG_ENABLE(doc,
  85. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  86. AC_ARG_ENABLE(cppunit,
  87. [ --enable-cppunit use cppunit for unit tests (autodetected)])
  88. AC_ARG_ENABLE(zzuf,
  89. [ --enable-zzuf use zzuf for fuzzing tests (autodetected)])
  90. AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h termios.h)
  91. AC_CHECK_FUNCS(signal ioctl snprintf vsnprintf getenv putenv strcasecmp htons)
  92. AC_CHECK_FUNCS(usleep gettimeofday)
  93. ac_cv_have_getopt_long="no"
  94. AC_CHECK_FUNCS(getopt_long,
  95. [ac_cv_have_getopt_long="yes"],
  96. [AC_CHECK_LIB(gnugetopt, getopt_long,
  97. [ac_cv_have_getopt_long="yes"
  98. GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
  99. if test "$ac_cv_have_getopt_long" != "no"; then
  100. AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the ‘getopt_long’ function.)
  101. fi
  102. AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
  103. AC_SUBST(GETOPT_LIBS)
  104. AC_MSG_CHECKING(for Sleep)
  105. AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
  106. [AC_MSG_RESULT(yes)
  107. AC_DEFINE(HAVE_SLEEP, 1, [Define to 1 if you have the ‘Sleep’ function.])],
  108. [AC_MSG_RESULT(no)])
  109. AC_MSG_CHECKING(for fsin/fcos)
  110. AC_TRY_COMPILE([],[double x; asm volatile("fsin; fcos":"=t"(x):);],
  111. [AC_MSG_RESULT(yes)
  112. AC_DEFINE(HAVE_FSIN_FCOS, 1, [Define to 1 if you have the ‘fsin’ and ‘fcos’ instructions.])],
  113. [AC_MSG_RESULT(no)])
  114. AC_MSG_CHECKING(for fldln2/fxch/fyl2x)
  115. AC_TRY_COMPILE([],[double x; asm volatile("fldln2; fldln2; fxch; fyl2x":"=t"(x):);],
  116. [AC_MSG_RESULT(yes)
  117. AC_DEFINE(HAVE_FLDLN2, 1, [Define to 1 if you have the ‘fldln2’ and other floating point instructions.])],
  118. [AC_MSG_RESULT(no)])
  119. AC_CHECK_HEADERS(zlib.h)
  120. AC_CHECK_LIB(z, gzopen, [ZLIB_LIBS="${ZLIB_LIBS} -lz"])
  121. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  122. CACA_DRIVERS=""
  123. if test "${enable_conio}" != "no"; then
  124. ac_cv_my_have_conio="no"
  125. AC_CHECK_HEADERS(conio.h,
  126. [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
  127. AC_EGREP_HEADER(ScreenUpdate, pc.h,
  128. [ac_cv_my_have_conio="yes"
  129. AC_MSG_RESULT(yes)
  130. AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
  131. Define to 1 if <pc.h> defines ScreenUpdate.)
  132. AC_DEFINE(USE_CONIO, 1, Define to 1 to activate the conio.h backend driver)
  133. CACA_DRIVERS="${CACA_DRIVERS} conio"],
  134. [AC_MSG_RESULT(no)])])
  135. if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
  136. AC_MSG_ERROR([cannot find conio.h])
  137. fi
  138. fi
  139. if test "${enable_win32}" != "no"; then
  140. ac_cv_my_have_win32="no"
  141. AC_CHECK_HEADERS(windows.h,
  142. [AC_MSG_CHECKING(for AllocConsole in windows.h)
  143. AC_EGREP_HEADER(AllocConsole, windows.h,
  144. [ac_cv_my_have_win32="yes"
  145. AC_MSG_RESULT(yes)
  146. AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
  147. Define to 1 if <windows.h> defines AllocConsole.)
  148. AC_DEFINE(USE_WIN32, 1, Define to 1 to activate the win32 backend driver)
  149. CACA_DRIVERS="${CACA_DRIVERS} win32"],
  150. [AC_MSG_RESULT(no)])])
  151. if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
  152. AC_MSG_ERROR([cannot find win32 console development files])
  153. fi
  154. fi
  155. if test "${enable_slang}" != "no"; then
  156. ac_cv_my_have_slang="no"
  157. AC_CHECK_HEADERS(slang.h slang/slang.h,
  158. [ac_cv_my_have_slang="yes"
  159. AC_DEFINE(USE_SLANG, 1, Define to 1 to activate the slang backend driver)
  160. AC_CHECK_LIB(slang, SLsmg_utf8_enable,
  161. [AC_DEFINE(HAVE_SLSMG_UTF8_ENABLE, 1, Define to 1 if you have the ‘SLsmg_utf8_enable’ function.)])
  162. CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
  163. CACA_LIBS="${CACA_LIBS} -lslang"
  164. CACA_DRIVERS="${CACA_DRIVERS} slang"
  165. break])
  166. if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
  167. AC_MSG_ERROR([cannot find slang development files])
  168. fi
  169. fi
  170. if test "${enable_x11}" != "no"; then
  171. AC_PATH_X
  172. AC_CHECK_LIB(X11, XOpenDisplay,
  173. [ac_cv_my_have_x11="yes"
  174. if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
  175. if test -n "${x_libraries}"; then X_LIBS="-L${x_libraries}"; fi
  176. AC_DEFINE(USE_X11, 1, Define to 1 to activate the X11 backend driver)
  177. CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  178. X11_LIBS="${X11_LIBS} -lX11 ${X_LIBS}"
  179. CACA_DRIVERS="${CACA_DRIVERS} x11"],
  180. [ac_cv_my_have_x11="no"],
  181. [[`if test -n "${x_libraries}"; then echo -L${x_libraries}; fi`]])
  182. AC_CHECK_HEADERS(X11/XKBlib.h)
  183. if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
  184. AC_MSG_ERROR([cannot find X11 development files])
  185. fi
  186. fi
  187. if test "${enable_gl}" != "no"; then
  188. ac_cv_my_have_gl="no"
  189. AC_CHECK_HEADERS(GL/gl.h OpenGL/gl.h,
  190. [AC_CHECK_HEADERS(GL/glut.h,
  191. [AC_CHECK_LIB(glut, glutCloseFunc,
  192. [AC_DEFINE(HAVE_GLUTCLOSEFUNC, 1, Define to 1 if you have the ‘glutCloseFunc’ function.)])
  193. AC_CHECK_LIB(glut, glutMainLoopEvent,
  194. [ac_cv_my_have_gl="yes"])
  195. AC_CHECK_LIB(glut, glutCheckLoop,
  196. [ac_cv_my_have_gl="yes"
  197. AC_DEFINE(HAVE_GLUTCHECKLOOP, 1, Define to 1 if you have the ‘glutCheckLoop’ function.)])])
  198. break])
  199. if test "${ac_cv_my_have_gl}" = "yes"; then
  200. AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver)
  201. GL_LIBS="${GL_LIBS} -lGL -lglut"
  202. CACA_DRIVERS="${CACA_DRIVERS} gl"
  203. elif test "${enable_gl}" = "yes"; then
  204. AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
  205. fi
  206. PKG_CHECK_MODULES(FTGL, ftgl >= 2.1.3, [FTGL="yes"], [FTGL="no"])
  207. fi
  208. AM_CONDITIONAL(USE_FTGL, test "${FTGL}" = "yes")
  209. if test "${enable_cocoa}" != "no"; then
  210. ac_cv_my_have_cocoa="no"
  211. AC_CHECK_HEADERS(Cocoa/Cocoa.h,
  212. [ac_cv_my_have_cocoa="yes"])
  213. if test "${ac_cv_my_have_cocoa}" = "yes"; then
  214. case x${target} in
  215. xpowerpc*darwin*)
  216. # 10.3 needed to link with X11
  217. MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.3.9.sdk}"
  218. GCC_VERSION="${GCC_VERSION:-3.3}"
  219. ARCH="${ARCH:--arch ppc}"
  220. MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--nostdinc -isystem ${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOSX_SDK}/usr/include}"
  221. MACOSX_SDK_CXXFLAGS="${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}"
  222. MACOSX_SDK_LDFLAGS="${MACOSX_SDK_LDFLAGS:--L${MACOSX_SDK}/usr/lib/gcc/darwin -L${MACOSX_SDK}/usr/lib/gcc/darwin/${GCC_VERSION} -L${MACOSX_SDK}/usr/lib}"
  223. ;;
  224. x*86_64*darwin*)
  225. MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.5.sdk}"
  226. GCC_VERSION="${GCC_VERSION:-4.0}"
  227. ARCH="${ARCH:--arch i386}"
  228. MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--isysroot ${MACOSX_SDK}}"
  229. MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:-${MACOSX_SDK_CFLAGS}}"
  230. ;;
  231. x*86*darwin*)
  232. MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.4u.sdk}"
  233. GCC_VERSION="${GCC_VERSION:-4.0}"
  234. ARCH="${ARCH:--arch i386}"
  235. MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--isysroot ${MACOSX_SDK}}"
  236. MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:-${MACOSX_SDK_CFLAGS}}"
  237. ;;
  238. esac
  239. CC="${CC:-gcc-${GCC_VERSION}}"
  240. CXX="${CXX:-g++-${GCC_VERSION}}"
  241. MACOSX_SDK_FRAMEWORKS="${MACOSX_SDK_FRAMEWORKS:--F${MACOSX_SDK}/System/Library/Frameworks}"
  242. CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}"
  243. CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS}"
  244. CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
  245. OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
  246. LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
  247. AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
  248. CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
  249. CACA_DRIVERS="${CACA_DRIVERS} cocoa"
  250. elif test "${enable_cocoa}" = "yes"; then
  251. AC_MSG_ERROR([cannot find Cocoa development files])
  252. fi
  253. fi
  254. AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
  255. if test "${enable_ncurses}" != "no"; then
  256. ac_cv_my_have_ncurses="no"
  257. AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h,
  258. [ncurses="no"
  259. AC_CHECK_LIB(ncursesw, initscr,
  260. [ncurses="-lncursesw"],
  261. [AC_CHECK_LIB(ncurses, initscr,
  262. [ncurses="-lncurses"])])
  263. if test "${ncurses}" = "no"; then
  264. continue
  265. fi
  266. ac_cv_my_have_ncurses="yes"
  267. AC_DEFINE(USE_NCURSES, 1, Define to 1 to activate the ncurses backend driver)
  268. CACA_LIBS="${CACA_LIBS} ${ncurses}"
  269. CACA_DRIVERS="${CACA_DRIVERS} ncurses"
  270. dnl Check for resizeterm or resize_term
  271. SAVED_LIBS="${LIBS}"
  272. LIBS="${LIBS} ${ncurses}"
  273. AC_CHECK_FUNCS(resizeterm resize_term)
  274. LIBS="${SAVED_LIBS}"
  275. break])
  276. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  277. AC_MSG_ERROR([cannot find ncurses development files])
  278. fi
  279. fi
  280. if test "${enable_vga}" = "yes"; then
  281. ac_cv_my_have_vga="yes"
  282. CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/kernel.h -fno-stack-protector"
  283. CFLAGS="${CFLAGS} -fno-builtin -O2 -Wall -fno-stack-protector"
  284. CCASFLAGS="${CCASFLAGS} -I. -fno-stack-protector"
  285. LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000 -fno-stack-protector"
  286. AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
  287. CACA_DRIVERS="${CACA_DRIVERS} vga"
  288. fi
  289. AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_vga}" = "yes")
  290. if test "${enable_debug}" = "yes"; then
  291. AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
  292. fi
  293. if test "${enable_plugins}" = "yes"; then
  294. ac_cv_my_have_plugins="yes"
  295. AC_DEFINE(USE_PLUGINS, 1, Define to 1 to activate plugins)
  296. CACA_LIBS="${CACA_LIBS} -ldl"
  297. else
  298. CACA_CFLAGS="${CACA_CFLAGS} ${X11_CFLAGS} ${GL_CFLAGS} ${FTGL_CFLAGS}"
  299. CACA_LIBS="${CACA_LIBS} ${X11_LIBS} ${GL_LIBS} ${FTGL_LIBS}"
  300. fi
  301. AM_CONDITIONAL(USE_PLUGINS, test "${ac_cv_my_have_plugins}" = "yes")
  302. AC_MSG_CHECKING(valid output drivers)
  303. if test -z "${CACA_DRIVERS}"; then
  304. AC_MSG_RESULT(no)
  305. AC_MSG_ERROR([no output drivers were selected!])
  306. else
  307. CACA_DRIVERS="${CACA_DRIVERS# *}"
  308. AC_MSG_RESULT([${CACA_DRIVERS}])
  309. fi
  310. AC_SUBST(MATH_LIBS)
  311. AC_SUBST(ZLIB_LIBS)
  312. AC_SUBST(GETOPT_LIBS)
  313. AC_SUBST(CACA_CFLAGS)
  314. AC_SUBST(CACA_LIBS)
  315. AC_SUBST(X11_CFLAGS)
  316. AC_SUBST(X11_LIBS)
  317. AC_SUBST(GL_CFLAGS)
  318. AC_SUBST(GL_LIBS)
  319. # How to get the C99 types. See caca/caca_types.h.in for details about
  320. # the CACA_TYPES variable
  321. if test "${ac_cv_my_have_vga}" = "yes"; then
  322. CACA_TYPES=0
  323. else
  324. AC_CHECK_HEADERS(stdint.h,
  325. [CACA_TYPES=1],
  326. [AC_CHECK_HEADERS(inttypes.h,
  327. [CACA_TYPES=2],
  328. [AC_CHECK_HEADERS(windows.h,
  329. [CACA_TYPES=3],
  330. [CACA_TYPES=0])])])
  331. fi
  332. AC_SUBST(CACA_TYPES)
  333. # Optimizations
  334. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  335. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  336. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  337. CACA_BINDINGS=""
  338. # Build the C++ bindings?
  339. ac_cv_my_have_cxx="no"
  340. if test "${enable_cxx}" != "no"; then
  341. AC_MSG_CHECKING([working <iostream>])
  342. AC_LANG_PUSH(C++)
  343. AC_TRY_COMPILE(
  344. [#include <iostream>],
  345. [],
  346. [ac_cv_my_have_cxx="yes"
  347. CACA_BINDINGS="${CACA_BINDINGS} C++"])
  348. AC_LANG_POP(C++)
  349. AC_MSG_RESULT([$ac_cv_my_have_cxx])
  350. fi
  351. AM_CONDITIONAL(USE_CXX, test "${ac_cv_my_have_cxx}" = "yes")
  352. # Build the .NET bindings?
  353. ac_cv_my_have_csharp="no"
  354. if test "${enable_csharp}" != "no"; then
  355. AC_PATH_PROG(GMCS, gmcs, no)
  356. AC_PATH_PROG(GACUTIL, gacutil, no)
  357. if test "${GMCS}" != "no" -a "${GACUTIL}" != "no"; then
  358. ac_cv_my_have_csharp="yes"
  359. CACA_BINDINGS="${CACA_BINDINGS} C#"
  360. fi
  361. fi
  362. AM_CONDITIONAL(USE_CSHARP, test "${ac_cv_my_have_csharp}" = "yes")
  363. # Build the Ruby bindings?
  364. ac_cv_my_have_ruby="no"
  365. if test "${enable_ruby}" != "no"; then
  366. AC_PATH_PROG(RUBY, ruby, no)
  367. if test "${RUBY}" != "no"; then
  368. RUBY_CFLAGS="-I$(ruby -r rbconfig -e 'print Config::CONFIG@<:@"archdir"@:>@')"
  369. RUBY_LIBS="-L$(ruby -r rbconfig -e 'print Config::CONFIG@<:@"libdir"@:>@') -l$(ruby -r rbconfig -e 'print Config::CONFIG@<:@"RUBY_SO_NAME"@:>@')"
  370. RUBY_SITEARCHDIR=`ruby -r rbconfig -e 'print Config::CONFIG@<:@"sitearchdir"@:>@'`
  371. RUBY_SITELIBDIR=`ruby -r rbconfig -e 'print Config::CONFIG@<:@"sitelibdir"@:>@'`
  372. AC_SUBST(RUBY_CFLAGS)
  373. AC_SUBST(RUBY_LIBS)
  374. AC_SUBST(RUBY_SITEARCHDIR)
  375. AC_SUBST(RUBY_SITELIBDIR)
  376. CPPFLAGS="${CPPFLAGS} ${RUBY_CFLAGS}"
  377. AC_CHECK_HEADERS([ruby.h],
  378. [ac_cv_my_have_ruby="yes"
  379. CACA_BINDINGS="${CACA_BINDINGS} Ruby"])
  380. fi
  381. fi
  382. AM_CONDITIONAL(USE_RUBY, test "${ac_cv_my_have_ruby}" = "yes")
  383. AC_MSG_CHECKING(available language bindings)
  384. if test -z "${CACA_BINDINGS}"; then
  385. AC_MSG_RESULT(no)
  386. else
  387. CACA_BINDINGS="${CACA_BINDINGS# *}"
  388. AC_MSG_RESULT([${CACA_BINDINGS}])
  389. fi
  390. # Build cacaserver?
  391. ac_cv_my_have_network="no"
  392. AC_CHECK_HEADERS(sys/socket.h,
  393. [ac_cv_my_have_network="yes"])
  394. AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
  395. # Use Imlib2?
  396. if test "${enable_imlib2}" != "no"; then
  397. PKG_CHECK_MODULES(IMLIB2, imlib2, [IMLIB2="yes"], [IMLIB2="no"])
  398. if test "${IMLIB2}" = "yes"; then
  399. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  400. fi
  401. fi
  402. # Build development tools?
  403. PKG_CHECK_MODULES(PANGOFT2, pangoft2, [PANGOFT2="yes"], [PANGOFT2="no"])
  404. AM_CONDITIONAL(USE_PANGO, test "${PANGOFT2}" = "yes")
  405. # Build documentation?
  406. DOXYGEN="no"
  407. LATEX="no"
  408. if test "${enable_doc}" != "no"; then
  409. AC_PATH_PROG(DOXYGEN, doxygen, no)
  410. if test "${DOXYGEN}" != "no"; then
  411. # Build LaTeX documentation?
  412. AC_PATH_PROG(LATEX, pdflatex, no)
  413. AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
  414. AC_PATH_PROG(DVIPS, dvips, no)
  415. if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
  416. LATEX="no"
  417. fi
  418. if test "${LATEX}" != "no"; then
  419. AC_MSG_CHECKING(for a4.sty and a4wide.sty)
  420. if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
  421. if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
  422. AC_MSG_RESULT(yes)
  423. else
  424. LATEX="no"
  425. AC_MSG_RESULT(no)
  426. fi
  427. else
  428. LATEX="no"
  429. AC_MSG_RESULT(no)
  430. fi
  431. fi
  432. fi
  433. fi
  434. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  435. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  436. # Use cppunit for unit tests?
  437. PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
  438. AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
  439. # Use zzuf for fuzzing tests?
  440. ZZUF="no"
  441. if test "${enable_zzuf}" != "no"; then
  442. AC_PATH_PROG(ZZUF, zzuf, no)
  443. fi
  444. AM_CONDITIONAL(USE_ZZUF, test "${ZZUF}" != "no")
  445. AC_CONFIG_FILES([
  446. Makefile
  447. kernel/Makefile
  448. caca/Makefile
  449. src/Makefile
  450. examples/Makefile
  451. tests/Makefile
  452. tools/Makefile
  453. caca-sharp/Makefile
  454. cxx/Makefile
  455. python/Makefile
  456. ruby/Makefile
  457. doc/Makefile
  458. win32/Makefile
  459. ])
  460. AC_CONFIG_FILES([
  461. caca/caca_types.h
  462. caca/caca.pc
  463. caca-sharp/caca-sharp.dll.config
  464. cxx/caca++.pc
  465. doc/doxygen.cfg
  466. ])
  467. AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  468. AC_OUTPUT