Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

configure.ac 9.2 KiB

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