Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

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