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 10 KiB

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