forked from FreeSpacenav/spnavcfg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·158 lines (135 loc) · 3.54 KB
/
configure
File metadata and controls
executable file
·158 lines (135 loc) · 3.54 KB
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
#!/bin/sh
echo 'configuring spnavcfg...'
PREFIX=/usr/local
OPT=yes
DBG=yes
X11=yes
qtmoc=moc
qtuic=uic
qtrcc=rcc
qtver=
qttooldir=
for arg; do
case "$arg" in
--prefix=*)
value=`echo $arg | sed 's/--prefix=//'`
PREFIX=${value:-$prefix}
;;
--enable-opt)
OPT=yes;;
--disable-opt)
OPT=no;;
--enable-debug)
DBG=yes;;
--disable-debug)
DBG=no;;
--qt5)
qtver=5;;
--qt6)
qtver=6;;
--qt-tooldir=*)
qttooldir=`echo $arg | sed 's/--qt-tooldir=//; s/\/$//'`;;
--help)
echo 'usage: ./configure [options]'
echo 'options:'
echo ' --prefix=<path>: installation path (default: /usr/local)'
echo ' --enable-opt: enable speed optimizations (default)'
echo ' --disable-opt: disable speed optimizations'
echo ' --enable-debug: include debugging symbols (default)'
echo ' --disable-debug: do not include debugging symbols'
echo ' --qt5: use Qt 5.x'
echo ' --qt6: use Qt 6.x'
echo ' --qt-tooldir=<path>: location of moc, uic, and rcc, if not in PATH'
echo 'all invalid options are silently ignored'
exit 0
;;
esac
done
check_moc_version()
{
if [ -n "$qttooldir" ]; then
qtmoc=$qttooldir/moc
qtuic=$qttooldir/uic
qtrcc=$qttooldir/rcc
fi
mocver=`$qtmoc --version 2>/dev/null | sed 's/moc //; s/\..*//'`
}
# if qt version was not specified, try to auto-detect it
# if the tool location was specified, look for moc and use its version
if [ -z "$qtver" -a -n "$qttooldir" ]; then
check_moc_version
if [ -n "$mocver" ]; then
qtver=$mocver
fi
fi
#if we still don't have a qt version ...
if [ -z "$qtver" ]; then
# if Qt6 is installed, default to that
if pkg-config --exists Qt6Widgets; then
qtver=6
else
qtver=5
fi
fi
# check moc presence and version
check_moc_version
if [ $? != 0 -o "$mocver" != "$qtver" ]; then
# moc not found, if tooldir was specified, panic
if [ -n "$qttooldir" ]; then
echo "can't find moc in the specified Qt tooldir: $qttooldir" >&2
exit 1
fi
qtsearchpaths='/usr/lib64 /usr/lib /usr/libexec \
/usr/local/lib64 /usr/local/lib /usr/local/libexec'
# look for moc in a few common locations
for i in $qtsearchpaths; do
mocpath=`find $i/qt$qtver -name moc 2>/dev/null | head -1`
[ -n "$mocpath" ] && break
done
if [ -z "$mocpath" ]; then
echo "failed to find Qt tools (moc,uic,rcc), use --qt-tooldir=<path> to specify their location" >&2
exit 1
fi
qttooldir=`dirname $mocpath`
check_moc_version
fi
if [ "$mocver" != "$qtver" ]; then
echo "Using Qt $qtver, but found moc from Qt $mocver." >&2
echo "Use --qt-tooldir=<path> to specify the location of the Qt $qtver tools (moc,uic,rcc)" >&2
exit 1
fi
if [ "$qtver" = 5 ]; then
cstd=c++11
else
cstd=c++17
fi
echo " prefix: $PREFIX"
echo " optimize for speed: $OPT"
echo " include debugging symbols: $DBG"
echo " using Qt $qtver"
[ -n "$qttooldir" ] && echo " Qt tool path: $qttooldir"
echo
# create Makefile
echo 'creating Makefile ...'
echo "PREFIX = $PREFIX" >Makefile
if [ "$DBG" = 'yes' ]; then
echo 'dbg = -g' >>Makefile
fi
if [ "$OPT" = 'yes' ]; then
echo 'opt = -O3' >>Makefile
fi
echo "qtmoc = $qtmoc" >>Makefile
echo "qtuic = $qtuic" >>Makefile
echo "qtrcc = $qtrcc" >>Makefile
echo "cflags_qt = -std=${cstd} `pkg-config --cflags Qt${qtver}Core Qt${qtver}Gui Qt${qtver}Widgets`" >>Makefile
echo "libs_qt = `pkg-config --libs Qt${qtver}Core Qt${qtver}Gui Qt${qtver}Widgets`" >>Makefile
if [ -n "$CFLAGS" ]; then
echo "add_cflags = $CFLAGS" >>Makefile
fi
if [ -n "$LDFLAGS" ]; then
echo "add_ldflags = $LDFLAGS" >>Makefile
fi
cat "Makefile.in" >>Makefile
echo ''
echo 'Done. You can now type make (or gmake) to compile spnavcfg.'
echo ''