5
Usage: ./configure [OPTION]...
7
This script creates necessary configuration files to build/install.
10
--prefix=[path] Base path for build/install. Default: /usr/local
11
--bindir=[path] Directory for binaries. Default: PREFIX/bin
12
--qtdir=[path] Directory where Qt is installed.
13
--debug Enable debug output.
14
--help This help text.
19
while [ $# -gt 0 ]; do
22
PREFIX="${1#--prefix=}"
27
BINDIR="${1#--bindir=}"
40
--help) show_usage; exit ;;
41
*) show_usage; exit ;;
45
PREFIX=${PREFIX:-/usr/local}
46
BINDIR=${BINDIR:-$PREFIX/bin}
48
echo "Configuring Iris Conntest ..."
50
if [ "$QC_DEBUG" = "Y" ]; then
58
printf "Verifying Qt 3.x Multithreaded (MT) build environment ... "
60
if [ -z "$QTDIR" ]; then
61
if [ "$QC_DEBUG" = "Y" ]; then
62
echo \$QTDIR not set... trying to find Qt manually
64
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
65
if [ -d "$p/mkspecs" ]; then
70
if [ -z "$QTDIR" ]; then
73
echo "Unable to find Qt 'mkspecs'. Perhaps you need to"
74
echo "install the Qt 3 development utilities. You may download"
75
echo "them either from the vendor of your operating system"
76
echo "or from http://www.trolltech.com/"
78
echo "If you're sure you have the Qt development utilities"
79
echo "installed, you might try using the --qtdir option."
83
if [ ! -x "$QTDIR/bin/moc" ]; then
84
m=`which moc 2>/dev/null`
85
if [ ! -x "$m" ]; then
88
echo "We found Qt in $QTDIR, but we were unable to locate"
89
echo "the moc utility. It was not found in $QTDIR/bin"
90
echo "nor in PATH. This seems to be a very unusual setup."
91
echo "You might try using the --qtdir option."
95
qtpre=`echo $m | awk '{ n = index($0, "/bin/moc"); if (!n) { exit 1; } print substr($0, 0, n-1); exit 0; }' 2>/dev/null`
97
if [ "$ret" != "0" ]; then
100
echo "We found Qt in $QTDIR, but the location of moc"
101
echo "($m) is not suitable for use with this build system."
102
echo "This is a VERY unusual and likely-broken setup. You"
103
echo "should contact the maintainer of your Qt package."
111
if [ ! -x "$QTDIR/bin/qmake" ]; then
112
if [ "$QC_DEBUG" = "Y" ]; then
113
echo Warning: qmake not in \$QTDIR/bin/qmake
114
echo trying to find it in \$PATH
116
qm=`which qmake 2>/dev/null`
117
if [ -x "$qm" ]; then
118
if [ "$QC_DEBUG" = "Y" ]; then
119
echo qmake found in $qm
124
echo Sorry, you seem to have a very unusual setup,
125
echo or I missdetected \$QTDIR=$QTDIR
127
echo Please set \$QTDIR manually and make sure that
128
echo \$QTDIR/bin/qmake exists.
137
cat >$1/modules.cpp <<EOT
140
cat >$1/modules_new.cpp <<EOT
143
cat >$1/conf.cpp <<EOT
149
#include<qfileinfo.h>
152
#include<qstringlist.h>
155
class MocTestObject : public QObject
170
virtual QString name() const=0;
171
virtual QString shortname() const=0;
172
virtual QString checkString() const;
173
virtual QString resultString() const;
174
virtual bool exec()=0;
181
typedef QPtrList<ConfObj> ConfObjList;
182
typedef QPtrListIterator<ConfObj> ConfObjListIt;
189
list.setAutoDelete(true);
190
vars.setAutoDelete(true);
192
vars.insert("QMAKE_INCDIR_X11", new QString(X11_INC));
193
vars.insert("QMAKE_LIBDIR_X11", new QString(X11_LIBDIR));
194
vars.insert("QMAKE_LIBS_X11", new QString(X11_LIB));
195
vars.insert("QMAKE_CC", new QString(CC));
205
void added(ConfObj *o)
210
QString getenv(const QString &var)
212
char *p = ::getenv(var.latin1());
214
return QString::null;
218
void debug(const QString &s)
224
printf(" * %s\n", s.latin1());
230
if(getenv("QC_DEBUG") == "Y")
233
ConfObjListIt it(list);
234
for(ConfObj *o; (o = it.current()); ++it) {
235
// if this was a disabled-by-default option, check if it was enabled
237
QString v = QString("QC_ENABLE_") + o->shortname();
243
QString v = QString("QC_DISABLE_") + o->shortname();
248
QString check = o->checkString();
250
check = QString("Checking for %1 ...").arg(o->name());
251
printf("%s", check.latin1());
257
QString result = o->resultString();
258
if(result.isEmpty()) {
265
printf(" -> %s\n", result.latin1());
267
printf(" %s\n", result.latin1());
269
if(!ok && o->required) {
270
printf("\nError: need %s!\n", o->name().latin1());
277
const QString & qvar(const QString &s)
279
QString *p = vars.find(s);
286
QString expandIncludes(const QString &inc)
288
return QString("-I") + inc;
291
QString expandLibs(const QString &lib)
293
return QString("-L") + lib;
296
int doCommand(const QString &s)
298
debug(QString("[%1]").arg(s));
303
fullcmd = s + " 1>/dev/null 2>/dev/null";
304
int r = system(fullcmd.latin1());
305
debug(QString("returned: %1").arg(r));
309
bool doCompileAndLink(const QString &filedata, const QString &flags, int *retcode=0)
312
QString fname = "atest.c";
313
QString out = "atest";
315
QCString cs = filedata.latin1();
316
if(!f.open(IO_WriteOnly | IO_Truncate)) {
317
debug("unable to open atest.c for writing");
320
if(f.writeBlock(cs.data(), cs.length()) == -1) {
321
debug("error writing to atest.c");
326
debug(QString("Wrote atest.c:\n%1").arg(filedata));
328
QString str = qvar("QMAKE_CC") + ' ' + fname + " -o " + out;
329
if(!flags.isEmpty()) {
334
int r = doCommand(str);
335
if(r == 0 && retcode)
336
*retcode = doCommand(QString("./") + out);
344
bool checkHeader(const QString &path, const QString &h)
346
QFileInfo fi(path + '/' + h);
352
bool findHeader(const QString &h, const QStringList &ext, QString *inc)
354
if(checkHeader("/usr/include", h)) {
359
dirs += "/usr/local/include";
361
for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) {
362
if(checkHeader(*it, h)) {
370
bool checkLibrary(const QString &path, const QString &name)
380
extra += QString("-L") + path + ' ';
381
extra += QString("-l") + name;
382
if(!doCompileAndLink(str, extra))
387
bool findLibrary(const QString &name, QString *lib)
389
if(checkLibrary("", name)) {
393
if(checkLibrary("/usr/local/lib", name)) {
394
*lib = "/usr/local/lib";
400
void addDefine(const QString &str)
402
if(DEFINES.isEmpty())
405
DEFINES += QString(" ") + str;
406
debug(QString("DEFINES += %1").arg(str));
409
void addLib(const QString &str)
414
LIBS += QString(" ") + str;
415
debug(QString("LIBS += %1").arg(str));
418
void addIncludePath(const QString &str)
420
if(INCLUDEPATH.isEmpty())
423
INCLUDEPATH += QString(" ") + str;
424
debug(QString("INCLUDEPATH += %1").arg(str));
427
void addExtra(const QString &str)
430
debug(QString("extra += %1").arg(str));
442
bool do_debug, done_debug;
445
ConfObj::ConfObj(Conf *c)
457
QString ConfObj::checkString() const
462
QString ConfObj::resultString() const
467
#include"modules.cpp"
469
//----------------------------------------------------------------------------
471
//----------------------------------------------------------------------------
474
Conf *conf = new Conf;
477
#include"modules_new.cpp"
480
bool success = false;
483
if(!f.open(IO_WriteOnly | IO_Truncate)) {
484
printf("Error writing %s\n", f.name().latin1());
490
str += "QT_PATH_PLUGINS = " + QString(qInstallPathPlugins()) + '\n';
491
if(!conf->DEFINES.isEmpty())
492
str += "DEFINES += " + conf->DEFINES + '\n';
493
if(!conf->INCLUDEPATH.isEmpty())
494
str += "INCLUDEPATH += " + conf->INCLUDEPATH + '\n';
495
if(!conf->LIBS.isEmpty())
496
str += "LIBS += " + conf->LIBS + '\n';
497
if(!conf->extra.isEmpty())
501
char *p = getenv("BINDIR");
503
str += QString("target.path = ") + p + '\n';
504
str += "INSTALLS += target\n";
507
QCString cs = str.latin1();
508
f.writeBlock(cs.data(), cs.length());
524
cat >$1/conf.pro <<EOT
526
CONFIG += qt x11 thread console
529
DEFINES += X11_INC='"\$\$QMAKE_INCDIR_X11"'
530
DEFINES += X11_LIBDIR='"\$\$QMAKE_LIBDIR_X11"'
531
DEFINES += X11_LIB='"\$\$QMAKE_LIBS_X11"'
532
DEFINES += CC='"\$\$QMAKE_CC"'
548
$qm conf.pro >/dev/null
549
QTDIR=$QTDIR make clean >/dev/null 2>&1
550
QTDIR=$QTDIR make >../conf.log 2>&1
553
if [ "$?" != "0" ]; then
557
echo "There was an error compiling 'conf'. Be sure you have a proper"
558
echo "Qt 3.x Multithreaded (MT) build environment set up. This"
559
echo "means not just Qt, but also a C++ compiler, the 'make' command,"
560
echo "and any other packages necessary to compile C++ programs."
561
echo "See conf.log for details."
562
if [ ! -f "$QTDIR/lib/libqt-mt.so.3" ]; then
564
echo "One possible reason is that you don't have"
565
echo "libqt-mt.so.3 installed in $QTDIR/lib/."
573
if [ "$ret" = "1" ]; then
578
if [ "$ret" != "0" ]; then
582
echo Unexpected error launching 'conf'
589
if [ -x "./qcextra" ]; then
594
if [ "$?" != "0" ]; then
598
cat >Makefile.tmp <<EOT
599
export QTDIR = $QTDIR
600
export PATH = $QTDIR/bin:$PATH
602
cat Makefile >> Makefile.tmp
604
cp -f Makefile.tmp Makefile
608
echo Good, your configure finished. Now run \'make\'.