1# configure.ac script for ngspice 2# 3# This file is part of ngspice. 4# 5# (Process this file with autoconf to produce a configure script.) 6# 7# This configure file has been updated to mostly follow the guidance in the 8# GNU Autoconf manual for version 2.59 9 10 11# Initialization 12# --------------- 13 14# Ensure a recent version of Autoconf is in use 15# Older versions may not work with this script and this will report the 16# problem to the user. 17AC_PREREQ([2.59]) 18 19m4_define([ngspice_major_version], [35]) 20m4_define([ngspice_minor_version], [0]) 21m4_define([ngspice_version], 22 [ngspice_major_version]) 23 24# Initialization of configure 25AC_INIT([ngspice], [ngspice_version], [http://ngspice.sourceforge.net/bugrep.html]) 26 27# Revision stamp the generated ./configure script 28AC_REVISION([$Revision: ngspice_version$]) 29 30# Unique file in the source directory 31AC_CONFIG_SRCDIR([src/ngspice.c]) 32 33# Create a configuration header 34AC_CONFIG_HEADER([src/include/ngspice/config.h]) 35 36# Initialize automake stuff 37AM_INIT_AUTOMAKE([-Wall -Werror nostdinc serial-tests]) 38m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 39 40ext_CFLAGS="${CFLAGS+yes}" 41 42AC_PROG_CC 43AC_PROG_CXX 44AX_PROG_CC_FOR_BUILD 45 46m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 47 48AC_SUBST([AM_CPPFLAGS], ['-I. -I$(srcdir) -I$(top_builddir)/src/include']) 49 50AC_CONFIG_MACRO_DIR([m4]) 51 52# Enable the automatically build of shared and static libraries 53LT_INIT([shared static]) 54 55# Setting the libtool versioning 56################################################################################### 57# # 58# To set the version of the library, libtool provides the -version-info # 59# parameter, which accepts three numbers, separated by colons, that are called # 60# respectively, current, revision and age. Both their name and their behavior, # 61# nowadays, have to be considered fully arbitrary, as the explanation provided # 62# in the official documentation is confusing to say the least, and can be, in # 63# some cases, considered completely wrong. # 64# https://autotools.io/libtool/version.html # 65# # 66################################################################################### 67# 68# How to work with the libtool versioning? 69# 70# Follow the following steps from top to bottom. This means always start at point 1 71# if you plan to make a release and change the values. 72# Every new library starts with a version 'current' (short 'c') = 0 73# 'revision' (short 'r') = 0 74# 'age' (short 'a') = 0 75# 76# Update the libtool versioning only after the release of a public release of ngspice. 77# Go through the following checklist from top to bottom and check your needs, following 78# the reminded changes if you can say "Yes" for specific check. 79# 80# 1. Only existing code has changed, no functional changes. 81# If the library source code has changed but *no* new symbols were added at all 82# since the last update, then increment the revision (c:r:a becomes c:r+1:a). 83# This is usually happen if the existing source of a function was changed for 84# bug fixing e.g. 85# 86# --> Increase the 'LT_NGSPICE_REVISION' value with *every* new software release 87# within one release cycle. 88# 89# 2. Interfaces were added, functions have changed or are removed. 90# If any interfaces [exported functions or data] have been added, got internal 91# changes that implies a different behavior or removed and by this the visible 92# symbols have changed since the last update, increment current, and set the 93# revision to 0 (c:r:a becomes c+1:r=0:a). 94# The new modified behavior of the library isn't backward compatible! 95# 96# --> Increase the 'LT_NGSPICE_CURRENT' value whenever as an interface has been added 97# or removed. This implies also a API change! You mostly have to change the 98# 'ngspice_major_version'! 99# --> Set 'LT_NGSPICE_REVISION' to 0. 100# 101# 3. Interfaces were added but none removed or changed. 102# If any interfaces have been added since the last public release and non of the 103# existing interfaces were removed and existing interfaces have not changed internal 104# functionality then the new library is backward compatible. Existing binaries can 105# use the new library the same way than as the existing old library without loosing 106# existing functionality or breakage. 107# Increase age by 1 (c:r:a becomes c:r:a+1). 108# 109# --> Increase the 'LT_NGSPICE_AGE' value only if the changes made to the ABI are 110# backward compatible. 111# 112# 4. Interfaces were removed or have functional changes. 113# If any interfaces within the library have been removed since the last public 114# release or got some internal changes that let the interface act different than 115# before, then set age to 0. The library isn't backwards compatible. 116# 117# --> Set 'LT_NGSPICE_AGE' to 0. 118 119LT_NGSPICE_CURRENT=0 120LT_NGSPICE_REVISION=1 121LT_NGSPICE_AGE=0 122LIBNGSPICE_SO_VERSION=$LT_NGSPICE_CURRENT.$LT_NGSPICE_REVISION.$LT_NGSPICE_AGE 123 124# Announce the libtool version 125AC_SUBST(LT_NGSPICE_CURRENT) 126AC_SUBST(LT_NGSPICE_REVISION) 127AC_SUBST(LT_NGSPICE_AGE) 128AC_SUBST(LIBNGSPICE_SO_VERSION) 129 130# Defining the API Version 131LIBNGSPICE_API_VERSION=0 132AC_SUBST(LIBNGSPICE_API_VERSION) 133 134# Package Options 135# --------------- 136 137# --disable-debug: remove -g and -Wall option to the compiler 138AC_ARG_ENABLE([debug], 139 [AS_HELP_STRING([--disable-debug], [Remove -g option for compilation (default is -g)])]) 140 141 # --enable-oldapps: define OLDAPPS 142AC_ARG_ENABLE([oldapps], 143 [AS_HELP_STRING([--enable-oldapps], [Enable making old, outdated apps.])]) 144 145# --enable-xspice: define XSPICE in the code. This is for xspice support 146AC_ARG_ENABLE([xspice], 147 [AS_HELP_STRING([--enable-xspice], [Enable XSPICE enhancements])]) 148 149# --enable-cider: define CIDER in the code. This is for CIDER support 150AC_ARG_ENABLE([cider], 151 [AS_HELP_STRING([--enable-cider], [Enable CIDER enhancements])]) 152 153# --enable-adms: define ADMS in the code. This is for the adms Verilog-A compiler support 154AC_ARG_ENABLE([adms], 155 [AS_HELP_STRING([--enable-adms], [Enable ADMS code models, (experimental)])]) 156 157# --enable-pss: enable PSS Analysis 158AC_ARG_ENABLE([pss], 159 [AS_HELP_STRING([--enable-pss], [Enable PSS Analysis, (experimental)])]) 160 161# --enable-relpath: Relative path for binary and data. Default is "no". 162# ngspice shared may want relative paths for spinit etc. 163AC_ARG_ENABLE([relpath], 164 [AS_HELP_STRING([--enable-relpath], [Enable relative paths for spinit etc. Default=no])]) 165 166# --with-readline: Includes GNU readline support into CLI. Default is "no". 167AC_ARG_WITH([readline], 168 [AS_HELP_STRING([--with-readline[=yes/no]], [Enable GNU readline support for CLI. Default=no.])]) 169 170# --with-editline: Includes BSD Editline support into CLI. Default is "no". 171AC_ARG_WITH([editline], 172 [AS_HELP_STRING([--with-editline[=yes/no]], [Enable BSD editline support for CLI. Default=no.])]) 173 174# --with-tcl: define TCL_MODULE in the code. This is for tcl support 175AC_ARG_WITH([tcl], 176 [AS_HELP_STRING([--with-tcl=tcldir], [Compiles the tcl module instead, experimental, see README.tcl])]) 177 178# --with-ngshared: define SHARED_MODULE in the code. This is for ngspice as shared library (or dll) 179AC_ARG_WITH([ngshared], 180 [AS_HELP_STRING([--with-ngshared], [Compiles ngspice as shared library (dll)])]) 181 182# --disable-utf8: don't use utf-8 and tchar for string representation, UNICODE support disabled 183AC_ARG_ENABLE([utf8], 184 [AS_HELP_STRING([--disable-utf8], [Don't use utf-8 or tchar (default is UNICODE support with utf-8)])]) 185 186# old options, not maintained, may even not work at all 187 188# --enable-ansi: try to force --ansi option to the compiler 189AC_ARG_ENABLE([ansi], 190 [AS_HELP_STRING([--enable-ansi], [Force --ansi option for compilation])]) 191 192# --enable-gprof: add -pg option to the compiler (GCC) 193AC_ARG_ENABLE([gprof], 194 [AS_HELP_STRING([--enable-gprof], [Produce gprof profiling data in 'gmon.out' (GCC only).])]) 195 196# --enable-nobypass: define NOBYPASS for the code 197AC_ARG_ENABLE([nobypass], 198 [AS_HELP_STRING([--enable-nobypass], [Don't bypass recalculations of slowly changing variables])]) 199 200# --enable-capbypass: define CAPBYPASS for the code 201AC_ARG_ENABLE([capbypass], 202 [AS_HELP_STRING([--enable-capbypass], [Bypass calculation of cbd/cbs in the mosfets if the vbs/vbd voltages are unchanged])]) 203 204# --enable-nodelimiting: define NODELIMITING for the code 205AC_ARG_ENABLE([nodelimiting], 206 [AS_HELP_STRING([--enable-nodelimiting], [Experimental damping scheme.])]) 207 208# --enable-predictor: define PREDICTOR for the code 209AC_ARG_ENABLE([predictor], 210 [AS_HELP_STRING([--enable-predictor], [Enable a predictor method for convergence.])]) 211 212# --enable-newpred: define NEWPRED for the code 213AC_ARG_ENABLE([newpred], 214 [AS_HELP_STRING([--enable-newpred], [Enable NEWPRED whatever it is(?)])]) 215 216# --enable-newtrunc: define NEWTRUNC for the code 217AC_ARG_ENABLE([newtrunc], 218 [AS_HELP_STRING([--enable-newtrunc], [Enable, how we want extrapolate capacitances.])]) 219 220# --enable-sense2: define WANT_SENSE2 for the code 221AC_ARG_ENABLE([sense2], 222 [AS_HELP_STRING([--enable-sense2], [Use spice2 sensitivity analysis.])]) 223 224# --enable-ftedebug: enable frontend debug macros 225AC_ARG_ENABLE([ftedebug], 226 [AS_HELP_STRING([--enable-ftedebug], [Enable ngspice frontend debug])]) 227 228# --enable-cpdebug: enable frontend debug macros 229AC_ARG_ENABLE([cpdebug], 230 [AS_HELP_STRING([--enable-cpdebug], [Enable ngspice shell debug])]) 231 232# --enable-sensdebug: define SENSDEBUG for the code 233AC_ARG_ENABLE([sensdebug], 234 [AS_HELP_STRING([--enable-sensdebug], [Debug sensitivity code *SENSDEBUG*])]) 235 236# --enable-asdebug: define ASDEBUG for the code 237AC_ARG_ENABLE([asdebug], 238 [AS_HELP_STRING([--enable-asdebug], [Debug sensitivity code *ASDEBUG*])]) 239 240# --enable-stepdebug: define STEPDEBUG for the code 241AC_ARG_ENABLE([stepdebug], 242 [AS_HELP_STRING([--enable-stepdebug], [Unknown debug option])]) 243 244# --enable-pzdebug: define PZDEBUG for the code 245AC_ARG_ENABLE([pzdebug], 246 [AS_HELP_STRING([--enable-pzdebug], [Debug pole/zero code])]) 247 248# --enable-blktmsdebug: define D_DBG_BLOCKTIMES for the code 249AC_ARG_ENABLE([blktmsdebug], 250 [AS_HELP_STRING([--enable-blktmsdebug], [Debug distortion code *BLOCKTIMES*])]) 251 252# --enable-smltmsdebug: define D_DBG_SMALLTIMES for the code 253AC_ARG_ENABLE([smltmsdebug], 254 [AS_HELP_STRING([--enable-smltmsdebug], [Debug distortion code *SMALLTIMES*])]) 255 256# --enable-smoketest: a smoketest 257AC_ARG_ENABLE([smoketest], 258 [AS_HELP_STRING([--enable-smoketest], [Enable smoketest compile])]) 259 260# --enable-experimental: define EXPERIMENTAL_CODE for the code 261AC_ARG_ENABLE([experimental], 262 [AS_HELP_STRING([--enable-experimental], [Enable some experimental code])]) 263 264# --enable-expdevices: Enable the compilation of experimental devices 265AC_ARG_ENABLE([expdevices], 266 [AS_HELP_STRING([--enable-expdevices], [Enable experimental devices (they do not compile)])]) 267 268# --enable-ndev: define NDEV in the code. An interface for external device i.e. numerical device 269AC_ARG_ENABLE([ndev], 270 [AS_HELP_STRING([--enable-ndev], [Enable NDEV interface, (experimental)])]) 271 272# --enable-cluster: define CLUSTER in the code. This is for cluster support 273AC_ARG_ENABLE([cluster], 274 [AS_HELP_STRING([--enable-cluster], [Enable cluster support, (experimental)])]) 275 276# --enable-cmathtests: run the ancient tests in src/math/cmaths 277AC_ARG_ENABLE([cmathtests], 278 [AS_HELP_STRING([--enable-cmathtests], [Enable ancient tests in src/math/cmaths])]) 279 280# --enable-help: try to force --ansi option to the compiler 281AC_ARG_ENABLE([help], 282 [AS_HELP_STRING([--enable-help], [Force building nghelp (deprecated)])]) 283 284# --with-fftw3: Use fftw3 for Fourier transforms. Default is "yes". 285AC_ARG_WITH([fftw3], 286 [AS_HELP_STRING([--with-fftw3[=yes/no]], [Use fftw3 for Fourier transforms. Default=yes.])]) 287 288# readline and editline cannot both be enabled 289if test "x$with_editline" = xyes; then 290 if test "x$with_readline" = xyes; then 291 AC_MSG_ERROR([Readline and editline cannot both be enabled]) 292 fi 293fi 294 295 296# Enable maintainer commands only if requested 297AM_MAINTAINER_MODE([enable]) 298 299 300# Compiler checks 301# --------------- 302 303# Work on compiler options according to system: 304# Set default CFLAGS - only use -Wall if we have gcc 305 306# the above AC_PROG_CC may set CFLAGS to "-O2 -g" 307if test "x$ext_CFLAGS" != xyes; then 308 309 if test "x$enable_debug" = xno; then 310 AC_MSG_WARN([Removing debugging option!]) 311 if test "x$GCC" = xyes; then 312 CFLAGS="-O2 -s" 313 else 314 CFLAGS="-O2" 315 fi 316 else 317 AC_DEFINE([NGDEBUG], [1], [Compile with debug info]) 318 if test "x$GCC" = xyes; then 319 CFLAGS="-g -O0" 320 else 321 CFLAGS="-g" 322 fi 323 fi 324 325 if test "x$GCC" = xyes; then 326 CFLAGS="$CFLAGS -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion -Wno-unused-but-set-variable" 327 fi 328 329fi 330 331# the profiling option 332if test "x$enable_gprof" = xyes; then 333 # Probably other compilers support -pg or something similar; 334 # feel free to extend this to include them. 335 if test "x$GCC" = xyes; then 336 if test "x$enable_shared" = xyes ; then 337 AC_MSG_ERROR([Can't have --enable-gprof without --disable-shared (we recommend also using --enable-all-static).]) 338 fi 339 if test "x$enable_static" != xyes ; then 340 AC_MSG_WARN([We recommend --enable-static with --enable-gprof.]) 341 fi 342 AC_MSG_NOTICE([Enabling gprof profiling data (to gmon.out).]) 343 CFLAGS="$CFLAGS -pg" 344 LDFLAGS="$LDFLAGS -pg" 345 else 346 AC_MSG_ERROR([We only support --enable-gprof with GCC right now.]) 347 fi 348fi 349 350# Checks for ANSI-C header files. 351AC_HEADER_STDC 352AC_CHECK_HEADERS([strings.h]) 353 354if test "x$enable_ansi" = xyes; then 355 AC_PROG_CC() 356 AC_DIAGNOSE([obsolete], [AM_PROG_CC_STDC: 357 your code should no longer depend upon `am_cv_prog_cc_stdc', but upon 358 `ac_cv_prog_cc_stdc'. Remove this warning and the assignment when 359 you adjust the code. You can also remove the above call to 360 AC_PROG_CC if you already called it elsewhere.]) 361 am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc 362 363 if test "x$am_cv_prog_cc_stdc" != xyes ; then 364 AC_MSG_WARN([Failed to find Ansi flag!]) 365 fi 366fi 367 368if test "x$enable_smoketest" = xyes; then 369# CFLAGS="$CFLAGS -Werror" 370 CFLAGS="$CFLAGS -pedantic -W -Wmissing-prototypes" 371 CFLAGS="$CFLAGS -Wstrict-prototypes -Wtraditional" 372 CFLAGS="$CFLAGS -Wconversion -Wshadow -Wpointer-arith" 373 CFLAGS="$CFLAGS -Wcast-qual -Wcast-align -Wwrite-strings" 374 CFLAGS="$CFLAGS -Waggregate-return -fshort-enums -fno-common" 375 CFLAGS="$CFLAGS -Wnested-externs -Dinline= -g -O4" 376fi 377 378 379# Check system we're on , and tune accordingly 380AC_CANONICAL_HOST 381 382# Expand the prefix variable 383if test "x$prefix" = xNONE ; then 384# with the MS WINDOWS executable we suggest C:/Spice/bin as *.exe-path 385 if test "x$with_wingui" = xyes; then 386 dprefix="C:/Spice" 387 prefix=$dprefix 388 else 389 dprefix=$ac_default_prefix 390 fi 391else 392 dprefix=$prefix 393fi 394 395#### 396### check for operating system at compile time 397case $host_os in 398 *mingw* | *msys* ) 399 AC_DEFINE([OS_COMPILED], [1], [MINGW for MS Windows]) 400 ;; 401 *cygwin* ) 402 AC_DEFINE([OS_COMPILED], [2], [Cygwin for MS Windows]) 403 ;; 404 *freebsd* ) 405 AC_DEFINE([OS_COMPILED], [3], [FreeBSD]) 406 ;; 407 *openbsd* ) 408 AC_DEFINE([OS_COMPILED], [4], [OpenBSD]) 409 ;; 410 *solaris* ) 411 AC_DEFINE([OS_COMPILED], [5], [Solaris]) 412 ;; 413 *linux* ) 414 AC_DEFINE([OS_COMPILED], [6], [Linux]) 415 ;; 416 *darwin* ) 417 AC_DEFINE([OS_COMPILED], [7], [macOS]) 418 ;; 419 * ) 420 AC_DEFINE([OS_COMPILED], [0], [Other Operating System]) 421 ;; 422esac 423 424########################################################################## 425# 426# ngspice as shared library (ngspice.so or ngspice.dll) 427# 428########################################################################## 429 430if test "x$with_ngshared" != x && test "x$with_ngshared" != xno ; then 431 has_shared_module=true 432 AC_DEFINE([SHARED_MODULE], [1], [shared ngspice module]) 433 case $host_os in 434 *mingw* | *msys* ) 435 has_shwin=true 436 has_no_help=true 437 ;; 438 *cygwin* ) 439 has_shcyg=true 440 AC_CHECK_LIB([pthread], [pthread_create]) 441 ;; 442 *) 443 AC_CHECK_LIB([pthread], [pthread_create]) 444 ;; 445 esac 446 if test "x$enable_debug" = xno; then 447 case $host_os in 448 *solaris* ) 449 if test "x$GCC" = xyes; then 450 CFLAGS="$CFLAGS -fvisibility=hidden" 451 else 452 CFLAGS="$CFLAGS -xldscope=hidden" 453 fi 454 ;; 455 *mingw* | *msys* | *cygwin* ) 456 ;; 457 *) 458 CFLAGS="$CFLAGS -fvisibility=hidden" 459 ;; 460 esac 461 fi 462 463 with_x=no 464 with_windows=no 465 466 AC_SUBST([STATIC], [-shared]) 467 468 TCL_PACKAGE_PATH="" 469 TCL_LIB_SPEC="" 470 471 472########################################################################## 473# 474# tcl libraries test 475# 476########################################################################## 477 478# 479# The tclSpice options 480# 481elif test "x$with_tcl" != x && test "x$with_tcl" != xno ; then 482 has_tcl_module=true 483 AC_DEFINE([TCL_MODULE], [1], [Tcl Module]) 484 case $host_os in 485 *mingw* | *msys* ) 486 has_tclwin=true 487 has_no_help=true 488 AC_DEFINE([HAS_TCLWIN], [1], [Tcl Windows]) 489 ;; 490 *cygwin* ) 491 has_tclcyg=true 492 ;; 493 *) 494 ;; 495 esac 496 497 with_x=no 498 499 AC_MSG_CHECKING([for tclConfig.sh]) 500 tcl_config_sh="" 501 if test "x$with_tcl" != xyes ; then 502 for dir in \ 503 $with_tcl 504 do 505 if test -r "$dir/tclConfig.sh" ; then 506 tcl_config_sh="$dir/tclConfig.sh" 507 break 508 elif test -r "$dir/lib/tclConfig.sh" ; then 509 tcl_config_sh="$dir/lib/tclConfig.sh" 510 break 511 elif test -r "$dir/unix/tclConfig.sh" ; then 512 tcl_config_sh="$dir/unix/tclConfig.sh" 513 break 514 fi 515 done 516 else 517 for dir in \ 518 $prefix \ 519 $exec_prefix 520 do 521 if test -r "$dir/tclConfig.sh" ; then 522 tcl_config_sh="$dir/tclConfig.sh" 523 break 524 elif test -r "$dir/lib/tclConfig.sh" ; then 525 tcl_config_sh="$dir/lib/tclConfig.sh" 526 break 527 elif test -r "$dir/unix/tclConfig.sh" ; then 528 tcl_config_sh="$dir/unix/tclConfig.sh" 529 break 530 fi 531 done 532 533 534 if test "x$tcl_config_sh" = x ; then 535 for dir in \ 536 `ls -dr /usr/local/tcltk/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ 537 `ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ 538 `ls -dr /usr/local/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ 539 `ls -dr /usr/share/tcltk/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ 540 `ls -dr /usr/share/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ 541 `ls -dr /usr/share/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ 542 `ls -dr /usr/lib/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ 543 `ls -dr /usr/lib/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ 544 /usr/local/tcl \ 545 /usr/local \ 546 /usr \ 547 /mingw 548 do 549 if test -r "$dir/tclConfig.sh" ; then 550 echo "Automatic research of tclConfig.sh Found one, accepting it and stopping research." 551 tcl_config_sh="$dir/tclConfig.sh" 552 break 553 elif test -r "$dir/lib/tclConfig.sh" ; then 554 echo "Automatic research of tclConfig.sh Found one, accepting it and stopping research." 555 tcl_config_sh="$dir/lib/tclConfig.sh" 556 break 557 fi 558 done 559 fi 560 fi 561 562 AC_MSG_RESULT([${tcl_config_sh}]) 563 564 if test "x$tcl_config_sh" = x ; then 565 echo "can't find Tcl configuration script \"tclConfig.sh\"" 566 find /usr/ -name 'tclConfig.sh' -exec echo "Should you add --with-tcl={} to ./configure arguments?" \; | sed -re "s/\/tclConfig.sh/ /" 567 exit 1 568 fi 569 570 . $tcl_config_sh 571 572 CFLAGS="$CFLAGS $TCL_INCLUDE_SPEC" 573 CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC" 574 575 AC_CHECK_HEADERS([tcl.h blt.h], [], [AC_MSG_ERROR([Couldn't find Tcl/BLT headers])]) 576 577 if test ! -x "$TCL_EXEC_PREFIX/bin/tclsh$TCL_VERSION" ; then 578 AC_MSG_ERROR([Couldn't find $TCL_EXEC_PREFIX/bin/tclsh$TCL_VERSION]) 579 fi 580 581 AC_MSG_CHECKING([for TCL module BLT]) 582 583 rm -f conftest.tcl 584 cat > conftest.tcl << EOF 585package require BLT; 586exit; 587EOF 588 589 if ($TCL_EXEC_PREFIX/bin/tclsh$TCL_VERSION conftest.tcl; exit) 2>/dev/null 590 then 591 AC_MSG_RESULT([Found]) 592 else 593 AC_MSG_ERROR([Couldn't find BLT]) 594 fi 595 rm -f conftest.tcl 596 597 AC_SEARCH_LIBS([Blt_GetVector], [BLT BLT24 BLT25],, 598 [AC_MSG_ERROR([Couldnt find BLT library.])]) 599 600 AC_CHECK_LIB([pthread], [pthread_create]) 601 602 if test -n "$libdir" ; then 603 AC_SUBST([libdir]) 604 echo "libraries in $libdir" 605 fi 606 607 if test -z "$libdir" ; then 608 for TCL_PACKAGE_PATH_ELEMENT in $TCL_PACKAGE_PATH ; do 609 if test -a "$TCL_PACKAGE_PATH_ELEMENT" ; then 610 libdir=$TCL_PACKAGE_PATH_ELEMENT 611 AC_SUBST([libdir]) 612 echo "library in $libdir" 613 break 614 fi 615 done 616 fi 617 618 AC_SUBST([STATIC], [-shared]) 619 620else 621 TCL_PACKAGE_PATH="" 622 TCL_LIB_SPEC="" 623 AC_SUBST([STATIC], [-static]) 624fi 625 626 627AM_CONDITIONAL([SHARED_MODULE], [test "x$has_shared_module" = xtrue]) 628AM_CONDITIONAL([SHWIN], [test "x$has_shwin" = xtrue]) 629AM_CONDITIONAL([SHCYG], [test "x$has_shcyg" = xtrue]) 630AM_CONDITIONAL([TCL_MODULE], [test "x$has_tcl_module" = xtrue]) 631AM_CONDITIONAL([TCLWIN], [test "x$has_tclwin" = xtrue]) 632AM_CONDITIONAL([TCLCYG], [test "x$has_tclcyg" = xtrue]) 633 634AC_SUBST([TCL_PACKAGE_PATH]) 635AC_SUBST([TCL_LIB_SPEC]) 636################################################################## 637# 638# 639#End of tcl libraries test 640# 641################################################################# 642 643 644 645# Checks for programs 646AC_LIBTOOL_WIN32_DLL 647AC_LIBTOOL_DLOPEN 648AM_PROG_CC_C_O 649## AM_PROG_LIBTOOL 650AC_PROG_LIBTOOL 651 652 653# --with-windows : the user wants to use generate the MS WINDOWS GUI executable 654# old command version, deprecated, use --with-wingui 655AC_ARG_WITH([windows], 656 [AS_HELP_STRING([--with-windows], [MS WINDOWS GUI executable, deprecated])], 657 [if test "x$with_windows" = xyes; then 658 AC_DEFINE([HAS_WINGUI], [1], [define to specify MS Windows executable with simple GUI]) 659 fi], 660 [with_windows=no]) 661 662# --with-wingui : the user wants to use generate the MS WINDOWS GUI executable 663AC_MSG_CHECKING([whether windows code with gui is enabled]) 664AC_ARG_WITH([wingui], 665 [AS_HELP_STRING([--with-wingui], [MS WINDOWS GUI executable])], 666 [if test "x$with_wingui" = xyes; then 667 AC_DEFINE([HAS_WINGUI], [1], [define to specify MS Windows executable with simple GUI]) 668 fi], 669 [if test "x$with_windows" = xyes; then 670 with_wingui=yes 671 else 672 with_wingui=no 673 fi]) 674AC_MSG_RESULT([$with_wingui]) 675AM_CONDITIONAL([WINGUI], [test "x$with_wingui" = xyes]) 676 677case $host_os in 678 *mingw* | *msys* ) 679 has_win32=yes 680 if test "x$with_wingui" = xyes; then 681 has_winconsole=no 682 else 683 if test "x$with_ngshared" = xyes; then 684 has_winconsole=no 685 else 686 has_winconsole=yes 687 fi 688 fi 689 ;; 690 *cygwin* ) 691 has_cyg=yes 692 ;; 693 *) 694 has_win32=no 695 has_cyg=no 696 ;; 697esac 698AM_CONDITIONAL([WINCONSOLE], [test "x$has_winconsole" = xyes]) 699 700if test "x$has_winconsole" = xyes; then 701 AC_CHECK_PROGS([WINRES], [windres windres.exe], [no]) 702 if test "x$WINRES" = xno; then 703 AC_MSG_WARN([If you want adding the icon you should install windres]) 704 fi 705fi 706 707if test "x$with_wingui" = xyes; then 708 AC_CHECK_PROGS([WINRES], [windres windres.exe], [no]) 709 if test "x$WINRES" = xno; then 710 AC_MSG_WARN([If you want adding the icon you should install windres]) 711 fi 712fi 713 714AM_CONDITIONAL([WINRESOURCE], [test "x$WINRES" = xwindres]) 715 716case $with_wingui in 717 yes ) 718 AC_DEFINE([X_DISPLAY_MISSING]) 719 AC_MSG_RESULT([No X display!]) 720 has_no_x=true 721 if test "x$enable_help" = xyes; then 722 has_no_help=false 723 else 724 has_no_help=true 725 fi 726 CFLAGS="$CFLAGS -mwindows" 727 ;; 728 * ) 729 730# Check for /proc (virtual process information file system) 731AC_CHECK_HEADERS([/proc/meminfo]) 732 733# Checks for X11 header files and libraries - X11 support can be disabled 734# by passing the '--without-x' option to configure: 735 736# Try to locate the X-Windows include files and libraries 737# will set no_x="yes" or no_x="" 738AC_PATH_X 739 740# will set X_CFLAGS, X_LIBS, and might define X_DISPLAY_MISSING 741AC_PATH_XTRA 742 743# Checks for typedefs, structures, and compiler characteristics. 744AC_HEADER_STDBOOL 745AC_TYPE_SIZE_T 746 747# Checks for library functions. 748AC_FUNC_CLOSEDIR_VOID 749AC_FUNC_SELECT_ARGTYPES 750AC_FUNC_SETVBUF_REVERSED 751AC_FUNC_VPRINTF 752 753# Check if the user wants to use the appropriate rpath commands to compile in 754# the shared library path for the X libraries. This is off by default since 755# that is how it has been historically. Using --enable-rpath will turn this on 756 757_use_rpath=no 758AC_MSG_CHECKING([if hard-coding of the X11 runtime library path is desired]) 759AC_ARG_ENABLE([rpath], 760 [AS_HELP_STRING([--enable-rpath], [Enable hard-coding the X11 runtime library path])], 761 [ if test "x$enable_rpath" = xno ; then 762 AC_MSG_RESULT([no]) 763 _use_rpath=no 764 else 765 AC_MSG_RESULT([yes]) 766 _use_rpath=yes 767 fi 768 ], 769 [ AC_MSG_RESULT([no]) 770 _use_rpath=no 771 ] 772) 773 774 775if test "x$_use_rpath" = xyes ; then 776 # Try to figure out if we need -Rpath for finding X11 libs 777 # at runtime. Why autoconf doesn't already do this, I don't 778 # know... 779 xlib_path="" 780 for p in $X_LDFLAGS ; do 781 case $p in 782 -L*) 783 xlib_path="$xlib_path $p" 784 ;; 785 esac 786 done 787 788 _save_LIBS=$LIBS 789 LIBS="$LIBS $X_LDFLAGS" 790 rpath="" 791 for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R" "-R " ; do 792 xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"` 793 LIBS="$_save_LIBS $X_LIBS $xlib_rpath" 794 AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime libraries]) 795 AC_LINK_IFELSE([AC_LANG_PROGRAM()], 796 [AC_MSG_RESULT([yes]) 797 rpath=$fl], 798 [AC_MSG_RESULT([no])]) 799 test -n "$rpath" && break 800 done 801 if test -n "$rpath"; then 802 X_LDFLAGS="$X_LDFLAGS $xlib_rpath" 803 fi 804 LIBS=$_save_LIBS 805fi 806 807# Checks for X libraries - if X11 wasn't found then don't make following 808# tests and compile without X11 support - otherwise, check if the following 809# libraries are present (error if they are not) 810# XShmAttach is a struct in CYGWIN, not a function 811# Library order is 812# -lXaw -lXmu -lXt -lXext -lX11 (-lXft -lfontconfig -lXrender -lfreetype) 813# Xft is optional, allows text rotation in plots 814 815if test "x$no_x" != xyes ; then 816 X_CFLAGS="$X_CFLAGS -I/usr/include/freetype2" 817 AC_CHECK_LIB([Xaw], [main], [X_LIBS="$X_LIBS -lXaw"], 818 [AC_MSG_ERROR([Couldn't find Xaw library])], [$X_LIBS $X_EXTRA_LIBS]) 819 AC_CHECK_LIB([Xmu], [main], [X_LIBS="$X_LIBS -lXmu"], 820 [AC_MSG_ERROR([Couldn't find Xmu library])], [$X_LIBS $X_EXTRA_LIBS]) 821 X_LIBS="$X_LIBS -lXt" 822 AC_CHECK_LIB([Xext], [XShmAttach], [X_LIBS="$X_LIBS -lXext"], 823 [AC_MSG_ERROR([Couldn't find Xext library])], [$X_LIBS $X_EXTRA_LIBS]) 824 X_LIBS="$X_LIBS -lX11" 825 AC_CHECK_LIB([Xft], [main], 826 [AC_DEFINE([HAVE_LIBXFT], [1], [Have xft routines in libxft])] 827 X_LIBS="$X_LIBS -lXft -lfontconfig -lXrender -lfreetype" 828 has_xft=yes, 829 [has_xft=no], [$X_LIBS $X_EXTRA_LIBS]) 830 831 if test "x$has_xft" = xyes ; then 832 AC_CHECK_LIB([fontconfig], [main], [], 833 [AC_MSG_ERROR([Couldn't find fontconfig library])], [$X_LIBS $X_EXTRA_LIBS]) 834# AC_CHECK_LIB([Xrender], [main], [], 835# [AC_MSG_ERROR([Couldn't find Xrender library])], [$X_LIBS $X_EXTRA_LIBS]) 836 AC_CHECK_LIB([freetype], [main], [], 837 [AC_MSG_ERROR([Couldn't find freetype library])], [$X_LIBS $X_EXTRA_LIBS]) 838 fi 839 840 has_no_x=false 841else 842 AC_DEFINE([X_DISPLAY_MISSING]) 843 AC_MSG_RESULT([No X display!]) 844 has_no_x=true 845fi 846 847if test "x$enable_help" = xyes && test "x$no_x" != xyes ; then 848 has_no_help=false 849else 850 has_no_help=true 851fi ;; 852 853esac 854# end of case --with-windows 855 856AM_CONDITIONAL([NO_X], [test "x$has_no_x" = xtrue]) 857AM_CONDITIONAL([NO_HELP], [test "x$has_no_help" = xtrue]) 858 859# Additional libs of hicum group 860AC_CHECK_LIB(stdc++, main, XTRALIBS="$XTRALIBS -lstdc++",,) 861AC_SUBST(XTRALIBS, $XTRALIBS) 862 863LIBS="$LIBS $XTRALIBS" 864 865# enabling making of the old and outdated applications 866# ngsconvert ngproc2mod ngmultidec ngmakeidx nghelp 867if test "x$enable_oldapps" = xyes ; then 868 AC_MSG_RESULT([ngnutmeg ngsconvert ngproc2mod ngmultidec ngmakeidx nghelp are made.]) 869else 870 AC_MSG_RESULT([ngnutmeg ngsconvert ngproc2mod ngmultidec ngmakeidx nghelp are not made.]) 871 AC_MSG_RESULT([No internal help available.]) 872 AC_DEFINE([NOINTHELP], [1], [Internal (old) help not available]) 873fi 874AM_CONDITIONAL([OLDAPPS], [test "x$enable_oldapps" = xyes]) 875 876 877# Check for a few typdefs: 878AC_TYPE_PID_T 879AC_TYPE_SIGNAL 880 881# sighandler_t is the type of the signal handler on GNU variants, 882# sig_t is the type of a signal handler on 4.4BSD's, 883# other systems use __sighandler_t. 884AC_CHECK_TYPES([sighandler_t, sig_t, __sighandler_t], [], [], 885 [#include <sys/types.h> 886 #include <signal.h>]) 887 888# Check for a few libraries and headers: 889AC_HEADER_DIRENT 890AC_CHECK_HEADERS([unistd.h ctype.h pwd.h fcntl.h sys/ioctl.h stropts.h]) 891AC_HEADER_SYS_WAIT 892AC_HEADER_STAT 893 894AC_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]) 895 896 897# Check time and resources headers and functions: 898AC_HEADER_TIME 899AC_STRUCT_TM 900AC_STRUCT_TIMEZONE 901AC_CHECK_FUNCS([localtime]) 902 903AC_CHECK_FUNCS([ftime gettimeofday]) 904# Do not use time or getrusage function for CPU time measurement under OpenMP 905if test "x$enable_openmp" != xyes; then 906 AC_CHECK_FUNCS([time getrusage]) 907fi 908AC_CHECK_FUNCS([utimes]) 909AC_CHECK_FUNCS([getrlimit ulimit], [break]) 910 911AC_CHECK_FUNCS([endpwent gethostbyname memset select socket strdup strerror strncasecmp strstr strtol]) 912 913# Look for termios first (posix) 914AC_CHECK_HEADERS([termios.h termio.h sgtty.h], [break]) 915AC_CHECK_FUNCS([isatty tcgetattr tcsetattr]) 916 917# Check for a few functions: 918AC_FUNC_FORK([]) 919AC_CHECK_FUNCS([access qsort dup2 popen tsearch tdestroy]) 920AC_CHECK_FUNCS([strchr index], [break]) 921AC_CHECK_FUNCS([strrchr rindex], [break]) 922AC_CHECK_FUNCS([getcwd getwd], [break]) 923 924 925AC_MSG_RESULT([Checking mathematical features of the system:]) 926# Look for math library: 927AC_CHECK_LIB([m], [sqrt]) 928AC_CHECK_HEADERS([float.h limits.h values.h ieeefp.h]) 929if test "x$with_fftw3" != xno; then 930 AC_CHECK_HEADERS([fftw3.h]) 931 AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], 932 [AC_DEFINE([HAVE_LIBFFTW3], [], [Have fft routines in libfftw3]) 933 LIBS="$LIBS -lfftw3"]) 934fi 935 936# Check for a few mathematical functions: 937AC_CHECK_FUNCS([erfc logb scalb scalbn asinh acosh atanh finite]) 938# According POSIX we should look for macros first 939AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]]) 940AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]]) 941# But may be we have still functions 942if test "x$ac_cv_have_decl_isinf" != xyes; then 943 AC_CHECK_FUNC([isinf]) 944fi 945if test "x$ac_cv_have_decl_isnan" != xyes; then 946 AC_CHECK_FUNC([isnan]) 947fi 948 949# If user enables garbage collection, look for garbage collector 950if test "x$TCL_PACKAGE_PATH" = x; then 951 if test "x$enable_gc" = xyes; then 952 AC_MSG_RESULT([Checking for the presence of the Garbage Collector:]) 953 AC_CHECK_LIB([gc], [GC_malloc], 954 [AC_DEFINE([HAVE_LIBGC], [], [Define if we want garbage collection enabled]) 955 LIBS="$LIBS -lgc"]) 956 fi 957fi 958# check, if we have sigsetjmp and siglongjmp. 959# A trivial AC_CHECK_FUNCS(sigsetjmp) won't do because sigsetjmp() might be a 960# macro declared in <setjmp.h>. (joze) 961AC_MSG_CHECKING([for sigsetjmp]) 962AC_TRY_LINK([#include <setjmp.h>],[jmp_buf env; sigsetjmp(env, 1);], 963 [AC_MSG_RESULT([yes]) 964 AC_DEFINE([HAVE_SIGSETJMP], [], [Define if we have sigsetjmp().])], 965 [AC_MSG_RESULT([no])]) 966 967 968# Check for the snprintf function: 969AC_CHECK_FUNCS([snprintf]) 970 971# Check for the dirname function: 972AC_CHECK_FUNCS([dirname], [], 973 [AC_CHECK_LIB([gen], [dirname], 974 [AC_DEFINE([HAVE_DIRNAME], [1], [Have dirname in libgen]) 975 LIBS="$LIBS -lgen"])]) 976 977AC_CHECK_HEADERS([getopt.h]) 978AC_CHECK_FUNC([getopt_long], [getopt_long=true]) 979if test "x$getopt_long" = xtrue; then 980 AC_DEFINE([HAVE_GETOPT_LONG], [1], [Have fcn getopt_long()]) 981fi 982 983AM_CONDITIONAL([RELPATH], [test "x$enable_relpath" = xyes]) 984if test "x$enable_relpath" = xyes; then 985 AC_DEFINE_UNQUOTED([NGSPICEBINDIR], ["`echo ../bin`"], [Define the directory for executables]) 986 AC_DEFINE_UNQUOTED([NGSPICEDATADIR], ["`echo ../share/ngspice`"], [Define the directory for architecture independent data files]) 987 AC_DEFINE([HAS_RELPATH], [1], [rel. path of libraries and scripts]) 988else 989AC_DEFINE_UNQUOTED([NGSPICEBINDIR], ["`echo $dprefix/bin`"], [Define the directory for executables]) 990AC_DEFINE_UNQUOTED([NGSPICEDATADIR], ["`echo $dprefix/share/ngspice`"], [Define the directory for architecture independent data files]) 991fi 992 993# Create timestamp, may be overruled by setting env var SOURCE_DATE_EPOCH 994case $host_os in 995 *freebsd* ) 996 DATE_FMT="%Y-%m-%d" 997 SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" 998 BUILD_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u "+$DATE_FMT") 999 ;; 1000 *openbsd* ) 1001 DATE_FMT="%Y-%m-%d" 1002 SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" 1003 BUILD_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u "+$DATE_FMT") 1004 ;; 1005 * ) 1006 BUILD_DATE="$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}")" 1007 ;; 1008esac 1009 1010AC_DEFINE_UNQUOTED([NGSPICEBUILDDATE], ["$BUILD_DATE"], [Define the build date]) 1011 1012if test "x$with_wingui" = xyes; then 1013 AC_MSG_RESULT([WINDOWS GUI code enabled]) 1014 AC_CHECK_FUNCS([memmove]) 1015fi 1016 1017# Recapitulate settings: 1018AC_MSG_RESULT([Settings which were chosen:]) 1019 1020if test "x$enable_nobypass" = xyes; then 1021 AC_DEFINE([NOBYPASS], [], [Define if we want NOBYPASS]) 1022 AC_MSG_RESULT([NOBYPASS option enabled]) 1023fi 1024if test "x$enable_capbypass" = xyes; then 1025 AC_DEFINE([CAPBYPASS], [], [Define if we want to bypass cbd/cbs calculation for non varying vbs/vbd]) 1026 AC_MSG_RESULT([CAPBYPASS option enabled]) 1027fi 1028if test "x$enable_nodelimiting" = xyes; then 1029 AC_DEFINE([NODELIMITING], [], [Experimental code never implemented to damp Newton iterations]) 1030 AC_MSG_RESULT([NODELIMITING option enabled]) 1031fi 1032if test "x$enable_predictor" = xyes; then 1033 AC_DEFINE([PREDICTOR], [], [Define if we want predictor algorithm]) 1034 AC_MSG_RESULT([PREDICTOR algorithm enabled]) 1035fi 1036if test "x$enable_newpred" = xyes; then 1037 AC_DEFINE([NEWPRED], [], [Define if you want to discover :)]) 1038 AC_MSG_RESULT([NEWPRED enabled]) 1039fi 1040if test "x$enable_newtrunc" = xyes; then 1041 AC_DEFINE([NEWTRUNC], [], [Do not trigger unwanted traps by default]) 1042 AC_MSG_RESULT([New truncation error calculation enabled]) 1043fi 1044if test "x$enable_experimental" = xyes; then 1045 AC_DEFINE([EXPERIMENTAL_CODE], [], [Define if we want some experimental code]) 1046 AC_MSG_RESULT([EXPERIMENTAL_CODE enabled]) 1047fi 1048if test "x$enable_cpdebug" = xyes; then 1049 AC_DEFINE([CPDEBUG], [], [Define if you want to debug ngspice shell]) 1050 AC_MSG_RESULT([WARNING: Shell debug is enabled]) 1051fi 1052if test "x$enable_ftedebug" = xyes; then 1053 AC_DEFINE([FTEDEBUG], [], [Define if you want to debug frontend]) 1054 AC_MSG_RESULT([WARNING: Frontend debug is enabled]) 1055fi 1056if test "x$enable_sensdebug" = xyes; then 1057 AC_DEFINE([SENSDEBUG], [], [Define if we want debug sensitivity analysis]) 1058 AC_MSG_RESULT([WARNING: Sensitivity code debug *SENSDEBUG* is enabled]) 1059fi 1060if test "x$enable_asdebug" = xyes; then 1061 AC_DEFINE([ASDEBUG], [], [Define if we want debug sensitivity analysis]) 1062 AC_MSG_RESULT([WARNING: Sensitivity code debug *ASDEBUG* is enabled]) 1063fi 1064if test "x$enable_stepdebug" = xyes; then 1065 AC_DEFINE([STEPDEBUG], [], [Define if we want stepdebug]) 1066 AC_MSG_RESULT([WARNING: STEPDEBUG debug is enabled]) 1067fi 1068if test "x$enable_pzdebug" = xyes; then 1069 AC_DEFINE([PZDEBUG], [], [Define if you want to debug pole-zero analysis]) 1070 AC_MSG_RESULT([WARNING: Pole/Zero analysis debug is enabled]) 1071fi 1072if test "x$enable_pss" = xyes; then 1073 AC_DEFINE([WITH_PSS], [], [Define if you want PSS analysis]) 1074 AC_MSG_RESULT([WARNING: PSS analysis enabled]) 1075fi 1076if test "x$enable_blktmsdebug" = xyes; then 1077 AC_DEFINE([D_DBG_BLOCKTIMES], [], [Define if we want debug distortion analysis (BLOCKTIMES)]) 1078 AC_MSG_RESULT([WARNING: Distortion analysis debug *D_DBG_BLOCKTIMES* is enabled]) 1079fi 1080if test "x$enable_smltmsdebug" = xyes; then 1081 AC_DEFINE([D_DBG_SMALLTIMES], [], [Define if we want debug distortion analysis (SMALLTIMES)]) 1082 AC_MSG_RESULT([WARNING: Distortion analysis debug *D_DBG_SMALLTIMES* is enabled]) 1083fi 1084if test "x$enable_utf8" = xno; then 1085 AC_DEFINE([EXT_ASC], [], [Define if you want to disable UNICODE support]) 1086 AC_MSG_RESULT([WARNING: UNICOPDE support is disabled, extended ascii is enabled instead]) 1087fi 1088 1089AC_PROG_YACC 1090AC_PATH_PROG([BISON], [bison]) 1091AX_PROG_BISON_VERSION([2.7], [], 1092 [AC_DEFINE([OLD_BISON], [], [Bison is older than 2.7]), 1093 AC_MSG_WARN([Bison is older than 2.7])]) 1094AC_PROG_LEX 1095 1096AM_CONDITIONAL([CMATHTESTS], [test "x$enable_cmathtests" = xyes]) 1097 1098################# XSPICE ################################################## 1099# Add new code models to the build by pointing to them here. 1100 1101if test "x$enable_xspice" = xyes; then 1102 VIS_CFLAGS="" 1103 AC_MSG_RESULT([X-Spice features included]) 1104 AC_DEFINE([XSPICE], [1], [The xspice enhancements]) 1105 case $host_os in 1106 *mingw* | *msys* ) 1107 AC_DEFINE([IPC_DEBUG_VIA_STDIO], [1], [Client-Server only via stdio.]) 1108 XSPICEDLLIBS="" 1109 ;; 1110 *cygwin* ) 1111 AC_DEFINE([IPC_UNIX_SOCKETS], [1], [Client-Server via socket.]) 1112 XSPICEDLLIBS="" 1113 ;; 1114 *freebsd* ) 1115 AC_DEFINE([IPC_UNIX_SOCKETS], [1], [Client-Server via socket.]) 1116 XSPICEDLLIBS="-ldl" 1117 ;; 1118 *openbsd* ) 1119 AC_DEFINE([IPC_UNIX_SOCKETS], [1], [Client-Server via socket.]) 1120 XSPICEDLLIBS="-ldl" 1121 ;; 1122 *solaris* ) 1123 AC_DEFINE([IPC_UNIX_SOCKETS], [1], [Client-Server via socket.]) 1124 XSPICEDLLIBS="" 1125 if test "x$with_ngshared" != xyes ; then 1126 if test "x$enable_debug" = xno; then 1127 if test "x$GCC" = xyes; then 1128 VIS_CFLAGS="-fvisibility=hidden" 1129 else 1130 VIS_CFLAGS="-xldscope=hidden" 1131 fi 1132 fi 1133 fi 1134 ;; 1135 * ) 1136 AC_DEFINE([IPC_UNIX_SOCKETS], [1], [Client-Server via socket.]) 1137 XSPICEDLLIBS="-ldl" 1138 if test "x$with_ngshared" != xyes ; then 1139 if test "x$enable_debug" = xno; then 1140 VIS_CFLAGS="-fvisibility=hidden" 1141 fi 1142 fi 1143 ;; 1144 esac 1145 XSPICEINIT="" 1146 AC_CHECK_FUNCS([modf]) 1147 AC_CHECK_HEADERS([libintl.h malloc.h]) 1148 AC_SUBST([VIS_CFLAGS]) 1149else 1150 XSPICEINIT="*" 1151fi 1152AC_SUBST([XSPICEINIT]) 1153AC_SUBST([XSPICEDLLIBS]) 1154 1155AM_CONDITIONAL([XSPICE_WANTED], [test "x$enable_xspice" = xyes]) 1156 1157 1158# Add CIDER enhancements to ngspice. 1159if test "x$enable_cider" = xyes; then 1160 AC_MSG_RESULT([CIDER features enabled]) 1161 AC_DEFINE([CIDER], [1], [The CIDER enhancements]) 1162fi 1163 1164AM_CONDITIONAL([CIDER_WANTED], [test "x$enable_cider" = xyes]) 1165AM_CONDITIONAL([NUMDEV_WANTED], [test "x$enable_cider" = xyes]) 1166 1167 1168AM_CONDITIONAL([PSS_WANTED], [test "x$enable_pss" = xyes]) 1169 1170AM_CONDITIONAL([SENSE2_WANTED], [test "x$enable_sense2" = xyes]) 1171 1172# adms option 1173if test "x$enable_adms" = xyes ; then 1174 AC_MSG_RESULT([********************************** 1175* ADMS support is experimental * 1176**********************************]) 1177 AC_CHECK_PROGS([ADMSXML], [admsXml admsXml.exe]) 1178 1179 if test "x$ADMSXML" = x; then 1180 AC_MSG_ERROR([If you want Verilog-A models you should install admsXml]) 1181 fi 1182 AC_DEFINE([ADMS], [1], [Support for Verilog-A models]) 1183 1184 VLADEVDIR=" adms/bsimbulk \ 1185 adms/bsimcmg \ 1186 adms/ekv \ 1187 adms/hicum0 \ 1188 adms/mextram \ 1189 adms/psp102 \ 1190 adms/psp103 \ 1191 adms/r2_cmc " 1192 1193# The makefiles for adms (to be added to AC_CONFIG_FILES by ./autogen.sh --adms) 1194#VLAMKF src/spicelib/devices/adms/bsimbulk/Makefile 1195#VLAMKF src/spicelib/devices/adms/bsimcmg/Makefile 1196#VLAMKF src/spicelib/devices/adms/ekv/Makefile 1197#VLAMKF src/spicelib/devices/adms/hicum0/Makefile 1198#VLAMKF src/spicelib/devices/adms/mextram/Makefile 1199#VLAMKF src/spicelib/devices/adms/psp102/Makefile 1200#VLAMKF src/spicelib/devices/adms/psp103/Makefile 1201#VLAMKF src/spicelib/devices/adms/r2_cmc/Makefile 1202 1203 NOTVLADEVDIR="" 1204 1205 VLADEV=" spicelib/devices/adms/bsimbulk/libbsimbulk.la \ 1206 spicelib/devices/adms/bsimcmg/libbsimcmg.la \ 1207 spicelib/devices/adms/ekv/libekv.la \ 1208 spicelib/devices/adms/hicum0/libhicum0.la \ 1209 spicelib/devices/adms/mextram/libbjt504t.la \ 1210 spicelib/devices/adms/psp102/libpsp102.la \ 1211 spicelib/devices/adms/psp103/libpsp103.la \ 1212 spicelib/devices/adms/r2_cmc/libr2_cmc.la " 1213 1214else 1215 1216 VLADEVDIR="" 1217 NOTVLADEVDIR="adms/admst" 1218 1219fi 1220 1221AC_SUBST([VLADEVDIR]) 1222AC_SUBST([VLADEV]) 1223AC_SUBST([NOTVLADEVDIR]) 1224 1225# NDEV option 1226if test "x$enable_ndev" = xyes; then 1227 AC_MSG_RESULT([NDEV features enabled]) 1228 AC_DEFINE([NDEV], [], [The NDEV interface]) 1229fi 1230AM_CONDITIONAL([NDEV_WANTED], [test "x$enable_ndev" = xyes]) 1231 1232 1233# Cluster option 1234if test "x$enable_cluster" = xyes; then 1235 AC_MSG_RESULT([Cluster version is being compiled]) 1236 AC_DEFINE([CLUSTER], [], [Spice cluster support]) 1237 LIBS="$LIBS -lpthread" 1238fi 1239 1240if test "x$enable_expdevices" = xyes; then 1241 AC_DEFINE([EXP_DEV], [], [Define if we want to enable experimental devices]) 1242 AC_MSG_RESULT([WARNING: Experimental devices enabled]) 1243fi 1244 1245# ---- Option to include GNU readline support in ngspice CLI ---- 1246# ---- Default: disabled. ---- 1247# ---- Hope to see in the future readline replacement. ---- 1248 1249if test "x$with_readline" = x || test "x$with_readline" = xno ; then 1250 AC_MSG_RESULT([GNU readline disabled.]) 1251else 1252 if test "x$with_readline" = xyes; then 1253 if test "x$with_tcl" = x || test "x$with_tcl" = xno ; then 1254 AC_MSG_RESULT([Checking for readline:]) 1255 AC_CHECK_HEADERS([readline/readline.h readline/history.h], 1256 [AC_DEFINE([HAVE_GNUREADLINE], [], [Define if we have GNU readline])], 1257 [AC_MSG_ERROR([Couldn't find GNU readline headers.])]) 1258 AC_SEARCH_LIBS([tputs], [ncurses tinfo termcap], 1259 [AC_DEFINE([HAVE_TERMCAP], [], [Define if we have ncurses/terminfo or termcap])], 1260 [AC_MSG_ERROR([Found neither ncurses/terminfo or termcap])]) 1261 AC_CHECK_LIB([readline], [readline], 1262 [LIBS="$LIBS -lreadline"], 1263 [AC_MSG_ERROR([Couldn't find readline libraries.])]) 1264 fi 1265 else 1266# Especially defined for macOS (Big Sur), with readline installed from Brew 1267 for dir in \ 1268 $with_readline 1269 do 1270 if test "x$with_tcl" = x || test "x$with_tcl" = xno ; then 1271 AC_MSG_RESULT([Checking for readline:]) 1272 AC_CHECK_HEADERS([$dir/include/readline/readline.h $dir/include/readline/history.h], 1273 [AC_DEFINE([HAVE_GNUREADLINE], [], [Define if we have GNU readline])], 1274 [AC_MSG_ERROR([Couldn't find GNU readline headers.])]) 1275 AC_SEARCH_LIBS([tputs], [ncurses tinfo termcap], 1276 [AC_DEFINE([HAVE_TERMCAP], [], [Define if we have ncurses/terminfo or termcap])], 1277 [AC_MSG_ERROR([Found neither ncurses/terminfo or termcap])]) 1278 AC_CHECK_LIB([readline], [readline], 1279 [LIBS="$LIBS -lreadline"], 1280 [AC_MSG_ERROR([Couldn't find readline libraries.])]) 1281 fi 1282 done 1283 fi 1284fi 1285 1286# ---- Option to include BSD editline support in ngspice CLI ---- 1287# ---- Default: disabled. ---- 1288 1289if test "x$with_editline" != xyes; then 1290 AC_MSG_RESULT([BSD editline disabled.]) 1291else 1292 AC_MSG_RESULT([Checking for editline:]) 1293 AC_CHECK_HEADERS([editline/readline.h], 1294 [AC_DEFINE([HAVE_BSDEDITLINE], [1], [Define to enable BSD editline])], 1295 [AC_MSG_ERROR([Couldn't find BSD editline headers.])]) 1296 AC_SEARCH_LIBS([tputs], [ncurses tinfo termcap], 1297 [AC_DEFINE([HAVE_TERMCAP], [], [Define if we have ncurses/terminfo or termcap])], 1298 [AC_MSG_ERROR([Found neither ncurses/terminfo or termcap])]) 1299 AC_CHECK_LIB([edit], [readline], 1300 [LIBS="$LIBS -ledit"], 1301 [AC_MSG_ERROR([Couldn't find editline libraries.])], 1302 [-lncurses]) 1303fi 1304 1305# Use AC_CHECK_HEADERS so the HAVE_*_H symbol gets defined 1306AC_CHECK_HEADERS([ncurses/termcap.h termcap.h]) 1307 1308# --enable-openmp: Use OpenMP on multi-core processors 1309AC_ARG_ENABLE([openmp], 1310 [AS_HELP_STRING([--enable-openmp], [Use OpenMP parallel processing])]) 1311 1312# Add OpenMP to ngspice. 1313: ${enable_openmp:=no} 1314m4_ifdef([AC_OPENMP], [AC_OPENMP]) 1315 1316if test "x$enable_openmp" = xyes; then 1317 AC_DEFINE([USE_OMP], [1], [OpenMP parallel processing]) 1318 CFLAGS="$CFLAGS $OPENMP_CFLAGS" 1319 AC_MSG_RESULT([OpenMP feature enabled]) 1320fi 1321 1322# Output Files 1323# ------------ 1324 1325AC_CONFIG_FILES([Makefile 1326 man/Makefile 1327 man/man1/Makefile 1328 ngspice.pc 1329 src/Makefile 1330 src/spicelib/Makefile 1331 src/spicelib/analysis/Makefile 1332 src/spicelib/devices/Makefile 1333 src/spicelib/devices/asrc/Makefile 1334 src/spicelib/devices/bjt/Makefile 1335 src/spicelib/devices/bsim1/Makefile 1336 src/spicelib/devices/bsim2/Makefile 1337 src/spicelib/devices/bsim3/Makefile 1338 src/spicelib/devices/bsim3v0/Makefile 1339 src/spicelib/devices/bsim3v1/Makefile 1340 src/spicelib/devices/bsim3v32/Makefile 1341 src/spicelib/devices/bsim4/Makefile 1342 src/spicelib/devices/bsim4v5/Makefile 1343 src/spicelib/devices/bsim4v6/Makefile 1344 src/spicelib/devices/bsim4v7/Makefile 1345 src/spicelib/devices/bsim3soi_pd/Makefile 1346 src/spicelib/devices/bsim3soi_fd/Makefile 1347 src/spicelib/devices/bsim3soi_dd/Makefile 1348 src/spicelib/devices/bsimsoi/Makefile 1349 src/spicelib/devices/cap/Makefile 1350 src/spicelib/devices/cccs/Makefile 1351 src/spicelib/devices/ccvs/Makefile 1352 src/spicelib/devices/csw/Makefile 1353 src/spicelib/devices/cpl/Makefile 1354 src/spicelib/devices/dio/Makefile 1355 src/spicelib/devices/ind/Makefile 1356 src/spicelib/devices/isrc/Makefile 1357 src/spicelib/devices/hfet1/Makefile 1358 src/spicelib/devices/hfet2/Makefile 1359 src/spicelib/devices/hicum2/Makefile 1360 src/spicelib/devices/hisim2/Makefile 1361 src/spicelib/devices/hisimhv1/Makefile 1362 src/spicelib/devices/hisimhv2/Makefile 1363 src/spicelib/devices/jfet/Makefile 1364 src/spicelib/devices/jfet2/Makefile 1365 src/spicelib/devices/ltra/Makefile 1366 src/spicelib/devices/mes/Makefile 1367 src/spicelib/devices/mesa/Makefile 1368 src/spicelib/devices/mos1/Makefile 1369 src/spicelib/devices/mos2/Makefile 1370 src/spicelib/devices/mos3/Makefile 1371 src/spicelib/devices/mos6/Makefile 1372 src/spicelib/devices/mos9/Makefile 1373 src/spicelib/devices/ndev/Makefile 1374 src/spicelib/devices/res/Makefile 1375 src/spicelib/devices/soi3/Makefile 1376 src/spicelib/devices/sw/Makefile 1377 src/spicelib/devices/tra/Makefile 1378 src/spicelib/devices/txl/Makefile 1379 src/spicelib/devices/urc/Makefile 1380 src/spicelib/devices/vbic/Makefile 1381 src/spicelib/devices/vccs/Makefile 1382 src/spicelib/devices/vcvs/Makefile 1383 src/spicelib/devices/vdmos/Makefile 1384 src/spicelib/devices/vsrc/Makefile 1385 src/spicelib/devices/nbjt/Makefile 1386 src/spicelib/devices/nbjt2/Makefile 1387 src/spicelib/devices/numd/Makefile 1388 src/spicelib/devices/numd2/Makefile 1389 src/spicelib/devices/numos/Makefile 1390 src/spicelib/parser/Makefile 1391 src/ciderlib/Makefile 1392 src/ciderlib/input/Makefile 1393 src/ciderlib/support/Makefile 1394 src/ciderlib/oned/Makefile 1395 src/ciderlib/twod/Makefile 1396 src/frontend/Makefile 1397 src/frontend/numparam/Makefile 1398 src/frontend/help/Makefile 1399 src/frontend/parser/Makefile 1400 src/frontend/plotting/Makefile 1401 src/frontend/trannoise/Makefile 1402 src/frontend/wdisp/Makefile 1403 src/include/ngspice/Makefile 1404 src/include/cppduals/duals/Makefile 1405 src/maths/Makefile 1406 src/maths/cmaths/Makefile 1407 src/maths/fft/Makefile 1408 src/maths/misc/Makefile 1409 src/maths/ni/Makefile 1410 src/maths/deriv/Makefile 1411 src/maths/poly/Makefile 1412 src/maths/sparse/Makefile 1413 src/misc/Makefile 1414 src/xspice/Makefile 1415 src/xspice/cm/Makefile 1416 src/xspice/cmpp/Makefile 1417 src/xspice/icm/makedefs 1418 src/xspice/icm/GNUmakefile 1419 src/xspice/mif/Makefile 1420 src/xspice/evt/Makefile 1421 src/xspice/enh/Makefile 1422 src/xspice/ipc/Makefile 1423 src/xspice/idn/Makefile 1424 tests/Makefile 1425 tests/bsim1/Makefile 1426 tests/bsim2/Makefile 1427 tests/bsim3/Makefile 1428 tests/bsim3soidd/Makefile 1429 tests/bsim3soifd/Makefile 1430 tests/bsim3soipd/Makefile 1431 tests/bsim4/Makefile 1432 tests/bsimsoi/Makefile 1433 tests/filters/Makefile 1434 tests/general/Makefile 1435 tests/hfet/Makefile 1436 tests/hicum2/Makefile 1437 tests/hisim/Makefile 1438 tests/hisimhv1/Makefile 1439 tests/hisimhv2/Makefile 1440 tests/jfet/Makefile 1441 tests/mes/Makefile 1442 tests/mesa/Makefile 1443 tests/mos6/Makefile 1444 tests/polezero/Makefile 1445 tests/regression/Makefile 1446 tests/regression/subckt-processing/Makefile 1447 tests/regression/lib-processing/Makefile 1448 tests/regression/parser/Makefile 1449 tests/regression/func/Makefile 1450 tests/regression/model/Makefile 1451 tests/regression/misc/Makefile 1452 tests/regression/sens/Makefile 1453 tests/regression/temper/Makefile 1454 tests/regression/pipe/Makefile 1455 tests/regression/pz/Makefile 1456 tests/sensitivity/Makefile 1457 tests/transient/Makefile 1458 tests/transmission/Makefile 1459 tests/xspice/Makefile 1460 tests/xspice/digital/Makefile 1461 tests/xspice/digital/spinit 1462 tests/resistance/Makefile 1463 tests/vbic/Makefile]) 1464 1465AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes]) 1466 1467if test "x$cross_compiling" = xyes; then 1468 AC_CONFIG_COMMANDS([mkdir], [$MKDIR_P src/xspice/cmpp/build]) 1469 AC_SUBST([CMPP], ['$(top_builddir)/src/xspice/cmpp/build/cmpp$(BUILD_EXEEXT)']) 1470else 1471 AC_SUBST([CMPP], ['$(top_builddir)/src/xspice/cmpp/cmpp$(EXEEXT)']) 1472fi 1473 1474# See https://github.com/kimwalisch/primesieve/issues/16 1475# Silence warning: ar: 'u' modifier ignored since 'D' is the default 1476AC_SUBST(AR_FLAGS, [cr]) 1477 1478 1479AC_OUTPUT 1480