dnl configure.in script for ngspice dnl dnl This file is part of ngspice. dnl dnl (Process this file with autoconf to produce a configure script.) AC_INIT(src/main.c) dnl Create a configuration header AM_CONFIG_HEADER(config.h) dnl Initialize automake stuff AM_INIT_AUTOMAKE(ng-spice-rework,15pre1) dnl --enable-ansi : try to force --ansi option to the compiler AC_ARG_ENABLE(ansi, [ --enable-ansi Force --ansi option for compilation]) dnl --disable-debug : remove -g and -Wall option to the compiler AC_ARG_ENABLE(debug, [ --enable-debug Add -g option for compilation (default)]) dnl --enable-checker : add --with-checker-debug option to the compiler AC_ARG_ENABLE(checker, [ --enable-checkergcc Option for compilation with checkergcc]) dnl --enable-gc : Enable Boehm-Weiser Conservative Garbage Collector AC_ARG_ENABLE(checker, [ --enable-gc Use Boehm-Weiser Conservative Garbage Collector ]) dnl --enable-nosqrt : define NOSQRT for the code AC_ARG_ENABLE(nosqrt, [ --enable-nosqrt Use always log/exp for nonlinear capacitances]) dnl --enable-bypass : define BYPASS for the code AC_ARG_ENABLE(nobypass, [ --enable-nobypass Don't bypass recalculations of slowly changing variables]) dnl --enable-capbypass : define CAPBYPASS for the code AC_ARG_ENABLE(capbypass, [ --enable-capbypass Bypass calculation of cbd/cbs in the mosfets if the vbs/vbd voltages are unchanged]) dnl --enable-capzerobypass : define CAPZEROBYPASS for the code AC_ARG_ENABLE(capzerobypass, [ --enable-capzerobypass Bypass all the cbd/cbs calculations if Czero is zero]) dnl --enable-nodelimiting : define NODELIMITING for the code AC_ARG_ENABLE(nodelimiting, [ --enable-nodelimiting Experimental damping scheme]) dnl --enable-predictor : define PREDICTOR for the code AC_ARG_ENABLE(predictor, [ --enable-predictor Enable a predictor method for convergence]) dnl --enable-newtrunc : define NEWTRUNC for the code AC_ARG_ENABLE(newtrunc, [ --enable-newtrunc Enable the newtrunc option]) dnl --enable-sense2 : define WANT_SENSE2 for the code AC_ARG_ENABLE(sense2, [ --enable-sense2 Use spice2 sensitivity analysis]) dnl --enable-ftedebug : enable frontend debug macros AC_ARG_ENABLE(ftedebug, [ --enable-ftedebug Enable ngspice frontend debug]) dnl --enable-cpdebug : enable frontend debug macros AC_ARG_ENABLE(cpdebug, [ --enable-cpdebug Enable ngspice shell debug]) dnl --enable-sensdebug : define SENSDEBUG for the code AC_ARG_ENABLE(sensedebug, [ --enable-sensdebug Debug sensitivity code]) dnl --enable-stepdebug : define STEPDEBUG for the code AC_ARG_ENABLE(stepdebug, [ --enable-stepdebug Unknown debug option]) dnl --enable-pzdebug : define PZDEBUG for the code AC_ARG_ENABLE(pzdebug, [ --enable-pzdebug Debug pole/zero code]) dnl --enable-intnoise : define INT_NOISE for the code AC_ARG_ENABLE(intnoise, [ --enable-intnoise Enable noise integration in noise analysis]) dnl --enable-smoketest : a smoketest AC_ARG_ENABLE(smoketest, [ --enable-smoketest Enable smoketest compile]) dnl --enable-experimental : define EXPERIMENTAL_CODE for the code AC_ARG_ENABLE(experimental, [ --enable-experimental Enable some experimental code]) dnl --enable-expdevices : Enable the compilation of experimental deviced AC_ARG_ENABLE(expdevices, [ --enable-expdevices Enable experimental devices (they do not compile)]) dnl --enable-ekv: define HAVE_EKV in the code. This is for EKV model support AC_ARG_ENABLE(ekv, [ --enable-ekv Enable ekv model *not in standard distribution*]) dnl --enable-xspice: define XSPICE in the code. This is for xspice support AC_ARG_ENABLE(xspice, [ --enable-xspice Enable XSpice enchancements, experimental *not in standard distribution*]) dnl --enable-cider: define CIDER in the code. This is for CIDER support AC_ARG_ENABLE(cider, [ --enable-cider Enable CIDER enchancements, experimental *not in standard distribution*]) dnl --enable-cluster: define CLUSTER in the code. This is for cluster support AC_ARG_ENABLE(cluster, [ --enable-cluster Enable cluster support, experimental *not in standard distribution*]) dnl --enable-numparams: define NUMPARAMS in the code. This is for .param support AC_ARG_ENABLE(numparam, [ --enable-numparam Enable numparams library support, experimental *not in standard distribution*]) dnl Enable maintainer commands only if requested AM_MAINTAINER_MODE dnl Work on compiler options according to system: dnl Set default CFLAG - only use -Wall if we have gcc AC_PROG_CC if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall " fi if test "$enable_debug" = "no"; then AC_MSG_WARN(Removing debugging option!) CFLAGS=" " fi dnl Not sure that this will work.... if test "$with_checkergcc" = "yes"; then CC="checkergcc" fi dnl Checks for ANSI-C header files. AC_HEADER_STDC if test "$enable_ansi" = "yes"; then AM_PROG_CC_STDC if test ! "$am_cv_prog_cc_stdc"="yes"; then AC_MSG_WARN(Failed to find Ansi flag!) fi fi if test "$enable_smoketest" = "yes"; then dnl 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 dnl Chech system we're on , and tune accordingly AC_CANONICAL_HOST dnl Checks for programs AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL AC_PROG_LIBTOOL dnl --with-windows : the user wants to use generate the MS WINDOWS executable AC_ARG_WITH(windows, [ --with-windows MS WINDOWS executable], dnl set HAS_WINDOWS flag: AC_DEFINE(HAS_WINDOWS) ) case $with_windows in yes ) AC_DEFINE(X_DISPLAY_MISSING) AC_MSG_RESULT(No X display!) CFLAGS="$CFLAGS -mwindows";; * ) dnl Checks for X11 header files and libraries - X11 support can be disabled dnl by passing the '--without-x' option to configure: AC_PATH_X AC_PATH_XTRA dnl Checks for X libraries - if X11 wasn't found then don't make following dnl tests and compile without X11 support - otherwise, check if the following dnl libraries are present (error if they are not) dnl In CYGWIN library ordering has to be changed. Is this compatible to LINUX? dnl XShmAttach is a struct in CYGWIN, not a function if test ! "$no_x" = "yes" ; then X_LIBS="$X_LIBS -lX11 -lXt" AC_CHECK_LIB(Xext, XShmAttach,X_LIBS="$X_LIBS -lXext",AC_MSG_ERROR(Couldn't find Xext librairies), $X_LIBS $X_EXTRA_LIBS) AC_CHECK_LIB(Xmu,main,X_LIBS="$X_LIBS -lXmu",AC_MSG_ERROR(Couldn't find Xmu librairies), $X_LIBS $X_EXTRA_LIBS) AC_CHECK_LIB(Xaw,main,X_LIBS="$X_LIBS -lXaw",AC_MSG_ERROR(Couldn't find Xaw librairies),$X_LIBS $X_EXTRA_LIBS) fi ;; esac dnl Check for a few typdefs: AC_TYPE_PID_T AC_TYPE_SIGNAL dnl Check for a few libraries and headers: dnl Look for ncurses first, then termcap AC_SEARCH_LIBS(tputs,ncurses termcap,AC_DEFINE(HAVE_TERMCAP), AC_MSG_ERROR(Found neither ncurses or termcap)) AC_HEADER_DIRENT AC_CHECK_HEADERS(ctype.h unistd.h pwd.h fcntl.h string.h) AC_HEADER_SYS_WAIT AC_HEADER_STAT dnl Check time and ressources headers and functions: AC_HEADER_TIME AC_STRUCT_TM AC_STRUCT_TIMEZONE AC_CHECK_FUNCS(localtime) case $host_os in *cygwin* ) AC_CHECK_FUNCS(ftime) AC_DEFINE(HAVE__MEMAVL);; * ) AC_CHECK_FUNCS(gettimeofday time ftime , break) AC_CHECK_FUNCS(getrusage utimes, break) AC_CHECK_FUNCS(getrlimit ulimit, break);; esac dnl Look for termios first (posix) AC_CHECK_HEADERS(termios.h termio.h sgtty.h , break) AC_CHECK_FUNCS(isatty tcgetattr tcsetattr) dnl Check for a few functions: AC_FUNC_VFORK AC_CHECK_FUNCS(access bcopy qsort dup2 popen) AC_CHECK_FUNCS(strchr index , break) AC_CHECK_FUNCS(getcwd getwd , break) AC_MSG_RESULT(Checking mathematical features of the system:) dnl Look for math library: AC_CHECK_LIB(m,sqrt) AC_CHECK_HEADERS(float.h limits.h values.h) dnl Check for a few mathematical functions: AC_CHECK_FUNCS(erfc logb scalb scalbn asinh acosh atanh) AC_MSG_RESULT(Checking for the presence of the Garbage Collector:) dnl Check for the garbage collector: AC_CHECK_LIB(gc,GC_malloc,AC_DEFINE(HAVE_LIBGC) LIBS="$LIBS -lgc") dnl Check for the asprintf function: AC_CHECK_FUNCS(asprintf,,AC_CHECK_LIB(iberty,asprintf,AC_DEFINE(HAVE_ASPRINTF) LIBS="$LIBS -liberty")) dnl Check for va_copy AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy, AC_TRY_LINK( [#include ], [va_list ap1, ap2; va_copy(ap1,ap2); ], [ac_cv_c_va_copy="yes"], [ac_cv_c_va_copy="no"]) ) if test "$ac_cv_c_va_copy" = "yes" then AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy]) fi AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy, AC_TRY_LINK( [#include ], [va_list ap1, ap2; __va_copy(ap1,ap2); ], [ac_cv_c___va_copy="yes"], [ac_cv_c___va_copy="no"]) ) if test "$ac_cv_c___va_copy" = "yes" then AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy]) fi # AC_CHECK_FUNC(getopt_long, getopt_long=true) # AM_CONDITIONAL(HAVE_GETOPT_LONG, test "$getopt_long" = "true") # Expand the prefix variable (this is really annoying!) if eval "test x$prefix = xNONE"; then dprefix=$ac_default_prefix else dprefix=$prefix fi AC_DEFINE_UNQUOTED(NGSPICEBINDIR, "`echo $dprefix/bin`" ) AC_DEFINE_UNQUOTED(NGSPICEDATADIR, "`echo $dprefix/share/ng-spice-rework`" ) AC_DEFINE_UNQUOTED(NGSPICEBUILDDATE, "`date`" ) dnl with the MS WINDOWS executable we suggest /spice_win/bin as *.exe-path if test "$with_windows" = "yes"; then dnl redefine the path for WINDOWS: AC_MSG_RESULT(WINDOWS code enabled) AC_DEFINE_UNQUOTED(NGSPICEBINDIR, "`echo /spice_win/bin`" ) AC_DEFINE_UNQUOTED(NGSPICEDATADIR, "`echo /spice_win/lib`" ) WINMAIN="winmain.o" else WINMAIN="" fi AC_SUBST(WINMAIN) # Recapitulate settings: AC_MSG_RESULT(Settings which were chosen:) if test "$enable_sense2" = "yes"; then AC_DEFINE(WANT_SENSE2) AC_MSG_RESULT(Spice2 sensitivity analysis enabled) fi if test "$enable_nobypass" = "yes"; then AC_DEFINE(NOBYPASS) AC_MSG_RESULT(NOBYPASS option enabled) fi if test "$enable_capbypass" = "yes"; then AC_DEFINE(CAPBYPASS) AC_MSG_RESULT(CAPBYPASS option enabled) fi if test "$enable_capzerobypass" = "yes"; then AC_DEFINE(CAPZEROBYPASS) AC_MSG_RESULT(CAPZEROBYPASS option enabled) fi if test "$enable_nodelimiting" = "yes"; then AC_DEFINE(NODELIMITING) AC_MSG_RESULT(NODELIMITING option enabled) fi if test "$enable_predictor" = "yes"; then AC_DEFINE(PREDICTOR) AC_MSG_RESULT(PREDICTOR algorithm enabled) fi if test "$enable_newtrunc" = "yes"; then AC_DEFINE(NEWTRUNC) AC_MSG_RESULT(New truncation error calculation enabled) fi if test "$enable_intnoise" = "yes"; then AC_DEFINE(INT_NOISE) AC_MSG_RESULT(Noise integration enabled) fi if test "$enable_experimental" = "yes"; then AC_DEFINE(EXPERIMENTAL_CODE) AC_MSG_RESULT(EXPERIMENTAL_CODE enabled) fi if test "$enable_cpdebug" = "yes"; then AC_DEFINE(CPDEBUG) AC_MSG_RESULT(WARNING: Shell debug is enabled) fi if test "$enable_ftedebug" = "yes"; then AC_DEFINE(FTEDEBUG) AC_MSG_RESULT(WARNING: Frontend debug is enabled) fi if test "$enable_sensdebug" = "yes"; then AC_DEFINE(SENSDEBUG) AC_MSG_RESULT(WARNING: Sensitivity code debug is enabled) fi if test "$enable_stepdebug" = "yes"; then AC_DEFINE(STEPDEBUG) AC_MSG_RESULT(WARNING: STEPDEBUG debug is enabled) fi if test "$enable_pzdebug" = "yes"; then AC_DEFINE(PZDEBUG) AC_MSG_RESULT(WARNING: Pole/Zero analysis debug is enabled) fi if test "$enable_ekv" = "yes"; then AC_MSG_RESULT(Model EKV included) AC_DEFINE(HAVE_EKV) EKVDIR="ekv" EKVLIB="spicelib/devices/ekv/libekv.a" else EKVDIR="" EKVLIB="" fi AC_SUBST(EKVDIR) AC_SUBST(EKVLIB) dnl Add new code models to the build by pointing to them here. if test "$enable_xspice" = "yes"; then AC_MSG_RESULT(X-Spice features included) AC_DEFINE(XSPICE) XSPICEDIR="xspice" XSPICELIB1="$XSPICEDIR/xspice.o \ $XSPICEDIR/mif/libmifxsp.a \ $XSPICEDIR/cm/libcmxsp.a" XSPICELIB2="$XSPICEDIR/evt/libevtxsp.a \ $XSPICEDIR/enh/libenhxsp.a \ $XSPICEDIR/ipc/libipcxsp.a \ $XSPICEDIR/idn/libidnxsp.a \ -ldl" else XSPCIEDIR="" XSPICELIB1="" XSPICELIB2="" fi AC_SUBST(XSPICEDIR) AC_SUBST(XSPICELIB1) AC_SUBST(XSPICELIB2) dnl Add CIDER enhacements to ngspice. if test "$enable_cider" = "yes"; then AC_MSG_RESULT(CIDER features enabled) AC_DEFINE(CIDER) CIDERDIR="ciderlib" CIDERSIM=" $CIDERDIR/twod/libcidertwod.a \ $CIDERDIR/oned/libcideroned.a \ $CIDERDIR/input/libciderinput.a \ $CIDERDIR/support/libcidersuprt.a" CIDERMATH="misc" CIDERMATHDIR="maths/misc/libmathmisc.a" NUMDEV=" spicelib/devices/nbjt/libnbjt.a \ spicelib/devices/nbjt2/libnbjt2.a \ spicelib/devices/numd/libnumd.a \ spicelib/devices/numd2/libnumd2.a \ spicelib/devices/numos/libnumos.a" NUMDEVDIR=" nbjt \ nbjt2 \ numd \ numd2 \ numos" CIDERSCRIPTS="devload devaxis ciderinit" else CIDERLIB="" CIDERSIM="" CIDERMATH="" CIDERMATHDIR="" NUMDEV="" NUMDEVDIR="" CIDERSCRIPTS="" fi AC_SUBST(CIDERDIR) AC_SUBST(CIDERSIM) AC_SUBST(CIDERMATH) AC_SUBST(CIDERMATHDIR) AC_SUBST(NUMDEV) AC_SUBST(NUMDEVDIR) AC_SUBST(CIDERSCRIPTS) dnl Cluster option if test "$enable_cluster" = "yes"; then AC_MSG_RESULT(Cluster version is being compiled) AC_DEFINE(CLUSTER) LIBS="$LIBS -lpthread" fi if test "$enable_expdevices" = "yes"; then AC_DEFINE(EXP_DEV) AC_MSG_RESULT(WARNING: Experimental devices enabled) fi if test "$enable_numparam" = "yes"; then AC_MSG_RESULT(Numparam library is enabled) AC_DEFINE(NUMPARAMS) NUMPARAMDIR="numparam" NUMPARAMLIB="frontend/numparam/libnumparam.a" else NUMPARAMDIR="" NUMPARAMLIB="" fi AC_SUBST(NUMPARAMDIR) AC_SUBST(NUMPARAMLIB) dnl --with-readline : the user wants to use readline library AC_ARG_WITH(readline, [ --with-readline Use the readline library. WARNING: breaks GPL license], AC_MSG_RESULT(Checking for readline library:) AC_CHECK_LIB(readline, readline, AC_DEFINE(HAVE_GNUREADLINE) LIBS="$LIBS -lreadline") ) AC_OUTPUT( \ Makefile \ doc/Makefile \ man/Makefile \ man/man1/Makefile \ src/Makefile \ src/spicelib/Makefile \ src/spicelib/analysis/Makefile \ src/spicelib/devices/Makefile \ src/spicelib/devices/asrc/Makefile \ src/spicelib/devices/bjt/Makefile \ src/spicelib/devices/bjt2/Makefile \ src/spicelib/devices/bsim1/Makefile \ src/spicelib/devices/bsim2/Makefile \ src/spicelib/devices/bsim3v0/Makefile \ src/spicelib/devices/bsim3v1/Makefile \ src/spicelib/devices/bsim3v1a/Makefile \ src/spicelib/devices/bsim3v1s/Makefile \ src/spicelib/devices/bsim3/Makefile \ src/spicelib/devices/bsim4/Makefile \ src/spicelib/devices/bsim3soi/Makefile \ src/spicelib/devices/bsim3soi_pd/Makefile \ src/spicelib/devices/bsim3soi_fd/Makefile \ src/spicelib/devices/bsim3soi_dd/Makefile \ src/spicelib/devices/cap/Makefile \ src/spicelib/devices/cccs/Makefile \ src/spicelib/devices/ccvs/Makefile \ src/spicelib/devices/csw/Makefile \ src/spicelib/devices/cpl/Makefile \ src/spicelib/devices/dio/Makefile \ dnl src/spicelib/devices/ekv/Makefile \ src/spicelib/devices/ind/Makefile \ src/spicelib/devices/isrc/Makefile \ src/spicelib/devices/hfet1/Makefile \ src/spicelib/devices/hfet2/Makefile \ src/spicelib/devices/hisim/Makefile \ src/spicelib/devices/jfet/Makefile \ src/spicelib/devices/jfet2/Makefile \ src/spicelib/devices/ltra/Makefile \ src/spicelib/devices/mes/Makefile \ src/spicelib/devices/mesa/Makefile \ src/spicelib/devices/mos1/Makefile \ src/spicelib/devices/mos2/Makefile \ src/spicelib/devices/mos3/Makefile \ src/spicelib/devices/mos6/Makefile \ src/spicelib/devices/mos9/Makefile \ src/spicelib/devices/res/Makefile \ src/spicelib/devices/soi3/Makefile \ src/spicelib/devices/sw/Makefile \ src/spicelib/devices/tra/Makefile \ src/spicelib/devices/txl/Makefile \ src/spicelib/devices/urc/Makefile \ src/spicelib/devices/vccs/Makefile \ src/spicelib/devices/vcvs/Makefile \ src/spicelib/devices/vsrc/Makefile \ src/spicelib/devices/nbjt/Makefile \ src/spicelib/devices/nbjt2/Makefile \ src/spicelib/devices/numd/Makefile \ src/spicelib/devices/numd2/Makefile \ src/spicelib/devices/numos/Makefile \ src/spicelib/parser/Makefile \ src/ciderlib/Makefile \ src/ciderlib/input/Makefile \ src/ciderlib/support/Makefile \ src/ciderlib/oned/Makefile \ src/ciderlib/twod/Makefile \ src/frontend/Makefile \ src/frontend/numparam/Makefile \ src/frontend/help/Makefile \ src/frontend/parser/Makefile \ src/frontend/plotting/Makefile \ src/frontend/wdisp/Makefile \ src/include/Makefile \ src/maths/Makefile \ src/maths/cmaths/Makefile \ src/maths/misc/Makefile \ src/maths/ni/Makefile \ src/maths/deriv/Makefile \ src/maths/poly/Makefile \ src/maths/sparse/Makefile \ src/misc/Makefile \ src/xspice/Makefile \ src/xspice/cm/Makefile \ src/xspice/icm/makedefs \ src/xspice/mif/Makefile \ src/xspice/evt/Makefile \ src/xspice/enh/Makefile \ src/xspice/ipc/Makefile \ src/xspice/idn/Makefile \ tests/Makefile \ tests/filters/Makefile \ tests/polezero/Makefile \ tests/resistance/Makefile \ tests/bsim1/Makefile \ tests/bsim2/Makefile \ tests/bsim3soipd/Makefile \ tests/bsim3soifd/Makefile \ tests/bsim3soidd/Makefile \ tests/bsim4/Makefile \ tests/mesa/Makefile \ tests/transmission/Makefile \ tests/TransImpedanceAmp/Makefile )