10 if uname -a | grep -iq Darwin; then
11 DEFAULT_LIBS="/Library/Frameworks"
12 QMAKE_PARAMS="-spec macx-g++"
14 DEFAULT_LIBS="PREFIX/lib"
18 # the directory of this script (the root)
19 PROJECT_ROOT=`dirname $0`
20 PROJECT_ROOT=`(cd "$relpath"; /bin/pwd)`
21 TESTDIR=$PROJECT_ROOT/config.tests
22 CONFIG_LOG=$PROJECT_ROOT/config.log
24 # Define some colors for neat output
29 C_NONE='\e[0m' # No Color
31 #====parse configure options====
33 echo "QXT_stability += unknown" > config.in
35 while (( $# > 0 )); do
36 if [ $1 == "-qmake-bin" ]; then
38 elif [ $1 == "-bootstrap" ]; then
39 echo "CONFIG += bootstrap" >> config.in; shift
40 elif [ $1 == "-nomake" ]; then
41 echo "QXT_BUILD -= $2" >> config.in; shift
42 elif [ $1 == "-prefix" ]; then
43 echo "QXTINSTALLDIR = $2" >> config.in; shift
44 elif [ $1 == "-libdir" ]; then
45 echo "target.path = $2" >> config.in; shift
46 elif [ $1 == "-docdir" ]; then
47 echo "docs.path = $2" >> config.in; shift
48 elif [ $1 == "-headerdir" ]; then
49 echo "include.path = $2" >> config.in; shift
50 elif [ $1 == "-bindir" ]; then
51 echo "bin.path = $2" >> config.in; shift
52 elif [ $1 == "-static" ]; then
53 echo "CONFIG += static staticlib" >> config.in
54 elif [ $1 == "-debug" ]; then
55 echo "CONFIG += debug" >> config.in
56 elif [ $1 == "-release" ]; then
57 echo "CONFIG += release" >> config.in
58 elif [ $1 == "-no-openssl" ]; then
59 echo "QXT_LIBS -= openssl" >> config.in
61 elif [ $1 == "-help" ] || [ $1 == "--help" ]; then
62 echo "Usage: configure [-prefix <dir>] [-libdir <dir>] [-docdir <dir>]"
63 echo " [-bindir <dir>] [-headerdir <dir>] [-qmake-bin <path>]"
64 echo " [-static] [-debug] [-release] [-no-openssl] [-nomake <module>]"
66 echo "Installation options:"
68 echo "-prefix <dir> ....... This will install everything relative to <dir>"
69 echo " default: /usr/local/Qxt"
70 echo "-libdir <dir> ....... Libraries will be installed to <dir>"
71 echo " default: $DEFAULT_LIBS"
72 echo "-docdir <dir> ....... Documentation will be installed to <dir>"
73 echo " default: PREFIX/share/doc"
74 echo "-bindir <dir> ....... Executables will be installed to <dir>"
75 echo " default: PREFIX/bin"
76 echo "-headerdir <dir> .... Include files will be installed to <dir>"
77 echo " default: PREFIX/include"
78 echo "-qmake-bin <path> ... Specifies the path to the qmake executable"
79 echo " default: search the system path"
80 echo "-static ............. Compile Qxt as a static library"
81 echo "-debug .............. Build Qxt with debugging symbols"
82 echo "-release ............ Build Qxt without debugging support"
83 echo "-no-openssl ......... Do not link to OpenSSL"
84 echo "-nomake <module> .... Do not compile the specified module"
85 echo " options: network gui sql media web designer"
86 echo "-bootstrap .......... That should not be needed for release versions."
87 echo " warning: will only work on bash > 3.2"
92 echo "Unrecognized configure option: $1"
99 #====begin some autodetection====
103 if ! $WHICH $QMAKE_BIN >>$CONFIG_LOG 2>&1; then
104 echo >&2 "You don't seem to have 'qmake' in your PATH."
105 echo >&2 "Cannot proceed."
109 # find a make command
110 if [ -z "$MAKE" ]; then
112 for mk in gmake make; do
113 if "$WHICH" $mk | grep -qv "no "; then
118 if [ -z "$MAKE" ]; then
119 echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
120 echo >&2 "Cannot proceed."
127 echo -en "checking for $1\t"
128 echo -e " \n\n $1\n" >>$CONFIG_LOG
130 $QMAKE_BIN $QMAKE_PARAMS >>$CONFIG_LOG 2>&1
132 $MAKE clean >>$CONFIG_LOG 2>&1
133 [ -f ./$1 ] && rm ./$1
135 $MAKE >>$CONFIG_LOG 2>&1
137 if ./$1 >>$CONFIG_LOG 2>&1; then
138 echo -e >&2 " [${C_GREEN}success${C_NONE}] "
139 echo "DEFINES+=HAVE_$2">>$PROJECT_ROOT/config.in
141 echo -e >&2 " [${C_RED}failure${C_NONE}] "
146 if [[ "$NO_OPENSSL" == "0" ]]; then
147 configtest openssl OPENSSL
149 #configtest curses CURSES
153 #====finaly running qmake====
154 echo "autodetection finished. running qmake."
157 [ -f config.pri ] && mv config.pri config.pri.bak
158 mv config.in config.pri
160 $QMAKE_BIN $QMAKE_PARAMS -recursive 2>>$CONFIG_LOG
162 echo -e >&2 "${C_CYAN}configure finished. run $MAKE now.${C_NONE}\n"