configure.ac, src/Makefile.am, add --enable-relpath to set preprocessor flag HAS_RELPATH

This commit is contained in:
h_vogt 2016-11-01 16:01:33 +01:00 committed by rlar
parent 264d487848
commit 1fcca3a8d3
2 changed files with 19 additions and 1 deletions

View File

@ -182,6 +182,11 @@ AC_ARG_ENABLE([help],
AC_ARG_ENABLE([xgraph],
[AS_HELP_STRING([--enable-xgraph], [Enable xgraph compilation.])])
# --enable-relpath: Relative path for binary and data. Default is "no".
# ngspice shared may want relative paths for spinit etc.
AC_ARG_ENABLE([relpath],
[AS_HELP_STRING([--enable-relpath], [Enable relative paths for spinit etc.])])
# --with-readline: Includes GNU readline support into CLI. Default is "no".
AC_ARG_WITH([readline],
[AS_HELP_STRING([--with-readline[=yes/no]], [Enable GNU readline support for CLI. Default=no.])])
@ -793,8 +798,15 @@ if test "x$getopt_long" = xtrue; then
AC_DEFINE([HAVE_GETOPT_LONG], [1], [Have fcn getopt_long()])
fi
AM_CONDITIONAL([RELPATH], [test "x$enable_relpath" = xyes])
if test "x$enable_relpath" = xyes; then
AC_DEFINE_UNQUOTED([NGSPICEBINDIR], ["`echo ../bin`"], [Define the directory for executables])
AC_DEFINE_UNQUOTED([NGSPICEDATADIR], ["`echo ../share/ngspice`"], [Define the directory for architecture independent data files])
AC_DEFINE([HAS_RELPATH], [1], [rel. path of libraries and scripts])
else
AC_DEFINE_UNQUOTED([NGSPICEBINDIR], ["`echo $dprefix/bin`"], [Define the directory for executables])
AC_DEFINE_UNQUOTED([NGSPICEDATADIR], ["`echo $dprefix/share/ngspice`"], [Define the directory for architecture independent data files])
fi
AC_DEFINE_UNQUOTED([NGSPICEBUILDDATE], ["`date`"], [Define the build date])
if test "x$with_wingui" = xyes; then

View File

@ -293,13 +293,19 @@ ngspice.idx: ngmakeidx$(EXEEXT) $(srcdir)/ngspice.txt
endif !SHWIN
endif !WINGUI
if RELPATH
spinitpath=../lib/ngspice
endif RELPATH
if !RELPATH
spinitpath=$(pkglibdir)
endif !RELPATH
## create spinit at compile time, see
## (info "(autoconf) Installation Directory Variables")
edit = sed \
-e 's|@XSPICEINIT[@]|$(XSPICEINIT)|g' \
-e 's|@pkglibdir[@]|$(pkglibdir)|g'
-e 's|@pkglibdir[@]|$(spinitpath)|g'
spinit tclspinit : Makefile
rm -f $@ $@.tmp