dnl Process this file with autoconf to produce a configure script. AC_INIT(xcircuit.c,, xcircuit-dev@lists.sourceforge.net) AC_PREREQ(2.52) AC_CONFIG_SRCDIR(xcircuit.c) AC_CANONICAL_SYSTEM dnl this call will define PACKAGE and VERSION dnl please use this as the primary reference for the version number PACKAGE=xcircuit VERSION=`cat ./VERSION | cut -d. -f1-2` AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION}) dnl Initialize some variables SUBDIRS= SUBLIB= STDLIBS= XCIRCUIT_TARGET= ALL_TARGET="undefined-target" INSTALL_TARGET="undefined-install-target" REVISION=`cat ./VERSION | cut -d. -f3` INTERPRETER=NOINTERP HAVE_LGF=NOFORMATS LIB_SPECS="" WISH_EXE="" SHLIB_CFLAGS="" dnl Default is to use Tcl; if it can't be found, then flag a warning dnl and revert to the non-Tcl version. dnl pass the version string on the the makefiles AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_SUBST(REVISION) dnl Setup for automake in subdirectories AC_PROG_MAKE_SET dnl Checks for programs. AC_PROG_CC AC_ISC_POSIX dnl AM_C_PROTOTYPES if test "x$U" != "x"; then AC_MSG_ERROR(Compiler not ANSI compliant) fi AC_PROG_INSTALL AC_PROG_RANLIB dnl GNU M4 is preferred due to some of the option switches. AC_PATH_PROGS([M4], [gm4 gnum4 m4],) case "$target_os" in *cygwin*) ;; *) AC_CHECK_LIB(m, sin) ;; esac dnl check size of pointer for correct behavior on 64-bit systems AC_CHECK_SIZEOF([void *], 4) AC_CHECK_SIZEOF([unsigned int], 4) AC_CHECK_SIZEOF([unsigned long], 8) AC_CHECK_SIZEOF([unsigned long long], 16) dnl check for X libraries and include files AC_PATH_XTRA CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}" LDFLAGS="${LDFLAGS} ${X_LIBS}" LIBS="${X_PRE_LIBS} ${LIBS} -lX11" AC_CHECK_LIB(Xt, XtToolkitInitialize,,[ AC_CHECK_LIB(Xt, XtDisplayInitialize,,,-lSM -lICE -lXpm -lX11)]) dnl Check for required header files AC_HEADER_STDC dnl Need either setenv or putenv AC_CHECK_FUNCS(setenv putenv) dnl Check for vfork AC_CHECK_FUNC(vfork) dnl Check for AC_CHECK_HEADERS(dirent.h) dnl Check for lib64. This is a quick hack for Fedora Core on the dnl AMD Opteron; don't know if it works with others. case $target in x86_64-*) AC_MSG_CHECKING([for 64-bit X11 libraries]) AC_CHECK_FILE([/usr/X11R6/lib64], [ LDFLAGS="-L/usr/X11R6/lib64 ${LDFLAGS}" ], ) ;; esac dnl Check for valid cflag "-Wno-pointer-sign" AC_MSG_CHECKING(if -Wno-pointer-sign accepted in CFLAGS) ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wno-pointer-sign" AC_TRY_COMPILE(,[ int foo; foo = 0],[ AC_MSG_RESULT(yes)],[ CFLAGS="$ac_save_CFLAGS" AC_MSG_RESULT(no)]) dnl Check for Flate compression routines AC_CHECK_LIB(z, deflate,,,-lz) 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_MSG_CHECKING(if u_char defined) AC_TRY_COMPILE([#include ],[ u_char foo; foo = 0],[ AC_DEFINE(HAVE_U_CHAR) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no)) dnl Enable compile-time Optimization? Disable by default for debugging AC_ARG_ENABLE(optimize, [ --enable-optimize enable compile-time optimizer flag -O2], , [ CFLAGS=`echo $CFLAGS | sed -e "s/ -O2//"` ]) dnl check for Xpm library AC_ARG_WITH(xpm, [ --with-xpm=DIR use Xpm include/library files in DIR], [ if test "$withval" != "no" -a "$withval" != "yes"; then CPPFLAGS="${CPPFLAGS} -I$withval/include" LDFLAGS="${LDFLAGS} -L$withval/lib" fi ]) AC_CHECK_HEADERS(X11/xpm.h, AC_CHECK_LIB(Xpm, XpmCreateImageFromData, [ LIBS="${LIBS} -lXpm" AC_DEFINE(HAVE_XPM)], [ AC_MSG_WARN(Xpm library not found)], -lX11), AC_MSG_WARN(Xpm header not found)) dnl Check for GNU ld. This needs to be qualified for Solaris, which dnl may use gcc for the C compiler but not for the linker. dnl check if the linker is a GNU linker #------------------------------------------------------------ # AC_PROG_LD - find the path to the GNU or non-GNU linker # (This stuff ripped from libtool) #------------------------------------------------------------ AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [[default=no]]], test "$withval" = no || xc_with_gnu_ld=yes, xc_with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl dnl ###not for PostgreSQL### AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case "$ac_prog" in # Accept absolute paths. changequote(,)dnl [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' changequote([,])dnl # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. xc_with_gnu_ld=unknown ;; esac elif test "$xc_with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(ac_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$xc_with_gnu_ld" != no && break else test "$xc_with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$ac_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN([AC_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi]) xc_with_gnu_ld=$ac_cv_prog_gnu_ld ]) AC_PROG_LD dnl --- Enable TCL by default xc_with_tcl="yes" xc_with_tk="yes" xc_with_tcl_includes="" xc_with_tk_includes="" xc_with_tcl_libraries="" xc_with_tk_libraries="" xc_with_cairo="yes" dnl ----------------------------------------------------------------------- dnl --- Cairo library dnl ----------------------------------------------------------------------- AC_ARG_WITH([cairo], [AS_HELP_STRING([--with-cairo], [Use cairo graphics library @<:@default=yes@:>@])], [ xc_with_cairo=$withval if test "$withval" == "no" -o "$withval" == "NO"; then xc_with_cairo="" fi ], ) if test "x$xc_with_cairo" != "x" ; then AC_DEFINE([HAVE_CAIRO]) PKG_CHECK_MODULES([cairo], [cairo]) PKG_CHECK_MODULES([fontconfig], [fontconfig]) AC_CHECK_HEADERS([ghostscript/gdevdsp.h], [ GS_LIBS=-lgs AC_DEFINE([HAVE_GS]) ], [ AC_MSG_WARN([Building xcircuit without ghostscript rendering]) AC_MSG_WARN([Install the ghostscript-devel package to solve this]) ] ) fi dnl ----------------------------------------------------------------------- dnl --- Tcl/Tk support dnl ----------------------------------------------------------------------- AC_ARG_WITH(tcl, [ --with-tcl=DIR Find tclConfig.sh in DIR], [ xc_with_tcl=$withval if test "$withval" == "no" -o "$withval" == "NO"; then xc_with_tcl="" fi ], ) dnl ----------------------------------------------------------------------- dnl If TCL is not disabled, do our best to find it dnl ----------------------------------------------------------------------- AC_ARG_WITH(tk, [ --with-tk=DIR Find tkConfig.sh in DIR], xc_with_tk=$withval) AC_ARG_WITH(tclincls, [ --with-tclincls=DIR Find tcl.h in DIR], xc_with_tcl_includes=$withval) AC_ARG_WITH(tkincls, [ --with-tkincls=DIR Find tk.h in DIR], xc_with_tk_includes=$withval) AC_ARG_WITH(tcllibs, [ --with-tcllibs=DIR Find Tcl library in DIR], xc_with_tcl_libraries=$withval) AC_ARG_WITH(tklibs, [ --with-tklibs=DIR Find Tk library in DIR], xc_with_tk_libraries=$withval) # ----------------------------------------------------------------------- # # Find the Tcl build configuration file "tclConfig.sh" # # ----------------------------------------------------------------------- if test "x$xc_with_tcl" != "x" ; then TCL_INC_DIR="." TK_INC_DIR="." AC_MSG_CHECKING([for tclConfig.sh]) tcl_config_sh="" if test "$xc_with_tcl" = "no" ; then xc_with_tcl="" elif test "$xc_with_tcl" != "yes" ; then # # Verify that a tclConfig.sh file exists in the directory specified # by --with-tcl. # for dir in \ $xc_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 fi done else # # Otherwise, search for Tcl configuration file. # # 1. Search previously named locations. 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 fi done # 2. Search standard locations. if test "x$tcl_config_sh" = "x" ; then for dir in \ `ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ /usr/local/tcl \ /usr/local/lib \ /usr/local \ `ls -dr /usr/share/tcltk/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ /sw/lib \ /usr/lib \ /usr/lib64 \ /usr 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 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\"" echo "Reverting to non-Tcl compilation" xc_with_tcl="" fi fi # ----------------------------------------------------------------------- # # Find the Tk build configuration file "tkConfig.sh" # # ----------------------------------------------------------------------- if test "x$xc_with_tcl" != "x" ; then AC_MSG_CHECKING([for tkConfig.sh]) tk_config_sh="" if test "$xc_with_tk" != "yes"; then # # Verify that a tkConfig.sh file exists in the directory specified # by --with-tcl or --with-tk. # for dir in \ $xc_with_tk \ $xc_with_tcl do if test -r "$dir/tkConfig.sh" ; then tk_config_sh="$dir/tkConfig.sh" break elif test -r "$dir/lib/tkConfig.sh" ; then tk_config_sh="$dir/lib/tkConfig.sh" break fi done else # # Search for Tk configuration file. # # # 1. Search previously named locations. # for dir in \ $prefix \ $exec_prefix do if test -r "$dir/tkConfig.sh" ; then tk_config_sh="$dir/tkConfig.sh" break elif test -r "$dir/lib/tkConfig.sh" ; then tk_config_sh="$dir/lib/tkConfig.sh" break fi done # # 2. Search standard locations. # if test "x$tk_config_sh" = "x" ; then for dir in \ /usr/local \ /usr \ `ls -dr /usr/local/lib/tk[[7-9]].[[0-9]]* 2>/dev/null` \ `ls -dr /usr/lib/tk[[7-9]].[[0-9]]* 2>/dev/null` \ `ls -dr /usr/local/tk/tk[[7-9]].[[0-9]]* 2>/dev/null` \ `ls -dr /usr/local/tk[[7-9]].[[0-9]]* 2>/dev/null` \ /usr/local/tk \ `ls -dr /usr/local/lib/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ `ls -dr /usr/lib/tcl/tk[[7-9]].[[0-9]]* 2>/dev/null` \ `ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \ `ls -dr /usr/share/tcltk/tk[[7-9]].[[0-9]]* 2>/dev/null` \ /sw/lib \ /usr/lib \ /usr/lib64 \ ${x_libraries} do if test -r "$dir/tkConfig.sh" ; then tk_config_sh="$dir/tkConfig.sh" break elif test -r "$dir/lib/tkConfig.sh" ; then tk_config_sh="$dir/lib/tkConfig.sh" break fi done fi fi AC_MSG_RESULT([${tk_config_sh}]) if test "x$tk_config_sh" = "x" ; then echo "can't find Tk configuration script \"tkConfig.sh\"" echo "Reverting to non-Tcl compilation" xc_with_tcl="" fi fi # ----------------------------------------------------------------------- # # Source in the Tcl/Tk configuration scripts. # # This didn't work so well in the pre-8.5 days, but # seems to be okay now. # # ----------------------------------------------------------------------- if test "x$xc_with_tcl" != "x" ; then . $tcl_config_sh . $tk_config_sh # Should probably trust the config file contents, but this configure # file checks the Tcl and Tk include and lib directories. Since # the config file doesn't separate out the libraries from the strings # passed to the compiler/linker, do it manually here. # # Extract TCL_LIB_DIR from TCL_LIB_SPEC # Extract TK_LIB_DIR from TK_LIB_SPEC # Extract TCL_INC_DIR from TCL_INCLUDE_SPEC # Extract TK_INC_DIR from TK_INCLUDE_SPEC # # These will be the defaults unless overridden by configure command line tmpstr=${TCL_LIB_SPEC#*-L} TCL_LIB_DIR=${tmpstr% -l*} tmpstr=${TK_LIB_SPEC#*-L} TK_LIB_DIR=${tmpstr% -l*} TCL_INC_DIR=${TCL_INCLUDE_SPEC#*-I} TK_INC_DIR=${TK_INCLUDE_SPEC#*-I} LIBS="${TCL_LIBS} ${LIBS}" if test "$TCL_VERSION" = "$TK_VERSION" ; then : else echo "Mismatched Tcl/Tk versions ($TCL_VERSION != $TK_VERSION)" echo "Reverting to non-Tcl compilation" xc_with_tcl="" fi fi # ----------------------------------------------------------------------- # Rely on TCL_INCLUDE_SPEC from tclConfig.sh unless "--with-tclincls" # overrides. With TCL_INCLUDE_SPEC, pull out TCL_INC_DIR # ----------------------------------------------------------------------- if test "x$xc_with_tcl" != "x" ; then if test "x${xc_with_tcl_includes}" != "x" ; then if test -r "${xc_with_tcl_includes}/tcl.h" ; then TCL_INC_DIR=${xc_with_tcl_includes} elif test "x${TCL_INCLUDE_SPEC}" == "x" ; then echo "Can't find tcl.h in \"${xc_with_tcl_includes}\"" echo "Reverting to non-Tcl compilation" xc_with_tcl="" fi elif test "x${TCL_INCLUDE_SPEC}" == "x" ; then for dir in \ ${TCL_PREFIX}/include/tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION} \ ${TCL_PREFIX}/include \ ${TCL_SRC_DIR}/generic \ ${TCL_INC_DIR} do if test -r "$dir/tcl.h" ; then TCL_INC_DIR=$dir TCL_INCLUDE_SPEC="-I${TCL_INC_DIR}" break fi done if test "x${TCL_INC_DIR}" = "x" ; then echo "Can't find tcl.h header file" echo "Reverting to non-Tcl compilation" xc_with_tcl="" fi else TCL_INC_DIR=`echo ${TCL_INCLUDE_SPEC} | sed -e '/-I/s/-I//'` fi fi # ----------------------------------------------------------------------- # Rely on TK_INCLUDE_SPEC from tkConfig.sh unless "--with-tkincls" # overrides. With TK_INCLUDE_SPEC, pull out TK_INC_DIR # ----------------------------------------------------------------------- if test "x$xc_with_tcl" != "x" ; then if test "x${xc_with_tk_includes}" != "x" ; then if test -r "${xc_with_tk_includes}/tk.h" ; then TK_INC_DIR=${xc_with_tk_includes} elif test "x${TK_INCLUDE_SPEC}" == "x" ; then echo "Can't find tk.h in \"${xc_with_tk_includes}\"" echo "Reverting to non-Tcl compilation" xc_with_tcl="" fi elif test "x${TK_INCLUDE_SPEC}" == "x" ; then for dir in \ ${TK_PREFIX}/include/tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION} \ ${TK_PREFIX}/include/tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION} \ ${TK_PREFIX}/include \ ${TK_SRC_DIR}/generic \ ${TK_INC_DIR} do if test -r "$dir/tk.h" ; then TK_INC_DIR=$dir TK_INCLUDE_SPEC="-I${TK_INC_DIR}" break fi done if test "x${TK_INC_DIR}" = "x" ; then echo "Can't find tk.h header file" echo "Reverting to non-Tcl compilation" xc_with_tcl="" fi else TK_INC_DIR=`echo ${TK_INCLUDE_SPEC} | sed -e '/-I/s/-I//'` fi fi # -------------------------------------------------------------- # Rely on TCL_LIB_SPEC from tclConfig.sh unless "--with-tcllibs" # overrides. With TCL_LIB_SPEC, pull out TCL_LIB_DIR # -------------------------------------------------------------- if test "x$xc_with_tcl" != "x" ; then if test "x${xc_with_tcl_libraries}" != "x" ; then TCL_LIB_SPEC="" for libname in \ "${xc_with_tcl_libraries}/${TCL_LIB_FILE}" \ "${xc_with_tcl_libraries}/lib${TCL_LIB_NAME}${SHDLIB_EXT}" do if test -r "$libname" ; then TCL_LIB_DIR="${xc_with_tcl_libraries}" break fi done if test "x${TCL_LIB_DIR}" == "x" ; then echo "Can't find tcl library in \"${xc_with_tcl_libraries}\"" echo "Reverting to non-Tcl compile" xc_with_tcl="" fi elif test "x${TCL_LIB_SPEC}" == "x" ; then for libpfix in "lib64" "lib" do libname="${TCL_EXEC_PREFIX}/${libpfix}/lib${TCL_LIB_NAME}${SHDLIB_EXT}" if test -r "$libname" ; then TCL_LIB_DIR="${TCL_EXEC_PREFIX}/${libpfix}" break fi done if test "x${TCL_LIB_DIR}" = "x" ; then echo "Can't find tcl library" echo "Reverting to non-Tcl compile" xc_with_tcl="" fi else TCL_LIB_DIR=`echo ${TCL_LIB_SPEC} | sed -e '/-L/s/-L//' -e '/-l/s/-l.*//'` fi fi # -------------------------------------------------------------- # Rely on TK_LIB_SPEC from tkConfig.sh unless "--with-tklibs" # overrides. With TK_LIB_SPEC, pull out TK_LIB_DIR # -------------------------------------------------------------- if test "x$xc_with_tcl" != "x" ; then if test "x${xc_with_tk_libraries}" != "x" ; then TK_LIB_SPEC="" for libname in \ "${xc_with_tk_libraries}/${TK_LIB_FILE}" \ "${xc_with_tk_libraries}/lib${TK_LIB_NAME}${SHDLIB_EXT}" do if test -r "$libname" ; then TK_LIB_DIR="${xc_with_tk_libraries}" break fi done if test "x${TK_LIB_DIR}" == "x" ; then echo "Can't find tk library in \"${xc_with_tk_libraries}\"" echo "Reverting to non-Tcl compile" xc_with_tcl="" fi elif test "x${TK_LIB_SPEC}" == "x" ; then for libpfix in "lib64" "lib" do libname="${TK_EXEC_PREFIX}/${libpfix}/lib${TK_LIB_NAME}${SHDLIB_EXT}" if test -r "$libname" ; then TK_LIB_DIR="${TK_EXEC_PREFIX}/${libpfix}" break fi done if test "x${TK_LIB_DIR}" = "x" ; then echo "Can't find tk library" echo "Reverting to non-Tcl compile" xc_with_tcl="" fi else TK_LIB_DIR=`echo ${TCL_LIB_SPEC} | sed -e '/-L/s/-L//' -e '/-l/s/-l.*//'` fi fi #-------------------------------------------------------------------- # If TCL_LIB_SPEC and/or TK_LIB_SPEC do not exist, construct them #-------------------------------------------------------------------- if test "x$xc_with_tcl" != "x" ; then if test "x${TCL_LIB_SPEC}" == "x" ; then case $target in *-sunos4*|*-*-netbsd|NetBSD-*|FreeBSD-*|*-*-openbsd*|OpenBSD-*) TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}" ;; *) TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}" ;; esac TCL_LIB_SPEC="-L${TCL_LIB_DIR} -l${TCL_LIB_NAME}" fi if test "x${TK_LIB_SPEC}" == "x" ; then case $target in *-sunos4*|*-*-netbsd|NetBSD-*|FreeBSD-*|*-*-openbsd*|OpenBSD-*) TK_LIB_NAME="tk${TK_MAJOR_VERSION}${TK_MINOR_VERSION}" ;; *) TK_LIB_NAME="tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}" ;; esac TK_LIB_SPEC="-L${TK_LIB_DIR} -l${TK_LIB_NAME}" fi # Find the version of "wish" that corresponds to TCL_EXEC_PREFIX # We really ought to run "ldd" to confirm that the linked libraries match. AC_MSG_CHECKING([for wish executable]) for dir in \ ${TK_EXEC_PREFIX}/bin \ ${TK_EXEC_PREFIX} do for wishexe in \ wish \ wish${TK_VERSION} \ wish.exe \ wish${TK_VERSION}.exe do if test -r "$dir/$wishexe" ; then WISH_EXE=$dir/$wishexe break fi done if test "x${WISH_EXE}" != "x" ; then break fi done if test "x${WISH_EXE}" = "x" ; then echo "Warning: Can't find executable for \"wish\". You may have to" echo "manually set the value for WISH_EXE in the xcircuit startup script." AC_MSG_RESULT(no) else AC_MSG_RESULT([${WISH_EXE}]) fi # Have to define SHDLIB_EXT here even though we have to do it below, too. case $target in *-hpux*) SHDLIB_EXT=".sl" ;; *cygwin*) SHDLIB_EXT=".dll.a" ;; *-darwin*) SHDLIB_EXT=".dylib" ;; *-openbsd*) SHDLIB_EXT=".so.${TCL_LIB_FILE##*.so.}" ;; *) SHDLIB_EXT=".so" ;; esac fi dnl End of Tcl/Tk search dnl -------------------------------- # ----------------------------------------------------------------------- # # Tk libraries and header files # # ----------------------------------------------------------------------- if test "x$xc_with_tcl" != "x" ; then INC_SPECS="${INC_SPECS} ${TCL_INCLUDE_SPEC} ${TK_INCLUDE_SPEC}" LIB_SPECS="${LIB_SPECS} ${TCL_LIB_SPEC} ${TK_LIB_SPEC}" if test "x${loader_run_path}" = "x" ; then loader_run_path="${TCL_LIB_DIR}" else loader_run_path="${TCL_LIB_DIR}:${loader_run_path}" fi #-------------------------------------------------------------------- # # Check if we can generate shared libraries on this system. Set flags # to generate shared libraries for systems that we know about. Start # with the values found in tclConfig.sh, make changes as we know about # the different systems. # #-------------------------------------------------------------------- # Initialize shared library build variables if test "x${TCL_SHLIB_SUFFIX}" == "x" ; then SHDLIB_EXT=".so" else SHDLIB_EXT="${TCL_SHLIB_SUFFIX}" fi if test "x${TCL_SHLIB_LD}" == "x" ; then # Construct shared library build arguments the painful way # This is not expected to be necessary, so the number of # supported systems has been pared down to a minimum. LDDL_FLAGS="-shared" LD_RUN_PATH="" SHLIB_LD="${CC}" EXTRA_LIB_SPECS="" case $target in *-darwin*) SHDLIB_EXT=".dylib" SHLIB_LIB_SPECS="${LIB_SPECS}" if test "${xc_with_gnu_ld}" = "yes" ; then LDDL_FLAGS="-dynamiclib -bind_at_load" else LDDL_FLAGS="-single_module -dynamiclib -flat_namespace" LDDL_FLAGS="${LDDL_FLAGS} -undefined suppress -noprebind" SHLIB_CFLAGS="-I/sw/include -fno-common" fi ;; *cygwin*) AC_DEFINE(CYGWIN) SHDLIB_EXT=".dll.a" LDDL_FLAGS="-shared -Wl,--enable-auto-image-base -Wl,-rpath,${loader_run_path}" SHLIB_LIB_SPECS="${LIB_SPECS}" ;; *-linux*) SHLIB_CFLAGS="-fPIC" LDDL_FLAGS='-shared -Wl,-soname,$@' LD_RUN_PATH="-Wl,-rpath,${loader_run_path}" EXTRA_LIB_SPECS="-ldl" case $target in x86_64-*) # AMD 64-bit archictecture # Add -fPIC to standard compile switch CFLAGS="${CFLAGS} -fPIC" ;; esac ;; *-netbsd*|*-freebsd*|*-openbsd*) # Not available on all versions: check for include file. AC_CHECK_HEADER(dlfcn.h, test_ok=yes, test_ok=no) if test "$test_ok" = yes; then SHLIB_CFLAGS="-fpic" SHLIB_LD="ld" LDDL_FLAGS="-shared" fi ;; esac if test "$GCC" = "yes" ; then CFLAGS="-fPIC ${CFLAGS}" fi else # Rely on shared lib arguments in tclConfig.sh SHLIB_LD="${TCL_SHLIB_LD}" EXTRA_LIB_FLAGS="" LDDL_FLAGS="${TCL_LD_FLAGS}" LD_RUN_PATH="" case $target in *-linux*) LD_RUN_PATH="-Wl,-rpath,${loader_run_path}" ;; esac fi # If we're running gcc, then set SHLIB_CFLAGS flags for compiling # shared libraries for gcc, instead of those of the vendor's # compiler. if test "$GCC" = "yes" ; then if test "x${TCL_SHLIB_CFLAGS}" = "x" ; then SHLIB_CFLAGS="-fPIC ${SHLIB_CFLAGS}" else SHLIB_CFLAGS="${TCL_SHLIB_CFLAGS} ${SHLIB_CFLAGS}" fi fi CFLAGS="${CFLAGS} ${SHLIB_CFLAGS}" if test "${xc_with_gnu_ld}" = "yes" ; then LDDL_FLAGS="${LDDL_FLAGS} -Wl,--version-script=symbol.map" fi AC_SUBST(SHDLIB_EXT) AC_SUBST(SHLIB_LD) AC_SUBST(LDDL_FLAGS) AC_SUBST(SHLIB_LIB_SPECS) AC_SUBST(EXTRA_LIB_SPECS) AC_SUBST(LD_RUN_PATH) AC_SUBST(LDFLAGS) AC_SUBST(INC_SPECS) AC_SUBST(LIB_SPECS) AC_SUBST(TCL_LIB_DIR) AC_SUBST(WISH_EXE) fi dnl Disable the ASG (automatic schematic generation) package. Disabled by default. AC_ARG_ENABLE(asg, [ --enable-asg enable support for Automatic Schematic Generation], [ AC_DEFINE(ASG) AC_DEFINE(CONFIGURED) SUBDIRS="asg spiceparser" dnl Object files to link into the final executable or shared object dnl These must be in the correct order! SUBLIB="asg/libasg.a spiceparser/libspiceparser.a" ],) dnl Disable LGF (analog/diglog) file support. Enabled by default. AC_ARG_ENABLE(lgf, [ --disable-lgf disable support for reading Caltech tools analog simulator .lgf files], , [ HAVE_LGF=LGF AC_DEFINE(LGF) ]) dnl Disable fix for input focus on some window managers. Enabled by default. AC_ARG_ENABLE(focus-fix, [ --disable-focus-fix disable focus fix for some window managers], , [ AC_DEFINE(INPUT_FOCUS) ]) dnl Path to Ghostscript AC_ARG_WITH(gs, [ --with-gs=DIR path to ghostscript], [ if test -f "$withval"; then GS_EXEC=$withval else GS_EXEC=gs fi ], [ AC_CHECK_PROG(GS_EXEC, gs, , gs)]) AC_DEFINE_UNQUOTED(GS_EXEC, "$GS_EXEC") dnl Path to ngspice AC_ARG_WITH(ngspice, [ --with-ngspice=DIR path to ngspice], [ if test -f "$withval"; then SPICE_EXEC=$withval else SPICE_EXEC=ngspice fi ], [ AC_CHECK_PROG(SPICE_EXEC, ngspice, , ngspice)]) AC_DEFINE_UNQUOTED(SPICE_EXEC, "$SPICE_EXEC") dnl Path to Python xc_with_python="" PYTHON= AC_ARG_WITH(python, [ --with-python=DIR path to python interpreter], xc_with_python=$withval) if test "x$xc_with_tcl" != "x" ; then xc_with_python="" elif test "$xc_with_python" = "no" ; then xc_with_python="" elif test "$xc_with_python" = "yes" ; then AC_PATH_PROG(PYTHON,python) elif test "x$xc_with_python" != x; then test -f "$xc_with_python" && PYTHON=$xc_with_python fi if test "x$PYTHON" != x; then _py_version=`$PYTHON -c 'import sys; print sys.version[[0:3]]'` _py_prefix=`$PYTHON -c 'import sys; print sys.prefix'` _py_exec_prefix=`$PYTHON -c 'import sys; print sys.exec_prefix'` _py_include="$_py_prefix/include/python$_py_version" _py_lib="$_py_exec_prefix/lib/python$_py_version/config" _py_makefile="$_py_lib/Makefile" if test $_py_version = 1.5; then echo echo "*** WARNING:" echo "*** Python version 1.5 detected: This version of Python has a known fatal" echo "*** bug. Disabling Python interface. If you want the embedded Python" echo "*** interface, you will need to get an updated version of Python." echo PYTHON="" fi fi if test "x$PYTHON" != x; then if test -f $_py_makefile; then _py_libs=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $_py_makefile` _py_libm=`sed -n -e 's/^LIBM=\(.*\)/\1/p' $_py_makefile` else _py_libs='-lpthread -ldl -lutil -ldb' _py_libm='-lm' fi # Now that we think we know where the python include and # library files are, make sure we can build a small # program against them. _save_CPPFLAGS=${CPPFLAGS} _save_LDFLAGS=${LDFLAGS} _save_LIBS=${LIBS} CPPFLAGS="$CPPFLAGS -I$_py_include" LDFLAGS="$LDFLAGS -L$_py_lib" case "$target_os" in *cygwin*) PYLIB="-lpython$_py_version" LIBS="$PYLIB.dll $LIBS $X_PRE_LIBS $_py_libs" ;; *) LIBS="$LIBS -lpython$_py_version $_py_libs $_py_libm" ;; esac HAVE_PYTHON=0 AC_CHECK_HEADER(Python.h,[ AC_MSG_CHECKING([for Py_Initialize in -lpython$_py_version]) AC_TRY_LINK([#include "Python.h"],[Py_Initialize();],[ HAVE_PYTHON=1 INTERPRETER=PYTHON AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PYTHON)], AC_MSG_RESULT(no))]) if test "x$HAVE_PYTHON" = x0; then CPPFLAGS=$_save_CPPFLAGS LDFLAGS=$_save_LDFLAGS LIBS=$_save_LIBS PYTHON="" fi fi if test "x$PYTHON" != x; then STARTUP_FILE="xcstartup.py" INTERP_PATH="python" WRAPPER_SCRIPT="" SUBDIRS="${SUBDIRS} Xw" SUBLIB="${SUBLIB} Xw/libxcXw.a" XCIRCUIT_TARGET="xcircuit" elif test "x$xc_with_tcl" != "x" ; then INTERPRETER=TCL STARTUP_FILE="xcstartup.tcl" INTERP_PATH="tcl" WRAPPER_SCRIPT="wrapper.tcl" AC_DEFINE(TCL_WRAPPER) XCIRCUIT_TARGET="tcl" ALL_TARGET="all-recursive" INSTALL_TARGET="install-recursive" else STARTUP_FILE="startup.script" INTERP_PATH="." WRAPPER_SCRIPT="" SUBDIRS="${SUBDIRS} Xw" SUBLIB="${SUBLIB} Xw/libxcXw.a" XCIRCUIT_TARGET="xcircuit" fi # Add -lm last to LDFLAGS, or Tcl/Tk's addition of -lieee can cause # an error. EXTRA_LIB_SPECS="$EXTRA_LIB_SPECS -lm" dnl Memory debugging: dnl The non-Tcl version uses (links to) ElectricFence. dnl Tcl must use the Tcl memory debugger. dnl Caveats: dnl We should try to ensure that ElectricFence is available, or that dnl the Tcl version used has memory debugging compiled in AC_ARG_ENABLE(memdebug, [ --enable-memdebug enable memory debugging], [ if test "x$xc_with_tcl" = "x" ; then LIBS="${LIBS} -lefence" else AC_DEFINE(TCL_MEM_DEBUG) fi ],) AC_SUBST(SUBDIRS) AC_SUBST(SUBLIB) AC_SUBST(STDLIBS) AC_SUBST(GS_LIBS) AC_SUBST(STARTUP_FILE) AC_SUBST(INTERP_PATH) AC_SUBST(WRAPPER_SCRIPT) AC_SUBST(XCIRCUIT_TARGET) AC_SUBST(CFLAGS) AC_SUBST(LD) AC_SUBST(LDFLAGS) AC_SUBST(INTERPRETER) AC_SUBST(HAVE_LGF) AC_SUBST(ALL_TARGET) AC_SUBST(INSTALL_TARGET) dnl Automake requires these AC_SUBST(ACLOCAL) AC_SUBST(AUTOCONF) AC_SUBST(AUTOMAKE) AC_SUBST(AUTOHEADER) AC_OUTPUT(Makefile Xw/Makefile spiceparser/Makefile) echo "" echo "Configuration results:" echo "----------------------------------------------------" echo "" if test "x$xc_with_tcl" == "x" ; then if test "x$PYTHON" != x; then echo "Using Python interface (not recommended)" else echo "No Tcl/Tk, using standard Xlib/Xt interface." echo "If that is not what you wanted, then make sure" echo "you have Tcl/Tk development packages installed?" fi else echo "Using Tcl/Tk interface" fi echo "" if test "x$xc_with_cairo" == "x" ; then echo "No Cairo graphics." echo "If that is not what you wanted, then make sure" echo "you have libcairo and fontconfig installed." echo "Try installing package cairo-devel." else echo "Using Cairo graphics" fi echo "" echo "CFLAGS=${CFLAGS}"