From bea22589e57cf39e779ca7c4999c0ea30d0674fc Mon Sep 17 00:00:00 2001 From: cbauer Date: Sat, 2 Dec 2000 18:35:18 +0000 Subject: [PATCH] some minor fixes with respect to RPM package building --- Makefile.in | 21 ++++++++------- cln.m4 | 70 ++++++++++++++++++++++++++++++------------------- cln.spec.in | 7 +++-- doc/Makefile.in | 21 ++++++++------- src/Makefile.in | 39 +++++++++++++-------------- 5 files changed, 90 insertions(+), 68 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4ce83a7..da142f5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -11,6 +11,7 @@ datadir = @datadir@ libdir = @libdir@ includedir = @includedir@ mandir = @mandir@ +DESTDIR = # Programs used by "make": CC = @CC@ @@ -31,22 +32,22 @@ all : force install : installdirs force cd @subdir@; $(MAKE) install - $(INSTALL_PROGRAM) cln-config $(bindir)/cln-config - $(INSTALL_DATA) cln-config.1 $(mandir)/man1/cln-config.1 - $(INSTALL_DATA) cln.m4 $(datadir)/aclocal/cln.m4 + $(INSTALL_PROGRAM) cln-config $(DESTDIR)$(bindir)/cln-config + $(INSTALL_DATA) cln-config.1 $(DESTDIR)$(mandir)/man1/cln-config.1 + $(INSTALL_DATA) cln.m4 $(DESTDIR)$(datadir)/aclocal/cln.m4 installdirs : force cd @subdir@; $(MAKE) installdirs - if [ ! -d $(mandir) ] ; then mkdir $(mandir) ; fi - if [ ! -d $(mandir)/man1 ] ; then mkdir $(mandir)/man1 ; fi - if [ ! -d $(datadir)/aclocal ] ; then mkdir $(datadir)/aclocal ; fi - if [ ! -d $(bindir) ] ; then mkdir $(bindir) ; fi + if [ ! -d $(DESTDIR)$(mandir) ] ; then mkdir $(DESTDIR)$(mandir) ; fi + if [ ! -d $(DESTDIR)$(mandir)/man1 ] ; then mkdir $(DESTDIR)$(mandir)/man1 ; fi + if [ ! -d $(DESTDIR)$(datadir)/aclocal ] ; then mkdir $(DESTDIR)$(datadir)/aclocal ; fi + if [ ! -d $(DESTDIR)$(bindir) ] ; then mkdir $(DESTDIR)$(bindir) ; fi uninstall : force cd @subdir@; $(MAKE) uninstall - $(RM) $(bindir)/cln-config - $(RM) $(mandir)/man1/cln-config.1 - $(RM) $(datadir)/aclocal/cln.m4 + $(RM) $(DESTDIR)$(bindir)/cln-config + $(RM) $(DESTDIR)$(mandir)/man1/cln-config.1 + $(RM) $(DESTDIR)$(datadir)/aclocal/cln.m4 check : force cd @subdir@; $(MAKE) check diff --git a/cln.m4 b/cln.m4 index 5014584..42886ac 100644 --- a/cln.m4 +++ b/cln.m4 @@ -15,22 +15,22 @@ AC_DEFUN(AC_PATH_LIBCLN, dnl Get the cppflags and libraries from the cln-config script dnl AC_ARG_WITH(cln-prefix,[ --with-cln-prefix=PFX Prefix where CLN is installed (optional)], - cln_prefix="$withval", cln_prefix="") + cln_config_prefix="$withval", cln_config_prefix="") AC_ARG_WITH(cln-exec-prefix,[ --with-cln-exec-prefix=PFX Exec prefix where CLN is installed (optional)], - cln_exec_prefix="$withval", cln_exec_prefix="") + cln_config_exec_prefix="$withval", cln_config_exec_prefix="") AC_ARG_ENABLE(clntest, [ --disable-clntest Do not try to compile and run a test CLN program], , enable_clntest=yes) - if test x$cln_exec_prefix != x ; then - cln_args="$cln_args --exec-prefix=$cln_exec_prefix" + if test x$cln_config_exec_prefix != x ; then + cln_config_args="$cln_config_args --exec-prefix=$cln_config_exec_prefix" if test x${CLN_CONFIG+set} != xset ; then - CLN_CONFIG=$cln_exec_prefix/bin/cln-config + CLN_CONFIG=$cln_config_exec_prefix/bin/cln-config fi fi - if test x$cln_prefix != x ; then - cln_args="$cln_args --prefix=$cln_prefix" + if test x$cln_config_prefix != x ; then + cln_config_args="$cln_config_args --prefix=$cln_config_prefix" if test x${CLN_CONFIG+set} != xset ; then - CLN_CONFIG=$cln_prefix/bin/cln-config + CLN_CONFIG=$cln_config_prefix/bin/cln-config fi fi @@ -41,14 +41,13 @@ AC_ARG_ENABLE(clntest, [ --disable-clntest Do not try to compile and run if test "$CLN_CONFIG" = "no" ; then no_cln=yes else - LIBCLN_CPPFLAGS=`$CLN_CONFIG $clnconf_args --cppflags` - LIBCLN_LIBS=`$CLN_CONFIG $clnconf_args --libs` - - cln_major_version=`$CLN_CONFIG $cln_args --version | \ + LIBCLN_CPPFLAGS=`$CLN_CONFIG $cln_config_args --cppflags` + LIBCLN_LIBS=`$CLN_CONFIG $cln_config_args --libs` + cln_config_major_version=`$CLN_CONFIG $cln_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - cln_minor_version=`$CLN_CONFIG $cln_args --version | \ + cln_config_minor_version=`$CLN_CONFIG $cln_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - cln_micro_version=`$CLN_CONFIG $cln_config_args --version | \ + cln_config_micro_version=`$CLN_CONFIG $cln_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_clntest" = "xyes" ; then ac_save_CPPFLAGS="$CPPFLAGS" @@ -62,38 +61,55 @@ dnl rm -f conf.clntest AC_TRY_RUN([ #include -#include #include #include -int main () +/* we do not #include because autoconf in C++ mode inserts a + prototype for exit() that conflicts with the one in stdlib.h */ +extern "C" int system(const char *); + +char* my_strdup (char *str) +{ + char *new_str; + + if (str) { + new_str = new char[(strlen (str) + 1) * sizeof(char)]; + strcpy (new_str, str); + } else + new_str = NULL; + + return new_str; +} + +int main() { int major, minor, micro; char *tmp_version; system("touch conf.clntest"); - tmp_version = strdup("$min_cln_version"); + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_cln_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_cln_version"); - exit(1); + return 1; } - if (($cln_major_version > major) || - (($cln_major_version == major) && ($cln_minor_version > minor)) || - (($cln_major_version == major) && ($cln_minor_version == minor) && ($cln_micro_version >= micro))) { - if ((CL_VERSION_MAJOR == $cln_major_version) && - (CL_VERSION_MINOR == $cln_minor_version) && - (CL_VERSION_PATCHLEVEL == $cln_micro_version)) { + if (($cln_config_major_version > major) || + (($cln_config_major_version == major) && ($cln_config_minor_version > minor)) || + (($cln_config_major_version == major) && ($cln_config_minor_version == minor) && ($cln_config_micro_version >= micro))) { + if ((CL_VERSION_MAJOR == $cln_config_major_version) && + (CL_VERSION_MINOR == $cln_config_minor_version) && + (CL_VERSION_PATCHLEVEL == $cln_config_micro_version)) { return 0; } else { - printf("\n*** 'cln-config --version' returned %d.%d.%d, but the header file I found\n", $cln_major_version, $cln_minor_version, $cln_micro_version); + printf("\n*** 'cln-config --version' returned %d.%d.%d, but the header file I found\n", $cln_config_major_version, $cln_config_minor_version, $cln_config_micro_version); printf("*** corresponds to %d.%d.%d. This mismatch suggests your installation of CLN\n", CL_VERSION_MAJOR, CL_VERSION_MINOR, CL_VERSION_PATCHLEVEL); printf("*** is corrupted. Please inquire and consider reinstalling CLN.\n"); return 1; } } else { - printf("\n*** 'cln-config --version' returned %d.%d.%d, but the minimum version\n", $cln_major_version, $cln_minor_version, $cln_micro_version); + printf("\n*** 'cln-config --version' returned %d.%d.%d, but the minimum version\n", $cln_config_major_version, $cln_config_minor_version, $cln_config_micro_version); printf("*** of CLN required is %d.%d.%d. If cln-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If cln-config was wrong, set the environment variable CLN_CONFIG\n"); @@ -108,7 +124,7 @@ int main () fi fi if test "x$no_cln" = x ; then - AC_MSG_RESULT(yes) + AC_MSG_RESULT([yes, `$CLN_CONFIG --version`]) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) diff --git a/cln.spec.in b/cln.spec.in index 5d27e2c..e2e60f9 100644 --- a/cln.spec.in +++ b/cln.spec.in @@ -37,6 +37,7 @@ make %install rm -rf ${RPM_BUILD_ROOT} +mkdir -p ${RPM_BUILD_ROOT}/usr make prefix=%{_prefix} DESTDIR=${RPM_BUILD_ROOT} install gzip -9nf ${RPM_BUILD_ROOT}%{_infodir}/cln.info* @@ -64,12 +65,14 @@ fi %files devel %defattr(-,root,root) -%doc examples +%doc examples/*.cc %{_libdir}/*.a %{_libdir}/*.la %{_libdir}/*.so -%{_includedir}/*.h +%{_includedir}/cln/*.h %{_infodir}/*.info* +%{_mandir}/man1/cln-config.1 %{_bindir}/cln-config +%{_datadir}/aclocal/* %changelog diff --git a/doc/Makefile.in b/doc/Makefile.in index 0eb5f3b..69c0d23 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -14,6 +14,7 @@ infodir = @infodir@ mandir = @mandir@ htmldir = $(datadir)/html dvidir = $(datadir)/dvi +DESTDIR = # Programs used by "make": RM = rm -f @@ -78,20 +79,20 @@ $(PACKAGE)_toc.html : $(srcdir)/$(PACKAGE).texi install : all installdirs force - $(INSTALL_DATA) $(srcdir)/$(PACKAGE).info $(infodir)/$(PACKAGE).info - $(INSTALL_DATA) $(srcdir)/$(PACKAGE)_*.html $(htmldir) - $(INSTALL_DATA) $(srcdir)/$(PACKAGE).dvi $(dvidir)/$(PACKAGE).dvi + $(INSTALL_DATA) $(srcdir)/$(PACKAGE).info $(DESTDIR)$(infodir)/$(PACKAGE).info + $(INSTALL_DATA) $(srcdir)/$(PACKAGE)_*.html $(DESTDIR)$(htmldir) + $(INSTALL_DATA) $(srcdir)/$(PACKAGE).dvi $(DESTDIR)$(dvidir)/$(PACKAGE).dvi installdirs : force - if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi - if [ ! -d $(infodir) ] ; then mkdir $(infodir) ; fi - if [ ! -d $(htmldir) ] ; then mkdir $(htmldir) ; fi - if [ ! -d $(dvidir) ] ; then mkdir $(dvidir) ; fi + if [ ! -d $(DESTDIR)$(datadir) ] ; then mkdir $(DESTDIR)$(datadir) ; fi + if [ ! -d $(DESTDIR)$(infodir) ] ; then mkdir $(DESTDIR)$(infodir) ; fi + if [ ! -d $(DESTDIR)$(htmldir) ] ; then mkdir $(DESTDIR)$(htmldir) ; fi + if [ ! -d $(DESTDIR)$(dvidir) ] ; then mkdir $(DESTDIR)$(dvidir) ; fi uninstall : force - $(RM) $(infodir)/$(PACKAGE).info - $(RM) $(htmldir)/$(PACKAGE)_*.html - $(RM) $(dvidir)/$(PACKAGE).dvi + $(RM) $(DESTDIR)$(infodir)/$(PACKAGE).info + $(RM) $(DESTDIR)$(htmldir)/$(PACKAGE)_*.html + $(RM) $(DESTDIR)$(dvidir)/$(PACKAGE).dvi check : all diff --git a/src/Makefile.in b/src/Makefile.in index 9784773..f2041ee 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -14,6 +14,7 @@ datadir = @datadir@ libdir = @libdir@ includedir = @includedir@ mandir = @mandir@ +DESTDIR = # Programs used by "make": # C compiler @@ -199,29 +200,29 @@ libcln.la : $(LIBTOOL) $(ALLOBJECTS_LO) $(LIBTOOL_LINK) $(CC) -o libcln.la -rpath $(libdir) -version-info $(CL_CURRENT):$(CL_REVISION):$(CL_AGE) $(LDFLAGS) $(LIBS) $(ALLOBJECTS_LO) install : all force - if [ ! -d $(libdir) ] ; then mkdir $(libdir) ; fi - $(LIBTOOL_INSTALL) $(INSTALL_DATA) libcln.la $(libdir)/libcln.la - if [ ! -d $(includedir) ] ; then mkdir $(includedir) ; fi - if [ ! -d $(includedir)/cln ] ; then mkdir $(includedir)/cln ; fi - $(INSTALL_DATA) $(top_srcdir)/include/cln/*.h $(includedir)/cln - $(INSTALL_DATA) ../include/cln/*.h $(includedir)/cln -# if [ ! -d $(mandir) ] ; then mkdir $(mandir) ; fi -# if [ ! -d $(mandir)/man3 ] ; then mkdir $(mandir)/man3 ; fi -# if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi -# if [ ! -d $(datadir)/html ] ; then mkdir $(datadir)/html ; fi + if [ ! -d $(DESTDIR)$(libdir) ] ; then mkdir $(DESTDIR)$(libdir) ; fi + $(LIBTOOL_INSTALL) $(INSTALL_DATA) libcln.la $(DESTDIR)$(libdir)/libcln.la + if [ ! -d $(DESTDIR)$(includedir) ] ; then mkdir $(DESTDIR)$(includedir) ; fi + if [ ! -d $(DESTDIR)$(includedir)/cln ] ; then mkdir $(DESTDIR)$(includedir)/cln ; fi + $(INSTALL_DATA) $(top_srcdir)/include/cln/*.h $(DESTDIR)$(includedir)/cln + $(INSTALL_DATA) ../include/cln/*.h $(DESTDIR)$(includedir)/cln +# if [ ! -d $(DESTDIR)$(mandir) ] ; then mkdir $(DESTDIR)$(mandir) ; fi +# if [ ! -d $(DESTDIR)$(mandir)/man3 ] ; then mkdir $(DESTDIR)$(mandir)/man3 ; fi +# if [ ! -d $(DESTDIR)$(datadir) ] ; then mkdir $(DESTDIR)$(datadir) ; fi +# if [ ! -d $(DESTDIR)$(datadir)/html ] ; then mkdir $(DESTDIR)$(datadir)/html ; fi installdirs : force - if [ ! -d $(libdir) ] ; then mkdir $(libdir) ; fi - if [ ! -d $(includedir) ] ; then mkdir $(includedir) ; fi - if [ ! -d $(includedir)/cln ] ; then mkdir $(includedir)/cln ; fi -# if [ ! -d $(mandir) ] ; then mkdir $(mandir) ; fi -# if [ ! -d $(mandir)/man3 ] ; then mkdir $(mandir)/man3 ; fi -# if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi -# if [ ! -d $(datadir)/html ] ; then mkdir $(datadir)/html ; fi + if [ ! -d $(DESTDIR)$(libdir) ] ; then mkdir $(DESTDIR)$(libdir) ; fi + if [ ! -d $(DESTDIR)$(includedir) ] ; then mkdir $(DESTDIR)$(includedir) ; fi + if [ ! -d $(DESTDIR)$(includedir)/cln ] ; then mkdir $(DESTDIR)$(includedir)/cln ; fi +# if [ ! -d $(DESTDIR)$(mandir) ] ; then mkdir $(DESTDIR)$(mandir) ; fi +# if [ ! -d $(DESTDIR)$(mandir)/man3 ] ; then mkdir $(DESTDIR)$(mandir)/man3 ; fi +# if [ ! -d $(DESTDIR)$(datadir) ] ; then mkdir $(DESTDIR)$(datadir) ; fi +# if [ ! -d $(DESTDIR)$(datadir)/html ] ; then mkdir $(DESTDIR)$(datadir)/html ; fi uninstall : force - $(LIBTOOL_UNINSTALL) $(RM) $(libdir)/libcln.la - $(RM) -r $(includedir)/cln + $(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libcln.la + $(RM) -r $(DESTDIR)$(includedir)/cln check : all