# Source of configuration for CGI scripts of QDBM



#================================================================
# Generic Settings
#================================================================


# Targets
AC_INIT(qdbm-cgi, 0.0.1)

# Export variables
TARGETS="all"

# Building paths
pathtmp="$PATH"
PATH="$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
PATH="$PATH:/usr/ccs/bin:/usr/ucb:/usr/xpg4/bin:/usr/xpg6/bin:$pathtmp"
LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LIBRARY_PATH"
LD_LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH"
CPATH="$HOME/include:/usr/local/include:$CPATH"
export PATH LIBRARY_PATH LD_LIBRARY_PATH CPATH



#================================================================
# Options
#================================================================


# Debug mode
AC_ARG_ENABLE(debug, [  --enable-debug          build for debugging])
if test "$enable_debug" = "yes"
then
  TARGETS="debug"
fi

# Developping mode
AC_ARG_ENABLE(devel, [  --enable-devel          build for development])
if test "$enable_devel" = "yes"
then
  TARGETS="devel"
fi



#================================================================
# Checking Commands to Build with
#================================================================


# C compiler
AC_PROG_CC
if test "$GCC" != "yes"
then
  printf '#================================================================\n' 1>&2
  printf '# WARNING: GCC is required to build this package.\n' 1>&2
  printf '#================================================================\n' 1>&2
fi



#================================================================
# Checking Libraries
#================================================================


# Underlying libraries
AC_CHECK_LIB(c, main)
AC_CHECK_LIB(pthread, main)
AC_CHECK_LIB(z, main)
AC_CHECK_LIB(lzo2, main)
AC_CHECK_LIB(bz2, main)
AC_CHECK_LIB(iconv, main)

# Fundamental QDBM libraries
AC_CHECK_LIB(qdbm, main, true,
  printf 'checking whether /usr/local/lib/libqdbm.* is... '
  if ls /usr/local/lib/libqdbm.* > /dev/null 2>&1
  then
    printf 'yes\n'
  else
    printf 'no\n'
    printf '#================================================================\n' 1>&2
    printf '# WARNING: Install QDBM libraries before installation.\n' 1>&2
    printf '#================================================================\n' 1>&2
  fi
)



#================================================================
# Generic Settings
#================================================================


# Export variables
AC_SUBST(TARGETS)

# Targets
AC_OUTPUT(Makefile)



# END OF FILE
