* Proper DLL symbol exporting under Win32.

git-svn-id: svn://svn.zoy.org/elk/trunk@162 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-09-17 13:18:59 +00:00
parent 809443fb06
commit 5f31f6ae27
6 changed files with 68 additions and 21 deletions

View File

@ -37,11 +37,18 @@ AC_SUBST(STDINT_HEADER)
# type of system.
AC_DEFINE_UNQUOTED(SYSTEMTYPE, ["${target_os}"], [Our operating system])
MATH_LIBS="-lm"
case "${target_os}" in
*hpux*)
AC_DEFINE(ARRAY_BROKEN, 1, [Define if a-=1000; a[1000] doesn't work])
;;
*mingw32*)
ELK_CFLAGS="${ELK_CFLAGS} -DELK_BUILD_DLL"
ELK_LDFLAGS="${ELK_LDFLAGS} -no-undefined"
MATH_LIBS=""
;;
esac
ELK_LIBS="${ELK_LIBS} ${MATH_LIBS}"
# Does the system support the vprintf library function? If not,
# availability of the (non-portable) _doprnt function is assumed.
@ -190,6 +197,13 @@ if test "${ac_cv_my_can_load_lib}" = "no"; then
ac_cv_my_can_load_lib=yes])
fi
# Win32 style
if test "${ac_cv_my_can_load_lib}" = "no"; then
AC_CHECK_LIB(kernel32, main,
[ELK_LIBS="${ELK_LIBS} -lkernel32"
ac_cv_my_can_load_lib=yes])
fi
AC_CHECK_HEADERS(a.out.h)
# Only test for dlopen() if the others didn't work
@ -369,7 +383,7 @@ AC_DEFINE(ANSI_CPP, 1, [FIXME HARD])
# The UNIX extension likes to know which of the following system calls,
# library functions, and include files are supported by the system.
AC_CHECK_HEADERS(utime.h)
AC_CHECK_HEADERS(utime.h sys/wait.h)
AC_CHECK_FUNCS(waitpid wait3 wait4 vfork uname gethostname gettimeofday ftime)
AC_CHECK_FUNCS(mktemp tmpnam tempnam getcwd getwd rename regcomp)
@ -450,12 +464,17 @@ AM_CONDITIONAL(HAVE_X11, test "${ac_cv_my_have_x11}" = "yes")
AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)
AC_CHECK_LIB(Xmu, XmuDrawLogo,
[xmu_libraries="-lXmu"],
[xmu_libraries=""],
[[-lXt -lSM -lICE -lXext -lX11 -L${x_libraries}]])
AC_CHECK_LIB(Xaw, XawTextSearch, [
ac_cv_my_have_xaw=yes
XAW_CFLAGS="-I${x_includes}"
XAW_LIBS="-L${x_libraries} -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11"
XAW_LIBS="-L${x_libraries} -lXaw ${xmu_libraries} -lXt -lSM -lICE -lXext -lX11"
], [ac_cv_my_have_xaw=no],
[[-lXmu -lXt -lSM -lICE -lXext -lX11 -L${x_libraries}]])
[[${xmu_libraries} -lXt -lSM -lICE -lXext -lX11 -L${x_libraries}]])
AM_CONDITIONAL(HAVE_XAW, test "${ac_cv_my_have_xaw}" = "yes")
AC_SUBST(XAW_CFLAGS)
AC_SUBST(XAW_LIBS)
@ -463,17 +482,19 @@ AC_SUBST(XAW_LIBS)
AC_CHECK_LIB(Xm, XmStringConcat, [
ac_cv_my_have_motif=yes
MOTIF_CFLAGS="-I${x_includes} -I/usr/include/Xm"
MOTIF_LIBS="-L${x_libraries} -lXm -lXmu -lXt -lSM -lICE -lXext -lX11"
MOTIF_LIBS="-L${x_libraries} -lXm ${xmu_libraries} -lXt -lSM -lICE -lXext -lX11"
], [ac_cv_my_have_motif=no],
[[-lXmu -lXt -lSM -lICE -lXext -lX11 -L${x_libraries}]])
[[${xmu_libraries} -lXt -lSM -lICE -lXext -lX11 -L${x_libraries}]])
AM_CONDITIONAL(HAVE_MOTIF, test "${ac_cv_my_have_motif}" = "yes")
AC_SUBST(MOTIF_CFLAGS)
AC_SUBST(MOTIF_LIBS)
dnl Export variables
INCLUDES="${INCLUDES} -I\$(top_srcdir)/include -I\$(top_builddir)/include"
ELK_LIBS="${ELK_LIBS} -lm"
AC_SUBST(INCLUDES)
dnl Export variables
AC_SUBST(ELK_CFLAGS)
AC_SUBST(ELK_LDFLAGS)
AC_SUBST(ELK_LIBS)
dnl

View File

