Intial commit
[profile/ivi/w3m.git] / Bonus / oldconfigure.sh
1 #! /bin/sh
2 #
3 # oldconfig.sh: convert a config.param file and execute configure
4 #
5
6 # functions
7 opt_push () {
8 #  OPT="${OPT} $1"
9   OPT="${OPT}   \\
10         $1"
11 }
12
13 opt_enable_set () {
14   val=""
15   if test x"$1" = xy; then
16     val="--enable-$2"
17   elif test x"$1" = xn; then
18     val="--disable-$2"
19   fi
20   if test x"$val" != x; then
21     opt_push "$val"
22   fi
23 }
24
25 opt_with_set () {
26   val=""
27   if test x"$1" != x; then
28     val="--with-$2='$1'"
29   else
30     val="--without-$2"
31   fi
32   if test x"$val" != x; then
33     opt_push "$val"
34   fi
35 }
36
37 env_set () {
38   # no overwrite
39   if test x"$1" != x && eval "test -z \"\$$1\"" > /dev/null; then
40     echo "$1='$2'; export $1"
41     eval "$1='$2'; export $1"
42   fi
43 }
44
45 # main
46 topdir="`dirname $0`/.."
47
48 if test x"$1" = x-v; then
49   echo_only=yes
50   shift
51 fi
52 if test x"$1" = x; then
53   echo "USAGE: $0 [-v] <config.param file>"
54   echo "    option: -v ... echo only"
55   exit 1
56 fi
57
58 if expr "$1" : '.*/' > /dev/null; then
59   conffile="$1"
60 else
61   conffile=./"$1"
62 fi
63 . "$conffile" # read config.param
64
65 OPT=""
66 libdir=`echo $libdir | sed 's@/w3m[^/]*/cgi-bin@@'`
67 libexecdir=`echo $auxbindir | sed 's@/w3m[^/]*@@'`
68 datadir=`echo $helpdir | sed 's@/w3m[^/]*@@'`
69 sysconfdir=`echo $sysconfdir | sed 's@/w3m[^/]*@@'`
70 opt_push "--bindir='$bindir'"
71 opt_push "--libexecdir='$libexecdir'"
72 opt_push "--datadir='$datadir'"
73 opt_push "--sysconfdir='$sysconfdir'"
74 opt_push "--libdir='$libdir'"
75 opt_push "--mandir='$mandir'"
76
77 #case "$dmodel" in
78 #  1) val=baby;;
79 #  2) val=little;;
80 #  3) val=mouse;;
81 #  4) val=cookie;;
82 #  5) val=monster;;
83 #  *) echo "ERROR: Illegal model type (model=$dmodel)."
84 #     exit 1;;
85 #esac
86 #opt_push "--enable-model=$val"
87
88 case "$lang" in
89   JA)
90     if test x$display_code != x; then
91       opt_push "--enable-japanese='$display_code'"
92     else
93       opt_push "--enable-japanese"
94     fi
95     opt_enable_set "$kanji_symbols" kanjisymbols
96     ;;
97   *)
98     ;;
99 esac
100
101 opt_enable_set "$use_color" color
102 opt_enable_set "$use_ansi_color" ansi-color
103 opt_enable_set "$use_bg_color" bgcolor
104 if test x"$use_migemo" = xy; then
105   if test x"$def_migemo_command" != x; then
106     opt_push "--with-migemo='$def_migemo_command'"
107   fi
108 elif test x"$use_migemo" = xn; then
109   opt_push "--without-migemo"
110 fi
111 opt_enable_set "$use_mouse" mouse
112 opt_enable_set "$use_menu" menu
113 opt_enable_set "$use_cookie" cookie
114 opt_enable_set "$use_dict" dict
115 opt_enable_set "$use_history" history
116 opt_enable_set "$use_digest_auth" digest-auth
117 opt_enable_set "$use_nntp" nntp
118 opt_enable_set "$use_gopher" gopher
119 if test x"$use_lynx_key" = xy; then
120   opt_push "--enable-keymap=lynx"
121 else
122   opt_push "--enable-keymap=w3m"
123 fi
124 opt_with_set "$ded" editor
125 opt_with_set "$dmail" mailer
126 opt_with_set "$dbrowser" browser
127 opt_enable_set "$use_help_cgi" help-cgi
128 opt_enable_set "$use_external_uri_loader" external-uri-loader
129 opt_enable_set "$use_w3mmailer" w3mmailer
130 opt_enable_set "$use_alarm" alarm
131 if test x"$use_image" = xy; then
132   val_x11=""
133   val_fb=""
134   if test x"$use_w3mimg_x11" = xy; then
135     val_x11="x11"
136   fi
137   if test x"$use_w3mimg_fb" = xy; then
138     if test x"$w3mimgdisplay_setuid" = xy; then
139       val_fb="fb+s"
140     else
141       val_fb="fb"
142     fi
143   fi
144   if test x"$val_x11" != x; then
145     if test x"$val_fb" != x; then
146       val="$val_x11,$val_fb"
147     else
148       val="$val_x11"
149     fi
150   elif test x"$val_fb" != x; then
151     val="$val_fb"
152   fi
153
154   if test x"$val" = x; then
155     opt_push "--enable-image"
156   else
157     opt_push "--enable-image='$val'"
158   fi
159
160   opt_enable_set "$use_xface" xface
161 elif test x"$use_image" = xn; then
162   opt_push "--disable-image"
163 fi
164 if test x"$dtermlib" != x; then
165   dtermlib=`echo "$dtermlib"|sed 's/^-l//'`
166   opt_with_set "$dtermlib" termlib
167 fi
168 if test x"$use_ssl" = xy; then
169   opt_push "--with-ssl"
170   opt_enable_set "$use_ssl_verify" sslverify
171 elif test x"$use_ssl" = xn; then
172   opt_push "--without-ssl"
173 fi
174 opt_enable_set "$use_ipv6" ipv6
175
176 env_set CC "$dcc"
177 env_set CFLAGS "$dcflags"
178 env_set LDFLAGS "$dldflags"
179
180 echo "( cd '$topdir' && sh configure ${OPT} )"
181 if test "${echo_only+set}" != set; then
182   echo "( cd '$topdir' && sh configure ${OPT} )" | sh
183 fi