~ubuntu-branches/ubuntu/breezy/osspsa/breezy

« back to all changes in this revision

Viewing changes to sa-1.2.2.orig/aclocal.m4

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Bossek
  • Date: 2005-04-24 11:46:57 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050424114657-b9azplzw1aw4viba
Tags: 1.2.4-1
Update to new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl ##
2
 
dnl ##  OSSP sa - Socket Abstraction
3
 
dnl ##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
4
 
dnl ##  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
5
 
dnl ##  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
6
 
dnl ##
7
 
dnl ##  This file is part of OSSP sa, a socket abstraction library which
8
 
dnl ##  can be found at http://www.ossp.org/pkg/lib/sa/.
9
 
dnl ##
10
 
dnl ##  Permission to use, copy, modify, and distribute this software for
11
 
dnl ##  any purpose with or without fee is hereby granted, provided that
12
 
dnl ##  the above copyright notice and this permission notice appear in all
13
 
dnl ##  copies.
14
 
dnl ##
15
 
dnl ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
16
 
dnl ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17
 
dnl ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 
dnl ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
19
 
dnl ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
 
dnl ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21
 
dnl ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22
 
dnl ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
 
dnl ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
 
dnl ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25
 
dnl ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
 
dnl ##  SUCH DAMAGE.
27
 
dnl ##
28
 
dnl ##  aclocal.m4: GNU Autoconf local macro definitions
29
 
dnl ##
30
 
 
31
 
dnl ##
32
 
dnl ##  Check whether compiler option works
33
 
dnl ##
34
 
dnl ##  configure.in:
35
 
dnl ##    AC_COMPILER_OPTION(<name>, <display>, <option>,
36
 
dnl ##                       <action-success>, <action-failure>)
37
 
dnl ##
38
 
 
39
 
AC_DEFUN(AC_COMPILER_OPTION,[dnl
40
 
AC_MSG_CHECKING(whether compiler option(s) $2 work)
41
 
AC_CACHE_VAL(ac_cv_compiler_option_$1,[
42
 
SAVE_CFLAGS="$CFLAGS"
43
 
CFLAGS="$CFLAGS $3"
44
 
AC_TRY_COMPILE([],[], ac_cv_compiler_option_$1=yes, ac_cv_compiler_option_$1=no)
45
 
CFLAGS="$SAVE_CFLAGS"
46
 
])dnl
47
 
if test ".$ac_cv_compiler_option_$1" = .yes; then
48
 
    ifelse([$4], , :, [$4])
49
 
else
50
 
    ifelse([$5], , :, [$5])
51
 
fi
52
 
AC_MSG_RESULT([$ac_cv_compiler_option_$1])
53
 
])dnl
54
 
 
55
 
dnl ##
56
 
dnl ##  Debugging Support
57
 
dnl ##
58
 
dnl ##  configure.in:
59
 
dnl ##    AC_CHECK_DEBUGGING
60
 
dnl ##
61
 
 
62
 
AC_DEFUN(AC_CHECK_DEBUGGING,[dnl
63
 
AC_ARG_ENABLE(debug,dnl
64
 
[  --enable-debug          build for debugging (default=no)],
65
 
[dnl
66
 
if test ".$ac_cv_prog_gcc" = ".yes"; then
67
 
    case "$CFLAGS" in
68
 
        *-O* ) ;;
69
 
           * ) CFLAGS="$CFLAGS -O2" ;;
70
 
    esac
71
 
    case "$CFLAGS" in
72
 
        *-g* ) ;;
73
 
           * ) CFLAGS="$CFLAGS -g" ;;
74
 
    esac
75
 
    case "$CFLAGS" in
76
 
        *-pipe* ) ;;
77
 
              * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
78
 
    esac
79
 
    AC_COMPILER_OPTION(defdbg, -DDEBUG, -DDEBUG, CFLAGS="$CFLAGS -DDEBUG")
