$(o)/charset/libcharset.so: $(addsuffix .oo,$(addprefix $(o)/charset/,$(LIBCHARSET_MODS)))
$(o)/charset/libcharset.pc: $(LIBUCW)
+ifdef CONFIG_STATIC_PIC
+$(o)/charset/libcharset.pc: $(o)/charset/libcharset-pic.a
+endif
+
API_LIBS+=libcharset
API_INCLUDES+=$(o)/charset/.include-stamp
$(o)/charset/.include-stamp: $(addprefix $(s)/charset/,$(LIBCHARSET_INCLUDES))
install -m 644 $(addprefix run/include/charset/,$(LIBCHARSET_INCLUDES)) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/charset
install -m 644 run/lib/libcharset.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR)
install -m 644 run/lib/pkgconfig/libcharset.pc $(DESTDIR)$(INSTALL_PKGCONFIG_DIR)
+ifdef CONFIG_STATIC_PIC
+ install -m 644 run/lib/libcharset-pic.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR)
+endif
.PHONY: install-libcharset
LIBIMAGES_DEPS=$(LIBUCW)
endif
+ifdef CONFIG_STATIC_PIC
+LIBIMAGES_DEPS+=$(o)/images/libimages-pic.a
+endif
+
ifdef CONFIG_IMAGES_DUP
LIBIMAGES_PROGS+=$(o)/images/image-dup-test
LIBIMAGES_MODS+=dup-init dup-cmp
CONFIGS+=$(LIBIMAGES_CONFIGS)
$(o)/images/libimages.a: $(addsuffix .o,$(addprefix $(o)/images/,$(LIBIMAGES_MODS)))
+$(o)/images/libimages-pic.a: $(addsuffix .oo,$(addprefix $(o)/images/,$(LIBIMAGES_MODS)))
$(o)/images/libimages.so: $(addsuffix .oo,$(addprefix $(o)/images/,$(LIBIMAGES_MODS)))
$(o)/images/libimages.pc: $(LIBIMAGES_DEPS)
install -m 644 run/lib/libimages.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR)
install -m 644 run/lib/pkgconfig/libimages.pc $(DESTDIR)$(INSTALL_PKGCONFIG_DIR)
install -m 644 $(addprefix run/$(CONFIG_DIR)/,$(LIBIMAGES_CONFIGS)) $(DESTDIR)$(INSTALL_CONFIG_DIR)
+ifdef CONFIG_STATIC_PIC
+ install -m 644 run/lib/libimages-pic.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR)
+endif
.PHONY: install-libimages
libdir=@LIBDIR@
incdir=.
+# Override if you want to use the -pic version
+picsuffix=
+
Name: libimages
Description: Sherlock image library
Version: @UCW_VERSION@
Cflags: -I${incdir}
-Libs: -L${libdir} -limages -lm -lpthread @LIBIMAGES_LIBS@
+Libs: -L${libdir} -limages${picsuffix} -lm -lpthread @LIBIMAGES_LIBS@
Requires: @DEPS@
LIBSHXML_MOD_PATHS=$(addprefix $(o)/shxml/,$(LIBSHXML_MODS))
$(o)/shxml/libshxml.a: $(addsuffix .o,$(LIBSHXML_MOD_PATHS))
+$(o)/shxml/libshxml-pic.a: $(addsuffix .oo,$(LIBSHXML_MOD_PATHS))
$(o)/shxml/libshxml.so: $(addsuffix .oo,$(LIBSHXML_MOD_PATHS))
$(o)/shxml/libshxml.pc: $(LIBCHARSET)
+ifdef CONFIG_STATIC_PIC
+$(o)/shxml/libshxml.pc: $(o)/shxml/libshxml-pic.a
+endif
+
$(o)/shxml/common.o: $(o)/shxml/unicat.h
$(o)/shxml/common.oo: $(o)/shxml/unicat.h
$(o)/shxml/source.o: $(o)/shxml/unicat.h
install -m 644 $(addprefix run/include/shxml/,$(LIBSHXML_INCLUDES)) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/shxml
install -m 644 run/lib/pkgconfig/libshxml.pc $(DESTDIR)$(INSTALL_PKGCONFIG_DIR)
install -m 644 run/lib/libshxml.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR)
+ifdef CONFIG_STATIC_PIC
+ install -m 644 run/lib/libshxml-pic.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR)
+endif
.PHONY: install-sh-xml
libdir=@LIBDIR@
incdir=.
+# Override if you want to use the -pic version
+picsuffix=
+
Name: libshxml
Description: XML parser for Sherlock project
Version: @UCW_VERSION@
Cflags: -I${incdir}
-Libs: -L${libdir} -lshxml
+Libs: -L${libdir} -lshxml${picsuffix}
Requires: @DEPS@
$(o)/ucw/libucw-pic.a: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
$(o)/ucw/libucw.so: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
+ifdef CONFIG_STATIC_PIC
+$(o)/ucw/libucw.pc: $(o)/ucw/libucw-pic.a
+endif
+
$(o)/ucw/hashfunc.o $(o)/ucw/hashfunc.oo: CFLAGS += -funroll-loops
$(o)/ucw/lizard.o: CFLAGS += $(COPT2) -funroll-loops
install -m 644 $(addprefix run/include/ucw/,$(LIBUCW_MAIN_INCLUDES) autoconf.h config.h) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/
install -m 644 run/lib/pkgconfig/libucw.pc $(DESTDIR)$(INSTALL_PKGCONFIG_DIR)
install -m 644 run/lib/libucw.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR)
+ifdef CONFIG_STATIC_PIC
+ install -m 644 run/lib/libucw-pic.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR)
+endif
install -m 644 run/$(CONFIG_DIR)/libucw $(DESTDIR)$(INSTALL_CONFIG_DIR)
.PHONY: install-libucw
# Use shared libraries
UnSet("CONFIG_SHARED");
+# In addition to normal static libraries, generate also static libraries
+# with PIC code (libucw-pic.a and friends).
+UnSet("CONFIG_STATIC_PIC");
+
# If your system can't reset getopt with 'optind = 0', you need to compile our internal copy
# of GNU libc's getopt. This should not be necessary on GNU libc.
UnSet("CONFIG_OWN_GETOPT");
regex=
#endif
+# Override if you want to use the -pic version
+picsuffix=
+
perl_modules_dir=@INSTALL_PERL_DIR@
perl_module_flags=-I${perl_modules_dir}
build_system=@INSTALL_SHARE_DIR@/ucw/build
Description: A library of utility functions and data structures
Version: @UCW_VERSION@
Cflags: -I${incdir}
-Libs: -L${libdir} -lucw ${threads} ${regex}
+Libs: -L${libdir} -lucw${picsuffix} ${threads} ${regex}