1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
dnl Process this file with autoconf to produce a configure script.
AC_INIT(Makefile.am)
AM_INIT_AUTOMAKE(puf,1.0.0)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_DEFUN([OB_ARG_ENABLE], [
AC_MSG_CHECKING([$3])
AC_ARG_ENABLE($1, [$4], [ob_cv_enable_$1=$enable_$1],
[AC_CACHE_VAL(ob_cv_enable_$1, [ob_cv_enable_$1=$2])])
if test "$ob_cv_enable_$1" = yes; then
AC_MSG_RESULT([yes])
$5
else
AC_MSG_RESULT([no])
$6
fi])
AC_DEFUN([OB_ARG_WITH], [
AC_MSG_CHECKING([$3])
AC_ARG_WITH($1, [$4], [ob_cv_with_$1=$with_$1],
[AC_CACHE_VAL(ob_cv_with_$1, [ob_cv_with_$1=$2])])
if test "$ob_cv_with_$1" != no; then
case $ob_cv_with_$1 in
yes) AC_MSG_RESULT([yes]);;
"") AC_MSG_RESULT([detect]);;
*) AC_MSG_RESULT([yes ($ob_cv_with_$1)]);;
esac
$5
else
AC_MSG_RESULT([no])
$6
fi])
dnl Checks for programs.
AC_PROG_CC
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -W -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -Wsign-compare"
fi
AC_CANONICAL_HOST
case $host_os in
*cygwin* ) AC_DEFINE(HAVE_CYGWIN, 1, [define if you're compiling on CygWin]);;
esac
dnl Checks for libraries.
AC_CHECK_LIB(xnet, inet_addr)
AC_CHECK_LIB(socket, socket)
dnl Checks for header files.
dnl Checks for typedefs, structures, and compiler characteristics.
AC_CACHE_CHECK([whether off_t can be long long], ob_cv_type_off_t_ll, [
AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <stdlib.h>
int main()
{
if (sizeof(long long) == sizeof(long))
exit(1);
if (sizeof(off_t) != sizeof(long long))
exit(1);
exit(0);
}], ob_cv_type_off_t_ll=yes, ob_cv_type_off_t_ll=no)])
if test $ob_cv_type_off_t_ll = yes; then
AC_CACHE_CHECK([whether \"%lli\" works], ob_cv_func_printf_ok, [
AC_TRY_RUN([#include <stdio.h>
int main()
{
char ts[20];
sprintf(ts, "%lli", 1234567890123LL);
exit(strcmp(ts, "1234567890123"));
}], ob_cv_func_printf_ok=yes, ob_cv_func_printf_ok=no)])
if test $ob_cv_func_printf_ok = yes; then
AC_DEFINE(USE_LL, 1, [Defined if long long should be used for file offsets])
else
AC_MSG_WARN([your c library fails to format long long int correctly.
64 bit file offsets were disabled.])
fi
fi
dnl Checks for library functions.
AC_CHECK_FUNC(snprintf, [], [AC_MSG_ERROR([You need a c library with snprintf])])
AC_CHECK_FUNCS(strdup)
OB_ARG_ENABLE(debug, no, [whether to compile with debug info],
AS_HELP_STRING([--enable-debug], [put debug info in the binary [no]]),
[CFLAGS="$CFLAGS -g3 -O0"])
OB_ARG_ENABLE(static, no, [whether to build a static binary],
AS_HELP_STRING([--enable-static], [build a static binary [no]]),
[LDFLAGS="$LDFLAGS -static"])
AC_OUTPUT(Makefile src/Makefile puf.spec)
|