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.
 
 
 
 
 
 

168 lines
5.1 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.6)
  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. if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
  67. AC_MSG_ERROR([cannot find X11 development files])
  68. fi
  69. fi
  70. if test "${enable_ncurses}" != "no"; then
  71. AC_CHECK_HEADERS(ncurses.h,
  72. [AC_CHECK_LIB(ncurses, initscr,
  73. [ac_cv_my_have_ncurses="yes"
  74. AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
  75. CACA_LIBS="${CACA_LIBS} -lncurses"
  76. CACA_DRIVERS="${CACA_DRIVERS} ncurses"],
  77. [ac_cv_my_have_ncurses="no"])],
  78. [ac_cv_my_have_ncurses="no"])
  79. if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
  80. AC_MSG_ERROR([cannot find ncurses development files])
  81. fi
  82. fi
  83. AC_MSG_CHECKING(valid output drivers)
  84. if test -z "${CACA_DRIVERS}"; then
  85. AC_MSG_RESULT(no)
  86. AC_MSG_ERROR([no output drivers were selected!])
  87. else
  88. AC_MSG_RESULT([${CACA_DRIVERS}])
  89. fi
  90. AC_SUBST(CACA_LIBS)
  91. # Optimizations
  92. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  93. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  94. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  95. # Build the PIC library?
  96. case "${target_os}" in
  97. *mingw32* | *cygwin* | *djgpp*)
  98. NEED_PIC=false
  99. ;;
  100. *)
  101. NEED_PIC=:
  102. ;;
  103. esac
  104. AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
  105. # Use Imlib2?
  106. ac_cv_my_have_imlib2="no"
  107. AC_ARG_ENABLE(imlib2,
  108. [ --enable-imlib2 Imlib2 graphics support (default enabled)])
  109. save_CPPFLAGS="${CPPFLAGS}"
  110. if test "${enable_imlib2}" != "no"; then
  111. AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
  112. if test "${IMLIB2_CONFIG}" != "no"; then
  113. CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1"
  114. fi
  115. AC_CHECK_HEADERS(Imlib2.h,
  116. ac_cv_my_have_imlib2="yes",
  117. [ac_cv_my_have_imlib2="no"
  118. 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'.]])])
  119. CPPFLAGS="${save_CPPFLAGS}"
  120. fi
  121. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  122. # Build documentation?
  123. AC_PATH_PROG(DOXYGEN, doxygen, no)
  124. AM_CONDITIONAL(DOXYGEN, test "${DOXYGEN}" != "no")
  125. # Build LaTeX documentation?
  126. AC_PATH_PROG(LATEX, latex, no)
  127. AC_MSG_CHECKING(for a4wide.sty)
  128. if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
  129. AC_MSG_RESULT(yes)
  130. else
  131. LATEX=no
  132. AC_MSG_RESULT(no)
  133. fi
  134. AM_CONDITIONAL(LATEX, test "${LATEX}" != "no")
  135. AC_CONFIG_FILES([
  136. Makefile
  137. src/Makefile
  138. examples/Makefile
  139. test/Makefile
  140. doc/Makefile
  141. doc/doxygen.cfg
  142. autotools/Makefile
  143. debian/Makefile
  144. ])
  145. AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  146. AC_OUTPUT