diff --git a/config/programs.m4 b/config/programs.m4 index 42104de91c..04e67e68a9 100644 --- a/config/programs.m4 +++ b/config/programs.m4 @@ -1,4 +1,4 @@ -# $Header: /cvsroot/pgsql/config/programs.m4,v 1.8 2002/03/29 17:32:54 petere Exp $ +# $Header: /cvsroot/pgsql/config/programs.m4,v 1.9 2002/04/10 16:45:24 petere Exp $ # PGAC_PATH_FLEX @@ -144,3 +144,28 @@ dnl FIXME: We should probably check for version >=0.10.36. AC_DEFINE_UNQUOTED(LOCALEDIR, ["$exp_localedir"], [location of locale files]) ])# PGAC_CHECK_GETTEXT + + + +# PGAC_CHECK_STRIP +# ---------------- +# Check for a 'strip' program, and figure out if that program can +# strip libraries. + +AC_DEFUN([PGAC_CHECK_STRIP], +[ + AC_CHECK_TOOL(STRIP, strip, :) + + AC_MSG_CHECKING([whether it is possible to strip libraries]) + if test x"$STRIP" != x"" && "$STRIP" -V 2>&1 | grep "GNU strip" >/dev/null; then + STRIP_STATIC_LIB="$STRIP -x" + STRIP_SHARED_LIB="$STRIP --strip-unneeded" + AC_MSG_RESULT(yes) + else + STRIP_STATIC_LIB=: + STRIP_SHARED_LIB=: + AC_MSG_RESULT(no) + fi + AC_SUBST(STRIP_STATIC_LIB) + AC_SUBST(STRIP_SHARED_LIB) +])# PGAC_CHECK_STRIP diff --git a/configure b/configure index 01c0a9d946..4e312afadc 100755 --- a/configure +++ b/configure @@ -4668,6 +4668,104 @@ echo "${ECHO_T}no" >&6 fi + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + + + echo "$as_me:$LINENO: checking whether it is possible to strip libraries" >&5 +echo $ECHO_N "checking whether it is possible to strip libraries... $ECHO_C" >&6 + if test x"$STRIP" != x"" && "$STRIP" -V 2>&1 | grep "GNU strip" >/dev/null; then + STRIP_STATIC_LIB="$STRIP -x" + STRIP_SHARED_LIB="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + STRIP_STATIC_LIB=: + STRIP_SHARED_LIB=: + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + + + + for ac_prog in 'bison -y' do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -16740,6 +16838,10 @@ s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@LORDER@,$LORDER,;t t s,@TAR@,$TAR,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@STRIP_STATIC_LIB@,$STRIP_STATIC_LIB,;t t +s,@STRIP_SHARED_LIB@,$STRIP_SHARED_LIB,;t t s,@YACC@,$YACC,;t t s,@YFLAGS@,$YFLAGS,;t t s,@WISH@,$WISH,;t t diff --git a/configure.in b/configure.in index 7fbf76e32b..c2a8641d7b 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -dnl $Header: /cvsroot/pgsql/configure.in,v 1.175 2002/04/03 05:39:27 petere Exp $ +dnl $Header: /cvsroot/pgsql/configure.in,v 1.176 2002/04/10 16:45:24 petere Exp $ dnl Developers, please strive to achieve this order: dnl @@ -640,6 +640,7 @@ esac AC_PROG_RANLIB AC_CHECK_PROGS(LORDER, lorder) AC_PATH_PROG(TAR, tar) +PGAC_CHECK_STRIP AC_CHECK_PROGS(YACC, ['bison -y']) if test -z "$YACC"; then diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index e5f9de741a..11e4b92368 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -1,4 +1,4 @@ - + <![%standalone-include[<productname>PostgreSQL</>]]> @@ -983,6 +983,19 @@ All of PostgreSQL is successfully made. Ready to install. be granted. </para> + <para> + You can use <literal>gmake install-strip</literal> instead of + <literal>gmake install</literal> to strip the executable files and + libraries as they are installed. This will save some space. If + you built with debugging support, stripping will effectively + remove the debugging support, so it should only be done if + debugging is no longer needed. <literal>install-strip</literal> + tries to do a reasonable job saving space, but it does not have + perfect knowledge of how to strip every unneeded byte from an + executable file, so if you want to save all the disk space you + possibly can, you will have to do manual work. + </para> + <para> If you built the Perl or Python interfaces and you were not the root user when you executed the above command then that part of diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 361ff04d2f..f7feda8366 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -1,5 +1,5 @@ # -*-makefile-*- -# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.144 2002/03/29 17:32:54 petere Exp $ +# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.145 2002/04/10 16:45:25 petere Exp $ #------------------------------------------------------------------------------ # All PostgreSQL makefiles include this file and use the variables it sets, @@ -18,7 +18,7 @@ # # Meta configuration -.PHONY: all install installdirs uninstall clean distclean maintainer-clean distprep check installcheck maintainer-check +.PHONY: all install install-strip installdirs uninstall clean distclean maintainer-clean distprep check installcheck maintainer-check .SILENT: installdirs # make `all' the default target @@ -228,16 +228,21 @@ BZIP2 = bzip2 INSTALL = $(SHELL) $(top_srcdir)/config/install-sh -c -INSTALL_PROGRAM = $(INSTALL) +INSTALL_PROGRAM = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG) INSTALL_SCRIPT = $(INSTALL) -m 755 INSTALL_DATA = $(INSTALL) -m 644 -INSTALL_SHLIB = $(INSTALL) $(INSTALL_SHLIB_OPTS) +INSTALL_STLIB = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG) +INSTALL_SHLIB = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG) # Override in Makefile.port if necessary INSTALL_SHLIB_OPTS = -m 755 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs missing = $(SHELL) $(top_srcdir)/config/missing +STRIP = @STRIP@ +STRIP_STATIC_LIB = @STRIP_STATIC_LIB@ +STRIP_SHARED_LIB = @STRIP_SHARED_LIB@ + # Documentation JADE = @JADE@ @@ -384,6 +389,14 @@ $(top_builddir)/config.status: $(top_srcdir)/configure cd $(top_builddir) && ./config.status --recheck +install-strip: + @$(MAKE) INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \ + INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \ + INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \ + INSTALL_STRIP_FLAG=-s \ + install + + ########################################################################## # # Automatic dependency generation diff --git a/src/Makefile.shlib b/src/Makefile.shlib index 2496ad9914..9a4ee4b50e 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -6,7 +6,7 @@ # Copyright (c) 1998, Regents of the University of California # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.56 2001/11/11 19:20:53 momjian Exp $ +# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.57 2002/04/10 16:45:25 petere Exp $ # #------------------------------------------------------------------------- @@ -357,7 +357,7 @@ endif # enable_shared install-lib: install-lib-static install-lib-shared install-lib-static: lib$(NAME).a - $(INSTALL_DATA) $< $(DESTDIR)$(libdir)/lib$(NAME).a + $(INSTALL_STLIB) $< $(DESTDIR)$(libdir)/lib$(NAME).a ifeq ($(enable_shared), yes) install-lib-shared: $(shlib)