80
 
    CFLAGS="$CFLAGS -pedantic"
81
 
    CFLAGS="$CFLAGS -Wall"
82
 
    WMORE=""
83
 
    WMORE="$WMORE -Wbad-function-cast"
84
 
    WMORE="$WMORE -Wcast-align"
85
 
    WMORE="$WMORE -Winline"
86
 
    WMORE="$WMORE -Wmissing-declarations"
87
 
    WMORE="$WMORE -Wmissing-prototypes"
88
 
    WMORE="$WMORE -Wmultichar"
89
 
    WMORE="$WMORE -Wnested-externs"
90
 
    WMORE="$WMORE -Wno-system-headers"
91
 
    WMORE="$WMORE -Wpointer-arith"
92
 
    WMORE="$WMORE -Wredundant-decls"
93
 
    WMORE="$WMORE -Wshadow"
94
 
    WMORE="$WMORE -Wstrict-prototypes"
95
 
    AC_COMPILER_OPTION(wmore, -W<xxx>, $WMORE, CFLAGS="$CFLAGS $WMORE")
96
 
    AC_COMPILER_OPTION(wnolonglong, -Wno-long-long, -Wno-long-long, CFLAGS="$CFLAGS -Wno-long-long")
97
 
else
98
 
    case "$CFLAGS" in
99
 
        *-g* ) ;;
100
 
           * ) CFLAGS="$CFLAGS -g" ;;
101
 
    esac
102
 
fi
103
 
msg="enabled"
104
 
],[
105
 
if test ".$ac_cv_prog_gcc" = ".yes"; then
106
 
case "$CFLAGS" in
107
 
    *-pipe* ) ;;
108
 
          * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
109
 
esac
110
 
fi
111
 
