File: configure.win

package info (click to toggle)
r-cran-png 0.1-7-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 132 kB
  • sloc: ansic: 546; sh: 60; makefile: 2
file content (72 lines) | stat: -rw-r--r-- 2,037 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh

echo "  checking PNG headers and libraries"
allok=yes
use_local=no

## In the future we should be able to use
## local=`${R_HOME}/bin/R CMD config LOCAL_SOFT`
## but up to at least R 3.0.1 that doesn't work
if [ -z "$MAKE" ]; then
    MAKE=`${R_HOME}/bin/R CMD config MAKE`
    if [ -z "$MAKE" ]; then
	MAKE=make
    fi
fi
makefiles="-f ${R_HOME}/etc${R_ARCH}/Makeconf -f ${R_SHARE_DIR}/make/config.mk"
local=`${MAKE} -s ${makefiles} print R_HOME=${R_HOME} VAR=LOCAL_SOFT`

if [ -e $local/lib ]; then
    if ls $local/lib/libpng.* 2>/dev/null; then
	echo "  found libpng in LOCAL_SOFT: $local/lib"
	use_local=yes
    elif ls $local/lib${R_ARCH}/libpng.* 2>/dev/null; then
	echo "  found libpng in LOCAL_SOFT: $local/lib${R_ARCH}"
	use_local=yes
    else
	echo "  LOCAL_SOFT does not contain libpng, fall back to external png"
    fi
else
    echo "  LOCAL_SOFT does not exist, fall back to external png"
fi

if [ ${use_local} = no ]; then
    if [ ! -e src/win32/libz.a ]; then
	if [ ! -e src/libpng-current-win.tar.gz ]; then
	    echo "  cannot find current PNG files"
	    echo "  attempting to download them"
	    echo 'download.file("http://www.rforge.net/png/files/libpng-current-win.tar.gz","src/libpng-current-win.tar.gz",mode="wb",quiet=TRUE)'|${R_HOME}/bin/R --vanilla --slave
	fi
	if [ ! -e src/libpng-current-win.tar.gz ]; then
	    allok=no
	else
	    echo "  unpacking current PNG"
	    tar fxz src/libpng-current-win.tar.gz -C src
            if [ ! -e src/win32/libz.a ]; then
		allok=no
	    fi
	fi
    fi

    if [ ! -e src/win32/libz.a ]; then
	allok=no
    fi
fi

if [ ${allok} != yes ]; then
    echo ""
    echo " *** ERROR: unable to find PNG files"
    echo ""
    echo " They must be either in src/win32, in a tar-ball"
    echo " src/libpng-current-win.tar.gz or"
    echo " available via the LOCAL_SOFT R make setting."
    echo ""
    echo " You can get the latest binary tar ball from"
    echo " http://www.rforge.net/png/files/"
    echo ""
    exit 1
fi

echo "  seems ok, ready to go"

exit 0