You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 11 KiB

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