1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # Generated by qconf 1.2-CVS ( http://delta.affinix.com/qconf/ )
|
---|
4 | #
|
---|
5 |
|
---|
6 | show_usage() {
|
---|
7 | cat <<EOT
|
---|
8 | Usage: $0 [OPTION]...
|
---|
9 |
|
---|
10 | This script creates necessary configuration files to build/install.
|
---|
11 |
|
---|
12 | Main options:
|
---|
13 | --prefix=[path] Base path for build/install. Default: /usr/local
|
---|
14 | --bindir=[path] Directory for binaries. Default: PREFIX/bin
|
---|
15 | --datadir=[path] Directory for data. Default: PREFIX/share
|
---|
16 | --qtdir=[path] Directory where Qt is installed.
|
---|
17 | --debug Enable debug output.
|
---|
18 | --help This help text.
|
---|
19 |
|
---|
20 | Dependency options:
|
---|
21 | --with-qca-inc=[path] Path to QCA include files
|
---|
22 | --with-qca-lib=[path] Path to QCA library files
|
---|
23 | --with-zlib-inc=[path] Path to zlib include files
|
---|
24 | --with-zlib-lib=[path] Path to zlib library files
|
---|
25 | --disable-growl Disable use of Growl
|
---|
26 | --with-growl=[path] Path to the Growl framework
|
---|
27 | --disable-xss Disable use of the XScreenSaver extension
|
---|
28 | --disable-dnotify Disable use of Linux Directory Notification
|
---|
29 | --disable-ghbnr Disable use of gethostbyname_r()
|
---|
30 |
|
---|
31 | EOT
|
---|
32 | }
|
---|
33 |
|
---|
34 | # which/make detection adapted from Qt
|
---|
35 | which_command() {
|
---|
36 | OLD_HOME=$HOME
|
---|
37 | HOME=/dev/null
|
---|
38 | export HOME
|
---|
39 |
|
---|
40 | WHICH=`which which 2>/dev/null`
|
---|
41 | if echo $WHICH | grep 'shell built-in command' >/dev/null 2>&1; then
|
---|
42 | WHICH=which
|
---|
43 | elif [ -z "$WHICH" ]; then
|
---|
44 | if which which >/dev/null 2>&1; then
|
---|
45 | WHICH=which
|
---|
46 | else
|
---|
47 | for a in /usr/ucb /usr/bin /bin /usr/local/bin; do
|
---|
48 | if [ -x $a/which ]; then
|
---|
49 | WHICH=$a/which
|
---|
50 | break;
|
---|
51 | fi
|
---|
52 | done
|
---|
53 | fi
|
---|
54 | fi
|
---|
55 |
|
---|
56 | if [ -z "$WHICH" ]; then
|
---|
57 | OLD_IFS=$IFS
|
---|
58 | IFS=:
|
---|
59 | for a in $PATH; do
|
---|
60 | if [ -x $a/$1 ]; then
|
---|
61 | echo "$a/$1"
|
---|
62 | IFS=$OLD_IFS
|
---|
63 | export IFS
|
---|
64 | HOME=$OLD_HOME
|
---|
65 | export HOME
|
---|
66 | return 0
|
---|
67 | fi
|
---|
68 | done
|
---|
69 | IFS=$OLD_IFS
|
---|
70 | export IFS
|
---|
71 | else
|
---|
72 | a=`"$WHICH" "$1" 2>/dev/null`
|
---|
73 | if [ ! -z "$a" -a -x "$a" ]; then
|
---|
74 | echo "$a"
|
---|
75 | HOME=$OLD_HOME
|
---|
76 | export HOME
|
---|
77 | return 0
|
---|
78 | fi
|
---|
79 | fi
|
---|
80 | HOME=$OLD_HOME
|
---|
81 | export HOME
|
---|
82 | return 1
|
---|
83 | }
|
---|
84 | WHICH=which_command
|
---|
85 |
|
---|
86 | # find a make command
|
---|
87 | if [ -z "$MAKE" ]; then
|
---|
88 | MAKE=
|
---|
89 | for mk in gmake make; do
|
---|
90 | if $WHICH $mk >/dev/null 2>&1; then
|
---|
91 | MAKE=`$WHICH $mk`
|
---|
92 | break
|
---|
93 | fi
|
---|
94 | done
|
---|
95 | if [ -z "$MAKE" ]; then
|
---|
96 | echo "You don't seem to have 'make' or 'gmake' in your PATH."
|
---|
97 | echo "Cannot proceed."
|
---|
98 | exit 1
|
---|
99 | fi
|
---|
100 | fi
|
---|
101 |
|
---|
102 | show_qt_info() {
|
---|
103 | printf "Be sure you have a proper Qt 4.0 build environment set up. This means not\n"
|
---|
104 | printf "just Qt, but also a C++ compiler, a make tool, and any other packages\n"
|
---|
105 | printf "necessary for compiling C++ programs.\n"
|
---|
106 | printf "\n"
|
---|
107 | printf "If you are certain everything is installed, then it could be that Qt 4 is not\n"
|
---|
108 | printf "being recognized or that a different version of Qt is being detected by\n"
|
---|
109 | printf "mistake (for example, this could happen if \$QTDIR is pointing to a Qt 3\n"
|
---|
110 | printf "installation). At least one of the following conditions must be satisfied:\n"
|
---|
111 | printf "\n"
|
---|
112 | printf " 1) --qtdir is set to the location of Qt\n"
|
---|
113 | printf " 2) \$QTDIR is set to the location of Qt\n"
|
---|
114 | printf " 3) QtCore is in the pkg-config database\n"
|
---|
115 | printf " 4) qmake is in the \$PATH\n"
|
---|
116 | printf "\n"
|
---|
117 | printf "This script will use the first one it finds to be true, checked in the above\n"
|
---|
118 | printf "order. #3 and #4 are the recommended options. #1 and #2 are mainly for\n"
|
---|
119 | printf "overriding the system configuration.\n"
|
---|
120 | printf "\n"
|
---|
121 | }
|
---|
122 |
|
---|
123 | while [ $# -gt 0 ]; do
|
---|
124 | case "$1" in
|
---|
125 | --prefix=*)
|
---|
126 | PREFIX="${1#--prefix=}"
|
---|
127 | shift
|
---|
128 | ;;
|
---|
129 |
|
---|
130 | --bindir=*)
|
---|
131 | BINDIR="${1#--bindir=}"
|
---|
132 | shift
|
---|
133 | ;;
|
---|
134 |
|
---|
135 | --datadir=*)
|
---|
136 | DATADIR="${1#--datadir=}"
|
---|
137 | shift
|
---|
138 | ;;
|
---|
139 |
|
---|
140 | --qtdir=*)
|
---|
141 | EX_QTDIR="${1#--qtdir=}"
|
---|
142 | shift
|
---|
143 | ;;
|
---|
144 |
|
---|
145 | --with-qca-inc=*)
|
---|
146 | QC_WITH_QCA_INC="${1#--with-qca-inc=}"
|
---|
147 | shift
|
---|
148 | ;;
|
---|
149 |
|
---|
150 | --with-qca-lib=*)
|
---|
151 | QC_WITH_QCA_LIB="${1#--with-qca-lib=}"
|
---|
152 | shift
|
---|
153 | ;;
|
---|
154 |
|
---|
155 | --with-zlib-inc=*)
|
---|
156 | QC_WITH_ZLIB_INC="${1#--with-zlib-inc=}"
|
---|
157 | shift
|
---|
158 | ;;
|
---|
159 |
|
---|
160 | --with-zlib-lib=*)
|
---|
161 | QC_WITH_ZLIB_LIB="${1#--with-zlib-lib=}"
|
---|
162 | shift
|
---|
163 | ;;
|
---|
164 |
|
---|
165 | --disable-growl)
|
---|
166 | QC_DISABLE_growl="Y"
|
---|
167 | shift
|
---|
168 | ;;
|
---|
169 |
|
---|
170 | --with-growl=*)
|
---|
171 | QC_WITH_GROWL="${1#--with-growl=}"
|
---|
172 | shift
|
---|
173 | ;;
|
---|
174 |
|
---|
175 | --disable-xss)
|
---|
176 | QC_DISABLE_xss="Y"
|
---|
177 | shift
|
---|
178 | ;;
|
---|
179 |
|
---|
180 | --disable-dnotify)
|
---|
181 | QC_DISABLE_dnotify="Y"
|
---|
182 | shift
|
---|
183 | ;;
|
---|
184 |
|
---|
185 | --disable-ghbnr)
|
---|
186 | QC_DISABLE_ghbnr="Y"
|
---|
187 | shift
|
---|
188 | ;;
|
---|
189 |
|
---|
190 | --debug)
|
---|
191 | QC_DEBUG="Y"
|
---|
192 | shift
|
---|
193 | ;;
|
---|
194 | --help) show_usage; exit ;;
|
---|
195 | *) show_usage; exit ;;
|
---|
196 | esac
|
---|
197 | done
|
---|
198 |
|
---|
199 | PREFIX=${PREFIX:-/usr/local}
|
---|
200 | BINDIR=${BINDIR:-$PREFIX/bin}
|
---|
201 | DATADIR=${DATADIR:-$PREFIX/share}
|
---|
202 |
|
---|
203 | echo "Configuring Psi ..."
|
---|
204 |
|
---|
205 | if [ "$QC_DEBUG" = "Y" ]; then
|
---|
206 | echo
|
---|
207 | echo PREFIX=$PREFIX
|
---|
208 | echo BINDIR=$BINDIR
|
---|
209 | echo DATADIR=$DATADIR
|
---|
210 | echo EX_QTDIR=$EX_QTDIR
|
---|
211 | echo QC_WITH_QCA_INC=$QC_WITH_QCA_INC
|
---|
212 | echo QC_WITH_QCA_LIB=$QC_WITH_QCA_LIB
|
---|
213 | echo QC_WITH_ZLIB_INC=$QC_WITH_ZLIB_INC
|
---|
214 | echo QC_WITH_ZLIB_LIB=$QC_WITH_ZLIB_LIB
|
---|
215 | echo QC_DISABLE_growl=$QC_DISABLE_growl
|
---|
216 | echo QC_WITH_GROWL=$QC_WITH_GROWL
|
---|
217 | echo QC_DISABLE_xss=$QC_DISABLE_xss
|
---|
218 | echo QC_DISABLE_dnotify=$QC_DISABLE_dnotify
|
---|
219 | echo QC_DISABLE_ghbnr=$QC_DISABLE_ghbnr
|
---|
220 | echo
|
---|
221 | fi
|
---|
222 |
|
---|
223 | printf "Verifying Qt 3.x Multithreaded (MT) build environment ... "
|
---|
224 |
|
---|
225 | if [ -z "$QTDIR" ]; then
|
---|
226 | if [ "$QC_DEBUG" = "Y" ]; then
|
---|
227 | echo \$QTDIR not set... trying to find Qt manually
|
---|
228 | fi
|
---|
229 | for p in /usr/lib/qt /usr/share/qt /usr/share/qt3 /usr/local/lib/qt /usr/local/share/qt /usr/lib/qt3 /usr/local/lib/qt3 /usr/X11R6/share/qt /usr/qt/3 ; do
|
---|
230 | if [ -d "$p/mkspecs" ]; then
|
---|
231 | QTDIR=$p
|
---|
232 | break;
|
---|
233 | fi;
|
---|
234 | done
|
---|
235 | if [ -z "$QTDIR" ]; then
|
---|
236 | echo fail
|
---|
237 | echo
|
---|
238 | echo "Unable to find Qt 'mkspecs'. Perhaps you need to"
|
---|
239 | echo "install the Qt 3 development utilities. You may download"
|
---|
240 | echo "them either from the vendor of your operating system"
|
---|
241 | echo "or from http://www.trolltech.com/"
|
---|
242 | echo
|
---|
243 | echo "If you're sure you have the Qt development utilities"
|
---|
244 | echo "installed, you might try using the --qtdir option."
|
---|
245 | echo
|
---|
246 | exit 1;
|
---|
247 | fi
|
---|
248 | if [ ! -x "$QTDIR/bin/moc" ]; then
|
---|
249 | m=`which moc 2>/dev/null`
|
---|
250 | if [ ! -x "$m" ]; then
|
---|
251 | echo fail
|
---|
252 | echo
|
---|
253 | echo "We found Qt in $QTDIR, but we were unable to locate"
|
---|
254 | echo "the moc utility. It was not found in $QTDIR/bin"
|
---|
255 | echo "nor in PATH. This seems to be a very unusual setup."
|
---|
256 | echo "You might try using the --qtdir option."
|
---|
257 | echo
|
---|
258 | exit 1;
|
---|
259 | fi
|
---|
260 | qtpre=`echo $m | awk '{ n = index($0, "/bin/moc"); if (!n) { exit 1; } print substr($0, 0, n-1); exit 0; }' 2>/dev/null`
|
---|
261 | ret="$?"
|
---|
262 | if [ "$ret" != "0" ]; then
|
---|
263 | echo fail
|
---|
264 | echo
|
---|
265 | echo "We found Qt in $QTDIR, but the location of moc"
|
---|
266 | echo "($m) is not suitable for use with this build system."
|
---|
267 | echo "This is a VERY unusual and likely-broken setup. You"
|
---|
268 | echo "should contact the maintainer of your Qt package."
|
---|
269 | echo
|
---|
270 | exit 1;
|
---|
271 | fi
|
---|
272 | QTDIR=$qtpre
|
---|
273 | fi
|
---|
274 | fi
|
---|
275 |
|
---|
276 | if [ ! -x "$QTDIR/bin/qmake" ]; then
|
---|
277 | if [ "$QC_DEBUG" = "Y" ]; then
|
---|
278 | echo Warning: qmake not in \$QTDIR/bin/qmake
|
---|
279 | echo trying to find it in \$PATH
|
---|
280 | fi
|
---|
281 | qm=`which qmake 2>/dev/null`
|
---|
282 | if [ -x "$qm" ]; then
|
---|
283 | if [ "$QC_DEBUG" = "Y" ]; then
|
---|
284 | echo qmake found in $qm
|
---|
285 | fi
|
---|
286 | else
|
---|
287 | echo fail
|
---|
288 | echo
|
---|
289 | echo Sorry, you seem to have a very unusual setup,
|
---|
290 | echo or I missdetected \$QTDIR=$QTDIR
|
---|
291 | echo
|
---|
292 | echo Please set \$QTDIR manually and make sure that
|
---|
293 | echo \$QTDIR/bin/qmake exists.
|
---|
294 | echo
|
---|
295 | exit 1;
|
---|
296 | fi
|
---|
297 | else
|
---|
298 | qm=$QTDIR/bin/qmake
|
---|
299 | fi
|
---|
300 |
|
---|
301 | gen_files() {
|
---|
302 | cat >$1/modules.cpp <<EOT
|
---|
303 | #line 1 "qt31.qcm"
|
---|
304 | /*
|
---|
305 | -----BEGIN QCMOD-----
|
---|
306 | name: Qt >= 3.1
|
---|
307 | -----END QCMOD-----
|
---|
308 | */
|
---|
309 | class qc_qt31 : public ConfObj
|
---|
310 | {
|
---|
311 | public:
|
---|
312 | qc_qt31(Conf *c) : ConfObj(c) {}
|
---|
313 | QString name() const { return "Qt >= 3.1"; }
|
---|
314 | QString shortname() const { return "qt31"; }
|
---|
315 | bool exec()
|
---|
316 | {
|
---|
317 | if(QT_VERSION >= 0x030100) {
|
---|
318 | if(QT_VERSION < 0x030300)
|
---|
319 | conf->addExtra("QXML_STATIC = Y");
|
---|
320 | return true;
|
---|
321 | }
|
---|
322 | else
|
---|
323 | return false;
|
---|
324 | }
|
---|
325 | };
|
---|
326 | #line 1 "qca.qcm"
|
---|
327 | /*
|
---|
328 | -----BEGIN QCMOD-----
|
---|
329 | name: QCA 1.0
|
---|
330 | arg: with-qca-inc=[path],Path to QCA include files
|
---|
331 | arg: with-qca-lib=[path],Path to QCA library files
|
---|
332 | -----END QCMOD-----
|
---|
333 | */
|
---|
334 |
|
---|
335 | //----------------------------------------------------------------------------
|
---|
336 | // qc_qca
|
---|
337 | //----------------------------------------------------------------------------
|
---|
338 | class qc_qca : public ConfObj
|
---|
339 | {
|
---|
340 | public:
|
---|
341 | qc_qca(Conf *c) : ConfObj(c) {}
|
---|
342 | QString name() const { return "QCA 1.0"; }
|
---|
343 | QString shortname() const { return "qca"; }
|
---|
344 | bool exec()
|
---|
345 | {
|
---|
346 | QString inc, lib;
|
---|
347 | QString s;
|
---|
348 |
|
---|
349 | s = conf->getenv("QC_WITH_QCA_INC");
|
---|
350 | if(!s.isEmpty()) {
|
---|
351 | if(!conf->checkHeader(s, "qca.h"))
|
---|
352 | return false;
|
---|
353 | inc = s;
|
---|
354 | }
|
---|
355 | else {
|
---|
356 | if(!conf->findHeader("qca.h", QStringList(), &s))
|
---|
357 | return false;
|
---|
358 | inc = s;
|
---|
359 | }
|
---|
360 |
|
---|
361 | s = conf->getenv("QC_WITH_QCA_LIB");
|
---|
362 | if(!s.isEmpty()) {
|
---|
363 | if(!conf->checkLibrary(s, "qca"))
|
---|
364 | return false;
|
---|
365 | lib = s;
|
---|
366 | }
|
---|
367 | else {
|
---|
368 | if(!conf->findLibrary("qca", &s))
|
---|
369 | return false;
|
---|
370 | lib = s;
|
---|
371 | }
|
---|
372 |
|
---|
373 | if(!inc.isEmpty())
|
---|
374 | conf->addIncludePath(inc);
|
---|
375 | if(!lib.isEmpty())
|
---|
376 | conf->addLib(QString("-L") + s);
|
---|
377 | conf->addLib("-lqca");
|
---|
378 |
|
---|
379 | return true;
|
---|
380 | }
|
---|
381 | };
|
---|
382 | #line 1 "zlib.qcm"
|
---|
383 | /*
|
---|
384 | -----BEGIN QCMOD-----
|
---|
385 | name: zlib
|
---|
386 | arg: with-zlib-inc=[path],Path to zlib include files
|
---|
387 | arg: with-zlib-lib=[path],Path to zlib library files
|
---|
388 | -----END QCMOD-----
|
---|
389 | */
|
---|
390 |
|
---|
391 | //----------------------------------------------------------------------------
|
---|
392 | // qc_zlib
|
---|
393 | //----------------------------------------------------------------------------
|
---|
394 | class qc_zlib : public ConfObj
|
---|
395 | {
|
---|
396 | public:
|
---|
397 | qc_zlib(Conf *c) : ConfObj(c) {}
|
---|
398 | QString name() const { return "zlib"; }
|
---|
399 | QString shortname() const { return "zlib"; }
|
---|
400 | bool exec()
|
---|
401 | {
|
---|
402 | QString inc, lib;
|
---|
403 | QString s;
|
---|
404 |
|
---|
405 | s = conf->getenv("QC_WITH_ZLIB_INC");
|
---|
406 | if(!s.isEmpty()) {
|
---|
407 | if(!conf->checkHeader(s, "zlib.h"))
|
---|
408 | return false;
|
---|
409 | inc = s;
|
---|
410 | }
|
---|
411 | else {
|
---|
412 | if(!conf->findHeader("zlib.h", QStringList(), &s))
|
---|
413 | return false;
|
---|
414 | inc = s;
|
---|
415 | }
|
---|
416 |
|
---|
417 | s = conf->getenv("QC_WITH_ZLIB_LIB");
|
---|
418 | if(!s.isEmpty()) {
|
---|
419 | if(!conf->checkLibrary(s, "z"))
|
---|
420 | return false;
|
---|
421 | lib = s;
|
---|
422 | }
|
---|
423 | else {
|
---|
424 | if(!conf->findLibrary("z", &s))
|
---|
425 | return false;
|
---|
426 | lib = s;
|
---|
427 | }
|
---|
428 |
|
---|
429 | if(!inc.isEmpty())
|
---|
430 | conf->addIncludePath(inc);
|
---|
431 | if(!lib.isEmpty())
|
---|
432 | conf->addLib(QString("-L") + s);
|
---|
433 | conf->addLib("-lz");
|
---|
434 |
|
---|
435 | return true;
|
---|
436 | }
|
---|
437 | };
|
---|
438 | #line 1 "growl.qcm"
|
---|
439 | /*
|
---|
440 | -----BEGIN QCMOD-----
|
---|
441 | name: Growl
|
---|
442 | arg: with-growl=[path],Path to the Growl framework
|
---|
443 | -----END QCMOD-----
|
---|
444 | */
|
---|
445 |
|
---|
446 | //----------------------------------------------------------------------------
|
---|
447 | // qc_growl
|
---|
448 | //----------------------------------------------------------------------------
|
---|
449 | class qc_growl : public ConfObj
|
---|
450 | {
|
---|
451 | public:
|
---|
452 | qc_growl(Conf *c) : ConfObj(c) {}
|
---|
453 | QString name() const { return "Growl"; }
|
---|
454 | QString shortname() const { return "growl"; }
|
---|
455 |
|
---|
456 | // TODO: This should go into ConfObj
|
---|
457 | bool checkFramework(const QString &path, const QString &name)
|
---|
458 | {
|
---|
459 | QString str =
|
---|
460 | "int main()\n"
|
---|
461 | "{\n"
|
---|
462 | " return 0;\n"
|
---|
463 | "}\n";
|
---|
464 |
|
---|
465 | QString extra;
|
---|
466 | if(!path.isEmpty())
|
---|
467 | extra += QString("-F") + path + ' ';
|
---|
468 | extra += QString("-framework ") + name;
|
---|
469 | if(!conf->doCompileAndLink(str, extra))
|
---|
470 | return false;
|
---|
471 | return true;
|
---|
472 | }
|
---|
473 |
|
---|
474 | // TODO: This should go into ConfObj
|
---|
475 | void addFrameworkPath(const QString& str)
|
---|
476 | {
|
---|
477 | conf->addExtra("QMAKE_CXXFLAGS += -F" + str);
|
---|
478 | conf->addLib("-F" + str);
|
---|
479 | }
|
---|
480 |
|
---|
481 | bool exec()
|
---|
482 | {
|
---|
483 | #ifdef Q_WS_MAC
|
---|
484 | QString growl_path = conf->getenv("QC_WITH_GROWL");
|
---|
485 | if(!checkFramework(growl_path, "Growl"))
|
---|
486 | return false;
|
---|
487 |
|
---|
488 | if(!growl_path.isEmpty())
|
---|
489 | addFrameworkPath(growl_path);
|
---|
490 | conf->addLib("-framework Growl");
|
---|
491 | conf->addDefine("HAVE_GROWL");
|
---|
492 |
|
---|
493 | return true;
|
---|
494 | #else
|
---|
495 | return false;
|
---|
496 | #endif
|
---|
497 | }
|
---|
498 | };
|
---|
499 | #line 1 "xss.qcm"
|
---|
500 | /*
|
---|
501 | -----BEGIN QCMOD-----
|
---|
502 | name: the XScreenSaver extension
|
---|
503 | -----END QCMOD-----
|
---|
504 | */
|
---|
505 |
|
---|
506 | //----------------------------------------------------------------------------
|
---|
507 | // qc_xss
|
---|
508 | //----------------------------------------------------------------------------
|
---|
509 | class qc_xss : public ConfObj
|
---|
510 | {
|
---|
511 | public:
|
---|
512 | enum { OK, NEEDLIB, FAIL };
|
---|
513 | qc_xss(Conf *c) : ConfObj(c)
|
---|
514 | {
|
---|
515 | }
|
---|
516 |
|
---|
517 | ~qc_xss()
|
---|
518 | {
|
---|
519 | remove("xssprobe_test.c");
|
---|
520 | remove("xssprobe_test.o");
|
---|
521 | remove("xssprobe_test");
|
---|
522 | }
|
---|
523 |
|
---|
524 | QString name() const
|
---|
525 | {
|
---|
526 | return "the XScreenSaver extension";
|
---|
527 | }
|
---|
528 |
|
---|
529 | QString shortname() const { return "xss"; }
|
---|
530 |
|
---|
531 | int do_write()
|
---|
532 | {
|
---|
533 | char *xsstest =
|
---|
534 | "#include<X11/Xlib.h>\n"
|
---|
535 | "#include<X11/Xutil.h>\n"
|
---|
536 | "#include<X11/extensions/scrnsaver.h>\n"
|
---|
537 | "\n"
|
---|
538 | "int main()\n"
|
---|
539 | "{\n"
|
---|
540 | " XScreenSaverQueryExtension(NULL, NULL, NULL);\n"
|
---|
541 | " return 0;\n"
|
---|
542 | "}\n";
|
---|
543 |
|
---|
544 | FILE *f;
|
---|
545 | f = fopen("xssprobe_test.c", "w");
|
---|
546 | if(!f)
|
---|
547 | return 0;
|
---|
548 | fwrite(xsstest, strlen(xsstest), 1, f);
|
---|
549 | fclose(f);
|
---|
550 |
|
---|
551 | return 1;
|
---|
552 | }
|
---|
553 |
|
---|
554 | int do_compile()
|
---|
555 | {
|
---|
556 | QString inc = conf->expandIncludes(conf->qvar("QMAKE_INCDIR_X11"));
|
---|
557 | QString str = conf->qvar("QMAKE_CC") + " -c " + inc + " xssprobe_test.c -o xssprobe_test.o";
|
---|
558 | int r = conf->doCommand(str);
|
---|
559 | if(r == 0)
|
---|
560 | return 1;
|
---|
561 | else
|
---|
562 | return 0;
|
---|
563 | }
|
---|
564 |
|
---|
565 | int do_link()
|
---|
566 | {
|
---|
567 | QString lib = conf->expandLibs(conf->qvar("QMAKE_LIBDIR_X11"));
|
---|
568 | QString inc = conf->expandIncludes(conf->qvar("QMAKE_INCDIR_X11"));
|
---|
569 | QString str = conf->qvar("QMAKE_CC") + " xssprobe_test.o -o xssprobe_test " + lib + ' ' + conf->qvar("QMAKE_LIBS_X11");
|
---|
570 | int r = conf->doCommand(str);
|
---|
571 | if(r == 0)
|
---|
572 | return 1;
|
---|
573 | else
|
---|
574 | return 0;
|
---|
575 | }
|
---|
576 |
|
---|
577 | int do_linkLib()
|
---|
578 | {
|
---|
579 | QString lib = conf->expandLibs(conf->qvar("QMAKE_LIBDIR_X11"));
|
---|
580 | QString inc = conf->expandIncludes(conf->qvar("QMAKE_INCDIR_X11"));
|
---|
581 | QString str = conf->qvar("QMAKE_CC") + " xssprobe_test.o -o xssprobe_test " + lib + ' ' + conf->qvar("QMAKE_LIBS_X11") + " -lXss";
|
---|
582 | int r = conf->doCommand(str);
|
---|
583 | if(r == 0)
|
---|
584 | return 1;
|
---|
585 | else
|
---|
586 | return 0;
|
---|
587 | }
|
---|
588 |
|
---|
589 | int do_all()
|
---|
590 | {
|
---|
591 | if(!do_write())
|
---|
592 | return FAIL;
|
---|
593 | if(!do_compile())
|
---|
594 | return FAIL;
|
---|
595 | if(do_link())
|
---|
596 | return OK;
|
---|
597 | if(do_linkLib())
|
---|
598 | return NEEDLIB;
|
---|
599 | return FAIL;
|
---|
600 | }
|
---|
601 |
|
---|
602 | bool exec()
|
---|
603 | {
|
---|
604 | int r = do_all();
|
---|
605 | if(r == OK) {
|
---|
606 | conf->addDefine("HAVE_XSS");
|
---|
607 | return true;
|
---|
608 | }
|
---|
609 | else if(r == NEEDLIB) {
|
---|
610 | conf->addDefine("HAVE_XSS");
|
---|
611 | conf->addLib("-lXss");
|
---|
612 | return true;
|
---|
613 | }
|
---|
614 | }
|
---|
615 | };
|
---|
616 | #line 1 "dnotify.qcm"
|
---|
617 | /*
|
---|
618 | -----BEGIN QCMOD-----
|
---|
619 | name: Linux Directory Notification
|
---|
620 | -----END QCMOD-----
|
---|
621 | */
|
---|
622 |
|
---|
623 | #include<unistd.h>
|
---|
624 | #include<fcntl.h>
|
---|
625 | #include<signal.h>
|
---|
626 | #include<sys/utsname.h>
|
---|
627 |
|
---|
628 | //----------------------------------------------------------------------------
|
---|
629 | // qc_dnotify
|
---|
630 | //----------------------------------------------------------------------------
|
---|
631 | class qc_dnotify : public ConfObj
|
---|
632 | {
|
---|
633 | public:
|
---|
634 | qc_dnotify(Conf *c) : ConfObj(c)
|
---|
635 | {
|
---|
636 | }
|
---|
637 |
|
---|
638 | ~qc_dnotify()
|
---|
639 | {
|
---|
640 | remove("ftest.c");
|
---|
641 | remove("ftest.o");
|
---|
642 | }
|
---|
643 |
|
---|
644 | QString name() const { return "Linux Directory Notification"; }
|
---|
645 | QString shortname() const { return "dnotify"; }
|
---|
646 |
|
---|
647 | bool do_write()
|
---|
648 | {
|
---|
649 | char *fdata =
|
---|
650 | "#define _GNU_SOURCE\n"
|
---|
651 | "#include<unistd.h>\n"
|
---|
652 | "#include<fcntl.h>\n"
|
---|
653 | "#include<signal.h>\n"
|
---|
654 | "#include<sys/utsname.h>\n"
|
---|
655 | "\n"
|
---|
656 | "int main()\n"
|
---|
657 | "{\n"
|
---|
658 | " DN_DELETE|DN_CREATE|DN_RENAME|DN_MULTISHOT|DN_MODIFY|DN_ATTRIB;\n"
|
---|
659 | " return 0;\n"
|
---|
660 | "}\n";
|
---|
661 |
|
---|
662 | FILE *f;
|
---|
663 | f = fopen("ftest.c", "w");
|
---|
664 | if(!f)
|
---|
665 | return false;
|
---|
666 | fwrite(fdata, strlen(fdata), 1, f);
|
---|
667 | fclose(f);
|
---|
668 |
|
---|
669 | return true;
|
---|
670 | }
|
---|
671 |
|
---|
672 | bool do_compile()
|
---|
673 | {
|
---|
674 | QString str = conf->qvar("QMAKE_CC") + " -c ftest.c -o ftest.o";
|
---|
675 | int r = conf->doCommand(str);
|
---|
676 | if(r == 0)
|
---|
677 | return true;
|
---|
678 | else
|
---|
679 | return false;
|
---|
680 | }
|
---|
681 |
|
---|
682 | bool exec()
|
---|
683 | {
|
---|
684 | // taken from KDE
|
---|
685 | bool supports_dnotify = true; // not guilty until proven guilty
|
---|
686 | struct utsname uts;
|
---|
687 | int major, minor, patch;
|
---|
688 | if(uname(&uts) < 0)
|
---|
689 | supports_dnotify = false; // *shrug*
|
---|
690 | else if(sscanf(uts.release, "%d.%d.%d", &major, &minor, &patch) != 3)
|
---|
691 | supports_dnotify = false; // *shrug*
|
---|
692 | else if( major * 1000000 + minor * 1000 + patch < 2004019 ) // <2.4.19
|
---|
693 | supports_dnotify = false;
|
---|
694 | if(!supports_dnotify)
|
---|
695 | return false;
|
---|
696 |
|
---|
697 | if(!do_write())
|
---|
698 | return false;
|
---|
699 | if(!do_compile())
|
---|
700 | return false;
|
---|
701 |
|
---|
702 | conf->addDefine("HAVE_DNOTIFY");
|
---|
703 | return true;
|
---|
704 | }
|
---|
705 | };
|
---|
706 | #line 1 "ghbnr.qcm"
|
---|
707 | /*
|
---|
708 | -----BEGIN QCMOD-----
|
---|
709 | name: gethostbyname_r()
|
---|
710 | -----END QCMOD-----
|
---|
711 | */
|
---|
712 | class qc_ghbnr : public ConfObj
|
---|
713 | {
|
---|
714 | public:
|
---|
715 | qc_ghbnr(Conf *c) : ConfObj(c)
|
---|
716 | {
|
---|
717 | }
|
---|
718 |
|
---|
719 | ~qc_ghbnr()
|
---|
720 | {
|
---|
721 | remove("ftest.c");
|
---|
722 | remove("ftest");
|
---|
723 | }
|
---|
724 |
|
---|
725 | QString name() const { return "gethostbyname_r()"; }
|
---|
726 | QString shortname() const { return "ghbnr"; }
|
---|
727 |
|
---|
728 | bool exec()
|
---|
729 | {
|
---|
730 | char *fdata =
|
---|
731 | "#include<netdb.h>\n"
|
---|
732 | "\n"
|
---|
733 | "int main()\n"
|
---|
734 | "{\n"
|
---|
735 | " gethostbyname_r(\"\", 0, 0, 0, 0, 0);\n"
|
---|
736 | " return 0;\n"
|
---|
737 | "}\n";
|
---|
738 |
|
---|
739 | FILE *f;
|
---|
740 | f = fopen("ftest.c", "w");
|
---|
741 | if(!f)
|
---|
742 | return false;
|
---|
743 | fwrite(fdata, strlen(fdata), 1, f);
|
---|
744 | fclose(f);
|
---|
745 |
|
---|
746 | QString str = conf->qvar("QMAKE_CC") + " ftest.c -o ftest";
|
---|
747 | int r = conf->doCommand(str);
|
---|
748 | if(r == 0) {
|
---|
749 | conf->addDefine("HAVE_GETHOSTBYNAME_R");
|
---|
750 | return true;
|
---|
751 | }
|
---|
752 | else
|
---|
753 | return false;
|
---|
754 | }
|
---|
755 | };
|
---|
756 | #line 1 "conf.qcm"
|
---|
757 | /*
|
---|
758 | -----BEGIN QCMOD-----
|
---|
759 | name: Psi Configuration
|
---|
760 | -----END QCMOD-----
|
---|
761 | */
|
---|
762 |
|
---|
763 | //----------------------------------------------------------------------------
|
---|
764 | // qc_conf
|
---|
765 | //----------------------------------------------------------------------------
|
---|
766 | class qc_conf : public ConfObj
|
---|
767 | {
|
---|
768 | public:
|
---|
769 | qc_conf(Conf *c) : ConfObj(c) {}
|
---|
770 | QString name() const { return "Psi Configuration"; }
|
---|
771 | QString shortname() const { return "conf"; }
|
---|
772 | QString checkString() const { return "Writing configuration ..."; }
|
---|
773 | bool exec()
|
---|
774 | {
|
---|
775 | conf->addExtra(QString("PREFIX=%1").arg(conf->getenv("PREFIX")));
|
---|
776 | conf->addExtra(QString("DATADIR=%1/psi").arg(conf->getenv("DATADIR")));
|
---|
777 |
|
---|
778 | QFile file("src/config.h");
|
---|
779 | if ( file.open( IO_WriteOnly ) ) {
|
---|
780 | QTextStream stream( &file );
|
---|
781 | stream << "#define PSI_DATADIR \"" << conf->getenv("DATADIR") << "/psi\"" << endl;
|
---|
782 | }
|
---|
783 |
|
---|
784 | conf->addDefine("HAVE_CONFIG");
|
---|
785 |
|
---|
786 | return true;
|
---|
787 | }
|
---|
788 | };
|
---|
789 |
|
---|
790 | EOT
|
---|
791 | cat >$1/modules_new.cpp <<EOT
|
---|
792 | o = new qc_qt31(conf);
|
---|
793 | o->required = true;
|
---|
794 | o->disabled = false;
|
---|
795 | o = new qc_qca(conf);
|
---|
796 | o->required = true;
|
---|
797 | o->disabled = false;
|
---|
798 | o = new qc_zlib(conf);
|
---|
799 | o->required = true;
|
---|
800 | o->disabled = false;
|
---|
801 | o = new qc_growl(conf);
|
---|
802 | o->required = false;
|
---|
803 | o->disabled = false;
|
---|
804 | o = new qc_xss(conf);
|
---|
805 | o->required = false;
|
---|
806 | o->disabled = false;
|
---|
807 | o = new qc_dnotify(conf);
|
---|
808 | o->required = false;
|
---|
809 | o->disabled = false;
|
---|
810 | o = new qc_ghbnr(conf);
|
---|
811 | o->required = false;
|
---|
812 | o->disabled = false;
|
---|
813 | o = new qc_conf(conf);
|
---|
814 | o->required = true;
|
---|
815 | o->disabled = false;
|
---|
816 |
|
---|
817 | EOT
|
---|
818 | cat >$1/conf.h <<EOT
|
---|
819 |
|
---|
820 | EOT
|
---|
821 | cat >$1/conf.cpp <<EOT
|
---|
822 | #include<stdio.h>
|
---|
823 | #include<stdlib.h>
|
---|
824 | #include<qstring.h>
|
---|
825 | #include<qdict.h>
|
---|
826 | #include<qptrlist.h>
|
---|
827 | #include<qfileinfo.h>
|
---|
828 | #include<qfile.h>
|
---|
829 | #include<qdir.h>
|
---|
830 | #include<qstringlist.h>
|
---|
831 | #include<qobject.h>
|
---|
832 |
|
---|
833 | class MocTestObject : public QObject
|
---|
834 | {
|
---|
835 | Q_OBJECT
|
---|
836 | public:
|
---|
837 | MocTestObject() {}
|
---|
838 | };
|
---|
839 |
|
---|
840 | class Conf;
|
---|
841 |
|
---|
842 | class ConfObj
|
---|
843 | {
|
---|
844 | public:
|
---|
845 | ConfObj(Conf *c);
|
---|
846 | virtual ~ConfObj();
|
---|
847 |
|
---|
848 | virtual QString name() const=0;
|
---|
849 | virtual QString shortname() const=0;
|
---|
850 | virtual QString checkString() const;
|
---|
851 | virtual QString resultString() const;
|
---|
852 | virtual bool exec()=0;
|
---|
853 |
|
---|
854 | Conf *conf;
|
---|
855 | bool required;
|
---|
856 | bool disabled;
|
---|
857 | };
|
---|
858 |
|
---|
859 | typedef QPtrList<ConfObj> ConfObjList;
|
---|
860 | typedef QPtrListIterator<ConfObj> ConfObjListIt;
|
---|
861 |
|
---|
862 | class Conf
|
---|
863 | {
|
---|
864 | public:
|
---|
865 | Conf() : vars(17)
|
---|
866 | {
|
---|
867 | list.setAutoDelete(true);
|
---|
868 | vars.setAutoDelete(true);
|
---|
869 |
|
---|
870 | vars.insert("QMAKE_INCDIR_X11", new QString(X11_INC));
|
---|
871 | vars.insert("QMAKE_LIBDIR_X11", new QString(X11_LIBDIR));
|
---|
872 | vars.insert("QMAKE_LIBS_X11", new QString(X11_LIB));
|
---|
873 | vars.insert("QMAKE_CC", new QString(CC));
|
---|
874 | vars.insert("QMAKE_CXX", new QString(CXX));
|
---|
875 |
|
---|
876 | do_debug = false;
|
---|
877 | done_debug = false;
|
---|
878 | }
|
---|
879 |
|
---|
880 | ~Conf()
|
---|
881 | {
|
---|
882 | }
|
---|
883 |
|
---|
884 | void added(ConfObj *o)
|
---|
885 | {
|
---|
886 | list.append(o);
|
---|
887 | }
|
---|
888 |
|
---|
889 | QString getenv(const QString &var)
|
---|
890 | {
|
---|
891 | char *p = ::getenv(var.latin1());
|
---|
892 | if(!p)
|
---|
893 | return QString::null;
|
---|
894 | return QString(p);
|
---|
895 | }
|
---|
896 |
|
---|
897 | void debug(const QString &s)
|
---|
898 | {
|
---|
899 | if(do_debug) {
|
---|
900 | if(!done_debug)
|
---|
901 | printf("\n");
|
---|
902 | done_debug = true;
|
---|
903 | printf(" * %s\n", s.latin1());
|
---|
904 | }
|
---|
905 | }
|
---|
906 |
|
---|
907 | bool exec()
|
---|
908 | {
|
---|
909 | if(getenv("QC_DEBUG") == "Y")
|
---|
910 | do_debug = true;
|
---|
911 |
|
---|
912 | ConfObjListIt it(list);
|
---|
913 | for(ConfObj *o; (o = it.current()); ++it) {
|
---|
914 | // if this was a disabled-by-default option, check if it was enabled
|
---|
915 | if(o->disabled) {
|
---|
916 | QString v = QString("QC_ENABLE_") + o->shortname();
|
---|
917 | if(getenv(v) != "Y")
|
---|
918 | continue;
|
---|
919 | }
|
---|
920 | // and the opposite?
|
---|
921 | else {
|
---|
922 | QString v = QString("QC_DISABLE_") + o->shortname();
|
---|
923 | if(getenv(v) == "Y")
|
---|
924 | continue;
|
---|
925 | }
|
---|
926 |
|
---|
927 | QString check = o->checkString();
|
---|
928 | if(check.isEmpty())
|
---|
929 | check = QString("Checking for %1 ...").arg(o->name());
|
---|
930 | printf("%s", check.latin1());
|
---|
931 | fflush(stdout);
|
---|
932 |
|
---|
933 | done_debug = false;
|
---|
934 | bool ok = o->exec();
|
---|
935 |
|
---|
936 | QString result = o->resultString();
|
---|
937 | if(result.isEmpty()) {
|
---|
938 | if(ok)
|
---|
939 | result = "yes";
|
---|
940 | else
|
---|
941 | result = "no";
|
---|
942 | }
|
---|
943 | if(done_debug)
|
---|
944 | printf(" -> %s\n", result.latin1());
|
---|
945 | else
|
---|
946 | printf(" %s\n", result.latin1());
|
---|
947 |
|
---|
948 | if(!ok && o->required) {
|
---|
949 | printf("\nError: need %s!\n", o->name().latin1());
|
---|
950 | return false;
|
---|
951 | }
|
---|
952 | }
|
---|
953 | return true;
|
---|
954 | }
|
---|
955 |
|
---|
956 | const QString & qvar(const QString &s)
|
---|
957 | {
|
---|
958 | QString *p = vars.find(s);
|
---|
959 | if(p)
|
---|
960 | return *p;
|
---|
961 | else
|
---|
962 | return blank;
|
---|
963 | }
|
---|
964 |
|
---|
965 | QString expandIncludes(const QString &inc)
|
---|
966 | {
|
---|
967 | return QString("-I") + inc;
|
---|
968 | }
|
---|
969 |
|
---|
970 | QString expandLibs(const QString &lib)
|
---|
971 | {
|
---|
972 | return QString("-L") + lib;
|
---|
973 | }
|
---|
974 |
|
---|
975 | int doCommand(const QString &s)
|
---|
976 | {
|
---|
977 | debug(QString("[%1]").arg(s));
|
---|
978 | QString fullcmd;
|
---|
979 | if(do_debug)
|
---|
980 | fullcmd = s;
|
---|
981 | else
|
---|
982 | fullcmd = s + " 1>/dev/null 2>/dev/null";
|
---|
983 | int r = system(fullcmd.latin1());
|
---|
984 | debug(QString("returned: %1").arg(r));
|
---|
985 | return r;
|
---|
986 | }
|
---|
987 |
|
---|
988 | bool doCompileAndLink(const QString &filedata, const QString &flags, int *retcode=0)
|
---|
989 | {
|
---|
990 | QDir dir(".");
|
---|
991 | QString fname = "atest.c";
|
---|
992 | QString out = "atest";
|
---|
993 | QFile f(fname);
|
---|
994 | QCString cs = filedata.latin1();
|
---|
995 | if(!f.open(IO_WriteOnly | IO_Truncate)) {
|
---|
996 | debug("unable to open atest.c for writing");
|
---|
997 | return false;
|
---|
998 | }
|
---|
999 | if(f.writeBlock(cs.data(), cs.length()) == -1) {
|
---|
1000 | debug("error writing to atest.c");
|
---|
1001 | return false;
|
---|
1002 | }
|
---|
1003 | f.close();
|
---|
1004 |
|
---|
1005 | debug(QString("Wrote atest.c:\n%1").arg(filedata));
|
---|
1006 |
|
---|
1007 | QString str = qvar("QMAKE_CXX") + ' ' + fname + " -o " + out;
|
---|
1008 | if(!flags.isEmpty()) {
|
---|
1009 | str += ' ';
|
---|
1010 | str += flags;
|
---|
1011 | }
|
---|
1012 |
|
---|
1013 | int r = doCommand(str);
|
---|
1014 | if(r == 0 && retcode)
|
---|
1015 | *retcode = doCommand(QString("./") + out);
|
---|
1016 | dir.remove(fname);
|
---|
1017 | dir.remove(out);
|
---|
1018 | if(r != 0)
|
---|
1019 | return false;
|
---|
1020 | return true;
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | bool checkHeader(const QString &path, const QString &h)
|
---|
1024 | {
|
---|
1025 | QFileInfo fi(path + '/' + h);
|
---|
1026 | if(fi.exists())
|
---|
1027 | return true;
|
---|
1028 | return false;
|
---|
1029 | }
|
---|
1030 |
|
---|
1031 | bool findHeader(const QString &h, const QStringList &ext, QString *inc)
|
---|
1032 | {
|
---|
1033 | if(checkHeader("/usr/include", h)) {
|
---|
1034 | *inc = "";
|
---|
1035 | return true;
|
---|
1036 | }
|
---|
1037 | QStringList dirs;
|
---|
1038 | dirs += "/usr/local/include";
|
---|
1039 | dirs += ext;
|
---|
1040 | for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) {
|
---|
1041 | if(checkHeader(*it, h)) {
|
---|
1042 | *inc = *it;
|
---|
1043 | return true;
|
---|
1044 | }
|
---|
1045 | }
|
---|
1046 | return false;
|
---|
1047 | }
|
---|
1048 |
|
---|
1049 | bool checkLibrary(const QString &path, const QString &name)
|
---|
1050 | {
|
---|
1051 | QString str =
|
---|
1052 | "int main()\n"
|
---|
1053 | "{\n"
|
---|
1054 | " return 0;\n"
|
---|
1055 | "}\n";
|
---|
1056 |
|
---|
1057 | QString extra;
|
---|
1058 | if(!path.isEmpty())
|
---|
1059 | extra += QString("-L") + path + ' ';
|
---|
1060 | extra += QString("-l") + name;
|
---|
1061 | if(!doCompileAndLink(str, extra))
|
---|
1062 | return false;
|
---|
1063 | return true;
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | bool findLibrary(const QString &name, QString *lib)
|
---|
1067 | {
|
---|
1068 | if(checkLibrary("", name)) {
|
---|
1069 | *lib = "";
|
---|
1070 | return true;
|
---|
1071 | }
|
---|
1072 | if(checkLibrary("/usr/local/lib", name)) {
|
---|
1073 | *lib = "/usr/local/lib";
|
---|
1074 | return true;
|
---|
1075 | }
|
---|
1076 | return false;
|
---|
1077 | }
|
---|
1078 |
|
---|
1079 | void addDefine(const QString &str)
|
---|
1080 | {
|
---|
1081 | if(DEFINES.isEmpty())
|
---|
1082 | DEFINES = str;
|
---|
1083 | else
|
---|
1084 | DEFINES += QString(" ") + str;
|
---|
1085 | debug(QString("DEFINES += %1").arg(str));
|
---|
1086 | }
|
---|
1087 |
|
---|
1088 | void addLib(const QString &str)
|
---|
1089 | {
|
---|
1090 | if(LIBS.isEmpty())
|
---|
1091 | LIBS = str;
|
---|
1092 | else
|
---|
1093 | LIBS += QString(" ") + str;
|
---|
1094 | debug(QString("LIBS += %1").arg(str));
|
---|
1095 | }
|
---|
1096 |
|
---|
1097 | void addIncludePath(const QString &str)
|
---|
1098 | {
|
---|
1099 | if(INCLUDEPATH.isEmpty())
|
---|
1100 | INCLUDEPATH = str;
|
---|
1101 | else
|
---|
1102 | INCLUDEPATH += QString(" ") + str;
|
---|
1103 | debug(QString("INCLUDEPATH += %1").arg(str));
|
---|
1104 | }
|
---|
1105 |
|
---|
1106 | void addExtra(const QString &str)
|
---|
1107 | {
|
---|
1108 | extra += str + '\n';
|
---|
1109 | debug(QString("extra += %1").arg(str));
|
---|
1110 | }
|
---|
1111 |
|
---|
1112 | QString DEFINES;
|
---|
1113 | QString INCLUDEPATH;
|
---|
1114 | QString LIBS;
|
---|
1115 | QString extra;
|
---|
1116 |
|
---|
1117 | private:
|
---|
1118 | ConfObjList list;
|
---|
1119 | QDict<QString> vars;
|
---|
1120 | QString blank;
|
---|
1121 | bool do_debug, done_debug;
|
---|
1122 | };
|
---|
1123 |
|
---|
1124 | ConfObj::ConfObj(Conf *c)
|
---|
1125 | {
|
---|
1126 | conf = c;
|
---|
1127 | conf->added(this);
|
---|
1128 | required = false;
|
---|
1129 | disabled = false;
|
---|
1130 | }
|
---|
1131 |
|
---|
1132 | ConfObj::~ConfObj()
|
---|
1133 | {
|
---|
1134 | }
|
---|
1135 |
|
---|
1136 | QString ConfObj::checkString() const
|
---|
1137 | {
|
---|
1138 | return QString();
|
---|
1139 | }
|
---|
1140 |
|
---|
1141 | QString ConfObj::resultString() const
|
---|
1142 | {
|
---|
1143 | return QString();
|
---|
1144 | }
|
---|
1145 |
|
---|
1146 | #include"modules.cpp"
|
---|
1147 |
|
---|
1148 | //----------------------------------------------------------------------------
|
---|
1149 | // main
|
---|
1150 | //----------------------------------------------------------------------------
|
---|
1151 | int main()
|
---|
1152 | {
|
---|
1153 | Conf *conf = new Conf;
|
---|
1154 | ConfObj *o;
|
---|
1155 | o = 0;
|
---|
1156 | #include"modules_new.cpp"
|
---|
1157 |
|
---|
1158 | printf("ok\n");
|
---|
1159 | bool success = false;
|
---|
1160 | if(conf->exec()) {
|
---|
1161 | QFile f("conf.pri");
|
---|
1162 | if(!f.open(IO_WriteOnly | IO_Truncate)) {
|
---|
1163 | printf("Error writing %s\n", f.name().latin1());
|
---|
1164 | return 1;
|
---|
1165 | }
|
---|
1166 |
|
---|
1167 | QString str;
|
---|
1168 | str += "# qconf\n";
|
---|
1169 | str += "QT_PATH_PLUGINS = " + QString(qInstallPathPlugins()) + '\n';
|
---|
1170 | if(!conf->DEFINES.isEmpty())
|
---|
1171 | str += "DEFINES += " + conf->DEFINES + '\n';
|
---|
1172 | if(!conf->INCLUDEPATH.isEmpty())
|
---|
1173 | str += "INCLUDEPATH += " + conf->INCLUDEPATH + '\n';
|
---|
1174 | if(!conf->LIBS.isEmpty())
|
---|
1175 | str += "LIBS += " + conf->LIBS + '\n';
|
---|
1176 | if(!conf->extra.isEmpty())
|
---|
1177 | str += conf->extra;
|
---|
1178 | str += '\n';
|
---|
1179 |
|
---|
1180 | char *p = getenv("BINDIR");
|
---|
1181 | if(p) {
|
---|
1182 | str += QString("target.path = ") + p + '\n';
|
---|
1183 | str += "INSTALLS += target\n";
|
---|
1184 | }
|
---|
1185 |
|
---|
1186 | QCString cs = str.latin1();
|
---|
1187 | f.writeBlock(cs.data(), cs.length());
|
---|
1188 | f.close();
|
---|
1189 | success = true;
|
---|
1190 | }
|
---|
1191 | delete conf;
|
---|
1192 |
|
---|
1193 | if(success)
|
---|
1194 | return 0;
|
---|
1195 | else
|
---|
1196 | return 1;
|
---|
1197 | }
|
---|
1198 |
|
---|
1199 | #include"conf.moc"
|
---|
1200 |
|
---|
1201 |
|
---|
1202 | EOT
|
---|
1203 | cat >$1/conf.pro <<EOT
|
---|
1204 | TEMPLATE = app
|
---|
1205 | CONFIG += qt x11 thread console
|
---|
1206 | TARGET = conf
|
---|
1207 |
|
---|
1208 | DEFINES += X11_INC='"\$\$QMAKE_INCDIR_X11"'
|
---|
1209 | DEFINES += X11_LIBDIR='"\$\$QMAKE_LIBDIR_X11"'
|
---|
1210 | DEFINES += X11_LIB='"\$\$QMAKE_LIBS_X11"'
|
---|
1211 | DEFINES += CC='"\$\$QMAKE_CC"'
|
---|
1212 | DEFINES += CXX='"\$\$QMAKE_CXX"'
|
---|
1213 |
|
---|
1214 | SOURCES += conf.cpp
|
---|
1215 |
|
---|
1216 | DEFINES += HAVE_MODULES
|
---|
1217 |
|
---|
1218 | EOT
|
---|
1219 | }
|
---|
1220 |
|
---|
1221 | export PREFIX
|
---|
1222 | export BINDIR
|
---|
1223 | export DATADIR
|
---|
1224 | export EX_QTDIR
|
---|
1225 | export QC_WITH_QCA_INC
|
---|
1226 | export QC_WITH_QCA_LIB
|
---|
1227 | export QC_WITH_ZLIB_INC
|
---|
1228 | export QC_WITH_ZLIB_LIB
|
---|
1229 | export QC_DISABLE_growl
|
---|
1230 | export QC_WITH_GROWL
|
---|
1231 | export QC_DISABLE_xss
|
---|
1232 | export QC_DISABLE_dnotify
|
---|
1233 | export QC_DISABLE_ghbnr
|
---|
1234 | export QC_DEBUG
|
---|
1235 | rm -rf .qconftemp
|
---|
1236 | (
|
---|
1237 | mkdir .qconftemp
|
---|
1238 | gen_files .qconftemp
|
---|
1239 | cd .qconftemp
|
---|
1240 | $qm conf.pro >/dev/null
|
---|
1241 | QTDIR=$QTDIR make clean >/dev/null 2>&1
|
---|
1242 | QTDIR=$QTDIR make >../conf.log 2>&1
|
---|
1243 | )
|
---|
1244 |
|
---|
1245 | if [ "$?" != "0" ]; then
|
---|
1246 | rm -rf .qconftemp
|
---|
1247 | echo fail
|
---|
1248 | echo
|
---|
1249 | echo "There was an error compiling 'conf'. Be sure you have a proper"
|
---|
1250 | echo "Qt 3.x Multithreaded (MT) build environment set up. This"
|
---|
1251 | echo "means not just Qt, but also a C++ compiler, the 'make' command,"
|
---|
1252 | echo "and any other packages necessary to compile C++ programs."
|
---|
1253 | echo "See conf.log for details."
|
---|
1254 | if [ ! -f "$QTDIR/lib/libqt-mt.so.3" ]; then
|
---|
1255 | echo
|
---|
1256 | echo "One possible reason is that you don't have"
|
---|
1257 | echo "libqt-mt.so.3 installed in $QTDIR/lib/."
|
---|
1258 | fi
|
---|
1259 | echo
|
---|
1260 | exit 1;
|
---|
1261 | fi
|
---|
1262 |
|
---|
1263 | .qconftemp/conf
|
---|
1264 | ret="$?"
|
---|
1265 | if [ "$ret" = "1" ]; then
|
---|
1266 | rm -rf .qconftemp
|
---|
1267 | echo
|
---|
1268 | exit 1;
|
---|
1269 | else
|
---|
1270 | if [ "$ret" != "0" ]; then
|
---|
1271 | rm -rf .qconftemp
|
---|
1272 | echo fail
|
---|
1273 | echo
|
---|
1274 | echo "Unexpected error launching 'conf'"
|
---|
1275 | echo
|
---|
1276 | exit 1;
|
---|
1277 | fi
|
---|
1278 | fi
|
---|
1279 | rm -rf .qconftemp
|
---|
1280 |
|
---|
1281 | if [ -x "./qcextra" ]; then
|
---|
1282 | ./qcextra
|
---|
1283 | fi
|
---|
1284 | # run qmake
|
---|
1285 | $qm psi.pro
|
---|
1286 | if [ "$?" != "0" ]; then
|
---|
1287 | echo
|
---|
1288 | exit 1;
|
---|
1289 | fi
|
---|
1290 | cat >Makefile.tmp <<EOT
|
---|
1291 | export QTDIR = $QTDIR
|
---|
1292 | export PATH = $QTDIR/bin:$PATH
|
---|
1293 | EOT
|
---|
1294 | cat Makefile >> Makefile.tmp
|
---|
1295 | rm -f Makefile
|
---|
1296 | cp -f Makefile.tmp Makefile
|
---|
1297 | rm -f Makefile.tmp
|
---|
1298 |
|
---|
1299 | echo
|
---|
1300 | echo "Good, your configure finished. Now run 'make'."
|
---|
1301 | echo
|
---|