zygo

ncurses gopher client
git clone https://hhvn.uk/zygo
git clone git://hhvn.uk/zygo
Log | Files | Refs

configure (1521B)


      1 #!/bin/sh
      2 
      3 CC=${CC:-cc}
      4 
      5 trap "rm -f test.c test" EXIT
      6 echo "# Generated by configure" > config.mk
      7 
      8 printf '%s' "checking for libtls... "
      9 cat > test.c <<- EOF
     10 	#include <tls.h>
     11 	int main(void) { return 0; }
     12 EOF
     13 ${CC} -ltls -o test test.c >/dev/null 2>/dev/null && {
     14 	printf '%s\n' "yes"
     15 	cat >> config.mk <<- EOF
     16 		# libretls or libtls (standalone tls.h implementation) configuration
     17 		CFLAGS	+= -DTLS
     18 		LDFLAGS	+= -ltls
     19 		SRC	+= tls.c
     20 	EOF
     21 } || {
     22 	printf '%s\n' "no"
     23 	cat >> config.mk <<- EOF
     24 		# no TLS configured
     25 		# install libretls or libtls (standalone tls.h implementation) for TLS
     26 		SRC	+= plain.c
     27 	EOF
     28 }
     29 
     30 printf '%s' "checking for libtinfow... "
     31 cat > test.c <<- EOF
     32 	#include <ncurses.h>
     33 	int main(void) { return 0; }
     34 EOF
     35 ${CC} -ltinfow -o test test.c >/dev/null 2>/dev/null && {
     36 	printf '%s\n' "yes"
     37 	cat >> config.mk <<- EOF
     38 		# linking with tinfow
     39 		# on some systems both ncursesw and tinfow must be linked
     40 		# otherwise, thank ncurses for the nondescript segfault in initscr()...
     41 		LDFLAGS += -ltinfow
     42 	EOF
     43 } || {
     44 	printf '%s\n' "no"
     45 	hastinfow=0
     46 }
     47 
     48 printf '%s' "checking for strlcat... "
     49 cat > test.c <<- EOF
     50 	#include <string.h>
     51 	int main(void) { char a[3] = {'a', 0, 0}; strlcat(a, "hello", sizeof(a)); return 0; }
     52 EOF
     53 ${CC} -o test test.c >/dev/null 2>/dev/null && ./test >/dev/null 2>/dev/null && {
     54 	printf '%s\n' "yes"
     55 } || {
     56 	printf '%s\n' "no"
     57 	cat >> config.mk <<- EOF
     58 		# linking an included version of strlcat, as your system doesn't have it
     59 		CFLAGS	+= -DZYGO_STRLCAT
     60 		SRC	+= strlcat.c
     61 	EOF
     62 }