Work on yaz-config creation. Added yaz.m4.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 11 Oct 2000 10:40:56 +0000 (10:40 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 11 Oct 2000 10:40:56 +0000 (10:40 +0000)
Makefile.am
Makefile.in
configure
configure.in
include/Makefile.in
lib/Makefile.am
lib/Makefile.in
lib/yaz-config.in [deleted file]
yaz-config.in
yaz.m4 [new file with mode: 0644]
yaz.spec

index a31690c..31fb0f2 100644 (file)
@@ -1,4 +1,4 @@
-## $Id: Makefile.am,v 1.9 2000-10-02 12:31:43 adam Exp $
+## $Id: Makefile.am,v 1.10 2000-10-11 10:40:56 adam Exp $
 
 AUTOMAKE_OPTIONS = foreign 
 
@@ -6,8 +6,13 @@ DIST_SUBDIRS=util odr z39.50 asn ill zutil comstack ccl tab retrieval server lib
 
 SUBDIRS = @SUBDIRS_VAR@
 
+aclocaldir=$(datadir)/aclocal
+
+aclocal_DATA = yaz.m4
+
 SPEC_FILE=$(PACKAGE).spec
-EXTRA_DIST=$(SPEC_FILE) README LICENSE CHANGELOG TODO windows.txt
+EXTRA_DIST=$(SPEC_FILE) README LICENSE CHANGELOG TODO windows.txt \
+       yaz-config.in yaz.m4
 
 dist-hook:
        cd doc; make
index de7e3e7..7b4740b 100644 (file)
@@ -85,11 +85,18 @@ DIST_SUBDIRS = util odr z39.50 asn ill zutil comstack ccl tab retrieval server l
 
 SUBDIRS = @SUBDIRS_VAR@
 
+aclocaldir = $(datadir)/aclocal
+
+aclocal_DATA = yaz.m4
+
 SPEC_FILE = $(PACKAGE).spec
-EXTRA_DIST = $(SPEC_FILE) README LICENSE CHANGELOG TODO windows.txt
+EXTRA_DIST = $(SPEC_FILE) README LICENSE CHANGELOG TODO windows.txt    yaz-config.in yaz.m4
+
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =  yaz-config
+DATA =  $(aclocal_DATA)
+
 DIST_COMMON =  README Makefile.am Makefile.in TODO aclocal.m4 \
 config.guess config.sub configure configure.in install-sh ltconfig \
 ltmain.sh missing mkinstalldirs yaz-config.in
@@ -118,6 +125,25 @@ $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCI
 yaz-config: $(top_builddir)/config.status yaz-config.in
        cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
+install-aclocalDATA: $(aclocal_DATA)
+       @$(NORMAL_INSTALL)
+       $(mkinstalldirs) $(DESTDIR)$(aclocaldir)
+       @list='$(aclocal_DATA)'; for p in $$list; do \
+         if test -f $(srcdir)/$$p; then \
+           echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(aclocaldir)/$$p"; \
+           $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(aclocaldir)/$$p; \
+         else if test -f $$p; then \
+           echo " $(INSTALL_DATA) $$p $(DESTDIR)$(aclocaldir)/$$p"; \
+           $(INSTALL_DATA) $$p $(DESTDIR)$(aclocaldir)/$$p; \
+         fi; fi; \
+       done
+
+uninstall-aclocalDATA:
+       @$(NORMAL_UNINSTALL)
+       list='$(aclocal_DATA)'; for p in $$list; do \
+         rm -f $(DESTDIR)$(aclocaldir)/$$p; \
+       done
+
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
 # To change the values of `make' variables: instead of editing Makefiles,
@@ -125,6 +151,8 @@ yaz-config: $(top_builddir)/config.status yaz-config.in
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 
+@SET_MAKE@
+
 all-recursive install-data-recursive install-exec-recursive \
 installdirs-recursive install-recursive uninstall-recursive  \
 check-recursive installcheck-recursive info-recursive dvi-recursive:
@@ -151,11 +179,10 @@ maintainer-clean-recursive:
        @set fnord $(MAKEFLAGS); amf=$$2; \
        dot_seen=no; \
        rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
-         if test "$$subdir" = "."; then :; else \
-           rev="$$subdir $$rev"; \
-         fi; \
+         rev="$$subdir $$rev"; \
+         test "$$subdir" = "." && dot_seen=yes; \
        done; \
-       rev="$$rev ."; \
+       test "$$dot_seen" = "no" && rev=". $$rev"; \
        target=`echo $@ | sed s/-recursive//`; \
        for subdir in $$rev; do \
          echo "Making $$target in $$subdir"; \
@@ -281,20 +308,21 @@ installcheck: installcheck-recursive
 install-exec-am:
 install-exec: install-exec-recursive
 
-install-data-am:
+install-data-am: install-aclocalDATA
 install-data: install-data-recursive
 
 install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 install: install-recursive
-uninstall-am:
+uninstall-am: uninstall-aclocalDATA
 uninstall: uninstall-recursive
-all-am: Makefile
+all-am: Makefile $(DATA)
 all-redirect: all-recursive
 install-strip:
        $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
 installdirs: installdirs-recursive
 installdirs-am:
+       $(mkinstalldirs)  $(DESTDIR)$(aclocaldir)
 
 
 mostlyclean-generic:
@@ -328,11 +356,11 @@ maintainer-clean-am:  maintainer-clean-tags maintainer-clean-generic \
 maintainer-clean: maintainer-clean-recursive
        -rm -f config.status
 
-.PHONY: install-data-recursive uninstall-data-recursive \
-install-exec-recursive uninstall-exec-recursive installdirs-recursive \
-uninstalldirs-recursive all-recursive check-recursive \
-installcheck-recursive info-recursive dvi-recursive \
-mostlyclean-recursive distclean-recursive clean-recursive \
+.PHONY: uninstall-aclocalDATA install-aclocalDATA install-data-recursive \
+uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
 maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
 distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
 dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
index 6d632f7..25ba5c6 100755 (executable)
--- a/configure
+++ b/configure
@@ -2344,6 +2344,10 @@ fi
 YAZ_SRC_ROOT=`pwd`
 SUBDIRS_VAR="util odr $ASNMODULE $ILLMODULE zutil comstack ccl tab retrieval server include lib client ztest"
 
+if test -f lib/yaz-config.in; then
+       rm lib/yaz-config.in
+fi
+sed s%yaz_echo_source=yes%yaz_echo_source=no%g < yaz-config.in >lib/yaz-config.in
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -2477,7 +2481,8 @@ client/Makefile
 ztest/Makefile
 doc/Makefile
 yaz-config
-lib/yaz-config" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+lib/yaz-config
+" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -2603,7 +2608,8 @@ client/Makefile
 ztest/Makefile
 doc/Makefile
 yaz-config
-lib/yaz-config"}
+lib/yaz-config
+"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@@ -2667,7 +2673,7 @@ cat >> $CONFIG_STATUS <<EOF
 
 EOF
 cat >> $CONFIG_STATUS <<\EOF
-chmod +x lib/yaz-config yaz-config
+chmod +x yaz-config lib/yaz-config
 exit 0
 EOF
 chmod +x $CONFIG_STATUS
index 32f0360..16c7a51 100644 (file)
@@ -1,6 +1,6 @@
 dnl YAZ Toolkit, Index Data 1994-2000
 dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.36 2000-10-03 13:26:24 adam Exp $
+dnl $Id: configure.in,v 1.37 2000-10-11 10:40:56 adam Exp $
 AC_INIT(include/yaz/yaz-version.h)
 AM_INIT_AUTOMAKE(yaz, 1.7)
 dnl
@@ -127,6 +127,10 @@ YAZ_SRC_ROOT=`pwd`
 dnl
 SUBDIRS_VAR="util odr $ASNMODULE $ILLMODULE zutil comstack ccl tab retrieval server include lib client ztest"
 AC_SUBST(SUBDIRS_VAR)
+if test -f lib/yaz-config.in; then
+       rm lib/yaz-config.in
+fi
+sed s%yaz_echo_source=yes%yaz_echo_source=no%g < yaz-config.in >lib/yaz-config.in
 dnl
 dnl ------ Makefiles
 dnl
@@ -150,4 +154,5 @@ client/Makefile
 ztest/Makefile
 doc/Makefile
 yaz-config
-lib/yaz-config],[chmod +x lib/yaz-config yaz-config])
+lib/yaz-config
+],[chmod +x yaz-config lib/yaz-config])
index 67e11b7..995b628 100644 (file)
@@ -108,6 +108,8 @@ Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 
+@SET_MAKE@
+
 all-recursive install-data-recursive install-exec-recursive \
 installdirs-recursive install-recursive uninstall-recursive  \
 check-recursive installcheck-recursive info-recursive dvi-recursive:
