File: configure.in

package info (click to toggle)
libapache-mod-jk 1%3A1.2.18-3
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 5,004 kB
  • ctags: 2,664
  • sloc: ansic: 20,014; sh: 8,643; xml: 7,304; perl: 617; makefile: 321; awk: 59
file content (622 lines) | stat: -rwxr-xr-x 18,151 bytes parent folder | download | duplicates (2)
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_REVISION($Id: configure.in 423675 2006-07-20 00:15:01Z rjung $)dnl

AC_PREREQ(2.13)
AC_INIT(common/jk_worker.h)
AC_CONFIG_HEADER(common/portable.h)
AC_CONFIG_AUX_DIR(scripts/build/unix)
AC_CANONICAL_SYSTEM

dnl package and version. (synchronization with common/jk_version.h ?)
PACKAGE=mod_jk
VERSION=1.2.18

AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})

AC_PROG_CC
AC_PROG_LD

dnl Not sure what it does, but the libtool manual seems to require this
dnl It should use the native platform dlopen ( if available )
AC_LIBTOOL_DLOPEN

dnl AM_PROG_LIBTOOL often causes problems.
dnl I have solved them once using aclocal --acdir=/usr/local/share/aclocal/
AM_PROG_LIBTOOL

AC_PATH_PROG(TEST,test,$PATH)dnl
AC_SUBST(TEST)

AC_PATH_PROG(RM,rm,$PATH)dnl
AC_SUBST(RM)

AC_PATH_PROG(GREP,grep,$PATH)dnl
AC_SUBST(GREP)

AC_PATH_PROG(ECHO,echo,echo,$PATH)dnl
AC_SUBST(ECHO)

AC_PATH_PROG(SED,sed,$PATH)dnl
AC_SUBST(SED)

AC_PATH_PROG(CP,cp,$PATH)dnl
AC_SUBST(CP)

AC_PATH_PROG(MKDIR,mkdir,$PATH)dnl
AC_SUBST(MKDIR)

dnl AC_PATH_PROG(LIBTOOL,libtool,$PATH)dnl
AC_SUBST(LIBTOOL)

dnl ----------------------------- Checks for standard typedefs

dnl Checks for integer size
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(long double, 12)
AC_CHECK_SIZEOF(long long, 8)
AC_CHECK_SIZEOF(longlong, 8)

# Now we need to find what jk_uint32_t (sizeof == 4) will be.
# The first match is our preference.
if test "$ac_cv_sizeof_int" = "4"; then
    int32_t_fmt='#define JK_INT32_T_FMT "d"'
    uint32_t_fmt='#define JK_UINT32_T_FMT "u"'
    uint32_t_hex_fmt='#define JK_UINT32_T_HEX_FMT "x"'
    int32_value="int"
elif test "$ac_cv_sizeof_long" = "4"; then
    int32_t_fmt='#define JK_INT32_T_FMT "ld"'
    uint32_t_fmt='#define JK_UINT32_T_FMT "lu"'
    uint32_t_hex_fmt='#define JK_UINT32_T_HEX_FMT "lx"'
    int32_value="long"
else
    int32_t_fmt='#error could not detect a 32-bit integer type'
    uint32_t_fmt='#error could not detect a 32-bit integer type'
    uint32_t_hex_fmt='#error could not detect a 32-bit integer type'
    AC_ERROR([could not detect a 32-bit integer type])
fi

# Now we need to find what jk_uint64_t (sizeof == 8) will be.
# The first match is our preference.
if test "$ac_cv_sizeof_int" = "8"; then
    int64_t_fmt='#define JK_INT64_T_FMT "d"'
    uint64_t_fmt='#define JK_UINT64_T_FMT "u"'
    uint64_t_hex_fmt='#define JK_UINT64_T_HEX_FMT "x"'
    int64_value="int"
