1) added more portability checks

2) use new dependency scheume
3) use autoheader

CVS patchset: 2026
CVS date: 1998/03/04 16:53:54
This commit is contained in:
ewt 1998-03-04 16:53:54 +00:00
parent 0f2c5851da
commit 179e9c159a
8 changed files with 257 additions and 150 deletions

View File

@ -25,6 +25,7 @@ Significant code, ideas, or porting help have been contributed by:
Jared Mauch
Nigel Metheringham
Horacio Rodriguez Montero
Tim Mooney
Eric Mumpower
Michael Nyquisk
Steve Sanbeg

View File

@ -1,6 +1,7 @@
include Makefile.inc
srcdir= @srcdir@
top_srcdir= @top_srcdir@
INSTALL= @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -19,7 +20,6 @@ CVSTAG = r$(subst .,-,$(VERSION))
### These are variables meant to be exported
VPATH = $(srcdir)
WARNINGS = -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes
BINDIR=$(prefix)/bin
RPMBINDIR=$(subst usr/bin,bin,$(BINDIR))
@ -31,6 +31,7 @@ ETCDIR=$(ROOT)/etc
# -----------------------------------------------------------------------
SUBDIRS = popt @MISCDIR@ lib build tools @PO@
ALLSUBDIRS = popt misc lib build tools po
INSTSUBDIRS = lib @PO@
OTHERSUBDIRS = docs autodeps
OBJS = rpm.o query.o install.o verify.o checksig.o ftp.o url.o build.o \
@ -41,16 +42,16 @@ LOADLIBES = -lrpmbuild -lpopt -lrpm @LIBMISC@
SOURCES = $(subst .o,.c,$(OBJS))
ifeq (.depend,$(wildcard .depend))
ifeq (.depend-done,$(wildcard .depend-done))
TARGET=everything
else
TARGET=depend everything
TARGET=@TARGET@
endif
all: $(TARGET)
rpm: lib/librpm.a build/librpmbuild.a @MISCPATH@ $(OBJS)
$(CC) -o rpm -static $(OBJS) $(LDFLAGS) $(LOADLIBES) $(LIBS) \
$(CC) -o rpm $(LDFLAGS_STATIC) $(OBJS) $(LDFLAGS) $(LOADLIBES) $(LIBS) \
$(LIBEFENCE)
rpm.shared: lib/librpm.a build/librpmbuild.a $(OBJS)
@ -113,19 +114,21 @@ install: all
[ -d $(installprefix)/$(ETCDIR) ] || mkdir -p $(installprefix)/$(ETCDIR)
[ -d $(installprefix)/$(LIBDIR) ] || mkdir -p $(installprefix)/$(LIBDIR)
[ -d $(installprefix)/$(INCDIR) ] || mkdir -p $(installprefix)/$(INCDIR)
[ -d $(installprefix)/$(RPMCONFIGDIR) ] || \
mkdir -p $(installprefix)/$(INCDIR)
if [ -x ./rpm ]; then \
$(INSTALL) -s -m 755 rpm $(installprefix)/$(RPMBINDIR); \
$(INSTALL_PROGRAM) -s -m 755 rpm $(installprefix)/$(RPMBINDIR); \
else \
$(INSTALL) -s -m 755 rpm.shared $(installprefix)/$(RPMBINDIR)/rpm; \
$(INSTALL_PROGRAM) -s -m 755 rpm.shared $(installprefix)/$(RPMBINDIR)/rpm; \
fi
$(INSTALL) -m 755 $(srcdir)/gendiff $(installprefix)/$(BINDIR)
$(INSTALL) -m 755 $(topdir)/find-provides.sh $(installprefix)/$(BINDIR)/find-provides
$(INSTALL) -m 755 $(topdir)/find-requires.sh $(installprefix)/$(BINDIR)/find-requires
$(INSTALL) -s -m 755 rpm2cpio $(installprefix)/$(BINDIR)
$(INSTALL) -m 644 $(srcdir)/rpm.8 $(installprefix)/$(MANDIR)
$(INSTALL) -m 644 $(srcdir)/rpm2cpio.8 $(installprefix)/$(MANDIR)
$(INSTALL) -m 644 $(topdir)/lib-rpmrc $(installprefix)/$(LIBDIR)/rpmrc
$(INSTALL) -m 644 $(srcdir)/rpmpopt $(installprefix)/$(LIBDIR)/rpmpopt
$(INSTALL_PROGRAM) -m 755 $(srcdir)/gendiff $(installprefix)/$(BINDIR)
$(INSTALL_PROGRAM) -m 755 $(topdir)/find-provides.sh $(installprefix)/$(BINDIR)/find-provides
$(INSTALL_PROGRAM) -m 755 $(topdir)/find-requires.sh $(installprefix)/$(BINDIR)/find-requires
$(INSTALL_PROGRAM) -s -m 755 rpm2cpio $(installprefix)/$(BINDIR)
$(INSTALL_DATA) -m 644 $(srcdir)/rpm.8 $(installprefix)/$(MANDIR)
$(INSTALL_DATA) -m 644 $(srcdir)/rpm2cpio.8 $(installprefix)/$(MANDIR)
$(INSTALL_DATA) -m 644 $(topdir)/lib-rpmrc $(installprefix)/$(LIBDIR)/rpmrc
$(INSTALL_DATA) -m 644 $(srcdir)/rpmpopt $(installprefix)/$(LIBDIR)/rpmpopt
(cd lib; $(MAKE) LIBDIR=$(installprefix)/$(LIBDIR) INCDIR=$(installprefix)/$(INCDIR) install)
for d in $(INSTSUBDIRS); do \
(cd $$d; $(MAKE) installprefix=$(installprefix) LIBDIR=$(installprefix)/$(LIBDIR) INCDIR=$(installprefix)/$(INCDIR) install) ;\
@ -148,7 +151,7 @@ tar:
.PHONY: clean
clean:
for d in $(SUBDIRS); do \
for d in $(ALLSUBDIRS); do \
(cd $$d; $(MAKE) $@) ;\
done
rm -f *.a *.o core *~ $(PROGS) rpm.shared
@ -157,19 +160,23 @@ clean:
.PHONY: distclean
distclean:
for d in $(SUBDIRS); do \
for d in $(ALLSUBDIRS); do \
(cd $$d; $(MAKE) $@) ;\
done
rm -f *.a *.o core *~ $(PROGS) rpm.shared librpmrc find-provides.sh find-requires.sh
rm -f .depend Makefile Makefile.inc config.h config.cache config.status config.log lib-rpmrc
rm -f .depend-done Makefile Makefile.inc config.h config.cache
rm -f config.status config.log lib-rpmrc
.PHONY: depend
depend:
$(CPP) $(CFLAGS) -M $(srcdir)/$(SOURCES) > .depend
for d in $(SUBDIRS); do \
topdir_path=`( cd $(top_srcdir) && pwd )` ; \
$(CPP) -MM $(CFLAGS) $(srcdir)/$(SOURCES) | \
sed s+$$topdir_path+$(top_srcdir)+g > .depend ; \
for d in $(ALLSUBDIRS); do \
(cd $$d; $(MAKE) $@) ;\
done
echo > .depend-done
.PHONY: noconfig
noconfig:
@ -189,10 +196,7 @@ archive:
@cd /tmp; cvs export -r$(CVSTAG) rpm
@mv /tmp/rpm /tmp/rpm-$(VERSION)
@rm /tmp/rpm-$(VERSION)/popt/popt.spec
@cd /tmp/rpm-$(VERSION); \
autoconf
@cd /tmp/rpm-$(VERSION)/popt; \
autoconf
@./autogen.sh --noconfigure
@cd /tmp; tar czSpf rpm-$(VERSION).tar.gz rpm-$(VERSION)
@rm -rf /tmp/rpm-$(VERSION)
@cp /tmp/rpm-$(VERSION).tar.gz .

