~vanvugt/+junk/mediatomb

« back to all changes in this revision

Viewing changes to .pc/ffmpegthumbnailer-2.0.patch/acinclude.m4

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2010-02-22 20:16:31 UTC
  • mfrom: (4.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100222201631-fgwswo4s4ogdr8x8
Tags: 0.12.0~svn2018-6ubuntu1
* Merge from debian unstable, Ubuntu remaining changes:
  - Add OR depends on abrowser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ====================================================================
 
2
# ACX_PTHREAD
 
3
# ====================================================================
 
4
#
 
5
# This script has been downloaded from
 
6
# http://autoconf-archive.cryp.to/acx_pthread.html
 
7
#
 
8
# Copyright © 2006 Steven G. Johnson <stevenj@alum.mit.edu>
 
9
#
 
10
# This program is free software; you can redistribute it and/or modify
 
11
# it under the terms of the GNU General Public License as published by
 
12
# the Free Software Foundation; either version 2 of the License, or (at
 
13
# your option) any later version.
 
14
#
 
15
# This program is distributed in the hope that it will be useful, but
 
16
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
18
# General Public License for more details.
 
19
#
 
20
# You should have received a copy of the GNU General Public License
 
21
# along with this program; if not, write to the Free Software
 
22
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
23
# USA.
 
24
#
 
25
# As a special exception, the respective Autoconf Macro's copyright
 
26
# owner gives unlimited permission to copy, distribute and modify the
 
27
# configure scripts that are the output of Autoconf when processing the
 
28
# Macro. You need not follow the terms of the GNU General Public
 
29
# License when using or distributing such scripts, even though portions
 
30
# of the text of the Macro appear in them. The GNU General Public
 
31
# License (GPL) does govern all other use of the material that
 
32
# constitutes the Autoconf Macro.
 
33
#
 
34
# This special exception to the GPL applies to versions of the
 
35
# Autoconf Macro released by the Autoconf Macro Archive. When you make
 
36
# and distribute a modified version of the Autoconf Macro, you may
 
37
# extend this special exception to the GPL to apply to your modified
 
38
# version as well.
 
39
 
 
40
AC_DEFUN([ACX_PTHREAD], [
 
41
AC_REQUIRE([AC_CANONICAL_HOST])
 
42
AC_LANG_SAVE
 
43
AC_LANG_C
 
44
acx_pthread_ok=no
 
45
 
 
46
# We used to check for pthread.h first, but this fails if pthread.h
 
47
# requires special compiler flags (e.g. on True64 or Sequent).
 
48
# It gets checked for in the link test anyway.
 
49
 
 
50
# First of all, check if the user has set any of the PTHREAD_LIBS,
 
51
# etcetera environment variables, and if threads linking works using
 
52
# them:
 
53
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
 
54
        save_CFLAGS="$CFLAGS"
 
55
        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 
56
        save_LIBS="$LIBS"
 
57
        LIBS="$PTHREAD_LIBS $LIBS"
 
58
        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
 
59
        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
 
60
        AC_MSG_RESULT($acx_pthread_ok)
 
61
        if test x"$acx_pthread_ok" = xno; then
 
62
                PTHREAD_LIBS=""
 
63
                PTHREAD_CFLAGS=""
 
64
        fi
 
65
        LIBS="$save_LIBS"
 
66
        CFLAGS="$save_CFLAGS"
 
67
fi
 
68
 
 
69
# We must check for the threads library under a number of different
 
70
# names; the ordering is very important because some systems
 
71
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
 
72
# libraries is broken (non-POSIX).
 
73
 
 
74
# Create a list of thread flags to try.  Items starting with a "-" are
 
75
# C compiler flags, and other items are library names, except for "none"
 
76
# which indicates that we try without any flags at all, and "pthread-config"
 
77
# which is a program returning the flags for the Pth emulation library.
 
78
 
 
79
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
 
80
 
 
81
# The ordering *is* (sometimes) important.  Some notes on the
 
82
# individual items follow:
 
83
 
 
84
# pthreads: AIX (must check this before -lpthread)
 
85
# none: in case threads are in libc; should be tried before -Kthread and
 
86
#       other compiler flags to prevent continual compiler warnings
 
87
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
 
88
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
 
89
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
 
90
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
 
91
# -pthreads: Solaris/gcc
 
92
# -mthreads: Mingw32/gcc, Lynx/gcc
 
93
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
 
94
#      doesn't hurt to check since this sometimes defines pthreads too;
 
95
#      also defines -D_REENTRANT)
 
96
#      ... -mt is also the pthreads flag for HP/aCC
 
97
# pthread: Linux, etcetera
 
98
# --thread-safe: KAI C++
 
99
# pthread-config: use pthread-config program (for GNU Pth library)
 
100
 
 
101
case "${host_cpu}-${host_os}" in
 
102
        *solaris*)
 
103
 
 
104
        # On Solaris (at least, for some versions), libc contains stubbed
 
105
        # (non-functional) versions of the pthreads routines, so link-based
 
106
        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
 
107
        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
 
108
        # a function called by this macro, so we could check for that, but
 
109
        # who knows whether they'll stub that too in a future libc.)  So,
 
110
        # we'll just look for -pthreads and -lpthread first:
 
111
 
 
112
        acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
 
113
        ;;
 
114
esac
 
115
 
 
116
if test x"$acx_pthread_ok" = xno; then
 
117
for flag in $acx_pthread_flags; do
 
118
 
 
119
        case $flag in
 
120
                none)
 
121
                AC_MSG_CHECKING([whether pthreads work without any flags])
 
122
                ;;
 
123
 
 
124
                -*)
 
