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.

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