case "$CFLAGS" in
112
 
    *-g* ) CFLAGS=`echo "$CFLAGS" |\
113
 
                   sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
114
 
esac
115
 
case "$CXXFLAGS" in
116
 
    *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
117
 
                     sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
118
 
esac
119
 
msg=disabled
120
 
])dnl
121
 
AC_MSG_CHECKING(for compilation debug mode)
122
 
AC_MSG_RESULT([$msg])
123
 
if test ".$msg" = .enabled; then
124
 
    enable_shared=no
125
 
fi
126
 
])
127
 
 
128
 
dnl ##
129
 
dnl ##  Check for an external/extension library.
130
 
dnl ##  - is aware of <libname>-config style scripts
131
 
dnl ##  - searches under standard paths include, lib, etc.
132
 
dnl ##  - searches under subareas like .libs, etc.
133
 
dnl ##
134
 
dnl ##  configure.in:
135
 
dnl ##      AC_CHECK_EXTLIB(<realname>, <libname>, <func>, <header>,
136
 
dnl ##                      [<success-action> [, <fail-action>]])
137
 
dnl ##  Makefile.in:
138
 
dnl ##      CFLAGS  = @CFLAGS@
139
 
dnl ##      LDFLAGS = @LDFLAGS@
140
 
dnl ##      LIBS    = @LIBS@
141
 
dnl ##  shell:
142
 
dnl ##      $ ./configure --with-<libname>[=DIR]
143
 
dnl ##
144
 
 
145
 
AC_DEFUN(AC_CHECK_EXTLIB,[dnl
146
 
AC_ARG_WITH($2, [dnl
147
 
[  --with-]m4_substr([$2[[=DIR]]                     ], 0, 19)[build with external $1 library (default=no)]], [dnl
148
 
    if test ".$with_$2" = .yes; then
149
 
        #   via config script in PATH
150
 
        $2_version=`($2-config --version) 2>/dev/null`
151
 
        if test ".$$2_version" != .; then
152
 
            CPPFLAGS="$CPPFLAGS `$2-config --cflags`"
153
 
            CFLAGS="$CFLAGS `$2-config --cflags`"
154
 
            LDFLAGS="$LDFLAGS `$2-config --ldflags`"
155
 
        fi
156
 
    else
157
 
        if test -d "$with_$2"; then
158
 
            found=0
159
 
            #   via config script
160
 
            for dir in $with_$2/bin $with_$2; do
161
 
                if test -f "$dir/$2-config" && test ! -f "$dir/$2-config.in"; then
162
 
                    $2_version=`($dir/$2-config --version) 2>/dev/null`
163
 
                    if test ".$$2_version" != .; then
164
 
                        CPPFLAGS="$CPPFLAGS `$dir/$2-config --cflags`"
165
 
                        CFLAGS="$CFLAGS `$dir/$2-config --cflags`"
166
 
                        LDFLAGS="$LDFLAGS `$dir/$2-config --ldflags`"
167
 
                        found=1
168
 
                        break
169
 
                    fi
170
 
                fi
171
 
            done
172
 
            #   in standard sub-areas
173
 
            if test ".$found" = .0; then
174
 
                for dir in $with_$2/include/$2 $with_$2/include $with_$2; do
175
 
                    if test -f "$dir/$4"; then
176
 
                        CPPFLAGS="$CPPFLAGS -I$dir"
177
 
                        CFLAGS="$CFLAGS -I$dir"
178
 
                        found=1
179
 
                        break
180
 
                    fi
181
 
                done
182
 
                for dir in $with_$2/lib/$2 $with_$2/lib $with_$2; do
183
 
                    if test -f "$dir/lib$2.la" && test -d "$dir/.libs"; then
184
 
                        LDFLAGS="$LDFLAGS -L$dir -L$dir/.libs"
185
 
                        found=1
186
 
                        break
187
 
                    elif test -f "$dir/lib$2.a" || test -f "$dir/lib$2.so"; then
188
 
                        LDFLAGS="$LDFLAGS -L$dir"
189
 
                        found=1
190
 
                        break
191
 
                    fi
192
 
                done
193
 
            fi
194
 
            #   in any sub-area
195
 
            if test ".$found" = .0; then
196
 
changequote(, )dnl
197
 
                for file in x `find $with_$2 -name "$4" -type f -print`; do
198
 
                    test .$file = .x && continue
199
 
                    dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
200
 
                    CPPFLAGS="$CPPFLAGS -I$dir"
201
 
                    CFLAGS="$CFLAGS -I$dir"
202
 
                done
203
 
                for file in x `find $with_$2 -name "lib$2.[aso]" -type f -print`; do
204
 
                    test .$file = .x && continue
205
 
                    dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
206
 
                    LDFLAGS="$LDFLAGS -L$dir"
207
 
                done
208
 
changequote([, ])dnl
209
 
            fi
210
 
        fi
211
 
    fi
212
 
    AC_HAVE_HEADERS($4)
213
 
    AC_CHECK_LIB($2, $3)
214
 
    with_$2=yes
215
 
    ac_var="ac_cv_header_`echo $4 | sed 'y%./+-%__p_%'`"
216
 
    eval "ac_val=\$$ac_var"
217
 
    if test ".$ac_val" != .yes; then
218
 
        with_$2=no
219
 
    fi
220
 
    if test ".$ac_cv_lib_$2_$3" != .yes; then
221
 
        with_$2=no
222
 
    fi
223
 
    if test ".$with_$2" = .no; then
224
 
        AC_ERROR([Unable to find $1 library])
225
 
    fi
226
 
    ], [dnl
227
 
if test ".$with_$2" = .; then
228
 
    with_$2=no
229
 
fi
230
 
    ])dnl
231
 
AC_MSG_CHECKING(whether to build against external $1 library)
232
 
if test ".$with_$2" = .yes; then
233
 
    ifelse([$5], , :, [$5])
234
 
else
235
 
    ifelse([$6], , :, [$6])
236
 
fi
237
 
AC_MSG_RESULT([$with_$2])
238
 
])dnl
239