View File

@ -3,17 +3,18 @@ topsrcdir=@topsrcdir@
CPP = @CPP@
prefix= @prefix@
exec_prefix = @exec_prefix@
libdir= $(prefix)/lib
libdir= @libdir@
AR = ar
RANLIB = @RANLIB@
OPTS = @DEFS@
LIBRPMRC_FILENAME=$(libdir)/rpmrc
LIBRPMALIAS_FILENAME=$(libdir)/rpmpopt
RPMCONFIGDIR=@RPMCONFIGDIR@
LIBRPMRC_FILENAME==$(RPMCONFIGDIR)/rpmrc
LIBRPMALIAS_FILENAME=$(RPMCONFIGDIR)/rpmpopt
RPMNLSDIR=@datadir@/locale
RPMNLSPACKAGE=rpm
CFLAGS = @CFLAGS@ @INCPATH@ $(WARNINGS) $(OPTS) -I$(topdir) -I$(topsrcdir)\
-I$(topsrcdir)/lib -I$(topsrcdir)/misc -Wall -Wstrict-prototypes
CFLAGS = -I$(topdir) -I$(topsrcdir) @CFLAGS@ @INCPATH@ $(OPTS) \
-I$(topsrcdir)/lib -I$(topsrcdir)/misc
LDFLAGS = @LDFLAGS@ -L$(topdir)/lib -L$(topdir)/build -L$(topdir)/misc \
-L$(topdir)/popt
VERSION = 2.4.103

