Codebase list ace-of-penguins / 3f1afa4f-68c4-4383-baf7-a90d34b63446/main configure.in
3f1afa4f-68c4-4383-baf7-a90d34b63446/main

Tree @3f1afa4f-68c4-4383-baf7-a90d34b63446/main (Download .tar.gz)

configure.in @3f1afa4f-68c4-4383-baf7-a90d34b63446/mainraw · history · blame

dnl Process this file with autoconf to produce a configure script.
AC_INIT(ace,1.4)
AC_CONFIG_SRCDIR(lib/cards.h)
AM_INIT_AUTOMAKE

AC_ARG_WITH(cross,[  --with-cross=TARGET      select cross development], [
  target=$withval
  host=$withval
  echo Cross compiling for $withval
  CC=$target-gcc
  AR=$target-ar
  RANLIB=$target-ranlib
  LD=$target-ld
  STRIP=$target-strip
  PDA=-DPDA

  for dir in x `$CC --print-search-dirs | grep libraries: | sed -e 's/libraries: //' -e 's/:/ /g'`
  do
    dir=`echo $dir | sed 's@/$@@'`
    echo testing $dir/X11
    if test -d $dir/X11
    then
      x_libraries=$dir/X11
      break;
    fi
  done
  echo x_libraries=$x_libraries
  case $x_libraries in
    *lib/X11 ) dir=`echo $x_libraries | sed 's@lib/X11$@include@'` ;;
    *gcc-lib* ) dir=`echo $x_libraries | sed -e 's@gcc-lib@@' -e 's@X11$@include@'` ;;
    *) dir=`echo $x_libraries | sed 's@X11$@include@'` ;;
  esac
  test -d $dir/. && x_includes=$dir
  export CC AR RANLIB LD STRIP PDA
])

AC_LANG_C

AM_PROG_LIBTOOL

dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

AC_CHECK_PROGS(BUILD_CC,gcc cc ${CC},gcc)
AC_CHECK_PROG(AR,${AR:-ar},${AR:-ar},ar)
AC_CHECK_PROG(LD,${LD:-ld},${LD:-ld},ld)
AC_CHECK_PROG(STRIP,${STRIP:-strip},${STRIP:-strip},strip)

dnl Checks for libraries.
dnl Replace `main' with a function in -lgd:
dnl doesn't work if gd isn't where the compiler can find it
dnl AC_CHECK_LIB(gd, gdImageCreateFromGif)

dnl Checks for header files.

AC_PATH_XTRA
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_HEADER_TIME

dnl Checks for library functions.
AC_FUNC_UTIME_NULL
AC_CHECK_FUNCS(gettimeofday mkdir strdup strstr)

opt_gd=
AC_ARG_WITH(z,[  --with-z=DIR           location of the ZLIB library],opt_z=$withval)
AC_ARG_WITH(png,[  --with-png=DIR          location of the PNG library],opt_png=$withval)

case "$with_z" in
  yes|no) AC_MSG_ERROR([
*** Directory must be specified for --with-z])
    ;;
  "")
    Z_CFLAGS=
    Z_LIBS=-lz
    ;;
  *)
    if test -f $with_z/include/z.h
    then
      Z_CFLAGS=-I$with_z/include
    else
      Z_CFLAGS=-I$with_z
    fi
    if test -f $with_z/lib/libz.a
    then
      Z_LIBS=$with_z/lib/libz.a
    else
      Z_LIBS=$with_z/libz.a
    fi
    ;;
esac

case "$with_png" in
  yes|no) AC_MSG_ERROR([
*** Directory must be specified for --with-png])
    ;;
  "")
    PNG_CFLAGS=
    PNG_LIBS=
    ;;
  *)
    if test -f $with_png/lib/png.h
    then
      PNG_CFLAGS=-I$with_png/lib
    else
      PNG_CFLAGS=-I$with_png/include/X11
    fi
    if test -f $with_png/lib/libPng.a
    then
      PNG_LIBS="-L$with_png/lib"
    else
      PNG_LIBS="-L$with_png"
    fi
    ;;
esac

AC_SUBST(Z_CFLAGS)
AC_SUBST(Z_LIBS)

AC_SUBST(PNG_CFLAGS)
AC_SUBST(PNG_LIBS)

AC_SUBST(PDA)

AC_OUTPUT(Makefile lib/Makefile games/Makefile tests/Makefile)