您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

571 行
19 KiB

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