root/trunk/configure.in

Revision 149, 8.1 kB (checked in by mercyful, 2 years ago)

Fixing some build warning and testing some automake detection

  • Property svn:executable set to *
Line 
1# Autoconfig problems, run this!  'rm -f m4/{lt,lib}*.m4; autoreconf -svif'
2
3AC_INIT(configure.in)
4
5AM_CONFIG_HEADER(config.h)
6AM_INIT_AUTOMAKE(enthral, 001)
7
8AC_LANG_CPLUSPLUS
9AC_PROG_CXX
10
11AC_PROG_LIBTOOL
12AC_PROG_MAKE_SET
13AC_PROG_CC
14
15#AC_CHECK_HEADERS(errno.h strings.h unistd.h)
16#AC_CHECK_FUNCS(bzero memset, break)
17
18
19m4_pattern_allow([^AM_PROG_LIBTOOL$])
20AM_PROG_LIBTOOL
21
22AC_ARG_ENABLE(python,
23[  --disable-python        don't build the python plugin],
24        python=$enableval, python=yes)
25
26AC_ARG_ENABLE(perl,
27[  --disable-perl          don't build the perl plugin],
28        perl=$enableval, perl=yes)
29
30AC_PATH_PROG(sedpath, sed)
31if test "_$sedpath" = _; then
32    AC_MSG_ERROR("Cannot find sed: I need it\!")
33fi
34
35AH_VERBATIM([USING_FREEBSD],[#undef USING_FREEBSD])
36AH_VERBATIM([USING_LINUX],[#undef USING_LINUX])
37AH_VERBATIM([OLD_PERL],[#undef OLD_PERL])
38
39
40dnl *********************************************************************
41dnl ** MYSql ************************************************************
42dnl *********************************************************************
43
44echo Detecting MySQL ...
45
46# mysql autodetected.
47
48# checking for mysql library.
49AC_CHECK_HEADER([mysql/mysql.h])
50AC_PATH_PROG([mysql_config], [mysql_config])
51
52# checking for mysql environment.
53if test "$ac_cv_header_mysql_mysql_h" = "yes" -a -n "$mysql_config"; then
54    MYSQL_CFLAGS="$(mysql_config --cflags)"
55    MYSQL_LDFLAGS="$(mysql_config --libs)"
56    AC_SUBST(MYSQL_CFLAGS)
57    AC_SUBST(MYSQL_LDFLAGS)
58
59    # define the mysql name and version.
60    AC_DEFINE_UNQUOTED(PLUGIN_NAME_MYSQL, "mysql", [Plugin name as Prefix.])
61    AC_DEFINE_UNQUOTED(PLUGIN_VERSION_MYSQL, "$(mysql_config --version)", [Plugin version for MySQL.])
62fi
63
64# define automake rule for compiling.
65AM_CONDITIONAL([HAVE_MYSQL], [test "$ac_cv_header_mysql_mysql_h" = "yes"])
66
67
68# check if no database backends are available, that doesn't make sense for a sql plugin. :)
69if test -z "$ac_cv_header_mysql_mysql_h"; then
70    AC_MSG_ERROR([*** no database backend found, install development and library files])
71fi
72
73
74dnl *********************************************************************
75dnl ** PYTHON ***********************************************************
76dnl *********************************************************************
77
78echo Detecting Python ...
79
80echo Prefix: ${prefix}
81
82AC_PATH_PROG(pythonpath, python2)
83echo Pythonpath: $pythonpath
84
85AC_PATH_PROG(pythonpath, python)
86echo Pythonpath: $pythonpath
87
88
89if test "$python" = yes; then
90        AC_PATH_PROG(pythonpath, python2)
91        if test "_$pythonpath" = _ ; then
92                AC_PATH_PROG(pythonpath, python)
93        fi
94        if test "_$pythonpath" = _ ; then
95                python=no
96        else
97                AC_MSG_CHECKING(Python version)
98                changequote(<<, >>)dnl
99                PY_VER=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("VERSION")[0];'`
100                PY_LIB=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1);'`
101                PY_INC=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("INCLUDEPY")[0];'`
102                $pythonpath -c "import sys; map(int,sys.version[:3].split('.')) >= [2,2] or sys.exit(1)"
103                changequote([, ])dnl
104                AC_MSG_RESULT($PY_VER)
105                if test "$?" != "1"; then
106                        AC_MSG_CHECKING(Python compile flags)
107                        PY_PREFIX=`$pythonpath -c 'import sys; print sys.prefix'`
108                        PY_EXEC_PREFIX=`$pythonpath -c 'import sys; print sys.exec_prefix'`
109                        if test -f $PY_INC/Python.h; then
110
111                                # Check for BSD on This one Might be needed w/ config.
112                                #PY_LIBS="-L$PY_LIB/config -lpython$PY_VER -lpthread -lutil"
113                                #PY_LIBS="-L$PY_LIB -lpython$PY_VER -lpthread -lutil -lm"
114
115
116                                                                PY_LIBS="-L$PY_LIB/config -L$PY_LIB -lpython$PY_VER -lutil -lpthread -lm"
117                                PY_CFLAGS="-I$PY_INC"
118                                AC_MSG_RESULT(ok)
119
120                                #AH_BOTTOM([HAVE_PYTHON])
121                                AC_DEFINE(HAVE_PYTHON, 1, [Define if using PYTHON])
122
123
124                        else
125                                python=no
126                                AC_MSG_RESULT([Can't find Python.h])
127                        fi
128                else
129                        echo "Python too old. Only 2.2 or above is supported."
130                        python=no
131                fi
132
133                CFLAGS+=" -I$PY_INC"
134                CXXFLAGS+=" -I$PY_INC"
135
136        fi
137fi
138
139
140dnl *********************************************************************
141dnl ** PERL *************************************************************
142dnl *********************************************************************
143
144if test "$perl" = yes; then
145    AC_PATH_PROG(perlpath, perl)
146    AC_MSG_CHECKING(for Perl compile flags)
147    PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
148    if test "_$PERL_CFLAGS" = _ ; then
149        AC_MSG_RESULT([not found, building without perl.])
150        perl=no
151    else
152        PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts |$sedpath 's/-lgdbm //'`
153        PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-ldb //'`
154        PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lndbm //'`
155        if test "$system" = "Linux"; then
156            PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lnsl //'`
157            PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lposix //'`
158        fi
159        PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lc //'`
160        AC_MSG_RESULT(ok)
161        AC_MSG_CHECKING(for perl >= 5.8.0)
162        PERL_VER=`$perlpath -e 'print $]>= 5.008?"yes":"no"'`
163        if test "$PERL_VER" = "yes"; then
164            AC_MSG_RESULT(yes)
165            AC_MSG_CHECKING(if perl plugin will be backward compatible)
166            if test "$perl_old" = "yes"; then
167                      AC_MSG_RESULT(yes)
168                      AC_DEFINE(OLD_PERL)
169
170                    #CFLAGS+=" -I$PERL_CFLAGS"
171                    #CXXFLAGS+=" -I$PERL_LDFLAGS -l$PY_VER"
172                    #LDFLAGS+=" -l$PY_VER"
173                   
174                    #CFLAGS+=" -I$PERL_LDFLAGS -l$PY_VER"
175
176
177            else
178                      AC_MSG_RESULT(no)
179            fi
180            AC_DEFINE(HAVE_PERL, 1, [Define if using PERL])
181        else
182            AC_MSG_RESULT(no)
183            echo "perl version too old, building without perl."
184            perl=no
185        fi
186    fi
187fi
188
189AM_CONDITIONAL(DO_PYTHON, test "x$python" = "xyes")
190AM_CONDITIONAL(DO_PERL, test "x$perl" = "xyes")
191
192echo =[OpenSSL Detection]====================
193echo checking for OpenSSL for Encryption [Not Yet Implimented].
194# Checking openssl library.
195AC_CHECK_HEADER([openssl/des.h], [], [AC_MSG_ERROR([*** des.h is required, install openssl header files])])
196AC_CHECK_HEADER([openssl/evp.h], [], [AC_MSG_ERROR([*** evp.h is required, install openssl header files])])
197AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_init], [], [AC_MSG_ERROR([*** EVP_CIPHER_CTX_init is required, install openssl library files])])
198AC_CHECK_LIB([crypto], [EVP_MD_CTX_init], [], [AC_MSG_ERROR([*** EVP_MD_CTX_init is required, install openssl library files])])
199AC_CHECK_LIB([crypto], [DES_crypt], [], [AC_MSG_ERROR([*** DES_crypt is required, install openssl library files])])
200echo
201echo =[MySQL]================================
202echo PLUGINS: MySQL: $ac_cv_header_mysql_mysql_h
203echo PLUGINS: MySQL: $MYSQL_CFLAGS
204echo PLUGINS: MySQL: $MYSQL_LDFLAGS
205echo
206echo =[Python]===============================
207echo PLUGINS: Python: $python
208echo PLUGINS: Python: $PY_VER
209echo PLUGINS: Python: $PY_LIB
210echo PLUGINS: Python: $PY_INC
211echo
212echo =[Perl]=================================
213echo PLUGINS: Perl: $perl
214echo PLUGINS: Perl: $PERL_CFLAGS
215echo PLUGINS: Perl: $PERL_LDFLAGS
216
217CFLAGS+=" -I$PERL_CFLAGS"
218CXXFLAGS+=" -I$PERL_LDFLAGS"
219
220echo =[Compile]=================================
221
222echo CFLAGS+= -I$CFLAGS
223echo CXXFLAGS+= -I$CXXFLAGS
224
225echo =[Done]=================================
226
227AC_SUBST(MYSQL_CFLAGS)
228AC_SUBST(MYSQL_LDFLAGS)
229
230AC_SUBST(PY_CFLAGS)
231AC_SUBST(PY_LIBS)
232
233#AC_SUBST(PERL_CFLAGS)
234#AC_SUBST(PERL_LDFLAGS)
235
236AC_OUTPUT(Makefile src/Makefile)
237
Note: See TracBrowser for help on using the browser.