1#!/bin/sh
2# This script is in the public domain
3# configure script for small programs
4
5NF="true"		# Do not force install ('not force')
6PREFIX="/usr/local"
7self="$0"
8
9while [ "$#" -gt "0" ]; do
10 case "$1" in
11  -p|--prefix) PREFIX="$2"; shift 2;;
12  -b|--bindir) BINDIR="$2"; shift 2;;
13  -l|--libdir) LIBDIR="$2"; shift 2;;
14  -m|--moddir) MODDIR="$2"; shift 2;;
15  -d|--headdir) HEADDIR="$2"; shift 2;;
16  -v|--version)
17   echo "configures 1.3, by Joe Wreschnig <piman@sacredchao.net>"
18   echo "Placed in the public domain."; exit;;
19  -h|--help)
20   echo " --version	Print the version"
21   echo " --help		Print this message"
22   echo " --prefix	Set the install prefix"
23   echo " -f, --force	Create a Makefile even if the dependency detection fails";
24   exit;;
25  -f|--force) NF=""; shift;;
26  --) shift ; break;;
27  *) echo "Incorrect option: $1" ; $self -h ; exit 1;;
28 esac
29done
30
31. ./cfg.data
32
33if test ! -r ./Makefile.in; then
34 echo "There is no Makefile.in file, stopping configuration."
35 exit 1
36fi
37
38echo "This script will attempt to look for files needed by $PROGNAME $VERSION."
39
40test "$PROGRAMS" && echo "Programs:"
41for I in $PROGRAMS; do
42 echo -n "  Looking for $I... "
43 for J in `echo $PATH | sed 's/:/ /g'` $BINDIR; do
44  F="0"
45  if test -x "$J/$I"; then
46   echo "found."
47   F="1"
48   break
49  fi
50 done
51 if test $F = "0"; then echo "not found."; test $NF && exit 1; fi
52done
53
54test "$LIBS" && echo "Libraries:"
55for I in $LIBS; do
56 echo -n "  Looking for lib$I... "
57 for J in `echo $LD_LIBRARY_PATH | sed 's/:/ /g'` `test -x /etc/ld.so.conf && cat /etc/ld.so.conf` /lib /usr/lib /usr/local/lib $LIBDIR; do
58  F="0"
59  if test -r "$J/lib$I.so" || test -r "$J/lib$I.a"; then
60   echo "found."
61   F="1"
62   break
63  fi
64 done
65 if test $F = "0"; then echo "not found."; test $NF && exit 1; fi
66done
67
68test "$HEADERS" && echo "Headers:"
69for I in $HEADERS; do
70 echo -n "  Looking for $I... "
71 for J in /usr/include /usr/X11R6/include /usr/local/include $INCDIR; do
72  F="0" # Found
73  if test -r "$J/$I"; then
74   echo "found."
75   F="1"
76   break
77  fi
78 done
79 if test $F = "0"; then echo "not found."; test $NF && exit 1; fi
80done
81
82test "$PM" && echo "Perl modules:"
83for I in $PM; do
84 echo -n "  Looking for $I... "
85 for J in `perl -e "print join ' ', @INC"` $PERLDIR; do
86  F="0"
87  if test -r "$J/$I.pm"; then
88   echo "found."
89   F="1"
90   break
91  fi
92 done
93 if test $F = "0"; then echo "not found."; test $NF && exit 1; fi
94done
95
96test "$OTHER" && echo "Other files (will take a long time to find):"
97for I in $OTHER; do
98 echo -n "  Looking for $I... "
99 F="0"
100 if locate "$I" > /dev/null; then
101  echo "found."
102  F="1"
103 fi
104 if test $F = "0"; then echo "not found."; test $NF && exit 1; fi
105done
106
107echo; echo -n "Creating Makefile(s) to install into $PREFIX... "
108for I in $DIRS .; do
109 J=`pwd`
110 cd $I && sed "s!PREFIX!$PREFIX!g" < Makefile.in > Makefile && cd $J
111done
112
113echo "Done."
114
115echo "Type \`make; su -c \"make install\"' to compile and install $PROGNAME."
116