Created
October 21, 2013 13:03
-
-
Save markusfisch/7083520 to your computer and use it in GitHub Desktop.
Grep sources for system includes (e.g. for AC_CHECK_HEADERS in configure.ac)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Grep sources for system includes; e.g. for AC_CHECK_HEADERS: | |
# $ echo "AC_CHECK_HEADERS([$(./headers.sh | tr '\n' ' ')])" >> configure.ac | |
# | |
# @param ... - source files/directories | |
grep_for_includes() | |
{ | |
grep -h '#include[ ]*<' $@ | sort | uniq | while read | |
do | |
REPLY=${REPLY#*<} | |
echo ${REPLY%>} | |
done | |
} | |
grep_for_includes ${@:-*.c *.h} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment