~james-page/ubuntu/precise/leveldb/cloud-archive

« back to all changes in this revision

Viewing changes to build_detect_platform

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2012-06-14 10:38:40 UTC
  • mfrom: (7.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20120614103840-98xgc1gx7djt9v5c
Tags: 0+20120530.gitdd0d562-1
* Imported Upstream version 0+20120530.gitdd0d562
* Update patch for SuperH.
  Thanks to Nobuhiro Iwamatsu for the great work. (Closes: #671808)
* Drop 0111-soname_fix.patch, applied upstream.
* Refresh patches.
* Update debian/copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# argument, which in turn gets read while processing Makefile.
5
5
#
6
6
# The output will set the following variables:
 
7
#   CC                          C Compiler path
 
8
#   CXX                         C++ Compiler path
7
9
#   PLATFORM_LDFLAGS            Linker flags
8
10
#   PLATFORM_LIBS               Libraries flags
9
11
#   PLATFORM_SHARED_EXT         Extension for shared libraries
11
13
#   PLATFORM_SHARED_CFLAGS      Flags for compiling objects for shared library
12
14
#   PLATFORM_CCFLAGS            C compiler flags
13
15
#   PLATFORM_CXXFLAGS           C++ compiler flags.  Will contain:
14
 
#       -DLEVELDB_PLATFORM_POSIX if cstdatomic is present
15
 
#       -DLEVELDB_PLATFORM_NOATOMIC if it is not
 
16
#   PLATFORM_SHARED_VERSIONED   Set to 'true' if platform supports versioned
 
17
#                               shared libraries, empty otherwise.
 
18
#
 
19
# The PLATFORM_CCFLAGS and PLATFORM_CXXFLAGS might include the following:
 
20
#
 
21
#       -DLEVELDB_CSTDATOMIC_PRESENT if <cstdatomic> is present
 
22
#       -DLEVELDB_PLATFORM_POSIX     for Posix-based platforms
 
23
#       -DSNAPPY                     if the Snappy library is present
 
24
#
16
25
 
17
26
OUTPUT=$1
18
27
if test -z "$OUTPUT"; then
19
 
  echo "usage: $0 <output-filename>"
 
28
  echo "usage: $0 <output-filename>" >&2
20
29
  exit 1
21
30
fi
22
31
 
24
33
rm -f $OUTPUT
25
34
touch $OUTPUT
26
35
 
 
36
if test -z "$CC"; then
 
37
    CC=cc
 
38
fi
 
39
 
27
40
if test -z "$CXX"; then
28
41
    CXX=g++
29
42
fi
34
47
fi
35
48
 
36
49
COMMON_FLAGS=
 
50
CROSS_COMPILE=
37
51
PLATFORM_CCFLAGS=
38
52
PLATFORM_CXXFLAGS=
39
53
PLATFORM_LDFLAGS=
41
55
PLATFORM_SHARED_EXT="so"
42
56
PLATFORM_SHARED_LDFLAGS="-shared -Wl,-soname -Wl,"
43
57
PLATFORM_SHARED_CFLAGS="-fPIC"
 
58
PLATFORM_SHARED_VERSIONED=true
44
59
 
45
60
# On GCC, we pick libc's memcmp over GCC's memcmp via -fno-builtin-memcmp
46
61
case "$TARGET_OS" in
88
103
        PORT_FILE=port/port_posix.cc
89
104
        ;;
90
105
    OS_ANDROID_CROSSCOMPILE)
91
 
        PLATFORM="$TARGET_OS"
92
 
        COMMON_FLAGS=""
93
 
        PLATFORM_LDFLAGS=""
94
 
        PORT_FILE=port/port_android.cc
 
106
        PLATFORM=OS_ANDROID
 
107
        COMMON_FLAGS="-fno-builtin-memcmp -D_REENTRANT -DOS_ANDROID -DLEVELDB_PLATFORM_POSIX"
 
108
        PLATFORM_LDFLAGS=""  # All pthread features are in the Android C library
 
109
        PORT_FILE=port/port_posix.cc
 
110
        CROSS_COMPILE=true
95
111
        ;;
96
112
    GNU/kFreeBSD)
97
113
        PLATFORM=OS_FREEBSD
106
122
        PORT_FILE=port/port_posix.cc
107
123
        ;;
108
124
    *)
109
 
        echo "Unknown platform!"
 
125
        echo "Unknown platform!" >&2
110
126
        exit 1
111
127
esac
112
128
 
126
142
echo "SOURCES=$PORTABLE_FILES $PORT_FILE" >> $OUTPUT
127
143
echo "MEMENV_SOURCES=helpers/memenv/memenv.cc" >> $OUTPUT
128
144
 
129
 
if [ "$PLATFORM" = "OS_ANDROID_CROSSCOMPILE" ]; then
 
145
if [ "$CROSS_COMPILE" = "true" ]; then
130
146
    # Cross-compiling; do not try any compilation tests.
131
147
    true
132
148
else
165
181
PLATFORM_CCFLAGS="$PLATFORM_CCFLAGS $COMMON_FLAGS"
166
182
PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS $COMMON_FLAGS"
167
183
 
 
184
echo "CC=$CC" >> $OUTPUT
 
185
echo "CXX=$CXX" >> $OUTPUT
168
186
echo "PLATFORM=$PLATFORM" >> $OUTPUT
169
187
echo "PLATFORM_LDFLAGS=$PLATFORM_LDFLAGS" >> $OUTPUT
170
188
echo "PLATFORM_LIBS=$PLATFORM_LIBS" >> $OUTPUT
173
191
echo "PLATFORM_SHARED_CFLAGS=$PLATFORM_SHARED_CFLAGS" >> $OUTPUT
174
192
echo "PLATFORM_SHARED_EXT=$PLATFORM_SHARED_EXT" >> $OUTPUT
175
193
echo "PLATFORM_SHARED_LDFLAGS=$PLATFORM_SHARED_LDFLAGS" >> $OUTPUT
 
194
echo "PLATFORM_SHARED_VERSIONED=$PLATFORM_SHARED_VERSIONED" >> $OUTPUT