22 TEMP_DIR=".tmp-`uname -n`"
25 echo "Cannot create tmp dir"
28 touch "$TEMP_DIR/options"
29 touch "$TEMP_DIR/features"
36 echo "Usage: $0 [OPTIONS]..."
38 Installation directories:
39 --prefix=PREFIX path prefix for architecture-independent files
41 --exec-prefix=EPREFIX path prefix for architecture-dependent files
44 --bindir=DIR user executables [EPREFIX/bin]
45 --sbindir=DIR system admin executables [EPREFIX/sbin]
46 --libexecdir=DIR program executables [EPREFIX/libexec]
47 --sysconfdir=DIR system configuration files [PREFIX/etc]
48 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
49 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
50 --libdir=DIR object code libraries [EPREFIX/lib]
51 --includedir=DIR C header files [PREFIX/include]
52 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
53 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
54 --infodir=DIR info documentation [DATAROOTDIR/info]
55 --mandir=DIR man documentation [DATAROOTDIR/man]
58 --toolkit=(gtk3|motif)
69 "--prefix="*) PREFIX=${ARG#--prefix=} ;;
70 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;;
71 "--bindir="*) BINDIR=${ARG#----bindir=} ;;
72 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;;
73 "--libdir="*) LIBDIR=${ARG#--libdir=} ;;
74 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;;
75 "--datadir="*) DATADIR=${ARG#--datadir=} ;;
76 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;;
77 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
78 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;;
79 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;;
80 "--infodir="*) INFODIR=${ARG#--infodir=} ;;
81 "--mandir"*) MANDIR=${ARG#--mandir} ;;
82 "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;;
83 "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;;
84 "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;;
89 if [ -z "$BINDIR" ]; then
92 if [ -z "$SBINDIR" ]; then
95 if [ -z "$LIBDIR" ]; then
98 if [ -z "$LIBEXEC" ]; then
99 LIBEXECDIR=$EPREFIX/libexec
101 if [ -z "$DATADIR" ]; then
102 DATADIR=$PREFIX/share
104 if [ -z "$SYSCONFDIR" ]; then
105 SYSCONFDIR=$PREFIX/etc
107 if [ -z "$SHAREDSTATEDIR" ]; then
108 SHAREDSTATEDIR=$PREFIX/com
110 if [ -z "$LOCALSTATEDIR" ]; then
111 LOCALSTATEDIR=$PREFIX/var
113 if [ -z "$INCLUDEDIR" ]; then
114 INCLUDEDIR=$PREFIX/include
116 if [ -z "$INFODIR" ]; then
119 if [ -z "$MANDIR" ]; then
123 which pkg-config > /dev/null
124 if [ $? -eq 0 ]; then
125 PKG_CONFIG=pkg-config
130 # Simple uname based platform detection
131 # $PLATFORM is used for platform dependent dependency selection
132 printf "detect platform... "
133 if [ "$OS" = "SunOS" ]; then
134 PLATFORM="solaris sunos unix svr4"
136 if [ "$OS" = "Linux" ]; then
137 PLATFORM="linux unix"
139 if [ "$OS" = "FreeBSD" ]; then
140 PLATFORM="freebsd bsd unix"
142 if [ "$OS" = "Darwin" ]; then
143 PLATFORM="macos osx bsd unix"
145 echo "$OS" | grep -i "MINGW" > /dev/null
146 if [ $? -eq 0 ]; then
147 PLATFORM="windows mingw"
150 if [ -z "$PLATFORM" ]; then
165 if [ "$p" = "$1" ]; then
175 if [ "$p" = "$1" ]; then
182 # generate config.mk and config.h
183 cat > "$TEMP_DIR/config.mk" << __EOF__
185 # config.mk generated by configure
196 LIBEXECDIR=$LIBEXECDIR
198 SYSCONFDIR=$SYSCONFDIR
199 SHAREDSTATEDIR=$SHAREDSTATEDIR
200 LOCALSTATEDIR=$LOCALSTATEDIR
201 INCLUDEDIR=$INCLUDEDIR
207 echo > "$TEMP_DIR/make.mk"
211 ENV_CXXFLAGS=$CXXFLAGS
213 # Toolchain detection
214 # this will insert make vars to config.mk
217 # add user specified flags to config.mk
218 echo "# project specific flags" >> "$TEMP_DIR/config.mk"
219 if [ -n "${ENV_CFLAGS}" ]; then
220 echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk"
222 if [ -n "${ENV_CXXFLAGS}" ]; then
223 echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk"
225 if [ -n "${ENV_LDFLAGS}" ]; then
226 echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk"
235 printf "checking for curl... "
236 # dependency curl platform="windows"
239 if isnotplatform "windows"; then
242 TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include"
243 TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl"
248 # dependency curl platform="macos"
251 if isnotplatform "macos"; then
254 curl-config --cflags > /dev/null
255 if [ $? -eq 0 ]; then
256 TEMP_CFLAGS="$TEMP_CFLAGS `curl-config --cflags`"
260 curl-config --ldflags > /dev/null
261 if [ $? -eq 0 ]; then
262 TEMP_LDFLAGS="$TEMP_LDFLAGS `curl-config --ldflags`"
273 if [ -z "$PKG_CONFIG" ]; then
277 if [ $? -ne 0 ] ; then
280 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libcurl`"
281 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libcurl`"
289 which curl-config > /dev/null
290 if [ $? -ne 0 ]; then
293 curl-config --cflags > /dev/null
294 if [ $? -eq 0 ]; then
295 TEMP_CFLAGS="$TEMP_CFLAGS `curl-config --cflags`"
299 curl-config --ldflags > /dev/null
300 if [ $? -eq 0 ]; then
301 TEMP_LDFLAGS="$TEMP_LDFLAGS `curl-config --ldflags`"
314 printf "checking for gtk3... "
318 if [ -z "$PKG_CONFIG" ]; then
322 if [ $? -ne 0 ] ; then
325 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags gtk+-3.0`"
326 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs gtk+-3.0`"
327 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK3"
328 TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread"
338 printf "checking for openssl... "
339 # dependency openssl platform="windows"
342 if isnotplatform "windows"; then
345 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto"
350 # dependency openssl platform="macos"
353 if isnotplatform "macos"; then
356 TEMP_LDFLAGS="$TEMP_LDFLAGS -framework CoreFoundation"
361 # dependency openssl platform="bsd"
364 if isnotplatform "bsd"; then
367 if isplatform "macos"; then
370 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto"
378 if [ -z "$PKG_CONFIG" ]; then
382 if [ $? -ne 0 ] ; then
385 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags openssl`"
386 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs openssl`"
396 printf "checking for libxml2... "
397 # dependency libxml2 platform="windows"
400 if isnotplatform "windows"; then
403 xml2-config --cflags > /dev/null
404 if [ $? -eq 0 ]; then
405 TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`"
409 xml2-config --libs > /dev/null
410 if [ $? -eq 0 ]; then
411 TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`"
419 # dependency libxml2 platform="macos"
422 if isnotplatform "macos"; then
425 xml2-config --cflags > /dev/null
426 if [ $? -eq 0 ]; then
427 TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`"
431 xml2-config --libs > /dev/null
432 if [ $? -eq 0 ]; then
433 TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`"
444 if [ -z "$PKG_CONFIG" ]; then
447 $PKG_CONFIG libxml-2.0
448 if [ $? -ne 0 ] ; then
451 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libxml-2.0`"
452 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libxml-2.0`"
460 xml2-config --cflags > /dev/null
461 if [ $? -eq 0 ]; then
462 TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`"
466 xml2-config --libs > /dev/null
467 if [ $? -eq 0 ]; then
468 TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`"
481 printf "checking for motif... "
485 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_MOTIF"
486 TEMP_LDFLAGS="$TEMP_LDFLAGS -lXm -lXt -lX11 -lpthread"
497 # general dependencies
502 if isnotplatform "unix"; then
505 if isplatform "macos"; then
511 cat >> "$TEMP_DIR/make.mk" << __EOF__
514 PACKAGE_SCRIPT = package_unix.sh
528 TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread"
537 if isnotplatform "bsd"; then
540 if isplatform "macos"; then
546 TEMP_CFLAGS="$TEMP_CFLAGS -I/usr/local/include"
547 TEMP_LDFLAGS="$TEMP_LDFLAGS -L/usr/local/lib"
555 # add general dependency flags to config.mk
556 echo >> "$TEMP_DIR/config.mk"
557 if [ -n "${TEMP_CFLAGS}" ]; then
558 echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk
560 if [ -n "${TEMP_CXXFLAGS}" ]; then
561 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk
563 if [ -n "${TEMP_LDFLAGS}" ]; then
564 echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk
570 checkopt_toolkit_gtk3()
574 if [ $? -ne 0 ]; then
577 if [ $VERR -ne 0 ]; then
580 cat >> "$TEMP_DIR/make.mk" << __EOF__
582 GTKOBJ = draw_cairo.o
584 MZUI += gtk_browser.c
589 checkopt_toolkit_motif()
593 if [ $? -ne 0 ]; then
596 if [ $VERR -ne 0 ]; then
599 cat >> "$TEMP_DIR/make.mk" << __EOF__
601 MZUI = motif_pathbar.c
602 MZUI += motif_browser.c
624 if [ -z $OPT_TOOLKIT ]; then
626 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
630 checkopt_toolkit_motif
631 if [ $? -eq 0 ]; then
632 echo " toolkit: motif" >> "$TEMP_DIR/options"
636 checkopt_toolkit_gtk3
637 if [ $? -eq 0 ]; then
638 echo " toolkit: gtk3" >> "$TEMP_DIR/options"
644 if [ $ERROR -ne 0 ]; then
648 DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
652 elif [ "$OPT_TOOLKIT" = "gtk3" ]; then
653 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
654 checkopt_toolkit_gtk3
655 if [ $? -ne 0 ]; then
658 elif [ "$OPT_TOOLKIT" = "motif" ]; then
659 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
660 checkopt_toolkit_motif
661 if [ $? -ne 0 ]; then
667 echo >> "$TEMP_DIR/config.mk"
668 if [ -n "${TEMP_CFLAGS}" ]; then
669 echo "TK_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk"
671 if [ -n "${TEMP_CXXFLAGS}" ]; then
672 echo "TK_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk"
674 if [ -n "${TEMP_LDFLAGS}" ]; then
675 echo "TK_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk"
684 if [ $? -ne 0 ]; then
685 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
689 if [ $? -ne 0 ]; then
690 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
694 if [ $? -ne 0 ]; then
695 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
702 echo >> "$TEMP_DIR/config.mk"
703 if [ -n "${TEMP_CFLAGS}" ]; then
704 echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk"
706 if [ -n "${TEMP_CXXFLAGS}" ]; then
707 echo "DAV_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk"
709 if [ -n "${TEMP_LDFLAGS}" ]; then
710 echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk"
713 if [ $ERROR -ne 0 ]; then
715 echo "Error: Unresolved dependencies"
716 echo "$DEPENDENCIES_FAILED"
721 echo "configure finished"
724 echo " PREFIX: $PREFIX"
725 echo " TOOLCHAIN: $TOOLCHAIN_NAME"
727 cat "$TEMP_DIR/options"
729 cat "$TEMP_DIR/config.mk" "$TEMP_DIR/make.mk" > config.mk