-
Notifications
You must be signed in to change notification settings - Fork 21
/
configure
executable file
·165 lines (142 loc) · 3.46 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/sh
#-------------------------------------------------------------------------
#
# Copyright (c) 2011 Rajit Manohar
# All Rights Reserved
#
#-------------------------------------------------------------------------
#
# Create the "config" file in the scripts/ directory that contains
# standard definitions
#
if [ x$VLSI_TOOLS_SRC = "x" ]
then
echo "Environment variable VLSI_TOOLS_SRC undefined."
echo "It should be set to the root of the tools source tree."
exit 1
fi
first_char=`echo $0 | sed 's/^\(.\).*$/\1/g'`
if [ x$first_char = "x/" ]
then
full_pathname=`dirname $0`
else
full_pathname=`pwd`/`dirname $0`
fi
arch=`$full_pathname/scripts/getarch`;
os=`$full_pathname/scripts/getos`;
baseos=`$full_pathname/scripts/getbaseos`;
installdir=/usr/local/cad
if [ $# -gt 0 ]
then
installdir=$1
fi
if [ ! -d $installdir ]
then
echo "Missing install directory [$installdir]."
exit 1
fi
echo "Configuring for [$arch] architecture, os [${os}]"
echo "Install directory: [$installdir]"
#
# Binaries
#
if [ ! -d $installdir/bin ]
then
mkdir $installdir/bin
fi
#
# C/C++ Libraries
#
if [ ! -d $installdir/lib ]
then
mkdir $installdir/lib
fi
#
# Header files for libraries
#
if [ ! -d $installdir/include ]
then
mkdir $installdir/include
fi
if [ ! -d $installdir/include/act ]
then
mkdir $installdir/include/act
fi
#
# Technology configuration
#
if [ ! -d $installdir/conf ]
then
mkdir $installdir/conf
fi
#
# ACT standard includes
#
if [ ! -d $installdir/act ]
then
mkdir $installdir/act
fi
# use gcc and g++ if not otherwise specified
c_compiler_name=${C_COMPILER_NAME:-gcc}
cxx_compiler_name=${CXX_COMPILER_NAME:-g++}
# get additional CFLAGS and pass them through
while [ $# -gt 1 ]
do
case $2 in
"CFLAGS="*) addon_cflags=${2#CFLAGS=}
addon_cflags=${addon_cflags#\"}
addon_cflags=${addon_cflags#\'}
echo "CFLAGS: $addon_cflags"
;;
"CC="*) c_compiler_name=${2#CC=}
;;
"CXX="*) cxx_compiler_name=${2#CXX=}
;;
*) echo "Unknown argument: $2"; exit 1
esac
shift
done
#
# shared linking on macos
#
if [ "x$baseos" = "xdarwin" ]
then
sh_build=-fPIC
sh_link=-dynamiclib
sh_exe_options=
elif [ "x$baseos" = "xlinux" ] || [ "x$baseos" = "xsolaris" ]
then
sh_build="\"-shared -DPIC -fPIC\""
# the RUNPATH shared object search parameter are relative the location of the binary during runtime, and as backup the compile time $ACT_HOME path is used
# libraries and executables are parsed differently by the build system hand have therefor different escape patterns
sh_link="\"-shared -Wl,-x,-rpath=\\\$ORIGIN/../lib,-rpath=$ACT_HOME/lib\""
sh_exe_options="\"-Wl,-rpath=\\$\$ORIGIN/../lib,-rpath=$ACT_HOME/lib\""
else
sh_build="\"-shared -DPIC -fPIC\""
sh_link="\"-shared -Wl,-x,-rpath=$ACT_HOME/lib\""
sh_exe_options="\"-Wl,-rpath=$ACT_HOME/lib\""
fi
# the double parentesis are needed beause of double parcing in the check script and are removed in the makefile to have the intended behaviour
c_compiler_flags="\"-O2 ${addon_cflags}\""
make_program=gmake
myranlib=ranlib
cat <<EOF > $full_pathname/scripts/config
#
# This file is auto-generated, don't edit it!
#
ARCH=$arch
OS=$os
BASEOS=$baseos
RANLIB=$myranlib
INSTALLDIR=$installdir
C_COMPILER_NAME=$c_compiler_name
CXX_COMPILER_NAME=$cxx_compiler_name
C_COMPILER_FLAGS=$c_compiler_flags
SH_BUILD_OPTIONS=$sh_build
SH_LINK_OPTIONS=$sh_link
SH_EXE_OPTIONS=$sh_exe_options
EOF
if ! $full_pathname/scripts/check
then
exit 1
fi