Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

338 rindas
11 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.beta8)
  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_PROG_AS
  15. AC_LIBTOOL_WIN32_DLL
  16. AM_PROG_LIBTOOL
  17. AC_LIBTOOL_CXX
  18. AC_C_CONST
  19. AC_C_INLINE
  20. AC_TYPE_SIGNAL
  21. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  22. dnl now otherwise it might be set in an obscure if statement. Same thing for
  23. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  24. AC_EGREP_CPP(yes, foo)
  25. PKG_PROG_PKG_CONFIG()
  26. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  27. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  28. export PKG_CONFIG_LIBDIR=/dev/null
  29. fi
  30. dnl output driver features
  31. AC_ARG_ENABLE(slang,
  32. [ --enable-slang slang graphics support (autodetected)])
  33. AC_ARG_ENABLE(ncurses,
  34. [ --enable-ncurses ncurses graphics support (autodetected)])
  35. AC_ARG_ENABLE(win32,
  36. [ --enable-win32 Windows console support (autodetected)])
  37. AC_ARG_ENABLE(conio,
  38. [ --enable-conio DOS conio.h graphics support (autodetected)])
  39. AC_ARG_ENABLE(x11,
  40. [ --enable-x11 X11 support (autodetected)])
  41. AC_ARG_ENABLE(gl,
  42. [ --enable-gl OpenGL support (autodetected)])
  43. AC_ARG_ENABLE(network,
  44. [ --enable-network Network support (autodetected)])
  45. AC_ARG_ENABLE(vga,
  46. [ --enable-vga VGA support (default disabled)])
  47. dnl language bindings
  48. AC_ARG_ENABLE(cxx,
  49. [ --enable-cxx C++ bindings (default disabled)])
  50. dnl example programs features
  51. AC_ARG_ENABLE(imlib2,
  52. [ --enable-imlib2 Imlib2 graphics support (default enabled)])
  53. dnl conditional builds
  54. AC_ARG_ENABLE(plugins,
  55. [ --enable-plugins build X11 and GL drivers as plugins])
  56. AC_ARG_ENABLE(doc,
  57. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  58. 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)
  59. AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp htons)
  60. AC_CHECK_FUNCS(usleep gettimeofday)
  61. AC_CHECK_FUNCS(getopt_long,
  62. [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)],
  63. [AC_CHECK_LIB(gnugetopt, getopt_long,
  64. [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
  65. GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
  66. AC_SUBST(GETOPT_LIBS)
  67. AC_MSG_CHECKING(for Sleep)
  68. AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
  69. [AC_MSG_RESULT(yes)
  70. AC_DEFINE(HAVE_SLEEP, 1, [Define to 1 if you have the `Sleep' function.])],
  71. [AC_MSG_RESULT(no)])
  72. AC_MSG_CHECKING(for fsin/fcos)
  73. AC_TRY_COMPILE([],[asm("fsin\n\tfcos");],
  74. [AC_MSG_RESULT(yes)
  75. AC_DEFINE(HAVE_FSIN_FCOS, 1, [Define to 1 if you have the `fsin' and `fcos' operands.])],
  76. [AC_MSG_RESULT(no)])
  77. AC_MSG_CHECKING(for fldln2/fxch/fyl2x)
  78. AC_TRY_COMPILE([],[asm("fldln2; fldln2; fxch; fyl2x");],
  79. [AC_MSG_RESULT(yes)
  80. AC_DEFINE(HAVE_FLDLN2, 1, [Define to 1 if you have the `fldln2' and other floating points operands.])],
  81. [AC_MSG_RESULT(no)])
  82. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  83. CACA_DRIVERS=""
  84. if test "${enable_conio}" != "no"; then
  85. ac_cv_my_have_conio="no"
  86. AC_CHECK_HEADERS(conio.h,
  87. [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
  88. AC_EGREP_HEADER(ScreenUpdate, pc.h,
  89. [ac_cv_my_have_conio="yes"
  90. AC_MSG_RESULT(yes)
  91. AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
  92. Define to 1 if <pc.h> defines ScreenUpdate.)
  93. AC_DEFINE(USE_CONIO, 1, Define to 1 to activate the conio.h backend driver)
  94. CACA_DRIVERS="${CACA_DRIVERS} conio"],
  95. [AC_MSG_RESULT(no)])])
  96. if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
  97. AC_MSG_ERROR([cannot find conio.h])
  98. fi
  99. fi
  100. if test "${enable_win32}" != "no"; then
  101. ac_cv_my_have_win32="no"
  102. AC_CHECK_HEADERS(windows.h,
  103. [AC_MSG_CHECKING(for AllocConsole in windows.h)
  104. AC_EGREP_HEADER(AllocConsole, windows.h,
  105. [ac_cv_my_have_win32="yes"
  106. AC_MSG_RESULT(yes)
  107. AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
  108. Define to 1 if <windows.h> defines AllocConsole.)
  109. AC_DEFINE(USE_WIN32, 1, Define to 1 to activate the win32 backend driver)
  110. CACA_DRIVERS="${CACA_DRIVERS} win32"],
  111. [AC_MSG_RESULT(no)])])
  112. if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
  113. AC_MSG_ERROR([cannot find win32 console development files])
  114. fi
  115. fi
  116. if test "${enable_slang}" != "no"; then
  117. ac_cv_my_have_slang="no"
  118. AC_CHECK_HEADERS(slang.h slang/slang.h,
  119. [ac_cv_my_have_slang="yes"
  120. AC_DEFINE(USE_SLANG, 1, Define to 1 to activate the slang backend driver)
  121. AC_CHECK_LIB(slang, SLsmg_utf8_enable,
  122. [AC_DEFINE(HAVE_SLSMG_UTF8_ENABLE, 1, Define to 1 if you have the `SLsmg_utf8_enable' function.)])
  123. CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
  124. CACA_LIBS="${CACA_LIBS} -lslang"
  125. CACA_DRIVERS="${CACA_DRIVERS} slang"
  126. break])
  127. if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
  128. AC_MSG_ERROR([cannot find slang development files])
  129. fi
  130. fi
  131. if test "${enable_x11}" != "no"; then
  132. AC_PATH_X
  133. AC_CHECK_LIB(X11, XOpenDisplay,
  134. [ac_cv_my_have_x11="yes"
  135. if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
  136. if test -n "${x_libraries}"; then X_LIBS="-L${x_libraries}"; fi
  137. AC_DEFINE(USE_X11, 1, Define to 1 to activate the X11 backend driver)
  138. CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  139. X11_LIBS="${X11_LIBS} -lX11 ${X_LIBS}"
  140. CACA_DRIVERS="${CACA_DRIVERS} x11"],
  141. [ac_cv_my_have_x11="no"],
  142. [[`if test -n "${x_libraries}"; then echo -L${x_libraries}; fi`]])
  143. AC_CHECK_HEADERS(X11/XKBlib.h)
  144. if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
  145. AC_MSG_ERROR([cannot find X11 development files])
  146. fi
  147. fi
  148. if test "${enable_gl}" != "no"; then
  149. ac_cv_my_have_gl="no"
  150. AC_CHECK_HEADERS(GL/gl.h OpenGL/gl.h,
  151. [AC_CHECK_HEADERS(GL/glut.h,
  152. [AC_CHECK_LIB(glut, glutCloseFunc,
  153. [AC_DEFINE(HAVE_GLUTCLOSEFUNC, 1, Define to 1 if you have the `glutCloseFunc' function.)])
  154. AC_CHECK_LIB(glut, glutMainLoopEvent,
  155. [ac_cv_my_have_gl="yes"])
  156. AC_CHECK_LIB(glut, glutCheckLoop,
  157. [ac_cv_my_have_gl="yes"
  158. AC_DEFINE(HAVE_GLUTCHECKLOOP, 1, Define to 1 if you have the `glutCheckLoop' function.)])])
  159. break])
  160. if test "${ac_cv_my_have_gl}" = "yes"; then
  161. AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver)
  162. GL_LIBS="${GL_LIBS} -lGL -lglut"
  163. CACA_DRIVERS="${CACA_DRIVERS} gl"
  164. elif test "${enable_gl}" = "yes"; then
  165. AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
  166. fi
  167. fi
  168. if test "${enable_ncurses}" != "no"; then
  169. ac_cv_my_have_ncurses="no"
  170. AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h,
  171. [ncurses="no"
  172. AC_CHECK_LIB(ncursesw, initscr,
  173. [ncurses="-lncursesw"],
  174. [AC_CHECK_LIB(ncurses, initscr,
  175. [ncurses="-lncurses"])])
  176. if test "${ncurses}" = "no"; then
  177. continue
  178. fi
  179. ac_cv_my_have_ncurses="yes"
  180. AC_DEFINE(USE_NCURSES, 1, Define to 1 to activate the ncurses backend driver)
  181. CACA_LIBS="${CACA_LIBS} ${ncurses}"
  182. CACA_DRIVERS="${CACA_DRIVERS} ncurses"
  183. dnl Check for resizeterm or resize_term
  184. SAVED_LIBS="${LIBS}"
  185. LIBS="${LIBS} ${ncurses}"
  186. AC_CHECK_FUNCS(resizeterm resize_term)
  187. LIBS="${SAVED_LIBS}"
  188. break])
  189. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  190. AC_MSG_ERROR([cannot find ncurses development files])
  191. fi
  192. fi
  193. if test "${enable_vga}" = "yes"; then
  194. ac_cv_my_have_vga="yes"
  195. CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/kernel.h"
  196. CFLAGS="${CFLAGS} -fno-builtin -O2 -Wall"
  197. CCASFLAGS="${CCASFLAGS} -I."
  198. LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000"
  199. AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
  200. CACA_DRIVERS="${CACA_DRIVERS} vga"
  201. fi
  202. AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_vga}" = "yes")
  203. if test "${enable_plugins}" = "yes"; then
  204. ac_cv_my_have_plugins="yes"
  205. AC_DEFINE(USE_PLUGINS, 1, Define to 1 to activate plugins)
  206. CACA_LIBS="${CACA_LIBS} -ldl"
  207. else
  208. CACA_LIBS="${CACA_LIBS} ${X11_LIBS} ${GL_LIBS}"
  209. fi
  210. AM_CONDITIONAL(USE_PLUGINS, test "${ac_cv_my_have_plugins}" = "yes")
  211. AC_MSG_CHECKING(valid output drivers)
  212. if test -z "${CACA_DRIVERS}"; then
  213. AC_MSG_RESULT(no)
  214. AC_MSG_ERROR([no output drivers were selected!])
  215. else
  216. CACA_DRIVERS="${CACA_DRIVERS# *}"
  217. AC_MSG_RESULT([${CACA_DRIVERS}])
  218. fi
  219. AC_SUBST(MATH_LIBS)
  220. AC_SUBST(GETOPT_LIBS)
  221. AC_SUBST(CACA_LIBS)
  222. AC_SUBST(X11_LIBS)
  223. AC_SUBST(GL_LIBS)
  224. # Optimizations
  225. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  226. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  227. # [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
  228. # (Comme quoi on est pas les seuls porcs)
  229. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  230. # Build the C++ bindings?
  231. ac_cv_my_have_cxx="no"
  232. if test "${enable_cxx}" = "yes"; then
  233. ac_cv_my_have_cxx="yes"
  234. fi
  235. AM_CONDITIONAL(USE_CXX, test "${ac_cv_my_have_cxx}" = "yes")
  236. # Build cacaserver?
  237. ac_cv_my_have_network="no"
  238. AC_CHECK_HEADERS(sys/socket.h,
  239. [ac_cv_my_have_network="yes"])
  240. AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
  241. # Use Imlib2?
  242. if test "${enable_imlib2}" != "no"; then
  243. IMLIB2="no"
  244. PKG_CHECK_MODULES(IMLIB2, imlib2, [IMLIB2="yes"], [AC_MSG_RESULT(no)])
  245. if test "${IMLIB2}" = no; then
  246. AC_MSG_ERROR([[cannot find Imlib2 development files. Without Imlib2, cacaview will only open BMP files; if this is really what you want, re-run configure with '--disable-imlib2'.]])
  247. fi
  248. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  249. fi
  250. # Build development tools?
  251. PANGOFT2="no"
  252. PKG_CHECK_MODULES(PANGOFT2, pangoft2, [PANGOFT2="yes"], [AC_MSG_RESULT(no)])
  253. AM_CONDITIONAL(USE_PANGO, test "${PANGOFT2}" != "no")
  254. # Build documentation?
  255. DOXYGEN="no"
  256. LATEX="no"
  257. if test "${enable_doc}" != "no"; then
  258. AC_PATH_PROG(DOXYGEN, doxygen, no)
  259. if test "${DOXYGEN}" = "no"; then
  260. AC_MSG_ERROR([[cannot find doxygen, which is needed to build the libcaca documentation; if this is really what you want, re-run configure with '--disable-doc'.]])
  261. fi
  262. # Build LaTeX documentation?
  263. AC_PATH_PROG(LATEX, pdflatex, no)
  264. AC_PATH_PROG(DVIPS, dvips, no)
  265. if test "${DVIPS}" = "no"; then
  266. LATEX="no"
  267. fi
  268. AC_MSG_CHECKING(for a4wide.sty)
  269. if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
  270. AC_MSG_RESULT(yes)
  271. elif test -f /usr/share/texmf-tetex/tex/latex/a4wide/a4wide.sty; then
  272. AC_MSG_RESULT(yes)
  273. else
  274. LATEX="no"
  275. AC_MSG_RESULT(no)
  276. fi
  277. fi
  278. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  279. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  280. AC_CONFIG_FILES([
  281. Makefile
  282. kernel/Makefile
  283. cucul/Makefile
  284. caca/Makefile
  285. src/Makefile
  286. test/Makefile
  287. tools/Makefile
  288. cxx/Makefile
  289. doc/Makefile
  290. autotools/Makefile
  291. msvc/Makefile
  292. ])
  293. AC_CONFIG_FILES([
  294. cucul/cucul.pc
  295. caca/caca.pc
  296. doc/doxygen.cfg
  297. ])
  298. AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  299. AC_OUTPUT