summaryrefslogtreecommitdiffstats
path: root/autogen.sh
blob: b120d6dbf8b6a0c2d4a4d99d32726d8778d4de72 (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
#!/bin/sh

include ()
{
    # If we keep a copy of the kernel header in the SVN tree, we'll have
    # to worry about synchronization issues forever. Instead, we just copy 
    # the headers that we need from the lastest kernel version at autogen
    # stage.

    INCLUDEDIR=${KERNEL_DIR:-/lib/modules/`uname -r`/build}/include/linux
    if [ -f $INCLUDEDIR/netfilter/nfnetlink_queue.h ]
    then
    	TARGET=include/libnetfilter_queue/linux_nfnetlink_queue.h
    	echo "Copying nfnetlink_queue.h to linux_nfnetlink_queue.h"
    	cp $INCLUDEDIR/netfilter/nfnetlink_queue.h $TARGET
	TEMP=`tempfile`
	sed 's/linux\/netfilter\/nfnetlink.h/libnfnetlink\/linux_nfnetlink.h/g' $TARGET > $TEMP
	# Add aligned_u64 definition after #define _NFNETLINK_QUEUE_H
	awk '{
        if ( $0 == "#define _NFNETLINK_QUEUE_H" ) {
		print $0
		getline
		print $0
		print "#ifndef aligned_u64"
		print "#define aligned_u64 unsigned long long __attribute__((aligned(8)))"
		print "#endif"
	}

	print $0
	}' $TEMP > $TARGET
    else
    	echo "can't find nfnetlink_queue.h kernel file in $INCLUDEDIR"
    	exit 1
    fi
}

run ()
{
    echo "running: $*"
    eval $*

    if test $? != 0 ; then
	echo "error: while running '$*'"
	exit 1
    fi
}

include
run libtoolize
run aclocal
#run autoheader
run automake -a
run autoconf