Debian Codegraph @

contributed/linux-chimiak/.linux.configure

raw
1 #!/bin/sh
2 # This file is to configure the CTN software for Linux
3
4 echo "Requirements: "
5 echo " 1) This file should be in it's final place where the CTN binaries"
6 echo " and libraries will live."
7 echo " 2) This installation assumes that you will use Minerva SQL as the"
8 echo " data base."
9 echo "If any of these requirements is repellant to you or you have "
10 echo "not installed Minerva just say no to the continue question."
11
12 /bin/echo -n "Do you wish to continue (Y/N - Y is default)? "
13 read ANZ
14 case $ANZ in
15 [Nn]) exit ;;
16 [Nn]o) exit ;;
17 esac
18
19 ############### VARIABLE DEFININTIONS ########################
20
21 ROOTSKI=$PWD
22 DICOM_ROOT=$ROOTSKI
23 export DICOM_ROOT
24 /bin/echo "Your DICOM Root Directory is $DICOM_ROOT \n\n"
25 ############### END VARIABLE DEFININTIONS ########################
26
27 ############### Function DEFININTIONS ########################
28 #This function finds out where X libaries are located
29 whereisX()
30 {
31 # Find out where X11 is hiding
32 echo Searching for X11 libraries
33 XLIBRARYSTUFF=`find /usr/X11/lib -name "libX11*" -print`
34
35 # remember the directory
36 XLIBRARYSTUFF=`echo $XLIBRARYSTUFF | awk '{print $1 }'`
37
38 if [ ! -z $XLIBRARYSTUFF ]; then
39 XLIBRARYSTUFF=`dirname $XLIBRARYSTUFF`
40 /bin/echo "\t Got it. X11 library is at $XLIBRARYSTUFF\n"
41 else
42 /bin/echo "\t Could not find X windows in /usr. You are on your own"
43 exit 1
44 fi
45 XLIBVAR="-L$XLIBRARYSTUFF"
46 }
47 whereisX;
48
49 # For finding out where any of the rest of the X Libraries are
50 librarysrchr()
51 {
52 # Note that whereisX must be run first
53 /bin/echo Searching for $1 library
54
55 DALIB=""
56 DALIB=`find $XLIBRARYSTUFF -name $2 -print | awk '{ if (NR == 1 ) print $1 }'`
57 case $DALIB in
58 "") DALIB=`find /usr -name $2 -print | awk '{if (NR == 1 ) print $1 }'`
59 DALIB=`dirname $DALIB`
60 if [ -z $DALIB ] ; then
61 echo Could not find $2 libraries
62 exit 1
63 fi
64 ;;
65 *) /bin/echo "\t got it. The $1 library is at $DALIB"
66 DALIB=`dirname $DALIB`
67 ;;
68 esac
69 # if a library is in another place, the LIBPATH variable better know about it
70 echo $XLIBRARYSTUFF | grep $DALIB > /dev/null
71 if [ $? != 0 ]; then
72 XLIBVAR="$XLIBVAR -L$DALIB"
73 /bin/echo "\t XLibrary variable is $XLIBVAR"
74 fi
75 }
76
77 findXincludes()
78 {
79 # 1st variable is the name of the library
80 # 2nd variable is the actual Directory name
81 # Note that whereisX must be run first
82 /bin/echo "\nSearching for $1 Includes"
83
84 DAINC=""
85
86 if [ -d /usr/include/$2 ] ; then
87 DAINC=/usr/include/$2
88 elif [ -d /usr/X11/include/$2 ] ; then
89 DAINC=/usr/X11/include/$2
90 elif [ -d /usr/include/X11/$2 ] ; then
91 DAINC=/usr/X11/include/$2
92 else
93 DAINC=`find /usr -name $2 -print | awk '{ if (NR == 1 ) print $1 }'`
94 case $DAINC in
95 "") DAINC=`find /usr -name $2 -print | awk '{if (NR == 1 ) print $1 }'`
96 DAINC=`dirname $DAINC`
97 if [ -z $DAINC ] ; then
98 echo Could not find $2 libraries
99 exit 1
100 fi
101 ;;
102 *) /bin/echo "\t got it. The $1 library is at $DAINC"
103 DAINC=`dirname $DAINC`
104 ;;
105 esac
106 fi
107
108 # if a library is in another place, the LIBPATH variable better know about it
109 echo $XLIBRARYINCS | grep $DAINC
110 if [ $? != 0 ]; then
111 XINCVAR="$XINCVAR -I$DAINC"
112 /bin/echo "\t XInclude variable is $XINCVAR"
113 fi
114 }
115
116 findlinux_env()
117 {
118 echo "Finding (or creating) the Linux Environments directory"
119 if [ -d ./environments ]; then
120 if [ ! -d ./environments/linux ]; then
121 mkdir ./environments/linux
122 else
123 echo "found the environments/linux directory"
124 fi
125 else
126 echo Somehow this is not in the ctn directory. Change to the ctn directory
127 echo and run this. There should be an environments subdirectory.
128 fi
129 }
130
131 #To find out where the data base is
132 wheresminerva()
133 {
134 ######### Autofind #############
135 /bin/echo "\n I am looking for the Minerva Data base"
136 MSQL_ROOT=`find /usr/local -name Minerva -print | awk '{if (NR == 1) print $1}'`
137
138 if [ `basename $MSQL_ROOT`="Minerva" -a -d "$MSQL_ROOT" ]; then
139 /bin/echo "The Minerva SQL data base is at $MSQL_ROOT \n\n"
140 else
141 # Autofind failed #
142 echo "I did not find it under /usr/local"
143
144 /bin/echo "Do you know where Minerva is? "
145 /bin/echo "Input either C for me to look through all of your disks"
146 /bin/echo -n "and filesystems, or enter the path"
147
148 read ANZ
149 case $ANZ in
150 [Cc]*)
151 MSQL_ROOT=`find / -name Minerva -exec echo {} \;`
152 MSQL_ROOT=`echo $MSQL_ROOT | awk '{print $1}'`
153 echo it is $MSQL_ROOT ;;
154
155 "")
156 MSQL_ROOT=`find / -name Minerva -exec echo {} \;`
157 MSQL_ROOT=`echo $MSQL_ROOT | awk '{print $1}'`
158 echo it is $MSQL_ROOT ;;
159
160 *) MSQL_ROOT=$ANZ ;;
161 esac
162
163 if [ `basename $MSQL_ROOT`="Minerva" -a -d "$MSQL_ROOT" ]; then
164 echo I have found it at $MSQL_ROOT
165 else
166 echo "I did not find it. Exitting"
167 exit 1
168 fi
169 fi
170 }
171
172 find_the_bin_root()
173 {
174 /bin/echo "\nLooking for the DICOM binary root directory"
175 if [ -d ${DICOM_ROOT}/bin/linux.msql ]; then
176 DICOM_BIN=${DICOM_ROOT}/bin/linux.msql
177 export DICOM_BIN
178 elif [ -d ${DICOM_ROOT}/bin/ ]; then
179 mkdir ${DICOM_ROOT}/bin/linux.msql
180 DICOM_BIN=${DICOM_ROOT}/bin/linux.msql
181 export DICOM_BIN
182 /bin/echo "Your DICOM Binary root is $DICOM_BIN \n\n"
183 else
184 echo I could not find the DICOM_ROOT Directory. Are you sure
185 echo "you just did a tar extraction in this directory?"
186 echo "You did not move the $0 to another directory, did you?"
187 exit 1
188 fi
189 }
190
191 find_the_library_root()
192 {
193 if [ -d ${DICOM_ROOT}/lib/linux.msql ]; then
194 DICOM_LIB=${DICOM_ROOT}/lib/linux.msql
195 export DICOM_LIB
196 /bin/echo "Your DICOM Library root is $DICOM_LIB \n\n"
197 elif [ -d ${DICOM_ROOT}/lib/ ]; then
198 mkdir ${DICOM_ROOT}/lib/linux.msql
199 DICOM_LIB=${DICOM_ROOT}/lib/linux.msql
200 export DICOM_LIB
201 /bin/echo "Your DICOM Library root is $DICOM_LIB \n\n"
202 else
203 echo I could not find the DICOM_ROOT Directory. Are you sure
204 echo "you just did a tar extraction in this directory?"
205 echo "You did not move the $0 to another directory, did you?"
206 exit 1
207 fi
208 }
209
210 find_the_shell()
211 {
212 /bin/echo -n "Finding the shell for your environment. "
213 /bin/echo -n "It is >>> "
214
215 if [ `basename $SHELL` = "bash" ]; then
216 /bin/echo "bash \n\n"
217 elif [ `basename $SHELL` = "csh" ]; then
218 /bin/echo "csh \n\n"
219 elif [ `basename $SHELL` = "tcsh" ]; then
220 /bin/echo "tcsh \n\n"
221 elif [ `basename $SHELL` = "ksh" ]; then
222 /bin/echo "ksh \n\n"
223 elif [ `basename $SHELL` = "zsh" ]; then
224 /bin/echo "zsh \n\n"
225 elif [ `basename $SHELL` = "sh" ]; then
226 /bin/echo "sh \n\n"
227 else
228 echo " "; echo could not find it
229 echo bummers
230 echo Adios
231 exit 1
232 fi
233 }
234
235 get_cpu_info()
236 {
237 PROCR=`/bin/cat /proc/cpuinfo | /usr/bin/grep "cpu " | cut -d : -f 2`
238 echo You have a $PROCR Processor
239 case $PROCR in
240 " "[3456]86) ARCHITECTURE=LITTLE_ENDIAN_ARCHITECTURE
241 export ARCHITECTURE
242 ;;
243 [3456]86) ARCHITECTURE=LITTLE_ENDIAN_ARCHITECTURE
244 export ARCHITECTURE
245 ;;
246 *) /bin/echo "Is this a Big Endian or Little Endian Machine "
247 /bin/echo -n " (B or L LITTLE_ENDIAN_ARCHITECTURE is default)?"
248 read $ARCHITECTURE
249 case $ARCHITECTURE in
250 [Bb]) ARCHITECTURE=BIG_ENDIAN_ARCHITECTURE
251 export ARCHITECTURE
252 ;;
253 [Ll]) ARCHITECTURE=LITTLE_ENDIAN_ARCHITECTURE
254 export ARCHITECTURE=LITTLE_ENDIAN_ARCHITECTURE
255 ;;
256 esac
257 esac
258 }
259
260 ############### ENDFunction DEFININTIONS ########################
261
262 # # # # # # Begin Populate Variables # # # # # # # # # # # #
263
264 find_the_shell ;
265
266 find_the_bin_root;
267
268 find_the_library_root;
269
270 DICOM_INCLUDE=${DICOM_ROOT}/include
271 export DICOM_INCLUDE
272 echo Your DICOM includes are at $DICOM_INCLUDE
273
274 DICOM_MAKE=${DICOM_ROOT}/environments/linux/make.linux.msql
275 export DICOM_MAKE
276
277
278 ############### Populate the variables of the Global Makefile ###############
279
280 librarysrchr XPM libXpm.a
281 XPM_L="-L$DALIB"
282
283 librarysrchr XExtension libXext*
284 XEXTFIND=$DALIB
285
286 librarysrchr Motif libXm.a
287 XEXTFIND=$DALIB
288
289 /bin/echo "The X lib variable is $XLIBVAR \n\n"
290
291 findXincludes XWindows X11 ; findXincludes Motif Xm
292 MOTIF_BASE_INC=`dirname $DAINC`
293
294 ########### Find the Data Base ######################
295 wheresminerva ;
296 export MSQL_ROOT
297 MSQL_LIB="-L$MSQL_ROOT/lib"
298
299 PACSLIB=${DICOM_LIB}
300 export PACSLIB
301
302 get_cpu_info;
303
304 ###############################################################
305 LEX=flex
306 export LEX
307
308 #SUNOS works pretty good with Linux and for 2.8 works well
309 # was OS=SUNOS
310 OS=LINUX
311 export OS
312
313 CC=gcc
314 XCC=gcc
315 DBLINK=gcc
316 export CC XCC DBLINK
317 echo Your compiler is $CC
318
319 INSTALL=install
320 INSTALLUID="install -m 4775"
321 INSTALLINCLUDE="install -c -m 444 "
322 export INSTALLUID INSTALL INSTALLINCLUDE
323
324 echo "You are using $INSTALL as install, $INSTALLUID for INSTALLUID"
325 echo "and $INSTALLINCLUDE for INSTALLINCLUDE"
326
327 CI=ci
328 CO="co -l"
329 export CI CO
330
331 #indent changes the appearance of a C program by inserting/deleting whitespace.
332 INDENT="indent -i4 -nfc1 -di4 -nip -bc"
333 export INDENT
334
335 LINTOPTIONS=${DICOM_ROOT}/lint/minimal.lnt
336 export LINTOPTIONS
337
338 RANLIB=/usr/bin/ranlib
339 LD_LIBRARY_PATH=$DICOM_LIB
340 export RANLIB LD_LIBRARY_PATH
341
342 # # # # # Make the Global Makefile # # # # # # # # # # # # #
343 #findlinux_env; # this is not needed as the linux directory is there
344
345 cat > ${DICOM_ROOT}/environments/linux/make.linux.msql <<-end
346 # never used X11_LIBS variable in ctn: X11_LIBS = -L/usr/lib -lX11 -lXpm
347 # X11_LIBS = -L/usr/lib -lX11 -lXpm
348 #XAW_LIBS used in apps/print_clients
349 XAW_LIBS = -lXaw -lXmu -lXt -lXext -lm -lXpm
350
351 #LIBPATH_X11 = -L/usr/lib/X11
352 LIBPATH_X11 = $XLIBVAR
353
354 # LIBPATH_MOTIF used in apps in assoc_tool cfg_ctn_tables idb_viewer
355 # object_viewer pmgr_motif print_server query_client rsa_ui wlma_ui
356 # Do not believe this is a necessary variable as LIBPATH_X11 will contain
357 # the neccesary libraries as called by the Makefiles
358 # LIBPATH_MOTIF = -L/usr/X11/lib
359 LIBPATH_MOTIF =
360
361 LIBPATH_UCB =
362 LIBS_X11 = -lXext -lXt -lICE -lSM -lX11 -lXm -lXpm -lm
363 LIBS_MOTIF = -lXm
364 LIBS_XAW = -lXaw -lXmu -lXt -lXext -lm -lXm -lXpm
365 #LIBS_OS = -lm -lsocket -lnsl -lgen -lc
366 LIBS_OS =
367
368 LIBPATH_DATABASE = $MSQL_LIB
369 LIBS_DATABASE = -ltbl_msql -lmsql
370 LIBS_LEX = -lfl
371 LIBS_CTN = -lmanage -liap -licon -lprint -lsnp -lfis -lidb \\
372 -ldatabase -lhunk_man -lcfg -lservices -lmessages \\
373 -lsq -ldcmobjects -ldulprotocol -luid -llst -lgq \\
374 -lie -lutility -lcondition -lmut\\
375 \$(LIBPATH_DATABASE) \$(LIBS_DATABASE)
376
377 XM_INCLUDE = /usr/X11R6/include
378
379 # malincrodt says no CFLAGS_X11 CFLAGS_X11 = $XINCVAR
380 CFLAGS_X11 =
381
382 #CFLAGS_MOTIF = -I/usr/X11/include
383 CFLAGS_MOTIF = -I$MOTIF_BASE_INC
384 #DEBUG_LIBS = -lmalloc
385
386 # malincrodt says do this SYBASE_INCLUDE = .
387 SYBASE_INCLUDE = .
388
389 LONGSIZE=32
390 INTSIZE=32
391 SHORTSIZE=16
392 C_OPTS = -g -DDEBUG -D\$(ARCHITECTURE) -DLINUX \\
393 -DSHARED_MEMORY \\
394 -DSEMAPHORE -DX11 -DATHENA -DMOTIF -DX11R4 -DUSLEEP -DMSQL -DLINUX \\
395 -DUSEREGCOMP -I\$(DICOM_INCLUDE) -I\$(MSQL_ROOT)/include \\
396 \$(CFLAGS_MOTIF) \$(CFLAGS_X11) \\
397 -DLONGSIZE=\$(LONGSIZE) -DINTSIZE=\$(INTSIZE) \\
398 -DSHORTSIZE=\$(SHORTSIZE)
399 end
400