-
Notifications
You must be signed in to change notification settings - Fork 66
/
configure.ac
1506 lines (1305 loc) · 54 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
# configure.ac script for ngspice
#
# This file is part of ngspice.
#
# (Process this file with autoconf to produce a configure script.)
#
# This configure file has been updated to mostly follow the guidance in the
# GNU Autoconf manual for version 2.59
# Initialization
# ---------------
# Ensure a recent version of Autoconf is in use
# Older versions may not work with this script and this will report the
# problem to the user.
AC_PREREQ([2.59])
m4_define([ngspice_major_version], [43+])
m4_define([ngspice_minor_version], [0])
m4_define([ngspice_version],
[ngspice_major_version])
# Initialization of configure
AC_INIT([ngspice], [ngspice_version], [http://ngspice.sourceforge.net/bugrep.html])
# Revision stamp the generated ./configure script
AC_REVISION([$Revision: ngspice_version$])
# Unique file in the source directory
AC_CONFIG_SRCDIR([src/ngspice.c])
# Create a configuration header
AC_CONFIG_HEADERS([src/include/ngspice/config.h])
# Initialize automake stuff
AM_INIT_AUTOMAKE([-Wall -Werror nostdinc serial-tests])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
ext_CFLAGS="${CFLAGS+yes}"
AC_PROG_CC
AC_PROG_CXX
AX_PROG_CC_FOR_BUILD
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_SUBST([AM_CPPFLAGS], ['-I. -I$(srcdir) -I$(top_builddir)/src/include'])
AC_CONFIG_MACRO_DIR([m4])
# Enable the automatically build of shared and static libraries
LT_INIT([shared static])
# Setting the libtool versioning
###################################################################################
# #
# To set the version of the library, libtool provides the -version-info #
# parameter, which accepts three numbers, separated by colons, that are called #
# respectively, current, revision and age. Both their name and their behavior, #
# nowadays, have to be considered fully arbitrary, as the explanation provided #
# in the official documentation is confusing to say the least, and can be, in #
# some cases, considered completely wrong. #
# https://autotools.io/libtool/version.html #
# #
###################################################################################
#
# How to work with the libtool versioning?
#
# Follow the following steps from top to bottom. This means always start at point 1
# if you plan to make a release and change the values.
# Every new library starts with a version 'current' (short 'c') = 0
# 'revision' (short 'r') = 0
# 'age' (short 'a') = 0
#
# Update the libtool versioning only after the release of a public release of ngspice.
# Go through the following checklist from top to bottom and check your needs, following
# the reminded changes if you can say "Yes" for specific check.
#
# 1. Only existing code has changed, no functional changes.
# If the library source code has changed but *no* new symbols were added at all
# since the last update, then increment the revision (c:r:a becomes c:r+1:a).
# This is usually happen if the existing source of a function was changed for
# bug fixing e.g.
#
# --> Increase the 'LT_NGSPICE_REVISION' value with *every* new software release
# within one release cycle.
#
# 2. Interfaces were added, functions have changed or are removed.
# If any interfaces [exported functions or data] have been added, got internal
# changes that implies a different behavior or removed and by this the visible
# symbols have changed since the last update, increment current, and set the
# revision to 0 (c:r:a becomes c+1:r=0:a).
# The new modified behavior of the library isn't backward compatible!
#
# --> Increase the 'LT_NGSPICE_CURRENT' value whenever as an interface has been added
# or removed. This implies also a API change! You mostly have to change the
# 'ngspice_major_version'!
# --> Set 'LT_NGSPICE_REVISION' to 0.
#
# 3. Interfaces were added but none removed or changed.
# If any interfaces have been added since the last public release and non of the
# existing interfaces were removed and existing interfaces have not changed internal
# functionality then the new library is backward compatible. Existing binaries can
# use the new library the same way than as the existing old library without loosing
# existing functionality or breakage.
# Increase age by 1 (c:r:a becomes c:r:a+1).
#
# --> Increase the 'LT_NGSPICE_AGE' value only if the changes made to the ABI are
# backward compatible.
#
# 4. Interfaces were removed or have functional changes.
# If any interfaces within the library have been removed since the last public
# release or got some internal changes that let the interface act different than
# before, then set age to 0. The library isn't backwards compatible.
#
# --> Set 'LT_NGSPICE_AGE' to 0.
LT_NGSPICE_CURRENT=0
LT_NGSPICE_REVISION=10
LT_NGSPICE_AGE=0
LIBNGSPICE_SO_VERSION=$LT_NGSPICE_CURRENT.$LT_NGSPICE_REVISION.$LT_NGSPICE_AGE
# Announce the libtool version
AC_SUBST(LT_NGSPICE_CURRENT)
AC_SUBST(LT_NGSPICE_REVISION)
AC_SUBST(LT_NGSPICE_AGE)
AC_SUBST(LIBNGSPICE_SO_VERSION)
# Defining the API Version
LIBNGSPICE_API_VERSION=0
AC_SUBST(LIBNGSPICE_API_VERSION)
# Package Options
# ---------------
# --enable-debug: add -g and -Wall option to the compiler
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [Add -g option for compilation (default is without -g)])])
# --disable-xspice: define XSPICE in the code. This is for xspice support
AC_ARG_ENABLE([xspice],
[AS_HELP_STRING([--disable-xspice], [Disable XSPICE enhancements])])
# --disable-osdi: undefine OSDI in the code. This is for osdi support
AC_ARG_ENABLE([osdi],
[AS_HELP_STRING([--disable-osdi], [Disable OSDI integration])])
# --enable-cider: define CIDER in the code. This is for CIDER support
AC_ARG_ENABLE([cider],
[AS_HELP_STRING([--enable-cider], [Enable CIDER enhancements])])
# --enable-pss: enable PSS Analysis
AC_ARG_ENABLE([pss],
[AS_HELP_STRING([--enable-pss], [Enable PSS Analysis, (experimental)])])
# --disable-sp: disable S Parameter Analysis
AC_ARG_ENABLE([sp],
[AS_HELP_STRING([--disable-sp], [Disable S parameter Analysis])])
# --enable-relpath: Relative path for binary and data. Default is "no".
# ngspice shared may want relative paths for spinit etc.
AC_ARG_ENABLE([relpath],
[AS_HELP_STRING([--enable-relpath], [Enable relative paths for spinit etc. Default=no])])
# --with-readline: Includes GNU readline support into CLI. Default is "yes".
AC_ARG_WITH([readline],
[AS_HELP_STRING([--with-readline[=yes/no]], [Enable GNU readline support for CLI. Default=yes.])])
# --with-editline: Includes BSD Editline support into CLI. Default is "no".
AC_ARG_WITH([editline],
[AS_HELP_STRING([--with-editline[=yes/no]], [Enable BSD editline support for CLI. Default=no.])])
# --with-tcl: define TCL_MODULE in the code. This is for tcl support
AC_ARG_WITH([tcl],
[AS_HELP_STRING([--with-tcl=tcldir], [Compiles the tcl module instead, experimental, see README.tcl])])
# --with-ngshared: define SHARED_MODULE in the code. This is for ngspice as shared library (or dll)
AC_ARG_WITH([ngshared],
[AS_HELP_STRING([--with-ngshared], [Compiles ngspice as shared library (dll)])])
# --disable-utf8: don't use utf-8 and tchar for string representation, UNICODE support disabled
AC_ARG_ENABLE([utf8],
[AS_HELP_STRING([--disable-utf8], [Don't use utf-8 or tchar (default is UNICODE support with utf-8)])])
# --enable-shortcheck: CMC quality check only for BSIM3/4 to shorten check time
AC_ARG_ENABLE([shortcheck],
[AS_HELP_STRING([--enable-shortcheck], [CMC QA check only for BSIM4/4])])
# --with-fftw3: Use fftw3 for Fourier transforms. Default is "yes".
AC_ARG_WITH([fftw3],
[AS_HELP_STRING([--with-fftw3[=yes/no]], [Use fftw3 for Fourier transforms. Default=yes.])])
# --disable-klu: Do not use the KLU linear systems solver
AC_ARG_ENABLE([klu],
[AS_HELP_STRING([--disable-klu], [Use KLU linear systems solver. Default=yes.])])
# old options, not maintained, may even not work at all
# --enable-oldapps: define OLDAPPS
AC_ARG_ENABLE([oldapps],
[AS_HELP_STRING([--enable-oldapps], [Enable making old, outdated apps.])])
# --enable-ansi: try to force --ansi option to the compiler
AC_ARG_ENABLE([ansi],
[AS_HELP_STRING([--enable-ansi], [Force --ansi option for compilation])])
# --enable-gprof: add -pg option to the compiler (GCC)
AC_ARG_ENABLE([gprof],
[AS_HELP_STRING([--enable-gprof], [Produce gprof profiling data in 'gmon.out' (GCC only).])])
# --enable-nobypass: define NOBYPASS for the code
AC_ARG_ENABLE([nobypass],
[AS_HELP_STRING([--enable-nobypass], [Don't bypass recalculations of slowly changing variables])])
# --enable-capbypass: define CAPBYPASS for the code
AC_ARG_ENABLE([capbypass],
[AS_HELP_STRING([--enable-capbypass], [Bypass calculation of cbd/cbs in the mosfets if the vbs/vbd voltages are unchanged])])
# --enable-nodelimiting: define NODELIMITING for the code
AC_ARG_ENABLE([nodelimiting],
[AS_HELP_STRING([--enable-nodelimiting], [Experimental damping scheme.])])
# --enable-predictor: define PREDICTOR for the code
AC_ARG_ENABLE([predictor],
[AS_HELP_STRING([--enable-predictor], [Enable a predictor method for convergence.])])
# --enable-newpred: define NEWPRED for the code
AC_ARG_ENABLE([newpred],
[AS_HELP_STRING([--enable-newpred], [Enable NEWPRED whatever it is(?)])])
# --enable-newtrunc: define NEWTRUNC for the code
AC_ARG_ENABLE([newtrunc],
[AS_HELP_STRING([--enable-newtrunc], [Enable, how we want extrapolate capacitances.])])
# --enable-sense2: define WANT_SENSE2 for the code
AC_ARG_ENABLE([sense2],
[AS_HELP_STRING([--enable-sense2], [Use spice2 sensitivity analysis.])])
# --enable-ftedebug: enable frontend debug macros
AC_ARG_ENABLE([ftedebug],
[AS_HELP_STRING([--enable-ftedebug], [Enable ngspice frontend debug])])
# --enable-cpdebug: enable frontend debug macros
AC_ARG_ENABLE([cpdebug],
[AS_HELP_STRING([--enable-cpdebug], [Enable ngspice shell debug])])
# --enable-sensdebug: define SENSDEBUG for the code
AC_ARG_ENABLE([sensdebug],
[AS_HELP_STRING([--enable-sensdebug], [Debug sensitivity code *SENSDEBUG*])])
# --enable-asdebug: define ASDEBUG for the code
AC_ARG_ENABLE([asdebug],
[AS_HELP_STRING([--enable-asdebug], [Debug sensitivity code *ASDEBUG*])])
# --enable-stepdebug: define STEPDEBUG for the code
AC_ARG_ENABLE([stepdebug],
[AS_HELP_STRING([--enable-stepdebug], [Unknown debug option])])
# --enable-pzdebug: define PZDEBUG for the code
AC_ARG_ENABLE([pzdebug],
[AS_HELP_STRING([--enable-pzdebug], [Debug pole/zero code])])
# --enable-blktmsdebug: define D_DBG_BLOCKTIMES for the code
AC_ARG_ENABLE([blktmsdebug],
[AS_HELP_STRING([--enable-blktmsdebug], [Debug distortion code *BLOCKTIMES*])])
# --enable-smltmsdebug: define D_DBG_SMALLTIMES for the code
AC_ARG_ENABLE([smltmsdebug],
[AS_HELP_STRING([--enable-smltmsdebug], [Debug distortion code *SMALLTIMES*])])
# --enable-smoketest: a smoketest
AC_ARG_ENABLE([smoketest],
[AS_HELP_STRING([--enable-smoketest], [Enable smoketest compile])])
# --enable-experimental: define EXPERIMENTAL_CODE for the code
AC_ARG_ENABLE([experimental],
[AS_HELP_STRING([--enable-experimental], [Enable some experimental code])])
# --enable-expdevices: Enable the compilation of experimental devices
AC_ARG_ENABLE([expdevices],
[AS_HELP_STRING([--enable-expdevices], [Enable experimental devices (they do not compile)])])
# --enable-ndev: define NDEV in the code. An interface for external device i.e. numerical device
AC_ARG_ENABLE([ndev],
[AS_HELP_STRING([--enable-ndev], [Enable NDEV interface, (experimental)])])
# --enable-cluster: define CLUSTER in the code. This is for cluster support
AC_ARG_ENABLE([cluster],
[AS_HELP_STRING([--enable-cluster], [Enable cluster support, (experimental)])])
# --enable-cmathtests: run the ancient tests in src/math/cmaths
AC_ARG_ENABLE([cmathtests],
[AS_HELP_STRING([--enable-cmathtests], [Enable ancient tests in src/math/cmaths])])
# --enable-help: try to force --ansi option to the compiler
AC_ARG_ENABLE([help],
[AS_HELP_STRING([--enable-help], [Force building nghelp (deprecated)])])
# readline and editline cannot both be enabled
if test "x$with_editline" = xyes; then
if test "x$with_readline" = xyes; then
AC_MSG_ERROR([Readline and editline cannot both be enabled])
fi
fi
# Add KLU solver to ngspice
if test "x$enable_klu" = xyes || test "x$enable_klu" = x ; then
AC_DEFINE(KLU, [], [Define if we want KLU linear systems solver])
AC_MSG_RESULT([KLU solver enabled])
else
AC_MSG_RESULT([KLU solver disabled!])
fi
AM_CONDITIONAL([KLU_WANTED], [test "x$enable_klu" = xyes || test "x$enable_klu" = x])
# Enable maintainer commands only if requested
AM_MAINTAINER_MODE([enable])
# Compiler checks
# ---------------
# Work on compiler options according to system:
# Set default CFLAGS - only use -Wall if we have gcc
# the above AC_PROG_CC may set CFLAGS to "-O2 -g"
if test "x$ext_CFLAGS" != xyes; then
if test "x$enable_debug" = xyes; then
AC_DEFINE([NGDEBUG], [1], [Compile with debug info])
AC_MSG_WARN([Compile with debugging option -g!])
if test "x$GCC" = xyes; then
CFLAGS="-g -O0"
else
CFLAGS="-g"
fi
else
AC_MSG_RESULT([Debugging option -g removed])
if test "x$GCC" = xyes; then
CFLAGS="-O2 -s"
else
CFLAGS="-O2"
fi
fi
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion -Wno-unused-but-set-variable"
fi
else
AC_MSG_RESULT([Use external CFLAGS])
fi
# the profiling option
if test "x$enable_gprof" = xyes; then
# Probably other compilers support -pg or something similar;
# feel free to extend this to include them.
if test "x$GCC" = xyes; then
if test "x$enable_shared" = xyes ; then
AC_MSG_ERROR([Can't have --enable-gprof without --disable-shared (we recommend also using --enable-all-static).])
fi
if test "x$enable_static" != xyes ; then
AC_MSG_WARN([We recommend --enable-static with --enable-gprof.])
fi
AC_MSG_NOTICE([Enabling gprof profiling data (to gmon.out).])
CFLAGS="$CFLAGS -pg"
LDFLAGS="$LDFLAGS -pg"
else
AC_MSG_ERROR([We only support --enable-gprof with GCC right now.])
fi
fi
# Checks for ANSI-C header files.
AC_CHECK_HEADERS([strings.h])
if test "x$enable_ansi" = xyes; then
if test "x$ac_cv_prog_cc_stdc" != xyes ; then
AC_MSG_WARN([Failed to find Ansi flag!])
fi
fi
if test "x$enable_smoketest" = xyes; then
# CFLAGS="$CFLAGS -Werror"
CFLAGS="$CFLAGS -pedantic -W -Wmissing-prototypes"
CFLAGS="$CFLAGS -Wstrict-prototypes -Wtraditional"
CFLAGS="$CFLAGS -Wconversion -Wshadow -Wpointer-arith"
CFLAGS="$CFLAGS -Wcast-qual -Wcast-align -Wwrite-strings"
CFLAGS="$CFLAGS -Waggregate-return -fshort-enums -fno-common"
CFLAGS="$CFLAGS -Wnested-externs -Dinline= -g -O4"
fi
# Check system we're on , and tune accordingly
AC_CANONICAL_HOST
# Expand the prefix variable
if test "x$prefix" = xNONE ; then
# with the MS WINDOWS executable we suggest C:/Spice/bin as *.exe-path
if test "x$with_wingui" = xyes; then
dprefix="C:/Spice"
prefix=$dprefix
else
dprefix=$ac_default_prefix
fi
else
dprefix=$prefix
fi
####
### check for operating system at compile time
AM_CONDITIONAL([DLIBS_FULLY_RESOLVED], false)
case $host_os in
*mingw* | *msys* )
AC_DEFINE([OS_COMPILED], [1], [MINGW for MS Windows])
AM_CONDITIONAL([DLIBS_FULLY_RESOLVED], true)
;;
*cygwin* )
AC_DEFINE([OS_COMPILED], [2], [Cygwin for MS Windows])
AM_CONDITIONAL([DLIBS_FULLY_RESOLVED], true)
;;
*freebsd* )
AC_DEFINE([OS_COMPILED], [3], [FreeBSD])
;;
*openbsd* )
AC_DEFINE([OS_COMPILED], [4], [OpenBSD])
;;
*solaris* )
AC_DEFINE([OS_COMPILED], [5], [Solaris])
;;
*linux* )
AC_DEFINE([OS_COMPILED], [6], [Linux])
;;
*darwin* )
AC_DEFINE([OS_COMPILED], [7], [macOS])
;;
* )
AC_DEFINE([OS_COMPILED], [0], [Other Operating System])
;;
esac
##########################################################################
#
# ngspice as shared library (ngspice.so or ngspice.dll)
#
##########################################################################
if test "x$with_ngshared" != x && test "x$with_ngshared" != xno ; then
has_shared_module=true
AC_DEFINE([SHARED_MODULE], [1], [shared ngspice module])
case $host_os in
*mingw* | *msys* )
has_shwin=true
has_no_help=true
;;
*cygwin* )
has_shcyg=true
AC_CHECK_LIB([pthread], [pthread_create])
;;
*)
AC_CHECK_LIB([pthread], [pthread_create])
;;
esac
if test "x$enable_debug" = xno; then
case $host_os in
*solaris* )
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -fvisibility=hidden"
else
CFLAGS="$CFLAGS -xldscope=hidden"
fi
;;
*mingw* | *msys* | *cygwin* )
;;
*)
CFLAGS="$CFLAGS -fvisibility=hidden"
;;
esac
fi
with_x=no
with_windows=no
AC_SUBST([STATIC], [-shared])
TCL_PACKAGE_PATH=""
TCL_LIB_SPEC=""
##########################################################################
#
# tcl libraries test
#
##########################################################################
#
# The tclSpice options
#
elif test "x$with_tcl" != x && test "x$with_tcl" != xno ; then
has_tcl_module=true
AC_DEFINE([TCL_MODULE], [1], [Tcl Module])
case $host_os in
*mingw* | *msys* )
has_tclwin=true
has_no_help=true
AC_DEFINE([HAS_TCLWIN], [1], [Tcl Windows])
;;
*cygwin* )
has_tclcyg=true
;;
*)
;;
esac
with_x=no
AC_MSG_CHECKING([for tclConfig.sh])
tcl_config_sh=""
if test "x$with_tcl" != xyes ; then
for dir in \
$with_tcl
do
if test -r "$dir/tclConfig.sh" ; then
tcl_config_sh="$dir/tclConfig.sh"
break
elif test -r "$dir/lib/tclConfig.sh" ; then
tcl_config_sh="$dir/lib/tclConfig.sh"
break
elif test -r "$dir/unix/tclConfig.sh" ; then
tcl_config_sh="$dir/unix/tclConfig.sh"
break
fi
done
else
for dir in \
$prefix \
$exec_prefix
do
if test -r "$dir/tclConfig.sh" ; then
tcl_config_sh="$dir/tclConfig.sh"
break
elif test -r "$dir/lib/tclConfig.sh" ; then
tcl_config_sh="$dir/lib/tclConfig.sh"
break
elif test -r "$dir/unix/tclConfig.sh" ; then
tcl_config_sh="$dir/unix/tclConfig.sh"
break
fi
done
if test "x$tcl_config_sh" = x ; then
for dir in \
`ls -dr /usr/local/tcltk/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
`ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
`ls -dr /usr/local/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
`ls -dr /usr/share/tcltk/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
`ls -dr /usr/share/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
`ls -dr /usr/share/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
`ls -dr /usr/lib/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
`ls -dr /usr/lib/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
/usr/local/tcl \
/usr/local \
/usr \
/mingw
do
if test -r "$dir/tclConfig.sh" ; then
echo "Automatic research of tclConfig.sh Found one, accepting it and stopping research."
tcl_config_sh="$dir/tclConfig.sh"
break
elif test -r "$dir/lib/tclConfig.sh" ; then
echo "Automatic research of tclConfig.sh Found one, accepting it and stopping research."
tcl_config_sh="$dir/lib/tclConfig.sh"
break
fi
done
fi
fi
AC_MSG_RESULT([${tcl_config_sh}])
if test "x$tcl_config_sh" = x ; then
echo "can't find Tcl configuration script \"tclConfig.sh\""
find /usr/ -name 'tclConfig.sh' -exec echo "Should you add --with-tcl={} to ./configure arguments?" \; | sed -re "s/\/tclConfig.sh/ /"
exit 1
fi
. $tcl_config_sh
CFLAGS="$CFLAGS $TCL_INCLUDE_SPEC"
CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
AC_CHECK_HEADERS([tcl.h blt.h], [], [AC_MSG_ERROR([Couldn't find Tcl/BLT headers])])
if test ! -x "$TCL_EXEC_PREFIX/bin/tclsh$TCL_VERSION" ; then
AC_MSG_ERROR([Couldn't find $TCL_EXEC_PREFIX/bin/tclsh$TCL_VERSION])
fi
AC_MSG_CHECKING([for TCL module BLT])
rm -f conftest.tcl
cat > conftest.tcl << EOF
package require BLT;
exit;
EOF
if ($TCL_EXEC_PREFIX/bin/tclsh$TCL_VERSION conftest.tcl; exit) 2>/dev/null
then
AC_MSG_RESULT([Found])
else
AC_MSG_ERROR([Couldn't find BLT])
fi
rm -f conftest.tcl
AC_SEARCH_LIBS([Blt_GetVector], [BLT BLT24 BLT25],,
[AC_MSG_ERROR([Couldnt find BLT library.])])
AC_CHECK_LIB([pthread], [pthread_create])
if test -n "$libdir" ; then
AC_SUBST([libdir])
echo "libraries in $libdir"
fi
if test -z "$libdir" ; then
for TCL_PACKAGE_PATH_ELEMENT in $TCL_PACKAGE_PATH ; do
if test -a "$TCL_PACKAGE_PATH_ELEMENT" ; then
libdir=$TCL_PACKAGE_PATH_ELEMENT
AC_SUBST([libdir])
echo "library in $libdir"
break
fi
done
fi
AC_SUBST([STATIC], [-shared])
else
TCL_PACKAGE_PATH=""
TCL_LIB_SPEC=""
AC_SUBST([STATIC], [-static])
fi
AM_CONDITIONAL([SHARED_MODULE], [test "x$has_shared_module" = xtrue])
AM_CONDITIONAL([SHWIN], [test "x$has_shwin" = xtrue])
AM_CONDITIONAL([SHCYG], [test "x$has_shcyg" = xtrue])
AM_CONDITIONAL([TCL_MODULE], [test "x$has_tcl_module" = xtrue])
AM_CONDITIONAL([TCLWIN], [test "x$has_tclwin" = xtrue])
AM_CONDITIONAL([TCLCYG], [test "x$has_tclcyg" = xtrue])
AC_SUBST([TCL_PACKAGE_PATH])
AC_SUBST([TCL_LIB_SPEC])
##################################################################
#
#
#End of tcl libraries test
#
#################################################################
# Checks for programs
AM_PROG_CC_C_O
# --with-windows : the user wants to use generate the MS WINDOWS GUI executable
# old command version, deprecated, use --with-wingui
AC_ARG_WITH([windows],
[AS_HELP_STRING([--with-windows], [MS WINDOWS GUI executable, deprecated])],
[if test "x$with_windows" = xyes; then
AC_DEFINE([HAS_WINGUI], [1], [define to specify MS Windows executable with simple GUI])
fi],
[with_windows=no])
# --with-wingui : the user wants to use generate the MS WINDOWS GUI executable
AC_MSG_CHECKING([whether windows code with gui is enabled])
AC_ARG_WITH([wingui],
[AS_HELP_STRING([--with-wingui], [MS WINDOWS GUI executable])],
[if test "x$with_wingui" = xyes; then
AC_DEFINE([HAS_WINGUI], [1], [define to specify MS Windows executable with simple GUI])
fi],
[if test "x$with_windows" = xyes; then
with_wingui=yes
else
with_wingui=no
fi])
AC_MSG_RESULT([$with_wingui])
AM_CONDITIONAL([WINGUI], [test "x$with_wingui" = xyes])
case $host_os in
*mingw* | *msys* )
has_win32=yes
if test "x$with_wingui" = xyes; then
has_winconsole=no
else
if test "x$with_ngshared" = xyes; then
has_winconsole=no
else
has_winconsole=yes
fi
fi
;;
*cygwin* )
has_cyg=yes
;;
*)
has_win32=no
has_cyg=no
;;
esac
AM_CONDITIONAL([WINCONSOLE], [test "x$has_winconsole" = xyes])
if test "x$has_winconsole" = xyes; then
AC_CHECK_PROGS([WINRES], [windres windres.exe], [no])
if test "x$WINRES" = xno; then
AC_MSG_WARN([If you want adding the icon you should install windres])
fi
fi
if test "x$with_wingui" = xyes; then
AC_CHECK_PROGS([WINRES], [windres windres.exe], [no])
if test "x$WINRES" = xno; then
AC_MSG_WARN([If you want adding the icon you should install windres])
fi
fi
AM_CONDITIONAL([WINRESOURCE], [test "x$WINRES" = xwindres])
case $with_wingui in
yes )
AC_DEFINE([X_DISPLAY_MISSING])
AC_MSG_RESULT([No X display!])
has_no_x=true
if test "x$enable_help" = xyes; then
has_no_help=false
else
has_no_help=true
fi
CFLAGS="$CFLAGS -mwindows"
;;
* )
# Check for /proc (virtual process information file system)
AC_CHECK_HEADERS([/proc/meminfo])
# Checks for X11 header files and libraries - X11 support can be disabled
# by passing the '--without-x' option to configure:
# Try to locate the X-Windows include files and libraries
# will set no_x="yes" or no_x=""
AC_PATH_X
# will set X_CFLAGS, X_LIBS, and might define X_DISPLAY_MISSING
AC_PATH_XTRA
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_VPRINTF
# Check if the user wants to use the appropriate rpath commands to compile in
# the shared library path for the X libraries. This is off by default since
# that is how it has been historically. Using --enable-rpath will turn this on
_use_rpath=no
AC_MSG_CHECKING([if hard-coding of the X11 runtime library path is desired])
AC_ARG_ENABLE([rpath],
[AS_HELP_STRING([--enable-rpath], [Enable hard-coding the X11 runtime library path])],
[ if test "x$enable_rpath" = xno ; then
AC_MSG_RESULT([no])
_use_rpath=no
else
AC_MSG_RESULT([yes])
_use_rpath=yes
fi
],
[ AC_MSG_RESULT([no])
_use_rpath=no
]
)
if test "x$_use_rpath" = xyes ; then
# Try to figure out if we need -Rpath for finding X11 libs
# at runtime. Why autoconf doesn't already do this, I don't
# know...
xlib_path=""
for p in $X_LDFLAGS ; do
case $p in
-L*)
xlib_path="$xlib_path $p"
;;
esac
done
_save_LIBS=$LIBS
LIBS="$LIBS $X_LDFLAGS"
rpath=""
for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R" "-R " ; do
xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"`
LIBS="$_save_LIBS $X_LIBS $xlib_rpath"
AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime libraries])
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
[AC_MSG_RESULT([yes])
rpath=$fl],
[AC_MSG_RESULT([no])])
test -n "$rpath" && break
done
if test -n "$rpath"; then
X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
fi
LIBS=$_save_LIBS
fi
# Checks for X libraries - if X11 wasn't found then don't make following
# tests and compile without X11 support - otherwise, check if the following
# libraries are present (error if they are not)
# XShmAttach is a struct in CYGWIN, not a function
# Library order is
# -lXaw -lXmu -lXt -lXext -lX11 (-lXft -lfontconfig -lXrender -lfreetype)
# Xft is optional, allows text rotation in plots
if test "x$no_x" != xyes ; then
X_CFLAGS="$X_CFLAGS -I/usr/include/freetype2"
AC_CHECK_LIB([Xaw], [main], [X_LIBS="$X_LIBS -lXaw"],
[AC_MSG_ERROR([Couldn't find Xaw library])], [$X_LIBS $X_EXTRA_LIBS])
AC_CHECK_LIB([Xmu], [main], [X_LIBS="$X_LIBS -lXmu"],
[AC_MSG_ERROR([Couldn't find Xmu library])], [$X_LIBS $X_EXTRA_LIBS])
X_LIBS="$X_LIBS -lXt"
AC_CHECK_LIB([Xext], [XShmAttach], [X_LIBS="$X_LIBS -lXext"],
[AC_MSG_ERROR([Couldn't find Xext library])], [$X_LIBS $X_EXTRA_LIBS])
X_LIBS="$X_LIBS -lX11"
AC_CHECK_LIB([Xft], [main],
[AC_DEFINE([HAVE_LIBXFT], [1], [Have xft routines in libxft])]
X_LIBS="$X_LIBS -lXft -lfontconfig -lXrender -lfreetype"
has_xft=yes,
[has_xft=no], [$X_LIBS $X_EXTRA_LIBS])
if test "x$has_xft" = xyes ; then
AC_CHECK_LIB([fontconfig], [main], [],
[AC_MSG_ERROR([Couldn't find fontconfig library])], [$X_LIBS $X_EXTRA_LIBS])
# AC_CHECK_LIB([Xrender], [main], [],
# [AC_MSG_ERROR([Couldn't find Xrender library])], [$X_LIBS $X_EXTRA_LIBS])
AC_CHECK_LIB([freetype], [main], [],
[AC_MSG_ERROR([Couldn't find freetype library])], [$X_LIBS $X_EXTRA_LIBS])
fi
has_no_x=false
else
AC_DEFINE([X_DISPLAY_MISSING])
AC_MSG_RESULT([No X display!])
has_no_x=true
fi
if test "x$enable_help" = xyes && test "x$no_x" != xyes ; then
has_no_help=false
else
has_no_help=true
fi ;;
esac
# end of case --with-windows
AM_CONDITIONAL([NO_X], [test "x$has_no_x" = xtrue])
AM_CONDITIONAL([NO_HELP], [test "x$has_no_help" = xtrue])
# Additional libs of hicum group
AC_CHECK_LIB(stdc++, main, XTRALIBS="$XTRALIBS -lstdc++",,)
AC_SUBST(XTRALIBS, $XTRALIBS)
LIBS="$LIBS $XTRALIBS"
# enabling making of the old and outdated applications
# ngsconvert ngproc2mod ngmultidec ngmakeidx nghelp
if test "x$enable_oldapps" = xyes ; then
AC_MSG_RESULT([ngnutmeg ngsconvert ngproc2mod ngmultidec ngmakeidx nghelp are made.])
else
AC_MSG_RESULT([ngnutmeg ngsconvert ngproc2mod ngmultidec ngmakeidx nghelp are not made.])
AC_MSG_RESULT([No internal help available.])
AC_DEFINE([NOINTHELP], [1], [Internal (old) help not available])
fi
AM_CONDITIONAL([OLDAPPS], [test "x$enable_oldapps" = xyes])
# Check for a few typdefs:
AC_TYPE_PID_T
# sighandler_t is the type of the signal handler on GNU variants,
# sig_t is the type of a signal handler on 4.4BSD's,
# other systems use __sighandler_t.
AC_CHECK_TYPES([sighandler_t, sig_t, __sighandler_t], [], [],
[#include <sys/types.h>
#include <signal.h>])
# Check for a few libraries and headers:
AC_HEADER_DIRENT
AC_CHECK_HEADERS([unistd.h ctype.h pwd.h fcntl.h sys/ioctl.h stropts.h])
AC_HEADER_SYS_WAIT
AC_HEADER_STAT
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stddef.h sys/file.h sys/param.h sys/socket.h sys/time.h sys/timeb.h sys/io.h])
# Check time and resources headers and functions:
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_CHECK_FUNCS([localtime])
AC_CHECK_FUNCS([ftime gettimeofday])
# Do not use time or getrusage function for CPU time measurement under OpenMP
if test "x$enable_openmp" = xno; then
AC_CHECK_FUNCS([time getrusage])
fi
AC_CHECK_FUNCS([utimes])
AC_CHECK_FUNCS([getrlimit ulimit], [break])
AC_CHECK_FUNCS([endpwent gethostbyname memset select socket strdup strerror strncasecmp strstr strtol])
# Look for termios first (posix)
AC_CHECK_HEADERS([termios.h termio.h sgtty.h], [break])
AC_CHECK_FUNCS([isatty tcgetattr tcsetattr])
# Check for a few functions:
AC_FUNC_FORK([])
AC_CHECK_FUNCS([access qsort dup2 popen tsearch tdestroy])
AC_CHECK_FUNCS([strchr index], [break])
AC_CHECK_FUNCS([strrchr rindex], [break])
AC_CHECK_FUNCS([getcwd getwd], [break])
AC_MSG_RESULT([Checking mathematical features of the system:])
# Look for math library:
AC_CHECK_LIB([m], [sqrt])
AC_CHECK_HEADERS([float.h limits.h values.h ieeefp.h])
if test "x$with_fftw3" != xno; then
AC_CHECK_HEADERS([fftw3.h])
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d],
[AC_DEFINE([HAVE_LIBFFTW3], [], [Have fft routines in libfftw3])
LIBS="$LIBS -lfftw3"])
fi
# Check for a few mathematical functions:
AC_CHECK_FUNCS([erfc logb scalb scalbn asinh acosh atanh finite])
# According POSIX we should look for macros first
AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]])
AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]])
# But may be we have still functions
if test "x$ac_cv_have_decl_isinf" != xyes; then
AC_CHECK_FUNC([isinf])
fi
if test "x$ac_cv_have_decl_isnan" != xyes; then
AC_CHECK_FUNC([isnan])
fi
# If user enables garbage collection, look for garbage collector
if test "x$TCL_PACKAGE_PATH" = x; then
if test "x$enable_gc" = xyes; then
AC_MSG_RESULT([Checking for the presence of the Garbage Collector:])
AC_CHECK_LIB([gc], [GC_malloc],
[AC_DEFINE([HAVE_LIBGC], [], [Define if we want garbage collection enabled])
LIBS="$LIBS -lgc"])
fi
fi
# check, if we have sigsetjmp and siglongjmp.
# A trivial AC_CHECK_FUNCS(sigsetjmp) won't do because sigsetjmp() might be a
# macro declared in <setjmp.h>. (joze)
AC_MSG_CHECKING([for sigsetjmp])
AC_TRY_LINK([#include <setjmp.h>],[jmp_buf env; sigsetjmp(env, 1);],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_SIGSETJMP], [], [Define if we have sigsetjmp().])],
[AC_MSG_RESULT([no])])
# Check for the snprintf function:
AC_CHECK_FUNCS([snprintf])
# Check for the dirname function:
AC_CHECK_FUNCS([dirname], [],
[AC_CHECK_LIB([gen], [dirname],
[AC_DEFINE([HAVE_DIRNAME], [1], [Have dirname in libgen])
LIBS="$LIBS -lgen"])])
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_FUNC([getopt_long], [getopt_long=true])
if test "x$getopt_long" = xtrue; then
AC_DEFINE([HAVE_GETOPT_LONG], [1], [Have fcn getopt_long()])
fi
AM_CONDITIONAL([RELPATH], [test "x$enable_relpath" = xyes])
if test "x$enable_relpath" = xyes; then
AC_DEFINE_UNQUOTED([NGSPICEBINDIR], ["`echo ../bin`"], [Define the directory for executables])
AC_DEFINE_UNQUOTED([NGSPICEDATADIR], ["`echo ../share/ngspice`"], [Define the directory for architecture independent data files])
AC_DEFINE_UNQUOTED([NGSPICELIBDIR], ["`echo ../lib/ngspice`"], [Define the directory for architecture-dependent libraries])
AC_DEFINE([HAS_RELPATH], [1], [rel. path of libraries and scripts])
else
AC_DEFINE_UNQUOTED([NGSPICEBINDIR], ["`echo $dprefix/bin`"], [Define the directory for executables])
AC_DEFINE_UNQUOTED([NGSPICEDATADIR], ["`echo $dprefix/share/ngspice`"], [Define the directory for architecture independent data files])
AC_DEFINE_UNQUOTED([NGSPICELIBDIR], ["`echo $dprefix/lib/ngspice`"], [Define the directory for architecture-dependent libraries])