The source code and dockerfile for the GSW2024 AI Lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

55 lines
1.4 KiB

2 months ago
  1. #!/bin/bash
  2. # This script expects the (full) path of libgmp.a.
  3. # It prints out the (full) path of the (hopefully) corresponding gmp.h.
  4. if [ $# -ne 1 ]
  5. then
  6. echo "ERROR: $0: requires 1 arg (path of GMP library)"
  7. exit 1
  8. fi
  9. GMP_LIB="$1"
  10. PLATFORM=`basename "$GMP_LIB"`
  11. if [ "$PLATFORM" = "lib" ]
  12. then
  13. PLATFORM=
  14. fi
  15. GMP_LIB_DIR=`dirname "$GMP_LIB"`
  16. GMP_LIB_DIR_DIR=`dirname "$GMP_LIB_DIR"`
  17. # Special handling if libgmp.a is not fully installed...
  18. if [ `basename "$GMP_LIB_DIR"` = ".libs" ]
  19. then
  20. # GMP is not installed
  21. GMP_INC_DIR="$GMP_LIB_DIR_DIR"
  22. else
  23. # GMP is installed -- have to check two possible locations for the header file
  24. GMP_INC_DIR1="$GMP_LIB_DIR_DIR"/include
  25. GMP_INC_DIR2=`dirname "$GMP_LIB_DIR_DIR"`/include
  26. GMP_INC_DIR3="$GMP_LIB_DIR_DIR/include/$PLATFORM"
  27. if [ -f "$GMP_INC_DIR1/gmp.h" ]
  28. then
  29. GMP_INC_DIR="$GMP_INC_DIR1"
  30. elif [ -f "$GMP_INC_DIR2/gmp.h" ]
  31. then
  32. GMP_INC_DIR="$GMP_INC_DIR2"
  33. elif [ -n "$PLATFORM" -a -f "$GMP_INC_DIR3/gmp.h" ]
  34. then
  35. GMP_INC_DIR="$GMP_INC_DIR3"
  36. else
  37. echo "ERROR: $0: Cannot find GMP header for $GMP_LIB; searched in $GMP_INC_DIR1 and $GMP_INC_DIR2 and $GMP_INC_DIR3"
  38. exit 3
  39. fi
  40. fi
  41. if [ -r "$GMP_INC_DIR/gmp.h" ]
  42. then
  43. # We've found a plausible gmp.h.
  44. echo "$GMP_INC_DIR"
  45. exit 0
  46. fi
  47. # Get here probably only if there's a damaged GMP installation.
  48. echo "ERROR: $0: Trouble reading GMP header file $GMP_INC_DIR/gmp.h"
  49. exit 4