File: configure

package info (click to toggle)
vite 1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 15,296 kB
  • ctags: 4,426
  • sloc: cpp: 21,696; ansic: 20,533; sh: 10,218; python: 660; makefile: 439
file content (288 lines) | stat: -rwxr-xr-x 8,482 bytes parent folder | download
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#
# This file is part of the ViTE project.
#
# This software is governed by the CeCILL-A license under French law
# and abiding by the rules of distribution of free software. You can
# use, modify and/or redistribute the software under the terms of the
# CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
# URL: "http://www.cecill.info".
# 
# As a counterpart to the access to the source code and rights to copy,
# modify and redistribute granted by the license, users are provided
# only with a limited warranty and the software's author, the holder of
# the economic rights, and the successive licensors have only limited
# liability.
# 
# In this respect, the user's attention is drawn to the risks associated
# with loading, using, modifying and/or developing or reproducing the
# software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also
# therefore means that it is reserved for developers and experienced
# professionals having in-depth computer knowledge. Users are therefore
# encouraged to load and test the software's suitability as regards
# their requirements in conditions enabling the security of their
# systems and/or data to be ensured and, more generally, to use and
# operate it in the same conditions as regards security.
# 
# The fact that you are presently reading this means that you have had
# knowledge of the CeCILL-A license and that you accept its terms.
#
#
# ViTE developers are (for version 0.* to 1.0):
#
#        - COULOMB Kevin
#        - FAVERGE Mathieu
#        - JAZEIX Johnny
#        - LAGRASSE Olivier
#        - MARCOUEILLE Jule
#        - NOISETTE Pascal
#        - REDONDY Arthur
#        - VUCHENER Clément 
#
#
#!/bin/sh

relpath=`dirname $0`
relpath=`(cd "$relpath"; /bin/pwd)`
WHICH=`which which 2>/dev/null`
UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
makefile="Makefile"

with_otf=0
config_specified=0

# where will we concatenate options like macros, libs...
compilation_src_pro="src.pro"

# For qmake
config="\"CONFIG+="
defines="\"DEFINES+="
libs="\"LIBS+="
includes="\"INCLUDES+="
sources="\"SOURCES+="
headers="\"HEADERS+="

echo ""
echo "-------------------------------"
echo "-------------------------------"
echo ""
echo "     Visual Trace Explorer"
echo "       - configuration -"
echo ""
echo ""
echo " type './configure -h' for help "
echo ""
echo ""
echo " Default mode is:"
echo "      * RELEASE mode"
echo ""
echo "-------------------------------"
echo "-------------------------------"
echo ""
echo ""

usage()
{
  echo "ViTE configuration shell-script"
  echo "Usage:"
  echo " ./configure [ options ]"
  echo
  echo "Options:"
  echo "  -h, --help"
  echo "        print this page"
  echo ""
  echo "  --release"
  echo "        compiles in release mode (by default)"
  echo ""
  echo "  --debug"
  echo "        compiles in debug mode"
  echo ""
  echo "  --enable_spinning_logo"
  echo "        makes the rabbit to turn when no trace is loaded"
  echo ""
  echo "  --enable_otf"
  echo "        enables the otf support. The otf release used by default is in the src/general directory"
## Will be added later
#  echo "  --otf_include_dir=<path>    set the otf directory path"
#  echo "  --otf_library_dir=<path>    set the otf library path (<path>/libotf.a)"
  exit 0
}


while [ 0 -lt $# ]; do
    OPT=$1
    shift 1
    case $OPT in
        --help|-h)  # help
            usage
            ;;
        --enable_otf) # otf support
            with_otf=1;
            defines="$defines WITH_OTF"
            libs="$libs general/otf/otflib/.libs/libotf.a -Lgeneral/otf/otflib/.libs"
            sources="$sources parser/ParserOTF.cpp parser/ParserEventOTF.cpp parser/ParserDefinitionOTF.cpp"
            headers="$headers parser/ParserOTF.hpp parser/ParserEventOTF.hpp parser/ParserDefinitionOTF.hpp"
            includes="$includes "
            #compilation_src_pro="\"DEFINES+=WITH_OTF\" \"LIBS+=general/otf/otflib/.libs/libotf.a -Lgeneral/otf/otflib/.libs\" \"SOURCES+=parser/ParserOTF.cpp parser/ParserEventOTF.cpp parser/ParserDefinitionOTF.cpp\" \"HEADERS+=parser/ParserOTF.hpp parser/ParserEventOTF.hpp parser/ParserDefinitionOTF.hpp\" src.pro "
            ;;
        --enable_spinning_logo) # good openGL spinning rabbit :)
            defines="$defines SPINNING_LOGO"
            ;;
        --release)
            config_specified=1;
            config="$config release"
            ;;
        --debug)
            config_specified=1;
            config="$config debug"
            ;;
        *)
            echo "invalid option : $OPT";
            exit 0;
    esac