51
acconfig.h Normal file
View File

@ -0,0 +1,51 @@
/* Define as 1 if you have inet_aton() */
#undef HAVE_INET_ATON
/* Define as 1 if you have mntctl() (only aix?) */
#undef HAVE_MNTCTL
/* Define as 1 if your system provides realpath() */
#undef HAVE_REALPATH
/* Define as 1 if <netdb.h> defines h_errno */
#undef HAVE_HERRNO
/* Define as 1 if <sys/stat.h> defines S_ISLNK */
#undef HAVE_S_ISLNK
/* Define as 1 if <sys/stat.h> defines S_IFSOCK */
#undef HAVE_S_IFSOCK
/* Define as 1 if <sys/stat.h> defines S_ISSOCK */
#undef HAVE_S_ISSOCK
/* Define as 1 if we need timezone */
#undef NEED_TIMEZONE
/* Define as 1 if we need myrealloc */
#undef NEED_MYREALLOC
/* Define as one if we need to include <strings.h> (along with <string.h>) */
#undef NEED_STRINGS_H
/* Define as 1 if you have getmntinfo_r() (only osf?) */
#undef HAVE_GETMNTINFO_R
/* Define as 1 if you have "struct mnttab" (only sco?) */
#undef HAVE_STRUCT_MNTTAB
/* Define as 1 if you have lchown() */
#undef HAVE_LCHOWN
/* Define as 1 if chown() follows symlinks and you don't have lchown() */
#undef CHOWN_FOLLOWS_SYMLINK
/* Define if the patch call you'll be using is 2.1 or older */
#undef HAVE_OLDPATCH_21
/* A full path to a program, possibly with arguments, that will create a
directory and all necessary parent directories, ala `mkdir -p' */
#undef MKDIR_P
/* define this to be whatever root's primary group is, in double quotes */
#undef ROOT_GROUP

15
autogen.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
autoheader
autoconf
(cd popt; autoconf)
if [ "$1" = "--noconfigure" ]; then
exit 0;
fi
if [ -z "$@" ]; then
./configure --prefix=/usr
else
./configure "$@"
fi

View File