@@ -134,11 +136,10 @@ maintainer-clean-recursive:
        @set fnord $(MAKEFLAGS); amf=$$2; \
        dot_seen=no; \
        rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
-         if test "$$subdir" = "."; then :; else \
-           rev="$$subdir $$rev"; \
-         fi; \
+         rev="$$subdir $$rev"; \
+         test "$$subdir" = "." && dot_seen=yes; \
        done; \
-       rev="$$rev ."; \
+       test "$$dot_seen" = "no" && rev=". $$rev"; \
        target=`echo $@ | sed s/-recursive//`; \
        for subdir in $$rev; do \
          echo "Making $$target in $$subdir"; \
index a2eb3cd..0d7d94c 100644 (file)
@@ -1,11 +1,7 @@
-## $Id: Makefile.am,v 1.6 2000-06-19 09:49:35 adam Exp $
+## $Id: Makefile.am,v 1.7 2000-10-11 10:40:56 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
@@ -15,6 +11,8 @@ libyaz_la_SOURCES=
 
 LDFLAGS=-version-info 0:0:0
 
+bin_SCRIPTS = yaz-config
+
 libyaz_la_LIBADD=../odr/libodr.la ../$(ASNMODULE)/libasn.la \
  ../comstack/libcomstack.la ../server/libserver.la \
  ../zutil/libzutil.la ../util/libutil.la ../ccl/libccl.la \
