Skip to content

Config script

Brian Stafford edited this page Jun 6, 2021 · 3 revisions

libesmtp-config

The libesmtp-config script was removed with the v1.1.0 release for two reasons, partly because projects that use one of these scripts are rare nowadays, and partly because Meson has a module to generate a correct .pc file for pkg-config automatically. It was felt that a replacement script which covers all Meson use-cases would be difficult to get right.

Nevertheless there are some projects which may benefit from a script pending transition to pkg-config. The simplest approach is to wrap pkg-config with a shell script.

#! /bin/sh
# save this script as libesmtp-config and make it executable

usage()
{
    cat <<EOF
Usage: libesmtp-config [OPTION]
Values for OPTION are:
  --libs		print library linking information
  --cflags		print pre-processor and compiler flags
  --help		display this help and exit
  --version		output version information
  --numeric-version	output version information
EOF
    exit $1
}

CONFIG="pkg-config libesmtp-1.0"

if test $# -eq 0; then
    usage 1
fi

while test $# -gt 0; do
    case "$1" in
    --cflags|--libs)
	$CONFIG $1 ;;
    --version)
	$CONFIG --modversion ; exit 0 ;;
    --numeric-version)
	$CONFIG --modversion | awk -F '[a-z.]*' '{ print ($1 * 1000 +  $2) * 1000 + $3 }' 
	exit 0 ;;
    --help)
	usage 0 ;;
    *)
	usage 1 ;;
    esac
    shift
done
exit 0
Clone this wiki locally