elif test "$ac_cv_sizeof_long" = "8"; then
    int64_t_fmt='#define JK_INT64_T_FMT "ld"'
    uint64_t_fmt='#define JK_UINT64_T_FMT "lu"'
    uint64_t_hex_fmt='#define JK_UINT64_T_HEX_FMT "lx"'
    int64_value="long"
elif test "$ac_cv_sizeof_long_long" = "8"; then
    # Linux, Solaris, FreeBSD all support ll with printf.
    # BSD 4.4 originated 'q'.  Solaris is more popular and 
    # doesn't support 'q'.  Solaris wins.  Exceptions can
    # go to the OS-dependent section.
    int64_t_fmt='#define JK_INT64_T_FMT "lld"'
    uint64_t_fmt='#define JK_UINT64_T_FMT "llu"'
    uint64_t_hex_fmt='#define JK_UINT64_T_HEX_FMT "llx"'
    int64_value="long long"
elif test "$ac_cv_sizeof_long_double" = "8"; then
    int64_t_fmt='#define JK_INT64_T_FMT "Ld"'
    uint64_t_fmt='#define JK_UINT64_T_FMT "Lu"'
    uint64_t_hex_fmt='#define JK_UINT64_T_HEX_FMT "Lx"'
    int64_value="long double"
elif test "$ac_cv_sizeof_longlong" = "8"; then
    int64_t_fmt='#define JK_INT64_T_FMT "qd"'
    uint64_t_fmt='#define JK_UINT64_T_FMT "qu"'
    uint64_t_hex_fmt='#define JK_UINT64_T_HEX_FMT "qx"'
    int64_value="__int64"
else
    int64_t_fmt='#error could not detect a 64-bit integer type'
    uint64_t_fmt='#error could not detect a 64-bit integer type'
    uint64_t_hex_fmt='#error could not detect a 64-bit integer type'
    AC_ERROR([could not detect a 64-bit integer type])
fi

AC_SUBST(int32_value)
AC_SUBST(int32_t_fmt) 
AC_SUBST(uint32_t_fmt) 
AC_SUBST(uint32_t_hex_fmt) 
AC_SUBST(int64_value)
AC_SUBST(int64_t_fmt) 
AC_SUBST(uint64_t_fmt) 
AC_SUBST(uint64_t_hex_fmt) 

dnl check for snprintf and vsnprintf.
AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF,1,[Have snprintf()]))
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF,1,[Have vsnprintf()]))
dnl check for flock function.
AC_CHECK_FUNC(flock, AC_DEFINE(HAVE_FLOCK,1,[Have flock()]))
dnl check for -lsocket library
AC_CHECK_LIB(socket, setsockopt, [LIBS="$LIBS -lsocket"])

AC_DEFUN([JK_CHECK_SETSOCKOPT], [
AC_MSG_CHECKING(whether to use $1 with setsockopt())
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>

int main(void)
{
    int s;
    struct timeval tv;
    tv.tv_sec  = 3;
    tv.tv_usec = 0;

#ifndef $1
    exit(3);
#else
    if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1)
        exit(2);

    /* fails on Solaris 2.6,8,9,10 and some Linuxes because
       SO_RCVTIMEO|SO_SNDTIMEO are defined but not implemented */
    if (setsockopt(s, SOL_SOCKET, $1, (const void *)&tv, sizeof(tv)) == -1)
        exit(1);

    exit(0);
#endif
}
]
, [ AC_MSG_RESULT([yes]) AC_DEFINE(USE_$1, 1, [Define to use $1 with setsockopt()]) ]
, [ AC_MSG_RESULT([no]) ]
)
])dnl

dnl check for SO_RCVTIMEO and SO_SNDTIMEO
JK_CHECK_SETSOCKOPT(SO_RCVTIMEO)
JK_CHECK_SETSOCKOPT(SO_SNDTIMEO)

APACHE_CONFIG_VARS=`pwd`/scripts/build/config_vars.mk
WEBSERVER=""
apache_dir=""
apache_include=""
APXS="apxs"
AC_ARG_WITH(apxs,
[  --with-apxs[=FILE]      Build shared Apache module. FILE is the optional
                        pathname to the apxs tool; defaults to finding
			apxs in your PATH.],
[
    case "${withval}" in
        y | yes | true) find_apxs=true ;;
        n | no | false) find_apxs=false ;;
        *) find_apxs=false ;;
    esac

    if ${TEST} ${find_apxs} ; then
        AC_MSG_RESULT([need to check for Perl first, apxs depends on it...])
        AC_PATH_PROG(PERL,perl,$PATH)dnl

        if ${TEST} ${find_apxs} ; then
            APXS=${withval}
        else
            AC_PATH_PROG(APXS,apxs,$PATH)dnl
        fi

        if ${TEST} -n "${APXS}" ; then
            dnl Seems that we have it, but have to check if it is OK first
            if ${TEST} ! -x "${APXS}" ; then
                AC_MSG_ERROR(Invalid location for apxs: '${APXS}')
            fi

            ${APXS} -q PREFIX >/dev/null 2>/dev/null || apxs_support=false

            if ${TEST} "${apxs_support}" = "false" ; then
                AC_MSG_RESULT(could not find ${APXS})
                AC_MSG_ERROR(You must specify a valid --with-apxs path)
            fi

            dnl apache_dir and apache_include are also needed.
            apache_dir=`$APXS -q PREFIX`
            apache_include="-I`$APXS -q INCLUDEDIR`"

            dnl test apache version
            APA=`${GREP} STANDARD20 ${APXS}`
            if ${TEST} -z "$APA" ; then
                WEBSERVER="apache-1.3"
		APXSCFLAGS="`$APXS -q CFLAGS` -DJK_PREFORK"
		APXS_CPPFLAGS=""
            else
                WEBSERVER="apache-2.0"
              	APRINCLUDEDIR=""
              	INCTEMP="`$APXS -q APR_INCLUDEDIR` `$APXS -q APU_INCLUDEDIR`"
              	for INC in ${INCTEMP}; do
              	    APRINCLUDEDIR="${APRINCLUDEDIR} -I${INC}"
              	done
                AC_MSG_RESULT([APRINCLUDEDIR is $APRINCLUDEDIR])
              	APXSCFLAGS="`${APXS} -q CFLAGS` `${APXS} -q EXTRA_CFLAGS` -DHAVE_APR ${APRINCLUDEDIR}"
              	APXSCPPFLAGS="`${APXS} -q EXTRA_CPPFLAGS`"
                APACHE_CONFIG_VARS="`${APXS} -q exp_installbuilddir`/config_vars.mk"
                LIBTOOL=`$APXS -q LIBTOOL`
            fi
            AC_MSG_RESULT([building connector for \"$WEBSERVER\"])

            AC_SUBST(APXS)
        fi
    fi
],
[
	AC_MSG_RESULT(no apxs given)
])
AC_SUBST(APACHE_CONFIG_VARS)

dnl Apache-2.0 needs the os subdirectory to include os.h
dnl this include is copy from os/config.m4
sinclude(../support/os_apache.m4)

dnl it is copied from the configure of JServ ;=)
dnl and adapted.

apache_dir_is_src="false"
AC_ARG_WITH(apache,
[  --with-apache=DIR      Build static Apache module. DIR is the pathname
                        to the Apache source directory.],
[
    if ${TEST} ! -z "$WEBSERVER" ; then
        AC_MSG_ERROR([Sorry cannot use --with-apxs=${APXS} and --with-apache=${withval} togother, please choose one of both])
    fi

    AC_MSG_CHECKING([for Apache source directory (assume static build)])

    if ${TEST} -n "${withval}" && ${TEST} -d "${withval}" ; then
        if ${TEST} -d "${withval}/src" ; then
           # handle the case where people use relative paths to
           # the apache source directory by pre-pending the current
           # build directory to the path. there are probably
           # errors with this if configure is run while in a
           # different directory than what you are in at the time
           if ${TEST} -n "`${ECHO} ${withval}|${GREP} \"^\.\.\"`" ; then
               withval=`pwd`/${withval}
           fi

           apache_dir=${withval}
           apache_dir_is_src="true"
           AC_MSG_RESULT(${apache_dir})

           AC_MSG_CHECKING(for Apache include directory)

           if ${TEST} -d "${withval}/src/include" ; then
               # read osdir from the existing apache.
               osdir=`${GREP} '^OSDIR=' ${withval}/src/Makefile.config | ${SED} -e 's:^OSDIR=.*/os:os:'`
               if ${TEST} -z "${osdir}" ; then
                   osdir=os/unix
               fi
               apache_include="-I${withval}/src/include \
                   -I${withval}/src/${osdir}"
               WEBSERVER="apache-1.3"
               LIB_JK_TYPE=mod_jk.a
               CFLAGS="${CFLAGS} -DJK_PREFORK"
               AC_MSG_RESULT([${apache_include}, version 1.3])
           else
               AC_MSG_ERROR([Sorry Apache 1.2.x is no longer supported.])
           fi
        else
           if ${TEST} -d "${withval}/include" ; then
              # osdir for Apache20.
              WEBSERVER="apache-2.0"
              apache_dir=${withval}
              apache_dir_is_src="true"
              LIB_JK_TYPE=lib_jk.la
              apache_include="-I${withval}/include -I${withval}/srclib/apr/include -I${withval}/os/${OS_APACHE_DIR} -I${withval}/srclib/apr-util/include"
              AC_MSG_RESULT(${apache_dir})
           fi
        fi
    fi

    dnl Make sure we have a result.
    if ${TEST} -z "$WEBSERVER" ; then
        AC_MSG_ERROR([Directory $apache_dir is not a valid Apache source distribution])
    fi

# VT: Now, which one I'm supposed to use? Let's figure it out later

    configure_apache=true
    configure_src=true

    AC_MSG_RESULT([building connector for \"$WEBSERVER\"])
],
[
	AC_MSG_RESULT(no apache given)
])
AC_SUBST(apache_include)
APACHE_DIR=${apache_dir}
AC_SUBST(APACHE_DIR)

dnl Check for enable-jni
JK_JNI_WORKER=""
AC_ARG_ENABLE(jni,
[  --enable-jni     Build jni_connect.so and enable jni_worker.],
[
    AC_MSG_RESULT(jni enable (need JDK))
    CFLAGS="${CFLAGS} -DHAVE_JNI"
    JK_JNI_WORKER="\${JK}jk_jni_worker\${OEXT}"
])dnl
AC_SUBST(JK_JNI_WORKER)

dnl CFLAGS for EAPI mod_ssl (Apache 1.3)
dnl it also allows the CFLAGS environment variable.
CFLAGS="${CFLAGS}"
AC_ARG_ENABLE(
EAPI,
[  --enable-EAPI     Enable EAPI support (mod_ssl, Apache 1.3)],
[
case "${enableval}" in
    y | Y | YES | yes | TRUE | true )
        CFLAGS="${CFLAGS} -DEAPI"
        AC_MSG_RESULT([...Enabling EAPI Support...])
        ;;
esac
])
AC_SUBST(CFLAGS)

dnl CFLAGS for maintainer mode
dnl it also allows the CFLAGS environment variable.
CFLAGS="${CFLAGS}"
AC_ARG_ENABLE(
maintainer-mode,
[  --enable-maintainer-mode   Turn on debugging and compile time warnings],
[
case "${enableval}" in
    y | Y | YES | yes | TRUE | true )
        CFLAGS="${CFLAGS} -DDEBUG -Wall"
        AC_MSG_RESULT([...Enabling Maintainer mode...])
        ;;
esac
])
AC_SUBST(CFLAGS)

dnl CFLAGS for preforks mode
dnl it also allows the CFLAGS environment variable.
CFLAGS="${CFLAGS}"
AC_ARG_ENABLE(
prefork,
[  --enable-prefork   Turn on prefork web server mode],
[
case "${enableval}" in
    y | Y | YES | yes | TRUE | true )
        CFLAGS="${CFLAGS} -DJK_PREFORK"
        AC_MSG_RESULT([...Enabling Prefork mode...])
        ;;
esac
])
AC_SUBST(CFLAGS)

dnl the APXSCFLAGS is given by apxs to the C compiler
dnl the APXSLDFLAGS is given to the linker (for APRVARS).
dnl APXSLDFLAGS=""
dnl APXSCFLAGS=""
if ${TEST} -n "${CFLAGS}" ; then
	APXSCFLAGS="${APXSCFLAGS} ${CFLAGS}"
fi
dnl the APXSLDFLAGS is normaly empty but APXSCFLAGS is not.
if ${TEST} -n "${LDFLAGS}" ; then
	APXSLDFLAGS="-Wl,${LDFLAGS}"
fi
AC_SUBST(APXSCFLAGS)
AC_SUBST(APXSCPPFLAGS)
AC_SUBST(APXSLDFLAGS)

if ${TEST} -n "${JK_JNI_WORKER}" ; then

WEBSERVER="jni ${WEBSERVER}"

dnl Find the JDK
dnl Results go in JAVA_HOME
dnl Also sets JAVA_PLATFORM to 1 for 1.1 and to 2 for 1.2

AC_MSG_CHECKING([for JDK location (please wait)])

dnl The order is: --with-java-home first, environment second, guessed value third.

dnl This is a safe default. Could screw up on the security features, but
dnl oh well, this is what --with-java2 is for.

if ${TEST} -n "${JAVA_HOME}" ; then
	JAVA_HOME_ENV="${JAVA_HOME}"
else
	JAVA_HOME_ENV=""
fi
JAVA_HOME=""
JAVA_PLATFORM="1"

AC_ARG_WITH(java-home,
[  --with-java-home=DIR     Where is your JDK root directory.],
[

    # This stuff works if the command line parameter --with-java-home was
    # specified, so it takes priority rightfully.

    JAVA_HOME=${withval}

    if ${TEST} ! -d "${JAVA_HOME}" ; then
        AC_MSG_ERROR(Not a directory: ${JAVA_HOME})
    fi

    AC_MSG_RESULT(${JAVA_HOME})

],
[
    # This works if the parameter was NOT specified, so it's a good time
    # to see what the enviroment says.

    # Since Sun uses JAVA_HOME a lot, we check it first and ignore the
    # JAVA_HOME, otherwise just use whatever JAVA_HOME was specified.

    if ${TEST} -n "${JAVA_HOME_ENV}" ; then

        JAVA_HOME=${JAVA_HOME_ENV}
        AC_MSG_RESULT(${JAVA_HOME_ENV} from environment)
    fi
])

if ${TEST} -z "${JAVA_HOME}" ; then

    # Oh well, nobody set neither JAVA_HOME nor JAVA_HOME, have to guess

    # The following code is based on the code submitted by Henner Zeller
    # for ${srcdir}/src/scripts/package/rpm/ApacheJServ.spec

    # Two variables will be set as a result:
    #
    # JAVA_HOME
    # JAVA_PLATFORM
    AC_MSG_CHECKING([Try to guess JDK location])


    for JAVA_PREFIX in \
	    /usr/local \
	    /usr/local/lib \
    	    /usr \
    	    /usr/lib \
            /opt  \
    	    /
    do
        for JAVA_PLATFORM in 3 2 1 ;
        do

            for subversion in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ;
                do
                    for VARIANT in IBMJava2- java java- jdk jdk-;
                    do
                        GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}"