@ -1,105 +0,0 @@
#ifndef H_CONFIG
#define H_CONFIG
/* Define as 1 if you have ANSI headers */
#define STDC_HEADERS 0
/* Define as 1 if you have <netinet/in_systm.h> */
#define HAVE_NETINET_IN_SYSTM_H 0
/* Define as 1 if you have <alloca.h> */
#define HAVE_ALLOCA_H 0
/* Define as 1 if you have <dirent.h> */
#define HAVE_DIRENT_H 0
/* Define as 1 if you have <limits.h> */
#define HAVE_LIMITS_H 0
/* Define as 1 if you have <machine/types.h> */
#define HAVE_MACHINE_TYPES_H 0
/* Define as 1 if you have <sys/socket.h> */
#define HAVE_SYS_SOCKET_H 0
/* Define as 1 if you have <glob.h> */
#define HAVE_GLOB_H 0
/* Define as 1 if you have <fnmatch.h> */
#define HAVE_FNMATCH_H 0
/* Define as 1 if you have <libintl.h.h> */
#define HAVE_LIBINTL_H 0
/* Define as 1 if <string.h> defines h_errno */
#define HAVE_STRING_H 0
/* Define as 1 if your system provides realpath() */
#define HAVE_REALPATH 0
/* Define as 1 if <netdb.h> defines h_errno */
#define HAVE_HERRNO 0
/* Define as 1 if <sys/stat.h> defines S_ISLNK */
#define HAVE_S_ISLNK 0
/* Define as 1 if <sys/stat.h> defines S_IFSOCK */
#define HAVE_S_IFSOCK 0
/* Define as 1 if <sys/stat.h> defines S_ISSOCK */
#define HAVE_S_ISSOCK 0
/* Define as 1 if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#define WORDS_BIGENDIAN 0
/* Define as one if we need to include <strings.h> (along with <string.h>) */
#define NEED_STRINGS_H 0
/* Define as one if major, minor, and makedev macros are in <sys/sysmacros.h> */
#define MAJOR_IN_SYSMACROS 0
/* Define as one if major, minor, and makedev macros are in <sys/mkdev.h> */
#define MAJOR_IN_MKDEV 0
/* Define as 1 if we need timezone */
#define NEED_TIMEZONE 0
/* Define as 1 if we need myrealloc */
#define NEED_MYREALLOC 0
/* Define as 1 if chown() follows symlinks and you don't have lchown() */
#define CHOWN_FOLLOWS_SYMLINK 0
/* Define as 1 if you have <sys/select.h> */
#define HAVE_SYS_SELECT_H 0
/* Define as 1 if you have lchown() */
#define HAVE_LCHOWN 0
/* Define as 1 if you have <mntent.h> */
#define HAVE_MNTENT_H 0
/* Define as 1 if you have <sys/mnttab.h> */
#define HAVE_SYS_MNTTAB_H 0
/* Define as 1 if you have getmntent(), you'll also need one of the above
two defined */
#define HAVE_GETMNTENT 0
/* Define as 1 if you have mntctl() (only aix?) */
#define HAVE_MNTCTL 0
/* Define as 1 if you have "struct mnttab" (only sco?) */
#define HAVE_STRUCT_MNTTAB 0
/* Define as 1 if you have getmntinfo_r() (only osf?) */
#define HAVE_GETMNTINFO_R 0
/* Define as 1 if you have <sys/sysconfig.h> (only aix?) */
#define HAVE_SYS_SYSTEMCFG_H 0
/* Define if the patch call you'll be using is 2.1 or older */
#define HAVE_OLDPATCH_21 0
#endif

View File

