#!/usr/bin/env sh set -e BOLD="\033[1m" RESET="\033[0m" LIGHT_RED="\033[91m" LIGHT_GREEN="\033[92m" LIGHT_CYAN="\033[96m" logging(){ local type=$1; shift printf "${LIGHT_CYAN}${BOLD}configure${RESET} [%b] : %b\n" "$type" "$*" } log_info(){ logging "${LIGHT_GREEN}info${RESET}" "$@" } log_error(){ logging "${LIGHT_RED}error${RESET}" "$@" >&2 } # find and print x11 header path get_xlib_include_path(){ local result="" for inc in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/local/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include do if [ -f "$inc/X11/Xlib.h" -a -f "$inc/X11/extensions/XShm.h" ]; then result=$inc break fi done echo $result } show_help(){ cat < Makefile.gen cat Makefile.mk | grep -v %%%% >> Makefile.gen log_info 'Generate "test/makefile.gen" from template "test/makefile.mk"' echo "INC=$xlib_inc" > test/Makefile.gen cat test/Makefile.mk | grep -v %%%% >> test/Makefile.gen log_info 'Execute "make all" from file "makefile.gen"' ${MAKE} -f Makefile.gen all log_info 'Execute "make all" from file "test/makefile.gen"' (cd test ; ${MAKE} -f Makefile.gen all ) } main "$@"