diff --git a/configure.ac b/configure.ac index 038111ef8..931d454d0 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index 627882894..b7527ab35 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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