125
                AC_MSG_CHECKING([whether pthreads work with $flag])
 
126
                PTHREAD_CFLAGS="$flag"
 
127
                ;;
 
128
 
 
129
                pthread-config)
 
130
                AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
 
131
                if test x"$acx_pthread_config" = xno; then continue; fi
 
132
                PTHREAD_CFLAGS="`pthread-config --cflags`"
 
133
                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
 
134
                ;;
 
135
 
 
136
                *)
 
137
                AC_MSG_CHECKING([for the pthreads library -l$flag])
 
138
                PTHREAD_LIBS="-l$flag"
 
139
                ;;
 
140
        esac
 
141
 
 
142
        save_LIBS="$LIBS"
 
143
        save_CFLAGS="$CFLAGS"
 
144
        LIBS="$PTHREAD_LIBS $LIBS"
 
145
        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 
146
 
 
147
        # Check for various functions.  We must include pthread.h,
 
148
        # since some functions may be macros.  (On the Sequent, we
 
149
        # need a special flag -Kthread to make this header compile.)
 
150
        # We check for pthread_join because it is in -lpthread on IRIX
 
151
        # while pthread_create is in libc.  We check for pthread_attr_init
 
152
        # due to DEC craziness with -lpthreads.  We check for
 
153
        # pthread_cleanup_push because it is one of the few pthread
 
154
        # functions on Solaris that doesn't have a non-functional libc stub.
 
155
        # We try pthread_create on general principles.
 
156
        AC_TRY_LINK([#include <pthread.h>],
 
157
                    [pthread_t th; pthread_join(th, 0);
 
158
                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
 
159
                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
 
160
                    [acx_pthread_ok=yes])
 
161
 
 
162
        LIBS="$save_LIBS"
 
163
        CFLAGS="$save_CFLAGS"
 
164
 
 
165
        AC_MSG_RESULT($acx_pthread_ok)
 
166
        if test "x$acx_pthread_ok" = xyes; then
 
167
                break;
 
168
        fi
 
169
 
 
170
        PTHREAD_LIBS=""
 
171
        PTHREAD_CFLAGS=""
 
172
done
 
173
fi
 
174
 
 
175
# Various other checks:
 
176
if test "x$acx_pthread_ok" = xyes; then
 
177
        save_LIBS="$LIBS"
 
178
        LIBS="$PTHREAD_LIBS $LIBS"
 
179
        save_CFLAGS="$CFLAGS"
 
180
        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 
181
 
 
182
        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
 
183
        AC_MSG_CHECKING([for joinable pthread attribute])
 
184
        attr_name=unknown
 
185
        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
 
186
            AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
 
187
                        [attr_name=$attr; break])
 
188
        done
 
189
        AC_MSG_RESULT($attr_name)
 
190
        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
 
191
            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
 
192
                               [Define to necessary symbol if this constant
 
193
                                uses a non-standard name on your system.])
 
194
        fi
 
195
 
 
196
        AC_MSG_CHECKING([if more special flags are required for pthreads])
 
197
        flag=no
 
198
        case "${host_cpu}-${host_os}" in
 
199
            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
 
200
            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
 
201
        esac
 
202
        AC_MSG_RESULT(${flag})
 
203
        if test "x$flag" != xno; then
 
204
            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
 
205
        fi
 
206
 
 
207
        LIBS="$save_LIBS"
 
208
        CFLAGS="$save_CFLAGS"
 
209
 
 
210
        # More AIX lossage: must compile with xlc_r or cc_r
 
211
        if test x"$GCC" != xyes; then
 
212
          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
 
213
        else
 
214
          PTHREAD_CC=$CC
 
215
        fi
 
216
else
 
217
        PTHREAD_CC="$CC"
 
218
fi
 
219
 
 
220
AC_SUBST(PTHREAD_LIBS)
 
