# configure.in for dlcompat, process with autocong to generate a configure script
#
# This does only minimal checks, but it is all that is needed.

AC_INIT(dlfcn.c)
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_LN_S
OPT=-O2
VERSION=20030629
AC_SUBST(VERSION)
AC_CHECK_HEADER(mach-o/dyld.h, [], [AC_MSG_ERROR([No dyld.h found, can not continue])])
AC_CHECK_FUNC(NSLinkModule, [], [AC_MSG_ERROR([Can not continue])])
AC_CHECK_FUNC(NSAddImage, [], [AC_MSG_WARN([Not tested without NSAddImage, good luck!])])
# debug option
AC_ARG_ENABLE(debug,[  --enable-debug   build a debug version],[
		OPT="-O0 -g"
		DEBUGDEF="-DDEBUG=2"
		],[])
# for the fink package manager, build a version that is binary compatible
# with all previous releases of dlcompat
# no automatic underscore prepending
# lib is named libdl.0.dylib
AC_ARG_ENABLE(fink,	[  --enable-fink  build a fink version], [
		FINKDEF="-DFINK_BUILD=1"
		VERSTRING=""
		LIBVER=0
		NOTPREPEND="not"
		],[
		FINKDEF=""
		VERSTRING="-compatibility_version 1 -current_version 1"
		LIBVER=1
		NOTPREPEND="indeed"
		])
AC_SUBST(OPT)
AC_SUBST(DEBUGDEF)
AC_SUBST(FINKDEF)
AC_SUBST(VERSTRING)
AC_SUBST(LIBVER)
AC_SUBST(NOTPREPEND)
AC_OUTPUT(
		./Makefile
		)
