configure

Fri, 22 Sep 2023 23:26:23 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 22 Sep 2023 23:26:23 +0200
changeset 68
ae763178ee1e
child 74
ed9a5ffd1f13
permissions
-rwxr-xr-x

replace autoconf with uwproj

68
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 #!/bin/sh
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 # create temporary directory
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 TEMP_DIR=".tmp-`uname -n`"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 rm -Rf "$TEMP_DIR"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 if mkdir -p "$TEMP_DIR"; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 :
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 else
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 echo "Cannot create tmp dir $TEMP_DIR"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 echo "Abort"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 exit 1
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 touch "$TEMP_DIR/options"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 touch "$TEMP_DIR/features"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 # define standard variables
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 PREFIX=/usr
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 EPREFIX=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 BINDIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 SBINDIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 LIBDIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 LIBEXECDIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 DATADIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 SYSCONFDIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 SHAREDSTATEDIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 LOCALSTATEDIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 INCLUDEDIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 INFODIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 MANDIR=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
31 # custom variables
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
33 # features
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 # clean abort
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 abort_configure()
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 {
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38 rm -Rf "$TEMP_DIR"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
39 exit 1
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
40 }
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42 # help text
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 printhelp()
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 {
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45 echo "Usage: $0 [OPTIONS]..."
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46 cat << __EOF__
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47 Installation directories:
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
48 --prefix=PREFIX path prefix for architecture-independent files
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
49 [/usr]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 --exec-prefix=EPREFIX path prefix for architecture-dependent files
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
51 [PREFIX]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
53 --bindir=DIR user executables [EPREFIX/bin]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
54 --sbindir=DIR system admin executables [EPREFIX/sbin]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
55 --libexecdir=DIR program executables [EPREFIX/libexec]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56 --sysconfdir=DIR system configuration files [PREFIX/etc]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
58 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
59 --libdir=DIR object code libraries [EPREFIX/lib]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
60 --includedir=DIR C header files [PREFIX/include]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
62 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
63 --infodir=DIR info documentation [DATAROOTDIR/info]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
64 --mandir=DIR man documentation [DATAROOTDIR/man]
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66 __EOF__
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 }
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
69 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
70 # parse arguments
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
71 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72 BUILD_TYPE="default"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
73 for ARG in "$@"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
74 do
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
75 case "$ARG" in
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
76 "--prefix="*) PREFIX=${ARG#--prefix=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
77 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
78 "--bindir="*) BINDIR=${ARG#----bindir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
79 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
80 "--libdir="*) LIBDIR=${ARG#--libdir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
81 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
82 "--datadir="*) DATADIR=${ARG#--datadir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
83 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
84 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
85 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
86 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
87 "--infodir="*) INFODIR=${ARG#--infodir=} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
88 "--mandir"*) MANDIR=${ARG#--mandir} ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
89 "--help"*) printhelp; abort_configure ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
90 "--debug") BUILD_TYPE="debug" ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
91 "--release") BUILD_TYPE="release" ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
92 "-"*) echo "unknown option: $ARG"; abort_configure ;;
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
93 esac
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
94 done
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
95
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
96
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
97 # set dir variables
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
98 : ${EPREFIX:="$PREFIX"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
99 : ${BINDIR:="$EPREFIX/bin"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
100 : ${SBINDIR:="$EPREFIX/sbin"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
101 : ${LIBDIR:="$EPREFIX/lib"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
102 : ${LIBEXECDIR:="$EPREFIX/libexec"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
103 : ${DATADIR:="$PREFIX/share"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
104 : ${SYSCONFDIR:="$PREFIX/etc"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
105 : ${SHAREDSTATEDIR:="$PREFIX/com"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
106 : ${LOCALSTATEDIR:="$PREFIX/var"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
107 : ${INCLUDEDIR:="$PREFIX/include"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
108 : ${INFODIR:="$PREFIX/info"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
109 : ${MANDIR:="$PREFIX/man"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
110
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
111 # Test for availability of pkg-config
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
112 PKG_CONFIG=`command -v pkg-config`
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
113 : ${PKG_CONFIG:="false"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
114
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
115 # Simple uname based platform detection
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
116 # $PLATFORM is used for platform dependent dependency selection
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
117 OS=`uname -s`
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
118 OS_VERSION=`uname -r`
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
119 printf "detect platform... "
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
120 if [ "$OS" = "SunOS" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
121 PLATFORM="solaris sunos unix svr4"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
122 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
123 if [ "$OS" = "Linux" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
124 PLATFORM="linux unix"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
125 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
126 if [ "$OS" = "FreeBSD" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
127 PLATFORM="freebsd bsd unix"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
128 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
129 if [ "$OS" = "Darwin" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
130 PLATFORM="macos osx bsd unix"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
131 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
132 if echo "$OS" | grep -i "MINGW" > /dev/null; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
133 PLATFORM="windows mingw"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
134 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
135 : ${PLATFORM:="unix"}
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
136
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
137 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
138 echo "$PLATFORM_NAME"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
139
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
140 isplatform()
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
141 {
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
142 for p in $PLATFORM
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
143 do
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
144 if [ "$p" = "$1" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
145 return 0
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
146 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
147 done
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
148 return 1
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
149 }
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
150 notisplatform()
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
151 {
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
152 for p in $PLATFORM
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
153 do
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
154 if [ "$p" = "$1" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
155 return 1
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
156 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
157 done
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
158 return 0
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
159 }
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
160
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
161
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
162 # generate vars.mk
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
163 cat > "$TEMP_DIR/vars.mk" << __EOF__
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
164 PREFIX=$PREFIX
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
165 EPREFIX=$EPREFIX
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
166 BINDIR=$BINDIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
167 SBINDIR=$SBINDIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
168 LIBDIR=$LIBDIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
169 LIBEXECDIR=$LIBEXECDIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
170 DATADIR=$DATADIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
171 SYSCONFDIR=$SYSCONFDIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
172 SHAREDSTATEDIR=$SHAREDSTATEDIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
173 LOCALSTATEDIR=$LOCALSTATEDIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
174 INCLUDEDIR=$INCLUDEDIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
175 INFODIR=$INFODIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
176 MANDIR=$MANDIR
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
177 __EOF__
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
178 sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
179
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
180
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
181 # toolchain detection utilities
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
182 . make/toolchain.sh
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
183
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
184 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
185 # DEPENDENCIES
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
186 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
187
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
188 # check languages
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
189 lang_c=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
190 lang_cpp=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
191 if detect_c_compiler ; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
192 lang_c=1
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
193 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
194
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
195 # create buffer for make variables required by dependencies
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
196 echo > "$TEMP_DIR/make.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
197
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
198 test_pkg_config()
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
199 {
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
200 if "$PKG_CONFIG" --exists "$1" ; then :
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
201 else return 1 ; fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
202 if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
203 else return 1 ; fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
204 if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
205 else return 1 ; fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
206 if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
207 else return 1 ; fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
208 return 0
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
209 }
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
210
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
211
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
212
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
213
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
214
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
215 # start collecting dependency information
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
216 echo > "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
217
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
218 DEPENDENCIES_FAILED=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
219 ERROR=0
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
220 # unnamed dependencies
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
221 TEMP_CFLAGS=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
222 TEMP_CXXFLAGS=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
223 TEMP_LDFLAGS=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
224 while true
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
225 do
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
226 while true
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
227 do
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
228 if [ -z "$lang_c" ] ; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
229 ERROR=1
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
230 break
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
231 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
232
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
233 break
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
234 done
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
235 break
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
236 done
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
237
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
238 # add general dependency flags to flags.mk
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
239 echo "# general flags" >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
240 if [ -n "${TEMP_CFLAGS}" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
241 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
242 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
243 if [ -n "${TEMP_CXXFLAGS}" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
244 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
245 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
246 if [ -n "${TEMP_LDFLAGS}" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
247 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
248 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
249
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
250 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
251 # OPTION VALUES
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
252 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
253
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
254 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
255 # TARGETS
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
256 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
257
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
258 echo >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
259 # Target: default
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
260 echo "# flags for target default" >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
261 TEMP_CFLAGS=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
262 TEMP_CXXFLAGS=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
263 TEMP_LDFLAGS=
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
264
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
265
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
266 # Features
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
267
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
268
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
269 if [ -n "${TEMP_CFLAGS}" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
270 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
271 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
272 if [ -n "${TEMP_CXXFLAGS}" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
273 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
274 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
275 if [ "$BUILD_TYPE" = "debug" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
276 echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
277 echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
278 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
279 if [ "$BUILD_TYPE" = "release" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
280 echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
281 echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
282 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
283 if [ -n "${TEMP_LDFLAGS}" ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
284 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
285 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
286
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
287
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
288 # final result
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
289 if [ $ERROR -ne 0 ]; then
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
290 echo
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
291 echo "Error: Unresolved dependencies"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
292 echo "$DEPENDENCIES_FAILED"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
293 abort_configure
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
294 fi
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
295
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
296 echo "configure finished"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
297 echo
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
298 echo "Build Config:"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
299 echo " PREFIX: $PREFIX"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
300 echo " TOOLCHAIN: $TOOLCHAIN_NAME"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
301 echo
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
302
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
303 # generate the config.mk file
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
304 cat > "$TEMP_DIR/config.mk" << __EOF__
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
305 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
306 # config.mk generated by configure
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
307 #
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
308
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
309 __EOF__
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
310 write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
311 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
312 rm -Rf "$TEMP_DIR"
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
313
ae763178ee1e replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
314

mercurial