You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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