0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-25 14:03:42 +08:00
libzmq/version.sh
Hennadii Stepanov de5ee18203 Replace egrep with grep -E
For the GNU Grep package version >= 3.8, the `egrep` command emits:
```
egrep: warning: egrep is obsolescent; using grep -E
```
which makes the `./autogen.sh` script very noisy.
2023-08-26 22:19:35 +01:00

22 lines
755 B
Bash
Executable File

#!/bin/sh
#
# This script extracts the 0MQ version from include/zmq.h, which is the master
# location for this information.
#
if [ ! -f include/zmq.h ]; then
echo "version.sh: error: include/zmq.h does not exist" 1>&2
exit 1
fi
MAJOR=`grep -E '^#define +ZMQ_VERSION_MAJOR +[0-9]+$' include/zmq.h`
MINOR=`grep -E '^#define +ZMQ_VERSION_MINOR +[0-9]+$' include/zmq.h`
PATCH=`grep -E '^#define +ZMQ_VERSION_PATCH +[0-9]+$' include/zmq.h`
if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$PATCH" ]; then
echo "version.sh: error: could not extract version from include/zmq.h" 1>&2
exit 1
fi
MAJOR=`echo $MAJOR | awk '{ print $3 }'`
MINOR=`echo $MINOR | awk '{ print $3 }'`
PATCH=`echo $PATCH | awk '{ print $3 }'`
echo $MAJOR.$MINOR.$PATCH | tr -d '\n'