@ -17,12 +17,73 @@ MISCOBJS=
AC_CANONICAL_SYSTEM
RPMCONFIGDIR='$(libdir)'
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
dnl
dnl if CC is gcc, we can rebuild the dependencies (since the depend rule
dnl requires gcc). If it's not, don't rebuild dependencies -- use what was
dnl shipped with RPM.
dnl
if test X"$GCC" = Xyes ; then
TARGET="depend everything"
else
TARGET="everything"
#
# let the top level Makefile know that we're done with `depend'
#
echo > .depend-done
fi
AC_SUBST(TARGET)
dnl
dnl This is a quick hack, to make it so that we can statically link the
dnl rpm binary on as many platforms as possible.
dnl
dnl a *much* better solution would be to use libtool to determine the proper
dnl way to statically link on your platform.
dnl
AC_MSG_CHECKING(what additional CFLAGS are needed to link statically)
if test X"$GCC" = Xyes ; then
case "$target" in
*-*-hpux*) CFLAGS_STATIC="-Wl,-a,archive_shared";; #works better
*-*-*) CFLAGS_STATIC="-static";;
esac
elif test X"$CC" = Xcc ; then
case "$target" in
*-*-linux*) CFLAGS_STATIC="-static";;
*-*-freebsd*) CFLAGS_STATIC="-static";;
*-*-osf*) CFLAGS_STATIC="-non_shared";;
*-*-aix*) CFLAGS_STATIC="";; # -Wl,-bnso doesn't seem to work...
*-*-hpux*) CFLAGS_STATIC="-Wl,-a,archive_shared";;
*-*-solaris*) CFLAGS_STATIC="-B static";;
*-*-irix*) CFLAGS_STATIC="";; #should be -non_shared, but can't
# link because of crt1.o then.
*-*-ultrix*) CFLAGS_STATIC="";; #ultrix doesn't have shared libs.
*-*-*) CFLAGS_STATIC=""
AC_MSG_WARN([
Unable to guess what option to pass to $CC to generate a static
executable. You will need to set the CFLAGS_STATIC macro in Makefile.inc to
the appropriate argument(s) if you want to build a static rpm executable.
])
;;
esac
else
# a shot in the dark...
CFLAGS_STATIC="-static"
fi
AC_MSG_RESULT($CFLAGS_STATIC)
AC_SUBST(CFLAGS_STATIC)
AC_MSG_CHECKING(POSIX chmod...)
touch foo.chmodtest
chmod 744 foo.chmodtest
@ -37,6 +98,45 @@ else
FIXPERMS=a+r,g-w,o-w
fi
dnl
dnl see if we have a mkdir that supports `-p'.
dnl
AC_PATH_PROGS(MKDIR, mkdir, mkdir)
AC_MSG_CHECKING(if $MKDIR supports -p)
rm -rf conftest
$MKDIR -p conftest/a 2>/dev/null
if test $? = 0 ; then
rmdir conftest/a 2>/dev/null
if test $? = 0 ; then
:
else
MKDIR_P=0
fi
rmdir conftest 2>/dev/null
if test $? = 0 ; then
MKDIR_P="$MKDIR -p"
else
MKDIR_P=0
fi
else
MKDIR_P=0
fi
if test X"$MKDIR_P" = X0 ; then
AC_MSG_RESULT(no)
AC_PATH_PROGS(MKDIRHIER, mkdirhier, mkdirhier)
MKDIR_P="$MKDIRHIER"
else
AC_MSG_RESULT(yes)
fi
dnl
dnl substitute this into config.h, so the C source picks it up.
dnl
AC_DEFINE_UNQUOTED(MKDIR_P, "${MKDIR_P}")
AC_AIX
AC_MINIX
AC_ISC_POSIX
@ -217,7 +317,9 @@ AC_HEADER_MAJOR
AC_CHECK_HEADERS(netinet/in_systm.h limits.h)
AC_CHECK_HEADERS(alloca.h dirent.h sys/socket.h sys/select.h)
AC_CHECK_HEADERS(machine/types.h string.h)
AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h unistd.h)
AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/vmount.h)
AC_CHECK_HEADERS(glob.h,,MISCOBJS="$MISCOBJS glob.o")
AC_CHECK_HEADERS(fnmatch.h,,MISCOBJS="$MISCOBJS fnmatch.o")
@ -266,10 +368,6 @@ fi
AC_MSG_CHECKING(if timezone is defined...)
AC_TRY_LINK([#include <time.h>],printf("%ld", timezone),
HAS_TIMEZONE=yes,HAS_TIMEZONE=no)
AC_MSG_RESULT($HAS_TIMEZONE)
if test $HAS_TIMEZONE = no; then
AC_DEFINE(NEED_TIMEZONE)
fi
dnl Checks for library functions.
AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON), MISCOBJS="$MISCOBJS inet_aton.o")
@ -283,6 +381,7 @@ AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT), [
AC_CHECK_FUNC(strerror, [], MISCOBJS="$MISCOBJS strerror.o")
AC_CHECK_FUNC(strtol, [], MISCOBJS="$MISCOBJS strtol.o")
AC_CHECK_FUNC(strtoul, [], MISCOBJS="$MISCOBJS strtoul.o")
AC_CHECK_FUNC(strdup, [], MISCOBJS="$MISCOBJS strdup.o")
LCHOWN=no
AC_CHECK_FUNC(lchown, [LCHOWN=yes; AC_DEFINE(HAVE_LCHOWN)])
@ -298,7 +397,7 @@ if test "$LCHOWN" = no; then
result=no
fi
if test $result = unknown; then
if test `id | cut -f 2 -d \= | cut -f 1 -d \(` = 0; then
if test `id | cut -f2 -d\= | cut -f1 -d\(` = 0; then
rm -f foo bar
touch foo
ln -s foo bar
@ -321,6 +420,44 @@ if test "$LCHOWN" = no; then
fi
fi
dnl
dnl figure out what root's primary group is
dnl
AC_MSG_CHECKING(root's primary group)
AC_TRY_RUN([#include <stdio.h>
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
int main()
{
struct passwd *root = NULL;
struct group *roots_group = NULL;
FILE * tempfile = NULL;
root = getpwuid( (uid_t) 0 );
if (root != NULL) {
roots_group = getgrgid(root->pw_gid);
if (roots_group != NULL) {
tempfile = fopen("conftest_rootg", "w");
if (tempfile != NULL) {
fprintf(tempfile, "%s\n", roots_group->gr_name);
fclose(tempfile);
exit(0);
}
}
}
exit(1);
}], ROOT_GROUP=`cat conftest_rootg`,
ROOT_GROUP="root",ROOT_GROUP="root"
)
AC_DEFINE_UNQUOTED(ROOT_GROUP, "$ROOT_GROUP")
AC_MSG_RESULT($ROOT_GROUP)
AC_SUBST(ROOT_GROUP)
if test "x$varprefix" = "x"; then
varprefix=`echo $prefix | sed 's/usr/var/'`
test "x$prefix" = xNONE && varprefix=`echo $ac_default_prefix | sed 's/usr/var/'`
@ -363,11 +500,16 @@ elif echo "$build_os" | grep sunos > /dev/null; then
AC_DEFINE(NEED_MYREALLOC)
MISCOBJS="$MISCOBJS myrealloc.o"
elif echo "$build_os" | grep hpux > /dev/null; then
RPM=rpm.shared
#RPM=rpm.shared
RPM=rpm
LIBDL=-ldld
echo "hacking things up for hpux"
elif echo "$build_os" | grep irix > /dev/null; then
RPM=rpm.shared
echo "hacking things up for irix"
elif echo "$build_os" | grep aix > /dev/null; then
RPM=rpm.shared
echo "hacking things up for aix"
fi
rm -f ./find-provides.sh
@ -414,6 +556,7 @@ AC_SUBST(FIXPERMS)
AC_SUBST(MISCDIR)
AC_SUBST(LIBMISC)
AC_SUBST(MISCPATH)
AC_SUBST(RPMCONFIGDIR)
if test -d newbuild ; then
NBMAKEFILE=newbuild/Makefile

View File

@ -38,19 +38,16 @@ $(NLSPACKAGE).pot: $(POTFILES)
update-po: Makefile
$(MAKE) $(NLSPACKAGE).pot
catalogs='$(CATALOGS)'; \
@$(MAKE) $(NLSPACKAGE).pot
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
lang=`echo $$cat | sed 's/.mo//'`; \
mv $$lang.po $$lang.old.po; \
echo "$$lang:"; \
if $(MSGMERGE) $$lang.old.po $(NLSPACKAGE).pot -o $$lang.po; then \
rm -f $$lang.old.po; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
fi; \
if tupdate $(NLSPACKAGE).pot $$lang.po > $$lang.pot ; then \
echo "tupdate of $$lang succeeded" ; \
else \
echo "tupdate of $$lang failed" ; \
rm -f $$lang.pot ; \
fi \
done
clean: