選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

configure.ac 9.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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,
  129. [AC_CHECK_HEADERS(GL/glut.h,
  130. [AC_CHECK_LIB(glut, glutMainLoopEvent,
  131. [ac_cv_my_have_gl="yes"
  132. AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver)
  133. CACA_LIBS="${CACA_LIBS} -lGL -lglut"
  134. CACA_DRIVERS="${CACA_DRIVERS} gl"])])])
  135. if test "${ac_cv_my_have_gl}" = "no" -a "${enable_gl}" = "yes"; then
  136. AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
  137. fi
  138. fi
  139. if test "${enable_network}" != "no"; then
  140. ac_cv_my_have_network="no"
  141. AC_CHECK_HEADERS(sys/socket.h,
  142. [ac_cv_my_have_network="yes"
  143. AC_DEFINE(USE_NETWORK, 1, Define to 1 to activate the network backend driver)
  144. CACA_DRIVERS="${CACA_DRIVERS} network"])
  145. if test "${ac_cv_my_have_network}" = "no" -a "${enable_network}" = "yes"; then
  146. AC_MSG_ERROR([cannot find standard networking socket files])
  147. fi
  148. fi
  149. if test "${enable_ncurses}" != "no"; then
  150. ac_cv_my_have_ncurses="no"
  151. AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h,
  152. [ncurses="no"
  153. AC_CHECK_LIB(ncursesw, initscr,
  154. [ncurses="-lncursesw"],
  155. [AC_CHECK_LIB(ncurses, initscr,
  156. [ncurses="-lncurses"])])
  157. if test "${ncurses}" = "no"; then
  158. continue
  159. fi
  160. ac_cv_my_have_ncurses="yes"
  161. AC_DEFINE(USE_NCURSES, 1, Define to 1 to activate the ncurses backend driver)
  162. CACA_LIBS="${CACA_LIBS} ${ncurses}"
  163. CACA_DRIVERS="${CACA_DRIVERS} ncurses"
  164. dnl Check for resizeterm or resize_term
  165. SAVED_LIBS="${LIBS}"
  166. LIBS="${LIBS} ${ncurses}"
  167. AC_CHECK_FUNCS(resizeterm resize_term)
  168. LIBS="${SAVED_LIBS}"
  169. break])
  170. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  171. AC_MSG_ERROR([cannot find ncurses development files])
  172. fi
  173. fi
  174. if test "${enable_vga}" = "yes"; then
  175. ac_cv_my_have_vga="yes"
  176. CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/kernel.h"
  177. CFLAGS="${CFLAGS} -fno-builtin -O2 -Wall"
  178. CCASFLAGS="${CCASFLAGS} -I."
  179. LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000"
  180. AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
  181. CACA_DRIVERS="${CACA_DRIVERS} vga"
  182. fi
  183. AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_vga}" = "yes")
  184. AC_MSG_CHECKING(valid output drivers)
  185. if test -z "${CACA_DRIVERS}"; then
  186. AC_MSG_RESULT(no)
  187. AC_MSG_ERROR([no output drivers were selected!])
  188. else
  189. AC_MSG_RESULT([${CACA_DRIVERS}])
  190. fi
  191. AC_SUBST(MATH_LIBS)
  192. AC_SUBST(CACA_LIBS)
  193. AC_SUBST(CUCUL_LIBS)
  194. # Optimizations
  195. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  196. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  197. # [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
  198. # (Comme quoi on est pas les seuls porcs)
  199. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  200. # Build the PIC library?
  201. case "${target_os}" in
  202. *mingw32* | *cygwin* | *djgpp*)
  203. NEED_PIC=false
  204. ;;
  205. *)
  206. NEED_PIC=:
  207. ;;
  208. esac
  209. AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
  210. # Use Imlib2?
  211. ac_cv_my_have_imlib2="no"
  212. save_CPPFLAGS="${CPPFLAGS}"
  213. if test "${enable_imlib2}" != "no"; then
  214. AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
  215. if test "${IMLIB2_CONFIG}" != "no"; then
  216. CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
  217. fi
  218. AC_CHECK_HEADERS(Imlib2.h,
  219. ac_cv_my_have_imlib2="yes",
  220. [ac_cv_my_have_imlib2="no"
  221. 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'.]])])
  222. CPPFLAGS="${save_CPPFLAGS}"
  223. fi
  224. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  225. # Build documentation?
  226. DOXYGEN="no"
  227. LATEX="no"
  228. if test "${enable_doc}" != "no"; then
  229. AC_PATH_PROG(DOXYGEN, doxygen, no)
  230. if test "${DOXYGEN}" = "no"; then
  231. 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'.]])
  232. fi
  233. # Build LaTeX documentation?
  234. AC_PATH_PROG(LATEX, latex, no)
  235. AC_PATH_PROG(DVIPS, dvips, no)
  236. if test "${DVIPS}" = "no"; then
  237. LATEX="no"
  238. fi
  239. AC_MSG_CHECKING(for a4wide.sty)
  240. if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
  241. AC_MSG_RESULT(yes)
  242. elif test -f /usr/share/texmf-tetex/tex/latex/a4wide/a4wide.sty; then
  243. AC_MSG_RESULT(yes)
  244. else
  245. LATEX="no"
  246. AC_MSG_RESULT(no)
  247. fi
  248. fi
  249. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  250. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  251. AC_CONFIG_FILES([
  252. Makefile
  253. kernel/Makefile
  254. cucul/Makefile
  255. caca/Makefile
  256. src/Makefile
  257. test/Makefile
  258. doc/Makefile
  259. doc/doxygen.cfg
  260. autotools/Makefile
  261. debian/Makefile
  262. msvc/Makefile
  263. ])
  264. AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  265. AC_OUTPUT