Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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