AC_INIT(mbuffer.c)
AC_CONFIG_HEADER(config.h)
AC_CANONICAL_SYSTEM
AC_EXEEXT
PACKAGE=mbuffer
VERSION=20091122
if test "${LD_LIBRARY_PATH}" != "" ; then
echo ""
echo " WARNING: LD_LIBRARY_PATH is set. This can cause severe problems!!!"
echo " Please learn about using RUNPATH instead of LD_LIBRARY_PATH - e.g. here:"
echo " - http://prefetch.net/articles/linkers.badldlibrary.html"
echo " - http://blogs.sun.com/ali/entry/avoiding_ld_library_path_the"
echo " For gcc, you can pass LDFLAGS=\"-R/usr/local/lib\" to configure,"
echo " instead of setting LD_LIBRARY_PATH."
echo ""
sleep 5
fi
AC_PREFIX_DEFAULT(/usr/local)
test "$prefix" = NONE && prefix=/usr/local
test "$exec_prefix" = NONE && exec_prefix=$prefix
USRCFLAGS=$CFLAGS
AC_LANG_C
AC_PROG_CC(cc gcc)
AC_C_RESTRICT
AC_C_INLINE
AC_PROG_INSTALL
AC_PATH_PROG(RM,rm)
if test "${GCC}" = "yes" ; then
test "${USRCFLAGS}" = "" && CFLAGS="-g -O2 -Wall"
cflags_tmp="$CFLAGS"
CFLAGS="-m64"
AC_MSG_CHECKING([whether $CC supports $CFLAGS])
AC_RUN_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
CFLAGS=""
)
else
SUNCCVERSION=`${CC} -V 2>&1 | grep Sun`
SUNCC=$?
if test "${SUNCC}" == "0" ; then
test "${USRCFLAGS}" = "" && CFLAGS="-g -O"
cflags_tmp="$CFLAGS"
HAS_M64=`${CC} -flags | grep m64`
if test "${HAS_M64}" != "" ; then
CFLAGS="-m64"
AC_MSG_CHECKING([whether $CC supports $CFLAGS])
AC_RUN_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
CFLAGS=""
)
else
CFLAGS="-xarch=generic64"
AC_MSG_CHECKING([whether $CC supports $CFLAGS])
AC_RUN_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
CFLAGS=""
)
fi
else
echo unknown cc
test "${USRCFLAGS}" = "" && CFLAGS="-g -O"
cflags_tmp="$CFLAGS"
fi
fi
CFLAGS="$cflags_tmp $CFLAGS"
AC_SUBST(CFLAGS)
AC_HEADER_ASSERT
AC_CHECK_LIB(pthread, pthread_mutex_init)
AC_SEARCH_LIBS(sem_init,rt posix,,AC_MSG_ERROR(could not find semaphore functions!))
AC_SEARCH_LIBS(rint,m,,AC_MSG_ERROR(unable to find rint))
AC_SEARCH_LIBS(seteuid,c,AC_DEFINE(HAVE_SETEUID),)
AC_SEARCH_LIBS(atoll,c,,AC_DEFINE_UNQUOTED(atoll,atol))
AC_SEARCH_LIBS(hstrerror,resolv socket nsl,AC_DEFINE(HAVE_HSTRERROR),)
AC_SEARCH_LIBS(getaddrinfo,resolv socket nsl,AC_DEFINE(HAVE_GETADDRINFO),)
AC_PATH_PROG(MT,mt,AC_MSG_WARN(could not find the program mt - you might need this if you want autoloader support))
AC_TYPE_SIGNAL
AC_SYS_LARGEFILE
AC_STRUCT_ST_BLKSIZE
AC_SEARCH_LIBS(socket,socket,,AC_MSG_ERROR(could not find the library containing network functions!))
AC_SEARCH_LIBS(gethostbyname,nsl,,AC_MSG_ERROR(could not find the library containing name convertion functions!))
AC_CHECK_LIB(resolv,hstrerror)
AC_SEARCH_LIBS(sendfile,sendfile,AC_DEFINE(HAVE_SENDFILE,1,libsendfile is available),)
AC_CHECK_HEADER(sys/sendfile.h,AC_DEFINE(HAVE_SENDFILE_H,1,sendfile in sendfile.h),)
AC_FUNC_ALLOCA
AC_ARG_ENABLE(debug,
[ --disable-debug disable verbose logging to console for debugging purpose],
,enable_debug=yes
)
if test x$enable_debug = xyes ; then
AC_DEFINE_UNQUOTED(DEBUG)
fi
AC_ARG_ENABLE(md5,
[ --disable-md5 disable md5 hash generation],
,enable_md5=auto
)
if test x$enable_md5 != xno ; then
AC_SEARCH_LIBS(mhash_init,mhash,AC_DEFINE_UNQUOTED(HAVE_LIBMHASH),
AC_SEARCH_LIBS(MD5Init,md5,AC_DEFINE_UNQUOTED(HAVE_LIBMD5),
AC_SEARCH_LIBS(MD5_Init,crypto,AC_DEFINE_UNQUOTED(HAVE_LIBCRYPTO),
if test x$enable_md5 = xauto ; then
AC_MSG_WARN(could not find a library containing the md5 hash functions - md5 support disabled)
else
AC_MSG_ERROR(could not find the mhash library)
fi
)))
fi
AC_SUBST(DEBUG)
AC_DEFINE_UNQUOTED(PACKAGE,"${PACKAGE}")
AC_DEFINE_UNQUOTED(VERSION,"${VERSION}")
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(prefix)
AC_SUBST(AUTOCONF)
AC_DEFINE(_REENTRANT,1,Needed for thread safe compilation)
AC_OUTPUT(Makefile mbuffer.1)
# vim:tw=0