File: configure

package info (click to toggle)
webissues 1.1.5-10
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 17,108 kB
  • sloc: ansic: 97,819; cpp: 33,773; javascript: 1,171; xml: 465; sh: 378; makefile: 17
file content (166 lines) | stat: -rwxr-xr-x 3,402 bytes parent folder | download | duplicates (4)
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
#! /bin/sh

prefix=/usr/local
destdir=
config=release
QMAKE=
syssqlite=no
mac=no
universal=no
target=10.3
sdk=/Developer/SDKs/MacOSX10.6.sdk

usage="Usage: configure [-prefix DIR] [-destdir DIR] [-qmake PATH] [-debug]
                 [-system-sqlite] [-universal] [-target VERSION] [-sdk PATH]

General options:

  -prefix DIR    Set the instalation prefix to DIR (default: /usr/local)
  -destdir DIR   Set the destination path to DIR
  -qmake PATH    Full path to the 'qmake' program (default: autodetect)
  -debug         Build with debugging symbols
  -system-sqlite Use system SQLite library

OS X options:

  -universal     Build for x86_64, x86 and PPC platforms
  -target        Set OS X deployment target (default: 10.3)
  -sdk           Set OS X SDK (default: /Developer/SDKs/MacOSX10.6.sdk)
"

if test ! -f ./webissues.pro; then
  echo "*** ERROR: Cannot find project file in current directory." >&2
  exit 1
fi

while test $# -gt 0; do
  case $1 in
    -prefix )
      prefix=$2
      shift ; shift
      ;;
    -destdir )
      destdir=$2
      shift ; shift
      ;;
    -qmake )
      QMAKE=$2
      shift; shift
      ;;
    -debug )
      config=debug
      shift
      ;;
    -system-sqlite )
      syssqlite=yes
      shift
      ;;
    -universal )
      universal=yes
      mac=yes
      shift
      ;;
    -target )
      target=$2
      mac=yes
      shift ; shift
      ;;
    -sdk )
      sdk=$2
      mac=yes
      shift ; shift
      ;;
    -help | --help )
      echo "$usage"
      exit
      ;;
    * )
      echo "*** ERROR: Unrecognized option '$1'" >&2
      echo "$usage"
      exit 1
      ;;
  esac
done

echo "Testing for qmake..."

paths=

if test -n "$QMAKE"; then
  if test -x "$QMAKE"; then
    paths=$QMAKE
  else
    echo "*** ERROR: '$QMAKE' is not an executable program." >&2
    exit 1
  fi
else
  for i in qmake qmake-qt4; do
    if which $i >/dev/null 2>/dev/null; then
      paths="$paths `which $i`"
    fi
    if test -n "$QTDIR"; then
      if test -x "$QTDIR/bin/$i"; then
        paths="$paths $QTDIR/bin/$i"
      fi
    fi
  done
fi

if test -z "$paths"; then
  echo "*** ERROR: Cannot find 'qmake' in your PATH." >&2
  exit 1
fi

QMAKE=

for i in $paths; do
  version=`$i -query QT_VERSION`
  if test "$version" != "**Unknown**"; then
    major=`echo $version | cut -d . -f 1`
    minor=`echo $version | cut -d . -f 2`
    patch=`echo $version | cut -d . -f 3`
    if test "$major" -eq 5; then
      QMAKE=$i
      break
    fi
  fi
done

if test -z "$QMAKE"; then
  echo "*** ERROR: Cannot find 'qmake' from Qt 5." >&2
  exit 1
fi

echo "Using $QMAKE (Qt $version)"

echo "Writing configuration file..."

echo "# this file was generated by configure" >config.pri
echo "CONFIG += $config" >>config.pri
echo "PREFIX = $prefix" >>config.pri
echo "DESTINATION = $destdir" >>config.pri

if test "$syssqlite" = "yes"; then
  echo "CONFIG += system-sqlite" >>config.pri
fi

if test "$mac" = "yes"; then
  echo "mac {" >>config.pri
  echo "    QMAKE_MACOSX_DEPLOYMENT_TARGET = $target" >>config.pri
  echo "    QMAKE_MAC_SDK = $sdk" >>config.pri
  if test "$universal" = "yes"; then
    echo "    CONFIG += x86_64 x86 ppc" >>config.pri
  fi
  echo "}" >>config.pri
fi

echo "Generating Makefiles..."

if $QMAKE -recursive; then
  echo
  echo "Configure finished. Run 'make' now."
  echo
else
  echo "*** ERROR: Running 'qmake' failed." >&2
  exit 1
fi