@ -442,7 +442,12 @@ extern void String_Ungetc P_((Object, register int));
/* Symbols, variables, frequently used Scheme objects
*/
extern Object Null, True, False, Void, Newline, Eof;
extern_c Object elk_import Null;
extern_c Object elk_import True;
extern_c Object elk_import False;
extern_c Object elk_import Void;
extern_c Object elk_import Newline;
extern_c Object elk_import Eof;
extern Object Intern P_((const char*));
extern Object CI_Intern P_((const char*));
extern Object P_Oblist P_((void));

View File

@ -28,7 +28,7 @@
* THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
extern Object False2;
extern_c Object elk_import False2;
#define Nullp(x) (TYPE(x) == T_Null)
#define Truep(x) (!EQ(x,False) && !EQ(x,False2))

View File

@ -48,6 +48,27 @@
# define elk_attribute(att) /* */
#endif
/* Properly export Win32 symbols */
#if (defined(_WIN32) || defined(__CYGWIN__)) && \
!(defined(ELK_BUILD_DLL) || defined(ELK_STATIC))
# define elk_import __declspec(dllimport)
#else
# define elk_import /* */
#endif
#if defined(__cplusplus)
# define extern_c extern "C"
#else
# define extern_c /* */
#endif
/* Directory separator */
#ifdef WIN32
# define SEPARATOR_CHAR '\\'
# define SEPARATOR_STRING "\\"
#else
# define SEPARATOR_CHAR '/'
# define SEPARATOR_STRING "/"
#endif
/* Arithmetic shift right for compilers that don't sign extend:
*/

View File

@ -14,51 +14,51 @@ pkglib_LTLIBRARIES = \
$(NULL)
bitstring_la_SOURCES = bitstring.c
bitstring_la_LDFLAGS = -module -avoid-version
bitstring_la_LDFLAGS = -module -avoid-version -no-undefined
bitstring_la_LIBADD = $(top_builddir)/src/libelk.la
elk_eval_la_SOURCES = elk-eval.c
elk_eval_la_LDFLAGS = -module -avoid-version
elk_eval_la_LDFLAGS = -module -avoid-version -no-undefined
elk_eval_la_LIBADD = $(top_builddir)/src/libelk.la
hack_la_SOURCES = hack.c
hack_la_LDFLAGS = -module -avoid-version
hack_la_LDFLAGS = -module -avoid-version -no-undefined
hack_la_LIBADD = $(top_builddir)/src/libelk.la
regexp_la_SOURCES = regexp.c
regexp_la_LDFLAGS = -module -avoid-version
regexp_la_LDFLAGS = -module -avoid-version -no-undefined
regexp_la_LIBADD = $(top_builddir)/src/libelk.la
debug_la_SOURCES = debug.c
debug_la_LDFLAGS = -module -avoid-version
debug_la_LDFLAGS = -module -avoid-version -no-undefined
debug_la_LIBADD = $(top_builddir)/src/libelk.la
if HAVE_GDBM
gdbm_la = gdbm.la
endif
gdbm_la_SOURCES = gdbm.c
gdbm_la_LDFLAGS = -module -avoid-version
gdbm_la_LDFLAGS = -module -avoid-version -no-undefined
gdbm_la_LIBADD = $(top_builddir)/src/libelk.la -lgdbm
if HAVE_MONITOR
monitor_la = monitor.la
endif
monitor_la_SOURCES = monitor.c
monitor_la_LDFLAGS = -module -avoid-version
monitor_la_LDFLAGS = -module -avoid-version -no-undefined
monitor_la_LIBADD = $(top_builddir)/src/libelk.la
record_la_SOURCES = record.c
record_la_LDFLAGS = -module -avoid-version
record_la_LDFLAGS = -module -avoid-version -no-undefined
record_la_LIBADD = $(top_builddir)/src/libelk.la
struct_la_SOURCES = struct.c
struct_la_LDFLAGS = -module -avoid-version
struct_la_LDFLAGS = -module -avoid-version -no-undefined
struct_la_LIBADD = $(top_builddir)/src/libelk.la
if HAVE_CXX
newhandler_la = newhandler.la
endif
newhandler_la_SOURCES = newhandler.cpp
newhandler_la_LDFLAGS = -module -avoid-version
newhandler_la_LDFLAGS = -module -avoid-version -no-undefined
newhandler_la_LIBADD = $(top_builddir)/src/libelk.la

View File

@ -1,8 +1,8 @@
NULL =
lib_LTLIBRARIES = libelk.la
libelk_la_CFLAGS = -I/usr/include/libelf
libelk_la_LDFLAGS =
libelk_la_CFLAGS = @ELK_CFLAGS@ -I/usr/include/libelf
libelk_la_LDFLAGS = @ELK_LDFLAGS@
libelk_la_LIBADD = @ELK_LIBS@
libelk_la_SOURCES = \
autoload.c \