index c7d41b0..10266ee 100644 (file)
@@ -81,10 +81,6 @@ YAZ_SRC_ROOT = @YAZ_SRC_ROOT@
 
 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
@@ -94,6 +90,8 @@ libyaz_la_SOURCES =
 
 LDFLAGS = -version-info 0:0:0
 
+bin_SCRIPTS = yaz-config
+
 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)
 
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/lib/yaz-config.in b/lib/yaz-config.in
deleted file mode 100755 (executable)
index c215aee..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/sh
-# $Id: yaz-config.in,v 1.6 2000-10-02 12:31:43 adam Exp $
-yazprefix=@prefix@
-yaz_echo_cflags=no
-yaz_echo_libs=no
-yaz_echo_help=no
-yaz_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
-#      yaz_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)
-      yaz_echo_cflags=yes
-      ;;
-    --libs)
-      yaz_echo_libs=yes
-      ;;
-    --tabs)
-      yaz_echo_tabs=yes
-      ;;
-    -*)
-      yaz_echo_help=yes
-      ;;
-  esac
-  shift
-done
-
-YAZTAB=$yazprefix/share/yaz/tab
-YAZBIN=$yazprefix/bin
-
-if test "$yazprefix" = "/usr"; then
-       YAZLIB="-lyaz $yazlibs"
-else
-       YAZLIB="-L$yazprefix/lib -lyaz $yazlibs"
-fi
-if test "$yazprefix" = "/usr"; then
-       YAZINC=
-else
-       YAZINC=-I$yazprefix/include
-fi
-
-if test "$yaz_echo_help" = "yes"; then
-       usage 1 1>&2
-fi
-if test "$yaz_echo_cflags" = "yes"; then
-       echo $YAZINC
-fi
-if test "$yaz_echo_libs" = "yes"; then
-       echo $YAZLIB
-fi
-if test "$yaz_echo_tabs" = "yes"; then
-       echo $YAZTAB
-fi
index 70241cb..b047e6d 100644 (file)
@@ -1,7 +1,111 @@
 #!/bin/sh
-# yaz-config for source tree
+# $Id: yaz-config.in,v 1.2 2000-10-11 10:40:56 adam Exp $
+yazprefix=@prefix@
+yaz_echo_cflags=no
+yaz_echo_libs=no
+yaz_echo_help=no
+yaz_echo_tabs=no
+yaz_echo_source=yes
+yaz_echo_lalibs=no
+yaz_src_root=@YAZ_SRC_ROOT@
+
+yazlibs="@LIBS@"
 YAZVERSION=@VERSION@
