skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

gen-sysdepsh.sh (787B)


      1 #!/bin/sh
      2 
      3 cat <<EOF
      4 /* ISC license. */
      5 
      6 #ifndef SYSDEPS_H
      7 #define SYSDEPS_H
      8 
      9 #undef SKALIBS_TARGET
     10 #define SKALIBS_TARGET "$1"
     11 
     12 EOF
     13 
     14 while read k v ; do
     15   k=$(echo "${k%%:}" | tr '[:lower:]' '[:upper:]')
     16   if test ${k} != ${k##SIGNED} ; then
     17     echo "#undef SKALIBS_HASUN$k"
     18     echo "#undef SKALIBS_HAS$k"
     19     if test $v = yes ; then
     20       echo "#define SKALIBS_HAS$k"
     21     else
     22       echo "#define SKALIBS_HASUN$k"
     23     fi
     24   elif test ${k} != ${k##SIZEOF} ; then
     25     echo "#undef SKALIBS_$k"
     26     echo "#define SKALIBS_$k $v"
     27   elif test ${k} = ENDIANNESS ; then
     28     echo '#undef SKALIBS_ENDIANNESS'
     29     echo "#define SKALIBS_ENDIANNESS \"$v\""
     30   else
     31     echo "#undef SKALIBS_HAS$k"
     32     if test $v = yes ; then
     33       echo "#define SKALIBS_HAS$k"
     34     fi
     35   fi
     36   echo
     37 done
     38 
     39 echo '#endif'