1#
2#  acinclude.m4
3#
4#  The iODBC driver manager.
5#
6#  Copyright (C) 1995 by Ke Jin <kejin@empress.com>
7#  Copyright (C) 1996-2006 by OpenLink Software <iodbc@openlinksw.com>
8#  All Rights Reserved.
9#
10#  This software is released under the terms of either of the following
11#  licenses:
12#
13#      - GNU Library General Public License (see LICENSE.LGPL)
14#      - The BSD License (see LICENSE.BSD).
15#
16#  Note that the only valid version of the LGPL license as far as this
17#  project is concerned is the original GNU Library General Public License
18#  Version 2, dated June 1991.
19#
20#  While not mandated by the BSD license, any patches you make to the
21#  iODBC source code may be contributed back into the iODBC project
22#  at your discretion. Contributions will benefit the Open Source and
23#  Data Access community as a whole. Submissions may be made at:
24#
25#      http://www.iodbc.org
26#
27#
28#  GNU Library Generic Public License Version 2
29#  ============================================
30#  This library is free software; you can redistribute it and/or
31#  modify it under the terms of the GNU Library General Public
32#  License as published by the Free Software Foundation; only
33#  Version 2 of the License dated June 1991.
34#
35#  This library is distributed in the hope that it will be useful,
36#  but WITHOUT ANY WARRANTY; without even the implied warranty of
37#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
38#  Library General Public License for more details.
39#
40#  You should have received a copy of the GNU Library General Public
41#  License along with this library; if not, write to the Free
42#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
43#
44#
45#  The BSD License
46#  ===============
47#  Redistribution and use in source and binary forms, with or without
48#  modification, are permitted provided that the following conditions
49#  are met:
50#
51#  1. Redistributions of source code must retain the above copyright
52#     notice, this list of conditions and the following disclaimer.
53#  2. Redistributions in binary form must reproduce the above copyright
54#     notice, this list of conditions and the following disclaimer in
55#     the documentation and/or other materials provided with the
56#     distribution.
57#  3. Neither the name of OpenLink Software Inc. nor the names of its
58#     contributors may be used to endorse or promote products derived
59#     from this software without specific prior written permission.
60#
61#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
62#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
63#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
64#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
65#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
66#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
67#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
68#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
69#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
70#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
71#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
72#
73
74AC_DEFUN(IODBC_CHECK_PTHREAD_LIB,
75[AC_MSG_CHECKING([for $2 in -l$1 $5])
76ac_save_LIBS="$LIBS"
77LIBS="-l$1 $5 $LIBS"
78
79AC_TRY_LINK(dnl
80[
81#ifdef __cplusplus
82extern "C"
83#endif
84
85#if defined (HAVE_PTHREAD_H)
86#include <pthread.h>
87#endif
88],
89[$2(0)],
90eval "ac_cv_lib_$ac_lib_var=yes",
91eval "ac_cv_lib_$ac_lib_var=no")
92LIBS="$ac_save_LIBS"
93dnl
94if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
95AC_MSG_RESULT(yes)
96ifelse([$3], ,
97[changequote(, )dnl
98  ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
99    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
100changequote([, ])dnl
101  AC_DEFINE_UNQUOTED($ac_tr_lib)
102  LIBS="-l$1 $LIBS"
103], [$3])
104else
105  AC_MSG_RESULT(no)
106ifelse([$4], , , [$4
107])dnl
108fi
109])
110