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.
 
 
 
 
 
 

592 lines
20 KiB

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