AC_PREREQ(2.59)
dnl Process this file with autoconf to produce a configure script.
dnl
dnl aclocal_cache.m4, included by sowing/confdb/aclocal.m4, fixes 
dnl bugs in autoconf caching.
dnl
dnl The file name here refers to a file in the source being configured
AC_INIT(smpd_pmi.c)
dnl
dnl Definitions will be placed in this file rather than in the DEFS variable
AC_CONFIG_HEADER(pmiconf.h)
AH_TOP([/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*  
 *  (C) 2001 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */
#ifndef PMICONF_H_INCLUDED
#define PMICONF_H_INCLUDED
])
AH_BOTTOM([#endif])
dnl
dnl Set the directory that contains support scripts such as install-sh and
dnl config.guess
dnl AC_CONFIG_AUX_DIR(../../../confdb)
dnl
echo "RUNNING CONFIGURE FOR THE SMPD PMI"
dnl
dnl
dnl Use AC_ARG_ENABLE to look for --enable-feature and AC_ARG_WITH to look for
dnl --with-capability
dnl
dnl Enable better caching control
PAC_ARG_CACHING

PAC_PROG_MAKE

save_libs=$LIBS
LIBS=

AC_CHECK_HEADERS(stdarg.h unistd.h string.h stdlib.h dlfcn.h uuid/uuid.h mach-o/dyld.h ctype.h)
AC_CHECK_FUNCS( dlopen NSLinkModule )
AC_SEARCH_LIBS( dlopen, dl )

AC_TRY_COMPILE([
#include <dlfcn.h>
],[int a;],ac_cv_func_dlopen=yes,ac_cv_func_dlopen=no)
if test "$ac_cv_func_dlopen" = yes ; then
    AC_DEFINE(HAVE_DLOPEN,1,[Define if you have the dlopen function.])
fi

dnl AC_DEFINE(USE_HUMAN_READABLE_TOKENS,1,[Define to use ='s and spaces in the string utilities.])

SMPD_PMI_LIBS=$LIBS
LIBS=$save_libs

AC_SUBST(SMPD_PMI_LIBS)
AC_SUBST(AR)
AC_SUBST(RANLIB)
AC_SUBST(MPILIBNAME)
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(CC_SHL)
AC_SUBST(C_LINK_SHL)
AC_SUBST(ENABLE_SHLIB)
AC_SUBST(master_top_srcdir)

AC_OUTPUT(Makefile localdefs)


PAC_SUBDIR_CACHE_CLEANUP
