1#!/bin/sh
2
3# Run this script to generate the configure script and other files that will
4# be included in the distribution.  These files are not checked in because they
5# are automatically generated.
6
7set -e
8
9# Check that we're being run from the right directory.
10if test ! -f src/google/protobuf/stubs/common.h; then
11  cat >&2 << __EOF__
12Could not find source code.  Make sure you are running this script from the
13root of the distribution tree.
14__EOF__
15  exit 1
16fi
17
18# Check that gtest is present.  Usually it is already there since the
19# directory is set up as an SVN external.
20if test ! -e gtest; then
21  echo "Google Test not present.  Fetching gtest-1.5.0 from the web..."
22  curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx
23  mv gtest-1.5.0 gtest
24fi
25
26set -ex
27
28# Temporary hack:  Must change C runtime library to "multi-threaded DLL",
29#   otherwise it will be set to "multi-threaded static" when MSVC upgrades
30#   the project file to MSVC 2005/2008.  vladl of Google Test says gtest will
31#   probably change their default to match, then this will be unnecessary.
32#   One of these mappings converts the debug configuration and the other
33#   converts the release configuration.  I don't know which is which.
34sed -i -e 's/RuntimeLibrary="5"/RuntimeLibrary="3"/g;
35           s/RuntimeLibrary="4"/RuntimeLibrary="2"/g;' gtest/msvc/*.vcproj
36
37# TODO(kenton):  Remove the ",no-obsolete" part and fix the resulting warnings.
38autoreconf -f -i -Wall,no-obsolete
39
40rm -rf autom4te.cache config.h.in~
41exit 0
42