選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

587 行
20 KiB

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