221
AC_SUBST(PTHREAD_CFLAGS)
 
222
AC_SUBST(PTHREAD_CC)
 
223
 
 
224
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
 
225
if test x"$acx_pthread_ok" = xyes; then
 
226
        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
 
227
        :
 
228
else
 
229
        acx_pthread_ok=no
 
230
        $2
 
231
fi
 
232
AC_LANG_RESTORE
 
233
])dnl ACX_PTHREAD
 
234
 
 
235
# sets the search path which is used by MT_HAVE_PACKAGE
 
236
AC_DEFUN([MT_SET_SEARCHPATH],
 
237
[
 
238
    AC_REQUIRE([AC_CANONICAL_HOST])
 
239
 
 
240
    MT_SEARCHPATH="/usr/local"
 
241
    case $host in
 
242
        *-*-darwin*)
 
243
            MT_SEARCHPATH="/opt/local"
 
244
        ;;
 
245
    esac
 
246
 
 
247
    AC_ARG_WITH(search,
 
248
        AC_HELP_STRING([--with-search=DIR], [Additionally search for packages in DIR]),
 
249
        [
 
250
            MT_SEARCHPATH=$withval
 
251
            AC_MSG_NOTICE([Will also search for packages in ${MT_SEARCHPATH}])
 
252
        ]
 
253
    )
 
254
 
 
255
    MT_SEARCHPATH_HEADERS="${MT_SEARCHPATH}/include"
 
256
    MT_SEARCHPATH_LIBS="${MT_SEARCHPATH}/lib"
 
257
    MT_SEARCHPATH_PROGS="${MT_SEARCHPATH}/bin"
 
258
 
 
259
    AC_SUBST(MT_SEARCHPATH)
 
260
    AC_SUBST(MT_SEARCHPATH_HEADERS)
 
261
    AC_SUBST(MT_SEARCHPATH_LIBS)
 
262
    AC_SUBST(MT_SEARCHPATH_PROGS)
 
263
])
 
264
 
 
265
 
 
266
# $1 with parameter/package name
 
267
# $2 library name
 
268
# $3 function name
 
269
 
270
# returns:
 
271
#   mt_$1_library_status
 
272
#   mt_$1_libs
 
273
#   mt_$1_ldflags
 
274
 
 
275
AC_DEFUN([MT_CHECK_LIBRARY_INTERNAL],
 
276
[
 
277
    mt_$1_arg_default=yes
 
278
    mt_$1_library_status=yes
 
279
 
 
280
    LIBS_SAVE=$LIBS
 
281
    LDFLAGS_SAVE=$LDFLAGS
 
282
    CFLAGS_SAVE=$CFLAGS
 
283
    CXXFLAGS_SAVE=$CXXFLAGS
 
284
    CPPFLAGS_SAVE=$CPPFLAGS
 
285
 
 
286
    AC_ARG_WITH($1-libs,
 
287
        AC_HELP_STRING([--with-$1-libs=DIR], [search for $1 libraries in DIR]),
 
288
        [
 
289
            mt_$1_search_libs="$withval"
 
290
            AC_MSG_NOTICE([Will search for $1 libs in $withval])
 
291
        ]
 
292
    )
 
293
 
 
294
    if test "$mt_$1_search_libs" ; then
 
295
        unset ac_cv_lib_$2_$3
 
296
        LDFLAGS="$LDFLAGS -L$mt_$1_search_libs"
 
297
        AC_CHECK_LIB($2, $3,
 
298
            [
 
299
                mt_$1_libs="-l$2"
 
300
                mt_$1_ldflags="-L$mt_$1_search_libs"
 
301
            ],
 
302
            [
 
303
                AC_MSG_ERROR([$1 library not found in requested location $mt_$1_search_libs])
 
304
            ]
 
305
        )
 
306
    else
 
307
        unset ac_cv_lib_$2_$3
 
308
        AC_CHECK_LIB($2, $3,
 
309
            [
 
310
                mt_$1_libs="-l$2"
 
311
            ],
 
312
            [
 
313
                LDFLAGS="$LDFLAGS -L$MT_SEARCHPATH_LIBS"
 
314
                unset ac_cv_lib_$2_$3
 
315
                AC_CHECK_LIB($2, $3,
 
316
                    [
 
317
                        mt_$1_libs="-l$2"
 
318
                        mt_$1_ldflags="-L$MT_SEARCHPATH_LIBS" 
 
319
                    ],
 
320
                    [
 
321
                        mt_$1_library_status=missing
 
322
                    ]
 
323
                )
 
324
            ]
 
325
        )
 
326
    fi
 
327
 
 
328
    if test "x$mt_$1_library_status" != xyes; then
 
329
        mt_$1_libs=""
 
330
        mt_$1_ldflags=""
 
331
    fi
 
332
 
 
333
    LIBS=$LIBS_SAVE
 
334
    LDFLAGS=$LDFLAGS_SAVE
 
335
    CFLAGS=$CFLAGS_SAVE
 
336
    CXXFLAGS=$CXXFLAGS_SAVE
 
337
    CPPFLAGS=$CPPFLAGS_SAVE
 
338
])
 
