Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

391 wiersze
13 KiB

  1. # $Id$
  2. AC_INIT(caca/caca.c)
  3. AC_PREREQ(2.50)
  4. AC_CONFIG_AUX_DIR(autotools)
  5. AC_CANONICAL_SYSTEM
  6. AM_INIT_AUTOMAKE(libcaca, 0.99.beta12)
  7. LT_VERSION="99:0:99"
  8. AC_SUBST(LT_VERSION)
  9. AM_CONFIG_HEADER(config.h)
  10. AM_PROG_CC_C_O
  11. AC_PROG_CPP
  12. AC_PROG_CXX
  13. AC_PROG_CXXCPP
  14. _AM_DEPENDENCIES([OBJC])
  15. OBJC="${CC}"
  16. AC_SUBST(OBJC)
  17. AC_SUBST(OBJCFLAGS)
  18. AM_PROG_AS
  19. AC_LIBTOOL_WIN32_DLL
  20. AM_PROG_LIBTOOL
  21. AC_LIBTOOL_CXX
  22. AC_C_CONST
  23. AC_C_INLINE
  24. AC_TYPE_SIGNAL
  25. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  26. dnl now otherwise it might be set in an obscure if statement. Same thing for
  27. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  28. AC_EGREP_CPP(yes, foo)
  29. PKG_PROG_PKG_CONFIG()
  30. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  31. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  32. export PKG_CONFIG_LIBDIR=/dev/null
  33. fi
  34. dnl output driver features
  35. AC_ARG_ENABLE(slang,
  36. [ --enable-slang slang graphics support (autodetected)])
  37. AC_ARG_ENABLE(ncurses,
  38. [ --enable-ncurses ncurses graphics support (autodetected)])
  39. AC_ARG_ENABLE(win32,
  40. [ --enable-win32 Windows console support (autodetected)])
  41. AC_ARG_ENABLE(conio,
  42. [ --enable-conio DOS conio.h graphics support (autodetected)])
  43. AC_ARG_ENABLE(x11,
  44. [ --enable-x11 X11 support (autodetected)])
  45. AC_ARG_ENABLE(gl,
  46. [ --enable-gl OpenGL support (autodetected)])
  47. AC_ARG_ENABLE(cocoa,
  48. [ --enable-cocoa Cocoa support (autodetected)])
  49. AC_ARG_ENABLE(network,
  50. [ --enable-network Network support (autodetected)])
  51. AC_ARG_ENABLE(vga,
  52. [ --enable-vga VGA support (default disabled)])
  53. dnl language bindings
  54. AC_ARG_ENABLE(cxx,
  55. [ --enable-cxx C++ bindings (default disabled)])
  56. dnl example programs features
  57. AC_ARG_ENABLE(imlib2,
  58. [ --enable-imlib2 Imlib2 graphics support (autodetected)])
  59. dnl conditional builds
  60. AC_ARG_ENABLE(debug,
  61. [ --enable-debug build debug versions of the library])
  62. AC_ARG_ENABLE(plugins,
  63. [ --enable-plugins build X11 and GL drivers as plugins])
  64. AC_ARG_ENABLE(doc,
  65. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  66. AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h termios.h)
  67. AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp htons)
  68. AC_CHECK_FUNCS(usleep gettimeofday)
  69. AC_CHECK_FUNCS(getopt_long,
  70. [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)],
  71. [AC_CHECK_LIB(gnugetopt, getopt_long,
  72. [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
  73. GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
  74. AC_SUBST(GETOPT_LIBS)
  75. AC_MSG_CHECKING(for Sleep)
  76. AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
  77. [AC_MSG_RESULT(yes)
  78. AC_DEFINE(HAVE_SLEEP, 1, [Define to 1 if you have the `Sleep' function.])],
  79. [AC_MSG_RESULT(no)])
  80. AC_MSG_CHECKING(for fsin/fcos)
  81. AC_TRY_COMPILE([],[asm("fsin\n\tfcos");],
  82. [AC_MSG_RESULT(yes)
  83. AC_DEFINE(HAVE_FSIN_FCOS, 1, [Define to 1 if you have the `fsin' and `fcos' operands.])],
  84. [AC_MSG_RESULT(no)])
  85. AC_MSG_CHECKING(for fldln2/fxch/fyl2x)
  86. AC_TRY_COMPILE([],[asm("fldln2; fldln2; fxch; fyl2x");],
  87. [AC_MSG_RESULT(yes)
  88. AC_DEFINE(HAVE_FLDLN2, 1, [Define to 1 if you have the `fldln2' and other floating points operands.])],
  89. [AC_MSG_RESULT(no)])
  90. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  91. CACA_DRIVERS=""
  92. if test "${enable_conio}" != "no"; then
  93. ac_cv_my_have_conio="no"
  94. AC_CHECK_HEADERS(conio.h,
  95. [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
  96. AC_EGREP_HEADER(ScreenUpdate, pc.h,
  97. [ac_cv_my_have_conio="yes"
  98. AC_MSG_RESULT(yes)
  99. AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
  100. Define to 1 if <pc.h> defines ScreenUpdate.)
  101. AC_DEFINE(USE_CONIO, 1, Define to 1 to activate the conio.h backend driver)
  102. CACA_DRIVERS="${CACA_DRIVERS} conio"],
  103. [AC_MSG_RESULT(no)])])
  104. if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
  105. AC_MSG_ERROR([cannot find conio.h])
  106. fi
  107. fi
  108. if test "${enable_win32}" != "no"; then
  109. ac_cv_my_have_win32="no"
  110. AC_CHECK_HEADERS(windows.h,
  111. [AC_MSG_CHECKING(for AllocConsole in windows.h)
  112. AC_EGREP_HEADER(AllocConsole, windows.h,
  113. [ac_cv_my_have_win32="yes"
  114. AC_MSG_RESULT(yes)
  115. AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
  116. Define to 1 if <windows.h> defines AllocConsole.)
  117. AC_DEFINE(USE_WIN32, 1, Define to 1 to activate the win32 backend driver)
  118. CACA_DRIVERS="${CACA_DRIVERS} win32"],
  119. [AC_MSG_RESULT(no)])])
  120. if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
  121. AC_MSG_ERROR([cannot find win32 console development files])
  122. fi
  123. fi
  124. if test "${enable_slang}" != "no"; then
  125. ac_cv_my_have_slang="no"
  126. AC_CHECK_HEADERS(slang.h slang/slang.h,
  127. [ac_cv_my_have_slang="yes"
  128. AC_DEFINE(USE_SLANG, 1, Define to 1 to activate the slang backend driver)
  129. AC_CHECK_LIB(slang, SLsmg_utf8_enable,
  130. [AC_DEFINE(HAVE_SLSMG_UTF8_ENABLE, 1, Define to 1 if you have the `SLsmg_utf8_enable' function.)])
  131. CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
  132. CACA_LIBS="${CACA_LIBS} -lslang"
  133. CACA_DRIVERS="${CACA_DRIVERS} slang"
  134. break])
  135. if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
  136. AC_MSG_ERROR([cannot find slang development files])
  137. fi
  138. fi
  139. if test "${enable_x11}" != "no"; then
  140. AC_PATH_X
  141. AC_CHECK_LIB(X11, XOpenDisplay,
  142. [ac_cv_my_have_x11="yes"
  143. if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
  144. if test -n "${x_libraries}"; then X_LIBS="-L${x_libraries}"; fi
  145. AC_DEFINE(USE_X11, 1, Define to 1 to activate the X11 backend driver)
  146. CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  147. X11_LIBS="${X11_LIBS} -lX11 ${X_LIBS}"
  148. CACA_DRIVERS="${CACA_DRIVERS} x11"],
  149. [ac_cv_my_have_x11="no"],
  150. [[`if test -n "${x_libraries}"; then echo -L${x_libraries}; fi`]])
  151. AC_CHECK_HEADERS(X11/XKBlib.h)
  152. if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
  153. AC_MSG_ERROR([cannot find X11 development files])
  154. fi
  155. fi
  156. if test "${enable_gl}" != "no"; then
  157. ac_cv_my_have_gl="no"
  158. AC_CHECK_HEADERS(GL/gl.h OpenGL/gl.h,
  159. [AC_CHECK_HEADERS(GL/glut.h,
  160. [AC_CHECK_LIB(glut, glutCloseFunc,
  161. [AC_DEFINE(HAVE_GLUTCLOSEFUNC, 1, Define to 1 if you have the `glutCloseFunc' function.)])
  162. AC_CHECK_LIB(glut, glutMainLoopEvent,
  163. [ac_cv_my_have_gl="yes"])
  164. AC_CHECK_LIB(glut, glutCheckLoop,
  165. [ac_cv_my_have_gl="yes"
  166. AC_DEFINE(HAVE_GLUTCHECKLOOP, 1, Define to 1 if you have the `glutCheckLoop' function.)])])
  167. break])
  168. if test "${ac_cv_my_have_gl}" = "yes"; then
  169. AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver)
  170. GL_LIBS="${GL_LIBS} -lGL -lglut"
  171. CACA_DRIVERS="${CACA_DRIVERS} gl"
  172. elif test "${enable_gl}" = "yes"; then
  173. AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
  174. fi
  175. fi
  176. if test "${enable_cocoa}" != "no"; then
  177. ac_cv_my_have_cocoa="no"
  178. AC_CHECK_HEADERS(Cocoa/Cocoa.h,
  179. [ac_cv_my_have_cocoa="yes"])
  180. if test "${ac_cv_my_have_cocoa}" = "yes"; then
  181. case x${target} in
  182. xpowerpc*darwin*)
  183. # 10.3 needed to link with X11
  184. MACOSX_SDK=/Developer/SDKs/MacOSX10.3.9.sdk
  185. GCC_VERSION=3.3
  186. ARCH="-arch ppc"
  187. MACOSX_SDK_CFLAGS="-nostdinc -isystem ${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOSX_SDK}/usr/include"
  188. 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"
  189. MACOSX_SDK_LDFLAGS="-L${MACOSX_SDK}/usr/lib/gcc/darwin -L${MACOSX_SDK}/usr/lib/gcc/darwin/${GCC_VERSION} -L${MACOSX_SDK}/usr/lib"
  190. ;;
  191. x*86*darwin*)
  192. MACOSX_SDK=/Developer/SDKs/MacOSX10.4u.sdk
  193. GCC_VERSION=4.0
  194. ARCH="-arch i386"
  195. MACOSX_SDK_CFLAGS="-isysroot ${MACOSX_SDK}"
  196. MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CFLAGS}"
  197. ;;
  198. esac
  199. CC=gcc-${GCC_VERSION}
  200. CXX=g++-${GCC_VERSION}
  201. MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
  202. CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}"
  203. CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS}"
  204. CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
  205. OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
  206. LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
  207. AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
  208. CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
  209. CACA_DRIVERS="${CACA_DRIVERS} cocoa"
  210. elif test "${enable_cocoa}" = "yes"; then
  211. AC_MSG_ERROR([cannot find Cocoa development files])
  212. fi
  213. fi
  214. AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
  215. if test "${enable_ncurses}" != "no"; then
  216. ac_cv_my_have_ncurses="no"
  217. AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h,
  218. [ncurses="no"
  219. AC_CHECK_LIB(ncursesw, initscr,
  220. [ncurses="-lncursesw"],
  221. [AC_CHECK_LIB(ncurses, initscr,
  222. [ncurses="-lncurses"])])
  223. if test "${ncurses}" = "no"; then
  224. continue
  225. fi
  226. ac_cv_my_have_ncurses="yes"
  227. AC_DEFINE(USE_NCURSES, 1, Define to 1 to activate the ncurses backend driver)
  228. CACA_LIBS="${CACA_LIBS} ${ncurses}"
  229. CACA_DRIVERS="${CACA_DRIVERS} ncurses"
  230. dnl Check for resizeterm or resize_term
  231. SAVED_LIBS="${LIBS}"
  232. LIBS="${LIBS} ${ncurses}"
  233. AC_CHECK_FUNCS(resizeterm resize_term)
  234. LIBS="${SAVED_LIBS}"
  235. break])
  236. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  237. AC_MSG_ERROR([cannot find ncurses development files])
  238. fi
  239. fi
  240. if test "${enable_vga}" = "yes"; then
  241. ac_cv_my_have_vga="yes"
  242. CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/kernel.h"
  243. CFLAGS="${CFLAGS} -fno-builtin -O2 -Wall"
  244. CCASFLAGS="${CCASFLAGS} -I."
  245. LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000"
  246. AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
  247. CACA_DRIVERS="${CACA_DRIVERS} vga"
  248. fi
  249. AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_vga}" = "yes")
  250. if test "${enable_debug}" = "yes"; then
  251. AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
  252. fi
  253. if test "${enable_plugins}" = "yes"; then
  254. ac_cv_my_have_plugins="yes"
  255. AC_DEFINE(USE_PLUGINS, 1, Define to 1 to activate plugins)
  256. CACA_LIBS="${CACA_LIBS} -ldl"
  257. else
  258. CACA_LIBS="${CACA_LIBS} ${X11_LIBS} ${GL_LIBS}"
  259. fi
  260. AM_CONDITIONAL(USE_PLUGINS, test "${ac_cv_my_have_plugins}" = "yes")
  261. AC_MSG_CHECKING(valid output drivers)
  262. if test -z "${CACA_DRIVERS}"; then
  263. AC_MSG_RESULT(no)
  264. AC_MSG_ERROR([no output drivers were selected!])
  265. else
  266. CACA_DRIVERS="${CACA_DRIVERS# *}"
  267. AC_MSG_RESULT([${CACA_DRIVERS}])
  268. fi
  269. AC_SUBST(MATH_LIBS)
  270. AC_SUBST(GETOPT_LIBS)
  271. AC_SUBST(CACA_LIBS)
  272. AC_SUBST(X11_LIBS)
  273. AC_SUBST(GL_LIBS)
  274. # Optimizations
  275. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  276. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  277. # [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
  278. # (Comme quoi on n'est pas les seuls porcs)
  279. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  280. # Build the C++ bindings?
  281. ac_cv_my_have_cxx="no"
  282. if test "${enable_cxx}" = "yes"; then
  283. ac_cv_my_have_cxx="yes"
  284. fi
  285. AM_CONDITIONAL(USE_CXX, test "${ac_cv_my_have_cxx}" = "yes")
  286. # Build cacaserver?
  287. ac_cv_my_have_network="no"
  288. AC_CHECK_HEADERS(sys/socket.h,
  289. [ac_cv_my_have_network="yes"])
  290. AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
  291. # Use Imlib2?
  292. if test "${enable_imlib2}" != "no"; then
  293. IMLIB2="no"
  294. PKG_CHECK_MODULES(IMLIB2, imlib2, [IMLIB2="yes"], [AC_MSG_RESULT(no)])
  295. if test "${IMLIB2}" != "no"; then
  296. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  297. fi
  298. fi
  299. # Build development tools?
  300. PANGOFT2="no"
  301. PKG_CHECK_MODULES(PANGOFT2, pangoft2, [PANGOFT2="yes"], [AC_MSG_RESULT(no)])
  302. AM_CONDITIONAL(USE_PANGO, test "${PANGOFT2}" != "no")
  303. # Build documentation?
  304. DOXYGEN="no"
  305. LATEX="no"
  306. if test "${enable_doc}" != "no"; then
  307. AC_PATH_PROG(DOXYGEN, doxygen, no)
  308. if test "${DOXYGEN}" != "no"; then
  309. # Build LaTeX documentation?
  310. AC_PATH_PROG(LATEX, pdflatex, no)
  311. AC_PATH_PROG(DVIPS, dvips, no)
  312. if test "${DVIPS}" = "no"; then
  313. LATEX="no"
  314. fi
  315. AC_MSG_CHECKING(for a4.sty)
  316. if test "$(find /usr/share/texmf* -name 'a4.sty')" != ""; then
  317. AC_MSG_RESULT(yes)
  318. AC_MSG_CHECKING(for a4wide.sty)
  319. if test "$(find /usr/share/texmf* -name 'a4wide.sty')" != ""; then
  320. AC_MSG_RESULT(yes)
  321. else
  322. LATEX="no"
  323. AC_MSG_RESULT(no)
  324. fi
  325. else
  326. LATEX="no"
  327. AC_MSG_RESULT(no)
  328. fi
  329. fi
  330. fi
  331. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  332. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  333. AC_CONFIG_FILES([
  334. Makefile
  335. kernel/Makefile
  336. cucul/Makefile
  337. caca/Makefile
  338. src/Makefile
  339. test/Makefile
  340. tools/Makefile
  341. cxx/Makefile
  342. doc/Makefile
  343. msvc/Makefile
  344. ])
  345. AC_CONFIG_FILES([
  346. cucul/cucul.pc
  347. caca/caca.pc
  348. doc/doxygen.cfg
  349. ])
  350. AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  351. AC_OUTPUT