Imported Upstream version 3.2.2
[debian/gnuradio] / config / gr_standalone.m4
1 dnl
2 dnl Copyright 2008 Free Software Foundation, Inc.
3 dnl 
4 dnl This file is part of GNU Radio
5 dnl 
6 dnl GNU Radio is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 3, or (at your option)
9 dnl any later version.
10 dnl 
11 dnl GNU Radio is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 dnl GNU General Public License for more details.
15 dnl 
16 dnl You should have received a copy of the GNU General Public License along
17 dnl with this program; if not, write to the Free Software Foundation, Inc.,
18 dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 dnl
20
21 dnl
22 dnl GR_STANDALONE([package],[version])
23 dnl
24 dnl Handles the bulk of the configure.ac work for an out-of-tree build
25 dnl
26 dnl N.B., this is an m4_define because if it were an AC_DEFUN it would
27 dnl get called too late to be useful.
28
29 m4_define([GR_STANDALONE],
30 [
31   AC_INIT([$1],[$2])
32   AC_PREREQ(2.57)
33   AC_CONFIG_SRCDIR([config/gr_standalone.m4])
34   AC_CONFIG_AUX_DIR([.])        
35   AM_CONFIG_HEADER(config.h)
36
37   AC_CANONICAL_BUILD
38   AC_CANONICAL_HOST
39   AC_CANONICAL_TARGET
40
41   AM_INIT_AUTOMAKE
42
43   LF_CONFIGURE_CC
44   LF_CONFIGURE_CXX
45   GR_LIB64              dnl check for lib64 suffix after choosing compilers
46
47   dnl add ${prefix}/lib${gr_libdir_suffix}/pkgconfig to the head of the PKG_CONFIG_PATH
48   if test x${PKG_CONFIG_PATH} = x; then
49       PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig
50   else
51       PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig:${PKG_CONFIG_PATH}
52   fi
53   export PKG_CONFIG_PATH
54
55   LF_SET_WARNINGS
56   GR_SET_GPROF
57   GR_SET_PROF
58   AM_PROG_AS
59   AC_PROG_LN_S
60   AC_PROG_MAKE_SET
61   AC_PROG_INSTALL
62   AC_PATH_PROG([RM_PROG], [rm])
63
64   AC_LIBTOOL_WIN32_DLL
65   AC_ENABLE_SHARED      dnl do build shared libraries
66   AC_DISABLE_STATIC     dnl don't build static libraries
67   m4_ifdef([LT_INIT],[LT_INIT],[AC_PROG_LIBTOOL])
68   dnl GR_FORTRAN
69
70   GR_NO_UNDEFINED       dnl do we need the -no-undefined linker flag
71   GR_SCRIPTING          dnl Locate python, SWIG, etc
72
73   AC_ARG_WITH([python],
74     AC_HELP_STRING([--with-python], [Should we use python? [[default=yes]]]),
75     [case "$with_python" in
76       (no | yes) ;;
77       (*) AC_MSG_ERROR([Invalid argument ($with_python) to --with-python]) ;;
78      esac],
79     [with_python=yes])
80
81   AM_CONDITIONAL([USE_PYTHON], [test "$with_python" = yes])
82
83
84   dnl Set the c++ compiler that we use for the build system when cross compiling
85   if test "x$CXX_FOR_BUILD" = x
86   then
87     CXX_FOR_BUILD=${CXX}
88   fi
89   AC_SUBST(CXX_FOR_BUILD)
90
91   dnl Checks for header files.
92   AC_HEADER_STDC
93
94   dnl Checks for typedefs, structures, and compiler characteristics.
95   AC_C_CONST
96   AC_C_INLINE
97   AC_TYPE_SIZE_T
98   AC_HEADER_TIME
99   AC_C_BIGENDIAN
100
101   dnl Check for Mingw support
102   GR_PWIN32
103
104   AC_CHECK_PROG([XMLTO],[xmlto],[yes],[])
105   AM_CONDITIONAL([HAS_XMLTO], [test x$XMLTO = xyes])
106
107   dnl Define where to look for cppunit includes and libs
108   dnl sets CPPUNIT_CFLAGS and CPPUNIT_LIBS
109   dnl Try using pkg-config first, then fall back to cppunit-config.
110   PKG_CHECK_EXISTS(cppunit,
111     [PKG_CHECK_MODULES(CPPUNIT, cppunit >= 1.9.14)],
112     [AM_PATH_CPPUNIT([1.9.14],[],
113                      [AC_MSG_ERROR([GNU Radio requires cppunit.  Stop])])])
114
115   PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3)
116 ])