Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

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