Add missing XAW macros
[openwrt.git] / tools / missing-macros / src / m4 / xaw.m4
1 dnl Copyright 2005 Red Hat, Inc
2 dnl 
3 dnl Permission to use, copy, modify, distribute, and sell this software and its
4 dnl documentation for any purpose is hereby granted without fee, provided that
5 dnl the above copyright notice appear in all copies and that both that
6 dnl copyright notice and this permission notice appear in supporting
7 dnl documentation.
8 dnl 
9 dnl The above copyright notice and this permission notice shall be included
10 dnl in all copies or substantial portions of the Software.
11 dnl 
12 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
15 dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
16 dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
17 dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
18 dnl OTHER DEALINGS IN THE SOFTWARE.
19 dnl 
20 dnl Except as contained in this notice, the name of the copyright holders shall
21 dnl not be used in advertising or otherwise to promote the sale, use or
22 dnl other dealings in this Software without prior written authorization
23 dnl from the copyright holders.
24 dnl 
25
26 # XAW_CHECK_XPRINT_SUPPORT()
27 # --------------------------
28 # Adds --enable/disable-xprint and selects the appropriate version of the Xaw 
29 # library. If neither --enable-xprint nor --disable-xprint are given, 
30 # the presence of an Xaw with Xprint support will be auto detected
31
32 AC_DEFUN([XAW_CHECK_XPRINT_SUPPORT],[
33         AC_ARG_ENABLE(xprint, AC_HELP_STRING([--enable-xprint], [Enable XPrint support]),
34                         [use_xprint=$enableval],[use_xprint=auto])
35         if test "x$use_xprint" = "xyes"; then
36                 TMP_CHECK1=xaw8
37                 TMP_CHECK2=
38                 xaw_use_xprint=yes
39         elif test "x$use_xprint" = "xno"; then
40                 TMP_CHECK1=xaw7
41                 TMP_CHECK2=
42                 xaw_use_xprint=no
43         else
44                 TMP_CHECK1=xaw8
45                 TMP_CHECK2=xaw7
46                 xaw_use_xprint=yes
47         fi
48
49         PKG_CHECK_MODULES(TMP_XAW, $TMP_CHECK1, success=yes, success=no)
50         if [[ ! -z $TMP_CHECK2 ]] ; then
51                 if test $success = no ; then
52                         PKG_CHECK_MODULES(TMP_XAW, $TMP_CHECK2, success=yes, success=no)
53                         xaw_use_xprint=no
54                 fi
55         fi
56
57         if test "x$success" = "xyes"; then
58                 $1_CFLAGS=$TMP_XAW_CFLAGS
59                 $1_LIBS=$TMP_XAW_LIBS
60
61                 AM_CONDITIONAL([XAW_USE_XPRINT], [test "x$xaw_use_xprint" = "xyes"])
62         else
63                 AC_MSG_ERROR([No suitable version of Xaw found])
64         fi
65 ])