From 5248c4d50476896800e155d45932022f822e91cd Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Thu, 31 Jul 2008 21:58:37 +0000 Subject: [PATCH] More changes to support shared libraries and cleanup of files. --- configure/os/CONFIG.Common.cygwin-x86 | 62 ++++++++++++++----- configure/os/CONFIG.Common.win32-x86-mingw | 13 ++-- configure/os/CONFIG.cygwin-x86.Common | 1 - configure/os/CONFIG.cygwin-x86.cygwin-x86 | 28 +++++---- configure/os/CONFIG.win32-x86-mingw.Common | 11 +--- .../os/CONFIG.win32-x86-mingw.win32-x86-mingw | 23 ++----- configure/os/CONFIG_SITE.Common.cygwin-x86 | 4 +- .../os/CONFIG_SITE.cygwin-x86.cygwin-x86 | 2 +- 8 files changed, 79 insertions(+), 65 deletions(-) diff --git a/configure/os/CONFIG.Common.cygwin-x86 b/configure/os/CONFIG.Common.cygwin-x86 index ac9e3029a..a0964b490 100644 --- a/configure/os/CONFIG.Common.cygwin-x86 +++ b/configure/os/CONFIG.Common.cygwin-x86 @@ -13,27 +13,59 @@ include $(CONFIG)/os/CONFIG.Common.UnixCommon OS_CLASS = cygwin32 ARCH_CLASS = x86 -EXE=.exe +# Definitions used when COMMANDLINE_LIBRARY is READLINE +LDLIBS_READLINE = -lreadline -lcurses -COMPILER_CPPFLAGS = -D_REENTRANT - -#POSIX_CPPFLAGS = -D_POSIX_SOURCE=199506L -D_POSIX_THREADS -D_POSIX_TIMERS -# _POSIX_SOURCE eliminates select() POSIX_CPPFLAGS = -D_POSIX_THREADS -D_POSIX_TIMERS +#POSIX_CPPFLAGS += -D_POSIX_SOURCE POSIX_LDLIBS += -lpthread -ARCH_DEP_CPPFLAGS += -D_X86_ +ARCH_DEP_CFLAGS += -m32 +ARCH_DEP_LDFLAGS += -m32 -OP_SYS_CPPFLAGS += -DCYGWIN32 -U_WIN32 +# Compiler defines _X86_ 1 +# Compiler defines __MSVCRT__ 1 +# Compiler defines __CYGWIN__ 1 +# Compiler defines __CYGWIN32__ 1 +# Compiler defines __unix__ 1 +# Compiler defines __unix 1 +# Compiler defines unix 1 -# Set runtime path for shared libraries -SHRLIBDIR_LDFLAGS += $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath,%) +OP_SYS_CPPFLAGS += -DCYGWIN32 -# Set runtime path for products -PRODDIR_LDFLAGS += $(PROD_DEPLIB_DIRS:%=-Wl,-rpath,%) +EXE=.exe -# Definitions used when COMMANDLINE_LIBRARY is READLINE -INCLUDES_READLINE = -I$(GNU_DIR)/include -LDFLAGS_READLINE += -L$(GNU_DIR)/lib -LDLIBS_READLINE = -lreadline +VISC_DLL_NO = -DEPICS_DLL_NO +VISC_DLL_YES = +VISC_DLL = $(VISC_DLL_$(SHARED_LIBRARIES)) +STATIC_CFLAGS_YES= $(VISC_DLL) +STATIC_CFLAGS_NO= $(VISC_DLL) -D_DLL +STATIC_CXXFLAGS_YES= $(VISC_DLL) +STATIC_CXXFLAGS_NO= $(VISC_DLL) -D_DLL + +# adjust names of libraries to build +# +# But: if there are no objects LIBRARY_LD_OBJS to include +# in this library (may be for e.g. base/src/libCompat +# on some archs), don't define (and build) any library! +SHRLIB_PREFIX= +SHRLIB_SUFFIX=.dll +SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) +LOADABLE_SHRLIB_PREFIX= +LOADABLE_SHRLIB_SUFFIX=.dll +LOADABLE_SHRLIBNAME = $(LOADABLE_BUILD_LIBRARY:%=%$(LOADABLE_SHRLIB_SUFFIX)) + +# +# When SHARED_LIBRARIES is YES we are building a DLL link library +# and when SHARED_LIBRARIES is NO we are building an object library +# +LIB_PREFIX= +LIB_SUFFIX=.lib +DLL_LINK_LIBNAME_YES = $(BUILD_LIBRARY:%=%$(LIB_SUFFIX)) +DLL_LINK_LIBNAME = $(DLL_LINK_LIBNAME_$(SHARED_LIBRARIES)) +LIBNAME_NO = $(BUILD_LIBRARY:%=%$(LIB_SUFFIX)) +LIBNAME = $(LIBNAME_$(SHARED_LIBRARIES)) + +# dll install location +INSTALL_SHRLIB = $(INSTALL_BIN) diff --git a/configure/os/CONFIG.Common.win32-x86-mingw b/configure/os/CONFIG.Common.win32-x86-mingw index 262129024..7c062d060 100644 --- a/configure/os/CONFIG.Common.win32-x86-mingw +++ b/configure/os/CONFIG.Common.win32-x86-mingw @@ -13,7 +13,9 @@ include $(CONFIG)/os/CONFIG.Common.UnixCommon OS_CLASS = WIN32 ARCH_CLASS = x86 -#ARCH_DEP_CPPFLAGS += -D_X86_ +# Definitions used when COMMANDLINE_LIBRARY is READLINE +LDLIBS_READLINE = -lreadline -lcurses + ARCH_DEP_CFLAGS += -m32 ARCH_DEP_LDFLAGS += -m32 @@ -29,13 +31,11 @@ ARCH_DEP_LDFLAGS += -m32 # Compiler defines WINNT 1 # Compiler does not define __unix __unix__ unix -# Override of definitions from CONFIG.Common.UnixCommon - -EXE=.exe - # Override for -DUNIX from CONFIG.Common.UnixCommon OP_SYS_CPPFLAGS = -D_MINGW +EXE=.exe + VISC_DLL_NO = -DEPICS_DLL_NO VISC_DLL_YES = VISC_DLL = $(VISC_DLL_$(SHARED_LIBRARIES)) @@ -44,7 +44,6 @@ STATIC_CFLAGS_NO= $(VISC_DLL) -D_DLL STATIC_CXXFLAGS_YES= $(VISC_DLL) STATIC_CXXFLAGS_NO= $(VISC_DLL) -D_DLL -EXE=.exe # adjust names of libraries to build # # But: if there are no objects LIBRARY_LD_OBJS to include @@ -71,6 +70,4 @@ LIBNAME = $(LIBNAME_$(SHARED_LIBRARIES)) # dll install location INSTALL_SHRLIB = $(INSTALL_BIN) -LINK.shrlib = $(CCC) -o $(SHRLIB_PREFIX)$*$(SHRLIB_SUFFIX) $(TARGET_LIB_LDFLAGS) $(SHRLIBDIR_LDFLAGS) $(LDFLAGS) -LINK.shrlib += $(LIB_LDFLAGS) $(LIBRARY_LD_OBJS) $(LIBRARY_LD_RESS) $(SHRLIB_LDLIBS) diff --git a/configure/os/CONFIG.cygwin-x86.Common b/configure/os/CONFIG.cygwin-x86.Common index 336ac855e..ea291e2ab 100644 --- a/configure/os/CONFIG.cygwin-x86.Common +++ b/configure/os/CONFIG.cygwin-x86.Common @@ -18,4 +18,3 @@ HOSTEXE=.exe # Needed to find dlls for base installed build tools (antelope,eflex,...) PATH := $(EPICS_BASE_TOOLS_BIN):$(PATH) - diff --git a/configure/os/CONFIG.cygwin-x86.cygwin-x86 b/configure/os/CONFIG.cygwin-x86.cygwin-x86 index b347bb6ac..8cf0915e9 100644 --- a/configure/os/CONFIG.cygwin-x86.cygwin-x86 +++ b/configure/os/CONFIG.cygwin-x86.cygwin-x86 @@ -9,24 +9,30 @@ # Include common gnu compiler definitions include $(CONFIG)/CONFIG.gnuCommon -## Shared libraries for cygwin not implemented yet -SHARED_LIBRARIES=NO - # cygwin's gcc, g++, ar, ld, and ranlib must be in user's path CC = gcc CCC = g++ AR = ar -rc LD = ld -r RANLIB = ranlib +RES=.coff +RCCMD = windres $(INCLUDES) $< $@ -# Avoid 'position-independent code is always generated' message +# No -fPIC avoids "-fPIC ignored for target (all code is position independent)" SHRLIB_CFLAGS = -SHRLIB_LDFLAGS = -shared -LOADABLE_SHRLIB_LDFLAGS = -shared +SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) +LOADABLE_SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) + +CONFORM_CFLAGS_ANSI = +CONFORM_CFLAGS_STRICT = -ansi +CONFORM_CXXFLAGS_NORMAL = +CONFORM_CXXFLAGS_STRICT = -ansi + +# -ansi build errors need fixing: u_long undeclared, fd_set with no type +CONFORM_CFLAGS_STRICT = +CONFORM_CXXFLAGS_STRICT = + +# Override linking with gcc library from CONFIG.gnuCommon +GNU_LDLIBS_YES = -# -ansi eliminates strdup -CONFORM_CFLAGS_ANSI = -CONFORM_CFLAGS_STRICT = -pedantic -CONFORM_CXXFLAGS_NORMAL = -CONFORM_CXXFLAGS_STRICT = -pedantic diff --git a/configure/os/CONFIG.win32-x86-mingw.Common b/configure/os/CONFIG.win32-x86-mingw.Common index b6d83b4ec..d26e29f74 100644 --- a/configure/os/CONFIG.win32-x86-mingw.Common +++ b/configure/os/CONFIG.win32-x86-mingw.Common @@ -17,16 +17,11 @@ MKDIR = $(PERL) -MExtUtils::Command -e mkpath RMDIR = $(PERL) -MExtUtils::Command -e rm_rf ECHO = echo -HOSTEXE=.exe - WIND_HOST_TYPE = x86-win32 - -# osithead use default stack, YES or NO override OSITHREAD_USE_DEFAULT_STACK = NO -# DLL build not supported yet +HOSTEXE=.exe + # Needed to find dlls for base installed build tools (antelope,eflex,...) -#PATH := $(EPICS_BASE_TOOLS_BIN):$(PATH) - - +PATH := $(EPICS_BASE_TOOLS_BIN):$(PATH) diff --git a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw index a66edeb4f..02c569042 100644 --- a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw +++ b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw @@ -9,17 +9,16 @@ # Include common gnu compiler definitions include $(CONFIG)/CONFIG.gnuCommon -SHRLIB_VERSION= - # gcc, g++, ar, ld, and ranlib must be in user's path CC = gcc CCC = g++ AR = ar -rc LD = ld -r RANLIB = ranlib +RES=.coff +RCCMD = windres $(INCLUDES) $< $@ -# Avoid "-fPIC ignored for target (all code is position independent)" - +# No -fPIC avoids "-fPIC ignored for target (all code is position independent)" SHRLIB_CFLAGS = SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) LOADABLE_SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) @@ -33,17 +32,5 @@ CONFORM_CXXFLAGS_STRICT = # Override linking with gcc library from CONFIG.gnuCommon GNU_LDLIBS_YES = -# Library used when COMMANDLINE_LIBRARY is READLINE -LDLIBS_READLINE = -lreadline - -OP_SYS_CXXFLAGS += -D__cplusplus - -LIBRARY_LD_RESS= - -OP_SYS_LDLIBS = -lws2_32 -ladvapi32 -luser32 -lkernel32 -lwinmm -#STATIC_LDLIBS_YES=-lws2_32 -ladvapi32 -luser32 -lkernel32 -lwinmm - -#STATIC_LDFLAGS_YES= -Wl,-Bstatic -#STATIC_LDFLAGS_NO= -#STATIC_LDLIBS_YES= -Wl,-Bdynamic -#STATIC_LDLIBS_NO= +OP_SYS_LDLIBS = -lws2_32 +PROD_SYS_LIBS = ws2_32 diff --git a/configure/os/CONFIG_SITE.Common.cygwin-x86 b/configure/os/CONFIG_SITE.Common.cygwin-x86 index d1bc7d379..866886071 100644 --- a/configure/os/CONFIG_SITE.Common.cygwin-x86 +++ b/configure/os/CONFIG_SITE.Common.cygwin-x86 @@ -7,6 +7,4 @@ # If readline is installed uncomment the following line # to add command-line editing and history support -#COMMANDLINE_LIBRARY = READLINE - - +COMMANDLINE_LIBRARY = READLINE diff --git a/configure/os/CONFIG_SITE.cygwin-x86.cygwin-x86 b/configure/os/CONFIG_SITE.cygwin-x86.cygwin-x86 index 309f38a8b..4735eaba8 100644 --- a/configure/os/CONFIG_SITE.cygwin-x86.cygwin-x86 +++ b/configure/os/CONFIG_SITE.cygwin-x86.cygwin-x86 @@ -7,5 +7,5 @@ #------------------------------------------------------- # GNU_DIR used when COMMANDLINE_LIBRARY is READLINE -GNU_DIR=C:/cygwin +#GNU_DIR=C:/cygwin