1# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
2
3# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15m4_ifndef([AC_AUTOCONF_VERSION],
16  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18[m4_warning([this file was generated for autoconf 2.69.
19You have another version of autoconf.  It may work, but is not guaranteed to.
20If you have problems, you may need to regenerate the build system entirely.
21To do so, use the procedure documented by the package, typically 'autoreconf'.])])
22
23# ===========================================================================
24#       http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
25# ===========================================================================
26#
27# SYNOPSIS
28#
29#   AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
30#
31# DESCRIPTION
32#
33#   Test for the Boost C++ libraries of a particular version (or newer)
34#
35#   If no path to the installed boost library is given the macro searchs
36#   under /usr, /usr/local, /opt and /opt/local and evaluates the
37#   $BOOST_ROOT environment variable. Further documentation is available at
38#   <http://randspringer.de/boost/index.html>.
39#
40#   This macro calls:
41#
42#     AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
43#
44#   And sets:
45#
46#     HAVE_BOOST
47#
48# LICENSE
49#
50#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
51#   Copyright (c) 2009 Peter Adolphs
52#
53#   Copying and distribution of this file, with or without modification, are
54#   permitted in any medium without royalty provided the copyright notice
55#   and this notice are preserved. This file is offered as-is, without any
56#   warranty.
57
58#serial 21
59
60AC_DEFUN([AX_BOOST_BASE],
61[
62AC_ARG_WITH([boost],
63  [AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
64    [use Boost library from a standard location (ARG=yes),
65     from the specified location (ARG=<path>),
66     or disable it (ARG=no)
67     @<:@ARG=yes@:>@ ])],
68    [
69    if test "$withval" = "no"; then
70        want_boost="no"
71    elif test "$withval" = "yes"; then
72        want_boost="yes"
73        ac_boost_path=""
74    else
75        want_boost="yes"
76        ac_boost_path="$withval"
77    fi
78    ],
79    [want_boost="yes"])
80
81
82AC_ARG_WITH([boost-libdir],
83        AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
84        [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
85        [
86        if test -d "$withval"
87        then
88                ac_boost_lib_path="$withval"
89        else
90                AC_MSG_ERROR(--with-boost-libdir expected directory name)
91        fi
92        ],
93        [ac_boost_lib_path=""]
94)
95
96if test "x$want_boost" = "xyes"; then
97    boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
98    boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
99    boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
100    boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
101    boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
102    if test "x$boost_lib_version_req_sub_minor" = "x" ; then
103        boost_lib_version_req_sub_minor="0"
104        fi
105    WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
106    AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
107    succeeded=no
108
109    dnl On 64-bit systems check for system libraries in both lib64 and lib.
110    dnl The former is specified by FHS, but e.g. Debian does not adhere to
111    dnl this (as it rises problems for generic multi-arch support).
112    dnl The last entry in the list is chosen by default when no libraries
113    dnl are found, e.g. when only header-only libraries are installed!
114    libsubdirs="lib"
115    ax_arch=`uname -m`
116    case $ax_arch in
117      x86_64|ppc64|s390x|sparc64|aarch64)
118        libsubdirs="lib64 lib lib64"
119        ;;
120    esac
121
122    dnl first we check the system location for boost libraries
123    dnl this location ist chosen if boost libraries are installed with the --layout=system option
124    dnl or if you install boost with RPM
125    if test "$ac_boost_path" != ""; then
126        BOOST_CPPFLAGS="-I$ac_boost_path/include"
127        for ac_boost_path_tmp in $libsubdirs; do
128                if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
129                        BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
130                        break
131                fi
132        done
133    elif test "$cross_compiling" != yes; then
134        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
135            if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
136                for libsubdir in $libsubdirs ; do
137                    if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
138                done
139                BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
140                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
141                break;
142            fi
143        done
144    fi
145
146    dnl overwrite ld flags if we have required special directory with
147    dnl --with-boost-libdir parameter
148    if test "$ac_boost_lib_path" != ""; then
149       BOOST_LDFLAGS="-L$ac_boost_lib_path"
150    fi
151
152    CPPFLAGS_SAVED="$CPPFLAGS"
153    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
154    export CPPFLAGS
155
156    LDFLAGS_SAVED="$LDFLAGS"
157    LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
158    export LDFLAGS
159
160    AC_REQUIRE([AC_PROG_CXX])
161    AC_LANG_PUSH(C++)
162        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
163    @%:@include <boost/version.hpp>
164    ]], [[
165    #if BOOST_VERSION >= $WANT_BOOST_VERSION
166    // Everything is okay
167    #else
168    #  error Boost version is too old
169    #endif
170    ]])],[
171        AC_MSG_RESULT(yes)
172    succeeded=yes
173    found_system=yes
174        ],[
175        ])
176    AC_LANG_POP([C++])
177
178
179
180    dnl if we found no boost with system layout we search for boost libraries
181    dnl built and installed without the --layout=system option or for a staged(not installed) version
182    if test "x$succeeded" != "xyes"; then
183        _version=0
184        if test "$ac_boost_path" != ""; then
185            if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
186                for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
187                    _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
188                    V_CHECK=`expr $_version_tmp \> $_version`
189                    if test "$V_CHECK" = "1" ; then
190                        _version=$_version_tmp
191                    fi
192                    VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
193                    BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
194                done
195            fi
196        else
197            if test "$cross_compiling" != yes; then
198                for ac_boost_path in /usr /usr/local /opt /opt/local ; do
199                    if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
200                        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
201                            _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
202                            V_CHECK=`expr $_version_tmp \> $_version`
203                            if test "$V_CHECK" = "1" ; then
204                                _version=$_version_tmp
205                                best_path=$ac_boost_path
206                            fi
207                        done
208                    fi
209                done
210
211                VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
212                BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
213                if test "$ac_boost_lib_path" = ""; then
214                    for libsubdir in $libsubdirs ; do
215                        if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
216                    done
217                    BOOST_LDFLAGS="-L$best_path/$libsubdir"
218                fi
219            fi
220
221            if test "x$BOOST_ROOT" != "x"; then
222                for libsubdir in $libsubdirs ; do
223                    if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
224                done
225                if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
226                    version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
227                    stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
228                        stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
229                    V_CHECK=`expr $stage_version_shorten \>\= $_version`
230                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
231                        AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
232                        BOOST_CPPFLAGS="-I$BOOST_ROOT"
233                        BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
234                    fi
235                fi
236            fi
237        fi
238
239        CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
240        export CPPFLAGS
241        LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
242        export LDFLAGS
243
244        AC_LANG_PUSH(C++)
245            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
246        @%:@include <boost/version.hpp>
247        ]], [[
248        #if BOOST_VERSION >= $WANT_BOOST_VERSION
249        // Everything is okay
250        #else
251        #  error Boost version is too old
252        #endif
253        ]])],[
254            AC_MSG_RESULT(yes)
255        succeeded=yes
256        found_system=yes
257            ],[
258            ])
259        AC_LANG_POP([C++])
260    fi
261
262    if test "$succeeded" != "yes" ; then
263        if test "$_version" = "0" ; then
264            AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
265        else
266            AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
267        fi
268        # execute ACTION-IF-NOT-FOUND (if present):
269        ifelse([$3], , :, [$3])
270    else
271        AC_SUBST(BOOST_CPPFLAGS)
272        AC_SUBST(BOOST_LDFLAGS)
273        AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
274        # execute ACTION-IF-FOUND (if present):
275        ifelse([$2], , :, [$2])
276    fi
277
278    CPPFLAGS="$CPPFLAGS_SAVED"
279    LDFLAGS="$LDFLAGS_SAVED"
280fi
281
282])
283
284# ===========================================================================
285#    http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
286# ===========================================================================
287#
288# SYNOPSIS
289#
290#   AX_BOOST_FILESYSTEM
291#
292# DESCRIPTION
293#
294#   Test for Filesystem library from the Boost C++ libraries. The macro
295#   requires a preceding call to AX_BOOST_BASE. Further documentation is
296#   available at <http://randspringer.de/boost/index.html>.
297#
298#   This macro calls:
299#
300#     AC_SUBST(BOOST_FILESYSTEM_LIB)
301#
302#   And sets:
303#
304#     HAVE_BOOST_FILESYSTEM
305#
306# LICENSE
307#
308#   Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
309#   Copyright (c) 2009 Michael Tindal
310#   Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
311#
312#   Copying and distribution of this file, with or without modification, are
313#   permitted in any medium without royalty provided the copyright notice
314#   and this notice are preserved. This file is offered as-is, without any
315#   warranty.
316
317#serial 26
318
319AC_DEFUN([AX_BOOST_FILESYSTEM],
320[
321	AC_ARG_WITH([boost-filesystem],
322	AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
323                   [use the Filesystem library from boost - it is possible to specify a certain library for the linker
324                        e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
325        [
326        if test "$withval" = "no"; then
327			want_boost="no"
328        elif test "$withval" = "yes"; then
329            want_boost="yes"
330            ax_boost_user_filesystem_lib=""
331        else
332		    want_boost="yes"
333		ax_boost_user_filesystem_lib="$withval"
334		fi
335        ],
336        [want_boost="yes"]
337	)
338
339	if test "x$want_boost" = "xyes"; then
340        AC_REQUIRE([AC_PROG_CC])
341		CPPFLAGS_SAVED="$CPPFLAGS"
342		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
343		export CPPFLAGS
344
345		LDFLAGS_SAVED="$LDFLAGS"
346		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
347		export LDFLAGS
348
349		LIBS_SAVED=$LIBS
350		LIBS="$LIBS $BOOST_SYSTEM_LIB"
351		export LIBS
352
353        AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
354					   ax_cv_boost_filesystem,
355        [AC_LANG_PUSH([C++])
356         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
357                                   [[using namespace boost::filesystem;
358                                   path my_path( "foo/bar/data.txt" );
359                                   return 0;]])],
360					       ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
361         AC_LANG_POP([C++])
362		])
363		if test "x$ax_cv_boost_filesystem" = "xyes"; then
364			AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
365            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
366            if test "x$ax_boost_user_filesystem_lib" = "x"; then
367                for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
368                     ax_lib=${libextension}
369				    AC_CHECK_LIB($ax_lib, exit,
370                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
371                                 [link_filesystem="no"])
372				done
373                if test "x$link_filesystem" != "xyes"; then
374                for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
375                     ax_lib=${libextension}
376				    AC_CHECK_LIB($ax_lib, exit,
377                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
378                                 [link_filesystem="no"])
379				done
380		    fi
381            else
382               for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
383				      AC_CHECK_LIB($ax_lib, exit,
384                                   [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
385                                   [link_filesystem="no"])
386                  done
387
388            fi
389            if test "x$ax_lib" = "x"; then
390                AC_MSG_ERROR(Could not find a version of the library!)
391            fi
392			if test "x$link_filesystem" != "xyes"; then
393				AC_MSG_ERROR(Could not link against $ax_lib !)
394			fi
395		fi
396
397		CPPFLAGS="$CPPFLAGS_SAVED"
398		LDFLAGS="$LDFLAGS_SAVED"
399		LIBS="$LIBS_SAVED"
400	fi
401])
402
403# ===========================================================================
404#      http://www.gnu.org/software/autoconf-archive/ax_boost_system.html
405# ===========================================================================
406#
407# SYNOPSIS
408#
409#   AX_BOOST_SYSTEM
410#
411# DESCRIPTION
412#
413#   Test for System library from the Boost C++ libraries. The macro requires
414#   a preceding call to AX_BOOST_BASE. Further documentation is available at
415#   <http://randspringer.de/boost/index.html>.
416#
417#   This macro calls:
418#
419#     AC_SUBST(BOOST_SYSTEM_LIB)
420#
421#   And sets:
422#
423#     HAVE_BOOST_SYSTEM
424#
425# LICENSE
426#
427#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
428#   Copyright (c) 2008 Michael Tindal
429#   Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
430#
431#   Copying and distribution of this file, with or without modification, are
432#   permitted in any medium without royalty provided the copyright notice
433#   and this notice are preserved. This file is offered as-is, without any
434#   warranty.
435
436#serial 17
437
438AC_DEFUN([AX_BOOST_SYSTEM],
439[
440	AC_ARG_WITH([boost-system],
441	AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
442                   [use the System library from boost - it is possible to specify a certain library for the linker
443                        e.g. --with-boost-system=boost_system-gcc-mt ]),
444        [
445        if test "$withval" = "no"; then
446			want_boost="no"
447        elif test "$withval" = "yes"; then
448            want_boost="yes"
449            ax_boost_user_system_lib=""
450        else
451		    want_boost="yes"
452		ax_boost_user_system_lib="$withval"
453		fi
454        ],
455        [want_boost="yes"]
456	)
457
458	if test "x$want_boost" = "xyes"; then
459        AC_REQUIRE([AC_PROG_CC])
460        AC_REQUIRE([AC_CANONICAL_BUILD])
461		CPPFLAGS_SAVED="$CPPFLAGS"
462		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
463		export CPPFLAGS
464
465		LDFLAGS_SAVED="$LDFLAGS"
466		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
467		export LDFLAGS
468
469        AC_CACHE_CHECK(whether the Boost::System library is available,
470					   ax_cv_boost_system,
471        [AC_LANG_PUSH([C++])
472			 CXXFLAGS_SAVE=$CXXFLAGS
473
474			 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
475                                   [[boost::system::system_category]])],
476                   ax_cv_boost_system=yes, ax_cv_boost_system=no)
477			 CXXFLAGS=$CXXFLAGS_SAVE
478             AC_LANG_POP([C++])
479		])
480		if test "x$ax_cv_boost_system" = "xyes"; then
481			AC_SUBST(BOOST_CPPFLAGS)
482
483			AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available])
484            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
485
486			LDFLAGS_SAVE=$LDFLAGS
487            if test "x$ax_boost_user_system_lib" = "x"; then
488                for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
489                     ax_lib=${libextension}
490				    AC_CHECK_LIB($ax_lib, exit,
491                                 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
492                                 [link_system="no"])
493				done
494                if test "x$link_system" != "xyes"; then
495                for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
496                     ax_lib=${libextension}
497				    AC_CHECK_LIB($ax_lib, exit,
498                                 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
499                                 [link_system="no"])
500				done
501                fi
502
503            else
504               for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
505				      AC_CHECK_LIB($ax_lib, exit,
506                                   [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
507                                   [link_system="no"])
508                  done
509
510            fi
511            if test "x$ax_lib" = "x"; then
512                AC_MSG_ERROR(Could not find a version of the library!)
513            fi
514			if test "x$link_system" = "xno"; then
515				AC_MSG_ERROR(Could not link against $ax_lib !)
516			fi
517		fi
518
519		CPPFLAGS="$CPPFLAGS_SAVED"
520	LDFLAGS="$LDFLAGS_SAVED"
521	fi
522])
523
524# ===========================================================================
525#        http://www.gnu.org/software/autoconf-archive/ax_check_gl.html
526# ===========================================================================
527#
528# SYNOPSIS
529#
530#   AX_CHECK_GL
531#
532# DESCRIPTION
533#
534#   Check for an OpenGL implementation. If GL is found, the required
535#   compiler and linker flags are included in the output variables
536#   "GL_CFLAGS", "GL_LIBS", "GL_LDFLAGS", respectively. If no usable GL
537#   implementation is found, "no_gl" is set to "yes".
538#
539#   You could disable OpenGL using --with-gl=no
540#
541#   You could choose a specific OpenGL libs using --with-gl=lib_name
542#
543#   Under darwin, cygwin and mingw target you could prefer the OpenGL
544#   implementation that link with X setting --with-gl=x or without X support
545#   with --with-gl=nox. Notes that this script try to guess the right
546#   implementation.
547#
548#   If the header "GL/gl.h" is found, "HAVE_GL_GL_H" is defined. If the
549#   header "OpenGL/gl.h" is found, HAVE_OPENGL_GL_H is defined. These
550#   preprocessor definitions may not be mutually exclusive.
551#
552#   You should use something like this in your headers:
553#
554#     #if defined(HAVE_WINDOWS_H) && defined(_WIN32)
555#     # include <windows.h>
556#     #endif
557#     #ifdef HAVE_GL_GL_H
558#     # include <GL/gl.h>
559#     #elif defined(HAVE_OPENGL_GL_H)
560#     # include <OpenGL/gl.h>
561#     #else
562#     # error no gl.h
563#     #endif
564#
565# LICENSE
566#
567#   Copyright (c) 2009 Braden McDaniel <braden@endoframe.com>
568#   Copyright (c) 2012 Bastien Roucaries <roucaries.bastien+autoconf@gmail.com>
569#
570#   This program is free software; you can redistribute it and/or modify it
571#   under the terms of the GNU General Public License as published by the
572#   Free Software Foundation; either version 2 of the License, or (at your
573#   option) any later version.
574#
575#   This program is distributed in the hope that it will be useful, but
576#   WITHOUT ANY WARRANTY; without even the implied warranty of
577#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
578#   Public License for more details.
579#
580#   You should have received a copy of the GNU General Public License along
581#   with this program. If not, see <http://www.gnu.org/licenses/>.
582#
583#   As a special exception, the respective Autoconf Macro's copyright owner
584#   gives unlimited permission to copy, distribute and modify the configure
585#   scripts that are the output of Autoconf when processing the Macro. You
586#   need not follow the terms of the GNU General Public License when using
587#   or distributing such scripts, even though portions of the text of the
588#   Macro appear in them. The GNU General Public License (GPL) does govern
589#   all other use of the material that constitutes the Autoconf Macro.
590#
591#   This special exception to the GPL applies to versions of the Autoconf
592#   Macro released by the Autoconf Archive. When you make and distribute a
593#   modified version of the Autoconf Macro, you may extend this special
594#   exception to the GPL to apply to your modified version as well.
595
596#serial 15
597
598m4_define([_AX_CHECK_GL_PROGRAM],
599          [AC_LANG_PROGRAM([[
600# if defined(HAVE_WINDOWS_H) && defined(_WIN32)
601#   include <windows.h>
602# endif
603# ifdef HAVE_GL_GL_H
604#   include <GL/gl.h>
605# elif defined(HAVE_OPENGL_GL_H)
606#   include <OpenGL/gl.h>
607# else
608#   error no gl.h
609# endif
610]],[[glBegin(0)]])])
611
612dnl Default include : add windows.h
613dnl see http://www.opengl.org/wiki/Platform_specifics:_Windows
614dnl (acceded 20120801)
615AC_DEFUN([_AX_CHECK_GL_INCLUDES_DEFAULT],dnl
616[
617  AC_INCLUDES_DEFAULT
618  [
619  # if defined(HAVE_WINDOWS_H) && defined(_WIN32)
620  #   include <windows.h>
621  # endif
622  ]
623])
624
625dnl local save flags
626AC_DEFUN([_AX_CHECK_GL_SAVE_FLAGS],
627[dnl
628ax_check_gl_saved_libs="${LIBS}"
629ax_check_gl_saved_cflags="${CFLAGS}"
630ax_check_gl_saved_cppflags="${CPPFLAGS}"
631ax_check_gl_saved_ldflags="${LDFLAGS}"
632])
633
634dnl local restore flags
635AC_DEFUN([_AX_CHECK_GL_RESTORE_FLAGS],
636[dnl
637LIBS="${ax_check_gl_saved_libs}"
638CFLAGS="${ax_check_gl_saved_cflags}"
639CPPFLAGS="${ax_check_gl_saved_cppflags}"
640LDFLAGS="${ax_check_gl_saved_ldflags}"
641])
642
643# set the varible ax_check_gl_need_x
644# this variable determine if we need opengl that link with X
645# value are default aka try the first library wether if it link or not with x
646# yes that means we need a opengl with x
647# no that means we do not need an opengl with x
648AC_DEFUN([_AX_CHECK_GL_NEED_X],
649[dnl
650 # do not check if empty : allow a subroutine to modify the choice
651 AS_IF([test "X$ax_check_gl_need_x" = "X"],
652       [ax_check_gl_need_x="default"
653        AS_IF([test "X$no_x" = "Xyes"],[ax_check_gl_need_x="no"])
654        AS_IF([test "X$ax_check_gl_want_gl" = "Xnox"],[ax_check_gl_need_x="no"])
655        AS_IF([test "X$ax_check_gl_want_gl" = "Xx"],[ax_check_gl_need_x="yes"])])
656])
657
658# compile the example program
659AC_DEFUN([_AX_CHECK_GL_COMPILE],
660[dnl
661 AC_LANG_PUSH([C])
662 _AX_CHECK_GL_SAVE_FLAGS()
663 CFLAGS="${GL_CFLAGS} ${CFLAGS}"
664 AC_COMPILE_IFELSE([_AX_CHECK_GL_PROGRAM],
665                   [ax_check_gl_compile_opengl="yes"],
666                   [ax_check_gl_compile_opengl="no"])
667 _AX_CHECK_GL_RESTORE_FLAGS()
668 AC_LANG_POP([C])
669])
670
671# compile the example program (cache)
672AC_DEFUN([_AX_CHECK_GL_COMPILE_CV],
673[dnl
674 AC_CACHE_CHECK([for compiling a minimal OpenGL program],[ax_cv_check_gl_compile_opengl],
675                [_AX_CHECK_GL_COMPILE()
676                 ax_cv_check_gl_compile_opengl="${ax_check_gl_compile_opengl}"])
677 ax_check_gl_compile_opengl="${ax_cv_check_gl_compile_opengl}"
678])
679
680# link the example program
681AC_DEFUN([_AX_CHECK_GL_LINK],
682[dnl
683 AC_LANG_PUSH([C])
684 _AX_CHECK_GL_SAVE_FLAGS()
685 CFLAGS="${GL_CFLAGS} ${CFLAGS}"
686 LIBS="${GL_LIBS} ${LIBS}"
687 LDFLAGS="${GL_LDFLAGS} ${LDFLAGS}"
688 AC_LINK_IFELSE([_AX_CHECK_GL_PROGRAM],
689                [ax_check_gl_link_opengl="yes"],
690                [ax_check_gl_link_opengl="no"])
691 _AX_CHECK_GL_RESTORE_FLAGS()
692 AC_LANG_POP([C])
693])
694
695# link the example program (cache)
696AC_DEFUN([_AX_CHECK_GL_LINK_CV],
697[dnl
698 AC_CACHE_CHECK([for linking a minimal OpenGL program],[ax_cv_check_gl_link_opengl],
699                [_AX_CHECK_GL_LINK()
700                 ax_cv_check_gl_link_opengl="${ax_check_gl_link_opengl}"])
701 ax_check_gl_link_opengl="${ax_cv_check_gl_link_opengl}"
702])
703
704dnl Check headers manually (default case)
705AC_DEFUN([_AX_CHECK_GL_MANUAL_HEADERS_DEFAULT],
706[AC_REQUIRE([AC_PATH_XTRA])
707 AC_LANG_PUSH([C])
708 _AX_CHECK_GL_SAVE_FLAGS()
709 CFLAGS="${GL_CFLAGS} ${CFLAGS}"
710 # see comment in _AX_CHECK_GL_INCLUDES_DEFAULT
711 AC_CHECK_HEADERS([windows.h],[],[],[AC_INCLUDES_DEFAULT])
712 # FIXME: use extra cflags
713 AC_CHECK_HEADERS([GL/gl.h],[ax_check_gl_have_headers="yes"],
714                            [ax_check_gl_have_headers_headers="no"],
715			    [_AX_CHECK_GL_INCLUDES_DEFAULT()])
716 # do not try darwin specific OpenGl/gl.h
717 _AX_CHECK_GL_RESTORE_FLAGS()
718 AC_LANG_POP([C])
719])
720
721# darwin headers without X
722AC_DEFUN([_AX_CHECK_GL_MANUAL_HEADERS_DARWIN_NOX],[
723 AC_LANG_PUSH([C])
724 _AX_CHECK_GL_SAVE_FLAGS()
725 # FIXME: use -framework opengl as an extra cflags
726 CFLAGS="-framework opengl ${GL_CFLAGS} ${CFLAGS}"
727 AC_CHECK_HEADERS([OpenGL/gl.h],[ax_check_gl_have_headers="yes"],
728                                [ax_check_gl_have_headers_headers="no"],
729			        [_AX_CHECK_GL_INCLUDES_DEFAULT()])
730 AS_IF([test "X$ax_check_gl_have_headers" = "yes"],
731       [GL_CFLAGS="-framework opengl ${GL_CFLAGS}"])
732 _AX_CHECK_GL_SAVE_FLAGS()
733 AC_LANG_POP([C])
734])
735
736# check header for darwin
737AC_DEFUN([_AX_CHECK_GL_MANUAL_HEADERS_DARWIN],
738[AC_REQUIRE([_AX_CHECK_GL_NEED_X])dnl
739 AS_CASE([$ax_check_gl_need_x],
740         # try to get X libs if possible do not use framework
741         [yes],[_AX_CHECK_GL_MANUAL_HEADERS_DEFAULT()]
742	 [no],[_AX_CHECK_GL_MANUAL_HEADERS_DARWIN_NOX()]
743	 # per default use framework that will select if possible no_x version
744	 [_AX_CHECK_GL_MANUAL_HEADERS_DARWIN_NOX()
745	  # if not found set that we need x in order to found the good library
746	  AS_IF([test "X$ax_check_gl_have_headers" = "yes"],
747	        [ax_check_gl_need_x="no"],
748		[ax_check_gl_need_x="yes"
749		 # retry with general test
750	  	 _AX_CHECK_GL_MANUAL_HEADERS_DEFAULT()])
751 ])
752])
753
754dnl Check headers manually: subroutine must set ax_check_gl_have_headers={yes,no}
755AC_DEFUN([_AX_CHECK_GL_MANUAL_HEADERS],
756[AC_REQUIRE([AC_CANONICAL_HOST])
757 AS_CASE([${host}],
758         [*-darwin*],[_AX_CHECK_GL_MANUAL_HEADERS_DARWIN],
759	 [_AX_CHECK_GL_MANUAL_HEADERS_DEFAULT()])
760 AC_CACHE_CHECK([for OpenGL headers],[ax_cv_check_gl_have_headers],
761               	[ax_cv_check_gl_have_headers="${ax_check_gl_have_headers}"])
762])
763
764# dnl try to found library (generic case)
765# dnl $1 is set to the library to found
766AC_DEFUN([_AX_CHECK_GL_MANUAL_LIBS_GENERIC],
767[dnl
768 ax_check_gl_manual_libs_generic_extra_libs="$1"
769 AS_IF([test "X$ax_check_gl_manual_libs_generic_extra_libs" = "X"],
770       [AC_MSG_ERROR([AX_CHECK_GL_MANUAL_LIBS_GENERIC argument must no be empty])])
771
772 AC_LANG_PUSH([C])
773 _AX_CHECK_GL_SAVE_FLAGS()
774 CFLAGS="${GL_CFLAGS} ${CFLAGS}"
775 LIBS="${GL_LIBS} ${LIBS}"
776 AC_SEARCH_LIBS([glBegin],[$ax_check_gl_manual_libs_generic_extra_libs],
777                [ax_check_gl_lib_opengl="yes"],
778                [ax_check_gl_lib_opengl="no"])
779 AS_CASE([$ac_cv_search_glBegin],
780         ["none required"],[],
781 	 [no],[],
782 	 [GL_LIBS="${ac_cv_search_glBegin} ${GL_LIBS}"])
783  _AX_CHECK_GL_RESTORE_FLAGS()
784  AC_LANG_PUSH([C])
785])
786
787# dnl try to found lib under darwin
788# darwin opengl hack
789# see http://web.archive.org/web/20090410052741/http://developer.apple.com/qa/qa2007/qa1567.html
790# and http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/
791AC_DEFUN([_AX_CHECK_GL_MANUAL_LIBS_DARWIN],
792[# ldhack list
793 ldhack1 = "-Wl,-framework,OpenGL"
794 ldhack2 = "-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
795 ldhack3 = "$ldhack1,$ldhack2"
796
797 # select hack
798 AS_IF([test "X$ax_check_gl_need_x" = "Xyes"],
799       [# libs already set by -framework cflag
800        darwinlibs=""
801        ldhacks="$ldhack1 $ldhack2 $ldhack3"],
802       [# do not use framework ldflags in case of x version
803        darwinlibs="GL gl MesaGL"
804        ldhack="$ldhack2"])
805
806 ax_check_gl_link_opengl="no"
807 for extralibs in " " $darwinlibs; do
808   for extraldflags in " " ldhacks; do
809       AC_LANG_PUSH([C])
810        _AX_CHECK_GL_SAVE_FLAGS()
811       CFLAGS="${GL_CFLAGS} ${CFLAGS}"
812       LIBS="$extralibs ${GL_LIBS} ${LIBS}"
813       LDFLAGS="$extraldflags ${GL_LDFLAGS} ${LDFLAGS}"
814       AC_LINK_IFELSE([_AX_CHECK_GL_PROGRAM],
815                      [ax_check_gl_link_opengl="yes"],
816                      [ax_check_gl_link_opengl="no"])
817       _AX_CHECK_GL_RESTORE_FLAGS()
818       AC_LANG_POP([C])
819       AS_IF([test "X$ax_check_gl_link_opengl" = "Xyes"],[break])
820   done;
821   AS_IF([test "X$ax_check_gl_link_opengl" = "Xyes"],[break])
822 done;
823 GL_LIBS="$extralibs ${GL_LIBS}"
824 GL_LDFLAGS="$extraldflags ${GL_LDFLAGS}"
825])
826
827dnl Check library manually: subroutine must set
828dnl $ax_check_gl_lib_opengl={yes,no}
829AC_DEFUN([_AX_CHECK_GL_MANUAL_LIBS],
830[AC_REQUIRE([AC_CANONICAL_HOST])
831 AS_CASE([${host}],
832         [*-darwin*],[_AX_CHECK_GL_MANUAL_LIBS_DARWIN()],
833         # try first cygwin version
834         [*-cygwin*],[_AX_CHECK_GL_MANUAL_LIBS_GENERIC([GL gl MesaGL opengl32])],
835         # try first native
836	 [*-mingw*],[_AX_CHECK_GL_MANUAL_LIBS_GENERIC([opengl32 GL gl MesaGL])],
837	 [_AX_CHECK_GL_MANUAL_LIBS_GENERIC([GL gl MesaGL])])
838
839 AC_CACHE_CHECK([for OpenGL libraries],[ax_cv_check_gl_lib_opengl],
840               	[ax_cv_check_gl_lib_opengl="${ax_check_gl_lib_opengl}"])
841 ax_check_gl_lib_opengl="${ax_cv_check_gl_lib_opengl}"
842])
843
844# manually check aka old way
845AC_DEFUN([_AX_CHECK_GL_MANUAL],
846[AC_REQUIRE([AC_CANONICAL_HOST])dnl
847 AC_REQUIRE([AC_PATH_XTRA])dnl
848
849 no_gl="yes"
850
851 _AX_CHECK_GL_MANUAL_HEADERS()
852 AS_IF([test "X$ax_check_gl_have_headers" = "Xyes"],
853       [_AX_CHECK_GL_COMPILE_CV()],
854       [ax_check_gl_compile_opengl=no])
855
856 AS_IF([test "X$ax_check_gl_compile_opengl" = "Xyes"],
857       [_AX_CHECK_GL_MANUAL_LIBS],
858       [ax_check_gl_lib_opengl=no])
859
860 AS_IF([test "X$ax_check_gl_lib_opengl" = "Xyes"],
861       [_AX_CHECK_GL_LINK_CV()],
862       [ax_check_gl_link_opengl=no])
863
864 AS_IF([test "X$ax_check_gl_link_opengl" = "Xyes"],
865       [no_gl="no"],
866       [no_gl="yes"])
867])dnl
868
869
870# try to test using pkgconfig: set ax_check_gl_pkg_config=no if not found
871AC_DEFUN([_AX_CHECK_GL_PKG_CONFIG],dnl
872[dnl
873 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
874
875 PKG_CHECK_MODULES([GL],[gl],[ax_check_gl_pkg_config=yes],[ax_check_gl_pkg_config=no])
876 AS_IF([test "X$ax_check_gl_pkg_config" = "Xyes"],[
877        # check headers
878        AC_LANG_PUSH([C])
879 	_AX_CHECK_GL_SAVE_FLAGS()
880        CFLAGS="${GL_CFLAGS} ${CFLAGS}"
881        AC_CHECK_HEADERS([windows.h],[],[],[AC_INCLUDES_DEFAULT])
882        AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h],
883                         [ax_check_gl_have_headers="yes";break],
884                         [ax_check_gl_have_headers_headers="no"],
885			 [_AX_CHECK_GL_INCLUDES_DEFAULT()])
886        _AX_CHECK_GL_RESTORE_FLAGS()
887	AC_LANG_POP([C])
888	AC_CACHE_CHECK([for OpenGL headers],[ax_cv_check_gl_have_headers],
889               	       [ax_cv_check_gl_have_headers="${ax_check_gl_have_headers}"])
890
891        # pkgconfig library are suposed to work ...
892        AS_IF([test "X$ax_cv_check_gl_have_headers" = "Xno"],
893              [AC_MSG_ERROR("Pkgconfig detected OpenGL library has no headers!")])
894
895	_AX_CHECK_GL_COMPILE_CV()
896	AS_IF([test "X$ax_cv_check_gl_compile_opengl" = "Xno"],
897              [AC_MSG_ERROR("Pkgconfig detected opengl library could not be used for compiling minimal program!")])
898
899	_AX_CHECK_GL_LINK_CV()
900	AS_IF([test "X$ax_cv_check_gl_link_opengl" = "Xno"],
901              [AC_MSG_ERROR("Pkgconfig detected opengl library could not be used for linking minimal program!")])
902  ])
903])
904
905# test if gl link with X
906AC_DEFUN([_AX_CHECK_GL_WITH_X],
907[
908 # try if opengl need X
909 AC_LANG_PUSH([C])
910 _AX_CHECK_GL_SAVE_FLAGS()
911 CFLAGS="${GL_CFLAGS} ${CFLAGS}"
912 LIBS="${GL_LIBS} ${LIBS}"
913 LDFLAGS="${GL_LDFLAGS} ${LDFLAGS}"
914 AC_LINK_IFELSE([AC_LANG_CALL([], [glXQueryVersion])],
915                [ax_check_gl_link_implicitly_with_x="yes"],
916   	        [ax_check_gl_link_implicitly_with_x="no"])
917 _AX_CHECK_GL_RESTORE_FLAGS()
918 AC_LANG_POP([C])
919])
920
921# internal routine: entry point if gl not disable
922AC_DEFUN([_AX_CHECK_GL],[dnl
923 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
924 AC_REQUIRE([AC_PATH_X])dnl
925
926 # does we need X or not
927 _AX_CHECK_GL_NEED_X()
928
929 # try first pkgconfig
930 AC_MSG_CHECKING([for a working OpenGL implementation by pkg-config])
931 AS_IF([test "X${PKG_CONFIG}" = "X"],
932       [ AC_MSG_RESULT([no])
933         ax_check_gl_pkg_config=no],
934       [ AC_MSG_RESULT([yes])
935         _AX_CHECK_GL_PKG_CONFIG()])
936
937 # if no pkgconfig or pkgconfig fail try manual way
938 AS_IF([test "X$ax_check_gl_pkg_config" = "Xno"],
939       [_AX_CHECK_GL_MANUAL()],
940       [no_gl=no])
941
942
943 # test if need to test X compatibility
944 AS_IF([test $no_gl = no],
945       [# test X compatibility
946 	AS_IF([test X$ax_check_gl_need_x != "Xdefault"],
947       	      [AC_CACHE_CHECK([wether OpenGL link implictly with X],[ax_cv_check_gl_link_with_x],
948                              [_AX_CHECK_GL_WITH_X()
949                               ax_cv_check_gl_link_with_x="${ax_check_gl_link_implicitly_with_x}"])
950                               AS_IF([test "X${ax_cv_check_gl_link_with_x}" = "X${ax_check_gl_need_x}"],
951                                     [no_gl="no"],
952                                     [no_gl=yes])])
953	     ])
954])
955
956# ax_check_gl entry point
957AC_DEFUN([AX_CHECK_GL],
958[AC_REQUIRE([AC_PATH_X])dnl
959
960 AC_ARG_WITH([gl],
961  [AS_HELP_STRING([--with-gl@<:@=ARG@:>@],
962    [use opengl (ARG=yes),
963     using the specific lib (ARG=<lib>),
964     using the OpenGL lib that link with X (ARG=x),
965     using the OpenGL lib that link without X (ARG=nox),
966     or disable it (ARG=no)
967     @<:@ARG=yes@:>@ ])],
968    [
969    AS_CASE(["$withval"],
970            ["no"|"NO"],[ax_check_gl_want_gl="no"],
971	    ["yes"|"YES"],[ax_check_gl_want_gl="yes"],
972	    [ax_check_gl_want_gl="$withval"])
973    ],
974    [ax_check_gl_want_gl="yes"])
975
976 # check consistency of parameters
977 AS_IF([test "X$have_x" = "Xdisabled"],
978       [AS_IF([test X$ax_check_gl_want_gl = "Xx"],
979              [AC_MSG_ERROR([You prefer OpenGL with X and asked for no X support])])])
980
981 # set flags
982 no_gl="yes"
983
984 # now do the real testing
985 AS_IF([test X$ax_check_gl_want_gl != "Xno"],
986       [_AX_CHECK_GL()])
987
988 AC_MSG_CHECKING([for a working OpenGL implementation])
989 AS_IF([test "X$no_gl" = "Xno"],
990       [AC_MSG_RESULT([yes])
991        AC_MSG_CHECKING([for CFLAGS needed for OpenGL])
992        AC_MSG_RESULT(["${GL_CFLAGS}"])
993        AC_MSG_CHECKING([for LIBS needed for OpenGL])
994        AC_MSG_RESULT(["${GL_LIBS}"])
995        AC_MSG_CHECKING([for LDFLAGS needed for OpenGL])
996        AC_MSG_RESULT(["${GL_LDFLAGS}"])],
997       [AC_MSG_RESULT([no])
998        GL_CFLAGS=""
999        GL_LIBS=""
1000        GL_LDFLAGS=""])
1001
1002 AC_SUBST([GL_CFLAGS])
1003 AC_SUBST([GL_LIBS])
1004 AC_SUBST([GL_LDFLAGS])
1005])
1006
1007# ===========================================================================
1008#       http://www.gnu.org/software/autoconf-archive/ax_check_glu.html
1009# ===========================================================================
1010#
1011# SYNOPSIS
1012#
1013#   AX_CHECK_GLU
1014#
1015# DESCRIPTION
1016#
1017#   Check for GLU. If GLU is found, the required preprocessor and linker
1018#   flags are included in the output variables "GLU_CFLAGS" and "GLU_LIBS",
1019#   respectively. If no GLU implementation is found, "no_glu" is set to
1020#   "yes".
1021#
1022#   If the header "GL/glu.h" is found, "HAVE_GL_GLU_H" is defined. If the
1023#   header "OpenGL/glu.h" is found, HAVE_OPENGL_GLU_H is defined. These
1024#   preprocessor definitions may not be mutually exclusive.
1025#
1026#   You should use something like this in your headers:
1027#
1028#     # if defined(HAVE_WINDOWS_H) && defined(_WIN32)
1029#     #  include <windows.h>
1030#     # endif
1031#     # if defined(HAVE_GL_GLU_H)
1032#     #  include <GL/glu.h>
1033#     # elif defined(HAVE_OPENGL_GLU_H)
1034#     #  include <OpenGL/glu.h>
1035#     # else
1036#     #  error no glu.h
1037#     # endif
1038#
1039#   Some implementations (in particular, some versions of Mac OS X) are
1040#   known to treat the GLU tesselator callback function type as "GLvoid
1041#   (*)(...)" rather than the standard "GLvoid (*)()". If the former
1042#   condition is detected, this macro defines "HAVE_VARARGS_GLU_TESSCB".
1043#
1044# LICENSE
1045#
1046#   Copyright (c) 2009 Braden McDaniel <braden@endoframe.com>
1047#   Copyright (c) 2013 Bastien Roucaries <roucaries.bastien+autoconf@gmail.com>
1048#
1049#   This program is free software; you can redistribute it and/or modify it
1050#   under the terms of the GNU General Public License as published by the
1051#   Free Software Foundation; either version 2 of the License, or (at your
1052#   option) any later version.
1053#
1054#   This program is distributed in the hope that it will be useful, but
1055#   WITHOUT ANY WARRANTY; without even the implied warranty of
1056#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1057#   Public License for more details.
1058#
1059#   You should have received a copy of the GNU General Public License along
1060#   with this program. If not, see <http://www.gnu.org/licenses/>.
1061#
1062#   As a special exception, the respective Autoconf Macro's copyright owner
1063#   gives unlimited permission to copy, distribute and modify the configure
1064#   scripts that are the output of Autoconf when processing the Macro. You
1065#   need not follow the terms of the GNU General Public License when using
1066#   or distributing such scripts, even though portions of the text of the
1067#   Macro appear in them. The GNU General Public License (GPL) does govern
1068#   all other use of the material that constitutes the Autoconf Macro.
1069#
1070#   This special exception to the GPL applies to versions of the Autoconf
1071#   Macro released by the Autoconf Archive. When you make and distribute a
1072#   modified version of the Autoconf Macro, you may extend this special
1073#   exception to the GPL to apply to your modified version as well.
1074
1075#serial 16
1076
1077# exemple program
1078m4_define([_AX_CHECK_GLU_PROGRAM],
1079          [AC_LANG_PROGRAM([[
1080# if defined(HAVE_WINDOWS_H) && defined(_WIN32)
1081#   include <windows.h>
1082# endif
1083# ifdef HAVE_GL_GLU_H
1084#   include <GL/glu.h>
1085# elif defined(HAVE_OPENGL_GLU_H)
1086#   include <OpenGL/glu.h>
1087# else
1088#   error no glu.h
1089# endif
1090]],[[gluBeginCurve(0)]])])
1091
1092
1093dnl Default include : add windows.h
1094dnl see http://www.opengl.org/wiki/Platform_specifics:_Windows
1095dnl (acceded 20120801)
1096AC_DEFUN([_AX_CHECK_GLU_INCLUDES_DEFAULT],dnl
1097[
1098  AC_INCLUDES_DEFAULT
1099  [
1100  # if defined(HAVE_WINDOWS_H) && defined(_WIN32)
1101  #   include <windows.h>
1102  # endif
1103  ]
1104])
1105
1106dnl local save flags
1107AC_DEFUN([_AX_CHECK_GLU_SAVE_FLAGS],
1108[dnl
1109ax_check_glu_saved_libs="${LIBS}"
1110ax_check_glu_saved_cflags="${CFLAGS}"
1111ax_check_glu_saved_cppflags="${CPPFLAGS}"
1112ax_check_glu_saved_ldflags="${LDFLAGS}"
1113])
1114
1115
1116dnl local restore flags
1117AC_DEFUN([_AX_CHECK_GLU_RESTORE_FLAGS],
1118[dnl
1119LIBS="${ax_check_glu_saved_libs}"
1120CFLAGS="${ax_check_glu_saved_cflags}"
1121CPPFLAGS="${ax_check_glu_saved_cppflags}"
1122LDFLAGS="${ax_check_glu_saved_ldflags}"
1123])
1124
1125
1126# compile the example program
1127AC_DEFUN([_AX_CHECK_GLU_COMPILE],
1128[dnl
1129 AC_LANG_PUSH([C])
1130 _AX_CHECK_GLU_SAVE_FLAGS()
1131 CFLAGS="${GLU_CFLAGS} ${CFLAGS}"
1132 AC_COMPILE_IFELSE([_AX_CHECK_GLU_PROGRAM],
1133                   [ax_check_glu_compile_opengl="yes"],
1134                   [ax_check_glu_compile_opengl="no"])
1135 _AX_CHECK_GLU_RESTORE_FLAGS()
1136 AC_LANG_POP([C])
1137])
1138
1139# compile the example program (cache)
1140AC_DEFUN([_AX_CHECK_GLU_COMPILE_CV],
1141[dnl
1142 AC_CACHE_CHECK([for compiling a minimal OpenGL Utility (GLU) program],[ax_cv_check_glu_compile_opengl],
1143                [_AX_CHECK_GLU_COMPILE()
1144                 ax_cv_check_glu_compile_opengl="${ax_check_glu_compile_opengl}"])
1145 ax_check_glu_compile_opengl="${ax_cv_check_glu_compile_opengl}"
1146])
1147
1148# link the example program
1149AC_DEFUN([_AX_CHECK_GLU_LINK],
1150[dnl
1151 AC_LANG_PUSH([C])
1152 _AX_CHECK_GLU_SAVE_FLAGS()
1153 CFLAGS="${GLU_CFLAGS} ${CFLAGS}"
1154 LIBS="${GLU_LIBS} ${LIBS}"
1155 LDFLAGS="${GLU_LDFLAGS} ${LDFLAGS}"
1156 AC_LINK_IFELSE([_AX_CHECK_GLU_PROGRAM],
1157                [ax_check_glu_link_opengl="yes"],
1158                [ax_check_glu_link_opengl="no"])
1159 _AX_CHECK_GLU_RESTORE_FLAGS()
1160 AC_LANG_POP([C])
1161])
1162
1163# link the example program (cache)
1164AC_DEFUN([_AX_CHECK_GLU_LINK_CV],
1165[dnl
1166 AC_CACHE_CHECK([for linking a minimal OpenGL Utility (GLU) program],[ax_cv_check_glu_link_opengl],
1167                [_AX_CHECK_GLU_LINK()
1168                 ax_cv_check_glu_link_opengl="${ax_check_glu_link_opengl}"])
1169 ax_check_glu_link_opengl="${ax_cv_check_glu_link_opengl}"
1170])
1171
1172dnl Check headers manually (default case)
1173AC_DEFUN([_AX_CHECK_GLU_HEADERS],
1174[AC_LANG_PUSH([C])
1175 _AX_CHECK_GLU_SAVE_FLAGS()
1176 CFLAGS="${GLU_CFLAGS} ${CFLAGS}"
1177 # see comment in _AX_CHECK_GL_INCLUDES_DEFAULT
1178 AC_CHECK_HEADERS([windows.h],[],[],[AC_INCLUDES_DEFAULT])
1179 AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h],
1180                         [ax_check_glu_have_headers="yes";break],
1181                         [ax_check_glu_have_headers_headers="no"],
1182			 [_AX_CHECK_GLU_INCLUDES_DEFAULT()])
1183 # do not try darwin specific OpenGl/gl.h
1184 _AX_CHECK_GLU_RESTORE_FLAGS()
1185 AC_LANG_POP([C])
1186])
1187
1188# check tesselation callback function signature.
1189m4_define([_AX_CHECK_GLU_VARARGS_TESSVB_PROGRAM],
1190[AC_LANG_PROGRAM([[
1191# if defined(HAVE_WINDOWS_H) && defined(_WIN32)
1192#   include <windows.h>
1193# endif
1194# ifdef HAVE_GL_GLU_H
1195#   include <GL/glu.h>
1196# elif defined(HAVE_OPENGL_GLU_H)
1197#   include <OpenGL/glu.h>
1198# else
1199#   error no glu.h
1200# endif
1201]],
1202[[GLvoid (*func)(...); gluTessCallback(0, 0, func)]])
1203])
1204
1205# compile the tesselation callback function program
1206# test with c++
1207AC_DEFUN([_AX_CHECK_GLU_COMPILE_VARARGS_TESSVB_PROGRAM],
1208[AC_REQUIRE([AC_PROG_CXX])dnl
1209
1210 AC_LANG_PUSH([C++])
1211 _AX_CHECK_GLU_SAVE_FLAGS()
1212 CFLAGS="${GLU_CFLAGS} ${CFLAGS}"
1213 AC_COMPILE_IFELSE([_AX_CHECK_GLU_VARARGS_TESSVB_PROGRAM],
1214                   [ax_check_glu_compile_varargs_tessvb_program="yes"],
1215                   [ax_check_glu_compile_varargs_tessvb_program="no"])
1216 _AX_CHECK_GLU_RESTORE_FLAGS()
1217 AC_LANG_POP([C++])
1218])
1219
1220
1221#
1222# Some versions of Mac OS X include a broken interpretation of the GLU
1223# tesselation callback function signature.
1224#
1225AC_DEFUN([_AX_CHECK_GLU_VARARGS_TESSVB],
1226[
1227AC_CACHE_CHECK([for varargs OpenGL Utility (GLU) tesselator callback function type],
1228                [ax_cv_varargs_glu_tesscb],
1229		[_AX_CHECK_GLU_COMPILE_VARARGS_TESSVB_PROGRAM
1230		 ax_cv_varargs_glu_tesscb="${ax_check_glu_compile_varargs_tessvb_program}"])
1231ax_check_glu_compile_varargs_tessvb_program="${ax_cv_varargs_glu_tesscb}"
1232
1233AS_IF([test X$ax_cv_varargs_glu_tesscb = Xyes],
1234      [AC_DEFINE([HAVE_VARARGS_GLU_TESSCB], [1],
1235                 [Use nonstandard varargs form for the GLU tesselator callback])])
1236])
1237
1238
1239# dnl try to found library (generic case)
1240# dnl $1 is set to the library to found
1241AC_DEFUN([_AX_CHECK_GLU_MANUAL_LIBS_GENERIC],
1242[dnl
1243 ax_check_glu_manual_libs_generic_extra_libs="$1"
1244 AS_IF([test "X$ax_check_glu_manual_libs_generic_extra_libs" = "X"],
1245       [AC_MSG_ERROR([AX_CHECK_GLU_MANUAL_LIBS_GENERIC argument must no be empty])])
1246
1247 AC_LANG_PUSH([C])
1248 _AX_CHECK_GLU_SAVE_FLAGS()
1249 CFLAGS="${GLU_CFLAGS} ${CFLAGS}"
1250 LIBS="${GLU_LIBS} ${LIBS}"
1251 AC_SEARCH_LIBS([gluBeginCurve],[$ax_check_glu_manual_libs_generic_extra_libs],
1252                [ax_check_glu_lib_opengl="yes"],
1253                [ax_check_glu_lib_opengl="no"])
1254 AS_CASE([$ac_cv_search_gluBeginCurve],
1255         ["none required"],[],
1256 	 [no],[],
1257 	 [GLU_LIBS="${ac_cv_search_gluBeginCurve} ${GLU_LIBS}"])
1258  _AX_CHECK_GLU_RESTORE_FLAGS()
1259  AC_LANG_PUSH([C])
1260])
1261
1262
1263dnl Check library manually: subroutine must set
1264dnl $ax_check_gl_lib_opengl={yes,no}
1265AC_DEFUN([_AX_CHECK_GLU_MANUAL_LIBS],
1266[AC_REQUIRE([AC_CANONICAL_HOST])
1267 GLU_LIBS="${GLU_LIBS} ${GL_LIBS}"
1268 AS_CASE([${host}],
1269         # try first cygwin version
1270         [*-cygwin*],[_AX_CHECK_GLU_MANUAL_LIBS_GENERIC([GLU glu MesaGLU glu32])],
1271         # try first native
1272	 [*-mingw*],[_AX_CHECK_GLU_MANUAL_LIBS_GENERIC([glu32 GLU glu MesaGLU])],
1273	 [_AX_CHECK_GLU_MANUAL_LIBS_GENERIC([GLU glu MesaGLU])])
1274
1275 AC_CACHE_CHECK([for OpenGL Utility (GLU) libraries],[ax_cv_check_glu_lib_opengl],
1276               	[ax_cv_check_glu_lib_opengl="${ax_check_glu_lib_opengl}"])
1277 ax_check_glu_lib_opengl="${ax_cv_check_glu_lib_opengl}"
1278])
1279
1280
1281dnl Manual way to detect GLU
1282AC_DEFUN([_AX_CHECK_GLU_MANUAL],
1283[dnl
1284
1285# inherit cflags
1286GLU_CFLAGS="${GLU_CFLAGS} ${GL_CFLAGS}"
1287
1288# check headers
1289_AX_CHECK_GLU_HEADERS
1290
1291AS_IF([test "X$ax_check_glu_have_headers" = "Xyes"],
1292      [_AX_CHECK_GLU_MANUAL_LIBS],
1293      [ax_check_glu_lib_opengl="no"])
1294
1295AS_IF([test "X$ax_check_glu_lib_opengl" = "Xyes"],
1296      [_AX_CHECK_GLU_COMPILE_CV()],
1297      [ax_cv_check_glu_compile_opengl="no"])
1298
1299AS_IF([test "X$ax_cv_check_glu_compile_opengl" = "Xyes"],
1300      [_AX_CHECK_GLU_LINK_CV()],
1301      [ax_cv_check_glu_link_opengl="no"])
1302
1303AS_IF([test "X$ax_cv_check_glu_link_opengl" = "Xyes"],
1304      [no_glu="no"],
1305      [no_glu="yes"])
1306])
1307
1308# detect using pkgconfig
1309AC_DEFUN([_AX_CHECK_GLU_PKG_CONFIG],
1310[
1311 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1312
1313 PKG_CHECK_MODULES([GLU],[glu],[ax_check_glu_pkg_config=yes],[ax_check_glu_pkg_config=no])
1314
1315 AS_IF([test "X$ax_check_glu_pkg_config" = "Xyes"],[
1316        # check headers
1317        AC_LANG_PUSH([C])
1318 	_AX_CHECK_GLU_SAVE_FLAGS()
1319        CFLAGS="${GLU_CFLAGS} ${CFLAGS}"
1320        AC_CHECK_HEADERS([windows.h],[],[],[AC_INCLUDES_DEFAULT])
1321        AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h],
1322                         [ax_check_glu_have_headers="yes";break],
1323                         [ax_check_glu_have_headers_headers="no"],
1324			 [_AX_CHECK_GLU_INCLUDES_DEFAULT()])
1325        _AX_CHECK_GL_RESTORE_FLAGS()
1326	AC_LANG_POP([C])
1327	AC_CACHE_CHECK([for OpenGL Utility (GLU) headers],[ax_cv_check_glu_have_headers],
1328               	       [ax_cv_check_glu_have_headers="${ax_check_glu_have_headers}"])
1329
1330        # pkgconfig library are suposed to work ...
1331        AS_IF([test "X$ax_cv_check_glu_have_headers" = "Xno"],
1332              [AC_MSG_ERROR("Pkgconfig detected OpenGL Utility (GLU) library has no headers!")])
1333
1334	_AX_CHECK_GLU_COMPILE_CV()
1335	AS_IF([test "X$ax_cv_check_glu_compile_opengl" = "Xno"],
1336              [AC_MSG_ERROR("Pkgconfig detected OpenGL Utility (GLU) library could not be used for compiling minimal program!")])
1337
1338	_AX_CHECK_GLU_LINK_CV()
1339	AS_IF([test "X$ax_cv_check_glu_link_opengl" = "Xno"],
1340              [AC_MSG_ERROR("Pkgconfig detected OpenGL Utility (GLU) library could not be used for linking minimal program!")])
1341  ])
1342])
1343
1344# entry point
1345AC_DEFUN([AX_CHECK_GLU],dnl
1346[
1347 AC_REQUIRE([AX_CHECK_GL])
1348 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1349
1350 # set flags
1351 no_glu="yes"
1352
1353 AC_MSG_CHECKING([for a working OpenGL Utility (GLU) implementation by pkg-config])
1354 # try first pkgconfig
1355 AS_IF([test "X${PKG_CONFIG}" = "X"],
1356       [AC_MSG_RESULT([no])
1357        ax_check_glu_pkg_config=no],
1358       [AC_MSG_RESULT([yes])
1359        _AX_CHECK_GLU_PKG_CONFIG()])
1360
1361 # if no pkg-config or pkg-config fail try manual way
1362 AS_IF([test "X$ax_check_glu_pkg_config" = "Xno"],
1363       [_AX_CHECK_GLU_MANUAL()],
1364       [no_glu=no])
1365
1366 # check broken implementation
1367 AS_IF([test "X$no_glu" = "Xno"],
1368       [_AX_CHECK_GLU_VARARGS_TESSVB],[])
1369
1370 AC_MSG_CHECKING([for a working OpenGL Utility (GLU) implementation])
1371 AS_IF([test "X$no_glu" = "Xno"],
1372       [AC_MSG_RESULT([yes])
1373        AC_MSG_CHECKING([for CFLAGS needed for OpenGL Utility (GLU)])
1374        AC_MSG_RESULT(["${GLU_CFLAGS}"])
1375        AC_MSG_CHECKING([for LIBS needed for OpenGL Utility (GLU)])
1376        AC_MSG_RESULT(["${GLU_LIBS}"])
1377        AC_MSG_CHECKING([for LDFLAGS needed for OpenGL Utility (GLU)])
1378        AC_MSG_RESULT(["${GLU_LDFLAGS}"])],
1379       [AC_MSG_RESULT([no])
1380        GLU_CFLAGS=""
1381        GLU_LIBS=""
1382        GLU_LDFLAGS=""])
1383
1384 AC_SUBST([GLU_CFLAGS])
1385 AC_SUBST([GLU_LIBS])
1386 AC_SUBST([GLU_LDFLAGS])
1387
1388])
1389
1390# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1391# serial 1 (pkg-config-0.24)
1392#
1393# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1394#
1395# This program is free software; you can redistribute it and/or modify
1396# it under the terms of the GNU General Public License as published by
1397# the Free Software Foundation; either version 2 of the License, or
1398# (at your option) any later version.
1399#
1400# This program is distributed in the hope that it will be useful, but
1401# WITHOUT ANY WARRANTY; without even the implied warranty of
1402# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1403# General Public License for more details.
1404#
1405# You should have received a copy of the GNU General Public License
1406# along with this program; if not, write to the Free Software
1407# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1408#
1409# As a special exception to the GNU General Public License, if you
1410# distribute this file as part of a program that contains a
1411# configuration script generated by Autoconf, you may include it under
1412# the same distribution terms that you use for the rest of that program.
1413
1414# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1415# ----------------------------------
1416AC_DEFUN([PKG_PROG_PKG_CONFIG],
1417[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1418m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1419m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1420AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1421AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1422AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1423
1424if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1425	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1426fi
1427if test -n "$PKG_CONFIG"; then
1428	_pkg_min_version=m4_default([$1], [0.9.0])
1429	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1430	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1431		AC_MSG_RESULT([yes])
1432	else
1433		AC_MSG_RESULT([no])
1434		PKG_CONFIG=""
1435	fi
1436fi[]dnl
1437])# PKG_PROG_PKG_CONFIG
1438
1439# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1440#
1441# Check to see whether a particular set of modules exists.  Similar
1442# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1443#
1444# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1445# only at the first occurence in configure.ac, so if the first place
1446# it's called might be skipped (such as if it is within an "if", you
1447# have to call PKG_CHECK_EXISTS manually
1448# --------------------------------------------------------------
1449AC_DEFUN([PKG_CHECK_EXISTS],
1450[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1451if test -n "$PKG_CONFIG" && \
1452    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1453  m4_default([$2], [:])
1454m4_ifvaln([$3], [else
1455  $3])dnl
1456fi])
1457
1458# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1459# ---------------------------------------------
1460m4_define([_PKG_CONFIG],
1461[if test -n "$$1"; then
1462    pkg_cv_[]$1="$$1"
1463 elif test -n "$PKG_CONFIG"; then
1464    PKG_CHECK_EXISTS([$3],
1465                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1466		      test "x$?" != "x0" && pkg_failed=yes ],
1467		     [pkg_failed=yes])
1468 else
1469    pkg_failed=untried
1470fi[]dnl
1471])# _PKG_CONFIG
1472
1473# _PKG_SHORT_ERRORS_SUPPORTED
1474# -----------------------------
1475AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1476[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1477if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1478        _pkg_short_errors_supported=yes
1479else
1480        _pkg_short_errors_supported=no
1481fi[]dnl
1482])# _PKG_SHORT_ERRORS_SUPPORTED
1483
1484
1485# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1486# [ACTION-IF-NOT-FOUND])
1487#
1488#
1489# Note that if there is a possibility the first call to
1490# PKG_CHECK_MODULES might not happen, you should be sure to include an
1491# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1492#
1493#
1494# --------------------------------------------------------------
1495AC_DEFUN([PKG_CHECK_MODULES],
1496[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1497AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1498AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1499
1500pkg_failed=no
1501AC_MSG_CHECKING([for $1])
1502
1503_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1504_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1505
1506m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1507and $1[]_LIBS to avoid the need to call pkg-config.
1508See the pkg-config man page for more details.])
1509
1510if test $pkg_failed = yes; then
1511   	AC_MSG_RESULT([no])
1512        _PKG_SHORT_ERRORS_SUPPORTED
1513        if test $_pkg_short_errors_supported = yes; then
1514	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1515        else
1516	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1517        fi
1518	# Put the nasty error message in config.log where it belongs
1519	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1520
1521	m4_default([$4], [AC_MSG_ERROR(
1522[Package requirements ($2) were not met:
1523
1524$$1_PKG_ERRORS
1525
1526Consider adjusting the PKG_CONFIG_PATH environment variable if you
1527installed software in a non-standard prefix.
1528
1529_PKG_TEXT])[]dnl
1530        ])
1531elif test $pkg_failed = untried; then
1532     	AC_MSG_RESULT([no])
1533	m4_default([$4], [AC_MSG_FAILURE(
1534[The pkg-config script could not be found or is too old.  Make sure it
1535is in your PATH or set the PKG_CONFIG environment variable to the full
1536path to pkg-config.
1537
1538_PKG_TEXT
1539
1540To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1541        ])
1542else
1543	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1544	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1545        AC_MSG_RESULT([yes])
1546	$3
1547fi[]dnl
1548])# PKG_CHECK_MODULES
1549
1550# Configure paths for SDL
1551# Sam Lantinga 9/21/99
1552# stolen from Manish Singh
1553# stolen back from Frank Belew
1554# stolen from Manish Singh
1555# Shamelessly stolen from Owen Taylor
1556
1557# serial 1
1558
1559dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1560dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
1561dnl
1562AC_DEFUN([AM_PATH_SDL],
1563[dnl
1564dnl Get the cflags and libraries from the sdl-config script
1565dnl
1566AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
1567            sdl_prefix="$withval", sdl_prefix="")
1568AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
1569            sdl_exec_prefix="$withval", sdl_exec_prefix="")
1570AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
1571		    , enable_sdltest=yes)
1572
1573  if test x$sdl_exec_prefix != x ; then
1574    sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
1575    if test x${SDL_CONFIG+set} != xset ; then
1576      SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
1577    fi
1578  fi
1579  if test x$sdl_prefix != x ; then
1580    sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
1581    if test x${SDL_CONFIG+set} != xset ; then
1582      SDL_CONFIG=$sdl_prefix/bin/sdl-config
1583    fi
1584  fi
1585
1586  as_save_PATH="$PATH"
1587  if test "x$prefix" != xNONE; then
1588    PATH="$prefix/bin:$prefix/usr/bin:$PATH"
1589  fi
1590  AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
1591  PATH="$as_save_PATH"
1592  min_sdl_version=ifelse([$1], ,0.11.0,$1)
1593  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
1594  no_sdl=""
1595  if test "$SDL_CONFIG" = "no" ; then
1596    no_sdl=yes
1597  else
1598    SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
1599    SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
1600
1601    sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
1602           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1603    sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
1604           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1605    sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
1606           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1607    if test "x$enable_sdltest" = "xyes" ; then
1608      ac_save_CFLAGS="$CFLAGS"
1609      ac_save_CXXFLAGS="$CXXFLAGS"
1610      ac_save_LIBS="$LIBS"
1611      CFLAGS="$CFLAGS $SDL_CFLAGS"
1612      CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
1613      LIBS="$LIBS $SDL_LIBS"
1614dnl
1615dnl Now check if the installed SDL is sufficiently new. (Also sanity
1616dnl checks the results of sdl-config to some extent
1617dnl
1618      rm -f conf.sdltest
1619      AC_TRY_RUN([
1620#include <stdio.h>
1621#include <stdlib.h>
1622#include <string.h>
1623#include "SDL.h"
1624
1625char*
1626my_strdup (char *str)
1627{
1628  char *new_str;
1629
1630  if (str)
1631    {
1632      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
1633      strcpy (new_str, str);
1634    }
1635  else
1636    new_str = NULL;
1637
1638  return new_str;
1639}
1640
1641int main (int argc, char *argv[])
1642{
1643  int major, minor, micro;
1644  char *tmp_version;
1645
1646  /* This hangs on some systems (?)
1647  system ("touch conf.sdltest");
1648  */
1649  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
1650
1651  /* HP/UX 9 (%@#!) writes to sscanf strings */
1652  tmp_version = my_strdup("$min_sdl_version");
1653  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1654     printf("%s, bad version string\n", "$min_sdl_version");
1655     exit(1);
1656   }
1657
1658   if (($sdl_major_version > major) ||
1659      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
1660      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
1661    {
1662      return 0;
1663    }
1664  else
1665    {
1666      printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
1667      printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
1668      printf("*** best to upgrade to the required version.\n");
1669      printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
1670      printf("*** to point to the correct copy of sdl-config, and remove the file\n");
1671      printf("*** config.cache before re-running configure\n");
1672      return 1;
1673    }
1674}
1675
1676],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1677       CFLAGS="$ac_save_CFLAGS"
1678       CXXFLAGS="$ac_save_CXXFLAGS"
1679       LIBS="$ac_save_LIBS"
1680     fi
1681  fi
1682  if test "x$no_sdl" = x ; then
1683     AC_MSG_RESULT(yes)
1684     ifelse([$2], , :, [$2])
1685  else
1686     AC_MSG_RESULT(no)
1687     if test "$SDL_CONFIG" = "no" ; then
1688       echo "*** The sdl-config script installed by SDL could not be found"
1689       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
1690       echo "*** your path, or set the SDL_CONFIG environment variable to the"
1691       echo "*** full path to sdl-config."
1692     else
1693       if test -f conf.sdltest ; then
1694        :
1695       else
1696          echo "*** Could not run SDL test program, checking why..."
1697          CFLAGS="$CFLAGS $SDL_CFLAGS"
1698          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
1699          LIBS="$LIBS $SDL_LIBS"
1700          AC_TRY_LINK([
1701#include <stdio.h>
1702#include "SDL.h"
1703
1704int main(int argc, char *argv[])
1705{ return 0; }
1706#undef  main
1707#define main K_and_R_C_main
1708],      [ return 0; ],
1709        [ echo "*** The test program compiled, but did not run. This usually means"
1710          echo "*** that the run-time linker is not finding SDL or finding the wrong"
1711          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
1712          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1713          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1714          echo "*** is required on your system"
1715	  echo "***"
1716          echo "*** If you have an old version installed, it is best to remove it, although"
1717          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1718        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1719          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
1720          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
1721          echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
1722          CFLAGS="$ac_save_CFLAGS"
1723          CXXFLAGS="$ac_save_CXXFLAGS"
1724          LIBS="$ac_save_LIBS"
1725       fi
1726     fi
1727     SDL_CFLAGS=""
1728     SDL_LIBS=""
1729     ifelse([$3], , :, [$3])
1730  fi
1731  AC_SUBST(SDL_CFLAGS)
1732  AC_SUBST(SDL_LIBS)
1733  rm -f conf.sdltest
1734])
1735
1736# Copyright (C) 2002-2013 Free Software Foundation, Inc.
1737#
1738# This file is free software; the Free Software Foundation
1739# gives unlimited permission to copy and/or distribute it,
1740# with or without modifications, as long as this notice is preserved.
1741
1742# AM_AUTOMAKE_VERSION(VERSION)
1743# ----------------------------
1744# Automake X.Y traces this macro to ensure aclocal.m4 has been
1745# generated from the m4 files accompanying Automake X.Y.
1746# (This private macro should not be called outside this file.)
1747AC_DEFUN([AM_AUTOMAKE_VERSION],
1748[am__api_version='1.14'
1749dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
1750dnl require some minimum version.  Point them to the right macro.
1751m4_if([$1], [1.14.1], [],
1752      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
1753])
1754
1755# _AM_AUTOCONF_VERSION(VERSION)
1756# -----------------------------
1757# aclocal traces this macro to find the Autoconf version.
1758# This is a private macro too.  Using m4_define simplifies
1759# the logic in aclocal, which can simply ignore this definition.
1760m4_define([_AM_AUTOCONF_VERSION], [])
1761
1762# AM_SET_CURRENT_AUTOMAKE_VERSION
1763# -------------------------------
1764# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
1765# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
1766AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
1767[AM_AUTOMAKE_VERSION([1.14.1])dnl
1768m4_ifndef([AC_AUTOCONF_VERSION],
1769  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1770_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
1771
1772# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
1773
1774# Copyright (C) 2001-2013 Free Software Foundation, Inc.
1775#
1776# This file is free software; the Free Software Foundation
1777# gives unlimited permission to copy and/or distribute it,
1778# with or without modifications, as long as this notice is preserved.
1779
1780# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
1781# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
1782# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
1783#
1784# Of course, Automake must honor this variable whenever it calls a
1785# tool from the auxiliary directory.  The problem is that $srcdir (and
1786# therefore $ac_aux_dir as well) can be either absolute or relative,
1787# depending on how configure is run.  This is pretty annoying, since
1788# it makes $ac_aux_dir quite unusable in subdirectories: in the top
1789# source directory, any form will work fine, but in subdirectories a
1790# relative path needs to be adjusted first.
1791#
1792# $ac_aux_dir/missing
1793#    fails when called from a subdirectory if $ac_aux_dir is relative
1794# $top_srcdir/$ac_aux_dir/missing
1795#    fails if $ac_aux_dir is absolute,
1796#    fails when called from a subdirectory in a VPATH build with
1797#          a relative $ac_aux_dir
1798#
1799# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
1800# are both prefixed by $srcdir.  In an in-source build this is usually
1801# harmless because $srcdir is '.', but things will broke when you
1802# start a VPATH build or use an absolute $srcdir.
1803#
1804# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
1805# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
1806#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
1807# and then we would define $MISSING as
1808#   MISSING="\${SHELL} $am_aux_dir/missing"
1809# This will work as long as MISSING is not called from configure, because
1810# unfortunately $(top_srcdir) has no meaning in configure.
1811# However there are other variables, like CC, which are often used in
1812# configure, and could therefore not use this "fixed" $ac_aux_dir.
1813#
1814# Another solution, used here, is to always expand $ac_aux_dir to an
1815# absolute PATH.  The drawback is that using absolute paths prevent a
1816# configured tree to be moved without reconfiguration.
1817
1818AC_DEFUN([AM_AUX_DIR_EXPAND],
1819[dnl Rely on autoconf to set up CDPATH properly.
1820AC_PREREQ([2.50])dnl
1821# expand $ac_aux_dir to an absolute path
1822am_aux_dir=`cd $ac_aux_dir && pwd`
1823])
1824
1825# AM_CONDITIONAL                                            -*- Autoconf -*-
1826
1827# Copyright (C) 1997-2013 Free Software Foundation, Inc.
1828#
1829# This file is free software; the Free Software Foundation
1830# gives unlimited permission to copy and/or distribute it,
1831# with or without modifications, as long as this notice is preserved.
1832
1833# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1834# -------------------------------------
1835# Define a conditional.
1836AC_DEFUN([AM_CONDITIONAL],
1837[AC_PREREQ([2.52])dnl
1838 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1839       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1840AC_SUBST([$1_TRUE])dnl
1841AC_SUBST([$1_FALSE])dnl
1842_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1843_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1844m4_define([_AM_COND_VALUE_$1], [$2])dnl
1845if $2; then
1846  $1_TRUE=
1847  $1_FALSE='#'
1848else
1849  $1_TRUE='#'
1850  $1_FALSE=
1851fi
1852AC_CONFIG_COMMANDS_PRE(
1853[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1854  AC_MSG_ERROR([[conditional "$1" was never defined.
1855Usually this means the macro was only invoked conditionally.]])
1856fi])])
1857
1858# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1859#
1860# This file is free software; the Free Software Foundation
1861# gives unlimited permission to copy and/or distribute it,
1862# with or without modifications, as long as this notice is preserved.
1863
1864
1865# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1866# written in clear, in which case automake, when reading aclocal.m4,
1867# will think it sees a *use*, and therefore will trigger all it's
1868# C support machinery.  Also note that it means that autoscan, seeing
1869# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1870
1871
1872# _AM_DEPENDENCIES(NAME)
1873# ----------------------
1874# See how the compiler implements dependency checking.
1875# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1876# We try a few techniques and use that to set a single cache variable.
1877#
1878# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1879# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1880# dependency, and given that the user is not expected to run this macro,
1881# just rely on AC_PROG_CC.
1882AC_DEFUN([_AM_DEPENDENCIES],
1883[AC_REQUIRE([AM_SET_DEPDIR])dnl
1884AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1885AC_REQUIRE([AM_MAKE_INCLUDE])dnl
1886AC_REQUIRE([AM_DEP_TRACK])dnl
1887
1888m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1889      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1890      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1891      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1892      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1893      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1894                    [depcc="$$1"   am_compiler_list=])
1895
1896AC_CACHE_CHECK([dependency style of $depcc],
1897               [am_cv_$1_dependencies_compiler_type],
1898[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1899  # We make a subdir and do the tests there.  Otherwise we can end up
1900  # making bogus files that we don't know about and never remove.  For
1901  # instance it was reported that on HP-UX the gcc test will end up
1902  # making a dummy file named 'D' -- because '-MD' means "put the output
1903  # in D".
1904  rm -rf conftest.dir
1905  mkdir conftest.dir
1906  # Copy depcomp to subdir because otherwise we won't find it if we're
1907  # using a relative directory.
1908  cp "$am_depcomp" conftest.dir
1909  cd conftest.dir
1910  # We will build objects and dependencies in a subdirectory because
1911  # it helps to detect inapplicable dependency modes.  For instance
1912  # both Tru64's cc and ICC support -MD to output dependencies as a
1913  # side effect of compilation, but ICC will put the dependencies in
1914  # the current directory while Tru64 will put them in the object
1915  # directory.
1916  mkdir sub
1917
1918  am_cv_$1_dependencies_compiler_type=none
1919  if test "$am_compiler_list" = ""; then
1920     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
1921  fi
1922  am__universal=false
1923  m4_case([$1], [CC],
1924    [case " $depcc " in #(
1925     *\ -arch\ *\ -arch\ *) am__universal=true ;;
1926     esac],
1927    [CXX],
1928    [case " $depcc " in #(
1929     *\ -arch\ *\ -arch\ *) am__universal=true ;;
1930     esac])
1931
1932  for depmode in $am_compiler_list; do
1933    # Setup a source with many dependencies, because some compilers
1934    # like to wrap large dependency lists on column 80 (with \), and
1935    # we should not choose a depcomp mode which is confused by this.
1936    #
1937    # We need to recreate these files for each test, as the compiler may
1938    # overwrite some of them when testing with obscure command lines.
1939    # This happens at least with the AIX C compiler.
1940    : > sub/conftest.c
1941    for i in 1 2 3 4 5 6; do
1942      echo '#include "conftst'$i'.h"' >> sub/conftest.c
1943      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
1944      # Solaris 10 /bin/sh.
1945      echo '/* dummy */' > sub/conftst$i.h
1946    done
1947    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
1948
1949    # We check with '-c' and '-o' for the sake of the "dashmstdout"
1950    # mode.  It turns out that the SunPro C++ compiler does not properly
1951    # handle '-M -o', and we need to detect this.  Also, some Intel
1952    # versions had trouble with output in subdirs.
1953    am__obj=sub/conftest.${OBJEXT-o}
1954    am__minus_obj="-o $am__obj"
1955    case $depmode in
1956    gcc)
1957      # This depmode causes a compiler race in universal mode.
1958      test "$am__universal" = false || continue
1959      ;;
1960    nosideeffect)
1961      # After this tag, mechanisms are not by side-effect, so they'll
1962      # only be used when explicitly requested.
1963      if test "x$enable_dependency_tracking" = xyes; then
1964	continue
1965      else
1966	break
1967      fi
1968      ;;
1969    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
1970      # This compiler won't grok '-c -o', but also, the minuso test has
1971      # not run yet.  These depmodes are late enough in the game, and
1972      # so weak that their functioning should not be impacted.
1973      am__obj=conftest.${OBJEXT-o}
1974      am__minus_obj=
1975      ;;
1976    none) break ;;
1977    esac
1978    if depmode=$depmode \
1979       source=sub/conftest.c object=$am__obj \
1980       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
1981       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
1982         >/dev/null 2>conftest.err &&
1983       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
1984       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
1985       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
1986       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
1987      # icc doesn't choke on unknown options, it will just issue warnings
1988      # or remarks (even with -Werror).  So we grep stderr for any message
1989      # that says an option was ignored or not supported.
1990      # When given -MP, icc 7.0 and 7.1 complain thusly:
1991      #   icc: Command line warning: ignoring option '-M'; no argument required
1992      # The diagnosis changed in icc 8.0:
1993      #   icc: Command line remark: option '-MP' not supported
1994      if (grep 'ignoring option' conftest.err ||
1995          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
1996        am_cv_$1_dependencies_compiler_type=$depmode
1997        break
1998      fi
1999    fi
2000  done
2001
2002  cd ..
2003  rm -rf conftest.dir
2004else
2005  am_cv_$1_dependencies_compiler_type=none
2006fi
2007])
2008AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2009AM_CONDITIONAL([am__fastdep$1], [
2010  test "x$enable_dependency_tracking" != xno \
2011  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2012])
2013
2014
2015# AM_SET_DEPDIR
2016# -------------
2017# Choose a directory name for dependency files.
2018# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2019AC_DEFUN([AM_SET_DEPDIR],
2020[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2021AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2022])
2023
2024
2025# AM_DEP_TRACK
2026# ------------
2027AC_DEFUN([AM_DEP_TRACK],
2028[AC_ARG_ENABLE([dependency-tracking], [dnl
2029AS_HELP_STRING(
2030  [--enable-dependency-tracking],
2031  [do not reject slow dependency extractors])
2032AS_HELP_STRING(
2033  [--disable-dependency-tracking],
2034  [speeds up one-time build])])
2035if test "x$enable_dependency_tracking" != xno; then
2036  am_depcomp="$ac_aux_dir/depcomp"
2037  AMDEPBACKSLASH='\'
2038  am__nodep='_no'
2039fi
2040AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2041AC_SUBST([AMDEPBACKSLASH])dnl
2042_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2043AC_SUBST([am__nodep])dnl
2044_AM_SUBST_NOTMAKE([am__nodep])dnl
2045])
2046
2047# Generate code to set up dependency tracking.              -*- Autoconf -*-
2048
2049# Copyright (C) 1999-2013 Free Software Foundation, Inc.
2050#
2051# This file is free software; the Free Software Foundation
2052# gives unlimited permission to copy and/or distribute it,
2053# with or without modifications, as long as this notice is preserved.
2054
2055
2056# _AM_OUTPUT_DEPENDENCY_COMMANDS
2057# ------------------------------
2058AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2059[{
2060  # Older Autoconf quotes --file arguments for eval, but not when files
2061  # are listed without --file.  Let's play safe and only enable the eval
2062  # if we detect the quoting.
2063  case $CONFIG_FILES in
2064  *\'*) eval set x "$CONFIG_FILES" ;;
2065  *)   set x $CONFIG_FILES ;;
2066  esac
2067  shift
2068  for mf
2069  do
2070    # Strip MF so we end up with the name of the file.
2071    mf=`echo "$mf" | sed -e 's/:.*$//'`
2072    # Check whether this is an Automake generated Makefile or not.
2073    # We used to match only the files named 'Makefile.in', but
2074    # some people rename them; so instead we look at the file content.
2075    # Grep'ing the first line is not enough: some people post-process
2076    # each Makefile.in and add a new line on top of each file to say so.
2077    # Grep'ing the whole file is not good either: AIX grep has a line
2078    # limit of 2048, but all sed's we know have understand at least 4000.
2079    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
2080      dirpart=`AS_DIRNAME("$mf")`
2081    else
2082      continue
2083    fi
2084    # Extract the definition of DEPDIR, am__include, and am__quote
2085    # from the Makefile without running 'make'.
2086    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
2087    test -z "$DEPDIR" && continue
2088    am__include=`sed -n 's/^am__include = //p' < "$mf"`
2089    test -z "$am__include" && continue
2090    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
2091    # Find all dependency output files, they are included files with
2092    # $(DEPDIR) in their names.  We invoke sed twice because it is the
2093    # simplest approach to changing $(DEPDIR) to its actual value in the
2094    # expansion.
2095    for file in `sed -n "
2096      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
2097	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
2098      # Make sure the directory exists.
2099      test -f "$dirpart/$file" && continue
2100      fdir=`AS_DIRNAME(["$file"])`
2101      AS_MKDIR_P([$dirpart/$fdir])
2102      # echo "creating $dirpart/$file"
2103      echo '# dummy' > "$dirpart/$file"
2104    done
2105  done
2106}
2107])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2108
2109
2110# AM_OUTPUT_DEPENDENCY_COMMANDS
2111# -----------------------------
2112# This macro should only be invoked once -- use via AC_REQUIRE.
2113#
2114# This code is only required when automatic dependency tracking
2115# is enabled.  FIXME.  This creates each '.P' file that we will
2116# need in order to bootstrap the dependency handling code.
2117AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2118[AC_CONFIG_COMMANDS([depfiles],
2119     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2120     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2121])
2122
2123# Do all the work for Automake.                             -*- Autoconf -*-
2124
2125# Copyright (C) 1996-2013 Free Software Foundation, Inc.
2126#
2127# This file is free software; the Free Software Foundation
2128# gives unlimited permission to copy and/or distribute it,
2129# with or without modifications, as long as this notice is preserved.
2130
2131# This macro actually does too much.  Some checks are only needed if
2132# your package does certain things.  But this isn't really a big deal.
2133
2134dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
2135m4_define([AC_PROG_CC],
2136m4_defn([AC_PROG_CC])
2137[_AM_PROG_CC_C_O
2138])
2139
2140# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2141# AM_INIT_AUTOMAKE([OPTIONS])
2142# -----------------------------------------------
2143# The call with PACKAGE and VERSION arguments is the old style
2144# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2145# and VERSION should now be passed to AC_INIT and removed from
2146# the call to AM_INIT_AUTOMAKE.
2147# We support both call styles for the transition.  After
2148# the next Automake release, Autoconf can make the AC_INIT
2149# arguments mandatory, and then we can depend on a new Autoconf
2150# release and drop the old call support.
2151AC_DEFUN([AM_INIT_AUTOMAKE],
2152[AC_PREREQ([2.65])dnl
2153dnl Autoconf wants to disallow AM_ names.  We explicitly allow
2154dnl the ones we care about.
2155m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2156AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2157AC_REQUIRE([AC_PROG_INSTALL])dnl
2158if test "`cd $srcdir && pwd`" != "`pwd`"; then
2159  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2160  # is not polluted with repeated "-I."
2161  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2162  # test to see if srcdir already configured
2163  if test -f $srcdir/config.status; then
2164    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2165  fi
2166fi
2167
2168# test whether we have cygpath
2169if test -z "$CYGPATH_W"; then
2170  if (cygpath --version) >/dev/null 2>/dev/null; then
2171    CYGPATH_W='cygpath -w'
2172  else
2173    CYGPATH_W=echo
2174  fi
2175fi
2176AC_SUBST([CYGPATH_W])
2177
2178# Define the identity of the package.
2179dnl Distinguish between old-style and new-style calls.
2180m4_ifval([$2],
2181[AC_DIAGNOSE([obsolete],
2182             [$0: two- and three-arguments forms are deprecated.])
2183m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2184 AC_SUBST([PACKAGE], [$1])dnl
2185 AC_SUBST([VERSION], [$2])],
2186[_AM_SET_OPTIONS([$1])dnl
2187dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2188m4_if(
2189  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
2190  [ok:ok],,
2191  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2192 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2193 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2194
2195_AM_IF_OPTION([no-define],,
2196[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2197 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2198
2199# Some tools Automake needs.
2200AC_REQUIRE([AM_SANITY_CHECK])dnl
2201AC_REQUIRE([AC_ARG_PROGRAM])dnl
2202AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2203AM_MISSING_PROG([AUTOCONF], [autoconf])
2204AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2205AM_MISSING_PROG([AUTOHEADER], [autoheader])
2206AM_MISSING_PROG([MAKEINFO], [makeinfo])
2207AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2208AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2209AC_REQUIRE([AC_PROG_MKDIR_P])dnl
2210# For better backward compatibility.  To be removed once Automake 1.9.x
2211# dies out for good.  For more background, see:
2212# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2213# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2214AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2215# We need awk for the "check" target.  The system "awk" is bad on
2216# some platforms.
2217AC_REQUIRE([AC_PROG_AWK])dnl
2218AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2219AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2220_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2221	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2222			     [_AM_PROG_TAR([v7])])])
2223_AM_IF_OPTION([no-dependencies],,
2224[AC_PROVIDE_IFELSE([AC_PROG_CC],
2225		  [_AM_DEPENDENCIES([CC])],
2226		  [m4_define([AC_PROG_CC],
2227			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2228AC_PROVIDE_IFELSE([AC_PROG_CXX],
2229		  [_AM_DEPENDENCIES([CXX])],
2230		  [m4_define([AC_PROG_CXX],
2231			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2232AC_PROVIDE_IFELSE([AC_PROG_OBJC],
2233		  [_AM_DEPENDENCIES([OBJC])],
2234		  [m4_define([AC_PROG_OBJC],
2235			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2236AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2237		  [_AM_DEPENDENCIES([OBJCXX])],
2238		  [m4_define([AC_PROG_OBJCXX],
2239			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2240])
2241AC_REQUIRE([AM_SILENT_RULES])dnl
2242dnl The testsuite driver may need to know about EXEEXT, so add the
2243dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2244dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2245AC_CONFIG_COMMANDS_PRE(dnl
2246[m4_provide_if([_AM_COMPILER_EXEEXT],
2247  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2248
2249# POSIX will say in a future version that running "rm -f" with no argument
2250# is OK; and we want to be able to make that assumption in our Makefile
2251# recipes.  So use an aggressive probe to check that the usage we want is
2252# actually supported "in the wild" to an acceptable degree.
2253# See automake bug#10828.
2254# To make any issue more visible, cause the running configure to be aborted
2255# by default if the 'rm' program in use doesn't match our expectations; the
2256# user can still override this though.
2257if rm -f && rm -fr && rm -rf; then : OK; else
2258  cat >&2 <<'END'
2259Oops!
2260
2261Your 'rm' program seems unable to run without file operands specified
2262on the command line, even when the '-f' option is present.  This is contrary
2263to the behaviour of most rm programs out there, and not conforming with
2264the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2265
2266Please tell bug-automake@gnu.org about your system, including the value
2267of your $PATH and any error possibly output before this message.  This
2268can help us improve future automake versions.
2269
2270END
2271  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2272    echo 'Configuration will proceed anyway, since you have set the' >&2
2273    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2274    echo >&2
2275  else
2276    cat >&2 <<'END'
2277Aborting the configuration process, to ensure you take notice of the issue.
2278
2279You can download and install GNU coreutils to get an 'rm' implementation
2280that behaves properly: <http://www.gnu.org/software/coreutils/>.
2281
2282If you want to complete the configuration process using your problematic
2283'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2284to "yes", and re-run configure.
2285
2286END
2287    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2288  fi
2289fi])
2290
2291dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2292dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2293dnl mangled by Autoconf and run in a shell conditional statement.
2294m4_define([_AC_COMPILER_EXEEXT],
2295m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2296
2297# When config.status generates a header, we must update the stamp-h file.
2298# This file resides in the same directory as the config header
2299# that is generated.  The stamp files are numbered to have different names.
2300
2301# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2302# loop where config.status creates the headers, so we can generate
2303# our stamp files there.
2304AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2305[# Compute $1's index in $config_headers.
2306_am_arg=$1
2307_am_stamp_count=1
2308for _am_header in $config_headers :; do
2309  case $_am_header in
2310    $_am_arg | $_am_arg:* )
2311      break ;;
2312    * )
2313      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2314  esac
2315done
2316echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2317
2318# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2319#
2320# This file is free software; the Free Software Foundation
2321# gives unlimited permission to copy and/or distribute it,
2322# with or without modifications, as long as this notice is preserved.
2323
2324# AM_PROG_INSTALL_SH
2325# ------------------
2326# Define $install_sh.
2327AC_DEFUN([AM_PROG_INSTALL_SH],
2328[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2329if test x"${install_sh}" != xset; then
2330  case $am_aux_dir in
2331  *\ * | *\	*)
2332    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2333  *)
2334    install_sh="\${SHELL} $am_aux_dir/install-sh"
2335  esac
2336fi
2337AC_SUBST([install_sh])])
2338
2339# Copyright (C) 2003-2013 Free Software Foundation, Inc.
2340#
2341# This file is free software; the Free Software Foundation
2342# gives unlimited permission to copy and/or distribute it,
2343# with or without modifications, as long as this notice is preserved.
2344
2345# Check whether the underlying file-system supports filenames
2346# with a leading dot.  For instance MS-DOS doesn't.
2347AC_DEFUN([AM_SET_LEADING_DOT],
2348[rm -rf .tst 2>/dev/null
2349mkdir .tst 2>/dev/null
2350if test -d .tst; then
2351  am__leading_dot=.
2352else
2353  am__leading_dot=_
2354fi
2355rmdir .tst 2>/dev/null
2356AC_SUBST([am__leading_dot])])
2357
2358# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2359
2360# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2361#
2362# This file is free software; the Free Software Foundation
2363# gives unlimited permission to copy and/or distribute it,
2364# with or without modifications, as long as this notice is preserved.
2365
2366# AM_MAKE_INCLUDE()
2367# -----------------
2368# Check to see how make treats includes.
2369AC_DEFUN([AM_MAKE_INCLUDE],
2370[am_make=${MAKE-make}
2371cat > confinc << 'END'
2372am__doit:
2373	@echo this is the am__doit target
2374.PHONY: am__doit
2375END
2376# If we don't find an include directive, just comment out the code.
2377AC_MSG_CHECKING([for style of include used by $am_make])
2378am__include="#"
2379am__quote=
2380_am_result=none
2381# First try GNU make style include.
2382echo "include confinc" > confmf
2383# Ignore all kinds of additional output from 'make'.
2384case `$am_make -s -f confmf 2> /dev/null` in #(
2385*the\ am__doit\ target*)
2386  am__include=include
2387  am__quote=
2388  _am_result=GNU
2389  ;;
2390esac
2391# Now try BSD make style include.
2392if test "$am__include" = "#"; then
2393   echo '.include "confinc"' > confmf
2394   case `$am_make -s -f confmf 2> /dev/null` in #(
2395   *the\ am__doit\ target*)
2396     am__include=.include
2397     am__quote="\""
2398     _am_result=BSD
2399     ;;
2400   esac
2401fi
2402AC_SUBST([am__include])
2403AC_SUBST([am__quote])
2404AC_MSG_RESULT([$_am_result])
2405rm -f confinc confmf
2406])
2407
2408# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2409
2410# Copyright (C) 1997-2013 Free Software Foundation, Inc.
2411#
2412# This file is free software; the Free Software Foundation
2413# gives unlimited permission to copy and/or distribute it,
2414# with or without modifications, as long as this notice is preserved.
2415
2416# AM_MISSING_PROG(NAME, PROGRAM)
2417# ------------------------------
2418AC_DEFUN([AM_MISSING_PROG],
2419[AC_REQUIRE([AM_MISSING_HAS_RUN])
2420$1=${$1-"${am_missing_run}$2"}
2421AC_SUBST($1)])
2422
2423# AM_MISSING_HAS_RUN
2424# ------------------
2425# Define MISSING if not defined so far and test if it is modern enough.
2426# If it is, set am_missing_run to use it, otherwise, to nothing.
2427AC_DEFUN([AM_MISSING_HAS_RUN],
2428[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2429AC_REQUIRE_AUX_FILE([missing])dnl
2430if test x"${MISSING+set}" != xset; then
2431  case $am_aux_dir in
2432  *\ * | *\	*)
2433    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2434  *)
2435    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2436  esac
2437fi
2438# Use eval to expand $SHELL
2439if eval "$MISSING --is-lightweight"; then
2440  am_missing_run="$MISSING "
2441else
2442  am_missing_run=
2443  AC_MSG_WARN(['missing' script is too old or missing])
2444fi
2445])
2446
2447# Helper functions for option handling.                     -*- Autoconf -*-
2448
2449# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2450#
2451# This file is free software; the Free Software Foundation
2452# gives unlimited permission to copy and/or distribute it,
2453# with or without modifications, as long as this notice is preserved.
2454
2455# _AM_MANGLE_OPTION(NAME)
2456# -----------------------
2457AC_DEFUN([_AM_MANGLE_OPTION],
2458[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2459
2460# _AM_SET_OPTION(NAME)
2461# --------------------
2462# Set option NAME.  Presently that only means defining a flag for this option.
2463AC_DEFUN([_AM_SET_OPTION],
2464[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2465
2466# _AM_SET_OPTIONS(OPTIONS)
2467# ------------------------
2468# OPTIONS is a space-separated list of Automake options.
2469AC_DEFUN([_AM_SET_OPTIONS],
2470[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2471
2472# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2473# -------------------------------------------
2474# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2475AC_DEFUN([_AM_IF_OPTION],
2476[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2477
2478# Copyright (C) 1999-2013 Free Software Foundation, Inc.
2479#
2480# This file is free software; the Free Software Foundation
2481# gives unlimited permission to copy and/or distribute it,
2482# with or without modifications, as long as this notice is preserved.
2483
2484# _AM_PROG_CC_C_O
2485# ---------------
2486# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
2487# to automatically call this.
2488AC_DEFUN([_AM_PROG_CC_C_O],
2489[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2490AC_REQUIRE_AUX_FILE([compile])dnl
2491AC_LANG_PUSH([C])dnl
2492AC_CACHE_CHECK(
2493  [whether $CC understands -c and -o together],
2494  [am_cv_prog_cc_c_o],
2495  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
2496  # Make sure it works both with $CC and with simple cc.
2497  # Following AC_PROG_CC_C_O, we do the test twice because some
2498  # compilers refuse to overwrite an existing .o file with -o,
2499  # though they will create one.
2500  am_cv_prog_cc_c_o=yes
2501  for am_i in 1 2; do
2502    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
2503         && test -f conftest2.$ac_objext; then
2504      : OK
2505    else
2506      am_cv_prog_cc_c_o=no
2507      break
2508    fi
2509  done
2510  rm -f core conftest*
2511  unset am_i])
2512if test "$am_cv_prog_cc_c_o" != yes; then
2513   # Losing compiler, so override with the script.
2514   # FIXME: It is wrong to rewrite CC.
2515   # But if we don't then we get into trouble of one sort or another.
2516   # A longer-term fix would be to have automake use am__CC in this case,
2517   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
2518   CC="$am_aux_dir/compile $CC"
2519fi
2520AC_LANG_POP([C])])
2521
2522# For backward compatibility.
2523AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
2524
2525# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2526#
2527# This file is free software; the Free Software Foundation
2528# gives unlimited permission to copy and/or distribute it,
2529# with or without modifications, as long as this notice is preserved.
2530
2531# AM_RUN_LOG(COMMAND)
2532# -------------------
2533# Run COMMAND, save the exit status in ac_status, and log it.
2534# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
2535AC_DEFUN([AM_RUN_LOG],
2536[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
2537   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
2538   ac_status=$?
2539   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
2540   (exit $ac_status); }])
2541
2542# Check to make sure that the build environment is sane.    -*- Autoconf -*-
2543
2544# Copyright (C) 1996-2013 Free Software Foundation, Inc.
2545#
2546# This file is free software; the Free Software Foundation
2547# gives unlimited permission to copy and/or distribute it,
2548# with or without modifications, as long as this notice is preserved.
2549
2550# AM_SANITY_CHECK
2551# ---------------
2552AC_DEFUN([AM_SANITY_CHECK],
2553[AC_MSG_CHECKING([whether build environment is sane])
2554# Reject unsafe characters in $srcdir or the absolute working directory
2555# name.  Accept space and tab only in the latter.
2556am_lf='
2557'
2558case `pwd` in
2559  *[[\\\"\#\$\&\'\`$am_lf]]*)
2560    AC_MSG_ERROR([unsafe absolute working directory name]);;
2561esac
2562case $srcdir in
2563  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
2564    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
2565esac
2566
2567# Do 'set' in a subshell so we don't clobber the current shell's
2568# arguments.  Must try -L first in case configure is actually a
2569# symlink; some systems play weird games with the mod time of symlinks
2570# (eg FreeBSD returns the mod time of the symlink's containing
2571# directory).
2572if (
2573   am_has_slept=no
2574   for am_try in 1 2; do
2575     echo "timestamp, slept: $am_has_slept" > conftest.file
2576     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
2577     if test "$[*]" = "X"; then
2578	# -L didn't work.
2579	set X `ls -t "$srcdir/configure" conftest.file`
2580     fi
2581     if test "$[*]" != "X $srcdir/configure conftest.file" \
2582	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
2583
2584	# If neither matched, then we have a broken ls.  This can happen
2585	# if, for instance, CONFIG_SHELL is bash and it inherits a
2586	# broken ls alias from the environment.  This has actually
2587	# happened.  Such a system could not be considered "sane".
2588	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
2589  alias in your environment])
2590     fi
2591     if test "$[2]" = conftest.file || test $am_try -eq 2; then
2592       break
2593     fi
2594     # Just in case.
2595     sleep 1
2596     am_has_slept=yes
2597   done
2598   test "$[2]" = conftest.file
2599   )
2600then
2601   # Ok.
2602   :
2603else
2604   AC_MSG_ERROR([newly created file is older than distributed files!
2605Check your system clock])
2606fi
2607AC_MSG_RESULT([yes])
2608# If we didn't sleep, we still need to ensure time stamps of config.status and
2609# generated files are strictly newer.
2610am_sleep_pid=
2611if grep 'slept: no' conftest.file >/dev/null 2>&1; then
2612  ( sleep 1 ) &
2613  am_sleep_pid=$!
2614fi
2615AC_CONFIG_COMMANDS_PRE(
2616  [AC_MSG_CHECKING([that generated files are newer than configure])
2617   if test -n "$am_sleep_pid"; then
2618     # Hide warnings about reused PIDs.
2619     wait $am_sleep_pid 2>/dev/null
2620   fi
2621   AC_MSG_RESULT([done])])
2622rm -f conftest.file
2623])
2624
2625# Copyright (C) 2009-2013 Free Software Foundation, Inc.
2626#
2627# This file is free software; the Free Software Foundation
2628# gives unlimited permission to copy and/or distribute it,
2629# with or without modifications, as long as this notice is preserved.
2630
2631# AM_SILENT_RULES([DEFAULT])
2632# --------------------------
2633# Enable less verbose build rules; with the default set to DEFAULT
2634# ("yes" being less verbose, "no" or empty being verbose).
2635AC_DEFUN([AM_SILENT_RULES],
2636[AC_ARG_ENABLE([silent-rules], [dnl
2637AS_HELP_STRING(
2638  [--enable-silent-rules],
2639  [less verbose build output (undo: "make V=1")])
2640AS_HELP_STRING(
2641  [--disable-silent-rules],
2642  [verbose build output (undo: "make V=0")])dnl
2643])
2644case $enable_silent_rules in @%:@ (((
2645  yes) AM_DEFAULT_VERBOSITY=0;;
2646   no) AM_DEFAULT_VERBOSITY=1;;
2647    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
2648esac
2649dnl
2650dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
2651dnl do not support nested variable expansions.
2652dnl See automake bug#9928 and bug#10237.
2653am_make=${MAKE-make}
2654AC_CACHE_CHECK([whether $am_make supports nested variables],
2655   [am_cv_make_support_nested_variables],
2656   [if AS_ECHO([['TRUE=$(BAR$(V))
2657BAR0=false
2658BAR1=true
2659V=1
2660am__doit:
2661	@$(TRUE)
2662.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
2663  am_cv_make_support_nested_variables=yes
2664else
2665  am_cv_make_support_nested_variables=no
2666fi])
2667if test $am_cv_make_support_nested_variables = yes; then
2668  dnl Using '$V' instead of '$(V)' breaks IRIX make.
2669  AM_V='$(V)'
2670  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
2671else
2672  AM_V=$AM_DEFAULT_VERBOSITY
2673  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
2674fi
2675AC_SUBST([AM_V])dnl
2676AM_SUBST_NOTMAKE([AM_V])dnl
2677AC_SUBST([AM_DEFAULT_V])dnl
2678AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
2679AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
2680AM_BACKSLASH='\'
2681AC_SUBST([AM_BACKSLASH])dnl
2682_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
2683])
2684
2685# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2686#
2687# This file is free software; the Free Software Foundation
2688# gives unlimited permission to copy and/or distribute it,
2689# with or without modifications, as long as this notice is preserved.
2690
2691# AM_PROG_INSTALL_STRIP
2692# ---------------------
2693# One issue with vendor 'install' (even GNU) is that you can't
2694# specify the program used to strip binaries.  This is especially
2695# annoying in cross-compiling environments, where the build's strip
2696# is unlikely to handle the host's binaries.
2697# Fortunately install-sh will honor a STRIPPROG variable, so we
2698# always use install-sh in "make install-strip", and initialize
2699# STRIPPROG with the value of the STRIP variable (set by the user).
2700AC_DEFUN([AM_PROG_INSTALL_STRIP],
2701[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2702# Installed binaries are usually stripped using 'strip' when the user
2703# run "make install-strip".  However 'strip' might not be the right
2704# tool to use in cross-compilation environments, therefore Automake
2705# will honor the 'STRIP' environment variable to overrule this program.
2706dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
2707if test "$cross_compiling" != no; then
2708  AC_CHECK_TOOL([STRIP], [strip], :)
2709fi
2710INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
2711AC_SUBST([INSTALL_STRIP_PROGRAM])])
2712
2713# Copyright (C) 2006-2013 Free Software Foundation, Inc.
2714#
2715# This file is free software; the Free Software Foundation
2716# gives unlimited permission to copy and/or distribute it,
2717# with or without modifications, as long as this notice is preserved.
2718
2719# _AM_SUBST_NOTMAKE(VARIABLE)
2720# ---------------------------
2721# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
2722# This macro is traced by Automake.
2723AC_DEFUN([_AM_SUBST_NOTMAKE])
2724
2725# AM_SUBST_NOTMAKE(VARIABLE)
2726# --------------------------
2727# Public sister of _AM_SUBST_NOTMAKE.
2728AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
2729
2730# Check how to create a tarball.                            -*- Autoconf -*-
2731
2732# Copyright (C) 2004-2013 Free Software Foundation, Inc.
2733#
2734# This file is free software; the Free Software Foundation
2735# gives unlimited permission to copy and/or distribute it,
2736# with or without modifications, as long as this notice is preserved.
2737
2738# _AM_PROG_TAR(FORMAT)
2739# --------------------
2740# Check how to create a tarball in format FORMAT.
2741# FORMAT should be one of 'v7', 'ustar', or 'pax'.
2742#
2743# Substitute a variable $(am__tar) that is a command
2744# writing to stdout a FORMAT-tarball containing the directory
2745# $tardir.
2746#     tardir=directory && $(am__tar) > result.tar
2747#
2748# Substitute a variable $(am__untar) that extract such
2749# a tarball read from stdin.
2750#     $(am__untar) < result.tar
2751#
2752AC_DEFUN([_AM_PROG_TAR],
2753[# Always define AMTAR for backward compatibility.  Yes, it's still used
2754# in the wild :-(  We should find a proper way to deprecate it ...
2755AC_SUBST([AMTAR], ['$${TAR-tar}'])
2756
2757# We'll loop over all known methods to create a tar archive until one works.
2758_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
2759
2760m4_if([$1], [v7],
2761  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
2762
2763  [m4_case([$1],
2764    [ustar],
2765     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
2766      # There is notably a 21 bits limit for the UID and the GID.  In fact,
2767      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
2768      # and bug#13588).
2769      am_max_uid=2097151 # 2^21 - 1
2770      am_max_gid=$am_max_uid
2771      # The $UID and $GID variables are not portable, so we need to resort
2772      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
2773      # below are definitely unexpected, so allow the users to see them
2774      # (that is, avoid stderr redirection).
2775      am_uid=`id -u || echo unknown`
2776      am_gid=`id -g || echo unknown`
2777      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
2778      if test $am_uid -le $am_max_uid; then
2779         AC_MSG_RESULT([yes])
2780      else
2781         AC_MSG_RESULT([no])
2782         _am_tools=none
2783      fi
2784      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
2785      if test $am_gid -le $am_max_gid; then
2786         AC_MSG_RESULT([yes])
2787      else
2788        AC_MSG_RESULT([no])
2789        _am_tools=none
2790      fi],
2791
2792  [pax],
2793    [],
2794
2795  [m4_fatal([Unknown tar format])])
2796
2797  AC_MSG_CHECKING([how to create a $1 tar archive])
2798
2799  # Go ahead even if we have the value already cached.  We do so because we
2800  # need to set the values for the 'am__tar' and 'am__untar' variables.
2801  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
2802
2803  for _am_tool in $_am_tools; do
2804    case $_am_tool in
2805    gnutar)
2806      for _am_tar in tar gnutar gtar; do
2807        AM_RUN_LOG([$_am_tar --version]) && break
2808      done
2809      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
2810      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
2811      am__untar="$_am_tar -xf -"
2812      ;;
2813    plaintar)
2814      # Must skip GNU tar: if it does not support --format= it doesn't create
2815      # ustar tarball either.
2816      (tar --version) >/dev/null 2>&1 && continue
2817      am__tar='tar chf - "$$tardir"'
2818      am__tar_='tar chf - "$tardir"'
2819      am__untar='tar xf -'
2820      ;;
2821    pax)
2822      am__tar='pax -L -x $1 -w "$$tardir"'
2823      am__tar_='pax -L -x $1 -w "$tardir"'
2824      am__untar='pax -r'
2825      ;;
2826    cpio)
2827      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
2828      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
2829      am__untar='cpio -i -H $1 -d'
2830      ;;
2831    none)
2832      am__tar=false
2833      am__tar_=false
2834      am__untar=false
2835      ;;
2836    esac
2837
2838    # If the value was cached, stop now.  We just wanted to have am__tar
2839    # and am__untar set.
2840    test -n "${am_cv_prog_tar_$1}" && break
2841
2842    # tar/untar a dummy directory, and stop if the command works.
2843    rm -rf conftest.dir
2844    mkdir conftest.dir
2845    echo GrepMe > conftest.dir/file
2846    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
2847    rm -rf conftest.dir
2848    if test -s conftest.tar; then
2849      AM_RUN_LOG([$am__untar <conftest.tar])
2850      AM_RUN_LOG([cat conftest.dir/file])
2851      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
2852    fi
2853  done
2854  rm -rf conftest.dir
2855
2856  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
2857  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
2858
2859AC_SUBST([am__tar])
2860AC_SUBST([am__untar])
2861]) # _AM_PROG_TAR
2862
2863m4_include([m4/gettext.m4])
2864m4_include([m4/iconv.m4])
2865m4_include([m4/intlmacosx.m4])
2866m4_include([m4/lib-ld.m4])
2867m4_include([m4/lib-link.m4])
2868m4_include([m4/lib-prefix.m4])
2869m4_include([m4/nls.m4])
2870m4_include([m4/po.m4])
2871m4_include([m4/progtest.m4])
2872