1#!/bin/sh
2
3# Note: future version will have a syntax something like
4#   ./configure [OPTIONS]
5#   Where OPTIONS is any of:
6#     --help
7#     --codes CODE1 ...
8#     --sizes SIZE1 ...
9#     --jargons JARGON1 ...
10#     --extras EXTRA1 ...
11#     --vars VAR1=VAL1 ...
12# which is why I warn when --vars is not used before VAR1=VAL1
13
14# Avoid depending upon Character Ranges.
15# Taken from autoconf 2.50
16cr_az='abcdefghijklmnopqrstuvwxyz'
17cr_AZ='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
18cr_09='0123456789'
19cr_alnum=$cr_az$cr_AZ$cr_09
20
21# also taken form autoconf
22case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
23  *c*,-n*) ECHO_N= ECHO_C='
24' ECHO_T='	' ;;
25  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
26  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
27esac
28
29
30mode=none
31for option
32do
33  case $option in
34    --vars)
35      mode=vars
36      ;;
37    *=*)
38      if test $mode != vars; then
39        echo "Warning: future versions will require --vars before variables are set"
40        mode=vars
41      fi
42      # Taken from autoconf 2.50
43      envvar=`expr "x$option" : 'x\([^=]*\)='`
44      optarg=`expr "x$option" : 'x[^=]*=\(.*\)'`
45      # Reject names that are not valid shell variable names.
46      expr "x$envvar" : ".*[^_$cr_alnum]" >/dev/null &&
47        { echo "$as_me: error: invalid variable name: $envvar" >&2
48      { (exit 1); exit 1; }; }
49      #echo $envvar $optarg
50      optarg=`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`
51      eval "$envvar='$optarg'"
52      export $envvar
53      ;;
54    --help)
55      echo "Usage: ./configure [--help | --vars VAR1=VAL1 ...]"
56      echo "  Note: Variables may also be set in the environment brefore running config"
57      echo "  Useful vars: ASPELL ASPELL_PARMS PREZIP DESTDIR"
58      exit 0
59      ;;
60    *)
61      echo "Error: unrecognized option $option";
62      exit 1
63    ;;
64  esac
65done
66
67#echo $ASPELL
68if test x = "x$ASPELL"
69  then ASPELL=aspell; fi
70if test x = "x$PREZIP"
71  then PREZIP=prezip-bin; fi
72#echo $ASPELL
73
74echo $ECHO_N "Finding Dictionary file location ... $ECHO_C"
75dictdir=`$ASPELL dump config dict-dir`
76echo $dictdir
77
78echo $ECHO_N "Finding Data file location ... $ECHO_C"
79datadir=`$ASPELL dump config data-dir`
80echo $datadir
81
82echo "ASPELL = `which $ASPELL`" > Makefile
83echo "ASPELL_FLAGS = $ASPELL_FLAGS" >> Makefile
84echo "PREZIP = `which $PREZIP`" >> Makefile
85echo "DESTDIR = $DESTDIR" >> Makefile
86echo "dictdir = $dictdir" >> Makefile
87echo "datadir = $datadir" >> Makefile
88echo                      >> Makefile
89cat Makefile.pre >> Makefile
90