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; exit 1 ;;
83 "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;;
84 "-"*) echo "unknown option: $ARG"; 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 "MINGW" > /dev/null
146 if [ $? -eq 0 ]; then
147 PLATFORM="windows mingw"
150 if [ -z "$PLATFORM" ]; 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 >> $TEMP_DIR/config.mk
219 if [ ! -z "${ENV_CFLAGS}" ]; then
220 echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
222 if [ ! -z "${ENV_CXXFLAGS}" ]; then
223 echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
225 if [ ! -z "${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 CFLAGS="$CFLAGS -I/mingw/include"
243 LDFLAGS="$LDFLAGS -lcurl"
248 # dependency curl platform="macos"
251 if isnotplatform "macos"; then
254 curl-config --cflags > /dev/null
255 if [ $? -eq 0 ]; then
256 CFLAGS="$CFLAGS `curl-config --cflags`"
260 curl-config --ldflags > /dev/null
261 if [ $? -eq 0 ]; then
262 LDFLAGS="$LDFLAGS `curl-config --ldflags`"
273 if [ -z "$PKG_CONFIG" ]; then
277 if [ $? -ne 0 ] ; then
280 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libcurl`"
281 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libcurl`"
289 curl-config --cflags > /dev/null
290 if [ $? -eq 0 ]; then
291 CFLAGS="$CFLAGS `curl-config --cflags`"
295 curl-config --ldflags > /dev/null
296 if [ $? -eq 0 ]; then
297 LDFLAGS="$LDFLAGS `curl-config --ldflags`"
301 which curl-config > /dev/null
302 if [ $? -ne 0 ]; then
314 printf "checking for gtk3... "
318 if [ -z "$PKG_CONFIG" ]; then
322 if [ $? -ne 0 ] ; then
325 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-3.0`"
326 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-3.0`"
327 CFLAGS="$CFLAGS -DUI_GTK3"
328 LDFLAGS="$LDFLAGS -lpthread"
338 printf "checking for openssl... "
339 # dependency openssl platform="windows"
342 if isnotplatform "windows"; then
345 LDFLAGS="$LDFLAGS -lssl -lcrypto"
350 # dependency openssl platform="macos"
353 if isnotplatform "macos"; then
356 LDFLAGS="$LDFLAGS -framework CoreFoundation"
361 # dependency openssl platform="bsd"
364 if isnotplatform "bsd"; then
367 if isplatform "macos"; then
370 LDFLAGS="$LDFLAGS -lssl -lcrypto"
378 if [ -z "$PKG_CONFIG" ]; then
382 if [ $? -ne 0 ] ; then
385 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags openssl`"
386 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs openssl`"
396 printf "checking for motif... "
400 CFLAGS="$CFLAGS -DUI_MOTIF"
401 LDFLAGS="$LDFLAGS -lXm -lXt -lX11 -lpthread"
411 printf "checking for libxml2... "
412 # dependency libxml2 platform="windows"
415 if isnotplatform "windows"; then
418 xml2-config --cflags > /dev/null
419 if [ $? -eq 0 ]; then
420 CFLAGS="$CFLAGS `xml2-config --cflags`"
424 xml2-config --libs > /dev/null
425 if [ $? -eq 0 ]; then
426 LDFLAGS="$LDFLAGS `xml2-config --libs`"
434 # dependency libxml2 platform="macos"
437 if isnotplatform "macos"; then
440 xml2-config --cflags > /dev/null
441 if [ $? -eq 0 ]; then
442 CFLAGS="$CFLAGS `xml2-config --cflags`"
446 xml2-config --libs > /dev/null
447 if [ $? -eq 0 ]; then
448 LDFLAGS="$LDFLAGS `xml2-config --libs`"
459 if [ -z "$PKG_CONFIG" ]; then
462 $PKG_CONFIG libxml-2.0
463 if [ $? -ne 0 ] ; then
466 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libxml-2.0`"
467 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libxml-2.0`"
475 xml2-config --cflags > /dev/null
476 if [ $? -eq 0 ]; then
477 CFLAGS="$CFLAGS `xml2-config --cflags`"
481 xml2-config --libs > /dev/null
482 if [ $? -eq 0 ]; then
483 LDFLAGS="$LDFLAGS `xml2-config --libs`"
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 LDFLAGS="$LDFLAGS -lpthread"
537 if isnotplatform "bsd"; then
540 if isplatform "macos"; then
546 CFLAGS="$CFLAGS -I/usr/local/include"
547 LDFLAGS="$LDFLAGS -L/usr/local/lib"
555 # add general dependency flags to config.mk
556 echo >> $TEMP_DIR/config.mk
557 if [ ! -z "${CFLAGS}" ]; then
558 echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
560 if [ ! -z "${CXXFLAGS}" ]; then
561 echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
563 if [ ! -z "${LDFLAGS}" ]; then
564 echo "LDFLAGS += $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
587 checkopt_toolkit_motif()
591 if [ $? -ne 0 ]; then
594 if [ $VERR -ne 0 ]; then
597 cat >> $TEMP_DIR/make.mk << __EOF__
620 if [ -z $OPT_TOOLKIT ]; then
622 SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED
626 checkopt_toolkit_motif
627 if [ $? -eq 0 ]; then
628 echo " toolkit: motif" >> $TEMP_DIR/options
632 checkopt_toolkit_gtk3
633 if [ $? -eq 0 ]; then
634 echo " toolkit: gtk3" >> $TEMP_DIR/options
640 if [ $ERROR -ne 0 ]; then
644 DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED=
648 elif [ $OPT_TOOLKIT = "gtk3" ]; then
649 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
650 checkopt_toolkit_gtk3
651 if [ $? -ne 0 ]; then
654 elif [ $OPT_TOOLKIT = "motif" ]; then
655 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
656 checkopt_toolkit_motif
657 if [ $? -ne 0 ]; then
663 echo >> $TEMP_DIR/config.mk
664 if [ ! -z "${CFLAGS}" ]; then
665 echo "TK_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
667 if [ ! -z "${CXXFLAGS}" ]; then
668 echo "TK_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
670 if [ ! -z "${LDFLAGS}" ]; then
671 echo "TK_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
680 if [ $? -ne 0 ]; then
681 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
685 if [ $? -ne 0 ]; then
686 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
690 if [ $? -ne 0 ]; then
691 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
698 echo >> $TEMP_DIR/config.mk
699 if [ ! -z "${CFLAGS}" ]; then
700 echo "DAV_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
702 if [ ! -z "${CXXFLAGS}" ]; then
703 echo "DAV_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
705 if [ ! -z "${LDFLAGS}" ]; then
706 echo "DAV_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
709 if [ $ERROR -ne 0 ]; then
711 echo "Error: Unresolved dependencies"
712 echo $DEPENDENCIES_FAILED
717 echo "configure finished"
720 echo " PREFIX: $PREFIX"
721 echo " TOOLCHAIN: $TOOLCHAIN_NAME"
723 cat $TEMP_DIR/options
725 cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk