version.sh 749 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. #
  3. # This script extracts the 0MQ version from include/zmq.h, which is the master
  4. # location for this information.
  5. #
  6. if [ ! -f include/zmq.h ]; then
  7. echo "version.sh: error: include/zmq.h does not exist" 1>&2
  8. exit 1
  9. fi
  10. MAJOR=`egrep '^#define +ZMQ_VERSION_MAJOR +[0-9]+$' include/zmq.h`
  11. MINOR=`egrep '^#define +ZMQ_VERSION_MINOR +[0-9]+$' include/zmq.h`
  12. PATCH=`egrep '^#define +ZMQ_VERSION_PATCH +[0-9]+$' include/zmq.h`
  13. if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$PATCH" ]; then
  14. echo "version.sh: error: could not extract version from include/zmq.h" 1>&2
  15. exit 1
  16. fi
  17. MAJOR=`echo $MAJOR | awk '{ print $3 }'`
  18. MINOR=`echo $MINOR | awk '{ print $3 }'`
  19. PATCH=`echo $PATCH | awk '{ print $3 }'`
  20. echo $MAJOR.$MINOR.$PATCH | tr -d '\n'