Welcome to mirror list, hosted at ThFree Co, Russian Federation.

regenerate-makefiles.sh - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8470e3f1e54ac4b29e40eb75f5f48eef8c5da334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
cat <<EOF
Moses is moving to Boost Jam.  To build Moses, run one command:
./bjam [--with-srilm=/path/to/srilm] [--with-irstlm=/path/to/irstlm] -j4

If that's not working for you, complain to moses-support then run 
./regenerate-makefiles.sh --force to continue using autotools.  
EOF
if [ z"$1" != z--force ]; then
  exit 1
fi

# NOTE:
# Versions 1.9 (or higher) of aclocal and automake are required.
# And version >=2.60 of autoconf
# And version >=1.4.7 of m4

# For Mac OSX users:
# Standard distribution usually includes versions 1.6.
# Get versions 1.9 or higher
# Set the following variable to the correct paths
#ACLOCAL="/path/to/aclocal-1.9"
#AUTOMAKE="/path/to/automake-1.9"

function die () {
  echo "$@" >&2

  # Try to be as helpful as possible by detecting OS and making recommendations
  if (( $(lsb_release -a | fgrep -ci "ubuntu") > 0 )); then
      echo >&2
      echo >&2 "Need to install build autotools on Ubuntu? Use:"
      echo >&2 "sudo aptitude install autoconf automake libtool build-essential"
  fi
  if (( $(uname -a | fgrep -ci "darwin") > 0 )); then
      echo >&2
      echo >&2 "Having problems on Mac OSX?"
      echo >&2 "You might have an old version of aclocal/automake. You'll need to upgrade these."
  fi
  exit 1
}

if [ -z "$ACLOCAL" ]; then
    ACLOCAL=`which aclocal`
    [ -n "$ACLOCAL" ] || die "aclocal not found on your system. Please install it or set $ACLOCAL"
fi

if [ -z "$AUTOMAKE" ]; then
    AUTOMAKE=`which automake`
    [ -n "$AUTOMAKE" ] || die "automake not found on your system. Please install it or set $AUTOMAKE"
fi

if [ -z "$AUTOCONF" ]; then
    AUTOCONF=`which autoconf`
    [ -n "$AUTOCONF" ] || die "autoconf not found on your system. Please install it or set $AUTOCONF"
fi

if [ -z "$LIBTOOLIZE" ]; then
    LIBTOOLIZE=`which libtoolize`

    if [ -z "$LIBTOOLIZE" ]; then
        LIBTOOLIZE=`which glibtoolize`
    fi

    [ -n "$LIBTOOLIZE" ] || die "libtoolize/glibtoolize not found on your system. Please install it or set $LIBTOOLIZE"
fi

echo >&2 "Detected aclocal: $($ACLOCAL --version | head -n1)"
echo >&2 "Detected autoconf: $($AUTOCONF --version | head -n1)"
echo >&2 "Detected automake: $($AUTOMAKE --version | head -n1)"
echo >&2 "Detected libtoolize: $($LIBTOOLIZE --version | head -n1)"

echo "Calling $ACLOCAL -I m4..."
$ACLOCAL -I m4 || die "aclocal failed"

echo "Calling $AUTOCONF..."
$AUTOCONF  || die "autoconf failed"

echo "Calling $LIBTOOLIZE"
$LIBTOOLIZE || die "libtoolize failed"

echo "Calling $AUTOMAKE --add-missing..."
$AUTOMAKE --add-missing || die "automake failed"

case `uname -s` in
    Darwin)
        cores=$(sysctl -n hw.ncpu)
        ;;
    Linux)
        cores=$(cat /proc/cpuinfo | fgrep -c processor)
        ;;
    *)
        echo "Unknown platform."
        cores=
        ;;
esac

if [ -z "$cores" ]; then
    cores=2 # assume 2 cores if we can't figure it out
    echo >&2 "Assuming 2 cores"
else
    echo >&2 "Detected $cores cores"
fi

echo
echo "You should now be able to configure and build:"
echo "   ./configure [--with-srilm=/path/to/srilm] [--with-irstlm=/path/to/irstlm] [--with-randlm=/path/to/randlm] [--with-synlm] [--with-xmlrpc-c=/path/to/xmlrpc-c-config]"
echo "   make -j ${cores}"
echo