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