dnl Process this file with autoconf to produce a configure script.
AC_INIT(ximp3.c)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(ximp3, 0.2)
AM_CONFIG_HEADER(config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.

dnl Threads stuff
case "$host_os" in
  *bsd*)
    AC_ARG_WITH(linuxthreads, 
      [  --with-linuxthreads     Use Linux threads],
      [CFLAGS="$CFLAGS -I/usr/local/include/pthread/linuxthreads -D_THREAD_SAFE"
       LDFLAGS="$LDFLAGS -L/usr/local/lib -llthread -llgcc_r"],
      [CFLAGS="$CFLAGS -D_THREAD_SAFE -pthread"])
    ;;
  *)
    AC_CHECK_LIB(pthread, pthread_create,,
      AC_CHECK_LIB(c, pthread_create,,
        AC_MSG_ERROR([ximp3 requires pthreads (-lpthread must work)])))
    ;;
esac

AC_OUTPUT(lib/Makefile Makefile)
.
