Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

578 řádky
20 KiB

  1. AC_INIT(libcaca, 0.99.beta19pre)
  2. AC_PREREQ(2.50)
  3. AC_CONFIG_AUX_DIR(.auto)
  4. AC_CANONICAL_SYSTEM
  5. dnl We cannot use subdir-objects because of a bug that will eg. remove
  6. dnl ../src/.deps upon distclean when a file from ../src/ is used.
  7. AM_INIT_AUTOMAKE([no-define tar-ustar silent-rules])
  8. dnl AM_MAINTAINER_MODE
  9. AM_DEFAULT_VERBOSITY=0
  10. AM_CONFIG_HEADER(config.h)
  11. LT_MAJOR="0"
  12. LT_MINOR="99"
  13. LT_MICRO="18"
  14. AC_SUBST(LT_MAJOR)
  15. AC_SUBST(LT_MINOR)
  16. AC_SUBST(LT_MICRO)
  17. LT_VERSION="$LT_MAJOR:$LT_MINOR:$LT_MICRO"
  18. AC_SUBST(LT_VERSION)
  19. AM_PROG_CC_C_O
  20. AC_PROG_CPP
  21. AC_PROG_CXX
  22. AC_PROG_CXXCPP
  23. _AM_DEPENDENCIES([OBJC])
  24. OBJC="${CC}"
  25. AC_SUBST(OBJC)
  26. AC_SUBST(OBJCFLAGS)
  27. AM_PROG_AS
  28. AC_LIBTOOL_WIN32_DLL
  29. AM_PROG_LIBTOOL
  30. AC_LIBTOOL_CXX
  31. AC_C_CONST
  32. AC_C_INLINE
  33. AC_TYPE_SIGNAL
  34. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  35. dnl now otherwise it might be set in an obscure if statement. Same thing for
  36. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  37. AC_EGREP_CPP(yes, foo)
  38. PKG_PROG_PKG_CONFIG()
  39. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  40. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  41. export PKG_CONFIG_LIBDIR=/dev/null
  42. fi
  43. AC_MSG_CHECKING(for suffix of libraries)
  44. case "$shrext_cmds" in
  45. .dll) eval LT_SUFFIX="-$LT_MAJOR$shrext_cmds" ;;
  46. "") LT_SUFFIX=".so.$LT_MAJOR" ;;
  47. *) eval LT_SUFFIX="$shrext_cmds.$LT_MAJOR" ;;
  48. esac
  49. AC_MSG_RESULT($LT_SUFFIX)
  50. AC_SUBST(LT_SUFFIX)
  51. dnl global configuration features
  52. AC_ARG_ENABLE(kernel,
  53. [ --enable-kernel kernel mode (default no)])
  54. dnl output driver features
  55. AC_ARG_ENABLE(slang,
  56. [ --enable-slang slang graphics support (autodetected)])
  57. AC_ARG_ENABLE(ncurses,
  58. [ --enable-ncurses ncurses graphics support (autodetected)])
  59. AC_ARG_ENABLE(win32,
  60. [ --enable-win32 Windows console support (autodetected)])
  61. AC_ARG_ENABLE(conio,
  62. [ --enable-conio DOS conio.h graphics support (autodetected)])
  63. AC_ARG_ENABLE(x11,
  64. [ --enable-x11 X11 support (autodetected)])
  65. AC_ARG_ENABLE(gl,
  66. [ --enable-gl OpenGL support (autodetected)])
  67. AC_ARG_ENABLE(cocoa,
  68. [ --enable-cocoa Cocoa support (autodetected)])
  69. AC_ARG_ENABLE(network,
  70. [ --enable-network network support (autodetected)])
  71. AC_ARG_ENABLE(vga,
  72. [ --enable-vga VGA support for kernel mode (autodetected)])
  73. dnl language bindings
  74. AC_ARG_ENABLE(csharp,
  75. [ --enable-csharp C# bindings (autodetected)])
  76. AC_ARG_ENABLE(java,
  77. [ --enable-java Java bindings (autodetected)])
  78. AC_ARG_ENABLE(cxx,
  79. [ --enable-cxx C++ bindings (autodetected)])
  80. AC_ARG_ENABLE(python,
  81. [ --enable-python Python bindings (autodetected)])
  82. AC_ARG_ENABLE(ruby,
  83. [ --enable-ruby Ruby bindings (autodetected)])
  84. dnl example programs features
  85. AC_ARG_ENABLE(imlib2,
  86. [ --enable-imlib2 Imlib2 graphics support (autodetected)])
  87. dnl conditional builds
  88. AC_ARG_ENABLE(debug,
  89. [ --enable-debug build debug versions of the library (default no)])
  90. AC_ARG_ENABLE(profiling,
  91. [ --enable-profiling activate built-in profiling (default no)])
  92. AC_ARG_ENABLE(plugins,
  93. [ --enable-plugins make X11 and GL drivers plugins (default disabled)])
  94. AC_ARG_ENABLE(doc,
  95. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  96. AC_ARG_ENABLE(cppunit,
  97. [ --enable-cppunit use cppunit for unit tests (autodetected)])
  98. AC_ARG_ENABLE(zzuf,
  99. [ --enable-zzuf use zzuf for fuzzing tests (autodetected)])
  100. ac_cv_my_have_kernel="no"
  101. if test "${enable_kernel}" = "yes"; then
  102. ac_cv_my_have_kernel="yes"
  103. CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/klibc.h -fno-stack-protector"
  104. CCASFLAGS="${CCASFLAGS} -I. -fno-stack-protector"
  105. CFLAGS="${CFLAGS} -fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"
  106. LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000 -fno-stack-protector"
  107. AC_DEFINE(USE_KERNEL, 1, Define to 1 to activate kernel mode)
  108. fi
  109. AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_kernel}" = "yes")
  110. 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)
  111. AC_CHECK_FUNCS(signal ioctl snprintf sprintf_s vsnprintf vsnprintf_s getenv putenv strcasecmp htons)
  112. AC_CHECK_FUNCS(usleep gettimeofday atexit)
  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. AC_CHECK_HEADERS(Cocoa/Cocoa.h,
  231. [ac_cv_my_have_cocoa="yes"])
  232. if test "${ac_cv_my_have_cocoa}" = "yes"; then
  233. case x${target} in
  234. xpowerpc*darwin*)
  235. # 10.3 needed to link with X11
  236. MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.3.9.sdk}"
  237. GCC_VERSION="${GCC_VERSION:-3.3}"
  238. ARCH="${ARCH:--arch ppc}"
  239. MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--nostdinc -isystem ${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOSX_SDK}/usr/include}"
  240. 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}"
  241. 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}"
  242. ;;
  243. x*86_64*darwin*)
  244. MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.5.sdk}"
  245. GCC_VERSION="${GCC_VERSION:-4.0}"
  246. ARCH="${ARCH:--arch x86_64}"
  247. MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--isysroot ${MACOSX_SDK}}"
  248. MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:-${MACOSX_SDK_CFLAGS}}"
  249. ;;
  250. x*86*darwin*)
  251. MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.6.sdk}"
  252. GCC_VERSION="${GCC_VERSION:-4.0}"
  253. ARCH="${ARCH:--arch x86_64}"
  254. MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--isysroot ${MACOSX_SDK}}"
  255. MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:-${MACOSX_SDK_CFLAGS}}"
  256. ;;
  257. esac
  258. CC="${CC:-gcc-${GCC_VERSION}}"
  259. CXX="${CXX:-g++-${GCC_VERSION}}"
  260. MACOSX_SDK_FRAMEWORKS="${MACOSX_SDK_FRAMEWORKS:--F${MACOSX_SDK}/System/Library/Frameworks}"
  261. CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}"
  262. CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -mmacosx-version-min=10.5"
  263. CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS} -mmacosx-version-min=10.5"
  264. OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS} -mmacosx-version-min=10.5"
  265. LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
  266. AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
  267. CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
  268. CACA_DRIVERS="${CACA_DRIVERS} cocoa"
  269. elif test "${enable_cocoa}" = "yes"; then
  270. AC_MSG_ERROR([cannot find Cocoa development files])
  271. fi
  272. fi
  273. AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
  274. if test "${enable_ncurses}" != "no"; then
  275. ac_cv_my_have_ncurses="no"
  276. AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h,
  277. [ncurses="no"
  278. AC_CHECK_LIB(ncursesw, initscr,
  279. [ncurses="-lncursesw"],
  280. [AC_CHECK_LIB(ncurses, initscr,
  281. [ncurses="-lncurses"])])
  282. if test "${ncurses}" = "no"; then
  283. continue
  284. fi
  285. ac_cv_my_have_ncurses="yes"
  286. AC_DEFINE(USE_NCURSES, 1, Define to 1 to activate the ncurses backend driver)
  287. CACA_LIBS="${CACA_LIBS} ${ncurses}"
  288. CACA_DRIVERS="${CACA_DRIVERS} ncurses"
  289. dnl Check for resizeterm or resize_term
  290. SAVED_LIBS="${LIBS}"
  291. LIBS="${LIBS} ${ncurses}"
  292. AC_CHECK_FUNCS(resizeterm resize_term)
  293. LIBS="${SAVED_LIBS}"
  294. break])
  295. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  296. AC_MSG_ERROR([cannot find ncurses development files])
  297. fi
  298. fi
  299. if test "${enable_vga}" != "no"; then
  300. if test "${ac_cv_my_have_kernel}" = "yes"; then
  301. AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
  302. CACA_DRIVERS="${CACA_DRIVERS} vga"
  303. elif test "${enable_vga}" = "yes"; then
  304. AC_MSG_ERROR([--enable-vga requires --enable-kernel])
  305. fi
  306. fi
  307. if test "${enable_debug}" = "yes"; then
  308. AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
  309. fi
  310. if test "${enable_profiling}" = "yes"; then
  311. AC_DEFINE(PROF, 1, Define to 1 to activate profiling)
  312. fi
  313. if test "${enable_plugins}" = "yes"; then
  314. ac_cv_my_have_plugins="yes"
  315. AC_DEFINE(USE_PLUGINS, 1, Define to 1 to activate plugins)
  316. CACA_LIBS="${CACA_LIBS} -ldl"
  317. else
  318. CACA_CFLAGS="${CACA_CFLAGS} ${X11_CFLAGS} ${GL_CFLAGS} ${FTGL_CFLAGS}"
  319. CACA_LIBS="${CACA_LIBS} ${X11_LIBS} ${GL_LIBS} ${FTGL_LIBS}"
  320. fi
  321. AM_CONDITIONAL(USE_PLUGINS, test "${ac_cv_my_have_plugins}" = "yes")
  322. AC_MSG_CHECKING(valid output drivers)
  323. if test -z "${CACA_DRIVERS}"; then
  324. AC_MSG_RESULT(no)
  325. AC_MSG_WARN([no output drivers were selected!])
  326. else
  327. CACA_DRIVERS="${CACA_DRIVERS# *}"
  328. AC_MSG_RESULT([${CACA_DRIVERS}])
  329. fi
  330. AC_SUBST(MATH_LIBS)
  331. AC_SUBST(ZLIB_LIBS)
  332. AC_SUBST(GETOPT_LIBS)
  333. AC_SUBST(CACA_CFLAGS)
  334. AC_SUBST(CACA_LIBS)
  335. AC_SUBST(X11_CFLAGS)
  336. AC_SUBST(X11_LIBS)
  337. AC_SUBST(GL_CFLAGS)
  338. AC_SUBST(GL_LIBS)
  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" -a "${ac_cv_my_have_kernel}" != "yes"; 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 Python bindings?
  416. ac_cv_my_have_python="no"
  417. if test "${enable_python}" != "no"; then
  418. AM_PATH_PYTHON(2.2, ac_cv_my_have_python="yes", :)
  419. fi
  420. AM_CONDITIONAL(USE_PYTHON, test "${ac_cv_my_have_python}" = "yes")
  421. # Build the Ruby bindings?
  422. ac_cv_my_have_ruby="no"
  423. if test "${enable_ruby}" != "no"; then
  424. AC_PATH_PROG(RUBY, ruby, no)
  425. if test "${RUBY}" != "no"; then
  426. RUBY_CFLAGS="$(ruby -r mkmf -e 'conf = RbConfig::CONFIG.merge("hdrdir" => $hdrdir, "arch_hdrdir" => $arch_hdrdir); print RbConfig::expand("#$INCFLAGS", conf)')"
  427. RUBY_LIBS="-L$(ruby -r rbconfig -e 'print RbConfig::CONFIG@<:@"libdir"@:>@') -l$(ruby -r rbconfig -e 'print RbConfig::CONFIG@<:@"RUBY_SO_NAME"@:>@')"
  428. RUBY_SITEARCHDIR=`ruby -r rbconfig -e 'print RbConfig::CONFIG@<:@"sitearchdir"@:>@'`
  429. RUBY_SITELIBDIR=`ruby -r rbconfig -e 'print RbConfig::CONFIG@<:@"sitelibdir"@:>@'`
  430. AC_SUBST(RUBY_CFLAGS)
  431. AC_SUBST(RUBY_LIBS)
  432. AC_SUBST(RUBY_SITEARCHDIR)
  433. AC_SUBST(RUBY_SITELIBDIR)
  434. CPPFLAGS="${CPPFLAGS} ${RUBY_CFLAGS}"
  435. AC_CHECK_HEADERS([ruby.h],
  436. [ac_cv_my_have_ruby="yes"
  437. CACA_BINDINGS="${CACA_BINDINGS} Ruby"])
  438. fi
  439. fi
  440. AM_CONDITIONAL(USE_RUBY, test "${ac_cv_my_have_ruby}" = "yes")
  441. AC_MSG_CHECKING(available language bindings)
  442. if test -z "${CACA_BINDINGS}"; then
  443. AC_MSG_RESULT(no)
  444. else
  445. CACA_BINDINGS="${CACA_BINDINGS# *}"
  446. AC_MSG_RESULT([${CACA_BINDINGS}])
  447. fi
  448. # Build cacaserver?
  449. ac_cv_my_have_network="no"
  450. AC_CHECK_HEADERS(sys/socket.h,
  451. [ac_cv_my_have_network="yes"])
  452. AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
  453. # Use Imlib2?
  454. if test "${enable_imlib2}" != "no"; then
  455. PKG_CHECK_MODULES(IMLIB2, imlib2, [IMLIB2="yes"], [IMLIB2="no"])
  456. if test "${IMLIB2}" = "yes"; then
  457. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  458. fi
  459. fi
  460. # Build development tools?
  461. PKG_CHECK_MODULES(PANGOFT2, pangoft2, [PANGOFT2="yes"], [PANGOFT2="no"])
  462. AM_CONDITIONAL(USE_PANGO, test "${PANGOFT2}" = "yes")
  463. # Build documentation?
  464. DOXYGEN="no"
  465. LATEX="no"
  466. if test "${enable_doc}" != "no"; then
  467. AC_PATH_PROG(DOXYGEN, doxygen, no)
  468. if test "${DOXYGEN}" != "no"; then
  469. # Build LaTeX documentation?
  470. AC_PATH_PROG(LATEX, pdflatex, no)
  471. AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
  472. AC_PATH_PROG(DVIPS, dvips, no)
  473. if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
  474. LATEX="no"
  475. fi
  476. if test "${LATEX}" != "no"; then
  477. AC_MSG_CHECKING(for a4.sty and a4wide.sty)
  478. if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
  479. if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
  480. AC_MSG_RESULT(yes)
  481. else
  482. LATEX="no"
  483. AC_MSG_RESULT(no)
  484. fi
  485. else
  486. LATEX="no"
  487. AC_MSG_RESULT(no)
  488. fi
  489. fi
  490. fi
  491. fi
  492. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  493. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  494. # Use cppunit for unit tests?
  495. PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
  496. AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
  497. # Use zzuf for fuzzing tests?
  498. ZZUF="no"
  499. if test "${enable_zzuf}" != "no"; then
  500. AC_PATH_PROG(ZZUF, zzuf, no)
  501. fi
  502. AM_CONDITIONAL(USE_ZZUF, test "${ZZUF}" != "no")
  503. AC_CONFIG_FILES(
  504. [Makefile
  505. kernel/Makefile
  506. caca/Makefile
  507. src/Makefile
  508. examples/Makefile
  509. test/Makefile
  510. tools/Makefile
  511. java/Makefile
  512. caca-sharp/Makefile
  513. cxx/Makefile
  514. python/Makefile
  515. ruby/Makefile
  516. doc/Makefile
  517. win32/Makefile
  518. ])
  519. AC_CONFIG_FILES(
  520. [caca/caca.pc
  521. caca-sharp/caca-sharp.dll.config
  522. cxx/caca++.pc
  523. doc/doxygen.cfg
  524. ])
  525. AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  526. AC_OUTPUT