configure.ac: shared module added

This commit is contained in:
h_vogt 2013-03-23 18:30:55 +01:00
parent 8250c56c33
commit 6e8c8d303d
1 changed files with 57 additions and 1 deletions

View File

@ -178,6 +178,10 @@ AC_ARG_WITH([editline],
AC_ARG_WITH([tcl],
[AS_HELP_STRING([--with-tcl=tcldir], [Compiles the tcl module instead, experimental, see README.tcl])])
# --with-ngshared: define SHARED_MODULE in the code. This is for ngspice as shared library (or dll)
AC_ARG_WITH([ngshared],
[AS_HELP_STRING([--with-ngshared], [Compiles ngspice as shared library (dll)])])
# readline and editline cannot both be enabled
if test "x$with_editline" = xyes; then
if test "x$with_readline" = xyes; then
@ -288,6 +292,43 @@ else
dprefix=$prefix
fi
##########################################################################
#
# ngspice as shared library (ngspice.so or ngspice.dll)
#
##########################################################################
if test "x$with_ngshared" != x && test "x$with_ngshared" != xno ; then
has_shared_module=true
AC_DEFINE([SHARED_MODULE], [1], [shared ngspice module])
case $host_os in
*mingw* )
has_shwin=true
has_no_help=true
AC_DEFINE([HAS_SHWIN], [1], [ngspice.dll Windows])
;;
*cygwin* )
has_shcyg=true
AC_CHECK_LIB([pthread], [pthread_create])
;;
*)
CFLAGS="$CFLAGS -fvisibility=hidden"
AC_CHECK_LIB([pthread], [pthread_create])
;;
esac
with_x=no
with_windows=no
AC_SUBST([STATIC], [-shared])
TCL_PACKAGE_PATH=""
TCL_LIB_SPEC=""
################### end of ngspice shared option #########################
##########################################################################
#
# tcl libraries test
@ -297,7 +338,7 @@ fi
#
# The tclSpice options
#
if test "x$with_tcl" != x && test "x$with_tcl" != xno ; then
elif test "x$with_tcl" != x && test "x$with_tcl" != xno ; then
has_tcl_module=true
AC_DEFINE([TCL_MODULE], [1], [Tcl Module])
case $host_os in
@ -439,6 +480,10 @@ else
AC_SUBST([STATIC], [-static])
fi
AM_CONDITIONAL([SHARED_MODULE], [test "x$has_shared_module" = xtrue])
AM_CONDITIONAL([SHWIN], [test "x$has_shwin" = xtrue])
AM_CONDITIONAL([SHCYG], [test "x$has_shcyg" = xtrue])
AM_CONDITIONAL([TCL_MODULE], [test "x$has_tcl_module" = xtrue])
AM_CONDITIONAL([TCLWIN], [test "x$has_tclwin" = xtrue])
AM_CONDITIONAL([TCLCYG], [test "x$has_tclcyg" = xtrue])
@ -704,6 +749,14 @@ AC_TRY_LINK([#include <setjmp.h>],[jmp_buf env; sigsetjmp(env, 1);],
AC_DEFINE([HAVE_SIGSETJMP], [], [Define if we have sigsetjmp().])],
[AC_MSG_RESULT([no])])
# A mingw ngspice dll with linking against libiberty.a seems not to be possible.
# Because there is a internal replacement for asprintf, and dirmane is not been used anywhere,
# just skip it.
case $host_os in
*mingw* )
AC_MSG_RESULT([Cannot make dll from libiberty.a, no check for headers])
;;
* )
# Check for some headers (asprintf, dirname, etc.)
AC_CHECK_HEADERS([libiberty.h libgen.h])
@ -712,6 +765,8 @@ AC_CHECK_FUNCS([asprintf], [],
[AC_CHECK_LIB([iberty], [asprintf],
[AC_DEFINE([HAVE_ASPRINTF], [1], [Have asprintf in libiberty])
LIBS="$LIBS -liberty"])])
;;
esac
# Check for the snprintf function:
if test "x$ac_cv_func_asprintf" = xno ; then
@ -724,6 +779,7 @@ AC_CHECK_FUNCS([dirname], [],
[AC_DEFINE([HAVE_DIRNAME], [1], [Have dirname in libgen])
LIBS="$LIBS -lgen"])])
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_FUNC([getopt_long], [getopt_long=true])
if test "x$getopt_long" = xtrue; then