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.
 
 
 
 
 
 

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