build (962B)
1 #!/bin/sh 2 # This file is in the public domain. 3 4 set -eu 5 workdir=$(mktemp -d) 6 trap 'rm -rf "$workdir"' EXIT 7 cat > "$workdir/test.c" <<'EOF' 8 #include <microhttpd2.h> 9 10 static const struct MHD_Action * 11 request_cb(void *cls, struct MHD_Request *request, 12 const struct MHD_String *path, enum MHD_HTTP_Method method, 13 uint_fast64_t upload_size) 14 { 15 (void) cls; 16 (void) path; 17 (void) method; 18 (void) upload_size; 19 return MHD_action_from_response(request, 20 MHD_response_from_buffer_static(MHD_HTTP_STATUS_OK, 2, "OK")); 21 } 22 23 int main(void) 24 { 25 struct MHD_Daemon *daemon = MHD_daemon_create(request_cb, NULL); 26 if (NULL == daemon) 27 return 1; 28 MHD_daemon_destroy(daemon); 29 return 0; 30 } 31 EOF 32 # pkg-config emits a list of compiler/linker arguments. 33 # shellcheck disable=SC2046 34 cc $(pkg-config --cflags libmicrohttpd2) "$workdir/test.c" \ 35 -o "$workdir/test" $(pkg-config --libs libmicrohttpd2) 36 "$workdir/test" 37 pkg-config --exists libmicrohttpd