1 | # $Id: configure.ac 245 2003-12-11 15:54:53Z sam $ |
---|
2 | |
---|
3 | AC_INIT(src/caca.c) |
---|
4 | |
---|
5 | AC_PREREQ(2.50) |
---|
6 | AC_CONFIG_AUX_DIR(autotools) |
---|
7 | AC_CANONICAL_SYSTEM |
---|
8 | |
---|
9 | AM_INIT_AUTOMAKE(libcaca, 0.2) |
---|
10 | AM_CONFIG_HEADER(config.h) |
---|
11 | |
---|
12 | AM_PROG_CC_C_O |
---|
13 | AC_PROG_CPP |
---|
14 | AC_PROG_RANLIB |
---|
15 | |
---|
16 | dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right |
---|
17 | dnl now otherwise it might be set in an obscure if statement. |
---|
18 | AC_EGREP_CPP(foo,foo) |
---|
19 | |
---|
20 | AC_ARG_ENABLE(ncurses, |
---|
21 | [ --enable-ncurses ncurses graphics support (default enabled)]) |
---|
22 | AC_ARG_ENABLE(slang, |
---|
23 | [ --enable-slang slang graphics support (default disabled)]) |
---|
24 | AC_ARG_ENABLE(conio, |
---|
25 | [ --enable-conio DOS conio.h graphics support (default disabled)]) |
---|
26 | |
---|
27 | AC_CHECK_HEADERS(inttypes.h endian.h) |
---|
28 | AC_CHECK_FUNCS(vsnprintf getenv putenv) |
---|
29 | |
---|
30 | if test "${enable_conio}" = "yes"; then |
---|
31 | AC_CHECK_HEADER(conio.h,:,AC_MSG_ERROR([cannot find conio.h header])) |
---|
32 | AC_MSG_CHECKING(for ScreenUpdate in pc.h) |
---|
33 | AC_EGREP_HEADER(ScreenUpdate,pc.h,[ |
---|
34 | AC_MSG_RESULT(yes) |
---|
35 | AC_DEFINE(SCREENUPDATE_IN_PC_H, 1, |
---|
36 | Define if <pc.h> defines ScreenUpdate.)],[ |
---|
37 | AC_MSG_RESULT(no)]) |
---|
38 | AC_DEFINE(USE_CONIO, 1, Define if the backend driver is conio.h) |
---|
39 | elif test "${enable_slang}" = "yes"; then |
---|
40 | AC_CHECK_HEADER(slang.h,:,AC_MSG_ERROR([cannot find slang headers])) |
---|
41 | AC_CHECK_LIB(slang,SLkp_init,:,AC_MSG_ERROR([cannot find slang library])) |
---|
42 | AC_DEFINE(USE_SLANG, 1, Define if the backend driver is slang) |
---|
43 | CACA_LIBS="${CACA_LIBS} -lslang" |
---|
44 | elif test "${enable_ncurses}" != "no"; then |
---|
45 | AC_CHECK_HEADER(ncurses.h,:,AC_MSG_ERROR([cannot find ncurses headers])) |
---|
46 | AC_CHECK_LIB(ncurses,initscr,:,AC_MSG_ERROR([cannot find ncurses library])) |
---|
47 | AC_DEFINE(USE_NCURSES, 1, Define if the backend driver is ncurses) |
---|
48 | CACA_LIBS="${CACA_LIBS} -lncurses" |
---|
49 | else |
---|
50 | AC_MSG_ERROR([could not find any terminal graphics interface]) |
---|
51 | fi |
---|
52 | |
---|
53 | AC_SUBST(CACA_LIBS) |
---|
54 | |
---|
55 | # Optimizations |
---|
56 | CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" |
---|
57 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
---|
58 | CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare" |
---|
59 | |
---|
60 | # Build the PIC library? |
---|
61 | case "${target_os}" in |
---|
62 | *mingw32* | *cygwin* | *djgpp*) |
---|
63 | NEED_PIC=false |
---|
64 | ;; |
---|
65 | *) |
---|
66 | NEED_PIC=: |
---|
67 | ;; |
---|
68 | esac |
---|
69 | AM_CONDITIONAL(NEED_PIC, ${NEED_PIC}) |
---|
70 | |
---|
71 | # Build cacaview? |
---|
72 | save_CPPFLAGS="${CPPFLAGS}" |
---|
73 | AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no) |
---|
74 | if test "${IMLIB2_CONFIG}" != "no"; then |
---|
75 | CPPFLAGS="${CPPFLAGS} `imlib2-config --cflags` -DX_DISPLAY_MISSING=1" |
---|
76 | fi |
---|
77 | AC_CHECK_HEADER(Imlib2.h, USE_IMLIB2=:, USE_IMLIB2=false) |
---|
78 | CPPFLAGS="${save_CPPFLAGS}" |
---|
79 | AM_CONDITIONAL(USE_IMLIB2, ${USE_IMLIB2}) |
---|
80 | |
---|
81 | # Build documentation? |
---|
82 | AC_PATH_PROG(DOXYGEN, doxygen, no) |
---|
83 | AM_CONDITIONAL(DOXYGEN, test "${DOXYGEN}" != "no") |
---|
84 | AC_PATH_PROG(LATEX, latex, no) |
---|
85 | AC_MSG_CHECKING(for a4wide.sty) |
---|
86 | if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then |
---|
87 | AC_MSG_RESULT(yes) |
---|
88 | else |
---|
89 | LATEX=no |
---|
90 | AC_MSG_RESULT(no) |
---|
91 | fi |
---|
92 | AM_CONDITIONAL(LATEX, test "${LATEX}" != "no") |
---|
93 | |
---|
94 | AC_CONFIG_FILES([ |
---|
95 | Makefile |
---|
96 | src/Makefile |
---|
97 | examples/Makefile |
---|
98 | doc/Makefile |
---|
99 | autotools/Makefile |
---|
100 | debian/Makefile |
---|
101 | ]) |
---|
102 | AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config]) |
---|
103 | AC_OUTPUT |
---|
104 | |
---|