configure

Sun, 01 Oct 2023 12:53:35 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 01 Oct 2023 12:53:35 +0200
changeset 71
0bdb910478cc
child 72
7e58e0f74e50
permissions
-rwxr-xr-x

add uwproj configure script generator

71
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 #!/bin/sh
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 # create temporary directory
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 TEMP_DIR=".tmp-`uname -n`"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 rm -Rf "$TEMP_DIR"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 if mkdir -p "$TEMP_DIR"; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 :
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 else
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 echo "Cannot create tmp dir $TEMP_DIR"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 echo "Abort"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 exit 1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 touch "$TEMP_DIR/options"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 touch "$TEMP_DIR/features"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 # define standard variables
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 PREFIX=/usr
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 EPREFIX=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 BINDIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 SBINDIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 LIBDIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 LIBEXECDIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 DATADIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 SYSCONFDIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 SHAREDSTATEDIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 LOCALSTATEDIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 INCLUDEDIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 INFODIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 MANDIR=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
31 # custom variables
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32 BUILDDIR=`pwd`/build
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
33
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34 # features
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 # clean abort
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 abort_configure()
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38 {
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
39 rm -Rf "$TEMP_DIR"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
40 exit 1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41 }
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 # help text
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 printhelp()
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45 {
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46 echo "Usage: $0 [OPTIONS]..."
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47 cat << __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
48 Installation directories:
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
49 --prefix=PREFIX path prefix for architecture-independent files
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 [/usr]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
51 --exec-prefix=EPREFIX path prefix for architecture-dependent files
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52 [PREFIX]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
53
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
54 --bindir=DIR user executables [EPREFIX/bin]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
55 --sbindir=DIR system admin executables [EPREFIX/sbin]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56 --libexecdir=DIR program executables [EPREFIX/libexec]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57 --sysconfdir=DIR system configuration files [PREFIX/etc]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
58 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
59 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
60 --libdir=DIR object code libraries [EPREFIX/lib]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61 --includedir=DIR C header files [PREFIX/include]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
62 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
63 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
64 --infodir=DIR info documentation [DATAROOTDIR/info]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65 --mandir=DIR man documentation [DATAROOTDIR/man]
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68 }
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
69
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
70 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
71 # parse arguments
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
73 BUILD_TYPE="default"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
74 for ARG in "$@"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
75 do
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
76 case "$ARG" in
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
77 "--prefix="*) PREFIX=${ARG#--prefix=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
78 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
79 "--bindir="*) BINDIR=${ARG#----bindir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
80 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
81 "--libdir="*) LIBDIR=${ARG#--libdir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
82 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
83 "--datadir="*) DATADIR=${ARG#--datadir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
84 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
85 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
86 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
87 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
88 "--infodir="*) INFODIR=${ARG#--infodir=} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
89 "--mandir"*) MANDIR=${ARG#--mandir} ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
90 "--help"*) printhelp; abort_configure ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
91 "--debug") BUILD_TYPE="debug" ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
92 "--release") BUILD_TYPE="release" ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
93 "-"*) echo "unknown option: $ARG"; abort_configure ;;
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
94 esac
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
95 done
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
96
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
97
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
98 # set dir variables
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
99 : ${EPREFIX:="$PREFIX"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
100 : ${BINDIR:="$EPREFIX/bin"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
101 : ${SBINDIR:="$EPREFIX/sbin"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
102 : ${LIBDIR:="$EPREFIX/lib"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
103 : ${LIBEXECDIR:="$EPREFIX/libexec"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
104 : ${DATADIR:="$PREFIX/share"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
105 : ${SYSCONFDIR:="$PREFIX/etc"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
106 : ${SHAREDSTATEDIR:="$PREFIX/com"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
107 : ${LOCALSTATEDIR:="$PREFIX/var"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
108 : ${INCLUDEDIR:="$PREFIX/include"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
109 : ${INFODIR:="$PREFIX/info"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
110 : ${MANDIR:="$PREFIX/man"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
111
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
112 # Test for availability of pkg-config
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
113 PKG_CONFIG=`command -v pkg-config`
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
114 : ${PKG_CONFIG:="false"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
115
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
116 # Simple uname based platform detection
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
117 # $PLATFORM is used for platform dependent dependency selection
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
118 OS=`uname -s`
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
119 OS_VERSION=`uname -r`
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
120 printf "detect platform... "
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
121 if [ "$OS" = "SunOS" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
122 PLATFORM="solaris sunos unix svr4"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
123 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
124 if [ "$OS" = "Linux" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
125 PLATFORM="linux unix"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
126 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
127 if [ "$OS" = "FreeBSD" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
128 PLATFORM="freebsd bsd unix"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
129 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
130 if [ "$OS" = "Darwin" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
131 PLATFORM="macos osx bsd unix"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
132 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
133 if echo "$OS" | grep -i "MINGW" > /dev/null; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
134 PLATFORM="windows mingw"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
135 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
136 : ${PLATFORM:="unix"}
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
137
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
138 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
139 echo "$PLATFORM_NAME"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
140
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
141 isplatform()
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
142 {
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
143 for p in $PLATFORM
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
144 do
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
145 if [ "$p" = "$1" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
146 return 0
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
147 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
148 done
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
149 return 1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
150 }
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
151 notisplatform()
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
152 {
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
153 for p in $PLATFORM
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
154 do
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
155 if [ "$p" = "$1" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
156 return 1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
157 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
158 done
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
159 return 0
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
160 }
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
161
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
162
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
163 # generate vars.mk
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
164 cat > "$TEMP_DIR/vars.mk" << __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
165 PREFIX=$PREFIX
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
166 EPREFIX=$EPREFIX
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
167 BINDIR=$BINDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
168 SBINDIR=$SBINDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
169 LIBDIR=$LIBDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
170 LIBEXECDIR=$LIBEXECDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
171 DATADIR=$DATADIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
172 SYSCONFDIR=$SYSCONFDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
173 SHAREDSTATEDIR=$SHAREDSTATEDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
174 LOCALSTATEDIR=$LOCALSTATEDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
175 INCLUDEDIR=$INCLUDEDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
176 INFODIR=$INFODIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
177 MANDIR=$MANDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
178 BUILDDIR=$BUILDDIR
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
179 __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
180 sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
181
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
182
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
183 # toolchain detection utilities
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
184 . make/toolchain.sh
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
185
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
186 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
187 # DEPENDENCIES
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
188 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
189
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
190 # check languages
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
191 lang_c=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
192 lang_cpp=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
193 if detect_c_compiler ; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
194 lang_c=1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
195 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
196
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
197 # create buffer for make variables required by dependencies
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
198 echo > "$TEMP_DIR/make.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
199
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
200 test_pkg_config()
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
201 {
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
202 if "$PKG_CONFIG" --exists "$1" ; then :
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
203 else return 1 ; fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
204 if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
205 else return 1 ; fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
206 if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
207 else return 1 ; fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
208 if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
209 else return 1 ; fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
210 return 0
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
211 }
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
212
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
213 dependency_error_archiver()
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
214 {
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
215 printf "checking for archiver... "
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
216 # dependency archiver
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
217 while true
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
218 do
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
219 if command -v ar > /dev/null ; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
220 :
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
221 else
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
222 break
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
223 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
224 cat >> $TEMP_DIR/make.mk << __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
225 # Dependency: archiver
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
226 AR = ar
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
227 ARFLAGS = -r
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
228
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
229 __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
230 echo yes
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
231 return 1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
232 done
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
233
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
234 echo no
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
235 return 0
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
236 }
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
237 dependency_error_rmdir()
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
238 {
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
239 printf "checking for rmdir... "
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
240 # dependency rmdir
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
241 while true
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
242 do
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
243 if command -v rm > /dev/null ; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
244 :
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
245 else
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
246 break
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
247 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
248 cat >> $TEMP_DIR/make.mk << __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
249 # Dependency: rmdir
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
250 RM = rm
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
251 RMFLAGS = -f -R
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
252
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
253 __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
254 echo yes
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
255 return 1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
256 done
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
257
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
258 echo no
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
259 return 0
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
260 }
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
261 dependency_error_ncurses()
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
262 {
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
263 printf "checking for ncurses... "
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
264 # dependency ncurses
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
265 while true
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
266 do
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
267 if [ -z "$PKG_CONFIG" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
268 break
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
269 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
270 if test_pkg_config "ncursesw" "" "" "" ; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
271 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags ncursesw`"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
272 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs ncursesw`"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
273 else
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
274 break
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
275 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
276 echo yes
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
277 return 1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
278 done
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
279
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
280 echo no
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
281 return 0
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
282 }
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
283 dependency_error_mkdir()
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
284 {
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
285 printf "checking for mkdir... "
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
286 # dependency mkdir
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
287 while true
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
288 do
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
289 if command -v mkdir > /dev/null ; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
290 :
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
291 else
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
292 break
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
293 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
294 cat >> $TEMP_DIR/make.mk << __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
295 # Dependency: mkdir
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
296 MKDIR = mkdir
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
297 MKDIRFLAGS = -p
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
298
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
299 __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
300 echo yes
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
301 return 1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
302 done
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
303
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
304 echo no
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
305 return 0
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
306 }
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
307
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
308
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
309
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
310
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
311 # start collecting dependency information
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
312 echo > "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
313
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
314 DEPENDENCIES_FAILED=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
315 ERROR=0
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
316 # unnamed dependencies
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
317 TEMP_CFLAGS=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
318 TEMP_CXXFLAGS=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
319 TEMP_LDFLAGS=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
320 while true
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
321 do
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
322 while true
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
323 do
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
324 if [ -z "$lang_c" ] ; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
325 ERROR=1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
326 break
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
327 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
328
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
329 cat >> "$TEMP_DIR/make.mk" << __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
330 LIB_EXT = .a
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
331 OBJ_EXT = .o
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
332
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
333 __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
334 break
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
335 done
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
336 break
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
337 done
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
338
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
339 # add general dependency flags to flags.mk
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
340 echo "# general flags" >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
341 if [ -n "${TEMP_CFLAGS}" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
342 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
343 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
344 if [ -n "${TEMP_CXXFLAGS}" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
345 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
346 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
347 if [ -n "${TEMP_LDFLAGS}" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
348 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
349 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
350
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
351 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
352 # OPTION VALUES
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
353 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
354
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
355 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
356 # TARGETS
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
357 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
358
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
359 echo >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
360 # Target: default
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
361 echo "# flags for target default" >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
362 TEMP_CFLAGS=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
363 TEMP_CXXFLAGS=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
364 TEMP_LDFLAGS=
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
365
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
366 if dependency_error_archiver; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
367 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED archiver "
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
368 ERROR=1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
369 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
370 if dependency_error_rmdir; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
371 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED rmdir "
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
372 ERROR=1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
373 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
374 if dependency_error_ncurses; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
375 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ncurses "
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
376 ERROR=1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
377 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
378 if dependency_error_mkdir; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
379 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED mkdir "
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
380 ERROR=1
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
381 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
382
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
383 # Features
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
384
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
385
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
386 if [ -n "${TEMP_CFLAGS}" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
387 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
388 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
389 if [ -n "${TEMP_CXXFLAGS}" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
390 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
391 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
392 if [ "$BUILD_TYPE" = "debug" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
393 echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
394 echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
395 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
396 if [ "$BUILD_TYPE" = "release" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
397 echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
398 echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
399 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
400 if [ -n "${TEMP_LDFLAGS}" ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
401 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
402 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
403
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
404
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
405 # final result
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
406 if [ $ERROR -ne 0 ]; then
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
407 echo
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
408 echo "Error: Unresolved dependencies"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
409 echo "$DEPENDENCIES_FAILED"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
410 abort_configure
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
411 fi
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
412
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
413 echo "configure finished"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
414 echo
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
415 echo "Build Config:"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
416 echo " PREFIX: $PREFIX"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
417 echo " TOOLCHAIN: $TOOLCHAIN_NAME"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
418 echo
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
419
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
420 # generate the config.mk file
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
421 cat > "$TEMP_DIR/config.mk" << __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
422 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
423 # config.mk generated by configure
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
424 #
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
425
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
426 __EOF__
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
427 write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
428 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
429 rm -Rf "$TEMP_DIR"
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
430
0bdb910478cc add uwproj configure script generator
Mike Becker <universe@uap-core.de>
parents:
diff changeset
431

mercurial