dnl Copyright (c) 2006, 2007 IBM Corporation, and others.
dnl All rights reserved. This program and the accompanying materials
dnl are made available under the terms of the Eclipse Public License v1.0
dnl which accompanies this distribution, and is available at
dnl http://www.eclipse.org/legal/epl-v10.html
dnl
dnl

AC_PREREQ(2.50)

AC_INIT(org.eclipse.ptp.ibmll, [5.0.6.201203091926])
AC_CONFIG_SRCDIR(src/ptp_ibmll_proxy.c)
AC_CONFIG_HEADERS(config.h)

AM_INIT_AUTOMAKE

AC_CANONICAL_BUILD

VERSION="_$PACKAGE_VERSION"
if test `expr "$VERSION" : "_@@<:@^@@:>@*@"` -gt 0 ; then
	VERSION=
fi
UTILS="`echo ../org.eclipse.ptp.utils${VERSION}`"
if test ! -d $UTILS; then
	UTILS="`echo ../../core/org.eclipse.ptp.utils${VERSION}`"
	if test ! -d $UTILS; then
		AC_MSG_ERROR([utils directory not found])
	fi
fi
PROXY="`echo ../org.eclipse.ptp.proxy${VERSION}`"
if test ! -d $PROXY; then
	PROXY="`echo ../../core/org.eclipse.ptp.proxy${VERSION}`"
	if test ! -d $PROXY; then
		AC_MSG_ERROR([proxy directory not found])
	fi
fi

LIBS="$LIBS -L$UTILS -L$PROXY"

AC_ARG_WITH(ll-header, AC_HELP_STRING([--with-ll-header=DIR], 
			[local LoadLeveler header directory @<:@none@:>@]),
			llinclude=-I$withval, llinclude="")
lldir="$llinclude -I/opt/ibmll/LoadL/full/include -I/usr/lpp/LoadL/full/include"
os=`uname -s`
if test "x$os" = "xAIX" ; then
        CFLAGS="$CFLAGS -qinfo=gen -qcpluscmt  -I$UTILS/include -I$PROXY/include $lldir"
else
        CFLAGS="$CFLAGS -Wall -I$UTILS/include -I$PROXY/include $lldir"
fi

dnl
dnl Check for programs.
dnl

AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB

dnl
dnl Check for libraries.
dnl
AC_CHECK_LIB(utils, bitset_new)
AC_CHECK_LIB(proxysvr, proxy_svr_init)

dnl
dnl Check for header files.
dnl

AC_HEADER_STDC
AC_CHECK_HEADER([llapi.h], [], 
	[AC_MSG_NOTICE([LoadLeveler not installed, skipping...])
	 AS_EXIT([1])
	])

dnl
dnl Check for types
dnl
AC_TYPE_SIGNAL

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
