Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

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