339
 
 
340
# $1 with parameter / library name
 
341
# $2 header without .h extension
 
342
# $3 fail / pass
 
343
#
 
344
# returns:
 
345
#   mt_$1_header_status
 
346
#   mt_$1_cxxflags
 
347
 
 
348
AC_DEFUN([MT_CHECK_HEADER_INTERNAL],
 
349
[
 
350
    LIBS_SAVE=$LIBS
 
351
    LDFLAGS_SAVE=$LDFLAGS
 
352
    CFLAGS_SAVE=$CFLAGS
 
353
    CXXFLAGS_SAVE=$CXXFLAGS
 
354
    CPPFLAGS_SAVE=$CPPFLAGS
 
355
 
 
356
    mt_$1_header_status=yes
 
357
 
 
358
    AC_ARG_WITH($1-h,
 
359
        AC_HELP_STRING([--with-$1-h=DIR], [search for $1 headers in DIR]),
 
360
        [
 
361
            mt_$1_search_headers="$withval"
 
362
            AC_MSG_NOTICE([Will search for $1 headers in $withval])
 
363
        ]
 
364
    )
 
365
 
 
366
    if test "$mt_$1_search_headers" ; then
 
367
        unset translit(ac_cv_header_$2_h, `/.-', `___')
 
368
        CFLAGS="$CFLAGS -I${mt_$1_search_headers}"
 
369
        CXXFLAGS="$CXXFLAGS -I${mt_$1_search_headers}"
 
370
        CPPFLAGS="$CPPFLAGS -I${mt_$1_search_headers}"
 
371
        AC_CHECK_HEADER($mt_$1_search_headers/$2.h,
 
372
            [
 
373
                mt_$1_cxxflags="-I${mt_$1_search_headers}"
 
374
            ],
 
375
            [
 
376
                mt_$1_header_status=missing
 
377
                if test "$3" = "pass"; then
 
378
                    AC_MSG_NOTICE([$1 headers not found in requested location $mt_$1_search_headers])
 
379
                else
 
380
                    AC_MSG_ERROR([$1 headers not found in requested location $mt_$1_search_headers])
 
381
                fi
 
382
            ]
 
383
        )
 
384
    else
 
385
        unset translit(ac_cv_header_$2_h, `/.-', `___')
 
386
        AC_CHECK_HEADER($2.h,
 
387
            [],
 
388
            [
 
389
                CFLAGS="$CFLAGS -I$MT_SEARCHPATH_HEADERS"
 
390
                CXXFLAGS="$CXXFLAGS -I$MT_SEARCHPATH_HEADERS"
 
391
                CPPFLAGS="$CPPFLAGS -I$MT_SEARCHPATH_HEADERS"
 
392
                unset translit(ac_cv_header_$2_h, `/.-', `___')
 
393
                AC_CHECK_HEADER($MT_SEARCHPATH_HEADERS/$2.h,
 
394
                    [
 
395
                        mt_$1_cxxflags="-I${MT_SEARCHPATH_HEADERS}"
 
396
                    ],
 
397
                    [
 
398
                        mt_$1_header_status=missing
 
399
                    ]
 
400
                )
 
401
            ]
 
402
        )
 
403
    fi
 
404
 
 
405
    if test "x$mt_$1_header_status" != xyes; then
 
406
        mt_$1_cxxflags=""
 
407
    fi
 
408
 
 
409
    LIBS=$LIBS_SAVE
 
410
    LDFLAGS=$LDFLAGS_SAVE
 
411
    CFLAGS=$CFLAGS_SAVE
 
412
    CXXFLAGS=$CXXFLAGS_SAVE
 
413
    CPPFLAGS=$CPPFLAGS_SAVE
 
414
])
 
415
 
 
416
 
 
417
# $1 package name
 
418
# $2 header name (without .h extension)
 
419
# $3 library name
 
420
# $4 function name
 
421
#
 
422
# returns:
 
423
#   mt_$1_package_status
 
424
#   $1_CFLAGS
 
425
#   $1_LIBS
 
426
#   $1_LDFLAGS
 
427
   
 
428
AC_DEFUN([MT_CHECK_PACKAGE_INTERNAL],
 
429
[
 
430
    MT_CHECK_HEADER_INTERNAL([$1], [$2])
 
431
    mt_$1_package_status=${mt_$1_header_status}
 
432
  
 
433
    if test "x$mt_$1_package_status" = xyes; then 
 
434
        MT_CHECK_LIBRARY_INTERNAL([$1], [$3], [$4])
 
435
        mt_$1_package_status=${mt_$1_library_status}
 
436
    fi
 
437
    
 
438
    if test "x$mt_$1_package_status" = xyes; then
 
439
        translit($1, `a-z/.-', `A-Z___')_CFLAGS=${mt_$1_cxxflags}
 
440
        translit($1, `a-z/.-', `A-Z___')_LIBS=${mt_$1_libs}
 
441
        translit($1, `a-z/.-', `A-Z___')_LDFLAGS=${mt_$1_ldflags}
 
442
    fi 
 
443
])
 
444
 
 
445
# $1 option name
 
446
# $2 enable/disable
 
447
# $3 help text
 
448
# $4 action if enabled
 
449
# $5 action if disabled
 
450
#
 
451
# returns:
 
452
#   $1_OPTION_ENABLED
 
453
#   $1_OPTION_REQUESTED
 
454
 
 
455
AC_DEFUN([MT_OPTION],
 
456
[
 
457
 
 
458
    translit(mt_$1_option_enabled, `/.-', `___')=
 
459
    translit(mt_$1_option_requested, `/.-', `___')=no
 
460
    if test "x$2" = xdisable; then
 
461
        translit(mt_$1_option_enabled, `/.-', `___')=yes
 
462
    else
 
463
        translit(mt_$1_option_enabled, `/.-', `___')=no
 
464
    fi
 
465
 
 
466
    AC_ARG_ENABLE([$1],
 
467
        AC_HELP_STRING([--$2-$1], [$3]),
 
468
        [
 
469
            translit(mt_$1_option_enabled, `/.-', `___')=$enableval
 
470
            translit(mt_$1_option_requested, `/.-', `___')=yes
 
471
        ]
 
472
    )
 
473
 
 
474
    translit($1, `a-z/.-', `A-Z___')_OPTION_ENABLED=${translit(mt_$1_option_enabled,`/.-', `___')}
 
475
    translit($1, `a-z/.-', `A-Z___')_OPTION_REQUESTED=${translit(mt_$1_option_requested, `/.-', `___')}
 
476
 
 
477
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_OPTION_ENABLED)
 
478
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_OPTION_REQUESTED)
 
479
 
 
480
    AS_IF([test "x${translit(mt_$1_option_enabled,`/.-', `___')}" = xyes], [$4], [$5])[]dnl
 
481
])
 
482
 
 
483
# $1 package name
 
484
# $2 enable/disable
 
485
# $3 enable/disable help string
 
486
# $4 header name (without .h)
 
487
# $5 library name
 
488
# $6 function name
 
489
# returns substed:
 
490
#   $1_STATUS
 
491
#   $1_LDFLAGS
 
492
#   $1_LIBS
 
493
#   $1_CFLAGS
 
494
 
 
495
AC_DEFUN([MT_CHECK_OPTIONAL_PACKAGE], 
 
496
[
 
497
    mt_$1_status=yes
 
498
 
 
499
    MT_OPTION([$1], [$2], [$3],[],[])
 
500
 
 
501
    if test "x${translit($1, `a-z/.-', `A-Z___')_OPTION_ENABLED}" = xyes; then
 
502
        MT_CHECK_PACKAGE_INTERNAL([$1], [$4], [$5], [$6])
 
503
        mt_$1_status=${mt_$1_package_status}
 
504
    else
 
505
        mt_$1_status=disabled
 
506
    fi
 
507
    
 
508
    if ((test "x${translit($1, `a-z/.-', `A-Z___')_OPTION_ENABLED}" = xyes) &&
 
509
        (test "x${translit($1, `a-z/.-', `A-Z___')_OPTION_REQUESTED}" = xyes) &&
 
510
        (test "x$mt_$1_status" != xyes)); then
 
511
        AC_MSG_ERROR([unable to configure $1 support])
 
512
    fi
 
513
 
 
514
    if test "x$mt_$1_status" = xyes; then
 
515
        AC_DEFINE(translit(HAVE_$1, `a-z/.-', `A-Z___'), [1], [$1 library presence])
 
516
    fi
 
517
    
 
518
    translit($1, `a-z/.-', `A-Z___')_STATUS=${mt_$1_status}
 
519
 
 
520
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LIBS)
 
521
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LDFLAGS)
 
522
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_CFLAGS)
 
523
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_STATUS)
 
524
])
 
525
 
 
526
# $1 package name
 
527
# $2 header name (without .h)
 
528
# $3 library name
 
529
# $4 function name
 
530
#
 
531
# returns substed:
 
532
#   $1_STATUS
 
533
#   $1_LDFLAGS
 
534
#   $1_LIBS
 
535
#   $1_CFLAGS
 
536
 
 
537
 
 
538
AC_DEFUN([MT_CHECK_REQUIRED_PACKAGE],
 
539
[
 
540
    MT_CHECK_PACKAGE_INTERNAL($1, $2, $3, $4)
 
541
    if test "x$mt_$1_package_status" != xyes; then
 
542
        AC_MSG_ERROR([unable to configure required package $1])
 
543
    fi
 
544
 
 
545
    AC_DEFINE(translit(HAVE_$1, `a-z/.-', `A-Z___'), [1], [$1 library presence])
 
546
    
 
547
    translit($1, `a-z/.-', `A-Z___')_STATUS=${mt_$1_package_status}
 
548
 
 
549
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_CFLAGS)
 
550
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LIBS)
 
551
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LDFLAGS)
 
552
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_STATUS)
 
553
])
 
554
 
 
555
# $1 with parameter name
 
556
# $2 library name
 
557
# $3 function to check
 
558
AC_DEFUN([MT_CHECK_LIBRARY],
 
559
[
 
560
    MT_CHECK_LIBRARY_INTERNAL([$1], [$2], [$3])
 
561
 
 
562
    translit($1, `a-z/.-', `A-Z___')_LIBS=${mt_$1_libs}
 
563
    translit($1, `a-z/.-', `A-Z___')_LDFLAGS=${mt_$1_ldflags}
 
564
    translit($1, `a-z/.-', `A-Z___')_STATUS=${mt_$1_library_status}
 
565
    
 
566
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LIBS)
 
567
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LDFLAGS)
 
568
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_STATUS)
 
569
])
 
570
 
 
571
# $1 with parameter name
 
572
# $2 header to check
 
573
# $3 fail or pass in case a path parameter was specified and the header missing
 
574
#    empty: fail
 
575
AC_DEFUN([MT_CHECK_HEADER],
 
576
[
 
577
    MT_CHECK_HEADER_INTERNAL($1, $2, $3)
 
578
    
 
579
    translit($1, `a-z/.-', `A-Z___')_CFLAGS=${mt_$1_cxxflags}
 
580
    translit($1, `a-z/.-', `A-Z___')_STATUS=${mt_$1_header_status}
 
581
 
 
582
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_CFLAGS)
 
583
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_STATUS)
 
584
])
 
585
 
 
586
# $1 package name
 
587
# $2 config file name
 
588
# $3 headers
 
589
# $4 library name
 
590
# $5 function name
 
591
# $6 optional library command
 
592
#
 
593
#  returns substed:
 
594
#    $mt_$1_package_status
 
595
#    $1_LDFLAGS
 
596
#    $1_LIBS
 
597
#    $1_CFLAGS
 
598
 
 
599
AC_DEFUN([MT_CHECK_BINCONFIG_INTERNAL],
 
600
[
 
601
    LIBS_SAVE=$LIBS
 
602
    LDFLAGS_SAVE=$LDFLAGS
 
603
    CFLAGS_SAVE=$CFLAGS
 
604
    CXXFLAGS_SAVE=$CXXFLAGS
 
605
    CPPFLAGS_SAVE=$CPPFLAGS
 
606
 
 
607
 
 
608
    mt_$1_config=none
 
609
    mt_$1_package_status=yes
 
610
 
 
611
    AC_ARG_WITH($1-cfg,
 
612
        AC_HELP_STRING([--with-$1-cfg=$2], [absolute path/name of $2]),
 
613
        [
 
614
            mt_$1_search_config="$withval"
 
615
            AC_MSG_NOTICE([Will search for $1 config in $withval])
 
616
        ]
 
617
    )
 
618
 
 
619
    if test -n "$mt_$1_search_config"; then
 
620
        AC_MSG_NOTICE([You specified ${mt_$1_search_config} for $2])
 
621
        if test -f "$mt_$1_search_config"; then
 
622
            mt_$1_config=${mt_$1_search_config}
 
623
        else
 
624
            AC_MSG_ERROR([${mt_$1_search_config} not found])
 
625
        fi
 
626
 
 
627
        mt_$1_version=`${mt_$1_config} --version 2>/dev/null`
 
628
        if test -z "$mt_$1_version"; then
 
629
            AC_MSG_ERROR([${mt_$1_search_config} could not be executed or returned invalid values])
 
630
        fi
 
631
    else
 
632
        AC_PATH_PROG(mt_$1_config, $2, none)
 
633
        if test "x$mt_$1_config" = xnone; then
 
634
            unset ac_cv_path_mt_$1_config
 
635
            AC_PATH_PROG(mt_$1_config, $2, none, $MT_SEARCHPATH_PROGS)
 
636
            if test "x$mt_$1_config" = xnone; then
 
637
                mt_$1_package_status=missing
 
638
                AC_MSG_RESULT([$2 not found, please install the $1 devel package])
 
639
            fi
 
640
        fi
 
641
       
 
642
        mt_$1_version=`${mt_$1_config} --version 2>/dev/null`
 
643
        if test -z "$mt_$1_version"; then
 
644
            AC_MSG_NOTICE([${mt_$1_config} could not be executed or returned invalid values])
 
645
            mt_$1_package_status=missing
 
646
        fi
 
647
    fi
 
648
    if test "x$mt_$1_package_status" = xyes; then
 
649
        AC_MSG_CHECKING([$1 cflags])
 
650
        mt_$1_cxxflags=`${mt_$1_config} --cflags`
 
651
        AC_MSG_RESULT([$mt_$1_cxxflags])
 
652
        mt_$1_libs=
 
653
        AC_MSG_CHECKING([$1 libs])
 
654
        if test -z "$6";  then
 
655
            mt_$1_libs=`${mt_$1_config} --libs`
 
656
        else
 
657
            mt_$1_libs=`${mt_$1_config} $6`
 
658
        fi
 
659
        AC_MSG_RESULT([$mt_$1_libs])
 
660
    fi
 
661
 
 
662
    if test "x$mt_$1_package_status" = xyes; then
 
663
        CPPFLAGS="$CPPFLAGS $mt_$1_cxxflags"
 
664
        CXXFLAGS="$CXXFLAGS $mt_$1_cxxflags"
 
665
        CFLAGS="$CFLAGS $mt_$1_cxxflags"
 
666
        for mt_u_header in translit($3, `/.-', `___'); do
 
667
            unset ac_cv_header_${mt_u_header}
 
668
        done
 
669
        AC_CHECK_HEADERS($3, [], [mt_$1_package_status=missing])
 
670
    fi
 
671
 
 
672
    if test "x$mt_$1_package_status" = xyes; then
 
673
        LIBS="$mt_$1_libs $LIBS"
 
674
        if test -z "$4"; then
 
675
            unset ac_cv_func_$5
 
676
            AC_CHECK_FUNCS($5, [], [mt_$1_package_status=missing])
 
677
        else
 
678
            unset ac_cv_lib_$4_$5
 
679
            AC_CHECK_LIB($4, $5, [], [mt_$1_package_status=missing])
 
680
        fi
 
681
    fi
 
682
 
 
683
    if test "x$mt_$1_package_status" = xyes; then
 
684
        translit($1, `a-z/.-', `A-Z___')_CFLAGS=${mt_$1_cxxflags}
 
685
        translit($1, `a-z/.-', `A-Z___')_LIBS=${mt_$1_libs}
 
686
        translit($1, `a-z/.-', `A-Z___')_VERSION=${mt_$1_version}
 
687
    fi 
 
688
 
 
689
 
 
690
    LIBS=$LIBS_SAVE
 
691
    LDFLAGS=$LDFLAGS_SAVE
 
692
    CFLAGS=$CFLAGS_SAVE
 
693
    CXXFLAGS=$CXXFLAGS_SAVE
 
694
    CPPFLAGS=$CPPFLAGS_SAVE
 
695
])
 
696
 
 
697
# $1 package name
 
698
# $2 enable/disable
 
699
# $3 enable/disable help string
 
700
# $4 config file name
 
701
# $5 headers
 
702
# $6 library name
 
703
# $7 function name
 
704
# $8 custom lib parameter
 
705
#
 
706
# returns:
 
707
#   mt_$1_package_status
 
708
#   $1_CFLAGS
 
709
#   $1_LIBS
 
710
#   $1_VERSION
 
711
 
 
712
AC_DEFUN([MT_CHECK_OPTIONAL_PACKAGE_CFG],
 
713
[
 
714
    mt_$1_status=yes
 
715
    mt_$1_requested=no
 
716
 
 
717
    MT_OPTION([$1], [$2], [$3],[],[])
 
718
 
 
719
    if test "x${translit($1, `a-z/.-', `A-Z___')_OPTION_ENABLED}" = xyes; then
 
720
        MT_CHECK_BINCONFIG_INTERNAL($1, $4, $5, $6, $7, $8)
 
721
        mt_$1_status=${mt_$1_package_status}
 
722
    else
 
723
        mt_$1_status=disabled
 
724
    fi
 
725
 
 
726
    if ((test "x${translit($1, `a-z/.-', `A-Z___')_OPTION_ENABLED}" = xyes) &&
 
727
        (test "x${translit($1, `a-z/.-', `A-Z___')_OPTION_REQUESTED}" = xyes) &&
 
728
        (test "x$mt_$1_status" != xyes)); then
 
729
        AC_MSG_ERROR([unable to configure $1 support])
 
730
    fi
 
731
   
 
732
    if test "x$mt_$1_status" = xyes; then
 
733
        AC_DEFINE(translit(HAVE_$1, `a-z/.-', `A-Z___'), [1], [$1 library presence])
 
734
    fi
 
735
 
 
736
    translit($1, `a-z/.-', `A-Z___')_STATUS=${mt_$1_status}
 
737
 
 
738
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_CFLAGS)
 
739
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LIBS)
 
740
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_VERSION)
 
741
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_STATUS)
 
742
 
 
743
 
 
744
#    AS_IF([test x"$mt_$1_status" = xyes], [$8], [$9])[]dnl
 
745
])
 
746
 
 
747
# $1 package name
 
748
# $2 config file name
 
749
# $3 headers
 
750
# $4 library name
 
751
# $5 function name
 
752
#
 
753
#  returns substed:
 
754
#    $mt_$1_package_status
 
755
#    $1_LDFLAGS
 
756
#    $1_LIBS
 
757
#    $1_CFLAGS
 
758
 
 
759
AC_DEFUN([MT_CHECK_REQUIRED_PACKAGE_CFG],
 
760
[
 
761
    MT_CHECK_BINCONFIG_INTERNAL($1, $2, $3, $4, $5)
 
762
    if test "x$mt_$1_package_status" != xyes; then
 
763
        AC_MSG_ERROR([unable to configure required package $1])
 
764
    fi
 
765
    
 
766
    translit($1, `a-z/.-', `A-Z___')_STATUS=${mt_$1_package_status}
 
767
        
 
768
    AC_DEFINE(translit(HAVE_$1, `a-z/.-', `A-Z___'), [1], [$1 library presence])
 
769
 
 
770
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_CFLAGS)
 
771
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LIBS)
 
772
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_VERSION)
 
773
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_STATUS)
 
774
])
 
775
 
 
776
# $1 package name
 
777
# $2 config file name
 
778
# $3 headers
 
779
# $4 library name
 
780
# $5 function name
 
781
#
 
782
#  returns substed:
 
783
#    $mt_$1_package_status
 
784
#    $1_LDFLAGS
 
785
#    $1_LIBS
 
786
#    $1_CFLAGS
 
787
 
 
788
 
 
789
AC_DEFUN([MT_CHECK_PACKAGE_CFG],
 
790
[
 
791
    mt_$1_status=yes
 
792
 
 
793
    if test "x$mt_$1_status" = xyes; then
 
794
        MT_CHECK_BINCONFIG_INTERNAL($1, $2, $3, $4, $5)
 
795
        mt_$1_status=${mt_$1_package_status}
 
796
    fi
 
797
    
 
798
    if test "x$mt_$1_status" = xyes; then
 
799
        AC_DEFINE(translit(HAVE_$1, `a-z/.-', `A-Z___'), [1], [$1 library presence])
 
800
    fi
 
801
 
 
802
    translit($1, `a-z/.-', `A-Z___')_STATUS=${mt_$1_status}
 
803
 
 
804
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_CFLAGS)
 
805
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LIBS)
 
806
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_VERSION)
 
807
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_STATUS)
 
808
])
 
809
 
 
810
# $1 package name
 
811
# $2 headers
 
812
# $3 library name
 
813
# $4 function name
 
814
#
 
815
#  returns substed:
 
816
#    $mt_$1_package_status
 
817
#    $1_LDFLAGS
 
818
#    $1_LIBS
 
819
#    $1_CFLAGS
 
820
 
 
821
 
 
822
AC_DEFUN([MT_CHECK_PACKAGE],
 
823
[
 
824
    mt_$1_status=yes
 
825
 
 
826
    if test "x$mt_$1_status" = xyes; then
 
827
        MT_CHECK_PACKAGE_INTERNAL($1, $2, $3, $4)
 
828
        mt_$1_status=${mt_$1_package_status}
 
829
    fi
 
830
 
 
831
    if test "x$mt_$1_status" = xyes; then
 
832
        AC_DEFINE(translit(HAVE_$1, `a-z/.-', `A-Z___'), [1], [$1 library presence])
 
833
    fi
 
834
 
 
835
    translit($1, `a-z/.-', `A-Z___')_STATUS=${mt_$1_status}
 
836
 
 
837
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_CFLAGS)
 
838
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_LIBS)
 
839
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_VERSION)
 
840
    AC_SUBST(translit($1, `a-z/.-', `A-Z___')_STATUS)
 
841
])
 
842
 
 
843