-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac.in
1236 lines (1076 loc) · 38.9 KB
/
configure.ac.in
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
#
# CAUTION!
#
# The file configure.ac is auto-generated from configure.ac.in
# Changes to configure.ac will be overwritten by bootstrap.sh
#
AC_PREREQ(2.52)
AC_INIT([nest], [2.3.svn], [[email protected]])
# These variables are exported to libnestutil/config.h
# The patchlevel is updated automatically by the script
# releasetools/buildnest
SLI_MAJOR=2
SLI_MINOR=3
SLI_PATCHLEVEL=svn
SLI_PRGNAME="nest-$SLI_MAJOR.$SLI_MINOR.$SLI_PATCHLEVEL"
SLI_VERSION=$SLI_MAJOR.$SLI_MINOR.$SLI_PATCHLEVEL
# Exporting source and build directories to SLI requires full path names.
# Thus we have to expand. Here, we are in top build dir, since source dir
# must exist, we can just move there and call pwd
if test "x$srcdir" = x ; then
PKGSRCDIR=`pwd`
else
PKGSRCDIR=`cd $srcdir && pwd`
fi
PKGBUILDDIR=`pwd`
# If the user did not supply --prefix, we fail loudly
if test $prefix = NONE; then
echo "Please supply a valid installation prefix, for example ./configure --prefix=\$HOME/opt/nest !"
exit 1
fi
# If this is not called, install-sh will be put into .. by bootstrap.sh
# moritz, 06-26-06
AC_CONFIG_AUX_DIR(.)
# We might consider switching to tar-pax (2001) in the future, for now
# tar-ustar (1988) is probably good enough. tar-v7 is not an option, since
# we already hit the 99 char filename limit.
AM_INIT_AUTOMAKE([tar-ustar])
# Allow to build NEST using silent rules.
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
# Obtain host system type; HEP 2004-12-20
AC_CANONICAL_HOST
# ------------------------------------------------------------------------
# Handle options
#
# NOTE: No programs/compilations must be run in this section;
# otherwise CFLAGS and CXXFLAGS may take on funny default
# values.
# HEP 2004-12-20
# ------------------------------------------------------------------------
# Use PS_ARRAYS
AC_DEFINE(PS_ARRAYS, 1, [Use PS array construction semantics])
# Debug level
# Note, $SLI_debug is used in acinclude.m4
SLI_debug="unset"
# Flags depend on platform and compiler and will be set later
SLI_debugflags=""
# Optimization level
# Note, $SLI_optimize is used in acinclude.m4
SLI_optimize="set"
# Flags depend on platform and compiler and will be set later
SLI_optimizeflags=""
# Warning level
# Note, $SLI_warning is used in acinclude.m4
SLI_warning="set"
# Flags depend on platform and compiler and will be set later
SLI_warningflags=""
# Select elementary unit of time
# example:
# ./configure --with-tics-per-ms=1000 // 1 microsecond, default
# ./configure --with-tics-per-ms=1e3 // the same
# ./configure --with-tics-per-ms='std::ldexp(1.0,13)' // 2^13 tics per ms
#
AC_ARG_WITH(tics_per_ms,[ --with-tics-per-ms=nnn Specify elementary unit of time.],
[if test "$withval" != no; then
AC_DEFINE(HAVE_TICS_PER_MS,1, [Tics per millisecond specified? ])
AC_DEFINE_UNQUOTED(CONFIG_TICS_PER_MS, ${withval}, [tics per ms in simulation])
fi])
# Select resolution of simulation
# example:
# ./configure --with-tics-per-step=100 // 100 tics per step = 0.1ms (default)
#
AC_ARG_WITH(tics_per_step,[ --with-tics-per-step=nnn Specify resolution.],
[if test "$withval" != no; then
AC_DEFINE(HAVE_TICS_PER_STEP,1, [Tics per step specified? ])
AC_DEFINE_UNQUOTED(CONFIG_TICS_PER_STEP, ${withval}, [tics per step in simulation])
fi])
# Select usage of the vampir tool
#
# in order to analyze the result of a program run
# the required environment variables are:
# PAL_ROOT e.g. /usr/nld/vampir
# PAL_LICENSEFILE e.g. /usr/nld/vampir/etc/license.dat
# and path to the binary vampir which needs to be called with the
# trace file .bpv as a parameter.
#
# 28.3.03 Diesmann, Morrison
#
AC_ARG_WITH(vampir,[ --with-vampir Include support for the Vampir tool.],
[if test "$withval" != no; then
AC_DEFINE(HAVE_VAMPIR,1, [Vampir support enabled? ])
VAMPIR_PATH="${withval}"
VAMPIR_LIBS="-L${VAMPIR_PATH}/lib -lVT -lpmpi"
VAMPIR_CFLAGS="-I${VAMPIR_PATH}/include"
else
unset HAVE_VAMPIR
unset VAMPIR_PATH
unset VAMPIR_LIBS
unset VAMPIR_CFLAGS
fi])
bluegene_architecture="none"
configure_bluegene="no"
AC_MSG_CHECKING(whether we are configuring for Blue Gene)
AC_ARG_ENABLE([bluegene],
[AS_HELP_STRING([--enable-bluegene],
[Configure for Blue Gene; the specific BG model must be given as argument (=L/P/Q).])],
[if test "x$enableval" != "xno" ; then
configure_bluegene="yes"
enableval_uc=`echo ${enableval} | awk {'print toupper($_)'}`
if test "x$enableval_uc" = xL || test "x$enableval_uc" = xP || test "x$enableval_uc" = xQ; then
bluegene_architecture="$enableval_uc"
else
echo
AC_MSG_ERROR([Only L, P, or Q are valid arguments for --enable-bluegene.])
fi
fi],[])
if test "x$configure_bluegene" = xno ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT([yes ($bluegene_architecture)])
fi
# register variable IS_BLUEGENE to be visible in Makefile.am
# required to suppress slidoc installation, which would fail due to cross-compile
AM_CONDITIONAL(IS_BLUEGENE, test "x$configure_bluegene" != xno)
# Manually activate MPI, allow to specify directory containing MPI
#
# The Scali mpic++ wrapper leads to link problems, so we cannot use it.
# Instead, we use the plain C++ compiler and look for MPI in the scali
# installation directory, by default /opt/scali.
#
# To make this easy for the user, there are two mutually exclusive options:
# --with-mpi for non-Scali MPI
# --with-scali for Scali MPI
#
# H. E. Plesser, 2007-01-05
#
SLI_distributed="unset"
SLI_mpi_prefix="unset"
SLI_mpi_option="no"
SLI_scali_option="no"
if test "x$configure_bluegene" = xyes ; then
SLI_distributed=set
SLI_mpi_option=yes
if test "x$bluegene_architecture" = xL; then
AC_DEFINE(IS_BLUEGENE_L, 1, [Configuring for Blue Gene/L])
bluegene_dynamic_libs=no # no dynamic libs on BG/L
elif test "x$bluegene_architecture" = xP; then
AC_DEFINE(IS_BLUEGENE_P, 1, [Configuring for Blue Gene/P])
bluegene_dynamic_libs=yes
elif test "x$bluegene_architecture" = xQ ; then
AC_DEFINE(IS_BLUEGENE_Q, 1, [Configuring for Blue Gene/Q])
bluegene_dynamic_libs=yes
fi
else
AC_ARG_WITH(mpi,[ --with-mpi[[=directory]] Request compilation with MPI; optionally give directory with MPI installation.],
[
if test "$SLI_scali_option" = "yes" ; then
AC_MSG_ERROR([The --with-mpi and --with-scali options are mutually exclusive.])
fi
if test "$withval" = "yes" ; then
SLI_distributed="set"
SLI_mpi_option="yes"
elif test "$withval" != "no" ; then
SLI_distributed="set"
SLI_mpi_prefix=`echo ${withval} | sed 's/\/*$//'` # remove trailing slashes
SLI_mpi_option="yes"
fi
])
AC_ARG_WITH(scali, [ --with-scali[[=directory]] Request compilation with Scali MPI; optionally give directory with Scali [[/opt/scali]]],
[
if test "$SLI_mpi_option" = "yes" ; then
AC_MSG_ERROR([The --with-mpi and --with-scali options are mutually exclusive.])
fi
if test "$withval" = "yes" ; then
SLI_distributed="set"
SLI_mpi_prefix="/opt/scali"
SLI_scali_option="yes"
elif test "$withval" != "no" ; then
SLI_distributed="set"
SLI_mpi_prefix=`echo ${withval} | sed 's#\(.*\)/$#\1# ; q'`
SLI_scali_option="yes"
fi
])
fi
if test "x$configure_k" = xyes ; then
AC_DEFINE(IS_K, 1, [Configuring for K])
fi
# Use the MUSIC library to allow for simulator interoperation
#
AC_ARG_WITH(music,[ --with-music[[=directory]] Request the use of MUSIC. Optionally give the directory, where MUSIC is installed],
[
if test "$withval" != "no"; then
if test "$SLI_distributed" != "set"; then
AC_MSG_ERROR([MUSIC requires --with-mpi.])
else
AC_DEFINE(HAVE_MUSIC,1, [MUSIC support enabled?])
if test "$withval" = "yes"; then
MUSIC_LIBS="-lmusic"
MUSIC_INCLUDE=""
else
MUSIC_PATH="${withval}"
MUSIC_LIBS="-L${MUSIC_PATH}/lib -lmusic"
MUSIC_INCLUDE="-I${MUSIC_PATH}/include"
fi
fi
else
unset HAVE_MUSIC
fi
])
# Select optimization mode
# note: see debugging mode selection
#
AC_ARG_WITH(optimize,[ --with-optimize[[=flags]] Select optimization level.],
[ SLI_debug="unset"
SLI_optimize="unset"
if test "$withval" != no; then
SLI_optimize="set"
if test "$withval" != "yes"; then
SLI_optimizeflags="$withval"
fi
fi])
# select debugging mode
# note: --with-debug -> withval = yes
# --without-debug -> withval = no
# --with-debug=foo -> withval = foo
#
AC_ARG_WITH(debug,[ --with-debug[[=flags]] Enable debugging information.],
[SLI_debug="unset"
if test "$withval" != "no"; then
SLI_debug="set"
## Debugging should be done without optimizations
SLI_optimize="unset"
if test "$withval" != "yes"; then
SLI_debugflags="$withval"
fi
fi])
# select warning level
#
AC_ARG_WITH(warnings,[ --with-warnings[[=flags]] Enable warnings.],
[SLI_warning="unset"
if test "$withval" != "no"; then
SLI_warning="set"
SLI_warningflags="$withval"
fi])
# Set the platform-dependent compiler flags based on the canonical
# host string. These flags are placed in AM_{C,CXX}FLAGS. If
# {C,CXX}FLAGS are given as environment variables, then they are
# appended to the set of automatically chosen flags. After
# {C,CXX}FLAGS have been read out, they must be cleared, since
# system-dependent defaults will otherwise be placed into the
# Makefiles. HEP 2004-12-20.
# Before we can determine the proper compiler flags, we must know
# which compiler we are using. Since the pertaining AC macros run the
# compiler and set CFLAGS, CXXFLAGS to system-dependent values, we
# need to save command line/enviroment settings of these variables
# first. AC_AIX must run before the compiler is run, so we must run it
# here.
# HEP 2004-12-21
# Compiler selection:
# - C compiler is chosen using AC_PROG_CC. C code occurs only in a
# few files in librandom. None of that code is MPI related.
#
# - C++ compiler is chosen as follows if distributed simulation is
# chosen:
#
# 1. If simulation is not distributed, use AC_PROC_CXX.
# 2. Otherwise, if no prefix is given, search for mpiCC or equivalent
# using AC_PROG_CXX(mpiCC).
# Search order can be influenced by setting PATH before calling
# configure.
# 3. If distributed simulation is requested and a prefix given, use
# standard compiler from AC_PROG_CXX and check for libraries in
# prefix directory.
# 4. Setting CXX overrides compiler selection brute force. AC_PROG_CXX
# handles this.
# 5. The final configuration is tested for if it works.
#
# HEP 2007-01-03
SLI_SAVE_CFLAGS=$CFLAGS
SLI_SAVE_CXXFLAGS=$CXXFLAGS
AC_AIX
AC_PROG_CC
if test "$SLI_distributed" = unset ; then
# no-distributed simulation
AC_PROG_CXX
else
if test "$SLI_scali_option" = "yes" ; then
# We cannot use the mpic++ wrapper for Scali, since it
# leads to a linker error due to "hidden symbol __dso_handle"
# on several systems. So we just choose the default C++ compiler
# and handle MPI via compiler flags later.
AC_PROG_CXX
else
# Non-Scali MPI. Here we assume that the wrappers work. If an
# explicit mpi-path is given, we add its bin to PATH first, then
# test, and then redefine the compiler variables to full path
# names. This is necessary since AC_PROG_CXX internally searches
# through the entire PATH; since AC_PROG_CXX contains many checks
# in addition to the search, we cannot simply write our own
# absolute-path version.
#
# Search for MPI C++ compiler wrapper:
# 1. Search for mpicxx, since mpicc and mpiCC are the same file
# on non-case-sensitive file systems (most OSX filesystems).
# 2. Search for mpiCC, which is MPICH standard
# 3. Do not look for Scali's mpic++, since the Scali compiler wrapper
# does not work.
if test "$SLI_mpi_prefix" = unset ; then
AC_PROG_CXX(mpicxx mpiCC)
else
SLI_SAVE_PATH=$PATH
# add /bin, avoiding duplicate //
mpi_bin=${SLI_mpi_prefix}/bin
PATH=${mpi_bin}:$PATH
AC_PROG_CXX(mpicxx mpiCC)
# If mpicxx or mpiCC are chosen, we check if they exists in the prefix
# path. If so, we add the prefix path. Otherwise, we leave CXX untouched.
if test $CXX = mpicxx -o $CXX = mpiCC ; then
if test -x ${mpi_bin}/$CXX ; then
CXX=$mpi_bin/$CXX
ac_ct_CXX=$CXX
ac_cv_prog_ac_ct_CXX=$CXX
fi
fi
PATH=$SLI_SAVE_PATH
fi
fi
fi
# further processing of distributed case below (see SLI_NEW_PATH_MPI)
# disable PyNEST for Blue Gene or if explicitly stated
AC_MSG_CHECKING([whether to compile PyNEST])
if test "x$configure_bluegene" = xyes ; then
HAVE_PYTHON=no
else
HAVE_PYTHON=yes
PYTHON_EXEC=`which python`
AC_ARG_WITH(python,[ --with-python=python specify the Python interpreter to use],
[
if test "$withval" == no; then
HAVE_PYTHON=no
else
if test "$withval" != yes; then
PYTHON_EXEC=$withval
fi
fi
])
fi
AC_MSG_RESULT([$HAVE_PYTHON])
# Check, whether we are able to compile PyNEST. This will break, if no Python
# interpreter is found.
# JME 2008/04
if test $HAVE_PYTHON = yes; then
AC_CHECK_FILE($PYTHON_EXEC, HAVE_PYTHON=yes, AC_MSG_ERROR([Python interpreter '$PYTHON_EXEC' not found.]))
PYTHON_VERSION=`$PYTHON_EXEC -c "from distutils import sysconfig;\
print (sysconfig.get_python_version())"`
HAVE_PY3K=`$PYTHON_EXEC -c "from distutils import sysconfig;\
print (int(sysconfig.get_python_version().split('.')[[0]])>2)"`
AC_MSG_WARN([$HAVE_PY3K])
AC_MSG_CHECKING([for Python 3])
if test $HAVE_PY3K = "True"; then
configure_cynest="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([which Python bindings to use])
AC_ARG_ENABLE([cynest],
[AS_HELP_STRING([--enable-cynest],
[Configure for Cython based Python bindings.])],
[if test "x$enableval" != xno ; then
configure_cynest="yes"
fi],
[])
if test "$configure_cynest" = "yes"; then
PYNEST_SUBDIR="cynest"
PYNEST_MODULE="CyNEST"
PYNEST_MODULENAME="cynest"
AC_MSG_RESULT([CyNEST])
else
PYNEST_SUBDIR="pynest"
PYNEST_MODULE="PyNEST"
PYNEST_MODULENAME="nest"
AC_MSG_RESULT([PyNEST])
fi
AC_MSG_CHECKING([for Python headers])
PYTHON_INC_PATH="`$PYTHON_EXEC $PKGSRCDIR/$PYNEST_SUBDIR/checkpython.py`"
if test $PYTHON_INC_PATH != "yes"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Python headers not found. Make sure you have the development package installed.
If you do not need '$PYNEST_MODULE', use --without-python to disable it.])
fi
AC_MSG_RESULT([yes])
if test $exec_prefix = NONE; then
PYNEST_PREFIX=${prefix}
else
PYNEST_PREFIX=${exec_prefix}
fi
# Check for a non-standard installation path for PyNEST
AC_ARG_WITH(pynest-prefix,[ --with-pynest-prefix=path install '$PYNEST_MODULE' to path/lib/python<version>/site-packages.],
[
PYNEST_PREFIX=$withval
])
fi
# register variable HAVE_PYTHON to be visible in Makefile.am
# required to run or not run the PyNEST tests in the testsuite
AM_CONDITIONAL(HAVE_PYTHON, test "x$HAVE_PYTHON" != xno)
##-- use ltdl library for dynamic loading of modules
## if not Cygwin or blue gene
AC_MSG_CHECKING([whether to build shared libraries])
if test "$host_os" != "cygwin"; then
if test "x$configure_bluegene" = xno ; then
BUILD_SHARED=yes
else
BUILD_SHARED=$bluegene_dynamic_libs
fi
else
BUILD_SHARED=no
SLI_debug="unset"
SLI_debugflags="-g"
SLI_optimize="set"
SLI_optimizeflags="-O"
fi
if test "x$BUILD_SHARED" != xno ; then
AC_ENABLE_SHARED ## do not build static libraries by default, use
AC_DISABLE_STATIC ## --enable-static to build them too
else
AC_DISABLE_SHARED
AC_ENABLE_STATIC
fi
AC_MSG_RESULT([$BUILD_SHARED])
SLI_SET_CFLAGS
CFLAGS=
SLI_SET_CXXFLAGS
CXXFLAGS=
# -------------------------------------------
# END Handle options
# -------------------------------------------
## search for the Doxygen executable
AC_PATH_PROG([DOXYGEN], [doxygen])
AM_CONDITIONAL(DOXYGEN_AVAILABLE, test x$DOXYGEN != x)
## see if dot from graphviz is available
## this is only needed to choose between
## Doxygen files, see doc/Makefile.am; HEP
AC_CHECK_PROG(HAVE_DOT, dot, "yes")
AM_CONDITIONAL(DOT_AVAILABLE, test x$HAVE_DOT = xyes)
## Configure C environment
AC_PROG_INSTALL
LT_PATH_LD
LT_CONFIG_LTDL_DIR([libltdl])
_LTDL_CONVENIENCE ## put libltdl into a convenience library
LT_INIT([dlopen]) ## use libtool
m4_pattern_allow([LT_LIBEXT]) ## supress false positive message by autoconf
AC_CONFIG_SUBDIRS(libltdl) ## also configure subdir containing libltdl
# This is a fix for a bug in Debian's libtool.
# See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526750
if echo $LIBLTDL | grep -s -q top_build_prefix; then
top_build_prefix=${PKGBUILDDIR}/
LIBLTDL=`eval echo $LIBLTDL`
fi
if test "x$BUILD_SHARED" != xno ; then
if test "x$LIBLTDL" != x ; then
AC_DEFINE(HAVE_LIBLTDL, 1, [Havel libltdl, can load dynamic modules])
fi
fi
#-- Stuff for GSL -----------------------------------------
# NOTE: MUST come BEFORE switching to AC_LANG_CPLUSPLUS !!!
# HEP 2001-08-07
# NOTE: Adding @GSL_CFLAGS@ to the AM_CPPFLAGS variable
# in Makefile.am will result in warnings about re-ordering
# the search path.
# HEP 2002-07-10
# GSL Related HAVE_* variables:
#
# HAVE_GSL indicates that some GSL release version is available
# (i.e., version 1.0 or higher)
# HAVE_GSL_X_Y indicates that the GSL is version >= X.Y
#
# Currently implemented:
# HAVE_GSL
# HAVE_GSL_1_2 # minimum requirement for GSL Random Generators
# HAVE_GSL_1_11 # fixes bug in ODE solvers, see #313 and #88
#
# Add further HAVE_GSL_MAJOR_MINOR if necessary according to scheme for
# HAVE_GSL_1_2 below.
#
# For each HAVE_GSL_X_Y, define also an automake conditional
# GSL_1_2_AVAILABLE to allow for conditional compilation. See example
# below, and librandom for an example of how to use it in Makefile.am.
#
# HEP 2002-08-21
AM_PATH_GSL(1.0, ac_have_gsl="yes", ac_have_gsl="no")
if test "$ac_have_gsl" != no ; then
AC_DEFINE(HAVE_GSL,1, [Is the GNU Science Library available (ver. >= 1.0)?])
AC_SUBST(HAVE_GSL)
AC_SUBST(GSL_LIBS)
AC_SUBST(GSL_CFLAGS)
AM_PATH_GSL(1.2, ac_have_gsl_1_2="yes", ac_have_gsl_1_2="no")
if test "x$ac_have_gsl_1_2" = xyes ; then
AC_DEFINE(HAVE_GSL_1_2, 1, [Is GSL Version >= 1.2?])
AM_PATH_GSL(1.11, ac_have_gsl_1_11="yes", ac_have_gsl_1_11="no")
if test "x$ac_have_gsl_1_11" = xyes ; then
AC_DEFINE(HAVE_GSL_1_11, 1, [Is GSL Version >= 1.11?])
else
ac_have_gsl_1_11="no"
fi
fi
else
unset GSL_LIBS
unset GSL_CFLAGS
unset GSL_VERSION
ac_have_gsl_1_2="no"
fi
# AM_CONDITIONAL must not be invoked conditionally
AM_CONDITIONAL(GSL_1_2_AVAILABLE, test x$ac_have_gsl_1_2 = xyes)
AM_CONDITIONAL(GSL_1_11_AVAILABLE, test x$ac_have_gsl_1_11 = xyes)
# C Inline stuff revised, HEP 2003-03-11
SLI_C_INLINE
if test "$ac_cv_c_inline" != no ; then
AC_DEFINE(HAVE_INLINE,1, [Do we have the inline macro in C?])
AC_SUBST(HAVE_INLINE)
fi
## --- end GSL STUFF -----------------------------------
# fails to find available functions if run with language
# set to C++; HEP 2003-03-13
AC_CHECK_FUNCS(popen pclose execv fork setenv sigaction)
#-- Set the language to C++
AC_LANG_CPLUSPLUS
# check if expm1 is available after we have switched to C++
AC_MSG_CHECKING([for expm1 ])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
[[double x = ::expm1(0.1);]])],
ac_have_expm1="yes", ac_have_expm1="no")
if test "$ac_have_expm1" = yes ; then
AC_DEFINE(HAVE_EXPM1,1, ["Define if expm1() is available"])
fi
AC_MSG_RESULT($ac_have_expm1)
#-- Look for programs needed in the Makefile
AC_PROG_CXXCPP
AC_PATH_PROGS([MAKE],[gmake make],[make])
SLI_LIBS="$SLI_LIBS $LDFLAGS"
AC_MSG_WARN("x$configure_bluegene")
# Check for readline if not configuring for Blue Gene
if test "x$configure_bluegene" = "xno" ; then
AC_ARG_WITH([readline], [AS_HELP_STRING([--without-readline], [disable support for GNU readline])],
[],
[with_readline=yes])
if test "x$with_readline" != xno ; then
AC_CHECK_LIB(curses,tgetstr, SLI_LIBS="${SLI_LIBS} -lcurses",\
[AC_CHECK_LIB(termcap,tgetstr, SLI_LIBS="${SLI_LIBS} -ltermcap",\
[AC_CHECK_LIB(ncursesw,tgetstr, SLI_LIBS="${SLI_LIBS} -lncursesw",\
[AC_CHECK_LIB(ncurses,tgetstr, SLI_LIBS="${SLI_LIBS} -lncurses",\
[AC_MSG_ERROR([You need either libncurses, libcurses, or libtermcap to compile NEST.
])])])])])
AC_CHECK_LIB(readline, readline,\
[SLI_LIBS="${SLI_LIBS} -lreadline"\
AC_DEFINE(HAVE_READLINE, 1,[Use GNU libreadline])],\
[AC_MSG_ERROR([No readline found, --without-readline to disable])],\
[${SLI_LIBS}])
fi
else
AC_MSG_WARN("Skipping configuration of libreadline")
fi
# Test if to use multithreading with either OpenMP or POSIX threads
# JME 2011/09/29
AC_MSG_CHECKING(which threading library to use)
# Testing for OpenMP
AC_ARG_WITH([openmp], [AS_HELP_STRING([--without-openmp], [disable OpenMP multithreading])],
[with_openmp=$withval], # withval=yes, if configured with --with-openmp, no with --without-openmp
[with_openmp=default]) # withval would be yes, if configured without args
# Testing for POSIX threads
AC_ARG_WITH([pthread], [AS_HELP_STRING([--with-pthread], [enable POSIX threads])],
[with_pthread=$withval],
[with_pthread=no])
# This allows to override the default (OpenMP) by only using
# --with-pthread without also having to use --without-openmp
if test "$with_openmp" = default && test "$with_pthread" = yes; then
with_openmp=no
fi
# Force a sensible combination of --with-openmp and --with-pthread
if test "$with_openmp" = yes && test "$with_pthread" = yes; then
echo # we need a newline here because there won't be a result to print
AC_MSG_ERROR([Only one of OpenMP and POSIX threads can be enabled manually.])
fi
# On Blue Gene/L we can't use POSIX threads
if test "$with_pthread" = yes && test "x$bluegene_architecture" = xL; then
echo # we need a newline here because there won't be a result to print
AC_MSG_ERROR([POSIX threads are not available on Blue Gene/L, either use OpenMP, or no threading.])
fi
# Check if the OpenMP setup is usable
if test "$with_openmp" = yes || test "$with_openmp" = default; then
AC_MSG_RESULT(openmp)
if test "x$configure_bluegene" = xyes; then
# On Blue Gene, the macro AC_OPENMP is not defined, so we set the flags manually
OPENMP_CXXFLAGS="-qsmp=omp"
elif test "x$configure_k" = xyes; then
# On K, the macro AC_OPENMP is not defined, so we set the flags manually
OPENMP_CXXFLAGS="-Kopenmp"
else
m4_ifdef([AC_OPENMP], [AC_OPENMP])
if test "$OPENMP_CXXFLAGS" = ""; then
AC_MSG_ERROR([OpenMP not found, please use --without-openmp to disable.])
fi
fi
AM_CFLAGS="$AM_CFLAGS $OPENMP_CXXFLAGS"
AM_CXXFLAGS="$AM_CXXFLAGS $OPENMP_CXXFLAGS"
with_openmp=yes
else
# Check if the POSIX threads are usable
if test "$with_pthread" = yes; then
AC_MSG_RESULT(pthreads)
AC_CHECK_LIB(pthread, pthread_testcancel,
[SLI_LIBS="${SLI_LIBS} -lpthread"
SLI_THREAD_DEFS="-D_POSIX_C_SOURCE=199506L"
SLI_HAVE_PTHREADS="true"
AC_DEFINE(HAVE_PTHREADS,1,[pthreads are available])],\
[echo; AC_MSG_ERROR([No pthread library found, please use --without-pthread to disable.])])
else
AC_MSG_RESULT(none)
fi
fi
# End of thread library processing
# is long long available for type representation and fully usable?
SLI_HAVE_LONG_LONG
# Check whether Alpha cxx includes *.h standard headers
# and C-style macros correctly
SLI_ALPHA_CXX_STD_BUG
# For a description of MPI detection, see comment on compiler selection.
if test "$SLI_distributed" = "set"; then
if test "x$configure_bluegene" = xyes ; then
BLUEGENE_MPI
else
SLI_NEW_PATH_MPI
fi
fi
# Makros M_E and M_PI
#
# !HAVE_M_E && HAVE_CMATH_MAKROS_IGNORED
# --> cmath needs to be included with #undef __PURE_CNAME
#
# HAVE_M_E || HAVE_CMATH_MAKROS_IGNORED --> M_E is present
# HAVE_M_PI || HAVE_CMATH_MAKROS_IGNORED --> M_PI is present
#
# Diesmann, 28.8.02
#
SLI_CXX_HAVE_M_E
SLI_CXX_HAVE_M_PI
SLI_CHECK_STATIC_TEMPLATE_DECLARATION
SLI_ALPHA_CMATH_MAKROS_IGNORED
SLI_ALPHA_CXX_SIGUSR_IGNORED
if test "$SLI_HAVE_PTHREADS" = "true"; then
SLI_ALPHA_CXX_PTHREAD_IGNORED
# must run aftr SLI_ALPHA_CXX_PTHREAD_IGNORED
SLI_HAVE_PTHREAD_SETCONCURRENCY
fi
SLI_CHECK_ISTREAM_HEADER
SLI_CHECK_OSTREAM_HEADER
SLI_CHECK_SSTREAM_HEADER
SLI_CHECK_STL_VECTOR_CAPACITY_BASE_UNITY
SLI_CHECK_STL_VECTOR_CAPACITY_DOUBLING
SLI_CHECK_EXITCODES
# ----------------------------------------------------
# Configure external modules to be linked into nest
# ----------------------------------------------------
# SLI_USER_MODULES collects module names for informative messages
SLI_USER_MODULES=""
# LINKED_USER_MODULES collects what needs to be added to LDADD
LINKED_USER_MODULES=""
AC_ARG_WITH(modules,[ --with-modules = external modules to be linked in],
[
if test "$withval" != no; then
LINKED_USER_MODULES="-L$prefix/lib/nest"
for mod in $withval; do
LINKED_USER_MODULES="$LINKED_USER_MODULES -l$mod"
SLI_USER_MODULES="$SLI_USER_MODULES $mod"
done
fi
])
# ---------------------------------------------------------------
# Configure directories to be built
# ---------------------------------------------------------------
# Classification of modules:
#
# - SLI_PUBLIC_MODULES
# statically linked, included in release
# - SLI_NONPUBLIC_MODULES
# statically linked, not included in release
#
# - SLI_PUBLIC_DYNMODULES
# dynamically linked, automatically loaded, included in release
# - SLI_NONPUBLIC_DYNMODULES
# dynamically linked, automatically loaded, not included in release
SLI_PUBLIC_MODULES="models precise topology conngen"
SLI_NONPUBLIC_MODULES=""
SLI_PUBLIC_DYNMODULES=""
SLI_NONPUBLIC_DYNMODULES=""
# Now go through all candidates and set up necessary variables and directories
# NOTE: We only include those modules that shall be loaded automatically.
# The _NOLOAD modules will only be included with the SUBDIRS below.
SLI_EXTRA_MODULE_CANDIDATES="$SLI_PUBLIC_MODULES $SLI_NONPUBLIC_MODULES"
# add dynmodules only if building shared libs
if test "x$BUILD_SHARED" != xno ; then
SLI_EXTRA_MODULE_CANDIDATES="$SLI_EXTRA_MODULE_CANDIDATES $SLI_PUBLIC_DYNMODULES $SLI_NONPUBLIC_DYNMODULES"
fi
# collect modules that shall be linked in
# these are modules from the NEST code base, ie, in the source directory
# and dependency tracking shall happen for these modules
LINKED_MODULES=""
SLI_EXTRA_MODULES=""
# collect directories for which AC_CONFIG_FILES need to be run
NEED_MAKEFILE_DIRS=""
# check all candidates: must contain Makefile.am
for mod in $SLI_EXTRA_MODULE_CANDIDATES; do
SLI_CHECK_SOURCE_FILE([$srcdir/$mod/Makefile.am], mod_exists="yes", mod_exists="no")
if test "x$mod_exists" = xyes; then
SLI_EXTRA_MODULES="$SLI_EXTRA_MODULES $mod"
NEED_MAKEFILE_DIRS="$NEED_MAKEFILE_DIRS $mod"
newmod="${PKGBUILDDIR}/${mod}/lib${mod}module.la"
LINKED_MODULES="$LINKED_MODULES $newmod"
# check if we need to create Makefiles in doc, examples, tests, pynest
for sdir in doc examples tests pynest; do
SLI_CHECK_SOURCE_FILE([$srcdir/$mod/$sdir/Makefile.am],
[NEED_MAKEFILE_DIRS="$NEED_MAKEFILE_DIRS $mod/$sdir"], [printf ""])
done
fi
done
# now build include and addmodule lines for use in (py)neststartup
# this is a bit redundant with the above, but here we look only at the
# static modules.
# The variables built here go to $PKGBUILDDIR/nest/static_modules.h via
# AC_CONFIG_FILES(). They should not be put into the Makefile using
# AC_SUBST().
INCLUDE_STATIC_MODULES=''
ADD_STATIC_MODULES=''
for mod in $SLI_PUBLIC_MODULES $SLI_NONPUBLIC_MODULES; do
modheader="$mod/${mod}module.h"
# get module name from the module's main header
Mod=`grep SLIModule ${srcdir}/${modheader} | sed -n 's/class *\(.*\) *:.*/\1/p' | tr -d ' '`
# the line breaks must remain in the strings below
SLI_CHECK_SOURCE_FILE([$srcdir/$mod/Makefile.am],
[INCLUDE_STATIC_MODULES="${INCLUDE_STATIC_MODULES}#include \"../${modheader}\"
"
ADD_STATIC_MODULES="${ADD_STATIC_MODULES} engine.addmodule(new nest::${Mod}(net));
"],
[printf ""])
done
# Now instruct configure to generate $PKGBUILDDIR/nest/static_modules.h,
# including the required headers and providing the add_static_modules()
# function.
# This way of doing it is quite a hack. We cannot use AC_CONFIG_FILES(), since
# we cannot AC_SUBST() the multiline variables we create here.
AC_CONFIG_COMMANDS([nest/static_modules.h],
[printf "#ifndef STATIC_MODULES_H\n#define STATIC_MODULES_H\n\n$acc_include_static_modules\n#include \"interpret.h\"\n#include \"network.h\"\n\nvoid add_static_modules(SLIInterpreter& engine, nest::Network& net)\n{\n$acc_add_static_modules\n}\n#endif\n" > nest/static_modules.h],
[acc_include_static_modules='$INCLUDE_STATIC_MODULES'
acc_add_static_modules='$ADD_STATIC_MODULES'])
# directories to include in distribution tarballs
SLI_CORE_LIBS="libnestutil sli librandom lib nestkernel $SLI_PUBLIC_MODULES $SLI_PUBLIC_DYNMODULES"
SLI_DIST_SUBDIRS="$SLI_CORE_LIBS nest $PYNEST_SUBDIR"
SLI_SUBDIRS="$SLI_CORE_LIBS $SLI_EXTRA_MODULES nest"
# generate a list of absolute paths where to search for help files
for dir in $SLI_SUBDIRS; do
HELPDIRS="$HELPDIRS $PKGSRCDIR/$dir"
# Automatically include sli directory if it exists
if test -d "$PKGSRCDIR/$dir/sli" ; then
HELPDIRS="$HELPDIRS $PKGSRCDIR/$dir/sli"
fi
done
HELPDIRS=`echo $HELPDIRS | tr " " ":"`
INSTALL_HELP_LOG="$PKGBUILDDIR/install-help.log"
PKGDATADIR=$datadir/$PACKAGE
PKGDOCDIR=$datadir/doc/$PACKAGE
TESTSUITE_BASEDIR=`eval eval echo $PKGDOCDIR`
SLI_PREFIX=$prefix
# This hack resolves '${prefix}' in the variables
eval eval eval PKGDOCDIR_AS_CONFIGURED=$PKGDOCDIR
eval eval eval PKGDATADIR_AS_CONFIGURED=$PKGDATADIR
#-- Replace these variables in *.in
AC_SUBST(HAVE_ISTREAM)
AC_SUBST(HAVE_OSTREAM)
AC_SUBST(HAVE_SSTREAM)
AC_SUBST(HAVE_STL_VECTOR_CAPACITY_BASE_UNITY)
AC_SUBST(HAVE_STL_VECTOR_CAPACITY_DOUBLING)
AC_SUBST(HAVE_ERRNO_IGNORED)
AC_SUBST(HAVE_M_E)
AC_SUBST(HAVE_M_PI)
AC_SUBST(HAVE_CMATH_MAKROS_IGNORED)
AC_SUBST(HAVE_SIGUSR_IGNORED)
AC_SUBST(HAVE_PTHREAD)
AC_SUBST(HAVE_PTHREAD_IGNORED)
AC_SUBST(HAVE_READLINE)
AC_SUBST(HAVE_VAMPIR)
AC_SUBST(VAMPIR_LIBS)
AC_SUBST(VAMPIR_CFLAGS)
AC_SUBST(IS_BLUEGENE_L)
AC_SUBST(IS_BLUEGENE_P)
AC_SUBST(IS_BLUEGENE_Q)
AC_SUBST(IS_K)
AC_SUBST(SLI_MAJOR)
AC_SUBST(SLI_MINOR)
AC_SUBST(SLI_PATCHLEVEL)
AC_SUBST(SLI_VERSION)
AC_SUBST(SLI_PRGNAME)
AC_SUBST(SLI_PREFIX)
AC_SUBST(PKGSRCDIR)
AC_SUBST(PKGBUILDDIR)
AC_SUBST(PKGDATADIR)
AC_SUBST(PKGDATADIR_AS_CONFIGURED)
AC_SUBST(PKGDOCDIR)
AC_SUBST(PKGDOCDIR_AS_CONFIGURED)
AC_SUBST(TESTSUITE_BASEDIR)
AC_SUBST(SLI_EXITCODE_ABORT)
AC_SUBST(SLI_EXITCODE_SEGFAULT)
AC_SUBST(KERNEL)
AC_SUBST(HOST)
AC_SUBST(SED)
AC_SUBST(LD)
AC_SUBST(host_os)
AC_SUBST(host_cpu)
AC_SUBST(host_vendor)
AC_SUBST(AS)
AC_SUBST(CC)
AC_SUBST(CXX)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
AC_SUBST(CXX_AR)
AC_SUBST(AM_CXXFLAGS)
AC_SUBST(AM_CFLAGS)
AC_SUBST(OPENMP_CXXFLAGS)
AC_SUBST(MAKE)
AC_SUBST(MAKE_FLAGS)
AC_SUBST(SLI_SUBDIRS)
AC_SUBST(HELPDIRS)
AC_SUBST(INSTALL_HELP_LOG)
AC_SUBST(SLI_DIST_SUBDIRS)
AC_SUBST(SLI_THREAD_DEFS)
AC_SUBST(SLI_LIBS)
AC_SUBST(MPI_LIBS)
AC_SUBST(MPI_INCLUDE)
AC_SUBST(HAVE_MUSIC)
AC_SUBST(MUSIC_LIBS)
AC_SUBST(MUSIC_INCLUDE)
AC_SUBST(INCLTDL)
AC_SUBST(LIBLTDL)
AC_SUBST(HAVE_LIBLTDL)
AC_SUBST(LIBADD_DL)
AC_SUBST(LINKED_MODULES)
AC_SUBST(LINKED_USER_MODULES)
AC_SUBST(PYTHON_EXEC)
AC_SUBST(PYTHON_VERSION)
AC_SUBST(PYNEST_PREFIX)
AC_SUBST(PYNEST_SUBDIR)
AC_SUBST(PYNEST_MODULE)
AC_SUBST(PYNEST_MODULENAME)
AC_SUBST(HAVE_PYTHON)
AC_CONFIG_HEADER(libnestutil/config.h)
AC_CONFIG_FILES(libnestutil/sliconfig.h)