]> git.lyx.org Git - lyx.git/blob - autogen.sh
some small autogen improvements
[lyx.git] / autogen.sh
1 #!/bin/sh
2
3 ACLOCAL=aclocal
4 AUTOHEADER="autoheader"
5 AUTOMAKE="automake -a -c --foreign"
6 AUTOCONF="autoconf"
7
8 # Discover what version of autoconf we are using.
9 autoversion=`$AUTOCONF --version | head -n 1`
10
11 echo "Using $autoversion"
12 case $autoversion in
13     *2.13)
14         cp config/acconfig.h .
15         cp config/configure.in .
16         rm -f configure.ac
17         cp config/relyx_configure.in lib/reLyX/configure.in
18         rm -f lib/reLyX/configure.ac
19         ;;
20     *2.5[23])
21         rm -f acconfig.h
22         rm -f configure.in
23         cp config/configure.ac .
24         rm -f lib/reLyX/configure.in
25         cp config/relyx_configure.ac lib/reLyX/configure.ac
26         ;;
27     *)
28         echo "This autoconf version is not supported by LyX."
29         echo "LyX only supports autoconf 2.13 and 2.53."
30         exit
31         ;;
32 esac
33
34
35 ACINCLUDE_FILES="lyxinclude.m4 libtool.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 xforms.m4 qt.m4 gtk--.m4 gnome--.m4 gnome.m4 pspell.m4 pkg.m4"
36 SIGCPP_ACINCLUDE_FILES="libtool.m4"
37
38 echo -n "Locating GNU m4... "
39 GNUM4=
40 for prog in $M4 gm4 gnum4 m4; do
41         # continue if $prog generates error (e.g. does not exist)
42         ( $prog --version ) < /dev/null > /dev/null 2>&1
43         if test $? -ne 0 ; then continue; fi
44
45         # /dev/null input prevents a hang of the script for some m4 compilers (e.g. on FreeBSD)
46         case `$prog --version < /dev/null 2>&1` in
47         *GNU*)  GNUM4=$prog
48                 break ;;
49         esac
50 done
51 if test x$GNUM4 = x ; then
52         echo "not found."
53         exit
54 else
55         echo `which $GNUM4`
56 fi
57
58 # Generate acinclude.m4
59 echo -n "Generate acinclude.m4... "
60 rm -f acinclude.m4
61 (cd config ; cat ${ACINCLUDE_FILES} >../acinclude.m4)
62 echo "done."
63
64 # Generate the Makefiles and configure files
65 if ( $ACLOCAL --version ) < /dev/null > /dev/null 2>&1; then
66         echo "Building macros..."
67         for dir in . lib/reLyX ; do
68             echo "        $dir"
69             ( cd $dir ; $ACLOCAL )
70         done
71         echo "done."
72 else
73         echo "aclocal not found -- aborting"
74         exit
75 fi
76
77 if ( $AUTOHEADER --version ) < /dev/null > /dev/null 2>&1; then
78         echo "Building config header template..."
79         for dir in . ; do
80             echo "        $dir"
81             ( cd $dir ; $AUTOHEADER )
82         done
83         echo "done."
84 else
85         echo "autoheader not found -- aborting"
86         exit
87 fi
88
89 if ( $AUTOMAKE --version ) < /dev/null > /dev/null 2>&1; then
90         echo "Building Makefile templates..."
91         for dir in . lib/reLyX ; do
92             echo "        $dir"
93             ( cd $dir ; $AUTOMAKE )
94         done
95         echo "done."
96 else
97         echo "automake not found -- aborting"
98         exit
99 fi
100
101 if ( $AUTOCONF --version ) < /dev/null > /dev/null 2>&1; then
102         echo "Building configure..."
103         for dir in . lib/reLyX ; do
104             echo "       $dir"
105             ( cd $dir ; $AUTOCONF )
106         done
107         echo "done."
108 else
109         echo "autoconf not found -- aborting"
110         exit
111 fi
112
113 # Autogenerate lib/configure.m4.
114 echo -n "Building lib/configure ... "
115 rm -f lib/configure
116 $GNUM4 lib/configure.m4 > lib/configure
117 chmod a+x lib/configure
118 echo "done."
119
120 echo
121 echo 'run "./configure ; make"'
122 echo