Edit

kc3-lang/ucd2c/configure

Branch :

  • configure
  • #!/bin/sh
    ## Copyright from 2022 to 2025 kmx.io <contact@kmx.io>
    ##
    ## Permission is hereby granted to use, modify and redistribute this
    ## software or modified version of this software, granted the above
    ## copyright notice and this permission paragraph are included in all
    ## copies and substantial portions of this software.
    ##
    ## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
    ## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
    ## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
    ## THIS SOFTWARE.
    
    CONFIG_MK=".config.mk.tmp"
    echo "# config.mk generated by configure" > ${CONFIG_MK}
    
    if [ "x$CC" = "x" ]; then
        if test -n $(which cc); then
            CC=cc
        elif test -n $(which gcc); then
            CC=gcc
        fi
    fi
    echo "CC = $CC" >> ${CONFIG_MK}
    
    CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -O2 -pipe"
    echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
    
    if ! cmp "${CONFIG_MK}" config.mk >/dev/null 2>&1; then
        mv "${CONFIG_MK}" config.mk
        echo "-> ${PWD}/config.mk"
    else
        rm "${CONFIG_MK}"
    fi