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

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