]> git.lyx.org Git - lyx.git/blob - autogen.sh
Enable the use of (1.5 <= automake <= 1.9)
[lyx.git] / autogen.sh
1 #!/bin/sh
2
3 ACLOCAL="aclocal -I ${PWD}/m4"
4 AUTOHEADER="autoheader"
5 AUTOMAKE="automake -a -c --foreign"
6 AUTOCONF="autoconf"
7 ACINCLUDE_FILES="lyxinclude.m4 libtool.m4 xforms.m4 qt.m4 gtk--.m4 gnome--.m4 gnome.m4 aspell.m4 pspell.m4 cygwin.m4 pkg.m4"
8
9 # Discover what version of gettext we are using.
10 gettext_version=`gettext --version 2>/dev/null | head -n 1`
11
12 test "$gettext_version" != "" && {
13     echo "Using $gettext_version"
14 } || {
15     echo "LyX requires getttext >= 0.12"
16     exit
17 }
18
19 case $gettext_version in
20     *' '0.1[2-4]*)
21         ;;
22     *)
23         echo "This gettext version is not supported by LyX."
24         echo "LyX supports only gettext 0.1[2-4]."
25         exit
26         ;;
27 esac
28
29 # Discover what version of automake we are using.
30 automake_version=`$AUTOMAKE --version 2>/dev/null | head -n 1`
31
32 test "$automake_version" != "" && {
33     echo "Using $automake_version"
34 } || {
35     echo "LyX requires automake >= 1.5"
36     exit
37 }
38
39 case $automake_version in
40     *' '1.[5-9]*)
41         ;;
42     *)
43     
44         echo "This automake version is not supported by LyX."
45         echo "LyX only supports automake 1.[5-9]."
46         exit
47         ;;
48 esac
49                                                         
50 # Discover what version of autoconf we are using.
51 autoversion=`$AUTOCONF --version 2>/dev/null | head -n 1`
52
53 test "$autoversion" != "" && {
54     echo "Using $autoversion"
55 } || {
56     echo "LyX requires autoconf >= 2.52"
57     exit
58 }
59             
60 case $autoversion in
61     *' '2.5[2-9])
62         EXTRA_ACINCLUDE_FILES="lyxinclude25x.m4"
63         ;;
64     *)
65         echo "This autoconf version is not supported by LyX."
66         echo "LyX only supports autoconf 2.5[2-9]."
67         exit
68         ;;
69 esac
70
71 echo -n "Locating GNU m4... "
72 GNUM4=
73 for prog in $M4 gm4 gnum4 m4; do
74         # continue if $prog generates error (e.g. does not exist)
75         ( $prog --version ) < /dev/null > /dev/null 2>&1
76         if test $? -ne 0 ; then continue; fi
77
78         # /dev/null input prevents a hang of the script for some m4 compilers (e.g. on FreeBSD)
79         case `$prog --version < /dev/null 2>&1` in
80         *GNU*)  GNUM4=$prog
81                 break ;;
82         esac
83 done
84 if test x$GNUM4 = x ; then
85         echo "not found."
86         exit
87 else
88         echo `which $GNUM4`
89 fi
90
91 # Generate acinclude.m4
92 echo -n "Generate acinclude.m4... "
93 rm -f acinclude.m4
94 (cd config ; cat ${ACINCLUDE_FILES} ${EXTRA_ACINCLUDE_FILES} >../acinclude.m4)
95 echo "done."
96
97 # Generate the Makefiles and configure files
98 if ( $ACLOCAL --version ) < /dev/null > /dev/null 2>&1; then
99         echo "Building macros..."
100         for dir in . lib/reLyX ; do
101             echo "        $dir"
102             ( cd $dir ; $ACLOCAL )
103         done
104         echo "done."
105 else
106         echo "aclocal not found -- aborting"
107         exit
108 fi
109
110 if ( $AUTOHEADER --version ) < /dev/null > /dev/null 2>&1; then
111         echo "Building config header template..."
112         for dir in . ; do
113             echo "        $dir"
114             ( cd $dir ; $AUTOHEADER )
115         done
116         echo "done."
117 else
118         echo "autoheader not found -- aborting"
119         exit
120 fi
121
122 if ( $AUTOMAKE --version ) < /dev/null > /dev/null 2>&1; then
123         echo "Building Makefile templates..."
124         for dir in . lib/reLyX ; do
125             echo "        $dir"
126             ( cd $dir ; $AUTOMAKE )
127         done
128         echo "done."
129 else
130         echo "automake not found -- aborting"
131         exit
132 fi
133
134 if ( $AUTOCONF --version ) < /dev/null > /dev/null 2>&1; then
135         echo "Building configure..."
136         for dir in . lib/reLyX ; do
137             echo "       $dir"
138             ( cd $dir ; $AUTOCONF )
139         done
140         echo "done."
141 else
142         echo "autoconf not found -- aborting"
143         exit
144 fi
145
146 # Autogenerate lib/configure.m4.
147 echo -n "Building lib/configure ... "
148 rm -f lib/configure
149 $GNUM4 lib/configure.m4 > lib/configure
150 chmod a+x lib/configure
151 echo "done."
152
153 echo
154 echo 'run "./configure ; make"'
155 echo