check_config.sh 957 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0
  3. #
  4. # Probe for libraries and create header files to record the results. Both C
  5. # header files and Makefile include fragments are created.
  6. OUTPUT_H_FILE=local_config.h
  7. OUTPUT_MKFILE=local_config.mk
  8. tmpname=$(mktemp)
  9. tmpfile_c=${tmpname}.c
  10. tmpfile_o=${tmpname}.o
  11. # liburing
  12. echo "#include <sys/types.h>" > $tmpfile_c
  13. echo "#include <liburing.h>" >> $tmpfile_c
  14. echo "int func(void) { return 0; }" >> $tmpfile_c
  15. CC=${1:?"Usage: $0 <compiler> # example compiler: gcc"}
  16. $CC -c $tmpfile_c -o $tmpfile_o >/dev/null 2>&1
  17. if [ -f $tmpfile_o ]; then
  18. echo "#define LOCAL_CONFIG_HAVE_LIBURING 1" > $OUTPUT_H_FILE
  19. echo "IOURING_EXTRA_LIBS = -luring" > $OUTPUT_MKFILE
  20. else
  21. echo "// No liburing support found" > $OUTPUT_H_FILE
  22. echo "# No liburing support found, so:" > $OUTPUT_MKFILE
  23. echo "IOURING_EXTRA_LIBS = " >> $OUTPUT_MKFILE
  24. fi
  25. rm ${tmpname}.*