done

#end the qmake options
if [ $config_specified = 1 ]; then 
    config="$config\"";
else
    config="$config release\"";
fi
defines="$defines\"";
libs="$libs\"";
includes="$includes\"";
sources="$sources\"";
headers="$headers\"";

compilation_src_pro="$defines $config $libs $includes $sources $headers";

# find a make command
if [ -z "$MAKE" ]; then
    MAKE=
    for mk in gmake make; do
        if "$WHICH" $mk >/dev/null 2>&1; then
            MAKE=`$WHICH $mk`
            break
        fi
    done
    if [ -z "$MAKE" ]; then
        echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
        echo >&2 "Cannot proceed."
        exit 1
    fi
fi

OTFLIB_DIR=./src/general/otf

# Creates the makefile
cat > "$makefile" <<EOF
########################################################################
##                                                                    ##
## This file was autogenerated by configure, all changes will be lost ##
##                                                                    ##
################### It has by done for ViTE project ####################
##                                                                    ##
########################################################################
EOF

if [ $with_otf = 1 ]; then # set the directory... should be decided by the user, we will see after how to do beautiful options :)

cat >> "$makefile" <<EOF
OTFLIB_DIR = ./src/general/otf

all:
	make -C \$(OTFLIB_DIR)
	rm -rf \$(OTFLIB_DIR)/otflib/.libs/*so*
	rm -rf \$(OTFLIB_DIR)/otflib/.libs/*dylib* # For mac
EOF
else
cat >> "$makefile" <<EOF
    
all:
EOF

fi

if "$WHICH" qmake-qt4 >/dev/null 2>&1 ; then
    cat >> "$makefile" <<EOF
	cd ./src && qmake-qt4 -makefile -o Makefile $compilation_src_pro && make
EOF
elif "$WHICH" qmake >/dev/null 2>&1 && [ "$UNAME_SYSTEM" = "Darwin" ] ; then # Mac
    cat >> "$makefile" <<EOF
	cd src/ && qmake -spec macx-xcode $compilation_src_pro && xcodebuild -project vite.xcodeproj -configuration Debug clean build
EOF
elif "$WHICH" qmake >/dev/null 2>&1 ; then
    cat >> "$makefile" <<EOF
	cd ./src && qmake -makefile -o Makefile $compilation_src_pro && make
EOF
elif "$WHICH" qmake-mac >/dev/null 2>&1 ; then # Mac the return
    cat >> "$makefile" <<EOF
	cd ./src && qmake-mac -makefile -o Makefile $compilation_src_pro && make
EOF
else # error
    echo >&2 "Warning: Impossible to find qmake or qmake-qt4."
    echo >&2 "Be sure that you have installed Qt and qmake (if it is not included in the Qt package)"
    rm -f Makefile
    exit
fi
    cat >>"$makefile" <<EOF
	@echo " "
	@echo "Compilation completed! File created in 'bin' folder."
	@echo " "

DOCUMENTATION = ../documentation/
doc:
	doxygen Doxyfile
	make -C \$(DOCUMENTATION)/latex
	make -C \$(DOCUMENTATION)/user_manual
	make -C \$(DOCUMENTATION)/technical_manual
	@echo " "
	@echo "Documentation generated successfully!"
	@echo "It could be find in the \$(DOCUMENTATION) folder."
	@echo " "

clean:
	cd ./src && make clean
	\$(RM) log.txt
	@echo " "
	@echo "Cleaned!"
	@echo " "


cleanall:	clean
EOF

if [ $with_otf = 1 ]; then
    cat >>"$makefile" <<EOF
	make -C \$(OTFLIB_DIR) clean
EOF
fi
    cat >>"$makefile" <<EOF
	make -C \$(DOCUMENTATION)/user_manual cleanall
	make -C \$(DOCUMENTATION)/technical_manual cleanall
	@(cd bin/ && \$(RM) vite)
	@(cd \$(DOCUMENTATION) && rm -rf html/ latex/)

distclean:	cleanall
EOF
if [ $with_otf = 1 ]; then
    cat >>"$makefile" <<EOF
	make -C \$(OTFLIB_DIR) distclean
EOF
fi
    cat >>"$makefile" <<EOF
	\$(RM) Makefile
	\$(RM) src/Makefile

EOF


if [ $with_otf = 1 ]; then
    echo >&2 "Configuration of the otf library"
    cd $OTFLIB_DIR && ./configure
fi
# basename erase the path of acces of the command 
MAKE=`basename $MAKE`

echo ViTE is now configured for building. Just run \'$MAKE\'.