Added options for yaz-config.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 19 Jun 2000 09:49:35 +0000 (09:49 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 19 Jun 2000 09:49:35 +0000 (09:49 +0000)
CHANGELOG
Makefile.am
Makefile.in
configure
configure.in
lib/Makefile.am
lib/Makefile.in
lib/yaz-config.in [new file with mode: 0755]
yaz.spec

index b61642e..40ae8f7 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
 Possible compatibility problems with earlier versions marked with '*'.
 
+Config file yaz-config now accepts options so that it returns specific
+compile settings, etc. Thanks to Morten Bøgeskov <morten@bogeskov.dk>
+
 Shared library support for UNIX using GNU libtool.
 
 * Modified backend interface. Request/Response struct's replaced by
index 0b960e6..15c7323 100644 (file)
@@ -1,4 +1,4 @@
-## $Id: Makefile.am,v 1.7 2000-04-05 07:39:54 adam Exp $
+## $Id: Makefile.am,v 1.8 2000-06-19 09:49:35 adam Exp $
 
 AUTOMAKE_OPTIONS = foreign 
 
@@ -11,8 +11,10 @@ SPEC_FILE=$(PACKAGE).spec
 EXTRA_DIST=$(SPEC_FILE) README LICENSE CHANGELOG TODO windows.txt
 
 yaz-config: Makefile
+       @rm -f yaz-config
        @echo "#!/bin/sh" >yaz-config
-       @echo "# YAZ settings for developers" >>yaz-config
+       @echo "# yaz-config for source tree" >>yaz-config
+       @echo "YAZVERSION=@VERSION@" >>yaz-config
        @echo "YAZBIN=\"`pwd`/bin\"" >>yaz-config
        @echo "YAZTAB=\"`pwd`/tab\"" >>yaz-config
        @echo "YAZLIB=\"-L`pwd`/lib/.libs -lyaz @LIBS@\"" >>yaz-config
index e698e8c..883a3f4 100644 (file)
@@ -344,8 +344,10 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
 yaz-config: Makefile
+       @rm -f yaz-config
        @echo "#!/bin/sh" >yaz-config
-       @echo "# YAZ settings for developers" >>yaz-config
+       @echo "# yaz-config for source tree" >>yaz-config
+       @echo "YAZVERSION=@VERSION@" >>yaz-config
        @echo "YAZBIN=\"`pwd`/bin\"" >>yaz-config
        @echo "YAZTAB=\"`pwd`/tab\"" >>yaz-config
        @echo "YAZLIB=\"-L`pwd`/lib/.libs -lyaz @LIBS@\"" >>yaz-config
index 0b9469b..6f4628e 100755 (executable)
--- a/configure
+++ b/configure
@@ -2446,7 +2446,26 @@ done
 ac_given_srcdir=$srcdir
 ac_given_INSTALL="$INSTALL"
 
-trap 'rm -fr `echo "Makefile util/Makefile odr/Makefile z39.50/Makefile asn/Makefile ill/Makefile zutil/Makefile comstack/Makefile ccl/Makefile tab/Makefile retrieval/Makefile server/Makefile include/Makefile include/yaz/Makefile lib/Makefile client/Makefile ztest/Makefile doc/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "
+Makefile
+util/Makefile
+odr/Makefile
+z39.50/Makefile
+asn/Makefile
+ill/Makefile
+zutil/Makefile
+comstack/Makefile
+ccl/Makefile
+tab/Makefile
+retrieval/Makefile
+server/Makefile
+include/Makefile
+include/yaz/Makefile
+lib/Makefile
+client/Makefile
+ztest/Makefile
+doc/Makefile
+lib/yaz-config" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -2552,7 +2571,25 @@ EOF
 
 cat >> $CONFIG_STATUS <<EOF
 
-CONFIG_FILES=\${CONFIG_FILES-"Makefile util/Makefile odr/Makefile z39.50/Makefile asn/Makefile ill/Makefile zutil/Makefile comstack/Makefile ccl/Makefile tab/Makefile retrieval/Makefile server/Makefile include/Makefile include/yaz/Makefile lib/Makefile client/Makefile ztest/Makefile doc/Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile
+util/Makefile
+odr/Makefile
+z39.50/Makefile
+asn/Makefile
+ill/Makefile
+zutil/Makefile
+comstack/Makefile
+ccl/Makefile
+tab/Makefile
+retrieval/Makefile
+server/Makefile
+include/Makefile
+include/yaz/Makefile
+lib/Makefile
+client/Makefile
+ztest/Makefile
+doc/Makefile
+lib/yaz-config"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@@ -2616,7 +2653,7 @@ cat >> $CONFIG_STATUS <<EOF
 
 EOF
 cat >> $CONFIG_STATUS <<\EOF
-
+chmod +x lib/yaz-config
 exit 0
 EOF
 chmod +x $CONFIG_STATUS
index 5d17926..353b500 100644 (file)
@@ -1,7 +1,6 @@
-dnl YAZ Toolkit
-dnl (c) Index Data 1994-2000
+dnl YAZ Toolkit, Index Data 1994-2000
 dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.28 2000-05-18 11:57:04 adam Exp $
+dnl $Id: configure.in,v 1.29 2000-06-19 09:49:35 adam Exp $
 AC_INIT(include/yaz/yaz-version.h)
 AM_INIT_AUTOMAKE(yaz, 1.7)
 dnl
@@ -118,4 +117,23 @@ AC_SUBST(SUBDIRS_VAR)
 dnl
 dnl ------ Makefiles
 dnl
-AC_OUTPUT(Makefile util/Makefile odr/Makefile z39.50/Makefile asn/Makefile ill/Makefile zutil/Makefile comstack/Makefile ccl/Makefile tab/Makefile retrieval/Makefile server/Makefile include/Makefile include/yaz/Makefile lib/Makefile client/Makefile ztest/Makefile doc/Makefile)
+AC_OUTPUT([
+Makefile
+util/Makefile
+odr/Makefile
+z39.50/Makefile
+asn/Makefile
+ill/Makefile
+zutil/Makefile
+comstack/Makefile
+ccl/Makefile
+tab/Makefile
+retrieval/Makefile
+server/Makefile
+include/Makefile
+include/yaz/Makefile
+lib/Makefile
+client/Makefile
+ztest/Makefile
+doc/Makefile
+lib/yaz-config],[chmod +x lib/yaz-config])
index b653261..a2eb3cd 100644 (file)
@@ -1,9 +1,11 @@
-## $Id: Makefile.am,v 1.5 2000-05-02 19:32:16 adam Exp $
+## $Id: Makefile.am,v 1.6 2000-06-19 09:49:35 adam Exp $
 
 lib_LTLIBRARIES = libyaz.la
 
 bin_SCRIPTS = yaz-config
 
+EXTRA_DIST = yaz-config.in
+
 # If the line below is omitted the LINK variable is
 # not set in Makefile.in and it will NOT work ..
 EXTRA_libyaz_la_SOURCES=x.c
@@ -17,17 +19,3 @@ libyaz_la_LIBADD=../odr/libodr.la ../$(ASNMODULE)/libasn.la \
  ../comstack/libcomstack.la ../server/libserver.la \
  ../zutil/libzutil.la ../util/libutil.la ../ccl/libccl.la \
  ../retrieval/libret.la $(ILLLIB)
-
-#  Public libraries and header files
-LIBDIR=$(exec_prefix)/lib
-INCDIR=$(prefix)/include
-
-yaz-config: Makefile
-       @echo "#!/bin/sh" >yaz-config
-       @echo "# YAZ settings for developers" >>yaz-config
-       @echo "YAZBIN='$(bindir)'" >>yaz-config
-       @echo "YAZTAB='$(pkgdatadir)/tab'" >>yaz-config
-       @echo "YAZLIB='-L$(libdir) -lyaz $(LIBS)'" >>yaz-config
-       @echo "YAZINC='-I$(includedir)'" >>yaz-config
-       chmod +x yaz-config
-
index 521408e..8c85394 100644 (file)
@@ -82,6 +82,8 @@ lib_LTLIBRARIES = libyaz.la
 
 bin_SCRIPTS = yaz-config
 
+EXTRA_DIST = yaz-config.in
+
 # If the line below is omitted the LINK variable is
 # not set in Makefile.in and it will NOT work ..
 EXTRA_libyaz_la_SOURCES = x.c
@@ -93,12 +95,8 @@ LDFLAGS = -version-info 0:0:0
 
 libyaz_la_LIBADD = ../odr/libodr.la ../$(ASNMODULE)/libasn.la  ../comstack/libcomstack.la ../server/libserver.la  ../zutil/libzutil.la ../util/libutil.la ../ccl/libccl.la  ../retrieval/libret.la $(ILLLIB)
 
-
-#  Public libraries and header files
-LIBDIR = $(exec_prefix)/lib
-INCDIR = $(prefix)/include
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_CLEAN_FILES = 
+CONFIG_CLEAN_FILES =  yaz-config
 LTLIBRARIES =  $(lib_LTLIBRARIES)
 
 
@@ -117,7 +115,7 @@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CF
 LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
 LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-DIST_COMMON =  Makefile.am Makefile.in
+DIST_COMMON =  Makefile.am Makefile.in yaz-config.in
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -138,6 +136,8 @@ Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
        cd $(top_builddir) \
          && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
+yaz-config: $(top_builddir)/config.status yaz-config.in
+       cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
 mostlyclean-libLTLIBRARIES:
 
@@ -378,15 +378,6 @@ distclean-generic clean-generic maintainer-clean-generic clean \
 mostlyclean distclean maintainer-clean
 
 
-yaz-config: Makefile
-       @echo "#!/bin/sh" >yaz-config
-       @echo "# YAZ settings for developers" >>yaz-config
-       @echo "YAZBIN='$(bindir)'" >>yaz-config
-       @echo "YAZTAB='$(pkgdatadir)/tab'" >>yaz-config
-       @echo "YAZLIB='-L$(libdir) -lyaz $(LIBS)'" >>yaz-config
-       @echo "YAZINC='-I$(includedir)'" >>yaz-config
-       chmod +x yaz-config
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/lib/yaz-config.in b/lib/yaz-config.in
new file mode 100755 (executable)
index 0000000..2713388
--- /dev/null
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+yazprefix=@prefix@
+echo_cflags=no
+echo_libs=no
+echo_help=no
+echo_tabs=no
+
+yazlibs=@LIBS@
+YAZVERSION=@VERSION@
+
+usage()
+{
+       cat <<EOF
+Usage: yaz-config [OPTIONS] [LIBRARIES]
+Options:
+       [--prefix[=DIR]]
+       [--version]
+       [--libs]
+       [--cflags]
+       [--tabs]
+EOF
+       exit $1
+}
+
+#if test $# -eq 0; then
+#      echo_help=yes
+#fi
+
+while test $# -gt 0; do
+  case "$1" in
+  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  case $1 in
+    --prefix=*)
+      yazprefix=$optarg
+      ;;
+    --prefix)
+      echo $yazprefix
+      exit 0
+      ;;
+    --version)
+      echo $YAZVERSION
+      exit 0
+      ;;
+    --cflags)
+      echo_cflags=yes
+      ;;
+    --libs)
+      echo_libs=yes
+      ;;
+    --tabs)
+      echo_tabs=yes
+      ;;
+    *)
+      echo_help=yes
+      ;;
+  esac
+  shift
+done
+
+YAZTAB=$yazprefix/share/yaz/tab
+YAZBIN=$yazprefix/bin
+
+if test "$yazprefix" = "/usr"; then
+       YAZLIB="-L$yazprefix/lib $YAZLIB"
+else
+       YAZLIB="-lyaz $yazlibs"
+fi
+if test "$yazprefix" = "/usr"; then
+       YAZINC=
+else
+       YAZINC=-I$yazprefix/include
+fi
+
+if test "$echo_help" = "yes"; then
+       usage 1 1>&2
+fi
+if test "$echo_cflags" = "yes"; then
+       echo $YAZINC
+fi
+if test "$echo_libs" = "yes"; then
+       echo $YAZLIB
+fi
+if test "$echo_tabs" = "yes"; then
+       echo $YAZTAB
+fi
index 3c882c4..0d8c37a 100644 (file)
--- a/yaz.spec
+++ b/yaz.spec
@@ -11,9 +11,8 @@ URL: http://www.indexdata.dk/yaz/
 Summary: Z39.50 Library
 
 %description
-The YAZ package is a C library for developing client - and
-server applications using the ANSI/NISO Z39.50 protocol for Information
-Retrieval. 
+YAZ is a C library for developing client - and server applications
+using the ANSI/NISO Z39.50 protocol for Information Retrieval. 
 
 %prep
 %setup