Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

252 rader
7.9 KiB

  1. # $Id$
  2. AC_INIT(src/caca.c)
  3. AC_PREREQ(2.50)
  4. AC_CONFIG_AUX_DIR(autotools)
  5. AC_CANONICAL_SYSTEM
  6. AM_INIT_AUTOMAKE(libcaca, 0.9)
  7. AM_CONFIG_HEADER(config.h)
  8. AM_PROG_CC_C_O
  9. AC_PROG_CPP
  10. AC_LIBTOOL_WIN32_DLL
  11. AC_DISABLE_SHARED
  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(null,
  33. [ --enable-null Null driver support (autodetected)])
  34. dnl example programs features
  35. AC_ARG_ENABLE(imlib2,
  36. [ --enable-imlib2 Imlib2 graphics support (default enabled)])
  37. dnl conditional builds
  38. AC_ARG_ENABLE(doc,
  39. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  40. AC_CHECK_HEADERS(signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h)
  41. AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp)
  42. AC_CHECK_FUNCS(usleep gettimeofday)
  43. AC_MSG_CHECKING(for Sleep)
  44. AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
  45. [AC_MSG_RESULT(yes)
  46. AC_DEFINE(HAVE_SLEEP, 1, [Define if you have Windows' Sleep])],
  47. [AC_MSG_RESULT(no)])
  48. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  49. CACA_DRIVERS=""
  50. if test "${enable_conio}" != "no"; then
  51. ac_cv_my_have_conio="no"
  52. AC_CHECK_HEADERS(conio.h,
  53. [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
  54. AC_EGREP_HEADER(ScreenUpdate, pc.h,
  55. [ac_cv_my_have_conio="yes"
  56. AC_MSG_RESULT(yes)
  57. AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
  58. Define if <pc.h> defines ScreenUpdate.)
  59. AC_DEFINE(USE_CONIO, 1, Define to activate the conio.h backend driver)
  60. CACA_DRIVERS="${CACA_DRIVERS} conio"],
  61. [AC_MSG_RESULT(no)])])
  62. if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
  63. AC_MSG_ERROR([cannot find conio.h])
  64. fi
  65. fi
  66. if test "${enable_win32}" != "no"; then
  67. ac_cv_my_have_win32="no"
  68. AC_CHECK_HEADERS(windows.h,
  69. [AC_MSG_CHECKING(for AllocConsole in windows.h)
  70. AC_EGREP_HEADER(AllocConsole, windows.h,
  71. [ac_cv_my_have_win32="yes"
  72. AC_MSG_RESULT(yes)
  73. AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
  74. Define if <windows.h> defines AllocConsole.)
  75. AC_DEFINE(USE_WIN32, 1, Define to activate the win32 backend driver)
  76. CACA_DRIVERS="${CACA_DRIVERS} win32"],
  77. [AC_MSG_RESULT(no)])])
  78. if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
  79. AC_MSG_ERROR([cannot find win32 console development files])
  80. fi
  81. fi
  82. if test "${enable_slang}" != "no"; then
  83. ac_cv_my_have_slang="no"
  84. AC_CHECK_HEADERS(slang.h slang/slang.h,
  85. [AC_CHECK_LIB(slang, SLkp_init,
  86. [ac_cv_my_have_slang="yes"
  87. AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver)
  88. CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
  89. CACA_LIBS="${CACA_LIBS} -lslang"
  90. CACA_DRIVERS="${CACA_DRIVERS} slang"])])
  91. if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
  92. AC_MSG_ERROR([cannot find slang development files])
  93. fi
  94. fi
  95. if test "${enable_x11}" != "no"; then
  96. AC_PATH_X
  97. AC_CHECK_LIB(X11, XOpenDisplay,
  98. [ac_cv_my_have_x11="yes"
  99. if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
  100. if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi
  101. AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver)
  102. CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  103. CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
  104. CACA_DRIVERS="${CACA_DRIVERS} x11"],
  105. [ac_cv_my_have_x11="no"],
  106. [[-lXt -L${x_libraries}]])
  107. AC_CHECK_HEADERS(X11/XKBlib.h)
  108. if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
  109. AC_MSG_ERROR([cannot find X11 development files])
  110. fi
  111. fi
  112. if test "${enable_gl}" != "no"; then
  113. ac_cv_my_have_gl="no"
  114. AC_CHECK_HEADERS(GL/gl.h GL/glut.h,
  115. [AC_CHECK_LIB(glut, glutMainLoopEvent,
  116. [ac_cv_my_have_gl="yes"
  117. AC_DEFINE(USE_GL, 1, Define to activate the OpenGL backend driver)
  118. CACA_LIBS="${CACA_LIBS} -lGL -lglut"
  119. CACA_DRIVERS="${CACA_DRIVERS} gl"])])
  120. if test "${ac_cv_my_have_gl}" = "no" -a "${enable_gl}" = "yes"; then
  121. AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
  122. fi
  123. fi
  124. if test "${enable_null}" != "no"; then
  125. ac_cv_my_have_null="yes"
  126. AC_DEFINE(USE_NULL, 1, Define to activate the Null backend driver)
  127. CACA_DRIVERS="${CACA_DRIVERS} null"
  128. fi
  129. if test "${enable_ncurses}" != "no"; then
  130. ac_cv_my_have_ncurses="no"
  131. AC_CHECK_HEADERS(curses.h ncurses.h,
  132. [AC_CHECK_LIB(ncurses, initscr,
  133. [ac_cv_my_have_ncurses="yes"
  134. AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
  135. CACA_LIBS="${CACA_LIBS} -lncurses"
  136. CACA_DRIVERS="${CACA_DRIVERS} ncurses"
  137. dnl Check for resizeterm or resize_term
  138. SAVED_LIBS="${LIBS}"
  139. LIBS="${LIBS} -lncurses"
  140. AC_CHECK_FUNCS(resizeterm resize_term)
  141. LIBS="${SAVED_LIBS}"])])
  142. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  143. AC_MSG_ERROR([cannot find ncurses development files])
  144. fi
  145. fi
  146. AC_MSG_CHECKING(valid output drivers)
  147. if test -z "${CACA_DRIVERS}"; then
  148. AC_MSG_RESULT(no)
  149. AC_MSG_ERROR([no output drivers were selected!])
  150. else
  151. AC_MSG_RESULT([${CACA_DRIVERS}])
  152. fi
  153. AC_SUBST(MATH_LIBS)
  154. AC_SUBST(CACA_LIBS)
  155. # Optimizations
  156. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  157. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  158. # [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
  159. # (Comme quoi on est pas les seuls porcs)
  160. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  161. # Build the PIC library?
  162. case "${target_os}" in
  163. *mingw32* | *cygwin* | *djgpp*)
  164. NEED_PIC=false
  165. ;;
  166. *)
  167. NEED_PIC=:
  168. ;;
  169. esac
  170. AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
  171. # Use Imlib2?
  172. ac_cv_my_have_imlib2="no"
  173. save_CPPFLAGS="${CPPFLAGS}"
  174. if test "${enable_imlib2}" != "no"; then
  175. AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
  176. if test "${IMLIB2_CONFIG}" != "no"; then
  177. CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
  178. fi
  179. AC_CHECK_HEADERS(Imlib2.h,
  180. ac_cv_my_have_imlib2="yes",
  181. [ac_cv_my_have_imlib2="no"
  182. 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'.]])])
  183. CPPFLAGS="${save_CPPFLAGS}"
  184. fi
  185. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  186. # Build documentation?
  187. DOXYGEN="no"
  188. LATEX="no"
  189. if test "${enable_doc}" != "no"; then
  190. AC_PATH_PROG(DOXYGEN, doxygen, no)
  191. if test "${DOXYGEN}" = "no"; then
  192. 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'.]])
  193. fi
  194. # Build LaTeX documentation?
  195. AC_PATH_PROG(LATEX, latex, no)
  196. AC_PATH_PROG(DVIPS, dvips, no)
  197. if test "${DVIPS}" = "no"; then
  198. LATEX="no"
  199. fi
  200. AC_MSG_CHECKING(for a4wide.sty)
  201. if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
  202. AC_MSG_RESULT(yes)
  203. else
  204. LATEX="no"
  205. AC_MSG_RESULT(no)
  206. fi
  207. fi
  208. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  209. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  210. AC_CONFIG_FILES([
  211. Makefile
  212. src/Makefile
  213. examples/Makefile
  214. test/Makefile
  215. doc/Makefile
  216. doc/doxygen.cfg
  217. autotools/Makefile
  218. debian/Makefile
  219. msvc/Makefile
  220. ])
  221. AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  222. AC_OUTPUT