47 --sbindir=DIR system admin executables [EPREFIX/sbin] |
61 --sbindir=DIR system admin executables [EPREFIX/sbin] |
48 --libexecdir=DIR program executables [EPREFIX/libexec] |
62 --libexecdir=DIR program executables [EPREFIX/libexec] |
49 --sysconfdir=DIR system configuration files [PREFIX/etc] |
63 --sysconfdir=DIR system configuration files [PREFIX/etc] |
50 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
64 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
51 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
65 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
66 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
52 --libdir=DIR object code libraries [EPREFIX/lib] |
67 --libdir=DIR object code libraries [EPREFIX/lib] |
53 --includedir=DIR C header files [PREFIX/include] |
68 --includedir=DIR C header files [PREFIX/include] |
54 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
69 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
55 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
70 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
56 --infodir=DIR info documentation [DATAROOTDIR/info] |
71 --infodir=DIR info documentation [DATAROOTDIR/info] |
57 --mandir=DIR man documentation [DATAROOTDIR/man] |
72 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
73 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
58 |
74 |
59 Optional Features: |
75 Optional Features: |
60 --enable-postgresql |
76 --enable-postgresql |
61 |
77 |
62 __EOF__ |
78 __EOF__ |
63 } |
79 } |
64 |
80 |
65 # |
81 # |
66 # parse arguments |
82 # parse arguments |
67 # |
83 # |
|
84 BUILD_TYPE="default" |
68 for ARG in "$@" |
85 for ARG in "$@" |
69 do |
86 do |
70 case "$ARG" in |
87 case "$ARG" in |
71 "--prefix="*) PREFIX=${ARG#--prefix=} ;; |
88 "--prefix="*) prefix=${ARG#--prefix=} ;; |
72 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;; |
89 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; |
73 "--bindir="*) BINDIR=${ARG#----bindir=} ;; |
90 "--bindir="*) bindir=${ARG#----bindir=} ;; |
74 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;; |
91 "--sbindir="*) sbindir=${ARG#--sbindir=} ;; |
75 "--libdir="*) LIBDIR=${ARG#--libdir=} ;; |
92 "--libdir="*) libdir=${ARG#--libdir=} ;; |
76 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;; |
93 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; |
77 "--datadir="*) DATADIR=${ARG#--datadir=} ;; |
94 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; |
78 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;; |
95 "--datadir="*) datadir=${ARG#--datadir=} ;; |
79 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; |
96 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; |
80 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; |
97 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; |
81 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; |
98 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; |
82 "--infodir="*) INFODIR=${ARG#--infodir=} ;; |
99 "--includedir="*) includedir=${ARG#--includedir=} ;; |
83 "--mandir"*) MANDIR=${ARG#--mandir} ;; |
100 "--infodir="*) infodir=${ARG#--infodir=} ;; |
84 "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; |
101 "--mandir"*) mandir=${ARG#--mandir} ;; |
|
102 "--localedir"*) localedir=${ARG#--localedir} ;; |
|
103 "--help"*) printhelp; abort_configure ;; |
|
104 "--debug") BUILD_TYPE="debug" ;; |
|
105 "--release") BUILD_TYPE="release" ;; |
85 "--enable-postgresql") FEATURE_POSTGRESQL=on ;; |
106 "--enable-postgresql") FEATURE_POSTGRESQL=on ;; |
86 "--disable-postgresql") unset FEATURE_POSTGRESQL ;; |
107 "--disable-postgresql") unset FEATURE_POSTGRESQL ;; |
87 "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;; |
108 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
88 esac |
109 esac |
89 done |
110 done |
90 |
111 |
91 # set dir variables |
112 |
92 if [ -z "$BINDIR" ]; then |
113 |
93 BINDIR=$EPREFIX/bin |
114 # set defaults for dir variables |
94 fi |
115 : ${exec_prefix:="$prefix"} |
95 if [ -z "$SBINDIR" ]; then |
116 : ${bindir:='${exec_prefix}/bin'} |
96 SBINDIR=$EPREFIX/sbin |
117 : ${sbindir:='${exec_prefix}/sbin'} |
97 fi |
118 : ${libdir:='${exec_prefix}/lib'} |
98 if [ -z "$LIBDIR" ]; then |
119 : ${libexecdir:='${exec_prefix}/libexec'} |
99 LIBDIR=$EPREFIX/lib |
120 : ${datarootdir:='${prefix}/share'} |
100 fi |
121 : ${datadir:='${datarootdir}'} |
101 if [ -z "$LIBEXEC" ]; then |
122 : ${sysconfdir:='${prefix}/etc'} |
102 LIBEXECDIR=$EPREFIX/libexec |
123 : ${sharedstatedir:='${prefix}/com'} |
103 fi |
124 : ${localstatedir:='${prefix}/var'} |
104 if [ -z "$DATADIR" ]; then |
125 : ${runstatedir:='${localstatedir}/run'} |
105 DATADIR=$PREFIX/share |
126 : ${includedir:='${prefix}/include'} |
106 fi |
127 : ${infodir:='${datarootdir}/info'} |
107 if [ -z "$SYSCONFDIR" ]; then |
128 : ${mandir:='${datarootdir}/man'} |
108 SYSCONFDIR=$PREFIX/etc |
129 : ${localedir:='${datarootdir}/locale'} |
109 fi |
130 |
110 if [ -z "$SHAREDSTATEDIR" ]; then |
131 # check if a config.site exists and load it |
111 SHAREDSTATEDIR=$PREFIX/com |
132 if [ -n "$CONFIG_SITE" ]; then |
112 fi |
133 # CONFIG_SITE may contain space separated file names |
113 if [ -z "$LOCALSTATEDIR" ]; then |
134 for cs in $CONFIG_SITE; do |
114 LOCALSTATEDIR=$PREFIX/var |
135 printf "loading defaults from $cs... " |
115 fi |
136 . "$cs" |
116 if [ -z "$INCLUDEDIR" ]; then |
137 echo ok |
117 INCLUDEDIR=$PREFIX/include |
138 done |
118 fi |
139 elif [ -f "$prefix/share/config.site" ]; then |
119 if [ -z "$INFODIR" ]; then |
140 printf "loading site defaults... " |
120 INFODIR=$PREFIX/info |
141 . "$prefix/share/config.site" |
121 fi |
142 echo ok |
122 if [ -z "$MANDIR" ]; then |
143 elif [ -f "$prefix/etc/config.site" ]; then |
123 MANDIR=$PREFIX/man |
144 printf "loading site defaults... " |
124 fi |
145 . "$prefix/etc/config.site" |
125 |
146 echo ok |
126 which pkg-config > /dev/null |
147 fi |
127 if [ $? -eq 0 ]; then |
148 |
128 PKG_CONFIG=pkg-config |
149 # Test for availability of pkg-config |
129 else |
150 PKG_CONFIG=`command -v pkg-config` |
130 PKG_CONFIG=false |
151 : ${PKG_CONFIG:="false"} |
131 fi |
|
132 |
152 |
133 # Simple uname based platform detection |
153 # Simple uname based platform detection |
134 # $PLATFORM is used for platform dependent dependency selection |
154 # $PLATFORM is used for platform dependent dependency selection |
|
155 OS=`uname -s` |
|
156 OS_VERSION=`uname -r` |
135 printf "detect platform... " |
157 printf "detect platform... " |
136 if [ "$OS" = "SunOS" ]; then |
158 if [ "$OS" = "SunOS" ]; then |
137 PLATFORM="solaris sunos unix svr4" |
159 PLATFORM="solaris sunos unix svr4" |
138 fi |
160 elif [ "$OS" = "Linux" ]; then |
139 if [ "$OS" = "Linux" ]; then |
|
140 PLATFORM="linux unix" |
161 PLATFORM="linux unix" |
141 fi |
162 elif [ "$OS" = "FreeBSD" ]; then |
142 if [ "$OS" = "FreeBSD" ]; then |
|
143 PLATFORM="freebsd bsd unix" |
163 PLATFORM="freebsd bsd unix" |
144 fi |
164 elif [ "$OS" = "OpenBSD" ]; then |
145 if [ "$OS" = "Darwin" ]; then |
165 PLATFORM="openbsd bsd unix" |
|
166 elif [ "$OS" = "NetBSD" ]; then |
|
167 PLATFORM="netbsd bsd unix" |
|
168 elif [ "$OS" = "Darwin" ]; then |
146 PLATFORM="macos osx bsd unix" |
169 PLATFORM="macos osx bsd unix" |
147 fi |
170 elif echo "$OS" | grep -i "MINGW" > /dev/null; then |
148 echo "$OS" | grep -i "MINGW" > /dev/null |
|
149 if [ $? -eq 0 ]; then |
|
150 PLATFORM="windows mingw" |
171 PLATFORM="windows mingw" |
151 fi |
172 fi |
152 |
173 : ${PLATFORM:="unix"} |
153 if [ -z "$PLATFORM" ]; then |
174 |
154 PLATFORM="unix" |
175 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
155 fi |
176 echo "$PLATFORM_NAME" |
156 |
|
157 for p in $PLATFORM |
|
158 do |
|
159 PLATFORM_NAME=$p |
|
160 break |
|
161 done |
|
162 echo $PLATFORM_NAME |
|
163 |
177 |
164 isplatform() |
178 isplatform() |
165 { |
179 { |
166 for p in $PLATFORM |
180 for p in $PLATFORM |
167 do |
181 do |
169 return 0 |
183 return 0 |
170 fi |
184 fi |
171 done |
185 done |
172 return 1 |
186 return 1 |
173 } |
187 } |
174 isnotplatform() |
188 notisplatform() |
175 { |
189 { |
176 for p in $PLATFORM |
190 for p in $PLATFORM |
177 do |
191 do |
178 if [ "$p" = "$1" ]; then |
192 if [ "$p" = "$1" ]; then |
179 return 1 |
193 return 1 |
180 fi |
194 fi |
181 done |
195 done |
182 return 0 |
196 return 0 |
183 } |
197 } |
184 |
198 istoolchain() |
185 # generate config.mk and config.h |
199 { |
186 cat > "$TEMP_DIR/config.mk" << __EOF__ |
200 for t in $TOOLCHAIN |
187 # |
201 do |
188 # config.mk generated by configure |
202 if [ "$t" = "$1" ]; then |
189 # |
203 return 0 |
190 |
204 fi |
191 # general vars |
205 done |
|
206 return 1 |
|
207 } |
|
208 notistoolchain() |
|
209 { |
|
210 for t in $TOOLCHAIN |
|
211 do |
|
212 if [ "$t" = "$1" ]; then |
|
213 return 1 |
|
214 fi |
|
215 done |
|
216 return 0 |
|
217 } |
|
218 |
|
219 |
|
220 # generate vars.mk |
|
221 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
|
222 prefix=$prefix |
|
223 exec_prefix=$exec_prefix |
|
224 bindir=$bindir |
|
225 sbindir=$sbindir |
|
226 libdir=$libdir |
|
227 libexecdir=$libexecdir |
|
228 datarootdir=$datarootdir |
|
229 datadir=$datadir |
|
230 sysconfdir=$sysconfdir |
|
231 sharedstatedir=$sharedstatedir |
|
232 localstatedir=$localstatedir |
|
233 runstatedir=$runstatedir |
|
234 includedir=$includedir |
|
235 infodir=$infodir |
|
236 mandir=$mandir |
|
237 localedir=$localedir |
192 HOST=$HOST |
238 HOST=$HOST |
193 PREFIX=$PREFIX |
239 PREFIX=$PREFIX |
194 INSTALL_DIR=$INSTALL_DIR |
240 INSTALL_DIR=$INSTALL_DIR |
195 |
241 __EOF__ |
196 EPREFIX=$EPREFIX |
242 |
197 |
243 # toolchain detection utilities |
198 BINDIR=$BINDIR |
244 . make/toolchain.sh |
199 SBINDIR=$SBINDIR |
245 |
200 LIBDIR=$LIBDIR |
246 # |
201 LIBEXECDIR=$LIBEXECDIR |
247 # DEPENDENCIES |
202 DATADIR=$DATADIR |
248 # |
203 SYSCONFDIR=$SYSCONFDIR |
249 |
204 SHAREDSTATEDIR=$SHAREDSTATEDIR |
250 # check languages |
205 LOCALSTATEDIR=$LOCALSTATEDIR |
251 lang_c= |
206 INCLUDEDIR=$INCLUDEDIR |
252 lang_cpp= |
207 INFODIR=$INFODIR |
253 if detect_c_compiler ; then |
208 MANDIR=$MANDIR |
254 lang_c=1 |
209 |
255 fi |
210 __EOF__ |
256 |
211 |
257 # create buffer for make variables required by dependencies |
212 echo > "$TEMP_DIR/make.mk" |
258 echo > "$TEMP_DIR/make.mk" |
213 |
259 |
214 ENV_CFLAGS=$CFLAGS |
260 test_pkg_config() |
215 ENV_LDFLAGS=$LDFLAGS |
261 { |
216 ENV_CXXFLAGS=$CXXFLAGS |
262 if "$PKG_CONFIG" --exists "$1" ; then : |
217 |
263 else return 1 ; fi |
218 # Toolchain detection |
264 if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : |
219 # this will insert make vars to config.mk |
265 else return 1 ; fi |
220 . make/toolchain.sh |
266 if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : |
221 |
267 else return 1 ; fi |
222 # add user specified flags to config.mk |
268 if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : |
223 echo "# project specific flags" >> "$TEMP_DIR/config.mk" |
269 else return 1 ; fi |
224 if [ -n "${ENV_CFLAGS}" ]; then |
270 return 0 |
225 echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk" |
271 } |
226 fi |
272 |
227 if [ -n "${ENV_CXXFLAGS}" ]; then |
273 print_check_msg() |
228 echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk" |
274 { |
229 fi |
275 if [ -z "$1" ]; then |
230 if [ -n "${ENV_LDFLAGS}" ]; then |
276 shift |
231 echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk" |
277 printf "$@" |
232 fi |
278 fi |
233 |
279 } |
234 # |
280 |
235 # DEPENDENCIES |
281 dependency_error_libpq() |
236 # |
282 { |
237 |
283 print_check_msg "$dep_checked_libpq" "checking for libpq... " |
238 dependency_libpq() |
|
239 { |
|
240 printf "checking for libpq... " |
|
241 # dependency libpq |
284 # dependency libpq |
242 while true |
285 while true |
243 do |
286 do |
244 if [ -z "$PKG_CONFIG" ]; then |
287 if [ -z "$PKG_CONFIG" ]; then |
245 break |
288 break |
246 fi |
289 fi |
247 $PKG_CONFIG libpq |
290 if test_pkg_config "libpq" "" "" "" ; then |
248 if [ $? -ne 0 ] ; then |
291 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`" |
249 break |
292 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libpq`" |
250 fi |
293 else |
251 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libpq`" |
294 break |
252 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libpq`" |
295 fi |
253 cat >> $TEMP_DIR/make.mk << __EOF__ |
296 cat >> $TEMP_DIR/make.mk << __EOF__ |
254 # Dependency: libpq |
297 # Dependency: libpq |
255 CFLAGS += -DENABLE_POSTGRESQL |
298 CFLAGS += -DENABLE_POSTGRESQL |
256 PLUGINS += postgresql |
299 PLUGINS += postgresql |
257 TEST_PLUGIN_LDFLAGS += -lwspgtest |
300 TEST_PLUGIN_LDFLAGS += -lwspgtest |
258 |
301 __EOF__ |
259 __EOF__ |
302 print_check_msg "$dep_checked_libpq" "yes\n" |
260 echo yes |
303 dep_checked_libpq=1 |
261 return 0 |
304 return 1 |
262 done |
305 done |
263 |
306 |
264 echo no |
307 print_check_msg "$dep_checked_libpq" "no\n" |
265 return 1 |
308 dep_checked_libpq=1 |
266 } |
309 return 0 |
267 dependency_openssl() |
310 } |
268 { |
311 dependency_error_openssl() |
269 printf "checking for openssl... " |
312 { |
|
313 print_check_msg "$dep_checked_openssl" "checking for openssl... " |
270 # dependency openssl |
314 # dependency openssl |
271 while true |
315 while true |
272 do |
316 do |
273 if [ -z "$PKG_CONFIG" ]; then |
317 if [ -z "$PKG_CONFIG" ]; then |
274 break |
318 break |
275 fi |
319 fi |
276 $PKG_CONFIG openssl |
320 if test_pkg_config "openssl" "" "" "" ; then |
277 if [ $? -ne 0 ] ; then |
321 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`" |
278 break |
322 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`" |
279 fi |
323 else |
280 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags openssl`" |
324 break |
281 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs openssl`" |
325 fi |
282 echo yes |
326 print_check_msg "$dep_checked_openssl" "yes\n" |
283 return 0 |
327 dep_checked_openssl=1 |
|
328 return 1 |
284 done |
329 done |
285 |
330 |
286 # dependency openssl |
331 # dependency openssl |
287 while true |
332 while true |
288 do |
333 do |
289 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" |
334 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" |
290 echo yes |
335 print_check_msg "$dep_checked_openssl" "yes\n" |
291 return 0 |
336 dep_checked_openssl=1 |
292 done |
337 return 1 |
293 |
338 done |
294 echo no |
339 |
295 return 1 |
340 print_check_msg "$dep_checked_openssl" "no\n" |
296 } |
341 dep_checked_openssl=1 |
297 dependency_libxml2() |
342 return 0 |
298 { |
343 } |
299 printf "checking for libxml2... " |
344 dependency_error_libxml2() |
|
345 { |
|
346 print_check_msg "$dep_checked_libxml2" "checking for libxml2... " |
300 # dependency libxml2 |
347 # dependency libxml2 |
301 while true |
348 while true |
302 do |
349 do |
303 if [ -z "$PKG_CONFIG" ]; then |
350 if [ -z "$PKG_CONFIG" ]; then |
304 break |
351 break |
305 fi |
352 fi |
306 $PKG_CONFIG libxml-2.0 |
353 if test_pkg_config "libxml-2.0" "" "" "" ; then |
307 if [ $? -ne 0 ] ; then |
354 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`" |
308 break |
355 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`" |
309 fi |
356 else |
310 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libxml-2.0`" |
357 break |
311 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libxml-2.0`" |
358 fi |
312 echo yes |
359 print_check_msg "$dep_checked_libxml2" "yes\n" |
313 return 0 |
360 dep_checked_libxml2=1 |
|
361 return 1 |
314 done |
362 done |
315 |
363 |
316 # dependency libxml2 |
364 # dependency libxml2 |
317 while true |
365 while true |
318 do |
366 do |
319 xml2-config --cflags > /dev/null |
367 if tmp_flags=`xml2-config --cflags` ; then |
320 if [ $? -eq 0 ]; then |
368 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" |
321 TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`" |
|
322 else |
369 else |
323 break |
370 break |
324 fi |
371 fi |
325 echo yes |
372 if tmp_flags=`xml2-config --libs` ; then |
326 return 0 |
373 TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" |
327 done |
374 else |
328 |
375 break |
329 echo no |
376 fi |
330 return 1 |
377 print_check_msg "$dep_checked_libxml2" "yes\n" |
331 } |
378 dep_checked_libxml2=1 |
|
379 return 1 |
|
380 done |
|
381 |
|
382 print_check_msg "$dep_checked_libxml2" "no\n" |
|
383 dep_checked_libxml2=1 |
|
384 return 0 |
|
385 } |
|
386 |
|
387 # start collecting dependency information |
|
388 echo > "$TEMP_DIR/flags.mk" |
332 |
389 |
333 DEPENDENCIES_FAILED= |
390 DEPENDENCIES_FAILED= |
334 ERROR=0 |
391 ERROR=0 |
335 # general dependencies |
392 # unnamed dependencies |
336 TEMP_CFLAGS= |
393 TEMP_CFLAGS= |
|
394 TEMP_CXXFLAGS= |
337 TEMP_LDFLAGS= |
395 TEMP_LDFLAGS= |
338 while true |
396 while true |
339 do |
397 do |
340 if isnotplatform "linux"; then |
398 while true |
|
399 do |
|
400 if [ -z "$lang_c" ] ; then |
|
401 ERROR=1 |
|
402 break |
|
403 fi |
|
404 |
|
405 break |
|
406 done |
|
407 break |
|
408 done |
|
409 while true |
|
410 do |
|
411 if notisplatform "linux"; then |
341 break |
412 break |
342 fi |
413 fi |
343 while true |
414 while true |
344 do |
415 do |
345 |
416 |
444 |
506 |
445 # platform dependend vars |
507 # platform dependend vars |
446 OBJ_EXT = .o |
508 OBJ_EXT = .o |
447 LIB_EXT = .so |
509 LIB_EXT = .so |
448 APP_EXT = |
510 APP_EXT = |
449 |
511 __EOF__ |
450 __EOF__ |
512 break |
451 |
513 done |
452 break |
|
453 done |
|
454 |
|
455 break |
514 break |
456 done |
515 done |
457 |
516 |
458 # add general dependency flags to config.mk |
517 # add general dependency flags to flags.mk |
459 echo >> "$TEMP_DIR/config.mk" |
518 echo "# general flags" >> "$TEMP_DIR/flags.mk" |
460 if [ -n "${TEMP_CFLAGS}" ]; then |
519 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
461 echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk |
520 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
462 fi |
521 fi |
463 if [ -n "${TEMP_CXXFLAGS}" ]; then |
522 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
464 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk |
523 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
465 fi |
524 fi |
466 if [ -n "${TEMP_LDFLAGS}" ]; then |
525 if [ -n "${TEMP_LDFLAGS}" ]; then |
467 echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk |
526 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
468 fi |
527 fi |
469 |
528 |
470 # |
529 # |
471 # OPTION VALUES |
530 # OPTION VALUES |
472 # |
531 # |
473 |
532 |
474 # |
533 # |
475 # TARGETS |
534 # TARGETS |
476 # |
535 # |
|
536 |
|
537 echo >> "$TEMP_DIR/flags.mk" |
|
538 echo "configuring global target" |
|
539 echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" |
477 TEMP_CFLAGS= |
540 TEMP_CFLAGS= |
478 TEMP_CXXFLAGS= |
541 TEMP_CXXFLAGS= |
479 TEMP_LDFLAGS= |
542 TEMP_LDFLAGS= |
480 |
543 |
481 # Target |
544 if dependency_error_libxml2; then |
482 TEMP_CFLAGS= |
|
483 TEMP_LDFLAGS= |
|
484 TEMP_CXXFLAGS= |
|
485 |
|
486 dependency_libxml2 |
|
487 if [ $? -ne 0 ]; then |
|
488 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " |
545 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " |
489 ERROR=1 |
546 ERROR=1 |
490 fi |
547 fi |
491 dependency_openssl |
548 if dependency_error_openssl; then |
492 if [ $? -ne 0 ]; then |
|
493 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " |
549 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " |
494 ERROR=1 |
550 ERROR=1 |
495 fi |
551 fi |
496 |
552 |
497 # Features |
553 # Features |
498 |
554 |
499 |
555 |
500 echo >> "$TEMP_DIR/config.mk" |
556 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
501 if [ -n "${TEMP_CFLAGS}" ]; then |
557 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
502 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" |
558 fi |
503 fi |
559 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
504 if [ -n "${TEMP_CXXFLAGS}" ]; then |
560 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
505 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" |
561 fi |
|
562 if [ "$BUILD_TYPE" = "debug" ]; then |
|
563 if [ -n "$lang_c" ]; then |
|
564 echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
565 fi |
|
566 if [ -n "$lang_cpp" ]; then |
|
567 echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
568 fi |
|
569 fi |
|
570 if [ "$BUILD_TYPE" = "release" ]; then |
|
571 if [ -n "$lang_c" ]; then |
|
572 echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
573 fi |
|
574 if [ -n "$lang_cpp" ]; then |
|
575 echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
576 fi |
506 fi |
577 fi |
507 if [ -n "${TEMP_LDFLAGS}" ]; then |
578 if [ -n "${TEMP_LDFLAGS}" ]; then |
508 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" |
579 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
509 fi |
580 fi |
510 |
581 |
511 # Target: postgresql |
582 echo >> "$TEMP_DIR/flags.mk" |
|
583 echo "configuring target: postgresql" |
|
584 echo "# flags for target postgresql" >> "$TEMP_DIR/flags.mk" |
512 TEMP_CFLAGS= |
585 TEMP_CFLAGS= |
|
586 TEMP_CXXFLAGS= |
513 TEMP_LDFLAGS= |
587 TEMP_LDFLAGS= |
514 TEMP_CXXFLAGS= |
|
515 |
588 |
516 |
589 |
517 # Features |
590 # Features |
518 if [ -n "$FEATURE_POSTGRESQL" ]; then |
591 if [ -n "$FEATURE_POSTGRESQL" ]; then |
519 # check dependency |
592 # check dependency |
520 dependency_libpq |
593 if dependency_error_libpq ; then |
521 if [ $? -ne 0 ]; then |
|
522 # "auto" features can fail and are just disabled in this case |
594 # "auto" features can fail and are just disabled in this case |
523 if [ "$FEATURE_POSTGRESQL" != "auto" ]; then |
595 if [ "$FEATURE_POSTGRESQL" = "auto" ]; then |
|
596 DISABLE_FEATURE_POSTGRESQL=1 |
|
597 else |
524 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " |
598 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " |
525 ERROR=1 |
599 ERROR=1 |
526 fi |
600 fi |
527 fi |
601 fi |
528 fi |
602 if [ -n "$DISABLE_FEATURE_POSTGRESQL" ]; then |
529 |
603 unset FEATURE_POSTGRESQL |
530 |
604 fi |
531 echo >> "$TEMP_DIR/config.mk" |
605 fi |
532 if [ -n "${TEMP_CFLAGS}" ]; then |
606 |
533 echo "POSTGRESQL_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" |
607 |
534 fi |
608 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
535 if [ -n "${TEMP_CXXFLAGS}" ]; then |
609 echo "POSTGRESQL_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
536 echo "POSTGRESQL_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" |
610 fi |
|
611 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
|
612 echo "POSTGRESQL_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
|
613 fi |
|
614 if [ "$BUILD_TYPE" = "debug" ]; then |
|
615 if [ -n "$lang_c" ]; then |
|
616 echo 'POSTGRESQL_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
617 fi |
|
618 if [ -n "$lang_cpp" ]; then |
|
619 echo 'POSTGRESQL_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
620 fi |
|
621 fi |
|
622 if [ "$BUILD_TYPE" = "release" ]; then |
|
623 if [ -n "$lang_c" ]; then |
|
624 echo 'POSTGRESQL_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
625 fi |
|
626 if [ -n "$lang_cpp" ]; then |
|
627 echo 'POSTGRESQL_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
628 fi |
537 fi |
629 fi |
538 if [ -n "${TEMP_LDFLAGS}" ]; then |
630 if [ -n "${TEMP_LDFLAGS}" ]; then |
539 echo "POSTGRESQL_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" |
631 echo "POSTGRESQL_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
540 fi |
632 fi |
541 |
633 |
|
634 |
|
635 # final result |
542 if [ $ERROR -ne 0 ]; then |
636 if [ $ERROR -ne 0 ]; then |
543 echo |
637 echo |
544 echo "Error: Unresolved dependencies" |
638 echo "Error: Unresolved dependencies" |
545 echo "$DEPENDENCIES_FAILED" |
639 echo "$DEPENDENCIES_FAILED" |
546 rm -Rf "$TEMP_DIR" |
640 abort_configure |
547 exit 1 |
|
548 fi |
641 fi |
549 |
642 |
550 echo "configure finished" |
643 echo "configure finished" |
551 echo |
644 echo |
552 echo "Build Config:" |
645 echo "Build Config:" |
553 echo " PREFIX: $PREFIX" |
646 echo " PREFIX: $prefix" |
554 echo " TOOLCHAIN: $TOOLCHAIN_NAME" |
647 echo " TOOLCHAIN: $TOOLCHAIN_NAME" |
|
648 echo "Features:" |
|
649 if [ -n "$FEATURE_POSTGRESQL" ]; then |
|
650 echo " postgresql: on" |
|
651 else |
|
652 echo " postgresql: off" |
|
653 fi |
555 echo |
654 echo |
556 cat "$TEMP_DIR/config.mk" "$TEMP_DIR/make.mk" > config.mk |
655 |
|
656 # generate the config.mk file |
|
657 cat > "$TEMP_DIR/config.mk" << __EOF__ |
|
658 # |
|
659 # config.mk generated by configure |
|
660 # |
|
661 |
|
662 __EOF__ |
|
663 write_toolchain_defaults "$TEMP_DIR/toolchain.mk" |
|
664 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
557 rm -Rf "$TEMP_DIR" |
665 rm -Rf "$TEMP_DIR" |
558 |
|
559 |
|