glusterfs/autogen.sh
Bala.FA f75957ab6b log: error code generation support
error code and message are generated at compile time by reading a json
file which contains information of elements for each error code.  This
framework provides error handling and ability to do more cleaner log
messages to users.

error-codes.json file contains error description is below format

{
    "ERR_NAME": {"code": ERR_NUM,
                 "message": {"LOCALE": "ERR_MESSAGE"}}
}

At compile time autogen.sh calls gen-headers.py which produces C
header file libglusterfs/src/gf-error-codes.h.  This header has a
function

const char *_gf_get_message (int code);

which returns respective ERR_MESSAGE for given ERR_NUM.

Change-Id: Ieefbf4c470e19a0175c28942e56cec98a3c94ff0
BUG: 928648
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: http://review.gluster.org/4977
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-07-19 03:55:15 -07:00

106 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
echo
echo ... GlusterFS autogen ...
echo
## Check all dependencies are present
MISSING=""
# Check for aclocal
env aclocal --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
ACLOCAL=aclocal
else
MISSING="$MISSING aclocal"
fi
# Check for autoconf
env autoconf --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
AUTOCONF=autoconf
else
MISSING="$MISSING autoconf"
fi
# Check for autoheader
env autoheader --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
AUTOHEADER=autoheader
else
MISSING="$MISSING autoheader"
fi
# Check for automake
env automake --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
AUTOMAKE=automake
else
MISSING="$MISSING automake"
fi
# Check for libtoolize or glibtoolize
env libtoolize --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
# libtoolize was found, so use it
TOOL=libtoolize
else
# libtoolize wasn't found, so check for glibtoolize
env glibtoolize --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
TOOL=glibtoolize
else
MISSING="$MISSING libtoolize/glibtoolize"
fi
fi
# Check for tar
env tar --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
MISSING="$MISSING tar"
fi
## If dependencies are missing, warn the user and abort
if [ "x$MISSING" != "x" ]; then
echo "Aborting."
echo
echo "The following build tools are missing:"
echo
for pkg in $MISSING; do
echo " * $pkg"
done
echo
echo "Please install them and try again."
echo
exit 1
fi
## generate gf-error-codes.h from error-codes.json
echo "Generate gf-error-codes.h ..."
if ./gen-headers.py; then
if ! mv -fv gf-error-codes.h libglusterfs/src/gf-error-codes.h; then
exit 1
fi
else
exit 1
fi
## Do the autogeneration
echo Running ${ACLOCAL}...
$ACLOCAL -I ./contrib/aclocal
echo Running ${AUTOHEADER}...
$AUTOHEADER
echo Running ${TOOL}...
$TOOL --automake --copy --force
echo Running ${AUTOCONF}...
$AUTOCONF
echo Running ${AUTOMAKE}...
$AUTOMAKE --add-missing --copy --foreign
# Run autogen in the argp-standalone sub-directory
cd argp-standalone;./autogen.sh
# Instruct user on next steps
echo
echo "Please proceed with configuring, compiling, and installing."