This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure
executable file
·99 lines (89 loc) · 3.14 KB
/
configure
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
#!/bin/bash
#
# @file configure Simple configuration script for building the SAS client
# library.
#
# Service Assurance Server client library
# Copyright (C) 2013 Metaswitch Networks Ltd
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version, along with the "Special Exception" for use of
# the program along with SSL, set forth below. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more
# details. You should have received a copy of the GNU General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# The author can be reached by email at [email protected] or by
# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK
#
# Special Exception
# Metaswitch Networks Ltd grants you permission to copy, modify,
# propagate, and distribute a work formed by combining OpenSSL with The
# Software, or a work derivative of such a combination, even if such
# copying, modification, propagation, or distribution would otherwise
# violate the terms of the GPL. You must comply with the GPL in all
# respects for all of the code used other than OpenSSL.
# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL
# Project and licensed under the OpenSSL Licenses, or a work based on such
# software and licensed under the OpenSSL Licenses.
# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License
# under which the OpenSSL Project distributes the OpenSSL toolkit software,
# as those licenses appear in the file LICENSE-OPENSSL.
# This script is a simple configure script. It is hand written (rather than
# using autoconf, automake etc.) as it only need to check for the presence of a
# few header files.
#
# If this script gets significantly more compliated, consider migrating to
# autoconf.
CONFIG_FILE=include/config.h
HEADERS="atomic cstdatomic"
# Check whether a header file is present on the system by compiling a test
# program that includes it.
#
# Params:
# $1 - The header file to check.
check_header_file()
{
header=$1
echo "#include <$header>" > test.cpp
g++ -c test.cpp -std=c++0x >/dev/null 2>&1
present=$?
rm test.cpp
printf "checking for $header... "
if [[ $present -eq 0 ]]
then
echo "yes"
else
echo "no"
fi
return $present
}
# Write a #define to the config header file indicating whether a particular
# resource is present.
#
# Params:
# $1 - The resource referred to.
# $2 - Whether the resource is present (0 or 1)
write_hash_define()
{
name=$(echo $1 | tr [a-z.] [A-Z_])
flag=$2
echo "#define HAVE_$name $flag" >> $CONFIG_FILE
}
# Clear out the config file.
: > $CONFIG_FILE
# Work out whether the header files we could use are present.
for header in $HEADERS
do
if check_header_file $header
then
write_hash_define $header 1
else
write_hash_define $header 0
fi
done