forked from orocos-toolchain/rtt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·133 lines (118 loc) · 4.08 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
#!/bin/bash
echo "Orocos configure script. WARNING: ONLY WORKS FOR GNULINUX INSTALLATIONS"
function usage
{
echo "This script allows you to set the compiler and CFLAGS/LDFLAGS."
echo "Usage : ../configure [--prefix=/usr/local] [--with-target=/target/path] [CC=compiler] [CXX=compiler]"
echo
echo "Supported --with-target's: --with-xenomai --with-lxrt --with-gnulinux"
echo
echo "Options:"
echo " --enable-corba Enable CORBA, if installed on the system."
echo " --disable-shared Build static libraries instead of shared libraries."
echo " --embedded Disable Scripting, Exceptions and reduce the type system."
echo " --with-linux=/path Provide a Linux path for RTAI/LXRT or old Xenomai versions."
echo
echo "Example: CXXFLAGS='-g' $0 --prefix=/usr/local/orocos --with-xenomai=/usr/xenomai CC=gcc-3.3.6 CXX=g++-3.3.6"
echo
echo "For more advanced configuration, use the 'ccmake' utility directly."
}
function getoptions
{
arg="$1"
if [ $(expr match "$arg" "CC=") != 0 ]; then
CMAKE_CC="$arg"
fi
if [ $(expr match "$arg" "CXX=") != 0 ]; then
CMAKE_CXX="$arg"
fi
if [ $(expr match "$arg" "--prefix=") != 0 ]; then
CMAKE_PREFIX="${arg:9}"
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=$CMAKE_PREFIX"
fi
if [ $(expr match "$arg" "--with-xenomai") != 0 ]; then
CMAKE_XENO_PATH="${arg:15}"
CMAKE_ARGS="$CMAKE_ARGS -DOROCOS_TARGET=xenomai"
if [ x$CMAKE_XENO_PATH != x ]; then
CMAKE_ARGS="$CMAKE_ARGS -DXENOMAI_INSTALL_DIR=$CMAKE_XENO_PATH"
fi
fi
if [ $(expr match "$arg" "--with-lxrt") != 0 ]; then
CMAKE_LXRT_PATH="${arg:12}"
CMAKE_ARGS="$CMAKE_ARGS -DOROCOS_TARGET=lxrt"
if [ x$CMAKE_LXRT_PATH != x ]; then
CMAKE_ARGS="$CMAKE_ARGS -DRTAI_INSTALL_DIR=$CMAKE_LXRT_PATH"
fi
fi
if [ $(expr match "$arg" "--with-linux") != 0 ]; then
CMAKE_LINUX_PATH="${arg:13}"
if [ x$CMAKE_LINUX_PATH != x ]; then
CMAKE_ARGS="$CMAKE_ARGS -DLINUX_SOURCE_DIR=$CMAKE_LINUX_PATH"
# else
# CMAKE_ARGS="$CMAKE_ARGS -DLINUX_SOURCE_DIR=/usr/include"
fi
fi
if [ $(expr match "$arg" "--enable-corba") != 0 ]; then
CMAKE_ARGS="$CMAKE_ARGS -DENABLE_CORBA=TRUE"
fi
if [ $(expr match "$arg" "--disable-shared") != 0 ]; then
CMAKE_ARGS="$CMAKE_ARGS -DBUILD_STATIC=ON"
fi
if [ $(expr match "$arg" "--enable-static") != 0 ]; then
CMAKE_ARGS="$CMAKE_ARGS -DBUILD_STATIC=ON"
fi
if [ $(expr match "$arg" "--embedded") != 0 ]; then
CMAKE_ARGS="$CMAKE_ARGS -DOS_EMBEDDED=ON"
fi
}
while [ "$1" != "" ]; do
case $1 in
-h | --help ) usage
exit
;;
* ) getoptions $1
esac
shift
done
# if [ -f ./configure ]; then
# echo "Error: run configure from a 'build' directory:"
# echo " $ mkdir build"
# echo " $ cd build"
# echo " $ ../configure [options]"
# exit 1
# fi
src_dir="$(dirname $0)"
if [ -f ./CMakeCache.txt ]; then
echo "Error: One can not change the compiler once configured !"
echo "Error: In order to change the compiler, use a fresh build directory."
exit 1
fi
if [ x$(which cmake) == x ]; then
echo "Error: 'cmake' executable not found. Download it from http://www.cmake.org"
echo "Error: or install the cmake package of your distribution version 2.2 or higher."
exit 1
fi
# If CXXFLAGS set, build type must be set to None to have them picked up.
if [ "x$CXXFLAGS" != "x" ]; then
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=None"
export CXXFLAGS
fi
if [ "x$LDFLAGS" != "x" ]; then
#CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=None"
export LDFLAGS
fi
CMAKE_EXE=$(which cmake)
if [ x$CMAKE_EXE = x ]; then
echo "Error: cmake program not found. See http://www.cmake.org"
exit 1;
fi
echo "Invoking: '$CMAKE_CC $CMAKE_CXX $CMAKE_EXE .. $CMAKE_ARGS'"
if [ x$CMAKE_CC != x ]; then
export $CMAKE_CC
fi
if [ x$CMAKE_CXX != x ]; then
export $CMAKE_CXX
fi
$CMAKE_EXE $src_dir $CMAKE_ARGS || { echo -e "\ncmake produced an error - removing cache."; rm CMakeCache.txt; exit 1; }
echo
echo "OK: configure done. Now issue 'make'."