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.

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