Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

216 рядки
6.7 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.7)
  7. AM_CONFIG_HEADER(config.h)
  8. AM_PROG_CC_C_O
  9. AC_PROG_CPP
  10. AC_PROG_RANLIB
  11. AC_C_CONST
  12. AC_C_INLINE
  13. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  14. dnl now otherwise it might be set in an obscure if statement.
  15. AC_EGREP_CPP(foo, foo)
  16. dnl output driver features
  17. AC_ARG_ENABLE(slang,
  18. [ --enable-slang slang graphics support (autodetected)])
  19. AC_ARG_ENABLE(ncurses,
  20. [ --enable-ncurses ncurses graphics support (autodetected)])
  21. AC_ARG_ENABLE(win32,
  22. [ --enable-win32 Windows console support (autodetected)])
  23. AC_ARG_ENABLE(conio,
  24. [ --enable-conio DOS conio.h graphics support (autodetected)])
  25. AC_ARG_ENABLE(x11,
  26. [ --enable-x11 X11 support (autodetected)])
  27. dnl example programs features
  28. AC_ARG_ENABLE(imlib2,
  29. [ --enable-imlib2 Imlib2 graphics support (default enabled)])
  30. dnl conditional builds
  31. AC_ARG_ENABLE(doc,
  32. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  33. AC_CHECK_HEADERS(sys/time.h inttypes.h endian.h unistd.h)
  34. AC_CHECK_FUNCS(vsnprintf _vsnprintf getenv putenv strcasecmp usleep gettimeofday)
  35. AC_MSG_CHECKING(for Sleep)
  36. AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
  37. [AC_MSG_RESULT(yes)
  38. AC_DEFINE(HAVE_SLEEP, 1, [Define if you have Windows' Sleep])],
  39. [AC_MSG_RESULT(no)])
  40. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  41. CACA_DRIVERS=""
  42. if test "${enable_conio}" != "no"; then
  43. ac_cv_my_have_conio="no"
  44. AC_CHECK_HEADERS(conio.h,
  45. [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
  46. AC_EGREP_HEADER(ScreenUpdate, pc.h,
  47. [ac_cv_my_have_conio="yes"
  48. AC_MSG_RESULT(yes)
  49. AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
  50. Define if <pc.h> defines ScreenUpdate.)
  51. AC_DEFINE(USE_CONIO, 1, Define to activate the conio.h backend driver)
  52. CACA_DRIVERS="${CACA_DRIVERS} conio"],
  53. [AC_MSG_RESULT(no)])])
  54. if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
  55. AC_MSG_ERROR([cannot find conio.h])
  56. fi
  57. fi
  58. if test "${enable_win32}" != "no"; then
  59. ac_cv_my_have_win32="no"
  60. AC_CHECK_HEADERS(windows.h,
  61. [AC_MSG_CHECKING(for AllocConsole in windows.h)
  62. AC_EGREP_HEADER(AllocConsole, windows.h,
  63. [ac_cv_my_have_win32="yes"
  64. AC_MSG_RESULT(yes)
  65. AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
  66. Define if <windows.h> defines AllocConsole.)
  67. AC_DEFINE(USE_WIN32, 1, Define to activate the win32 backend driver)
  68. CACA_DRIVERS="${CACA_DRIVERS} win32"],
  69. [AC_MSG_RESULT(no)])])
  70. if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
  71. AC_MSG_ERROR([cannot find win32 console development files])
  72. fi
  73. fi
  74. if test "${enable_slang}" != "no"; then
  75. ac_cv_my_have_slang="no"
  76. AC_CHECK_HEADERS(slang.h slang/slang.h,
  77. [AC_CHECK_LIB(slang, SLkp_init,
  78. [ac_cv_my_have_slang="yes"
  79. AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver)
  80. CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
  81. CACA_LIBS="${CACA_LIBS} -lslang"
  82. CACA_DRIVERS="${CACA_DRIVERS} slang"])])
  83. if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
  84. AC_MSG_ERROR([cannot find slang development files])
  85. fi
  86. fi
  87. if test "${enable_x11}" != "no"; then
  88. AC_PATH_X
  89. AC_CHECK_LIB(X11, XOpenDisplay,
  90. [ac_cv_my_have_x11="yes"
  91. if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
  92. if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi
  93. AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver)
  94. CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  95. CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
  96. CACA_DRIVERS="${CACA_DRIVERS} x11"],
  97. [ac_cv_my_have_x11="no"],
  98. [[-lXt -L${x_libraries}]])
  99. AC_CHECK_HEADERS(X11/XKBlib.h)
  100. if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
  101. AC_MSG_ERROR([cannot find X11 development files])
  102. fi
  103. fi
  104. if test "${enable_ncurses}" != "no"; then
  105. ac_cv_my_have_ncurses="no"
  106. AC_CHECK_HEADERS(ncurses.h,
  107. [AC_CHECK_LIB(ncurses, initscr,
  108. [ac_cv_my_have_ncurses="yes"
  109. AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
  110. CACA_LIBS="${CACA_LIBS} -lncurses"
  111. CACA_DRIVERS="${CACA_DRIVERS} ncurses"])])
  112. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  113. AC_MSG_ERROR([cannot find ncurses development files])
  114. fi
  115. fi
  116. AC_MSG_CHECKING(valid output drivers)
  117. if test -z "${CACA_DRIVERS}"; then
  118. AC_MSG_RESULT(no)
  119. AC_MSG_ERROR([no output drivers were selected!])
  120. else
  121. AC_MSG_RESULT([${CACA_DRIVERS}])
  122. fi
  123. AC_SUBST(MATH_LIBS)
  124. AC_SUBST(CACA_LIBS)
  125. # Optimizations
  126. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  127. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  128. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  129. # Build the PIC library?
  130. case "${target_os}" in
  131. *mingw32* | *cygwin* | *djgpp*)
  132. NEED_PIC=false
  133. ;;
  134. *)
  135. NEED_PIC=:
  136. ;;
  137. esac
  138. AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
  139. # Use Imlib2?
  140. ac_cv_my_have_imlib2="no"
  141. save_CPPFLAGS="${CPPFLAGS}"
  142. if test "${enable_imlib2}" != "no"; then
  143. AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
  144. if test "${IMLIB2_CONFIG}" != "no"; then
  145. CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
  146. fi
  147. AC_CHECK_HEADERS(Imlib2.h,
  148. ac_cv_my_have_imlib2="yes",
  149. [ac_cv_my_have_imlib2="no"
  150. 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'.]])])
  151. CPPFLAGS="${save_CPPFLAGS}"
  152. fi
  153. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  154. # Build documentation?
  155. DOXYGEN="no"
  156. LATEX="no"
  157. if test "${enable_doc}" != "no"; then
  158. AC_PATH_PROG(DOXYGEN, doxygen, no)
  159. if test "${DOXYGEN}" = "no"; then
  160. 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'.]])
  161. fi
  162. # Build LaTeX documentation?
  163. AC_PATH_PROG(LATEX, latex, no)
  164. AC_PATH_PROG(DVIPS, dvips, no)
  165. if test "${DVIPS}" = "no"; then
  166. LATEX="no"
  167. fi
  168. AC_MSG_CHECKING(for a4wide.sty)
  169. if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
  170. AC_MSG_RESULT(yes)
  171. else
  172. LATEX="no"
  173. AC_MSG_RESULT(no)
  174. fi
  175. fi
  176. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  177. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  178. AC_CONFIG_FILES([
  179. Makefile
  180. src/Makefile
  181. examples/Makefile
  182. test/Makefile
  183. doc/Makefile
  184. doc/doxygen.cfg
  185. autotools/Makefile
  186. debian/Makefile
  187. msvc/Makefile
  188. ])
  189. AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  190. AC_OUTPUT