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.
 
 
 
 
 
 

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