File: configure

package info (click to toggle)
cksfv 1.3.14-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch, wheezy
  • size: 368 kB
  • sloc: ansic: 819; sh: 314; makefile: 35
file content (165 lines) | stat: -rwxr-xr-x 3,982 bytes parent folder | download | duplicates (2)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/bin/sh

version="1.3.14"
prefix="/usr/local"
packageprefix=""
have_mandir="no"
have_bindir="no"

compiler="gcc"
if test -n "$CC" ; then
    compiler="$CC"
fi

for opt in "$@" ; do
	case $opt in
	--prefix=*)
		prefix=`echo $opt | sed -n 's/--prefix=\(.*\)/\1/p'`
		;;
	--package-prefix=*)
		packageprefix=`echo $opt | sed -n 's|--package-prefix=\(.*\)|\1|p'`
		;;
	--bindir=*)
		bindir=`echo $opt | sed -n 's|--bindir=\(.*\)|\1|p'`
		have_bindir="yes"
		;;
	--mandir=*)
		mandir=`echo $opt | sed -n 's|--mandir=\(.*\)|\1|p'`
		have_mandir="yes"
		;;
	--compiler=*)
		compiler=`echo $opt | sed -n 's|--compiler=\(.*\)|\1|p'`
		;;
	--help)
		echo ""
		echo "valid options are:"
		echo "--prefix=dir           install to prefix 'dir'"
 		echo "--package-prefix=dest  pretend to install to the prefix,"
		echo "                       but copy files to 'dest/prefix' on make install"
		echo "--bindir=dir           install program to 'dir' (PREFIX/bin/)"
		echo "--mandir=dir           install man page to 'dir' (PREFIX/share/man/)"
		echo "--compiler=program     compile with 'program' (gcc)"
		exit
		;;
        *)
		echo "unknown configure argument:" "$opt" "(ignoring)"
		;;
	esac
done

if test -n "$packageprefix" ; then
    packageprefix="$packageprefix/"
fi

if test "$have_bindir" = "no" ; then
    bindir="$prefix/bin"
fi

if test "$have_mandir" = "no" ; then
    mandir="$prefix/share/man"
fi

packagebindir="$packageprefix$bindir"
packagemandir="$packageprefix$mandir"

sed -e "s|{BINDIR}|$packagebindir|g" \
    -e "s|{MANDIR}|$packagemandir|g" \
    < Makefile.in > Makefile

if test -z "$CFLAGS" ; then
    CFLAGS="-O2"
fi
EXTRASOURCES=""

os="`uname`"
echo $os |grep MINGW32 > /dev/null
if test "$?" = "0" ; then
    os="MinGW"
fi

if test "$os" = "MinGW" ; then
    EXTRASOURCES="$EXTRASOURCES basename.c"
    cp win32/libgen.h win32/basename.c src/
fi

sed -e "s|{CC}|$compiler|" \
    -e "s|{CFLAGS}|$CFLAGS|" \
    -e "s|{EXTRASOURCES}|$EXTRASOURCES|" \
    < src/Makefile.in > src/Makefile

echo "" > "src/config.h"
echo "#ifndef CKSFV_CONFIG_H" >> "src/config.h"
echo "#define CKSFV_CONFIG_H" >> "src/config.h"

echo "#define VERSION \"$version\"" >> src/config.h

has_stdint="no"
has_inttypes="no"

cat > tmpfile.c <<EOF
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
int main(void) {return 0;}
EOF
$compiler -o tmpfile tmpfile.c >/dev/null 2>/dev/null
if test "$?" = "0" ; then
    has_stdint="yes"
fi

# A slight optimization: test inttypes.h only if there is no stdint.h
if test "$has_stdint" = "no" ; then
    cat > tmpfile.c <<EOF
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
int main(void) {return 0;}
EOF
    $compiler -o tmpfile tmpfile.c >/dev/null 2>/dev/null
    if test "$?" = "0"; then
	has_inttypes="yes"
    fi
fi

rm -f tmpfile tmpfile.c

if test "$has_stdint" = "yes" ; then
    echo "#include <stdint.h>" >> src/config.h
elif test "$has_inttypes" = "yes"; then
    echo "#include <inttypes.h>" >> src/config.h
else
    # no stdint.h or inttypes.h. obsolete environment. but we may hope..
    echo "#include <unistd.h>" >> src/config.h
    has_stdint="no (compilation will probably fail)"
fi

echo "#endif" >> "src/config.h"

echo ""
echo "  prefix directory:          $prefix"
echo "  package prefix:            $packageprefix"
echo "  binary directory:          $bindir"
echo "  man directory:             $mandir"
echo "  compiler:                  $compiler"
echo "  has stdint.h:              $has_stdint"
echo "  has inttypes.h:            $has_inttypes"

have_nautilus="no"
if test -n "$(zenity --version 2>/dev/null)" ; then
    if test -n "$(nautilus --version 2>/dev/null)" ; then
	have_natilus="yes"
    fi
fi

if test "$have_nautilus" = "yes" ; then
    echo ""
    echo "It seems you have Nautilus, you can copy scripts/CheckSFV"
    echo "Nautilus script into:"
    echo ""
    echo "    ~/.gnome2/nautilus-scripts"
else
    echo "  nautilus support:          no"
fi

echo ""
echo "configure succesful."