Codebase list virtualpg / scrub-obsolete/main configure.ac
scrub-obsolete/main

Tree @scrub-obsolete/main (Download .tar.gz)

configure.ac @scrub-obsolete/mainraw · history · blame

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(virtualpg, 2.0.1, a.furieri@lqt.it)
AC_LANG(C)
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([foreign])
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)

# disablibg debug support
AH_TEMPLATE([NDEBUG],
            [Must be defined in order to disable debug mode.])
AC_DEFINE(NDEBUG)

# Checks for header files.
AC_CHECK_HEADERS(stdlib.h,, [AC_MSG_ERROR([cannot find stdlib.h, bailing out])])
AC_CHECK_HEADERS(stdio.h,, [AC_MSG_ERROR([cannot find stdio.h, bailing out])])
AC_CHECK_HEADERS(string.h,, [AC_MSG_ERROR([cannot find string.h, bailing out])])
AC_CHECK_HEADERS(sqlite3ext.h,, [AC_MSG_ERROR([cannot find sqlite3ext.h, bailing out])])
AC_CHECK_HEADERS(sqlite3.h,, [AC_MSG_ERROR([cannot find sqlite3.h, bailing out])])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_VOLATILE

# Checks for library functions.
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MEMCMP
AC_FUNC_STAT
AC_FUNC_STRFTIME

#-----------------------------------------------------------------------
#   --with-pgconfig
#
AC_ARG_WITH([pgconfig],
      [AS_HELP_STRING([--with-pgconfig=FILE], [specify an alternative pg_config file])],
         [PGCONFIG="$withval"], [PGCONFIG=""])
if test "x$PGCONFIG" = "x"; then
      # PGCONFIG was not specified, so search within the current path
      AC_PATH_PROG([PGCONFIG], [pg_config])	
      # If we couldn't find pg_config, display an error
      if test "x$PGCONFIG" = "x"; then
              AC_MSG_ERROR([could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.])
      fi
else
      # PGCONFIG was specified; display a message to the user
      if test "x$PGSCONFIG" = "xyes"; then
              AC_MSG_ERROR([you must specify a parameter to --with-pgconfig, e.g. --with-pgconfig=/path/to/pg_config])
      else
              if test -f $PGCONFIG; then
                      AC_MSG_RESULT([Using user-specified pg_config file: $PGCONFIG])
              else
                      AC_MSG_ERROR([the user-specified pg_config file $PGCONFIG does not exist])
              fi     
      fi
fi

PG_CFLAGS=-I`$PGCONFIG --includedir`
PG_LDFLAGS=-L`$PGCONFIG --libdir`
AC_SUBST(PG_CFLAGS)
AC_SUBST(PG_LDFLAGS)

# Ensure that we can parse libpq-fe.h
CFLAGS_SAVE="$CFLAGS"
CFLAGS="$PG_CFLAGS"
AC_CHECK_HEADERS(libpq-fe.h,, [AC_MSG_ERROR([cannot find libpq-fe.h, bailing out])])
CFLAGS="$CFLAGS_SAVE"	
# Ensure we can link against libpq
LDFLAGS_SAVE="$LDFLAGS"
LDFLAGS="$PG_LDFLAGS"
AC_CHECK_LIB(pq,PQconnectdb,PG_LIB=-lpq,AC_MSG_ERROR(['libpq' is required but it doesn't seem to be installed on this system.]))
LDFLAGS="$LDFLAGS_SAVE"
AC_SUBST(PG_LIB)

# Checks for installed libraries
AC_CHECK_LIB(sqlite3,sqlite3_prepare_v2,,AC_MSG_ERROR(['libsqlite3' is required but it doesn't seem to be installed on this system.]),-lm)

AC_CONFIG_FILES([Makefile \
				Doxyfile \
				virtualpg.pc])

# Checking for MinGW
AM_CONDITIONAL([MINGW], [test "$target_alias" = "mingw32"])

AC_OUTPUT