xref: /aosp_15_r20/external/cronet/third_party/ced/src/autogen.sh (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1#!/bin/bash
2#
3# Copyright 2016 Google Inc.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17################################################################################
18
19# Run this script to generate the configure script and other files that will
20# be included in the distribution.  These files are not checked in because they
21# are automatically generated.
22
23set -e
24
25if [ ! -z "$@" ]; then
26  for argument in "$@"; do
27    case $argument in
28	  # make curl silent
29      "-s")
30        curlopts="-s"
31        ;;
32    esac
33  done
34fi
35
36
37# Check that we're being run from the right directory.
38if test ! -f compact_enc_det/compact_enc_det.h; then
39  cat >&2 << __EOF__
40Could not find source code.  Make sure you are running this script from the
41root of the distribution tree.
42__EOF__
43  exit 1
44fi
45
46# Check that gtest is present. It is used to build unit test suite.
47if test ! -e gtest; then
48  if test -z $(which curl); then
49    echo "curl cannot be found. Please install it to build the package."
50    exit 1
51  fi
52
53  echo "Google Test not present.  Fetching from the web..."
54  curl $curlopts -L -O https://github.com/google/googletest/archive/master.zip
55  unzip -q master.zip
56  rm master.zip
57  mv googletest-master gtest
58fi
59
60if test -z $(which cmake); then
61  echo "CMake cannot be found. Please install it to build the package."
62  exit 1
63fi
64
65# Build gtest
66(cd gtest && cmake . && make)
67
68# Build the main package
69cmake . && make
70
71set -ex
72
73exit 0
74