ca9f05e16b025fa5ad6bec6933b2946b647d1b63
[jra/samba/.git] / source4 / build / m4 / env.m4
1 dnl SMB Build Environment Checks
2 dnl -------------------------------------------------------
3 dnl  Copyright (C) Stefan (metze) Metzmacher 2004
4 dnl  Copyright (C) Jelmer Vernooij 2005,2008
5 dnl  Released under the GNU GPL
6 dnl -------------------------------------------------------
7 dnl
8
9 AC_SUBST(srcdir)
10 export srcdir;
11
12 # we always set builddir to "." as that's nicer than
13 # having the absolute path of the current work directory
14 builddir=.
15 AC_SUBST(builddir)
16 export builddir;
17
18 AC_SUBST(datarootdir)
19
20 AC_SUBST(VPATH)
21 VPATH="\$(builddir):\$(srcdir)"
22
23 SMB_VERSION_STRING=`cat ${srcdir}/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
24 echo "SAMBA VERSION: ${SMB_VERSION_STRING}"
25
26 SAMBA_VERSION_GIT_COMMIT_FULLREV=`cat ${srcdir}/version.h | grep 'SAMBA_VERSION_GIT_COMMIT_FULLREV' | cut -d ' ' -f3- | cut -d '"' -f2`
27 if test -n "${SAMBA_VERSION_GIT_COMMIT_FULLREV}";then
28         echo "BUILD COMMIT REVISION: ${SAMBA_VERSION_GIT_COMMIT_FULLREV}"
29 fi
30 SAMBA_VERSION_GIT_COMMIT_DATE=`cat ${srcdir}/version.h | grep 'SAMBA_VERSION_GIT_COMMIT_DATE' | cut -d ' ' -f3-`
31 if test -n "${SAMBA_VERSION_GIT_COMMIT_DATE}";then
32         echo "BUILD COMMIT DATE: ${SAMBA_VERSION_GIT_COMMIT_DATE}"
33 fi
34 SAMBA_VERSION_GIT_COMMIT_TIME=`cat ${srcdir}/version.h | grep 'SAMBA_VERSION_GIT_COMMIT_TIME' | cut -d ' ' -f3-`
35 if test -n "${SAMBA_VERSION_GIT_COMMIT_TIME}";then
36         echo "BUILD COMMIT TIME: ${SAMBA_VERSION_GIT_COMMIT_TIME}"
37
38         # just to keep the build-farm gui happy for now...
39         echo "BUILD REVISION: ${SAMBA_VERSION_GIT_COMMIT_TIME}"
40 fi
41
42 m4_include(build/m4/check_path.m4)
43 m4_include(build/m4/check_perl.m4)
44
45 AC_SAMBA_PERL([], [AC_MSG_ERROR([Please install perl from http://www.perl.com/])])
46
47 AC_PATH_PROG(YAPP, yapp, false)
48
49 m4_include(build/m4/check_cc.m4)
50 m4_include(build/m4/check_ld.m4)
51 m4_include(../m4/check_make.m4)
52
53 AC_SAMBA_GNU_MAKE([AC_MSG_RESULT(found)], [AC_MSG_ERROR([Unable to find GNU make])])
54 AC_SAMBA_GNU_MAKE_VERSION()
55 GNU_MAKE_VERSION=$samba_cv_gnu_make_version
56 AC_SUBST(GNU_MAKE_VERSION)
57
58 new_make=no
59 AC_MSG_CHECKING([for GNU make >= 3.81])
60 if $PERL -e " \$_ = '$GNU_MAKE_VERSION'; s/@<:@^\d\.@:>@.*//g; exit (\$_ < 3.81);"; then
61         new_make=yes
62 fi
63 AC_MSG_RESULT($new_make)
64 automatic_dependencies=no
65 AX_CFLAGS_GCC_OPTION([-M -MT conftest.d -MF conftest.o], [], [ automatic_dependencies=$new_make ], [])
66 AC_MSG_CHECKING([Whether to use automatic dependencies])
67 AC_ARG_ENABLE(automatic-dependencies,
68 [  --enable-automatic-dependencies Enable automatic dependencies],
69 [ automatic_dependencies=$enableval ], 
70 [ automatic_dependencies=no ])
71 AC_MSG_RESULT($automatic_dependencies)
72 AC_SUBST(automatic_dependencies)
73
74 m4_include(build/m4/check_doc.m4)
75
76 m4_include(build/m4/check_python.m4)
77
78 AC_SAMBA_PYTHON_DEVEL([
79 SMB_EXT_LIB(EXT_LIB_PYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS])
80 SMB_ENABLE(EXT_LIB_PYTHON,YES)
81 SMB_ENABLE(LIBPYTHON,YES)
82 ],[
83 AC_MSG_ERROR([Python not found. Please install Python 2.x and its development headers/libraries.])
84 ])
85
86 AC_MSG_CHECKING(python library directory)
87 pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1, 0, '\\${prefix}')"`
88 AC_MSG_RESULT($pythondir)
89
90 AC_SUBST(pythondir)