| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
version="1.3.15" |
| 4 |
prefix="/usr/local" |
| 5 |
packageprefix="" |
| 6 |
have_mandir="no" |
| 7 |
have_bindir="no" |
| 8 |
|
| 9 |
compiler="gcc" |
| 10 |
if test -n "$CC" ; then |
| 11 |
compiler="$CC" |
| 12 |
fi |
| 13 |
|
| 14 |
for opt in "$@" ; do |
| 15 |
case $opt in |
| 16 |
--prefix=*) |
| 17 |
prefix=`echo $opt | sed -n 's/--prefix=\(.*\)/\1/p'` |
| 18 |
;; |
| 19 |
--package-prefix=*) |
| 20 |
packageprefix=`echo $opt | sed -n 's|--package-prefix=\(.*\)|\1|p'` |
| 21 |
;; |
| 22 |
--bindir=*) |
| 23 |
bindir=`echo $opt | sed -n 's|--bindir=\(.*\)|\1|p'` |
| 24 |
have_bindir="yes" |
| 25 |
;; |
| 26 |
--mandir=*) |
| 27 |
mandir=`echo $opt | sed -n 's|--mandir=\(.*\)|\1|p'` |
| 28 |
have_mandir="yes" |
| 29 |
;; |
| 30 |
--compiler=*) |
| 31 |
compiler=`echo $opt | sed -n 's|--compiler=\(.*\)|\1|p'` |
| 32 |
;; |
| 33 |
--help) |
| 34 |
echo "" |
| 35 |
echo "valid options are:" |
| 36 |
echo "--prefix=dir install to prefix 'dir'" |
| 37 |
echo "--package-prefix=dest pretend to install to the prefix," |
| 38 |
echo " but copy files to 'dest/prefix' on make install" |
| 39 |
echo "--bindir=dir install program to 'dir' (PREFIX/bin/)" |
| 40 |
echo "--mandir=dir install man page to 'dir' (PREFIX/share/man/)" |
| 41 |
echo "--compiler=program compile with 'program' (gcc)" |
| 42 |
exit |
| 43 |
;; |
| 44 |
*) |
| 45 |
echo "unknown configure argument:" "$opt" "(ignoring)" |
| 46 |
;; |
| 47 |
esac |
| 48 |
done |
| 49 |
|
| 50 |
if test -n "$packageprefix" ; then |
| 51 |
packageprefix="$packageprefix/" |
| 52 |
fi |
| 53 |
|
| 54 |
if test "$have_bindir" = "no" ; then |
| 55 |
bindir="$prefix/bin" |
| 56 |
fi |
| 57 |
|
| 58 |
if test "$have_mandir" = "no" ; then |
| 59 |
mandir="$prefix/share/man" |
| 60 |
fi |
| 61 |
|
| 62 |
packagebindir="$packageprefix$bindir" |
| 63 |
packagemandir="$packageprefix$mandir" |
| 64 |
|
| 65 |
sed -e "s|{BINDIR}|$packagebindir|g" \ |
| 66 |
-e "s|{MANDIR}|$packagemandir|g" \ |
| 67 |
< Makefile.in > Makefile |
| 68 |
|
| 69 |
if test -z "$CFLAGS" ; then |
| 70 |
CFLAGS="-O2" |
| 71 |
fi |
| 72 |
EXTRASOURCES="" |
| 73 |
|
| 74 |
os="`uname`" |
| 75 |
echo $os |grep MINGW32 > /dev/null |
| 76 |
if test "$?" = "0" ; then |
| 77 |
os="MinGW" |
| 78 |
fi |
| 79 |
|
| 80 |
if test "$os" = "MinGW" ; then |
| 81 |
EXTRASOURCES="$EXTRASOURCES basename.c" |
| 82 |
cp win32/libgen.h win32/basename.c src/ |
| 83 |
fi |
| 84 |
|
| 85 |
sed -e "s|{CC}|$compiler|" \ |
| 86 |
-e "s|{CFLAGS}|$CFLAGS|" \ |
| 87 |
-e "s|{EXTRASOURCES}|$EXTRASOURCES|" \ |
| 88 |
< src/Makefile.in > src/Makefile |
| 89 |
|
| 90 |
echo "" > "src/config.h" |
| 91 |
echo "#ifndef CKSFV_CONFIG_H" >> "src/config.h" |
| 92 |
echo "#define CKSFV_CONFIG_H" >> "src/config.h" |
| 93 |
|
| 94 |
echo "#define VERSION \"$version\"" >> src/config.h |
| 95 |
|
| 96 |
has_stdint="no" |
| 97 |
has_inttypes="no" |
| 98 |
|
| 99 |
cat > tmpfile.c <<EOF |
| 100 |
#include <stdint.h> |
| 101 |
#include <stdlib.h> |
| 102 |
#include <stdio.h> |
| 103 |
int main(void) {return 0;} |
| 104 |
EOF |
| 105 |
$compiler -o tmpfile tmpfile.c >/dev/null 2>/dev/null |
| 106 |
if test "$?" = "0" ; then |
| 107 |
has_stdint="yes" |
| 108 |
fi |
| 109 |
|
| 110 |
# A slight optimization: test inttypes.h only if there is no stdint.h |
| 111 |
if test "$has_stdint" = "no" ; then |
| 112 |
cat > tmpfile.c <<EOF |
| 113 |
#include <inttypes.h> |
| 114 |
#include <stdlib.h> |
| 115 |
#include <stdio.h> |
| 116 |
int main(void) {return 0;} |
| 117 |
EOF |
| 118 |
$compiler -o tmpfile tmpfile.c >/dev/null 2>/dev/null |
| 119 |
if test "$?" = "0"; then |
| 120 |
has_inttypes="yes" |
| 121 |
fi |
| 122 |
fi |
| 123 |
|
| 124 |
rm -f tmpfile tmpfile.c |
| 125 |
|
| 126 |
if test "$has_stdint" = "yes" ; then |
| 127 |
echo "#include <stdint.h>" >> src/config.h |
| 128 |
elif test "$has_inttypes" = "yes"; then |
| 129 |
echo "#include <inttypes.h>" >> src/config.h |
| 130 |
else |
| 131 |
# no stdint.h or inttypes.h. obsolete environment. but we may hope.. |
| 132 |
echo "#include <unistd.h>" >> src/config.h |
| 133 |
has_stdint="no (compilation will probably fail)" |
| 134 |
fi |
| 135 |
|
| 136 |
echo "#endif" >> "src/config.h" |
| 137 |
|
| 138 |
echo "" |
| 139 |
echo " prefix directory: $prefix" |
| 140 |
echo " package prefix: $packageprefix" |
| 141 |
echo " binary directory: $bindir" |
| 142 |
echo " man directory: $mandir" |
| 143 |
echo " compiler: $compiler" |
| 144 |
echo " has stdint.h: $has_stdint" |
| 145 |
echo " has inttypes.h: $has_inttypes" |
| 146 |
|
| 147 |
have_nautilus="no" |
| 148 |
if test -n "$(zenity --version 2>/dev/null)" ; then |
| 149 |
if test -n "$(nautilus --version 2>/dev/null)" ; then |
| 150 |
have_natilus="yes" |
| 151 |
fi |
| 152 |
fi |
| 153 |
|
| 154 |
if test "$have_nautilus" = "yes" ; then |
| 155 |
echo "" |
| 156 |
echo "It seems you have Nautilus, you can copy scripts/CheckSFV" |
| 157 |
echo "Nautilus script into:" |
| 158 |
echo "" |
| 159 |
echo " ~/.gnome2/nautilus-scripts" |
| 160 |
else |
| 161 |
echo " nautilus support: no" |
| 162 |
fi |
| 163 |
|
| 164 |
echo "" |
| •165 |
echo "configure successful." |