-
Notifications
You must be signed in to change notification settings - Fork 44
/
configure.ac
1059 lines (896 loc) · 30.1 KB
/
configure.ac
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
dnl configure.ac:
dnl Process this file with autoconf to produce a new configure script
dnl if it has changed.
dnl
dnl https://autotools.io/index.html
dnl aclocal --print
dnl will show which m4's are present and used
dnl git clone https://github.com/autoconf-archive/autoconf-archive
dnl ---------------------------------------------------------------------------------
AC_PREREQ(2.69)
AC_INIT(nemo_start.sh.in)
AC_MSG_CHECKING([NEMO config])
AC_CONFIG_MACRO_DIR([m4])
dnl AC_CONFIG_MACRO_DIRS - for future autoconf 2.70 ?
m4_include([m4/csh.m4])
dnl m4_include([m4/hdf5.m4])
dnl m4_include([m4/ax_lib_hdf5.m4])
m4_include([m4/ax_f77_cmain_fflags.m4])
m4_include([m4/ax_f77_func_mangle.m4])
m4_include([m4/acx_plplot.m4])
dnl m4_include([m4/gsl.m4])
dnl ax_lib_readline.m4
dnl ax_mpi.m4
dnl ax_pkg_swig.m4
dnl ax_prog_python_version.m4
AC_CONFIG_HEADER([config.h:config.h.in])
dnl -- checks for programs
dnl -- checks for libraries
dnl -- checks for header files
dnl -- checks for typedefs
dnl -- checks for structures
dnl -- checks for compiler characteristics
dnl -- checks for library functions
dnl -- checks for system services
dnl --- NEMO base directory
NEMO="`pwd`"
NEMOHOST="`./config.guess`"
NEMO_LIBS=""
NEMO_CFLAGS=""
NEMO_FFLAGS=""
AC_SUBST(NEMO)
AC_SUBST(NEMOHOST)
AC_SUBST(NEMO_LIBS)
AC_SUBST(NEMO_CFLAGS)
AC_SUBST(NEMO_FFLAGS)
dnl -- warning stuff
AC_SUBST(WARNING)
WARNING="Do not edit this file, it has been generated by configure"
dnl --- Nemo version - just for fun for now
NEMOVER="`cat VERSION`"
AC_SUBST(NEMOVER)
dnl --- Create needed libraries for next step
for i in bin lib obj local; do
if ! test -e $i ; then
mkdir $i
fi
done
dnl CMAKE_FIND_BINARY
dnl ---- Architecture stuff we need to know
AC_CANONICAL_HOST
echo "Found CANONICAL_HOST = $host_os or $host or $host_cpu"
AC_CANONICAL_BUILD
echo "Found CANONICAL_BUILD = $build"
AC_CANONICAL_TARGET
echo "Found CANONICAL_TARGET = $target"
dnl AC_ARG_ENABLE(option-name, help-string, action-if-present, action-if-not-present)
dnl AC_ARG_WITH
dnl AC_SEARCH_LIBS(function, libraries-list, action-if-found, action-if-not-found, extra-libraries)
dnl --- sizeof various data types
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_HEADER_STDC
AC_CHECK_FUNCS(strchr memcpy)
dnl AC_PROG_CPP
dnl Use native cc if present
AC_MSG_CHECKING([for vendor's cc to be used instead of gcc])
AC_CHECK_PROG(CC, cc, cc)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_CSH
dnl next ones seems to force linking with FC, and we have F77 as well, for now, FC=F77
dnl AC_PROG_FC
dnl AC_FC_WRAPPERS
AC_ARG_PROGRAM
AC_CHECK_PROGS(MAKE, [gmake make])
if test x"${MAKE}" = x
then
AC_MSG_ERROR([cannot find a make utility])
else
AC_MSG_CHECKING([whether ${MAKE} is GNU Make])
if ${MAKE} --version 2>/dev/null | head -n 1 |
grep "GNU Make" >/dev/null
then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([GNU Make is required, but ${MAKE} is
different])
fi
fi
AC_ARG_ENABLE(debug, [ --enable-debug compile for debugging], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
CFLAGS="-g"
CXXFLAGS="-g"
FFLAGS="-g"
LDFLAGS="-g"
# should we define DEBUG too?
fi
AC_ARG_ENABLE(shared, [ --disable-shared disable shared libraries? (needed for falcON on MAC)], ok=$enableval, ok=yes)
if test "$ok" = "yes"; then
NO_SHARED_LIBS=0
else
NO_SHARED_LIBS=1
fi
AC_SUBST(NO_SHARED_LIBS)
AC_ARG_ENABLE(clang, [ --enable-clang use clang compiler], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
CC="clang"
CXX="clang++"
#FC="flang"
#F77="flang"
FC="gfortran"
F77="gfortran"
fi
AC_ARG_ENABLE(pedantic, [ --enable-pedantic compile for lots of pedantics], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
flags="-std=c99 -pedantic -Wall -Werror -W -Wmissing-prototypes"
flags="$flags -Wconversion -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align"
flags="$flags -Wwrite-strings -Wnested-externs -fshort-enums -fno-common -Dinline= -g -O3"
flags="$flags -Wsign-compare -Wtype-limits -Wignored-qualifiers -Wempty-body -Wuninitialized"
PFLAGS="-Wimplicit-int -Werror-implicit-function-declaration"
else
PFLAGS="-Wall"
fi
AC_SUBST(PFLAGS)
AC_ARG_ENABLE(native, [ --enable-native optimize for native CPU], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
flags="-march=native"
CFLAGS="$CFLAGS $flags"
CXXFLAGS="$CXXFLAGS $flags"
FFLAGS="$CFLAGS $flags"
falcon_NO_NATIVE=0
else
falcon_NO_NATIVE=1
fi
AC_SUBST(falcon_NO_NATIVE)
AC_MSG_CHECKING(which precision NEMO is going to use)
prec_flag=""
AC_ARG_ENABLE(single, [ --enable-single single-precision], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
prec_flag="-DSINGLEPREC"
fi
AC_ARG_ENABLE(float, [ --enable-float single-precision], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
prec_flag="-DSINGLEPREC"
fi
AC_ARG_ENABLE(double, [ --enable-double double-precision (default)], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
prec_flag="-DDOUBLEPREC"
fi
AC_ARG_ENABLE(mixed, [ --enable-mixed mixed-precision], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
prec_flag="-DMIXEDPREC"
fi
AC_MSG_RESULT([$prec_flag])
AC_MSG_CHECKING(if the gnu coverage tool is to be used)
gcov_flag=""
AC_ARG_ENABLE(gcov, [ --enable-gcov gnu coverage tool], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
gcov_flag="-fprofile-arcs -ftest-coverage"
fi
AC_MSG_RESULT($ok)
AC_ARG_ENABLE(lfs, [ --enable-lfs large-file-size (files over 2GB)], ok=$enableval, ok=yes)
if test "$ok" = "yes"; then
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
echo "LFS selected, note that some filesystems may not support Large File anyways"
echo "Test this with the NEMO command:"
echo " mkspiral s000 1000000 nmodel=40"
else
echo "LFS not selected, be aware the largest filesize may be just 2GB"
fi
AC_ARG_ENABLE(fortran,[ --disable-fortran don't use any Fortran], enable_fortran=$enableval, enable_fortran=yes)
AC_ARG_ENABLE(falcon, [ --disable-falcon disable falcON],enable_falcon=$enableval, enable_falcon=yes)
if test "$enable_falcon" = "yes"; then
MAKELIBS="corelibs dehnen"
else
MAKELIBS="corelibs"
fi
MAKEDIRS="src usr"
AC_SUBST(MAKELIBS)
AC_SUBST(MAKEDIRS)
AC_ARG_WITH(mesa, [ --with-mesa force the use of Mesa instead of other graphics libs], with_mesa=$withval, with_mesa=maybe)
AC_ARG_WITH(hdf, [ --with-hdf force the use of HDF], with_hdf=$withval, with_hdf=maybe)
AC_ARG_WITH(ccmalloc,
[ --with-ccmalloc use CCMALLOC for malloc], with_ccmalloc=$withval, with_ccmalloc=no)
AC_ARG_WITH(dso,
[ --with-dso use DSO linking], with_dso=$withval, with_dso=no)
AC_ARG_WITH(opt,
[ --with-opt use opt for essentials], with_opt=$withval, with_opt=no)
AC_ARG_WITH(openmp,
[ --with-openmp use OMP directives], with_openmp=$withval, with_openmp=no)
AC_ARG_WITH(std,
[ --with-std use this -std=], with_std=$withval, with_std=c99)
if test $with_std != "default"; then
STDFLAG="-D_GNU_SOURCE -std=$with_std"
else
STDFLAG=""
fi
AC_SUBST(STDFLAG)
if test $with_openmp = "yes"; then
CFLAGS="$CFLAGS -fopenmp"
CXXFLAGS="$CXXFLAGS -fopenmp"
FFLAGS="$CFLAGS -fopenmp"
falcon_OPENMP="OPENMP"
else
falcon_OPENMP="noOPENMP"
fi
AC_SUBST(falcon_OPENMP)
dnl ---------------------------------------------------------------------
dnl Check for basic X windows stuff : AC_PATH_XTRA -> X_CFLAGS and X_LIBS
AC_PATH_X
AC_PATH_XTRA
XINCS="$X_CFLAGS"
if test -d /usr/X11R6/lib64; then
XLIBS="$X_LIBS $X_PRE_LIBS -L/usr/X11R6/lib64 -lXext -lX11 $X_EXTRA_LIBS"
elif test -d /usr/X11/lib; then
XLIBS="$X_LIBS $X_PRE_LIBS -L/usr/X11/lib -lXext -lX11 $X_EXTRA_LIBS"
else
XLIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
fi
AC_SUBST(XLIBS)
AC_SUBST(XINCS)
dnl CFITSIO_INC=""
dnl CFITSIO_LIB=""
dnl AC_CHECK_HEADERS([fitsio.h])
dnl AC_CHECK_HEADERS([/opt/include/fitsio.h],[CFITSIO_INC=-I/opt/include])
dnl AC_CHECK_HEADERS([/local/include/fitsio.h],[CFITSIO_INC=-I/local/include])
dnl AC_CHECK_LIB(cfitsio,ffopen,[CFITSIO_LIB="-lcfitsio"])
dnl AC_SUBST(CFITSIO_INC)
dnl AC_SUBST(CFITSIO_LIB)
dnl HDF5 is sometimes in a weird place, e.g. /usr/lib/x86_64-linux-gnu/hdf5/serial /usr/include/hdf5/serial
dnl AX_LIB_HDF5()
dnl AX_LIB_HDF5([serial])
dnl
dnl
dnl PKG_CHECK_MODULES(HDF5, [hdf5-serial],
dnl [AC_MSG_NOTICE([pkg-config hdf5-serial])],
dnl [AC_MSG_ERROR([hdf5-serial not found])]
dnl )
dnl
dnl PKG_CHECK_MODULES([HDF5], [hdf5-serial],[have_hdf5="yes"],[have_hdf5="no"])
dnl AC_SUBST([have_hdf5])
dnl
dnl PKG_CHECK_MODULES(HDF5, [hdf5-serial],
dnl [AC_MSG_NOTICE([pkg-config hdf5-serial])],
dnl [PKG_CHECK_MODULES(HDF5, [hdf5],
dnl [AC_MSG_NOTICE([pkg-config hdf5-serial])],
dnl [HDF5_CFLAGS=""
dnl HDF5_LIB="-lhdf5"
dnl AC_MSG_NOTICE([falling back to -lhdf5])
dnl ]
AC_SUBST([HDF5_CFLAGS])
AC_SUBST([HDF5_LIBS])
dnl ---------------------------------------------------------------------
dnl 3D Graphics Libraries (see also vis5d's configure.in)
dnl Or: AX_CHECK_GL
dnl AX_CHECK_GLU
dnl AX_CHECK_GLUT
GLLIBS=""
# First, look for OpenGL or Mesa:
if test "$with_mesa" != "yes"; then
AC_CHECK_LIB(GL, glBegin,
AC_CHECK_LIB(GLU, gluProject, GLLIBS="-lGLU -lGL",
:, -lGL $XLIBS), :, $XLIBS)
fi
if test -z "$GLLIBS" -a "$with_mesa" != "no"; then
AC_CHECK_LIB(MesaGL, glBegin,
AC_CHECK_LIB(MesaGLU, gluProject, GLLIBS="-lMesaGLU -lMesaGL",
:, -lMesaGL $XLIBS), :, $XLIBS)
fi
if test "$with_mesa" = "yes"; then
AC_CHECK_LIB(GL, glBegin,
AC_CHECK_LIB(GLU, gluProject, GLLIBS="-lGLU -lGL",
:, -lGL $XLIBS), :, $XLIBS)
fi
if test -n "$GLLIBS"; then
AC_DEFINE(HAVE_OPENGL)
else
echo "couldn't find OpenGL libraries!"
if test "$with_mesa" = "yes"; then
AC_MSG_ERROR([couldn't find Mesa library])
fi
fi
# Next, look for SGI IrisGL:
if test -z "$GLLIBS"; then
AC_CHECK_LIB(gl_s, bgnqstrip, ok=yes,ok=no, $XLIBS)
if test "$ok" = "yes"; then
AC_CHECK_LIB(fm, fminit, GLLIBS="-lfm -lgl_s",:,-lgl_s $XLIBS)
if test -z "$GLLIBS"; then
AC_CHECK_LIB(fm_s, fminit,
GLLIBS="-lfm_s -lgl_s",:,-lgl_s $XLIBS)
fi
fi
if test -n "$GLLIBS"; then
AC_DEFINE(HAVE_SGI_GL)
OPT_UTILS="$OPT_UTILS listfonts"
fi
fi
if test -z "$GLLIBS"; then
echo "****************************************************"
echo "You need to install a 3D graphics library, preferably"
echo "the free OpenGL replacement, Mesa. You can download"
echo "Mesa from the Mesa home page:"
echo " http://www.mesa3d.org/"
echo "and install it by running:"
echo " ./configure && make && su -c 'make install'"
echo "in the Mesa directory."
if test -r /sbin/ldconfig; then
echo "You may also need to run /sbin/ldconfig as root"
echo "to update the system after installing Mesa."
if test -r /etc/ld.so.conf; then
if test -z "`grep /usr/local/lib /etc/ld.so.conf`"; then
echo "(First, add '/usr/local/lib' to /etc/ld.so.conf if"
echo "you installed Mesa under /usr/local, the default.)"
fi
fi
fi
echo "****************************************************"
dnl AC_MSG_ERROR([couldn't find 3D graphics library])
fi
AC_SUBST(GLLIBS)
dnl -- Check for any particular functions in the GL libs:
save_LIBS="$LIBS"
LIBS="$GLLIBS $XLIBS $LIBS"
AC_CHECK_FUNCS(XMesaGetBackBuffer)
LIBS="$save_LIBS"
dnl ---------------------------------------------------------------------
dnl TODO: allow to choose a compiler, e.g. --with-fortran=f90 (setenv F77)
if test "$enable_fortran" = "yes"; then
AC_MSG_CHECKING([whether we have a FORTRAN 77 compiler])
AC_CHECK_PROGS(F77, gfortran g77 g95 ifort ifc xlf xlf77 fl32 fort77 fc cf77 frt f90 xlf90)
AC_PROG_F77
if test -n "$F77"; then
if test -n "$GCC"; then
AC_F77_LIBRARY_LDFLAGS
ACX_F77_FUNC_MANGLE
case $host_os in
ultrix*)
CC="$CC -Dmain=MAIN_"
;;
osf*)
CC="$CC -Dmain=MAIN__"
;;
sunos*)
CC="$CC -Dmain=MAIN_"
;;
esac
fi
else
F77="echo"
fortran=no
AC_MSG_WARN([no FORTRAN compiler])
fi
else
F77="echo"
fortran=no
AC_MSG_WARN([no FORTRAN compiler])
fi
FC=$F77
AC_SUBST(FC)
dnl Fortran/C linkeage : defines F77_CMAIN_FFLAGS
dnl ACX_F77_CMAIN_FFLAGS([AC_MSG_WARN([pjt])],[AC_MSG_WARN([problems fortran-c interface])])
AX_F77_CMAIN_FFLAGS([AC_MSG_WARN([f77 cmain ok])],[AC_MSG_WARN([problems fortran-c interface])])
dnl ACX_F77_CMAIN_FFLAGS([],[])
dnl Fortran binary I/O has a 4 or 8 byte header the unfio library needs to know
AC_MSG_CHECKING(size of unformatted fortran I/O header/footer)
$F77 -o src/kernel/fortran/hdr_size src/kernel/fortran/hdr_size.f
src/kernel/fortran/hdr_size
$CC -o src/kernel/fortran/hdr_size src/kernel/fortran/hdr_size.c
UNFIO_HDR_SIZE=`src/kernel/fortran/hdr_size one.dat`
AC_MSG_RESULT([$UNFIO_HDR_SIZE])
AC_DEFINE_UNQUOTED(UNFIO_HDR_SIZE,$UNFIO_HDR_SIZE,[Fortran unformatted I/O header size])
dnl MacOS (darwin) needs -lcc_dynamic, might need /sw stuff from FINK
dnl Only linux wants -rdynamic, for dlopen()
if test "$GCC" = "yes"; then
NEMO_CFLAGS="$NEMO_CFLAGS $gcov_flag"
fi
NEMO_CFLAGS="$NEMO_CFLAGS $prec_flag"
AC_SUBST(CCSHARED)
CCSHARED="-fpic"
AC_SUBST(MACOS_LIBS)
MACOS_LIBS=""
AC_MSG_CHECKING(what flags we need to created shared libs)
case $host_os in
linux*|Linux*)
CCSHARED="-fpic"
if test "$GCC" = "yes"; then
NEMO_CFLAGS="$NEMO_CFLAGS -rdynamic"
fi
;;
darwin*)
CCSHARED="-fPIC -fno-common"
# MACOS_LIBS="-lcc_dynamic -L/sw/lib"
# MACOS_LIBS="-L/sw/lib"
# NEMO_CFLAGS="$NEMO_CFLAGS -I/sw/include"
;;
sol*)
# -PIC ??
CCSHARED="-KPIC"
;;
esac
AC_MSG_RESULT([$CCSHARED])
dnl --
dnl helper library for PGPLOT
AC_ARG_ENABLE(png, [ --enable-png force the use of PNG for pgplot], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
PNG_LIB="-lpng -lz"
else
PNG_LIB=""
fi
AC_SUBST(PNG_LIB)
dnl ---------------------------------------------------------------------------
dnl PGPLOT detection: (NEMO allows PGPLOT to be built internally in $NEMO/lib)
dnl if $PGPLOT_DIR exists, take that as the default
dnl else, check a few standard places
dnl if all that fails and --with-pgplot-prefix is also not good, bail out.
dnl Known problems: if you have a local pgplot that needs odd libaries, e.g. -lpng
dnl although the -lpng problem is now solved
AC_SUBST(PGPLOT_DIR)
AC_MSG_CHECKING(whether we have PGPLOT)
if test -d "$PGPLOT_DIR"; then
pgplot_dir="$PGPLOT_DIR"
AC_MSG_RESULT([yes, found \$PGPLOT_DIR=$PGPLOT_DIR])
else
for dir in lib /usr/lib/pgplot /usr/local/lib/pgplot /usr/local/pgplot /opt/pgplot /usr/share/pgplot /usr/lib/pgplot5
do
if test -f $dir/grfont.dat; then
pgplot_dir="$dir"
break;
fi
done
fi
AC_ARG_WITH(pgplot-prefix,
[ --with-pgplot-prefix=DIR Directory where PGPLOT was installed, aka PGPLOT_DIR],
pgplot_config_prefix="$withval",
pgplot_config_prefix="$pgplot_dir")
yapp_default="ps"
if test x$pgplot_config_prefix != x; then
if ! test -f ${pgplot_config_prefix}/grfont.dat ; then
AC_MSG_WARN([could not find PGPLOT library in $pgplot_dir yet])
fi
PGPLOT_DIR="$pgplot_config_prefix"
PGPLOT_INCLUDE="-I$pgplot_config_prefix"
PGPLOT_LIB="-L$pgplot_config_prefix"
PGPLOT_LIB="$PGPLOT_LIB -lcpgplot -lpgplot $PNG_LIB"
AC_DEFINE(HAVE_LIBPGPLOT)
AC_MSG_RESULT([yes, $PGPLOT_DIR])
yapp_default="pgplot"
else
AC_MSG_WARN([could not find PGPLOT library in 2nd: $pgplot_config_prefix])
fi
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE(plplot,
[AS_HELP_STRING([--enable-plplot],
[Activate PLPlot library (default = yes)])],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))
AC_ARG_WITH(plplot-libdir,
[AS_HELP_STRING([--with-plplot-libdir=<PLPlot library path>],
[Provide an alternative path to the PLPlot library])])
AC_ARG_WITH(plplot-incdir,
[AS_HELP_STRING([--with-plplot-incdir=<PLPlot include dir>],
[Provide an alternative path to the PLPlot include directory])])
################# handle the PLPlot library (graphic plots) ##################
if test "$enable_plplot" != "no"; then
ACX_PLPLOT($with_plplot_libdir,$with_plplot_incdir,
[use_plplot="yes"]
[LIBS="$LIBS -lplplot $PLPLOT_LIB"],
[use_plplot="no"]
AC_MSG_WARN([PLPlot library not found/incomplete! Plotting deactivated.]))
else
AC_MSG_WARN([Plotting deactivated by user.])
fi
dnl [AM_CPPFLAGS="$AM_CPPFLAGS $PLPLOT_CFLAGS"]
dnl ---------------------------------------------------------------------
dnl check if we have the Fortran (sigh) idate function: == doesn't work ==
dnl == doesn't work - confusion with pgplot stuff ==
dnl if test -n "$F77"; then
dnl AC_LANG_SAVE
dnl AC_LANG_FORTRAN77
dnl AC_MSG_CHECKING([for Fortran idate function])
dnl AC_TRY_LINK(,[idate(imon,iday,iyear)],[AC_DEFINE(HAVE_IDATE)
dnl AC_MSG_RESULT(yes)],AC_MSG_RESULT(no))
dnl AC_LANG_RESTORE
dnl fi
dnl ---------------------------------------------------------------------
LOADOBJ_MACH=""
LOADOBJ_LIBS=""
echo "Trying to find LOADOBJ options for $host_os ; host=$host"
case $host_os in
linux*)
LOADOBJ_MACH="-Dlinux -DSYSV"
LOADOBJ_LIBS=-ldl
;;
solaris*)
LOADOBJ_MACH="-Dsun4 -DSOLARIS -DSYSV"
LOADOBJ_LIBS=-ldl
;;
darwin*)
LOADOBJ_MACH="-Ddarwin -DDL"
LOADOBJ_LIBS=-ldl
;;
irix*)
;;
esac
AC_SUBST(LOADOBJ_MACH)
AC_SUBST(LOADOBJ_LIBS)
#
# Find math library, and add ccmalloc support if needed
#
MATH_LIBS=''
AC_CHECK_LIB(m,sqrt,MATH_LIBS="-lm",,)
if test "$with_ccmalloc" = "yes"; then
MATH_LIBS="-lccmalloc $MATH_LIBS"
fi
AC_SUBST(MATH_LIBS)
dnl ---------------------------------------------------------------------
DSO_LINK=''
if test "$with_dso" = "yes"; then
DSO_LINK="-Wl,--no-as-needed"
fi
AC_SUBST(DSO_LINK)
dnl ---------------------------------------------------------------------
AC_MSG_CHECKING(whether we have HDF4)
AC_ARG_WITH(hdf-prefix,
[ --with-hdf-prefix=PFX Prefix where HDF4 was installed],
hdf_config_prefix="$withval",
hdf_config_prefix="/usr")
dnl this assumes people will use include <hdf.h>, not <hdf/hdf.h>
dnl on Fedora, you will find HDF4 in /usr/{include,lib}/hdf
dnl HDF5 uses hdf5.h :-)
hdf=$hdf_config_prefix
for dir in $hdf $hdf/include $hdf/hdf $hdf/include/hdf
do
if test -f $dir/hdf.h; then
HDF_INC="-I$dir"
break;
fi
done
if test "X$HDF_INC" != "X"; then
HDF_LIB="-L$hdf/lib -L$hdf/lib/hdf -ldf -ljpeg -lz"
AC_DEFINE(HAVE_HDF)
AC_MSG_RESULT([yes: hdf4, $HDF_INC])
else
HDF_INC=""
HDF_LIB=""
AC_MSG_RESULT(no)
AC_MSG_WARN([could not find HDF library])
fi
AC_SUBST(HDF_INC)
AC_SUBST(HDF_LIB)
dnl##--------------------------------------------------------------------
dnl Could also check FTOOLS_INCLUDE and/or FTOOLS_DIR for cfitsio....
dnl Note again, there are two ideas on where to store CFITSIO:
dnl library in PREFIX/lib
dnl header in PREFIX/include or PREFIX/include/cfitsio
dnl This section also allows --with-cfitsio-prefix to point to the
dnl source code tree, since that is where the *.a and *.h files live
dnl PJT
CFITSIO_INC=""
CFITSIO_LIB=""
AC_ARG_ENABLE(cfitsio, [ --enable-cfitsio use CFITSIO, instead of local fits I/O routines], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
AC_MSG_CHECKING(whether we have CFITSIO)
cfdefault=/usr
AC_ARG_WITH(cfitsio-prefix, AC_HELP_STRING([--with-cfitsio-prefix=PFX],
[CFITSIO installation prefix (default: $cfdefault)]),
cfitsio_config_prefix="$withval", cfitsio_config_prefix="use_default")
if test "$cfitsio_config_prefix" = "use_default"; then
if test -n "$CFITSIO"; then
cfitsio_config_prefix="$CFITSIO"
else
cfitsio_config_prefix="$cfdefault"
fi
fi
if test x$cfitsio_config_prefix != x; then
cdir="$cfitsio_config_prefix"
for dir in $cdir/include $cdir/cfitsio $cdir/include/cfitsio $cdir
do
if test -f ${dir}/fitsio.h ; then
CFITSIO_INC="-I${dir}"
incdir="$dir"
AC_MSG_RESULT($incdir (valid))
break;
fi
done
if test -n "$CFITSIO_INC"; then
for dir in $cdir/lib $cdir $cdir/lib/$host_cpu-$host_os
do
AC_MSG_RESULT($dir)
if test -f ${dir}/libcfitsio.a ; then
CFITSIO_LIB="${dir}/libcfitsio.a"
break;
fi
done
fi
if test -z "$CFITSIO_LIB"; then
AC_MSG_RESULT($cdir (invalid))
if test -z "$CFITSIO_INC"; then who="header"; else who="library"; fi
AC_MSG_ERROR([CFITSIO ${who} not found, please specify valid --with-cfitsio-prefix=DIR])
else
AC_MSG_RESULT(${cdir})
AC_DEFINE(HAVE_LIBCFITSIO)
rm -f src/include/cfitsio ; ln -s $incdir src/include/cfitsio
fi
fi
else
CFITSIOINC=""
CFITSIOLIB=""
AC_MSG_WARN([CFITSIO disabled])
fi
AC_SUBST(CFITSIO_INC)
AC_SUBST(CFITSIO_LIB)
AC_MSG_CHECKING(whether we have MIRIAD)
if test -d "$MIR"; then
mir="$MIR"
else
mir="/usr/local/miriad/current"
fi
AC_ARG_WITH(miriad-prefix,
[ --with-miriad-prefix=PFX Root directory where MIRIAD was installed],
miriad_config_prefix="$withval",
miriad_config_prefix="$mir")
if test -f ${miriad_config_prefix}/src/inc/maxdim.h ; then
MIRIAD_INC="-I$miriad_config_prefix/src/inc -I$miriad_config_prefix/src/subs"
MIRIAD_LIB="-L$miriad_config_prefix/lib"
MIRIAD_LIB="$MIRIAD_LIB -lmir"
AC_DEFINE(_WITH_MIRIAD)
AC_DEFINE(_WITH_MIRIAD_BIMA)
AC_MSG_RESULT([yes: bima-miriad $MIR])
elif test -f ${miriad_config_prefix}/inc/maxdim.h ; then
MIRIAD_INC="-I$miriad_config_prefix/inc -I$miriad_config_prefix/subs"
MIRIAD_LIB="-L$miriad_config_prefix/lib"
MIRIAD_LIB="$MIRIAD_LIB -lmir"
AC_DEFINE(_WITH_MIRIAD)
AC_DEFINE(_WITH_MIRIAD_ATNF)
AC_MSG_RESULT(yes: atnf-miriad)
else
MIRIAD_INC=""
MIRIAD_LIB=""
AC_MSG_RESULT(no)
AC_MSG_WARN([could not find MIRIAD library...])
fi
AC_SUBST(MIRIAD_INC)
AC_SUBST(MIRIAD_LIB)
dnl##-----------------------------------------------------------------------
dnl##
dnl## Flogger library (set of sorting routines)
dnl##
dnl##-----------------------------------------------------------------------
AC_ARG_ENABLE(flogger, [ --enable-flogger use Flogger], ok=$enableval, ok=no)
dnl##-----------------------------------------------------------------------
dnl##
dnl## TCL
dnl##
dnl##-----------------------------------------------------------------------
AC_ARG_ENABLE(tcl, [ --enable-tcl use TCL], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
if test "$ok" = "yes"; then
TCL_CFLAGS="$TCL_CFLAGS -DHAVE_TCL"
AC_DEFINE(HAVE_TCL)
else
AC_MSG_WARN([could not find TCL library])
fi
else
AC_MSG_WARN([TCL disabled])
fi
AC_SUBST(TCL_CFLAGS)
AC_SUBST(TCL_LIBS)
dnl##--------------------------------------------------------------------
dnl##
dnl## PGPLOT parameters
dnl##
dnl##--------------------------------------------------------------------
if test -n "$option_pgplot_link_flags"; then
PGPLOTINCLFLAGS="$option_pgplot_incl_flags"
PGPLOTLINKFLAGS="$option_pgplot_link_flags"
if test -n "$option_pgplot_link_search"; then
PGPLOTLINKSEARCH="$option_pgplot_link_search"
else
PGPLOTLINKSEARCH=""
fi
else
PGPLOTINCLFLAGS=""
PGPLOTLINKFLAGS=""
PGPLOTLINKSEARCH=""
fi
dnl AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
dnl if test "$ac_cv_func_vprintf" != yes; then
dnl AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
dnl fi
dnl ---------------------------------------------------------------------
dnl check for terminal library. this is a very cool solution
dnl from octave's configure.in
dnl Alternatively, check http://autoconf-archive.cryp.to/vl_lib_readline.html
unset tcap
for termlib in ncurses curses termcap terminfo termlib; do
AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
test -n "$tcap" && break
done
RDL_LIBS=""
AC_ARG_ENABLE(readline, [ --enable-readline use READLINE], ok=$enableval, ok=yes)
if test "$ok" = "yes"; then
AC_CHECK_HEADER(readline/history.h,
AC_CHECK_LIB(history, append_history,[
RDL_LIBS="-lhistory"
AC_DEFINE(HAVE_LIBHISTORY)]))
AC_CHECK_HEADER(readline/readline.h,
AC_CHECK_LIB(readline, readline,[
RDL_LIBS="-lreadline $RDL_LIBS $tcap"
AC_DEFINE(HAVE_LIBREADLINE)], , $tcap))
else
AC_MSG_WARN([READLINE disabled])
fi
AC_SUBST(RDL_LIBS)
AC_CHECK_LIB(df, DFSDndataset)
AC_CHECK_LIB(vogl, foreground)
AC_CHECK_LIB(z, inflate)
AC_CHECK_LIB(c, strtoll)
AC_CHECK_LIB(c, strtoull)
AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
AC_SEARCH_LIBS([dlopen], [dl dld], [], [
AC_MSG_WARN([unable to find the dlopen() function])
])
dnl AC_CHECK_LIB(utils, main)
dnl Replace `main' with a function in -lvogl:
dnl## this doesn't seem to work, since gsl linkeage also need libcblas etc...
dnl AC_CHECK_LIB(gsl,gsl_version)
dnl## hmm, but this does not seem to work either....
dnl AC_CHECK_LIB(gsl, main)
AC_SEARCH_LIBS(sin, m)
AC_SEARCH_LIBS(cblas_daxpy, gslcblas)
AC_SEARCH_LIBS(gsl_version, gsl)
dnl AC_CHECK_LIB(c, strsignal)
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sgtty.h strings.h sys/file.h sys/ioctl.h sys/time.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_SYS_LONG_FILE_NAMES
dnl next one can disable with --disable-largefile
AC_SYS_LARGEFILE
dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_VFORK
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(ftime gethostname gettimeofday getwd mkdir select strdup strtod strtol strtoul dprintf log2)
AC_C_BIGENDIAN
dnl -- tar file caching?
dnl -- if you have my "wgetc" use: --with-tar=$HOME/.wget-cache
tar_default="../tar"
AC_ARG_WITH(tar,
[ --with-tar=TARDIR cache directory for tar files for opt install],
tar_dir="$withval",
tar_dir="$tar_default")
NEMOTARS="$(readlink -f $tar_dir)"
AC_MSG_RESULT(Using NEMOTARS=$NEMOTARS)
AC_SUBST(NEMOTARS)
dnl -- some final YAPP stuff
AC_ARG_WITH(yapp,
[ --with-yapp=YAPPNAME Yapp module to make default (pgplot, ps, gnuplot, ...)],
yapp_name="$withval",
yapp_name="$yapp_default")
YAPP_NAME="$yapp_name"
AC_MSG_CHECKING(looking for a reasonable YAPP)
case $yapp_name in
ps)
YAPP_LIBS=""
YAPP_DEF="yapp.ps"
;;
gnuplot)
YAPP_LIBS=
YAPP_DEF=""
;;
plplot)
YAPP_LIBS="-lplplot"
YAPP_DEF="xwin"
;;
cpgplot)
if test "$PGPLOT_DIR" = "$NEMOLIB" ; then
YAPP_LIBS="-L\$(NEMOLIB) -lcpgplot -lpgplot $PNG_LIB \$(XLIBS) \$(FLIBS)"
PGPLOT_DIR='$NEMOLIB'
AC_MSG_WARN(C using dollar)
echo $PGPLOT_DIR
echo $NEMOLIB
else
YAPP_LIBS="-L$PGPLOT_DIR -lcpgplot -lpgplot $PNG_LIB $XLIBS $FLIBS"
AC_MSG_WARN(C using, external to NEMO, classic)
fi
YAPP_DEF="/xs"
;;
pgplot)
if test "$PGPLOT_DIR" = "$NEMOLIB" ; then
YAPP_LIBS="-L\$(NEMOLIB) -lcpgplot -lpgplot $PNG_LIB \$(XLIBS) \$(FLIBS)"
PGPLOT_DIR='$NEMOLIB'
AC_MSG_WARN(using dollar)
echo $PGPLOT_DIR
echo $NEMOLIB
else
YAPP_LIBS="-L$PGPLOT_DIR -lcpgplot -lpgplot $PNG_LIB $XLIBS $FLIBS"
AC_MSG_WARN(using, external to NEMO, classic)
fi
YAPP_DEF="/xs"
;;
giza)
YAPP_DEF="/xw"
YAPP_LIBS="-lgiza"
esac
AC_MSG_RESULT($YAPP_NAME)
AC_SUBST(YAPP_NAME)
AC_SUBST(YAPP_LIBS)
AC_SUBST(YAPP_DEF)