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