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

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