This repository has been archived by the owner on Jul 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup2
executable file
·1064 lines (920 loc) · 32.7 KB
/
setup2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/csh
#############################################################################
# $Id$
# Set up configuration file for building BL3DEMC Software - the real one
#
#
# Global setup
#
set imod_copyright = '1994-2012'
set lab_name1 = 'Boulder Laboratory for 3-Dimensional'
set lab_name2 = 'Electron Microscopy of Cells'
set source_dir = `pwd`
set endian_dir = include
set configure = configure
set hconfigure = include/imodconfig.tmp
set hconffinal = include/imodconfig.h
set debug = false
set bin_dir = $source_dir/bin
set inc_dir = $source_dir/include
set lib_dir = $source_dir/buildlib
set libhelp_dir = $source_dir/html/libhelp
set htmlman_dir = $source_dir/html/man
set plughelp_dir = $source_dir/html/plughelp
set include_flags = "-I. -I$inc_dir"
set optimization = "-O2"
set gfx = default
set compiler = default
set machine =
set defines =
set shared_libs = default
set intelstat = false
set flags =
set fallback =
set swap_ieee = true
set no_xlibs = false
set distname = ""
set packqt = true
set useqt = true
set qtthread = true
set m64bit = false
set m64notIA = false
set intel = false
set use_etomo =
set packg2c = false
set no_qt3 = true
set inst_dir = default
set tifflibs = default
set dummytiff =
set usfftdir = default
set wrapintel = true
set openmp = true
set blockio =
set imsubsobj = '*.o'
set tiltalilib =
set tilt_dir = flib/tilt
set fbpswitch = fbpswitch-def.inc
set midas_dir = midas
set sendevent_dir = qttools/sendevent
set imod_dir = 3dmod
set qtassist_dir = qttools/qtassist
set sourcedoc_dir = qttools/sourcedoc
set ctfplot_dir = ctfplotter
set ctfplot_flibs = ""
set prochunk_dir = qttools/processchunks
set mrc2tif_dir = qttools/mrc2tif
set plugsrc_dir = plugs
set libdiaqt_dir = libdiaqt
set etomo_dir = Etomo
set pysrc_dir = pysrc
set scripts_dir = scripts
set midas_qconf = midas/qconfigure
set imod_qconf = 3dmod/qconfigure
set sendevent_qconf = $sendevent_dir/qconfigure
set qtassist_qconf = $qtassist_dir/qconfigure
set sourcedoc_qconf = $sourcedoc_dir/qconfigure
set ctfplot_qconf = ctfplotter/qconfigure
set prochunk_qconf = $prochunk_dir/qconfigure
set mrc2tif_qconf = $mrc2tif_dir/qconfigure
set sourcedoc_exe = sourcedoc
set qtdel1 = ""
set fort_cpplibs =
set ctrl_string = Ctrl
set ld_lib_var = LD_LIBRARY_PATH
set qtapp_path =
set xplax = (qtplax.o moc_qtplax.o)
set objext = o
set binext =
set limod = -limod
set lcfshr = -lcfshr
set liimod = -liimod
set ltiff = -ltiff
set lhdf = ''
set ldnmncar = -ldnmncar
set lifft = -lifft
set limesh = -limesh
set liwarp = -liwarp
set nnvulnflags = -ffloat-store
set lapacklibs = '-lb3dlapk -lb3dblas'
set lapack_flibs = ''
set lapacklink = '$(CC)'
set fort_cpplibs = ''
set ldfflags = '$(LDFLAGS)'
set farflags = '$(ARFLAGS)'
set libtrackFlags = '$(LIBFFLAGS)'
set dllext = '$(LIBEXT)'
set moc = '$(QTDIR)/bin/moc'
set openmpfFlags = '$(OPENMP)'
set macsdkFlags = ''
set rgbprogs =
set makestaticlib = "ar ruv "
set staticranlib = ranlib
set staticext = a
set makenmcar = '$(AR) $(ARFLAGS)'
set nmcarext = '$(LIBEXT)'
set far = '$(AR)'
set lwmod = -lwmod
set lsmlmod = -lsmlmod
set wmodext = '$(DLLEXT)'
set makewmod = '$(FAR) $(FARFLAGS)'
set junit_home = /usr/local/junit
set jfcunit_home = /usr/local/jfcunit
set class_sep = ':'
set strip = strip
set rmcmd = '/bin/rm -f'
set qtincdir = '$(QTDIR)/include'
set qt_flags = '-I$(QTINCDIR) -I$(QTINCDIR)/QtCore -I$(QTINCDIR)/QtOpenGL -I$(QTINCDIR)/QtGui -I$(QTINCDIR)/QtSql'
set qt3_flags = '-DQT3_SUPPORT -I$(QTINCDIR)/Qt3Support'
# rhlinux uses ldd on assistant to get this list and adds OpenGL
set qt4libstocopy = 'QtOpenGL QtNetwork QtCore QtGui QtXml QtHelp QtSql QtCLucene'
set qt3supportcopy = ""
set assistantcopy = ''
set midasGL = "-lQtOpenGL"
set nogpu = ""
set suffix = ""
set b3dbyte = "char"
set ubyte = "unsigned char"
set int16 = "short int"
set uint16 = "unsigned short int"
set int32 = "int"
set uint32 = "unsigned int"
set float32 = "float"
set inargv = ($argv)
# This gives legacy behavior of passing on exit status of command in set var=`command`
# Needed by macosx
set anyerror
#
# Input options
#
while($#argv > 0)
switch($argv[1])
case -d:
case -debug:
set debug = true
breaksw
case -shared:
set shared_libs = true
breaksw
case -no_shared:
set shared_libs = false
breaksw
case -tiff:
set tifflibs = true
breaksw
case -no_tiff:
set tifflibs = false
breaksw
case -m:
case -mach:
case -machine:
shift
set machine = $argv[1]
breaksw
case -flags:
shift
set flags = "$argv[1]"
breaksw
case -i:
case -inst:
shift
set inst_dir = $argv[1]
breaksw
case -compiler:
case -c:
shift
set compiler = $argv[1]
breaksw
case -swapieee:
set swap_ieee = true
breaksw
case -swapvms:
set swap_ieee = false
breaksw
case -no_xlibs:
set no_xlibs = true
breaksw
case -qt3:
set no_qt3 = false
set qt3supportcopy = 'Qt3Support'
breaksw
case -name:
shift
set distname = _$argv[1]
breaksw
case -static:
set intelstat = true
breaksw
case -use_etomo:
shift
set use_etomo = $argv[1]
breaksw
case -packg2c:
set packg2c = true
breaksw
case -no_openmp:
set openmp = false
breaksw
case -nowrap:
set wrapintel = false
breaksw
case -no_gpu:
shift
set nogpu = $argv[1]
if ($?CUDA_DIR) unsetenv CUDA_DIR
breaksw
case -suffix:
shift
set suffix = $argv[1]
breaksw
case -h:
case -help:
goto usage
default:
echo Bad option
goto usage
breaksw
endsw
shift
end
# Set common flags if doing CUDA
if ($?CUDA_DIR) then
set nvcc_flags = '-arch sm_10 -maxrregcount 32 -I"'"$CUDA_DIR"'/include" -I../../include'
set cudalibs = "-L$CUDA_DIR/lib -lcudart -lcufft"
endif
#
# get more machine specifics - USYSTEM was done in setup
#
set UMACHINE = `uname -m | sed '/ /s//_/g'`
set URELEASE = `uname -r`
#set UVERSION = `uname -v`
#set target_computer = {$UMACHINE}__{$USYSTEM}__{$URELEASE}__{$UVERSION}
set target_computer = {$UMACHINE}__{$USYSTEM}__{$URELEASE}__all
#
# Create imodconfig.h file
#
set imod_version = `sed '/\./s///g' .version`
# This nightmare was needed under cygwin
set imod_version_name = `sed '/.\(*\[0-9.]*\).*/s//\1/' .version`
cat << EOF >! $hconfigure
/* THIS FILE IS GENERATED BY SETUP: DO NOT EDIT */
#ifndef IMOD_CONFIG_INCLUDED
#define IMOD_CONFIG_INCLUDED
#define VERSION $imod_version
#define VERSION_NAME "$imod_version_name"
#define COPYRIGHT_YEARS "$imod_copyright"
#define LAB_NAME1 "$lab_name1"
#define LAB_NAME2 "$lab_name2"
EOF
#
# Copy default include file for Fortran byte-ordering
# Set up default include file for number of bytes per item when defining
# record length for direct unformatted I/O
\cp $endian_dir/big_endian.inc $endian_dir/endian.inc
echo " parameter (nbytes_recl_item=1)" >! $endian_dir/recl_bytes.inc
# Was this needed? Need to research. Don't want to confuse VisualC
#if ($debug == false) then
# echo "#define NDEBUG" >> $hconfigure
#endif
#
# Create make config file
#
echo "# Configure file for making BL3DFS software." >! $configure
echo "# Do not edit this file it is created by setup." >> $configure
echo "# setup for $target_computer" >> $configure
echo " " >> $configure
echo "IMOD_VERSION $imod_version_name"
#
# Set up defaults for makefile copying
#
set makefile_ext = unix
set makefile_dirs = ($libdiaqt_dir $plugsrc_dir)
#
# Set up directory names
#
if ($inst_dir == default) set inst_dir = $source_dir
set inst_bin_dir = $inst_dir/bin
set inst_lib_dir = $inst_dir/lib
set inst_plug_dir = $inst_dir/lib/imodplug
set inst_plug_parent = $inst_dir/lib
# Make this for some machine scripts to copy to
#
mkdir -p $lib_dir
# Manage files that have to be in place before qmakes are run
# update imod_assistant files in subsidiary directories
#
foreach dir ($qtassist_dir $ctfplot_dir $midas_dir)
\find $dir -name imod_assistant.cpp ! -newer $imod_dir/imod_assistant.cpp -exec \rm -f '{}' \;
\find $dir -name imod_assistant.h ! -newer $imod_dir/imod_assistant.h -exec \rm -f '{}' \;
if (! -e $dir/imod_assistant.cpp) \cp $imod_dir/imod_assistant.cpp $dir
if (! -e $dir/imod_assistant.h) \cp $imod_dir/imod_assistant.h $dir
end
\find $mrc2tif_dir -name tiff.c ! -newer mrc/tiff.c -exec \rm -f '{}' \;
if (! -e $mrc2tif_dir/tiff.c) \cp mrc/tiff.c $mrc2tif_dir
# Make lists of qt directories and project names. List them in order of
# the ones that can be treated the same for runscripts, etc, then midas, then
# oddballs
#
set qdir = ($sendevent_dir $qtassist_dir $ctfplot_dir $prochunk_dir $mrc2tif_dir \
$midas_dir $imod_dir $sourcedoc_dir)
set qprog = (imodsendevent imodqtassist ctfplotter processchunks mrc2tif midas 3dmod \
sourcedoc)
set qconf = ($sendevent_qconf $qtassist_qconf $ctfplot_qconf $prochunk_qconf \
$mrc2tif_qconf $midas_qconf $imod_qconf $sourcedoc_qconf)
# Manage imodhelp for the qmake without having to delete a good one
if (! -e $imod_dir/imodhelp.h) touch $imod_dir/imodhelp.h
#
# Go To Machine dependent parts.
#
if ($machine != "") then
echo target is $machine
goto $machine
endif
switch($target_computer)
case *__IRIX64__6.0*:
case *__IRIX__6.0*:
case *__IRIX64__6.1*:
case *__IRIX__6.1*:
case *__IRIX64__6.2*:
case *__IRIX__6.2*:
echo target computer is SGI running $USYSTEM $URELEASE
set machine = irix6-32
goto irix6-32
breaksw
case *__IRIX64__6*:
case *__IRIX__6*:
echo target computer is SGI running $USYSTEM $URELEASE
set machine = irix6-n32
goto irix6-n32
breaksw
case *__IRIX__5.3*:
echo target computer is SGI running $USYSTEM $URELEASE
set machine = irix5
goto irix5
breaksw
case sun4*__SunOS__5.*__*:
echo $target_computer is solaris
set machine = solaris
goto solaris
breaksw
# Red Hat Linux on Intel (i686 for the time being 6 21 00)
case i686__Linux__*__*:
echo $target_computer is Intel running Red Hat Linux
set machine = rhlinux
goto rhlinux
breaksw
# AMD64 Linux (SuSe 9.0)
# added by CER March 3, 2003
case x86_64__Linux__*__*:
echo $target_computer is AMD64 running Linux
set machine = rhlinux
goto amd64linux
breaksw
case ia64__Linux__*__*:
echo $target_computer is Itanium running Linux
set machine = rhlinux
goto itanium
breaksw
# Cygwin on Intel
case *__CYGWIN_NT-*.*WOW64__*__*:
case x86_64__CYGWIN_NT-*.*__*__*:
echo $target_computer is Intel running Cygwin under Windows-64
set machine = cygwin64
goto cygwin64
breaksw
case i686__CYGWIN_NT-*.*__*__*:
echo $target_computer is Intel running Cygwin under Windows
set machine = cygwin
goto cygwin
breaksw
case Power_Macintosh__Darwin__*__*:
echo $target_computer is Power Macintosh running OSX
set machine = macosx
goto macosx
breaksw
case i386__Darwin__*__*:
case x86_64__Darwin__*__*:
echo $target_computer is Intel running OSX
set machine = macosx
goto intelosx
breaksw
default:
echo WARNING: no definition for $target_computer
echo $target_computer error
breaksw
endsw
#############################################################################
#
# The default system, to document the meaning of the variables that need
# to be defined.
#
echo "You need to specify a machine; the generic settings are not usable"
exit 1
# define the compilers to use
echo "CC = cc" >> $configure
echo "CXX = CC" >> $configure
echo "CPPC = CC" >> $configure
set fcomp = "f77"
# May need to define as \cp and \find if you have aliases
echo "CP = cp" >> $configure
echo "FIND = find" >> $configure
# define how to make libraries - see specific machines for shared libs
echo "AR = ar" >> $configure
echo "ARCPP = ar" >> $configure
echo "ARFLAGS = r " >> $configure
echo 'LDFLAGS = -L$(LIBDIR)' >> $configure
echo "RANLIB = ranlib" >> $configure
echo 'MAKELIB = $(AR) $(ARFLAGS)' >> $configure
# MAKELIBCPP needs to be defined to make a library from cpp files.
# MAKELIBSO needs to be defined to describe how to make a .so plugin
# from .o files; all systems are OK with MAKELIB for shared libraries
# Basic C libraries, used to build almost all programs, C and Fortran; but
# the Fortran Makefiles use FORTCLIBS
echo "CLIBS = -lm -lc" >> $configure
echo 'LIBS = $(CLIBS)' >> $configure
echo 'FORTCLIBS = $(LIBS)' >> $configure
# Libraries for programs using X
echo "XLIBS = -lXm -lXt -lX11 -lXext" >> $configure
# Libraries for non-graphical and graphics Fortran programs
echo "IMLIBS = -lhvem -lim -lifft -lcfshr" >> $configure
echo 'GRAPHLIBS = '"$ldnmncar"' $(IMLIBS) $(XLIBS)' >> $configure
# extra library and option entries for making imod run plugins
echo 'PLUGLIBS = ' >> $configure
# Command for building a Fortran plugin
echo 'MAKEF77PLUGIN = ld $(LDFLAGS) -shared -all -lftn -o' >> $configure
# set compilation flags for debugging
if ($debug == true) then
set optimization = "-g"
endif
# A slew of compilation flags - on the SGI, some Fortran programs needed not
# to be optimized, hence NOOPFLAGS. Some Fortran and C programs don't
# work with -n32, so they have to be done with "fallback" flags that compile
# them -32. For all other machines, the fallback flags can match the regular
# ones, as they do here
# you can set "defines" with extra defines for C programs, but it's better to
# use imodconfig instead
# also note that the flags variable is a way for flags to be added on
# the command-line, and to be defined globally for all compilations
echo "CFLAGS = $flags $defines $optimization $include_flags" >> $configure
echo "CXXFLAGS = $flags $defines $optimization $include_flags" >> $configure
echo "FFLAGS = $flags $optimization $include_flags" >> $configure
echo "NOOPFFLAGS = $flags $optimization -O0 $include_flags" >> $configure
echo "LIBCFLAGS = $flags $defines $optimization $include_flags" >> $configure
echo "LIBFFLAGS = $flags $optimization $include_flags" >> $configure
echo "FFALLBACK = $flags $optimization $include_flags" >> $configure
echo "CFALLBACK = $flags $defines $optimization $include_flags" >> $configure
echo 'LDFALLBACK = $(LDFLAGS)' >> $configure
echo 'NOOPFFALLBACK = $(NOOPFFLAGS)' >> $configure
# Make tilt program from Fortran subroutines
echo 'TILTOBJS = bpsumnox.o bpsumxtilt.o bpsumlocal.o' >> $configure
# To indicate that librandm and libdtrigs need to be built
echo 'LINUXFLIBS = ' >> $configure
goto standard_defines
###########################################################################
# SGI running IRIX 6
#
irix6-32:
irix6:
irix6-n32:
irix5:
source machines/irix5-6
goto standard_defines
#############################################################################
# Intel running Linux
#
itanium:
set m64bit = true
goto rhlinux
amd64linux:
set m64bit = true
set m64notIA = true
rhlinux:
source machines/rhlinux
goto standard_defines
#############################################################################
# Cygwin on Intel
#
cygwin64:
set m64bit = true
set machine = cygwin
cygwin:
dos2unix machines/cygwin >& /dev/null
source machines/cygwin
goto standard_defines
#############################################################################
# Macintosh
#
intelosx:
set machine = macosx
set intel = true
macosx:
source machines/macosx
goto standard_defines
##############################################################################
# Solaris 2.x or SunOS5 using gcc compiler.
#
solaris:
source machines/solaris
goto standard_defines
##############################################################################
# Defines used for every system:
#
standard_defines:
if (($tifflibs == default) || ($tifflibs == false)) then
echo 'DUMMYTIFF = libtiff.$(DLLEXT)' >> $configure
echo "TIFFLIBS = $ltiff" >> $configure
echo '#define NOTIFFLIBS' >> $hconfigure
else
if ($tifflibs == true) set tifflibs = "$ltiff"
echo "DUMMYTIFF = $dummytiff" >> $configure
echo "TIFFLIBS = $tifflibs" >> $configure
endif
if ($shared_libs == false) set inst_lib_dir = $lib_dir
cat <<EOF >> $configure
OBJEXT = $objext
BINEXT = $binext
LIMOD = $limod
LCFSHR = $lcfshr
LIIMOD = $liimod $lhdf
LIFFT = $lifft
LIMESH = $limesh
LIWARP = $liwarp
NNVULNFLAGS = $nnvulnflags
LAPACKLIBS = $lapacklibs
LAPACKLINK = $lapacklink
LAPACK_FLIBS = $lapack_flibs
FORT_CPPLIBS = $fort_cpplibs
BLOCKIO = $blockio
IMSUBSOBJ = $imsubsobj
TILTALILIB = $tiltalilib
BINDIR = $bin_dir
INSTBINDIR = $inst_bin_dir
LIBDIR = $lib_dir
INSTLIBDIR = $inst_lib_dir
INSTDIR = $inst_dir
HTML_ARCDIR = $source_dir/imod_${imod_version_name}_docs
INCDIR = $inc_dir
IMOD_PLUGIN_DIR = $inst_plug_dir
PLUG_HELP_DIR = $plughelp_dir
MOC = $moc
%.$objext : %.f90
\$(FC) -c \$(FFLAGS) \$< -o \$@
EOF
# Output the entries for Tilt using GPU or not
#
if ($?CUDA_DIR) then
echo "NVCC_FLAGS = $nvcc_flags" >> $configure
echo "CUDALIBS = $cudalibs" >> $configure
echo 'TILTGPUOBJ = gpubp.$(OBJEXT)' >> $configure
else
echo 'TILTGPUOBJ = nogpu.$(OBJEXT)' >> $configure
endif
if ($?HDF5_DIR) then
echo 'HDFOBJS = iihdf.$(OBJEXT) hdf_imageio.$(OBJEXT)' >> $configure
else
echo '#define NO_HDF_LIB' >> $hconfigure
endif
cat << EOF >> $hconfigure
#define CTRL_STRING "$ctrl_string"
typedef $b3dbyte b3dByte;
typedef $ubyte b3dUByte;
typedef $int16 b3dInt16;
typedef $uint16 b3dUInt16;
typedef $int32 b3dInt32;
typedef $uint32 b3dUInt32;
typedef $float32 b3dFloat;
#endif
EOF
#
# Make the directories if needed.
#
mkdir -p $bin_dir
mkdir -p $lib_dir
mkdir -p $libhelp_dir
mkdir -p $plughelp_dir
mkdir -p $htmlman_dir
mkdir -p $inst_bin_dir
mkdir -p $inst_lib_dir
mkdir -p $inst_plug_parent
mkdir -p $inst_plug_dir
mkdir -p $inst_dir/com
mkdir -p $inst_dir/autodoc
mkdir -p $inst_dir/SystemTemplate
mkdir -p $inst_dir/html
mkdir -p $inst_dir/man/cat1
mkdir -p $inst_dir/man/cat5
if ($?FFTW3_DIR) echo 'CFFTOBJS = fftw_wrap.$(OBJEXT)' >> $configure
if ($machine != cygwin) then
#
# manage qconfigure files
#
echo LIBS += -L$lib_dir -liimod -limod -liwarp -lcfshr -ldiaqt $ltiff $lhdf $lifft $midasGL >> $midas_qconf
echo LIBS += -L$lib_dir -lm -lb3dlapk -lb3dblas -liimod -lcfshr $ltiff $lhdf $lifft $lapack_flibs >> $ctfplot_qconf
echo LIBS += -L$lib_dir -lcfshr >! $qtassist_qconf
echo LIBS += -L$lib_dir -lcfshr >> $prochunk_qconf
echo LIBS += -L$lib_dir -liimod -lcfshr $ltiff $lhdf >> $mrc2tif_qconf
foreach i ($midas_qconf $ctfplot_qconf)
echo INCLUDEPATH += $inc_dir >> $i
echo MOC_DIR = tmp >> $i
echo OBJECTS_DIR = tmp >> $i
echo target.path = $inst_bin_dir >> $i
if ($no_qt3 == false) echo 'QT += qt3support' >> $i
end
echo target.path = $inst_bin_dir >! $sendevent_qconf
echo target.path = $inst_bin_dir >> $qtassist_qconf
echo target.path = $inst_bin_dir >> $prochunk_qconf
echo target.path = $inst_bin_dir >> $mrc2tif_qconf
echo -n >! $sourcedoc_qconf
# echo gives two \\ in tcsh 6.12 under RH 8.0 so use cat
#
cat <<EOF >> $imod_qconf
INSTALLS += 3dmodv
MOC_DIR = tmp
OBJECTS_DIR = tmp
INCLUDEPATH += $inc_dir
target.path = $inst_bin_dir
3dmodv.path = $inst_bin_dir
EOF
if ($no_qt3 == false) echo 'QT += qt3support' >> $imod_qconf
foreach i ($qconf)
if ($debug == true) then
echo CONFIG += debug warn_on >> $i
set qmflag = DEBUG
else
echo CONFIG += release warn_off >> $i
set qmflag = RELEASE
endif
if ($m64notIA == true) echo QMAKE_CXXFLAGS_$qmflag += -m64 >> $i
if ($m64notIA == true) echo QMAKE_CFLAGS_$qmflag += -m64 >> $i
if ($openmp == true) then
echo QMAKE_CXXFLAGS_$qmflag += $openmpFlags >> $i
echo QMAKE_CFLAGS_$qmflag += $openmpFlags >> $i
echo QMAKE_LFLAGS_$qmflag += $openmpFlags >> $i
endif
if ("$macsdkFlags" != '') echo QMAKE_CFLAGS_$qmflag += $macsdkFlags >> $i
if ("$macsdkFlags" != '') echo QMAKE_CXXFLAGS_$qmflag += $macsdkFlags >> $i
if ($qtthread == true) then
echo CONFIG += thread >> $i
echo DEFINES += QT_THREAD_SUPPORT >> $i
endif
end
# Finish qconfigure install instructions now that inst_bin_dir is defined
#
if ($machine != "macosx") then
cat <<EOF >> $imod_qconf
3dmodv.extra = strip 3dmod ; cd $inst_bin_dir ; \
if [ -e 3dmod ] ; then strip 3dmod ; fi ; rm -f 3dmodv imod imodv ; \
ln -s 3dmod 3dmodv ; ln -s 3dmod imod ; ln -s 3dmodv imodv
EOF
@ i = 0 # Loop on imodsendevent imodqtassist ctfplotter pchunk mrc2tif midas
while ($i < 6)
@ i++
cat <<EOF >> $qconf[$i]
INSTALLS += strip
strip.path = $inst_bin_dir
strip.extra = $strip $qprog[$i] ; if [ -e $inst_bin_dir/$qprog[$i] ] ; then $strip $inst_bin_dir/$qprog[$i] ; fi
EOF
end
else
# For Mac, copy the run files, also strip (-x needed for 3dmod)
#
@ i = 0
while ($i < 6) # Loop on imodsendevent imodqtass ctfplot pchunk mrc2tif midas
@ i++
cat <<EOF >> $qconf[$i]
INSTALLS += $qrun[$i]
$qrun[$i].path = $inst_bin_dir
$qrun[$i].extra = cp -f $qrun[$i] $inst_bin_dir/$qprog[$i] ; \
$strip $qprog[$i].app/Contents/MacOS/$qprog[$i] ; \
if [ -e $inst_bin_dir/$qprog[$i].app ] ; then $strip $inst_bin_dir/$qprog[$i].app/Contents/MacOS/$qprog[$i] ; fi
EOF
end
cat << EOF >> $imod_qconf
3dmodv.extra = cp -f runimodv $inst_bin_dir/3dmodv ; \
strip -x 3dmod.app/Contents/MacOS/3dmod ; \
cp -f runimod $inst_bin_dir/3dmod ; cd $inst_bin_dir ; \
rm -f imod imodv ; ln -s 3dmod imod ; ln -s 3dmodv imodv ; \
if [ -e 3dmod.app ] ; then strip -x 3dmod.app/Contents/MacOS/3dmod ; fi
EOF
endif
# Finally run qmake and doctor the Makefiles if necessary
#
@ i = 0
while ($i < $#qdir)
@ i++
(cd $qdir[$i] ; qmake $qprog[$i].pro)
if ($status) then
echo "ERROR: setup - executing qmake"
exit 1
endif
if ("$qtdel1" != "") then
sed -e "/$qtdel1/s///g" -e "/$qtdel2/s///g" \
-e "/$qtsub1f/s//$qtsub1t/g" \
< $qdir[$i]/Makefile >! $qdir[$i]/makefile.tmp
\mv $qdir[$i]/makefile.tmp $qdir[$i]/Makefile
endif
end
# Set ctfplotter to link with fortran compiler in Linux
#
if ($machine != "macosx") then
sed -e "/^LINK.*=/s/=.*/= $lapacklink/" \
< $ctfplot_dir/Makefile >! $ctfplot_dir/Makefile.tmp
\mv $ctfplot_dir/Makefile.tmp $ctfplot_dir/Makefile
# Make the runimodqtapp script for linux only now (used to be Mac too)
# See version 1.34 for general form, which was csh script
# Argh. sh script with if - then screws up csh inside this if/endif
cat << EOF >! $scripts_dir/runimodqtapp
#!/bin/sh
# THIS FILE WAS GENERATED BY setup
EOF
echo 'if [ ! -z "$IMOD_QTLIBDIR" ] ; then' >> $scripts_dir/runimodqtapp
cat << EOF >> $scripts_dir/runimodqtapp
export LD_LIBRARY_PATH="\${IMOD_QTLIBDIR}:\${IMOD_DIR}/lib:\$LD_LIBRARY_PATH"
fi
prog="\$1"
shift
"\$IMOD_DIR/bin/\$prog" "\$@"
EOF
chmod a+x $scripts_dir/runimodqtapp
set gen_scripts = runimodqtapp
# Set up Qt image plugins to copy
#
echo "QTPLUGS_TOCOPY1 = libqjpeg.so libqico.so" >> $configure
echo "QTPLUGS_TOCOPY2 = libqsqlmysql.so" >> $configure
echo "QTSQL_TOCOPY = libqsqlite.so" >> $configure
else
# MACOSX: deferred tasks
# Set up build line for plugins including 3dmod location and all libs
# but strip out libtrack to avoid warnings
#
set plug_loader = ${source_dir}/${imod_dir}/${imod_target}
set allqt_libs = `sed -n -e '/-ltrack/s///' -e '/^LIBS /s/^LIBS.*) *//p' $imod_dir/Makefile`
echo 'MAKELIBSO = $(ARCPP) -bundle -dynamic -bundle_loader '"$plug_loader"' $(LDFLAGS) '"$allqt_libs -o " >> $configure
echo "QTPLUGS_TOCOPY1 = libqjpeg.dylib libqico.dylib" >> $configure
echo "QTPLUGS_TOCOPY2 = libqsqlmysql.dylib" >> $configure
echo "QTSQL_TOCOPY = libqsqlite.dylib" >> $configure
endif
(cd $imod_dir ; \rm -f 3dmodv ; ln -s 3dmod 3dmodv)
set qt_libs = `sed -n -e '/^LIBS /s/^LIBS.*) *//p' $sendevent_dir/Makefile`
# Make the script for etomo to source to set library path
#
echo '# THIS FILE WAS GENERATED BY setup AND IS MEANT TO BE SOURCED FROM SH/BASH' >! $scripts_dir/setlibpath
echo 'if [ ! -z "$IMOD_QTLIBDIR" ] ; then' >> $scripts_dir/setlibpath
echo " export $ld_lib_var="'${IMOD_QTLIBDIR}:${IMOD_DIR}/lib:$'"$ld_lib_var" >> $scripts_dir/setlibpath
echo " export DYLD_FRAMEWORK_PATH="'${IMOD_QTLIBDIR}:$'"DYLD_FRAMEWORK_PATH" >> $scripts_dir/setlibpath
echo fi >> $scripts_dir/setlibpath
echo "GENERATED_SCRIPTS = setlibpath $gen_scripts" >> $configure
# Make sure python scripts are copied in install
echo "COPYPYSCRIPTS = copyscripts" >> $configure
endif
# After qmake: remove empty imodhelp and take care of dependencies on version
#
\find $imod_dir -name imodhelp.h -size 0 -exec \rm -f '{}' \;
\find $imod_dir -name 'imod.o*' ! -newer .version -exec \rm -f '{}' \;
\find $imod_dir -name 'imod*_menu.o*' ! -newer .version -exec \rm -f '{}' \;
echo "QTPLUG_SRCDIR1 = imageformats" >> $configure
echo "QTPLUG_SRCDIR2 = sqldrivers" >> $configure
echo "QTSQL_SRCDIR = sqldrivers" >> $configure
echo "RGBPROGS = $rgbprogs" >> $configure
echo "LDFFLAGS = $ldfflags" >> $configure
echo "FARFLAGS = $farflags" >> $configure
cat <<EOF >> $configure
LIBTRACKFLAGS = $libtrackFlags
EOF
echo "MAKESTATICLIB = $makestaticlib" >> $configure
echo "STATICRANLIB = $staticranlib" >> $configure
echo "STATICEXT = $staticext" >> $configure
echo "DLLEXT = $dllext" >> $configure
echo "MAKENMCAR = $makenmcar" >> $configure
echo "NMCAREXT = $nmcarext" >> $configure
echo "FAR = $far" >> $configure
echo "FC = $fcomp" >> $configure
echo "OPENMP = $openmpFlags" >> $configure
echo "OPENMPF = $openmpfFlags" >> $configure
echo "WMODEXT = $wmodext" >> $configure
echo "MAKEWMOD = $makewmod" >> $configure
echo "LWMOD = $lwmod" >> $configure
echo "LSMLMOD = $lsmlmod" >> $configure
echo "JUNIT_HOME = $junit_home" >> $configure
echo "JFCUNIT_HOME = $jfcunit_home" >> $configure
echo "CLASS_SEPARATOR = $class_sep" >> $configure
echo "SOURCEDOC_EXE = $sourcedoc_exe" >> $configure
echo "STRIP = $strip" >> $configure
echo "RM = $rmcmd" >> $configure
if ($no_qt3 == false) set qt_flags = "$qt3_flags"' '"$qt_flags"
echo "QTINCDIR = $qtincdir" >> $configure
echo "QTFLAGS = $qt_flags" >> $configure
if ("$qt4libstocopy" != "") \
echo "QTLIBSTOCOPY = $qt4libstocopy $assistantcopy $qt3supportcopy" >> $configure
# Take care of Fortran graphics variations
#
if ("$xplax[1]:r" == "qtplax") then
echo "GRAPHLIBS = $ldnmncar"' $(IMLIBS)'" $qt_libs $fort_cpplibs" >> $configure
else if ("$xplax[1]" == "xplax.o") then
echo "GRAPHLIBS = $ldnmncar"' $(IMLIBS) $(XLIBS)' >> $configure
else
echo "GRAPHLIBS = $ldnmncar"' $(IMLIBS)' >> $configure
endif
echo "XPLAX = $xplax" >> $configure
echo "# end of configure" >> $configure
# Copy makefiles for actual use or for dummy use under Cygwin-gcc
foreach i ($makefile_dirs)
cat <<EOF >! $i/Makefile
# *****************************************************************
# THIS FILE WAS COPIED BY SETUP FROM Makefile.$makefile_ext - DO NOT EDIT
# *****************************************************************
EOF
cat $i/Makefile.$makefile_ext >> $i/Makefile
end
# Take care of .distname file
#
if ($distname != "" && $nogpu != "") then
set distname = ${distname}_${nogpu}
endif
if ($distname != "" && $suffix != "") then
set distname = ${distname}_${suffix}
endif
echo $distname >! .distname
# Take care of .options file - stripping out install entry
# It had to be done with index, and down here, to work with DOS line endings
# This will not work with a quoted multiple -flags entry
#
set optlist = ()
@ ind = 1
while ($ind <= $#inargv)
if ("$inargv[$ind]" == "-inst" || "$inargv[$ind]" == "-i") then
@ ind++
else
set optlist = ($optlist $inargv[$ind])
endif
@ ind++
end
echo $optlist >! .options
# Test for javac and set up makefile for etomo
#
set javacexe = `which javac`
if ($status) then
echo "The Java SDK is not installed or not on the path, so Etomo will not be built"
\cp $etomo_dir/Makefile.dummy $etomo_dir/Makefile
else
echo "# THIS FILE WAS COPIED BY SETUP FROM Makefile.real - DO NOT EDIT" >! $etomo_dir/Makefile
if ($use_etomo != "" && -e $use_etomo/etomo.jar) then
echo "Copying etomo.jar from $use_etomo and omitting etomo tests"
mkdir -p $etomo_dir/jar_dir