-YAZBIN="@YAZ_SRC_ROOT@/bin"
-YAZTAB="@YAZ_SRC_ROOT@/tab"
-YAZLIB="-L@YAZ_SRC_ROOT@/lib/.libs -lyaz"
-YAZINC="-I@YAZ_SRC_ROOT@/include"
+
+usage()
+{
+       cat <<EOF
+Usage: yaz-config [OPTIONS] [LIBRARIES]
+Options:
+       [--prefix[=DIR]]
+       [--version]
+       [--libs]
+       [--lalibs]
+       [--cflags]
+       [--tabs]
+EOF
+       exit $1
+}
+
+#if test $# -eq 0; then
+#      yaz_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)
+      yaz_echo_cflags=yes
+      ;;
+    --libs)
+      yaz_echo_libs=yes
+      ;;
+    --tabs)
+      yaz_echo_tabs=yes
+      ;;
+    --source)
+      yaz_echo_source=yes
+      ;;
+    --lalibs)
+      yaz_echo_lalibs=yes
+      ;;
+    -*)
+      yaz_echo_help=yes
+      ;;
+  esac
+  shift
+done
+
+if test "$yaz_echo_source" = "yes"; then
+    YAZTAB=${yaz_src_root}/tab
+    YAZBIN=${yaz_src_root}/bin
+    YAZLIB="-L${yaz_src_root}/lib/.libs -lyaz $yazlibs"
+    YAZLALIB="${yaz_src_root}/lib/libyaz.la $yazlibs"
+    YAZINC="-I${yaz_src_root}/include"
+else
+    YAZTAB=$yazprefix/share/yaz/tab
+    YAZBIN=$yazprefix/bin
+
+    if test "$yazprefix" = "/usr"; then
+       YAZLIB="-lyaz $yazlibs"
+    else
+       YAZLIB="-L$yazprefix/lib -lyaz $yazlibs"
+    fi
+    YAZLALIB=$YAZLIB
+    if test "$yazprefix" = "/usr"; then
+       YAZINC=
+    else
+       YAZINC=-I$yazprefix/include
+    fi
+fi
+
+if test "$yaz_echo_help" = "yes"; then
+       usage 1 1>&2
+fi
+if test "$yaz_echo_cflags" = "yes"; then
+       echo $YAZINC
+fi
+if test "$yaz_echo_libs" = "yes"; then
+       echo $YAZLIB
+fi
+if test "$yaz_echo_tabs" = "yes"; then
+       echo $YAZTAB
+fi
+if test "$yaz_echo_lalibs" = "yes"; then
+       echo $YAZLALIB
+fi
diff --git a/yaz.m4 b/yaz.m4
new file mode 100644 (file)
index 0000000..bd6cf14
--- /dev/null
+++ b/yaz.m4
@@ -0,0 +1,48 @@
+## $Id: yaz.m4,v 1.1 2000-10-11 10:40:56 adam Exp $
+## 
+# Use this m4 funciton for autoconf if you use YAZ in your own
+# configure script.
+# YAZ_INIT
+
+AC_DEFUN([YAZ_INIT],
+[
+       AC_SUBST(YAZLIB)
+       AC_SUBST(YAZLALIB)
+       AC_SUBST(YAZINC)
+       AC_SUBST(YAZVERSION)
+       yazconfig=NONE
+       yazpath=NONE
+       AC_ARG_WITH(yazconfig, [  --with-yazconfig=DIR    yaz-config in DIR (example /home/yaz-1.7)], [yazpath=$withval])
+       if test "x$yazpath" != "xNONE"; then
+               yazconfig=$yazpath/yaz-config
+       else
+               for i in ../yaz* ../yaz; do
+                       if test -d $i; then
+                               if test -r $i/yaz-config; then
+                                       yazconfig=$i/yaz-config
+                               fi
+                       fi
+               done
+               if test "x$yazconfig" = "xNONE"; then
+                       AC_PATH_PROG(yazconfig, yaz-config, NONE)
+               fi
+       fi
+       AC_MSG_CHECKING(for YAZ)
+       if $yazconfig --version >/dev/null 2>&1; then
+               YAZLIB=`$yazconfig --libs`
+               # if this is empty, it's a simple version YAZ 1.6 script
+               # so we have to source it instead...
+               if test "X$YAZLIB" = "X"; then
+                       . $yazconfig
+               else
+                       YAZLALIB=`$yazconfig --lalibs`
+                       YAZINC=`$yazconfig --cflags`
+                       YAZVERSION=`$yazconfig --version`
+               fi
+               AC_MSG_RESULT($yazconfig)
+       else
+               AC_MSG_RESULT(Not found)
+               YAZVERSION=NONE
+       fi
+])
+       
index be0fd80..c44a49e 100644 (file)
--- a/yaz.spec
+++ b/yaz.spec
@@ -42,3 +42,4 @@ cd doc; make prefix=$RPM_BUILD_ROOT/usr install
 /usr/lib/libyaz.so.0.0.0
 /usr/include/yaz
 /usr/share/yaz/doc
+/usr/share/aclocal/yaz.m4