Do not log an error for missing Video info in DefineVideo, as that's fine when Vide...
[gnash.git] / macros / x11.m4
blobe85e324c0ae1778d6eb812b0a72c531eb7b3cd2a
1 dnl  
2 dnl    Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
3 dnl  
4 dnl  This program is free software; you can redistribute it and/or modify
5 dnl  it under the terms of the GNU General Public License as published by
6 dnl  the Free Software Foundation; either version 3 of the License, or
7 dnl  (at your option) any later version.
8 dnl  
9 dnl  This program is distributed in the hope that it will be useful,
10 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl  GNU General Public License for more details.
13 dnl  You should have received a copy of the GNU General Public License
14 dnl  along with this program; if not, write to the Free Software
15 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 AC_DEFUN([GNASH_PATH_X11],
20   dnl Look for the header
21   AC_ARG_WITH(x11_incl, AC_HELP_STRING([--with-x11-incl], [Directory where x11 header is]), with_x11_incl=${withval})
22   AC_CACHE_VAL(ac_cv_path_x11_incl, [
23     if test x"${with_x11_incl}" != x ; then
24       if test -f ${with_x11_incl}/X11/X.h ; then
25        ac_cv_path_x11_incl="-I`(cd ${with_x11_incl}; pwd)`"
26       else
27        AC_MSG_ERROR([${with_x11_incl} directory doesn't contain X.h])
28       fi
29     fi
30   ])
32   dnl If the path hasn't been specified, go look for it.
33   if test x"${ac_cv_path_x11_incl}" = x ; then
34     newlist="/Developer/SDKs/MacOSX10.5*.sdk/usr/include /Developer/SDKs/MacOSX10.4*.sdk/usr/include ${incllist}"
35     for i in $newlist; do
36         if test -f $i/X11/X.h; then
37             ac_cv_path_x11_incl="-I$i"
38         fi
39     done
40   fi
42   if test x"${ac_cv_path_x11_incl}" = x ; then
43     AC_CHECK_HEADERS(X11/X.h, [ac_cv_path_x11_incl=""])
44   fi
45   
46   dnl We want to know whether the headers for XShm exist.
47   if test x"${ac_cv_path_x11_incl}" != x ; then
48     includedirfound=`echo "${ac_cv_path_x11_incl}" | cut -b 3-`
49     if test -f "$includedirfound/X11/extensions/Xv.h"; then
50       xv_incl=yes
51     fi
52   fi
54   AC_MSG_CHECKING([for X11 headers])
55   if test x"${ac_cv_path_x11_incl}" != x ; then
56     dnl Don't pass -I/usr/include
57     if test x"${ac_cv_path_x11_incl}" != "x-I/usr/include"; then
58       X11_CFLAGS="${ac_cv_path_x11_incl}"
59     fi
60     AC_MSG_RESULT(${ac_cv_path_x11_incl})
61   else
62     X11_CFLAGS=""
63     AC_MSG_RESULT(none)
64   fi
66   dnl Look for the library
67   AC_ARG_WITH(x11_lib, AC_HELP_STRING([--with-x11-lib], [directory where x11 library is]), with_x11_lib=${withval})
68   AC_CACHE_VAL(ac_cv_path_x11_lib,[
69     if test x"${with_x11_lib}" != x ; then
70       if test -f ${with_x11_lib}/libX11.a -o -f ${with_x11_lib}/libX11.${shlibext}; then
71        ac_cv_path_x11_lib="-L`(cd ${with_x11_lib}; pwd)`"
72       else
73        AC_MSG_ERROR([${with_x11_lib} directory doesn't contain libx11.])
74       fi
75     fi
76   ])
78   dnl If the header doesn't exist, there is no point looking for the library.
79   if test x"${ac_cv_path_x11_incl}" != x ; then
80     newlist="/Developer/SDKs/MacOSX10.5*.sdk/usr/lib /Developer/SDKs/MacOSX10.5*.sdk/usr/X11R6/lib /Developer/SDKs/MacOSX10.4*.sdk/usr/lib /Developer/SDKs/MacOSX10.4*.sdk/usr/X11R6/lib ${libslist}"
81     for i in $newlist; do
82       if test -f $i/libX11.a -o -f $i/libX11.${shlibext}; then
83         if test ! x"${i}" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
84           ac_cv_path_x11_lib="-L$i -lX11"
85         else
86           ac_cv_path_x11_lib="-lX11"
87         fi
88         if test -f $i/libXinerama.a -o -f $i/libXinerama.${shlibext}; then
89           ac_cv_path_x11_lib="${ac_cv_path_x11_lib} -lXinerama"
90         fi
91         if test -f $i/libXext.a -o -f $i/libXext.${shlibext}; then
92           ac_cv_path_x11_lib="${ac_cv_path_x11_lib} -lXext"
93         fi
94         if test -f $i/libSM.a -o -f $i/libSM.${shlibext}; then
95           ac_cv_path_x11_lib="${ac_cv_path_x11_lib} -lSM"
96         fi
97         if test -f $i/libICE.a -o -f $i/libICE.${shlibext}; then
98           ac_cv_path_x11_lib="${ac_cv_path_x11_lib} -lICE"
99         fi
100         if test -f $i/libXv.a -o -f $i/libXv.${shlibext}; then
101           ac_cv_path_x11_lib="${ac_cv_path_x11_lib} -lXv"
102           xv_lib=yes
103         fi
104         break
105       fi
106     done
107   fi
109   for i in $newlist; do
110     if test -f $i/libXplugin.a -o -f $i/libXplugin.${shlibext}; then
111       if test ! x"${i}" = x"/usr/lib" -o x"$i" = x"/usr/lib64"; then
112         ac_cv_path_x11_lib="${ac_cv_path_x11_lib} -L$i -lXplugin"
113       else
114         ac_cv_path_x11_lib="${ac_cv_path_x11_lib} -lXplugin"
115       fi
116       break
117     fi
118   done
120   if test x"${ac_cv_path_x11_lib}" = x ; then
121     AC_CHECK_LIB(X11, x11_mem_init, [ac_cv_path_x11_lib=""])
122   fi
124   AC_MSG_CHECKING([for X11 library])
125   if test x"${ac_cv_path_x11_lib}" != x ; then
126     X11_LIBS="${ac_cv_path_x11_lib}"
127     AC_MSG_RESULT(${ac_cv_path_x11_lib})
128   else
129     X11_LIBS=""
130     AC_MSG_RESULT(none)
131   fi
133   if test -n "$X11_LIBS" -a -n "$X11_CFLAGS"; then
134     x11=yes
135   fi
137   if test "x$x11" = xyes; then
138     AC_DEFINE(HAVE_X11, [1], [X11 headers and libraries])
139   fi
140   
141   if test x"$xv_incl" != x -a x"$xv_lib" != x; then
142     AC_DEFINE(HAVE_XV, [1], [X Video extension header and library])
143   fi
144   AM_CONDITIONAL(HAVE_XV, [ test x"$xv_incl" != x -a x"$xv_lib" != x ])
146   AC_SUBST(X11_CFLAGS)
147   AC_SUBST(X11_LIBS)
150 # Local Variables:
151 # c-basic-offset: 2
152 # tab-width: 2
153 # indent-tabs-mode: nil
154 # End: