summaryrefslogtreecommitdiffstats
path: root/pki/base/tps/m4/apr.m4
blob: 88c177b028f9372e0ad3b45825e2ed5b4675ec40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
dnl BEGIN COPYRIGHT BLOCK
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation;
dnl version 2.1 of the License.
dnl 
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl Lesser General Public License for more details.
dnl 
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA  02110-1301  USA 
dnl 
dnl Copyright (C) 2007 Red Hat, Inc.
dnl All rights reserved.
dnl END COPYRIGHT BLOCK

AC_CHECKING(for Apr)

# check for --with-apr
AC_MSG_CHECKING(for --with-apr)
AC_ARG_WITH(apr, [  --with-apr=PATH        Apr directory],
[
  if test -e "$withval"/include/apr-0/apr.h -a -d "$withval"/lib -a -d "$withval"/bin
  then
    AC_MSG_RESULT([using $withval])
    APRDIR=$withval
    apr_inc="-DAPRDIR -I$APRDIR/include -I$APRDIR/include/apr-0"
    apr_lib_version="apr-0"
    case $host in
      *-*-linux*)
        if test -n "$USE_64"
        then
          apr_lib="-L$APRDIR/lib64"
          apr_libdir="$APRDIR/lib64"
        else
          apr_lib="-L$APRDIR/lib"
          apr_libdir="$APRDIR/lib"
        fi
        apr_bindir="$APRDIR/bin"
        ;;
      sparc-sun-solaris*)
        if test -n "$USE_64"
        then
          apr_lib="-L$APRDIR/lib/sparcv9"
          apr_libdir="$APRDIR/lib/sparcv9"
          apr_bindir="$APRDIR/bin/sparcv9"
        else
          apr_lib="-L$APRDIR/lib"
          apr_libdir="$APRDIR/lib"
          apr_bindir="$APRDIR/bin"
        fi
        ;;
      *)
        AC_MSG_ERROR([unconfigured platform $host])
        ;;
    esac
  elif test -e "$withval"/include/apr-1/apr.h -a -d "$withval"/lib -a -d "$withval"/bin
  then
    AC_MSG_RESULT([using $withval])
    APRDIR=$withval
    apr_inc="-DAPRDIR -I$APRDIR/include -I$APRDIR/include/apr-1"
    apr_lib_version="apr-1"
    case $host in
      *-*-linux*)
        if test -n "$USE_64"
        then
          apr_lib="-L$APRDIR/lib64"
          apr_libdir="$APRDIR/lib64"
        else
          apr_lib="-L$APRDIR/lib"
          apr_libdir="$APRDIR/lib"
        fi
        apr_bindir="$APRDIR/bin"
        ;;
      sparc-sun-solaris*)
        if test -n "$USE_64"
        then
          apr_lib="-L$APRDIR/lib/sparcv9"
          apr_libdir="$APRDIR/lib/sparcv9"
          apr_bindir="$APRDIR/bin/sparcv9"
        else
          apr_lib="-L$APRDIR/lib"
          apr_libdir="$APRDIR/lib"
          apr_bindir="$APRDIR/bin"
        fi
        ;;
      *)
        AC_MSG_ERROR([unconfigured platform $host])
        ;;
    esac
  else
    echo
    AC_MSG_ERROR([$withval not found])
  fi
],
AC_MSG_RESULT(no))

# check for --with-apr-inc
AC_MSG_CHECKING(for --with-apr-inc)
AC_ARG_WITH(apr-inc, [  --with-apr-inc=PATH        Apr include file directory],
[
  if test -e "$withval"/apr.h
  then
    AC_MSG_RESULT([using $withval])
    APRDIR=$withval/..
    apr_inc="-DAPRDIR -I$withval/.. -I$withval"
  else
    echo
    AC_MSG_ERROR([$withval not found])
  fi
],
AC_MSG_RESULT(no))

# check for --with-apr-lib
AC_MSG_CHECKING(for --with-apr-lib)
AC_ARG_WITH(apr-lib, [  --with-apr-lib=PATH        Apr library directory],
[
  if test -d "$withval"
  then
    AC_MSG_RESULT([using $withval])
    apr_lib="-L$withval"
    apr_libdir="$withval"
  else
    echo
    AC_MSG_ERROR([$withval not found])
  fi
  if test -e "$withval/libapr-0.so"
  then
    apr_lib_version="apr-0"
  elif test -e "$withval/libapr-1.so"
  then
    apr_lib_version="apr-1"
  else
    AC_MSG_ERROR([libapr in $withval not found])
  fi
],
AC_MSG_RESULT(no))

# check for --with-apr-bin
AC_MSG_CHECKING(for --with-apr-bin)
AC_ARG_WITH(apr-bin, [  --with-apr-bin=PATH        Apr executables directory],
[
  if test -d "$withval"
  then
    AC_MSG_RESULT([using $withval])
    apr_bindir="$withval"
  else
    echo
    AC_MSG_ERROR([$withval not found])
  fi
],
AC_MSG_RESULT(no))

# check for Apr in well-known locations
# e. g. - on certain platforms, check for the presence
#         of a "Fortitude"-enabled web-server first
AC_MSG_CHECKING(for APR in well-known locations)
case $host in
  *-*-linux*)
    if test -f /usr/include/apr-0/apr.h
    then
      apr_inc="-DAPRDIR -I/usr/include -I/usr/include/apr-0"
    elif test -f /usr/include/apr-1/apr.h
    then
      apr_inc="-DAPRDIR -I/usr/include -I/usr/include/apr-1"
    else
      AC_MSG_ERROR([apr.h not found])
    fi
    if test -n "$USE_64"
    then
      if test -e /usr/lib64/libapr-0.so
      then
        apr_lib="-L/usr/lib64"
        apr_libdir="/usr/lib64"
        apr_lib_version="apr-0"
      elif test -e /usr/lib64/libapr-1.so
      then
        apr_lib="-L/usr/lib64"
        apr_libdir="/usr/lib64"
        apr_lib_version="apr-1"
      else
        AC_MSG_ERROR([libapr not found])
      fi
    else
      if test -e /usr/lib/libapr-0.so
      then
        apr_lib="-L/usr/lib"
        apr_libdir="/usr/lib"
        apr_lib_version="apr-0"
      elif test -e /usr/lib/libapr-1.so
      then
        apr_lib="-L/usr/lib"
        apr_libdir="/usr/lib"
        apr_lib_version="apr-1"
      else
        AC_MSG_ERROR([libapr not found])
      fi
    fi
    if test -x /usr/bin/apr-config
    then
      apr_bindir="/usr/bin"
    elif test -x /usr/bin/apr-1-config
    then
      apr_bindir="/usr/bin"
    else
      AC_MSG_ERROR([apr-config or apr-1-config not found])
    fi
    AC_MSG_RESULT([using system Apr in /usr])
    ;;
  sparc-sun-solaris*)
    if test -d /opt/fortitude
    then
      if test -f /opt/fortitude/include/apr-0/apr.h
      then
        apr_inc="-DAPRDIR -I/opt/fortitude/include -I/opt/fortitude/include/apr-0"
      else
        AC_MSG_ERROR([/opt/fortitude/include/apr-0/apr.h not found])
      fi
      if test -n "$USE_64"
      then
        #############################################################
        ###  NOTE:  The 64-bit Fortitude "sparcv9" libraries and  ###
        ###         programs are now under "/opt/fortitude/lib"   ###
        ###         and "/opt/fortitude/bin" rather than          ###
        ###         "/opt/fortitude/lib/sparcv9" and              ###
        ###         "/opt/fortitude/bin/sparcv9"!!!               ###
        ###                                                       ###
        ###         To help guard against any future movement     ###
        ###         of any of these libraries and/or programs,    ###
        ###         this m4 file will first check under the       ###
        ###         "sparcv9" directory, and then the directory   ###
        ###         immediately above the "sparcv9" directory.    ###
        #############################################################
        if test -e /opt/fortitude/lib/sparcv9/libapr-0.so
        then
          apr_lib="-L/opt/fortitude/lib/sparcv9"
          apr_libdir="/opt/fortitude/lib/sparcv9"
          apr_lib_version="apr-0"
        else
          if test -e /opt/fortitude/lib/libapr-0.so
          then
            apr_lib="-L/opt/fortitude/lib"
            apr_libdir="/opt/fortitude/lib"
            apr_lib_version="apr-0"
          else
            AC_MSG_ERROR([Fortitude-enabled libapr-0.so not found])
          fi
        fi
        if test -x /opt/fortitude/bin/sparcv9/apr-config
        then
          apr_bindir="/opt/fortitude/bin/sparcv9"
        else
          if test -x /opt/fortitude/bin/apr-config
          then
            apr_bindir="/opt/fortitude/bin"
          else
            AC_MSG_ERROR([Fortitude-enabled apr-config not found])
          fi
        fi
      else
        if test -e /opt/fortitude/lib/libapr-0.so
        then
          apr_lib="-L/opt/fortitude/lib"
          apr_libdir="/opt/fortitude/lib"
          apr_lib_version="apr-0"
        else
          AC_MSG_ERROR([/opt/fortitude/lib/libapr-0.so not found])
        fi
        if test -x /opt/fortitude/bin/apr-config
        then
          apr_bindir="/opt/fortitude/bin"
        else
          AC_MSG_ERROR([/opt/fortitude/bin/apr-config not found])
        fi
      fi
      AC_MSG_RESULT([using Fortitude-enabled Apr in /opt/fortitude])
    else
      if test -f /usr/local/include/apr-0/apr.h
      then
        apr_inc="-DAPRDIR -I/usr/local/include -I/usr/local/include/apr-0"
      else
        AC_MSG_ERROR([/usr/local/include/apr-0/apr.h not found])
      fi
      if test -n "$USE_64"
      then
        if test -e /usr/local/lib/sparcv9/libapr-0.so
        then
          apr_lib="-L/usr/local/lib/sparcv9"
          apr_libdir="/usr/local/lib/sparcv9"
          apr_lib_version="apr-0"
        else
          AC_MSG_ERROR([/usr/local/lib/sparcv9/libapr-0.so not found])
        fi
        if test -x /usr/local/bin/sparcv9/apr-config
        then
          apr_bindir="/usr/local/bin/sparcv9"
        else
          AC_MSG_ERROR([/usr/local/bin/sparcv9/apr-config not found])
        fi
      else
        if test -e /usr/local/lib/libapr-0.so
        then
          apr_lib="-L/usr/local/lib"
          apr_libdir="/usr/local/lib"
          apr_lib_version="apr-0"
        else
          AC_MSG_ERROR([/usr/local/lib/libapr-0.so not found])
        fi
        if test -x /usr/local/bin/apr-config
        then
          apr_bindir="/usr/local/bin"
        else
          AC_MSG_ERROR([/usr/local/bin/apr-config not found])
        fi
      fi
    fi
    AC_MSG_RESULT([using system Apr in /usr/local])
    ;;
  *)
    AC_MSG_ERROR([unconfigured platform $host])
    ;;
esac

# if Apr has not been found, print an error and exit
if test -z "$apr_inc"
then
  AC_MSG_ERROR([Apr include file directory not found, specify with --with-apr.])
fi
if test -z "$apr_lib" -o -z "$apr_libdir"
then
  AC_MSG_ERROR([Apr library directory not found, specify with --with-apr.])
fi
if test -z "$apr_bindir"
then
  AC_MSG_ERROR([Apr executables directory not found, specify with --with-apr.])
fi
if test -z "$apr_lib_version"
then
  AC_MSG_ERROR([Apr library version not found, specify with --with-apr.])
fi