source: trunk/kitgen/config.sh@ 194

Last change on this file since 194 was 175, checked in by demin, 12 years ago

initial commit

File size: 5.4 KB
Line 
1#set -x
2
3args="$*"
4
5verbose=0; case $1 in -v) verbose=1; shift ;; esac
6
7root=`dirname $1`
8base=`basename $1`
9shift
10
11case $root in .) root=8.4;; esac
12path=$root/$base
13
14if test ! -d $root
15 then echo "error: directory '$root' does not exist"; exit 1; fi
16
17for v in allenc allmsgs aqua b64 cli dyn gui ppc \
18 gcov gprof sym thread tzdata univ x86
19 do eval $v=0; done
20
21while test $# != 0
22 do eval $1=1; shift; done
23
24#for v in thread allenc allmsgs tzdata cli dyn gui aqua x86 ppc univ
25# do eval val=$`echo $v`; echo $v = "$val"; done
26
27make=$path/Makefile
28mach=`uname`
29plat=unix
30
31echo "Configuring $make for $mach."
32mkdir -p $path
33
34case $cli-$dyn-$gui in 0-0-0) cli=1 dyn=1 gui=1 ;; esac
35
36( echo "# Generated `date`:"
37 echo "# `basename $0` $args"
38 echo
39
40 case $mach in
41
42 Darwin)
43 case $aqua in
44 1) echo "GUI_OPTS = -framework Carbon -framework IOKit" ;;
45 *) echo "GUI_OPTS = -L/usr/X11R6/lib -lX11 -weak-lXss -lXext" ;;
46 esac
47
48 echo "LDFLAGS = -framework CoreFoundation"
49 echo "LDSTRIP = -x"
50
51 case $b64-$univ-$ppc-$x86 in
52 0-0-0-0) ;;
53 0-0-1-0) echo "CFLAGS += -arch ppc" ;;
54 0-0-0-1) echo "CFLAGS += -arch x86" ;;
55 0-?-?-?) echo "CFLAGS += -arch ppc -arch i386" ;;
56 1-0-1-0) echo "CFLAGS += -arch ppc64" ;;
57 1-0-0-1) echo "CFLAGS += -arch x86_64" ;;
58 1-?-?-?) echo "CFLAGS += -arch ppc64 -arch x86_64" ;;
59 esac
60 echo "CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \
61 "-mmacosx-version-min=10.4"
62
63 case $aqua in 1)
64 echo "TK_OPTS = --enable-aqua"
65 echo "TKDYN_OPTS = --enable-aqua" ;;
66 esac
67 ;;
68
69 Linux)
70 echo "LDFLAGS = -ldl -lm"
71 echo "GUI_OPTS = -L/usr/X11R6/lib -lX11 -lXft -lXss -lfontconfig"
72 case $b64 in 1)
73 echo "CFLAGS += -m64" ;;
74 esac
75 ;;
76
77 *BSD)
78 echo "CFLAGS += -I/usr/X11R6/include"
79 echo "LDFLAGS = -lm"
80 echo "GUI_OPTS = -L/usr/X11R6/lib -lX11 -lXss"
81 case $b64 in 1)
82 echo "CFLAGS += -m64" ;;
83 esac
84 ;;
85
86 MINGW*)
87 echo 'LDFLAGS = -lws2_32 build/lib/dde1*/tcldde1*.a build/lib/reg1*/tclreg1*.a'
88 echo 'GUI_OPTS = -lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32'
89 echo 'GUI_OPTS += -lole32 -loleaut32 -luuid -lwinspool'
90 echo 'GUI_OPTS += build/tk/wish.res.o -mwindows'
91 echo 'CLIOBJ = $(OBJ) $(OUTDIR)/tclAppInit.o $(OUTDIR)/tclkitsh.res.o'
92 echo 'DYNOBJ = $(CLIOBJ) $(OUTDIR)/tkdyn/wish.res.o'
93 echo 'GUIOBJ = $(OBJ) $(OUTDIR)/winMain.o $(OUTDIR)/tclkit.res.o'
94 echo 'PRIV = install-private-headers'
95 echo 'EXE = .exe'
96 plat=win
97 ;;
98
99 SunOS)
100 echo "LDFLAGS = -ldl -lsocket -lnsl -lm"
101 echo "GUI_OPTS = -lX11 -lXext"
102 ;;
103
104 *) echo "warning: no settings known for '$mach'" >&2 ;;
105 esac
106
107 echo "PLAT = $plat"
108 case $plat in unix)
109 echo "PRIV = install-private-headers" ;;
110 esac
111 case $b64 in 1)
112 echo "TCL_OPTS += --enable-64bit"
113 echo "TK_OPTS += --enable-64bit"
114 echo "VFS_OPTS += --enable-64bit"
115 echo "VLERQ_OPTS += --enable-64bit" ;;
116 esac
117
118 #case $verbose in 1) kitopts=" -d" ;; esac
119 case $allenc in 1) kitopts="$kitopts -e" ;; esac
120 case $allmsgs in 1) kitopts="$kitopts -m" ;; esac
121 case $tzdata in 1) kitopts="$kitopts -z" ;; esac
122
123 case $thread in
124 1) case $mach in Linux|SunOS)
125 echo "LDFLAGS += -lpthread" ;;
126 esac
127 echo "TCL_OPTS = --enable-threads"
128 echo "KIT_OPTS = -t$kitopts" ;;
129 0) echo "KIT_OPTS =$kitopts" ;;
130 esac
131
132 case $tzdata in 1) echo "TCL_OPTS += --with-tzdata" ;; esac
133
134 case $gprof in 1)
135 echo "CFLAGS += -pg"
136 sym=1 ;;
137 esac
138
139 case $gcov in 1)
140 echo "CFLAGS += -fprofile-arcs -ftest-coverage -O0"
141 echo "LDFLAGS += -lgcov"
142 sym=1 ;;
143 esac
144
145 case $sym in 1)
146 echo "STRIP = :"
147 echo
148 echo "TCL_OPTS += --enable-symbols"
149 echo "THREADDYN_OPTS += --enable-symbols"
150 echo "TK_OPTS += --enable-symbols"
151 echo "TKDYN_OPTS += --enable-symbols"
152 echo "VFS_OPTS += --enable-symbols"
153 echo "VLERQ_OPTS += --enable-symbols"
154 echo ;;
155 esac
156
157 case $cli in 1) targets="$targets tclkit-cli" ;; esac
158 case $dyn in 1) targets="$targets tclkit-dyn" ;; esac
159 case $gui in 1) targets="$targets tclkit-gui" ;; esac
160
161 case $thread in
162 1) echo "all: threaded$targets" ;;
163 0) echo "all:$targets" ;;
164 esac
165
166 case $mach in MINGW*)
167 echo
168 echo "tclkit-cli: tclkit-cli.exe"
169 echo "tclkit-dyn: tclkit-dyn.exe"
170 echo "tclkit-gui: tclkit-gui.exe"
171 esac
172
173 echo
174 echo "include ../../makefile.include"
175
176) >$make
177
178case $verbose in 1)
179 echo
180 echo "Contents of $make:"
181 echo "======================================================================="
182 cat $make
183 echo "======================================================================="
184 echo
185 echo "To build, run these commands:"
186 echo " cd $path"
187 echo " make"
188 echo
189 echo "This produces the following executable(s):"
190 case $cli in 1) echo " $path/tclkit-cli (command-line)" ;; esac
191 case $dyn in 1) echo " $path/tclkit-dyn (Tk as shared lib)" ;; esac
192 case $gui in 1) echo " $path/tclkit-gui (Tk linked statically)" ;; esac
193 echo
194 echo "To remove all intermediate builds, use 'make clean'."
195 echo "To remove all executables as well, use 'make distclean'."
196 echo
197esac
Note: See TracBrowser for help on using the repository browser.