File: configure.in

package info (click to toggle)
rapache 1.2.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,248 kB
  • sloc: sh: 18,629; ansic: 10,417; perl: 5,675; javascript: 2,800; makefile: 307
file content (162 lines) | stat: -rw-r--r-- 4,591 bytes parent folder | download | duplicates (4)
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
AC_INIT(mod_R,1.0,jeff.horner@vanderbilt.edu)
AC_CONFIG_AUX_DIR([tools])
AC_CONFIG_MACRO_DIR([m4])
# Automake initialization
AM_INIT_AUTOMAKE( foreign no-texinfo.tex no-dependencies no-dist no-installinfo no-installman no-exeext )

# This macro turns off maintainer mode by default. use "configure --enable-mainainer-mode"
# to enable
AM_MAINTAINER_MODE

# We'll get compiler and libtool info from apxs2
#AC_PROG_CC
AC_PROG_LIBTOOL

AC_CHECK_HEADERS( sys/types.h unistd.h stdlib.h )

# --with-R
AC_DEFUN([R_PROG],[

    AC_ARG_WITH(
            R,
            [  --with-R=PATH                Path to R (usually /usr/local/bin/R) ],
            ,
            [with_R="no"]
    )


    if test "$with_R" = "no"; then
		AC_PATH_PROG([RPROGRAM],[R],[no])
		if test "$RPROGRAM" = "no"; then
			echo
			echo
			echo "Specify the R program using --with-R (like /usr/local/bin/R)"
			echo
			AC_MSG_ERROR( aborting! )
		else
			if $RPROGRAM CMD config --ldflags 2>/dev/null | grep -v 'R was not built as a shared library' >/dev/null; then
					RPROG=$RPROGRAM
					RHOME=`$RPROGRAM RHOME`
					RINCLUDES=`$RPROG CMD config --cppflags`
					RLINKLD=`$RPROG CMD config --ldflags`
			else
				echo
				echo
				echo "R was not built as a shared library"
				echo
				echo "Either build it with one, or use another install of R"
				echo
				AC_MSG_ERROR( aborting! )
			fi
		fi
    else
		AC_MSG_CHECKING(for R Program)
        # make sure that a well known include file exists
        # and the libR.so
        if $with_R CMD config --ldflags 2>/dev/null | grep -v 'R was not built as a shared library' >/dev/null; then
                RPROG=$with_R
                RHOME=`$with_R RHOME`
				RINCLUDES=`$RPROG CMD config --cppflags`
				RLINKLD=`$RPROG CMD config --ldflags`
                AC_MSG_RESULT([$RPROG])
        else
            echo
            echo
            echo "R was not built as a shared library"
            echo
            echo "Either build it with one, or use another install of R"
            echo
            AC_MSG_ERROR( aborting! )
        fi
    fi

])

# --with-apreq2-config
AC_DEFUN([APREQ_CONFIG],[

    AC_ARG_WITH(
            apreq2-config,
            [  --with-apreq2-config=PATH    Path to apreq2-config ],
            ,
            [with_apreq2_config="no"]
    )


    if test "$with_apreq2_config" = "no"; then
		AC_PATH_PROG([APREQCONFIG],[apreq2-config],[no])
			if test "$APREQCONFIG" = "no"; then
				echo
				echo
				echo "Using libapreq2 that comes bundled with mod_R"
				echo
				APREQ=`pwd`/libapreq2/apreq2-config
				APREQ_COMPILE="(cd libapreq2; make apreq2-config; cd library; make)"
				APREQ_INSTALL="(cd libapreq2/library; make install)"
				APREQ_CLEAN="(cd libapreq2; make clean)"
				(cd libapreq2; ./configure --with-apache2-apxs=$APXS)
				APREQ_LIB_DIR=`$APREQ --link-ld | sed -e 's/-L//;s/-lapreq2//;s/ //g'`
				APREQ_INCLUDES=`$APREQ --includes`
				APREQ_LINKLD=`$APREQ --link-ld`
			else
                APREQ=$APREQCONFIG
                APREQ_COMPILE=
                APREQ_INSTALL=
				APREQ_CLEAN=
				APREQ_LIB_DIR=`$APREQ --link-ld | sed -e 's/-L//;s/-lapreq2//;s/ //g'`
				APREQ_INCLUDES=`$APREQ --includes`
				APREQ_LINKLD=`$APREQ --link-ld`
			fi
    else
		AC_MSG_CHECKING(for apreq2-config)
        # make sure that a well known include file exists
        if test -f `$with_apreq2_config --includedir`/apreq.h  ; then
                APREQ=$with_apreq2_config
                APREQ_COMPILE=
                APREQ_INSTALL=
				APREQ_CLEAN=
				APREQ_LIB_DIR=`$APREQ --link-ld | sed -e 's/-L//;s/-lapreq2//;s/ //g'`
				APREQ_INCLUDES=`$APREQ --includes`
				APREQ_LINKLD=`$APREQ --link-ld`
        else
            echo
            echo
            echo "Cannot find libapreq2 header files"
            echo
            echo "Check to make sure libapreq2 is already installed in your Apache install."
            echo "If not, then don't specifiy the --with-apreq2-config option as mod_R comes bundled"
            echo "with it."
            echo
            AC_MSG_ERROR( aborting! )
        fi
    fi
])

AC_DEFUN([SET_DOCROOT],[
        DOCROOT=`pwd`/test
])

AX_WITH_APXS
AC_SUBST(APXS)
HTTPD="`$APXS -q sbindir`/`$APXS -q progname`"
AC_SUBST(HTTPD)
R_PROG
AC_SUBST(RPROG)
AC_SUBST(RHOME)
AC_SUBST(RINCLUDES)
AC_SUBST(RLINKLD)
APREQ_CONFIG
AC_SUBST(APREQ)
AC_SUBST(APREQ_COMPILE)
AC_SUBST(APREQ_INSTALL)
AC_SUBST(APREQ_CLEAN)
AC_SUBST(APREQ_LIB_DIR)
AC_SUBST(APREQ_INCLUDES)
AC_SUBST(APREQ_LINKLD)
SET_DOCROOT
AC_SUBST(DOCROOT)

SHLIBPATH_VAR=$shlibpath_var
AC_SUBST(SHLIBPATH_VAR)

AC_OUTPUT(Makefile mod_R.h)