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

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