#!/bin/bash
#
# This script was long ago based on gtk-config, but most of that has since
# been stripped away, with the real work happening in CMake nowadays.
#
# The documentation for gtk-config contained the following notice:
#
#   Copyright (C)  1998 Owen Taylor
#
#   Permission to use, copy, modify, and distribute this software and its
#   documentation for any purpose and without fee is hereby granted,
#   provided that the above copyright notice appear in all copies and that
#   both that copyright notice and this permission notice appear in
#   supporting documentation.
#
# Changes to this script were made by Ben Burton <bab@maths.uq.edu.au> and are
# released under the same license as above.

usage()
{
	cat <<EOF
Usage: regina-engine-config [OPTIONS]
Options:
	[--prefix]
	[--version]
	[--cflags]
	[--libs]
EOF
	exit $1
}

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

while test $# -gt 0; do
  case "$1" in
    --prefix=*)
      echo 'ERROR: --prefix=<DIR> is no longer supported.'
      echo 'In the past, this never did anything useful anyway.'
      exit 1
      ;;
    --prefix)
      echo '/usr'
      ;;
    --exec-prefix=*)
      echo 'ERROR: --exec-prefix=<DIR> is no longer supported.'
      echo 'In the past, this never did anything useful anyway.'
      exit 1
      ;;
    --exec-prefix)
      echo 'ERROR: --exec-prefix is no longer supported.'
      echo 'Just use --prefix instead (which behaves identically).'
      exit 1
      ;;
    --version)
      echo 'Regina 7.4.1'
      ;;
    --cflags)
      echo_cflags=yes
      ;;
    --libs)
      echo_libs=yes
      ;;
    *)
      usage 1 1>&2
      ;;
  esac
  shift
done

if test "$echo_cflags" = "yes" -o "$echo_libs" = "yes"; then
	echo '-std=c++20'
fi

if test "$echo_cflags" = "yes"; then
	echo '-I/usr/include/regina  -I/usr/include -I/usr/include/libxml2 -I/usr/include -I/usr/include -I/usr/include'
fi

if test "$echo_libs" = "yes"; then
	echo '-L/usr/lib -lregina-engine  /usr/lib/libxml2.so /usr/lib/libgmp.so /usr/lib/libgmpxx.so'
fi
