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.
 
 
 
 
 
 

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