1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(ace,1.4)
3AC_CONFIG_SRCDIR(lib/cards.h)
4AM_INIT_AUTOMAKE
5
6AC_ARG_WITH(cross,[  --with-cross=TARGET      select cross development], [
7  target=$withval
8  host=$withval
9  echo Cross compiling for $withval
10  CC=$target-gcc
11  AR=$target-ar
12  RANLIB=$target-ranlib
13  LD=$target-ld
14  STRIP=$target-strip
15  PDA=-DPDA
16
17  for dir in x `$CC --print-search-dirs | grep libraries: | sed -e 's/libraries: //' -e 's/:/ /g'`
18  do
19    dir=`echo $dir | sed 's@/$@@'`
20    echo testing $dir/X11
21    if test -d $dir/X11
22    then
23      x_libraries=$dir/X11
24      break;
25    fi
26  done
27  echo x_libraries=$x_libraries
28  case $x_libraries in
29    *lib/X11 ) dir=`echo $x_libraries | sed 's@lib/X11$@include@'` ;;
30    *gcc-lib* ) dir=`echo $x_libraries | sed -e 's@gcc-lib@@' -e 's@X11$@include@'` ;;
31    *) dir=`echo $x_libraries | sed 's@X11$@include@'` ;;
32  esac
33  test -d $dir/. && x_includes=$dir
34  export CC AR RANLIB LD STRIP PDA
35])
36
37AC_LANG_C
38
39AM_PROG_LIBTOOL
40
41dnl Checks for programs.
42AC_PROG_AWK
43AC_PROG_CC
44AC_PROG_INSTALL
45AC_PROG_LN_S
46AC_PROG_MAKE_SET
47
48AC_CHECK_PROGS(BUILD_CC,gcc cc ${CC},gcc)
49AC_CHECK_PROG(AR,${AR:-ar},${AR:-ar},ar)
50AC_CHECK_PROG(LD,${LD:-ld},${LD:-ld},ld)
51AC_CHECK_PROG(STRIP,${STRIP:-strip},${STRIP:-strip},strip)
52
53dnl Checks for libraries.
54dnl Replace `main' with a function in -lgd:
55dnl doesn't work if gd isn't where the compiler can find it
56dnl AC_CHECK_LIB(gd, gdImageCreateFromGif)
57
58dnl Checks for header files.
59
60AC_PATH_XTRA
61AC_HEADER_STDC
62AC_CHECK_HEADERS(sys/time.h)
63
64dnl Checks for typedefs, structures, and compiler characteristics.
65AC_C_INLINE
66AC_HEADER_TIME
67
68dnl Checks for library functions.
69AC_FUNC_UTIME_NULL
70AC_CHECK_FUNCS(gettimeofday mkdir strdup strstr)
71
72opt_gd=
73AC_ARG_WITH(z,[  --with-z=DIR           location of the ZLIB library],opt_z=$withval)
74AC_ARG_WITH(png,[  --with-png=DIR          location of the PNG library],opt_png=$withval)
75
76case "$with_z" in
77  yes|no) AC_MSG_ERROR([
78*** Directory must be specified for --with-z])
79    ;;
80  "")
81    Z_CFLAGS=
82    Z_LIBS=-lz
83    ;;
84  *)
85    if test -f $with_z/include/z.h
86    then
87      Z_CFLAGS=-I$with_z/include
88    else
89      Z_CFLAGS=-I$with_z
90    fi
91    if test -f $with_z/lib/libz.a
92    then
93      Z_LIBS=$with_z/lib/libz.a
94    else
95      Z_LIBS=$with_z/libz.a
96    fi
97    ;;
98esac
99
100case "$with_png" in
101  yes|no) AC_MSG_ERROR([
102*** Directory must be specified for --with-png])
103    ;;
104  "")
105    PNG_CFLAGS=
106    PNG_LIBS=
107    ;;
108  *)
109    if test -f $with_png/lib/png.h
110    then
111      PNG_CFLAGS=-I$with_png/lib
112    else
113      PNG_CFLAGS=-I$with_png/include/X11
114    fi
115    if test -f $with_png/lib/libPng.a
116    then
117      PNG_LIBS="-L$with_png/lib"
118    else
119      PNG_LIBS="-L$with_png"
120    fi
121    ;;
122esac
123
124AC_SUBST(Z_CFLAGS)
125AC_SUBST(Z_LIBS)
126
127AC_SUBST(PNG_CFLAGS)
128AC_SUBST(PNG_LIBS)
129
130AC_SUBST(PDA)
131
132AC_OUTPUT(Makefile lib/Makefile games/Makefile tests/Makefile)
133