# # $Id: x11.subr,v 1.11 2003/09/26 17:03:32 jmmv Exp $ # bt_config module: x11 detection # # buildtool # Copyright (c) 2003 Julio M. Merino Vidal # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # 3. Neither the name of the author nor the names of contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # x11_feature() { bt_feature X11 auto \ "Whether X11 support is wanted or not (yes, no, auto)." } x11_check() { local d found idirs ldirs if [ ${BT_FEATURE_X11:-unset} = no ]; then echo "X11 support disabled as requested" bt_msg_summary 'X11 support: no' return 0 fi idirs="${X11_DIR_INCLUDE}" idirs+="/usr/X11/include /usr/X11R6/include /usr/X11R5/include" idirs+="/usr/X11R4/include /usr/include/X11 /usr/include/X11R6" idirs+="/usr/include/X11R5 /usr/include/X11R4" idirs+="/usr/local/X11/include /usr/local/X11R6/include" idirs+="/usr/local/X11R5/include /usr/local/X11R4/include" idirs+="/usr/local/include/X11 /usr/local/include/X11R6" idirs+="/usr/local/include/X11R5 /usr/local/include/X11R4" idirs+="/usr/X386/include /usr/x386/include" idirs+="/usr/XFree86/include/X11 /usr/include /usr/local/include" idirs+="/usr/unsupported/include /usr/athena/include" idirs+="/usr/local/x11r5/include /usr/lpp/Xamples/include" idirs+="/usr/openwin/include /usr/openwin/share/include" bt_msg_chk "for X11 headers" found=no for d in ${idirs}; do if [ -f "${d}/X11/Intrinsic.h" ]; then X11_FLAGS_CPP+=-I${d} bt_subst X11_FLAGS_CPP bt_msg_result ${d} found=yes break fi done if [ ${found} = no ]; then bt_msg_result "not found." [ ${BT_FEATURE_X11:-unset} = yes ] && x11_failure bt_msg_summary 'X11 support: no' return 1 fi ldirs="${X11_DIR_LIB} $(echo ${d} | sed s/include/lib/)" ldirs+="/usr/X11/lib /usr/X11R6/lib /usr/X11R5/lib" ldirs+="/usr/X11R4/lib /usr/lib/X11 /usr/lib/X11R6" ldirs+="/usr/lib/X11R5 /usr/lib/X11R4" ldirs+="/usr/local/X11/lib /usr/local/X11R6/lib" ldirs+="/usr/local/X11R5/lib /usr/local/X11R4/lib" ldirs+="/usr/local/lib/X11 /usr/local/lib/X11R6" ldirs+="/usr/local/lib/X11R5 /usr/local/lib/X11R4" ldirs+="/usr/X386/lib /usr/x386/lib" ldirs+="/usr/XFree86/lib/X11 /usr/lib /usr/local/lib" ldirs+="/usr/unsupported/lib /usr/athena/lib" ldirs+="/usr/local/x11r5/lib /usr/lpp/Xamples/lib" ldirs+="/usr/openwin/lib /usr/openwin/share/lib" bt_msg_chk "for X11 libraries" found=no for d in ${ldirs}; do if [ -n "$(ls ${d}/libX11.* 2>/dev/null)" ]; then X11_FLAGS_LD+=-L${d} bt_subst X11_FLAGS_LD bt_msg_result "${d}" found=yes break fi done if [ ${found} = no ]; then bt_msg_result "not found." [ ${BT_FEATURE_X11:-unset} = yes ] && x11_failure bt_msg_summary 'X11 support: no' return 1 fi if [ ${BT_FEATURE_X11:-unset} != unset ]; then bt_msg_summary 'X11 support: yes' fi return 0 } x11_failure() { bt_err "Cannot locate required X11 headers/libraries." \ "Try to pass the \`--disable-x11' flag to the configure script" \ "to disable X11 detection." \ "If X11 is installed, set X11_DIR_INCLUDE and X11_DIR_LIB accordingly." } # Local Variables: *** # mode: shell-script *** # End: *** # vim: syntax=sh