summaryrefslogtreecommitdiff
path: root/mod_db4/configure.in
blob: 556186936ed29fd7b09b9305971b29cc33d53bc7 (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
#
# Copyright (c) 2004-2009 Oracle.  All rights reserved.
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#

AC_INIT(mod_db4.c)
AC_CONFIG_HEADER(config.h)
AC_PROG_CXX

AC_LANG_PUSH(C++)
if test "$cross_compiling" = no; then
    AC_MSG_CHECKING([that C++ compiler can compile simple program])
fi
AC_TRY_RUN([int main() { return 0; }],
           AC_MSG_RESULT(yes),
           AC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]))

# Allow user to specify flags
AC_ARG_WITH(cxxflags,
        [  --with-cxxflags           Specify additional flags to pass to compiler],
        [
                if test "x$withval" != "xno" ; then
                        CXXFLAGS="$withval $CXXFLAGS"
                fi
        ]       
)
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O2//g;' | sed -e 's/-g//g;'`
AC_ARG_WITH(ldflags,
        [  --with-ldflags          Specify additional flags to pass to linker],
        [
                if test "x$withval" != "xno" ; then
                        LDFLAGS="$withval $LDFLAGS"
                fi
        ]       
)

AC_ARG_WITH(libs,
        [  --with-libs             Specify additional libraries],
        [
                if test "x$withval" != "xno" ; then
                        LIBS="$withval $LIBS"
                fi
        ]       
)

AC_ARG_WITH(mm,
        [  --with-mm             Specify additional libraries],
        [
                if test "x$withval" != "xno" ; then
                        LIBS="-L$withval/lib $LIBS"
                        CPPFLAGS="-I$withval/include $CPPFLAGS"
                fi
        ]       

)

AC_ARG_WITH(db4,
        [  --with-db4             Specify additional libraries],
        [
                if test "x$withval" != "xno" ; then
                        LIBS="-L$withval/lib $LIBS"
                        CPPFLAGS="-I$withval/include $CPPFLAGS"
                fi
        ]       

)

AC_ARG_WITH(apxs,
[  --with-apxs[=FILE]   Build shared Apache module. FILE is optional
                        pathname to the Apache apxs tool; defaults to
                        "apxs".],
[
  if test "$withval" = "yes"; then
    withval="apxs"
  fi
  APXS="$withval"
  AC_SUBST(APXS)
],
[
  AC_MSG_ERROR([apxs is required])
])

LIBS="$LIBS -ldb_cxx"

AC_CACHE_CHECK(for union semun,cv_semun,
  AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
  ],
  [union semun x;],
  [
    cv_semun=yes
  ],[
    cv_semun=no
  ])
)
if test "$cv_semun" = "yes"; then
  AC_DEFINE(HAVE_SEMUN, 1, [ ])
else
  AC_DEFINE(HAVE_SEMUN, 0, [ ])
fi

AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
AC_SUBST(CPPFLAGS)
AC_SUBST(CXXFLAGS)

AC_CHECK_LIB(mm, mm_core_create, , [ AC_MSG_ERROR([libmm required]) ])

AC_SUBST(HAVE_SEMUN)
AC_OUTPUT(Makefile)