25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

252 satır
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. AM_PROG_LIBTOOL
  12. AC_C_CONST
  13. AC_C_INLINE
  14. AC_TYPE_SIGNAL
  15. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  16. dnl now otherwise it might be set in an obscure if statement.
  17. AC_EGREP_CPP(foo, foo)
  18. dnl output driver features
  19. AC_ARG_ENABLE(slang,
  20. [ --enable-slang slang graphics support (autodetected)])
  21. AC_ARG_ENABLE(ncurses,
  22. [ --enable-ncurses ncurses graphics support (autodetected)])
  23. AC_ARG_ENABLE(win32,
  24. [ --enable-win32 Windows console support (autodetected)])
  25. AC_ARG_ENABLE(conio,
  26. [ --enable-conio DOS conio.h graphics support (autodetected)])
  27. AC_ARG_ENABLE(x11,
  28. [ --enable-x11 X11 support (autodetected)])
  29. AC_ARG_ENABLE(gl,
  30. [ --enable-gl OpenGL support (autodetected)])
  31. AC_ARG_ENABLE(null,
  32. [ --enable-null Null driver support (autodetected)])
  33. dnl example programs features
  34. AC_ARG_ENABLE(imlib2,
  35. [ --enable-imlib2 Imlib2 graphics support (default enabled)])
  36. dnl conditional builds
  37. AC_ARG_ENABLE(doc,
  38. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  39. AC_CHECK_HEADERS(signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h)
  40. AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp)
  41. AC_CHECK_FUNCS(usleep gettimeofday)
  42. AC_MSG_CHECKING(for Sleep)
  43. AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
  44. [AC_MSG_RESULT(yes)
  45. AC_DEFINE(HAVE_SLEEP, 1, [Define if you have Windows' Sleep])],
  46. [AC_MSG_RESULT(no)])
  47. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  48. CACA_DRIVERS=""
  49. if test "${enable_conio}" != "no"; then
  50. ac_cv_my_have_conio="no"
  51. AC_CHECK_HEADERS(conio.h,
  52. [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
  53. AC_EGREP_HEADER(ScreenUpdate, pc.h,
  54. [ac_cv_my_have_conio="yes"
  55. AC_MSG_RESULT(yes)
  56. AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
  57. Define if <pc.h> defines ScreenUpdate.)
  58. AC_DEFINE(USE_CONIO, 1, Define to activate the conio.h backend driver)
  59. CACA_DRIVERS="${CACA_DRIVERS} conio"],
  60. [AC_MSG_RESULT(no)])])
  61. if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
  62. AC_MSG_ERROR([cannot find conio.h])
  63. fi
  64. fi
  65. if test "${enable_win32}" != "no"; then
  66. ac_cv_my_have_win32="no"
  67. AC_CHECK_HEADERS(windows.h,
  68. [AC_MSG_CHECKING(for AllocConsole in windows.h)
  69. AC_EGREP_HEADER(AllocConsole, windows.h,
  70. [ac_cv_my_have_win32="yes"
  71. AC_MSG_RESULT(yes)
  72. AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
  73. Define if <windows.h> defines AllocConsole.)
  74. AC_DEFINE(USE_WIN32, 1, Define to activate the win32 backend driver)
  75. CACA_DRIVERS="${CACA_DRIVERS} win32"],
  76. [AC_MSG_RESULT(no)])])
  77. if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
  78. AC_MSG_ERROR([cannot find win32 console development files])
  79. fi
  80. fi
  81. if test "${enable_slang}" != "no"; then
  82. ac_cv_my_have_slang="no"
  83. AC_CHECK_HEADERS(slang.h slang/slang.h,
  84. [AC_CHECK_LIB(slang, SLkp_init,
  85. [ac_cv_my_have_slang="yes"
  86. AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver)
  87. CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
  88. CACA_LIBS="${CACA_LIBS} -lslang"
  89. CACA_DRIVERS="${CACA_DRIVERS} slang"])])
  90. if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
  91. AC_MSG_ERROR([cannot find slang development files])
  92. fi
  93. fi
  94. if test "${enable_x11}" != "no"; then
  95. AC_PATH_X
  96. AC_CHECK_LIB(X11, XOpenDisplay,
  97. [ac_cv_my_have_x11="yes"
  98. if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
  99. if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi
  100. AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver)
  101. CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  102. CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
  103. CACA_DRIVERS="${CACA_DRIVERS} x11"],
  104. [ac_cv_my_have_x11="no"],
  105. [[-lXt -L${x_libraries}]])
  106. AC_CHECK_HEADERS(X11/XKBlib.h)
  107. if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
  108. AC_MSG_ERROR([cannot find X11 development files])
  109. fi
  110. fi
  111. if test "${enable_gl}" != "no"; then
  112. ac_cv_my_have_gl="no"
  113. AC_CHECK_HEADERS(GL/gl.h GL/glut.h,
  114. [AC_CHECK_LIB(glut, glutMainLoopEvent,
  115. [ac_cv_my_have_gl="yes"
  116. AC_DEFINE(USE_GL, 1, Define to activate the OpenGL backend driver)
  117. CACA_LIBS="${CACA_LIBS} -lGL -lglut"
  118. CACA_DRIVERS="${CACA_DRIVERS} gl"])])
  119. if test "${ac_cv_my_have_gl}" = "no" -a "${enable_gl}" = "yes"; then
  120. AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
  121. fi
  122. fi
  123. if test "${enable_null}" != "no"; then
  124. ac_cv_my_have_null="yes"
  125. AC_DEFINE(USE_NULL, 1, Define to activate the Null backend driver)
  126. CACA_DRIVERS="${CACA_DRIVERS} null"
  127. fi
  128. if test "${enable_ncurses}" != "no"; then
  129. ac_cv_my_have_ncurses="no"
  130. AC_CHECK_HEADERS(curses.h ncurses.h,
  131. [AC_CHECK_LIB(ncurses, initscr,
  132. [ac_cv_my_have_ncurses="yes"
  133. AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
  134. CACA_LIBS="${CACA_LIBS} -lncurses"
  135. CACA_DRIVERS="${CACA_DRIVERS} ncurses"
  136. dnl Check for resizeterm or resize_term
  137. SAVED_LIBS="${LIBS}"
  138. LIBS="${LIBS} -lncurses"
  139. AC_CHECK_FUNCS(resizeterm resize_term)
  140. LIBS="${SAVED_LIBS}"])])
  141. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  142. AC_MSG_ERROR([cannot find ncurses development files])
  143. fi
  144. fi
  145. AC_MSG_CHECKING(valid output drivers)
  146. if test -z "${CACA_DRIVERS}"; then
  147. AC_MSG_RESULT(no)
  148. AC_MSG_ERROR([no output drivers were selected!])
  149. else
  150. AC_MSG_RESULT([${CACA_DRIVERS}])
  151. fi
  152. AC_SUBST(MATH_LIBS)
  153. AC_SUBST(CACA_LIBS)
  154. AC_SUBST(CUCUL_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