fe

terminal file explorer and picker

git clone https://9o.is/git/fe.git

configure

(727B)


      1 #!/usr/bin/env sh
      2 
      3 h=compats.h
      4 printf "/* Generated by configure */\n\n" > $h
      5 
      6 probe_func() {
      7     def=$1
      8     ret=$2
      9     fun=$3
     10     arg="$4"
     11     shift 4;
     12     inc="$*"
     13 
     14     if printf "int main() { void *p = (void *)%s; return 0; }" "$fun" | \
     15             cc -x c -o /dev/null - >/dev/null 2>&1; then
     16         printf '#define %s 1\n' "$def" >> $h
     17     else
     18         printf '#define %s 0\n' "$def" >> $h
     19         for i in $inc; do
     20             printf '#include %s\n' "$i" >> $h
     21         done
     22         printf 'extern %s %s%s\n\n' "$ret" "$fun" "$arg" >> $h
     23     fi
     24 }
     25 
     26 probe_func HAVE_STRLCPY size_t strlcpy '(char *, const char *, size_t);' '<stddef.h>'
     27 probe_func HAVE_STRLCAT size_t strlcat '(char *, const char *, size_t);' '<stddef.h>'