summaryrefslogtreecommitdiff
path: root/configure.in
blob: cd8f37f0546cb4c3e473b6fc5dc7fcf121f60b56 (plain)
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
AC_INIT

AC_CANONICAL_SYSTEM

AM_INIT_AUTOMAKE(conntrack, 0.63)
AM_CONFIG_HEADER(config.h)

AC_PROG_CC
AM_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_LN_S

case $target in
*-*-linux*) ;;
*) AC_MSG_ERROR([Linux only, dude!]);;
esac

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lc':
dnl AC_CHECK_LIB([c], [main])
# FIXME: Replace `main' with a function in `-ldl':

AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([nfnetlink], [nfnl_listen])
AC_CHECK_LIB([nfnetlink_conntrack], [ctnl_register_handler] ,,,[-lnfnetlink])

# Checks for header files.
dnl AC_HEADER_STDC
dnl AC_CHECK_HEADERS([netinet/in.h stdlib.h])

# Checks for typedefs, structures, and compiler characteristics.
dnl AC_C_CONST
dnl AC_C_INLINE

# Checks for library functions.
dnl AC_FUNC_MALLOC
dnl AC_FUNC_VPRINTF
dnl AC_CHECK_FUNCS([memset])

dnl--------------------------------

AC_DEFUN([NF_KERNEL_SOURCE],[
    
  if test "$with_kernel" = ""; then
    KERNEL="`uname -r`"
  else
    KERNEL="$with_kernel"
  fi

  THIS_PREFIX=""
  for i in "/lib/modules/$KERNEL/build/include" "$KERNEL" "$KERNEL/include" "/usr/src/linux-$KERNEL" "/usr/src/kernel-$KERNEL" "/usr/src/linux-headers-$KERNEL" "/usr/src/kernel-headers-$KERNEL"
  do  
    AC_MSG_CHECKING([Looking for kernel source or headers in $i])
    if test -r "$i/linux/config.h"
    then
      THIS_PREFIX="$i"
      AC_MSG_RESULT([found])
      break
    fi
    AC_MSG_RESULT([ ])    
  done
  if test -r "$THIS_PREFIX/linux/config.h" ; then
    AC_SUBST(KERNELDIR,[$THIS_PREFIX])
    AC_MSG_RESULT([found])
  else
    AC_MSG_ERROR([not found $THIS_PREFIX])  
  fi

  # somehow add this as an include path
])

AC_ARG_WITH(kernel,
               AC_HELP_STRING([--with-kernel=DIR],
                              [ Show location of kernel source. Default is to use uname -r and look in /lib/modules/KERNEL/build/include. ]),
	       NF_KERNEL_SOURCE($with_kernel),NF_KERNEL_SOURCE())

#if test ! -z "$libdir"; then
#   MODULE_DIR="\\\"$libdir/\\\""
#   CFLAGS="$CFLAGS -DCONNTRACK_LIB_DIR=$MODULE_DIR"
#fi

dnl--------------------------------

dnl AC_CONFIG_FILES([Makefile
dnl                  debug/Makefile
dnl                  debug/src/Makefile
dnl                  extensions/Makefile
dnl                  src/Makefile])

AC_OUTPUT(Makefile src/Makefile extensions/Makefile include/Makefile)