dnl                        AC_MSG_CHECKING([${GUESS}])
                        if ${TEST} -d "${GUESS}/bin" \
                        && ${TEST} -d "${GUESS}/include" ; then

                            JAVA_HOME="${GUESS}"
                            AC_MSG_RESULT([${GUESS}])
                            break
                        fi

                    done

                    if ${TEST} -n "${JAVA_HOME}" ; then
                        break;
                    fi

                done

                if ${TEST} -n "${JAVA_HOME}" ; then
                    break;
                fi

            done

            if ${TEST} -n "${JAVA_HOME}" ; then
                break;
            fi

        done

        if ${TEST} -n "${JAVA_HOME}" ; then

            dnl Just to have the messages looking uniformly

            AC_MSG_CHECKING(Java platform)
            AC_MSG_RESULT([guess ${JAVA_PLATFORM}])
        fi


else

        AC_MSG_CHECKING(Java platform)

        AC_ARG_WITH(java-platform,
        [  --with-java-platform=VAL Force the Java platorm
                          (value is 1 for 1.1.x or 2 for 1.2.x or greater)],
        [
            dnl This requires a bit of tweaking to be handled properly, but
            dnl the default is good enough

            JAVA_PLATFORM="2"
        ])

        AC_MSG_RESULT(forced Java ${JAVA_PLATFORM})

fi
dnl end of JServ ;=)

dnl test if --enable-jni give but not valid JAVA_HOME
if ${TEST} -z "${JAVA_HOME}" ; then
    AC_MSG_ERROR([JDK home not found, please specify one with --with-java-home option (run ./configure --help for more options)])
fi

dnl guess OS = OS_TYPE for jni_md.h
OS=""
AC_ARG_WITH(os-type,
[  --with-os-type[=SUBDIR]     Where is your JDK os-type subdirectory.],
[
    OS=${withval}

    if ${TEST} ! -d "${JAVA_HOME}/${OS}" ; then
        AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${OS})
    fi
],
[
    AC_MSG_CHECKING(os_type directory)
    if ${TEST} -f ${JAVA_HOME}/include/jni_md.h; then
    	OS=""
    else
        for f in ${JAVA_HOME}/include/*/jni_md.h; do
            if ${TEST} -f $f; then
                OS=`dirname ${f}`
                OS=`basename ${OS}`
                echo " ${OS}"
            fi
        done
        if ${TEST} -z "${OS}"; then
            AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS})
            AC_MSG_ERROR(You should retry --with-os-type=SUBDIR)
        fi
    fi
])
fi
AC_SUBST(JAVA_HOME)
AC_SUBST(OS)


dnl Check that  a WEBSERVER has been given
if ${TEST} -z "$WEBSERVER" ; then
	AC_MSG_ERROR(Cannot find the WebServer)
fi

dnl Add common to subdir list
WEBSERVER="common ${WEBSERVER}"

AC_SUBST(WEBSERVER)

AM_CONDITIONAL(MAKE_DYNAMIC_APACHE, ${TEST} "${apache_dir_is_src}" = "false")

if ${TEST} "${apache_dir_is_src}" = "false" ; then
dnl normal apxs handling
	APACHE20_OEXT=.c
	LIB_JK_TYPE=mod_jk.so
	INSTALL_TYPE=install_dynamic
else
dnl install static library in apache sources.
	APACHE20_OEXT=.lo
	INSTALL_TYPE=install_static
fi
AC_SUBST(APACHE20_OEXT)
AC_SUBST(LIB_JK_TYPE)
AC_SUBST(INSTALL_TYPE)

dnl automake needs the path it does not work with $WEBSERVER
dnl that why useless Makefiles are build.
AC_OUTPUT([
	Makefile
	apache-1.3/Makefile
	apache-1.3/Makefile.apxs
	apache-2.0/Makefile
	apache-2.0/Makefile.apxs
	common/Makefile
	common/list.mk
	common/jk_types.h
	jni/Makefile
	])