Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

configure.ac 6.1 KiB

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