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.

configure.ac 8.2 KiB

19 years ago
19 years ago
19 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. 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(network,
  32. [ --enable-network Network 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_network}" != "no"; then
  124. ac_cv_my_have_network="no"
  125. AC_CHECK_HEADERS(sys/socket.h,
  126. [ac_cv_my_have_network="yes"
  127. AC_DEFINE(USE_NETWORK, 1, Define to activate the network backend driver)
  128. CACA_DRIVERS="${CACA_DRIVERS} network"])
  129. if test "${ac_cv_my_have_network}" = "no" -a "${enable_network}" = "yes"; then
  130. AC_MSG_ERROR([cannot find standard networking socket files])
  131. fi
  132. fi
  133. if test "${enable_ncurses}" != "no"; then
  134. ac_cv_my_have_ncurses="no"
  135. AC_CHECK_HEADERS(curses.h ncurses.h,
  136. [AC_CHECK_LIB(ncurses, initscr,
  137. [ac_cv_my_have_ncurses="yes"
  138. AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
  139. CACA_LIBS="${CACA_LIBS} -lncurses"
  140. CACA_DRIVERS="${CACA_DRIVERS} ncurses"
  141. dnl Check for resizeterm or resize_term
  142. SAVED_LIBS="${LIBS}"
  143. LIBS="${LIBS} -lncurses"
  144. AC_CHECK_FUNCS(resizeterm resize_term)
  145. LIBS="${SAVED_LIBS}"])])
  146. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  147. AC_MSG_ERROR([cannot find ncurses development files])
  148. fi
  149. fi
  150. AC_MSG_CHECKING(valid output drivers)
  151. if test -z "${CACA_DRIVERS}"; then
  152. AC_MSG_RESULT(no)
  153. AC_MSG_ERROR([no output drivers were selected!])
  154. else
  155. AC_MSG_RESULT([${CACA_DRIVERS}])
  156. fi
  157. AC_SUBST(MATH_LIBS)
  158. AC_SUBST(CACA_LIBS)
  159. AC_SUBST(CUCUL_LIBS)
  160. # Optimizations
  161. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  162. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  163. # [Jylam] Removed -Wshadow in order to avoid ncurses/gl conflict
  164. # (Comme quoi on est pas les seuls porcs)
  165. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  166. # Build the PIC library?
  167. case "${target_os}" in
  168. *mingw32* | *cygwin* | *djgpp*)
  169. NEED_PIC=false
  170. ;;
  171. *)
  172. NEED_PIC=:
  173. ;;
  174. esac
  175. AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
  176. # Use Imlib2?
  177. ac_cv_my_have_imlib2="no"
  178. save_CPPFLAGS="${CPPFLAGS}"
  179. if test "${enable_imlib2}" != "no"; then
  180. AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
  181. if test "${IMLIB2_CONFIG}" != "no"; then
  182. CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
  183. fi
  184. AC_CHECK_HEADERS(Imlib2.h,
  185. ac_cv_my_have_imlib2="yes",
  186. [ac_cv_my_have_imlib2="no"
  187. 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'.]])])
  188. CPPFLAGS="${save_CPPFLAGS}"
  189. fi
  190. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  191. # Build documentation?
  192. DOXYGEN="no"
  193. LATEX="no"
  194. if test "${enable_doc}" != "no"; then
  195. AC_PATH_PROG(DOXYGEN, doxygen, no)
  196. if test "${DOXYGEN}" = "no"; then
  197. 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'.]])
  198. fi
  199. # Build LaTeX documentation?
  200. AC_PATH_PROG(LATEX, latex, no)
  201. AC_PATH_PROG(DVIPS, dvips, no)
  202. if test "${DVIPS}" = "no"; then
  203. LATEX="no"
  204. fi
  205. AC_MSG_CHECKING(for a4wide.sty)
  206. if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
  207. AC_MSG_RESULT(yes)
  208. elif test -f /usr/share/texmf-tetex/tex/latex/a4wide/a4wide.sty; then
  209. AC_MSG_RESULT(yes)
  210. else
  211. LATEX="no"
  212. AC_MSG_RESULT(no)
  213. fi
  214. fi
  215. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  216. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  217. AC_CONFIG_FILES([
  218. Makefile
  219. cucul/Makefile
  220. caca/Makefile
  221. src/Makefile
  222. test/Makefile
  223. doc/Makefile
  224. doc/doxygen.cfg
  225. autotools/Makefile
  226. debian/Makefile
  227. msvc/Makefile
  228. ])
  229. AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  230. AC_OUTPUT