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.

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