Applied patch from Lionel Sainte Cluque to compile spice without X

Windows
This commit is contained in:
pnenzi 2008-08-21 10:34:29 +00:00
parent 7a63b8871a
commit 966ec71b16
6 changed files with 65 additions and 12 deletions

View File

@ -154,11 +154,19 @@ dnl --enable-cluster: define CLUSTER in the code. This is for cluster support
AC_ARG_ENABLE(cluster,
AS_HELP_STRING([--enable-cluster],[Enable cluster support, (experimental) ]))
dnl --enable-help: try to force --ansi option to the compiler
AC_ARG_ENABLE(help,
AS_HELP_STRING([--enable-help],[Force building nghelp (deprecated)]))
dnl --enable-xgraph: Compile the xgraph plotting program. Default is "no".
dnl Xgraph is a plotting package for X11 once very popular.
AC_ARG_ENABLE(xgraph,
AS_HELP_STRING([--enable-xgraph],[Enable xgraph compilation.]))
dnl --enable-x: Compile software using x libraries. A GUI will be provided then.
AC_ARG_ENABLE(x,
AS_HELP_STRING([--enable-x],[Enable X11 gui]))
dnl --with-readline: Includes GNU readline support into CLI. Default is "no".
dnl Including readline into ngspice is a violation of GPL license. It's use
dnl is discouraged.
@ -267,6 +275,12 @@ case $with_windows in
yes )
AC_DEFINE(X_DISPLAY_MISSING)
AC_MSG_RESULT(No X display!)
AM_CONDITIONAL(NO_X, test x$with_windows = xyes)
if test "x$enable_help" = "xyes"; then
AM_CONDITIONAL(NO_HELP, test ! x$with_windows = xyes)
else
AM_CONDITIONAL(NO_HELP, true)
fi
CFLAGS="$CFLAGS -mwindows";;
* )
@ -361,14 +375,26 @@ dnl for MacOSX or Linux, but
dnl -lXaw -lXmu -lXt -lXext -lX11
dnl seems to be the popular choice.
dnl (The previous order was -lX11 -lXt -lXext -lXmu -lXaw)
if test "x$enable_x" = "xno"; then
no_x = "no"
fi
if test ! "$no_x" = "yes" ; then
AC_CHECK_LIB(Xaw,main,X_LIBS="$X_LIBS -lXaw",AC_MSG_ERROR(Couldn't find Xaw library),$X_LIBS $X_EXTRA_LIBS)
AC_CHECK_LIB(Xmu,main,X_LIBS="$X_LIBS -lXmu",AC_MSG_ERROR(Couldn't find Xmu library), $X_LIBS $X_EXTRA_LIBS)
X_LIBS="$X_LIBS -lXt"
AC_CHECK_LIB(Xext, XShmAttach,X_LIBS="$X_LIBS -lXext",AC_MSG_ERROR(Couldn't find Xext library), $X_LIBS $X_EXTRA_LIBS)
X_LIBS="$X_LIBS -lX11"
AM_CONDITIONAL(NO_X, false)
else
AC_DEFINE(X_DISPLAY_MISSING)
AC_MSG_RESULT(No X display!)
AM_CONDITIONAL(NO_X, true)
fi
if ( test "x$enable_help" = "xyes" ) && ! ( test "$no_x" = "yes" ) ; then
AM_CONDITIONAL(NO_HELP, false)
else
AM_CONDITIONAL(NO_HELP, true)
fi ;;
esac

View File

@ -4,12 +4,15 @@
SUBDIRS = misc maths frontend spicelib include @XSPICEDIR@ @CIDERDIR@
DIST_SUBDIRS = misc maths frontend spicelib include xspice ciderlib
bin_PROGRAMS = ngspice ngnutmeg nghelp ngmakeidx
bin_PROGRAMS = ngspice ngnutmeg ngmakeidx
if !WINDOWS
bin_PROGRAMS += ngsconvert ngproc2mod ngmultidec
endif
if !NO_HELP
bin_PROGRAMS += nghelp
endif
EXTRA_DIST = ngspice.txt ngspice.idx setplot spectrum \
devload devaxis ciderinit winmain.c
@ -104,7 +107,6 @@ ngspice_LDADD = \
@XSPICELIB2@ \
frontend/parser/libparser.a \
frontend/numparam/libnumparam.a \
frontend/help/libhlp.a \
spicelib/parser/libinp.a \
@CIDERSIM@ \
maths/deriv/libderiv.a \
@ -114,7 +116,10 @@ ngspice_LDADD = \
maths/ni/libni.a \
maths/sparse/libsparse.a \
misc/libmisc.a
if !NO_X
ngspice_LDADD += \
frontend/help/libhlp.a
endif
winmain.o: winmain.c
$(COMPILE) -DSIMULATOR -o winmain.o -c $(srcdir)/winmain.c
@ -140,17 +145,21 @@ ngnutmeg_LDADD = \
frontend/plotting/libplotting.a \
frontend/parser/libparser.a \
frontend/numparam/libnumparam.a \
frontend/help/libhlp.a \
maths/cmaths/libcmaths.a \
maths/misc/libmathmisc.a \
maths/poly/libpoly.a \
misc/libmisc.a \
spicelib/parser/libinp.a
if !NO_X
ngnutmeg_LDADD += \
frontend/help/libhlp.a
endif
## help:
nghelp_SOURCES = conf.c nghelp.c
if !NO_HELP
if WINDOWS
nghelp_SOURCES += winmain.c
endif
@ -160,8 +169,12 @@ endif
# that would otherwise occur (thanks to Andreas Unger for this fix).
nghelp_LDADD = \
frontend/terminal.o \
frontend/help/libhlp.a \
misc/libmisc.a
if !NO_X
nghelp_LDADD += \
frontend/help/libhlp.a
endif
endif
## These programs currently fail to build on Windows
if !WINDOWS

View File

@ -1,14 +1,17 @@
#ifndef X_DISPLAY_MISSING
#include <ngspice.h>
#include <wordlist.h>
#include <bool.h>
#include <variable.h>
#include <hlpdefs.h>
#include "com_ghelp.h"
#include "com_help.h"
#include "variable.h"
#include "streams.h"
#include "cpextern.h"
#include <hlpdefs.h>
#endif
#include "com_ghelp.h"
#include "com_help.h"
void
com_ghelp(wordlist *wl)
@ -31,6 +34,7 @@ com_ghelp(wordlist *wl)
com_help(wl);
return;
}
#ifndef X_DISPLAY_MISSING /* 1 */
path = npath;
if (cp_getvar("helpregfont", VT_STRING, buf))
hlp_regfontname = copy(buf);
@ -67,4 +71,5 @@ com_ghelp(wordlist *wl)
hlp_displayname = NULL;
hlp_main(path, wl);
return;
#endif /* X_DISPLAY_MISSING 1 */
}

View File

@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in
if !NO_X
noinst_LIBRARIES = libhlp.a
libhlp_a_SOURCES = \
@ -14,5 +16,6 @@ libhlp_a_SOURCES = \
INCLUDES = -I$(top_srcdir)/src/include @X_CFLAGS@
endif
MAINTAINERCLEANFILES = Makefile.in

View File

@ -22,11 +22,15 @@ libplotting_a_SOURCES = \
plotcurv.c \
plotcurv.h \
plotit.c \
plotit.h \
plotit.h
if !NO_X
libplotting_a_SOURCES += \
x11.c \
x11.h \
xgraph.c \
xgraph.h
endif
INCLUDES = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/frontend @X_CFLAGS@

View File

@ -1,5 +1,6 @@
/* $Id$ */
#include <ngspice.h>
#include <config.h>
#include <bool.h>
#include <wordlist.h>
#include <graph.h>
@ -951,6 +952,7 @@ plotit(wordlist *wl, char *hcopy, char *devname)
break;
}
#ifndef X_DISPLAY_MISSING
if (devname && eq(devname, "xgraph")) {
/* Interface to XGraph-11 Plot Program */
ft_xgraph(xlims, ylims, hcopy,
@ -961,7 +963,7 @@ plotit(wordlist *wl, char *hcopy, char *devname)
rtn = TRUE;
goto quit;
}
#endif
if (devname && eq(devname, "gnuplot")) {
/* Interface to XGraph-11 Plot Program */