Merged silc_1_0_branch to trunk.
[silc.git] / apps / autodist / tests / autodist2.test
1 #!/bin/sh
2
3 AUTODIST=../../autodist
4
5 rm -rf test
6 mkdir test
7
8 cd test || exit 1
9
10 chmod +x $AUTODIST || exit 1
11
12 cat << EOF > configure.ad
13 AD_INIT
14 #ifdef _DIST_TEST
15 AC_CANONICAL_BUILD
16 AM_INIT_AUTOMAKE
17 AC_PREREQ(2.52)
18 AC_CONFIG_HEADERS(config.h)
19 AD_INCLUDE_CONFIGURE
20 AC_CONFIG_FILES(
21 Makefile
22 )
23 AC_OUTPUT
24 echo configure.ad ok
25 #endif _DIST_TEST
26 EOF
27
28 cat << EOF > Makefile.ad
29 SUBDIRS=        \
30 #ifndef _DIST_TEST
31         nodef   \
32 #endif _DIST_TEST
33 #endif
34 EOF
35
36 rm -rf distdir subdir
37 mkdir -p subdir || exit 1
38
39 cat << EOF > subdir/configure.ad
40 # subdir/configure.ad fragment
41 #ifndef _DIST_NODEF
42 #ifdef _DIST_TEST
43 echo "_DIST_NODEF ok"
44 #endif _DIST_TEST
45 #endif _DIST_NODEF
46 EOF
47
48 $AUTODIST -i || exit 1
49 if test '!' -d distdir; then
50   echo "error: distdir/ does no exist"
51   exit 1
52 fi 
53
54 cp -p ../../default distdir || exit 1
55 cp -p ../../autodist.conf distdir || exit 1
56
57 cat << EOF > distdir/test
58 name Test Distribution
59 package test-distro
60 bug-report test-dist@test.org
61 define _DIST_TEST
62 EOF
63
64 touch README NEWS AUTHORS ChangeLog
65
66 echo "inherit test" >> distdir/default
67
68 $AUTODIST || exit 1
69 $AUTODIST test 1.0 || exit 1
70
71 ./configure || exit 1
72 make || exit 1
73 echo make ok
74
75 $AUTODIST -m || exit 1
76
77 if test '!' -f test-distro-1.0.tar.gz; then
78   echo "error: makedist failed"
79   exit 1
80 fi
81
82 echo test ok
83
84 # Cleanup
85 rm -rf subdir distdir
86