25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

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