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.
 
 
 
 
 
 

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