summaryrefslogtreecommitdiffstats
path: root/kioslave/svn/configure.in.in
blob: 13fceb85b6fcbf3a762234629c4fdf172f635065 (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
AC_ARG_WITH(subversion,
  [AC_HELP_STRING(--with-subversion,
    [enable support for subversion @<:@default=check@:>@])],
  [], with_subversion=check)

SVN_SUBDIR=""
if test "x$with_subversion" != xno; then

APR_CONFIGS="apr-config apr-1-config /usr/local/apr/bin/apr-config"
SVN_SUBDIR="svn"
AC_ARG_WITH(apr-config,
[[  --with-apr-config=FILE    Use the given path to apr-config when determining
                            APR configuration; defaults to "apr-config"]],
[
    if test "$withval" != "yes" -a "$withval" != ""; then
        APR_CONFIGS=$withval
    fi
])
AC_MSG_CHECKING([for APR])
APR_CONFIG=""
for VALUE in $APR_CONFIGS ; do
	if $VALUE --cflags > /dev/null; then
		APR_CONFIG=$VALUE
		break
	fi
done
test $VALUE && APR_CONFIG=$VALUE
if test $APR_CONFIG ; then
    AC_MSG_RESULT([found])
else
    AC_MSG_RESULT([not found])
	SVN_SUBDIR=
dnl    AC_MSG_ERROR([APR is required. Try --with-apr-config.])
fi
	
APR_CPPFLAGS="`$APR_CONFIG --cppflags`"
APR_INCLUDE="`$APR_CONFIG --includes`"
APR_LIBS="`$APR_CONFIG --link-ld --libs`"

dnl
dnl APR util
dnl

APU_CONFIGS="apu-config apu-1-config /usr/local/apr/bin/apu-config"
AC_ARG_WITH(apu-config,
[[  --with-apu-config=FILE    Use the given path to apu-config when determining
                            APR util configuration; defaults to "apu-config"]],
[
    if test "$withval" != "yes" -a "$withval" != ""; then
        APU_CONFIGS=$withval
    fi
])
AC_MSG_CHECKING([for APR util])
APU_CONFIG=""
for VALUE in $APU_CONFIGS ; do
	if $VALUE --includes > /dev/null; then
		APU_CONFIG=$VALUE
		break
	fi
done
if test $APU_CONFIG ; then
    AC_MSG_RESULT([found])
else
    AC_MSG_RESULT([not found])
	SVN_SUBDIR=
dnl    AC_MSG_ERROR([APR util is required. Try --with-apu-config.])
fi
dnl APR_CPPFLAGS="$APR_CPPFLAGS `$APU_CONFIG --includes`"
APR_INCLUDE="$APR_INCLUDE `$APU_CONFIG --includes`"
APR_LIBS="$APR_LIBS `$APU_CONFIG --link-ld --libs`"

AC_MSG_CHECKING(for Subversion svn-config)
AC_ARG_WITH(subversion-dir,
	 [  --with-subversion-dir=DIR           where Subversion is installed ],
	 [
		 SVNCONFIG="$withval/bin/svn-config"
	])

if test -z "$SVNCONFIG"; then
	_SVNCONFIG="`svn-config --prefix 2> /dev/null`"
	if test -n "$_SVNCONFIG"; then
		SVNCONFIG="$_SVNCONFIG/bin/svn-config"
	fi
fi

AC_SUBST(SVNCONFIG)
if test -x "$SVNCONFIG"; then
	SVNLD="`$SVNCONFIG --ldflags`"
	SVN_LIB="`$SVNCONFIG --libs` -lsvn_client-1"
	SVN_CPPFLAGS="`$SVNCONFIG --cppflags`"
	dnl ugly hack for subversion svn-config problems in 0.14.x, to be removed when svn-config is fixed
	SVN_INCLUDE="`$SVNCONFIG --includes` -I$_SVNCONFIG/include/subversion-1/"
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(not found)
	SVNLD=""
	dnl just a fallback to debian's config so that it works for me :)
	SVN_INCLUDES="/usr/local/include /usr/include"
	AC_ARG_WITH(svn-include,
				[[  --with-svn-include=DIR   Use the given path to the subversion headers.]],
				[
				 if test "$withval" != "yes" -a "$withval" != ""; then
					 SVN_INCLUDES=$withval
				 fi
				 ])
	AC_MSG_CHECKING([for Subversion headers])
	SVN_INCLUDE=""
	for VALUE in $SVN_INCLUDES ; do
		if test -f $VALUE/subversion-1/svn_types.h ; then
			SVN_INCLUDE="-I$VALUE"
			break
		fi
	done
	if test $SVN_INCLUDE ; then
		AC_MSG_RESULT([found])
	else
		AC_MSG_RESULT([not found])
		SVN_SUBDIR=
dnl		AC_MSG_ERROR([Subversion headers are required. Try --with-svn-include.])
	fi
	SVN_MULTIARCH_LIBS="`find /usr/lib/ -maxdepth 1 -type d | xargs echo`"
	SVN_LIBS="/usr/local/lib /usr/lib /usr/lib64 $SVN_MULTIARCH_LIBS"
	AC_ARG_WITH(svn-lib,
			[[  --with-svn-lib=DIR  Use the given path to the subversion libraries.]],
			[
			     if test "$withval" != "yes" -a "$withval" != ""; then
			         SVN_LIBS=$withval
			     fi
			 ])
	AC_MSG_CHECKING([for Subversion libraries])
	SVN_LIB=""
	for VALUE in $SVN_LIBS ; do
		if ls $VALUE/libsvn_client-1.* 1>/dev/null 2>&1; then
			SVN_LIB="-L$VALUE"
			break
		fi
	done
	if test $SVN_LIB ; then
		AC_MSG_RESULT([found])
	else
		AC_MSG_RESULT([not found])
		SVN_SUBDIR=
	fi
fi
SVN_LIB="$SVN_LIB $APR_LIBS -lsvn_client-1"
SVN_INCLUDE="$SVN_INCLUDE $APR_INCLUDE"
SVN_CPPFLAGS="$APR_CPPFLAGS $SVN_CPPFLAGS"

if test "x$with_subversion" != xcheck && test -z "$SVN_SUBDIR"; then
  AC_MSG_ERROR([--with-subversion was given, but test for subversion failed])
fi
fi

AC_SUBST(SVN_INCLUDE)
AC_SUBST(SVN_LIB)
AC_SUBST(SVN_CPPFLAGS)
AC_SUBST(SVNLD)
AM_CONDITIONAL(include_kioslave_svn, test -n "$SVN_SUBDIR")