File: patch-curl-clock-gettime.sh

package info (click to toggle)
davix 0.8.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,184 kB
  • sloc: ansic: 164,612; cpp: 38,741; python: 17,726; perl: 14,124; sh: 13,458; xml: 3,567; makefile: 1,959; javascript: 885; pascal: 570; lisp: 7
file content (25 lines) | stat: -rwxr-xr-x 790 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash

# An important user of davix (ROOT project) does not want to depend on librt.
# This means we can only use clock_gettime on CC7, not SLC6.
#
# (clock_gettime was moved from librt onto glibc proper, starting from CC7)
#
# This script patches out libcurl support for clock_gettime entirely when building on SLC6.

set -x

if [ -f lib/curl_config.h ]; then
  echo '#include<time.h>
        int main() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return 0; }' &> test.c
  gcc test.c -o /dev/null

  if [ $? -ne 0 ]; then
    grep "HAVE_CLOCK_GETTIME" lib/curl_config.h
    sed -i "" 's|^#define HAVE_CLOCK_GETTIME_MONOTONIC 1|// #define HAVE_CLOCK_GETTIME_MONOTONIC 1|g' lib/curl_config.h
    grep "HAVE_CLOCK_GETTIME" lib/curl_config.h
  fi

  rm test.c
fi