AC_PREREQ([2.59])
AC_INIT([UpTools],[8.5.3],[bugs-uptools@palermo.edu],[UpTools])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
LT_PREREQ([2.2])
LT_INIT([dlopen])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([UpConf.cc])
AC_CONFIG_HEADERS([config.h])
AC_PREFIX_DEFAULT(/usr)
AC_PROG_CXX
CXXFLAGS="-O3 -ansi ${TUNE} -Wall -Wno-deprecated -D_FORTIFY_SOURCE=0"
CPPFLAGS="${CPPFLAGS} -I/usr/include/postgresql"
AC_SEARCH_LIBS([pthread_create],[pthread])
AC_SEARCH_LIBS([ns_get16],[resolv])
AC_ARG_WITH([ssl],
[AS_HELP_STRING([--with-ssl],
[enable support for ssl @<:@default=check@:>@])],
[],
[with_ssl=check])
AS_IF([test "x$with_ssl" != xno],
[AC_SEARCH_LIBS([SSL_library_init], [ssl],
#AC_DEFINE([HAVE_LIBMYSQL], [1],
# [Define if you have libmysqlclient]),
[have_ssl=yes],
[ if test "x$with_ssl" != xcheck ;then
AC_MSG_FAILURE(
[ssl support was asked, but ssl was not found])
fi]
)])
AC_ARG_WITH([mysql],
[AS_HELP_STRING([--with-mysql],
[enable support for mysql @<:@default=check@:>@])],
[],
[with_mysql=check])
AS_IF([test "x$with_mysql" != xno],
[AC_SEARCH_LIBS([mysql_close], [mysqlclient],
#AC_DEFINE([HAVE_LIBMYSQL], [1],
# [Define if you have libmysqlclient]),
[have_mysql=yes],
[ if test "x$with_mysql" != xcheck ;then
AC_MSG_FAILURE(
[mysql support was asked, but mysqlclient was not found])
fi]
)])
AC_ARG_WITH([postgresql],
[AS_HELP_STRING([--with-postgresql],
[enable support for postgresqk @<:@default=check@:>@])],
[],
[with_postgresql=check])
AS_IF([test "x$with_postgresql" != xno],
[AC_SEARCH_LIBS([PQfinish], [pq],
# AC_DEFINE([HAVE_LIBPQ], [1],
# [Define if you have libpq]),
[have_pq=yes],
[ if test "x$with_postgresql" != xcheck ;then
AC_MSG_FAILURE([postgresql test failed (--without-postgresql to disable)])
fi
]
)])
AC_HEADER_RESOLV
if test "x${have_ssl}" = xyes
then AC_CHECK_HEADERS([openssl/ssl.h yassl/ssl.h], [break])
if test x"$ac_cv_header_openssl_ssl_h" != xyes -a x"$ac_cv_header_yassl_ssl_h" != xyes
then AC_MSG_FAILURE([ssl headers not found or not usable])
else ssl=true
fi
else ssl=false
fi
if test "x${have_mysql}" = xyes
then AC_CHECK_HEADERS([mysql/mysql.h mysql.h], [break])
if test x"$ac_cv_header_mysql_mysql_h" != xyes -a x"$ac_cv_header_mysql_h" != xyes
then AC_MSG_FAILURE([MySQL headers not found or not usable])
else mysql=true
fi
else mysql=false
fi
if test x"${have_pq}" = xyes
then AC_CHECK_HEADERS([postgresql/libpq-fe.h libpq-fe.h], [break])
if test x"$ac_cv_header_postgresql_libpq_fe_h" != xyes -a x"$ac_cv_header_libpq_fe_h" != xyes
then AC_MSG_FAILURE([PostgreSQL headers not found or not usable])
else postgresql=true
fi
else postgresql=false
fi
AM_CONDITIONAL([ssl], [test x$ssl = xtrue])
AM_CONDITIONAL([mysql], [test x$mysql = xtrue])
AM_CONDITIONAL([postgresql], [test x$postgresql = xtrue])
if test x"$ssl" = xfalse
then
ss="No. You may enable with --enable-ssl"
else
ss="Yes"
fi
if test x"$mysql" = xfalse
then
ms="No. You may enable with --with-mysql"
else
ms="Yes"
fi
if test x"$postgresql" = xfalse
then
pq="No. You may enable with --with-postgresql"
else
pq="Yes"
fi
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/ioctl.h sys/socket.h sys/time.h syslog.h unistd.h])
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
AC_FUNC_MKTIME
AC_CHECK_FUNCS([gethostbyname localtime_r memmove memset regcomp select socket strcasecmp strerror strncasecmp])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
echo \
"-------------------------------------------------
Congratulations! You have created a Makefile for: ${PACKAGE_NAME} ${PACKAGE_VERSION}
Prefix is '${prefix}'.
Compiler is '${CXX}
CXXFLAGS are '${CXXFLAGS}'
LDFLAGS are '${LDFLAGS}'
CPPFLAGS are '${CPPFLAGS}'
LIBS are '${LIBS}'
srcdir is '${srcdir}'
ssl support: '${ss}'
mysql support: '${ms}'
MYSQL_LDFLAGS: '${MYSQL_LDFLAGS}
postgresql support: '${pq}'
UpTools will be Built on: '${build}'
UpTools will Built for: '${host}'
Now type 'make' in order to compile
If you want to test your compiling type 'make check'
After compiling, you can install with 'make install'
At the end, you can check your installation with 'make installcheck'