]> git.lyx.org Git - lyx.git/blob - autogen.sh
Added preliminary support for pspell-libraries!
[lyx.git] / autogen.sh
1 #!/bin/sh
2
3 ACLOCAL=aclocal
4 AUTOHEADER=autoheader
5 AUTOMAKE="automake -a -c --foreign"
6 AUTOCONF=autoconf
7 GNUM4=
8
9 echo -n "Locating GNU m4... "
10 for prog in $M4 gm4 gnum4 m4 ; do
11   case `$prog --version 2>&1` in
12     *GNU*) ok=yes
13            GNUM4=$prog
14            echo "found: $GNUM4"
15            break ;;
16     *) ;;
17   esac
18 done
19 if test x$ok = xno ; then
20     echo "not found."
21 fi
22
23 # Generate acinclude.m4
24 echo -n "Generate acinclude.m4... "
25 rm -f acinclude.m4 sigc++/acinclude.m4
26 touch acinclude.m4
27 for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 config/sigc++.m4 config/kde.m4 config/gtk--.m4 config/gnome--.m4 config/gnome.m4 config/pspell.m4; do
28     cat $fil >> acinclude.m4
29 done
30 touch sigc++/acinclude.m4
31 for fil in config/libtool.m4 ; do
32     cat $fil >> sigc++/acinclude.m4
33 done
34 echo "done."
35
36 # Generate the ext_l10n.h
37 echo -n "Generate the ext_l10n file..."
38 rm -f src/ext_l10n.h
39 # first the ui file(s)
40 grep -i -E "submenu|item|optitem" < lib/ui/default.ui | cut -d '"' -f 2 | awk '{printf "_(\"%s\");\n", $0}' > src/ext_l10n.h
41 # then the layout files
42 cat lib/layouts/*.layout lib/layouts/*.inc | grep -i -E "[ ]*style .+$" | cut -d ' ' -f 2 | sort | uniq | awk '{printf "_(\"%s\");\n", $0}' >> src/ext_l10n.h
43 echo "done."
44
45 # Generate the Makefiles and configure files
46 if ( aclocal --version ) </dev/null > /dev/null 2>&1; then
47         echo -n "Building macros... "
48         $ACLOCAL ; ( cd lib/reLyX; $ACLOCAL ) ; ( cd sigc++; $ACLOCAL ) 
49         echo "done."
50 else
51         echo "aclocal not found -- aborting"
52         exit
53 fi
54
55 if ( autoheader --version ) </dev/null > /dev/null 2>&1; then
56         echo -n "Building config header template... "
57         $AUTOHEADER ; ( cd sigc++; $AUTOHEADER )
58         echo "done."
59 else
60         echo "autoheader not found -- aborting"
61         exit
62 fi
63
64 if ( $AUTOMAKE --version ) </dev/null > /dev/null 2>&1; then
65         echo -n "Building Makefile templates... "
66         $AUTOMAKE ; ( cd lib/reLyX ; $AUTOMAKE ) ; ( cd sigc++; $AUTOMAKE )
67         echo "done."
68 else
69         echo "automake not found -- aborting"
70         exit
71 fi
72
73 if ( $AUTOCONF --version ) </dev/null > /dev/null 2>&1; then
74         echo -n "Building configure... "
75         $AUTOCONF ; ( cd lib/reLyX ; $AUTOCONF ) ; ( cd sigc++; $AUTOCONF )
76         echo "done."
77 else
78         echo "autoconf not found -- aborting"
79         exit
80 fi
81
82 # Autogenerate lib/configure.m4.
83 if test x$GNUM4 != x ; then
84     echo -n "Building lib/configure ... "
85     rm -f lib/configure
86     $GNUM4 lib/configure.m4 > lib/configure
87     chmod a+x lib/configure
88     echo "done."
89 else
90     echo "No GNU m4. Impossible to build lib/configure -- aborting"
91     exit
92 fi
93
94 echo -n "Creating POTFILES.in... "
95 cat <<EOF > tmppot
96 #
97 # This file is automatically generated by autogen.sh. This command was
98 # used to extract the files from the sources:
99 #
100 # grep -E "_\(\".*\"\)" \`find src -name \*.[hHC]\` | \\
101 # awk 'BEGIN {FS= ":"} {print $1}' | sort | uniq
102 #
103 # This must be done when standing in lyx/
104 #
105 # This is all the files that contains internationalization strings.
106
107 EOF
108
109 grep -l -E "_\(\".*\"\)" `find src -name \*.[hHC]` | \
110 awk 'BEGIN {FS= ":"} {print $1}' | sort -f -d | uniq >> tmppot
111 mv tmppot po/POTFILES.in
112 echo "done"
113
114 echo
115 echo 'run "./configure ; make"'
116 echo