From dea84b1a0b92c59219484ba209107de0ad27aeb6 Mon Sep 17 00:00:00 2001 From: Brian Havard Date: Mon, 2 Apr 2001 15:20:45 +0000 Subject: [PATCH] Switch to using aplibtool for building under OS/2 & add support for building loadable modules as OS/2 DLLs. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88645 13f79535-47bb-0310-9956-ffa450edef68 --- Makefile.in | 4 +++- acinclude.m4 | 4 ++++ build/rules.mk | 13 +++++++++---- configure.in | 23 +++++++++++++++++++++-- os/os2/config.m4 | 1 - os/os2/core.mk | 7 +++++++ os/os2/core_header.def | 11 +++++++++++ server/Makefile.in | 9 +++++++-- 8 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 os/os2/core.mk create mode 100644 os/os2/core_header.def diff --git a/Makefile.in b/Makefile.in index 33e6822b1d..693b463b7f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,5 @@ -SUBDIRS = srclib modules os server support +SUBDIRS = srclib os server modules support PROGRAM_NAME = $(progname) PROGRAM_SOURCES = modules.c @@ -126,3 +126,5 @@ install-suexec: suexec: cd support && make suexec + +include $(top_srcdir)/os/os2/core.mk diff --git a/acinclude.m4 b/acinclude.m4 index ecb2b35080..352605f458 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -86,6 +86,10 @@ AC_DEFUN(APACHE_GEN_CONFIG_VARS,[ APACHE_SUBST(PORT) APACHE_SUBST(NOTEST_CFLAGS) APACHE_SUBST(NOTEST_LDFLAGS) + APACHE_SUBST(CORE_IMPLIB_FILE) + APACHE_SUBST(CORE_IMPLIB) + APACHE_SUBST(SH_LIBTOOL) + APACHE_SUBST(MK_IMPLIB) abs_srcdir="`(cd $srcdir && pwd)`" diff --git a/build/rules.mk b/build/rules.mk index 9d05a727e7..5c909180be 100644 --- a/build/rules.mk +++ b/build/rules.mk @@ -71,14 +71,13 @@ LT_CXX_COMPILE = $(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $< && touch $@ # Link-related commands LINK = $(LIBTOOL) --mode=link $(COMPILE) $(LTFLAGS) $(LDFLAGS) $(NOTEST_LDFLAGS) -o $@ -SH_LINK = $(SH_LIBTOOL) --mode=link $(COMPILE) $(LTFLAGS) $(LDFLAGS) $(NOTEST_LDFLAGS) -o $@ +SH_LINK = $(SH_LIBTOOL) --mode=link $(COMPILE) $(LTFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(NOTEST_LDFLAGS) $(CORE_IMPLIB) -o $@ MOD_LINK = $(LIBTOOL) --mode=link $(COMPILE) -module $(LTFLAGS) $(LDFLAGS) $(NOTEST_LDFLAGS) -o $@ # Cross compile commands # Helper programs -SH_LIBTOOL = $(SHELL) $(top_builddir)/shlibtool --silent MKINSTALLDIRS = $(abs_srcdir)/build/mkdir.sh INSTALL = $(abs_srcdir)/build/install.sh -c INSTALL_DATA = $(INSTALL) -m 644 @@ -92,7 +91,7 @@ CXX_SUFFIX = cpp SHLIB_SUFFIX = so .SUFFIXES: -.SUFFIXES: .S .c .$(CXX_SUFFIX) .lo .o .s .y .l .slo +.SUFFIXES: .S .c .$(CXX_SUFFIX) .lo .o .s .y .l .slo .def .la .c.o: $(COMPILE) -c $< @@ -128,6 +127,12 @@ SHLIB_SUFFIX = so all: all-recursive install: install-recursive + +# Makes an import library from a def file +.def.la: + $(LIBTOOL) --mode=compile $(MK_IMPLIB) -o $@ $< + + # if we are doing a distclean, we actually want to hit every # directory that has ever been configured. To do this, we just do a quick # find for all the leftover Makefiles, and then run make distclean in those @@ -184,7 +189,7 @@ depend: depend-recursive clean: clean-recursive clean-x clean-x: - rm -f $(targets) *.slo *.lo *.la *.o $(CLEAN_TARGETS) + rm -f $(targets) *.slo *.lo *.la *.o *.obj $(CLEAN_TARGETS) rm -rf .libs distclean: distclean-recursive clean-x diff --git a/configure.in b/configure.in index acab1b4395..0f71a88191 100644 --- a/configure.in +++ b/configure.in @@ -41,6 +41,23 @@ fi AC_CANONICAL_SYSTEM +case "$host_alias" in + *os2*) + # Use a custom made libtool replacement + echo "using aplibtool" + LIBTOOL="$abs_srcdir/srclib/apr/build/aplibtool" + SH_LIBTOOL="$LIBTOOL --shared --export-all" + CORE_IMPLIB_FILE="ApacheCoreOS2.la" + CORE_IMPLIB="$abs_srcdir/server/$CORE_IMPLIB_FILE" + MK_IMPLIB="emximp" + SHMOD_EXPORT_EXT="def" + other_targets="$other_targets os2core" + ;; + *) + SH_LIBTOOL='$(SHELL) $(top_builddir)/shlibtool --silent' + ;; +esac + dnl dnl ## Preload our OS configuration APR_PRELOAD @@ -158,8 +175,10 @@ APACHE_SUBST(OS_DIR) APACHE_SUBST(BUILTIN_LIBS) AM_DISABLE_SHARED -AM_PROG_LIBTOOL -APACHE_LIBTOOL_SILENT +if test -z "$LIBTOOL"; then + AM_PROG_LIBTOOL + APACHE_LIBTOOL_SILENT +fi if test "$apache_need_shared" = "yes"; then $SHELL $ac_aux_dir/ltconfig --output=shlibtool --disable-static --srcdir=$ac_aux_dir --cache-file=./config.cache $ac_aux_dir/ltmain.sh diff --git a/os/os2/config.m4 b/os/os2/config.m4 index d6bab02dd4..81a6811a3c 100644 --- a/os/os2/config.m4 +++ b/os/os2/config.m4 @@ -1,4 +1,3 @@ if test "$OS" = "os2" ; then CFLAGS="$CFLAGS -DOS2 -O2" - LDFLAGS="$LDFLAGS -Zexe" fi diff --git a/os/os2/core.mk b/os/os2/core.mk new file mode 100644 index 0000000000..aac4356532 --- /dev/null +++ b/os/os2/core.mk @@ -0,0 +1,7 @@ +# Some rules for making a shared core dll on OS/2 + +os2core: httpd.dll $(CORE_IMPLIB) + $(LIBTOOL) --mode=link gcc $(EXTRA_LDFLAGS) -o httpd $(CORE_IMPLIB) + +httpd.dll: $(PROGRAM_DEPENDENCIES) $(CORE_IMPLIB) + $(LINK) -Zdll $(EXTRA_LDFLAGS) -s -o $@ server/exports.lo modules.lo $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) server/ApacheCoreOS2.def diff --git a/os/os2/core_header.def b/os/os2/core_header.def new file mode 100644 index 0000000000..85e02fbd85 --- /dev/null +++ b/os/os2/core_header.def @@ -0,0 +1,11 @@ +LIBRARY httpd INITINSTANCE +DESCRIPTION "Apache Server Core" +EXPORTS + "main" + "ap_my_generation" + "ap_restart_time" + "ap_extended_status" + "ap_scoreboard_image" + "ap_conftree" + "ap_server_root" + "ap_top_module" diff --git a/server/Makefile.in b/server/Makefile.in index 945fdbbfab..fd7af84383 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -1,7 +1,7 @@ TARGET_EXPORTS = apache.exports CLEAN_TARGETS = gen_test_char gen_uri_delims test_char.h uri_delims.h \ - $(TARGET_EXPORTS) + $(TARGET_EXPORTS) ApacheCoreOS2.def SUBDIRS = mpm @@ -15,7 +15,7 @@ LTLIBRARY_SOURCES = \ util_filter.c exports.c buildmark.c scoreboard.c \ error_bucket.c protocol.c core.c request.c -targets = delete-exports $(LTLIBRARY_NAME) +targets = delete-exports $(LTLIBRARY_NAME) $(CORE_IMPLIB_FILE) include $(top_srcdir)/build/rules.mk include $(top_srcdir)/build/library.mk @@ -59,3 +59,8 @@ exports.c: $(EXPORT_FILES) # wtf does this have to be explicit???? exports.lo: exports.c + +# Rule to make def file for OS/2 core dll +ApacheCoreOS2.def: exports.c $(top_srcdir)/os/$(OS_DIR)/core_header.def + cat $(top_srcdir)/os/$(OS_DIR)/core_header.def > $@ + $(CPP) $< $(COMMON_FLAGS) | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/ "\1"/' >> $@ -- 2.50.1