Cygwin and sdl_image compiling problems

i’m having some problems compiling sdl_image on my machine (with jpeg and
png support). I got the all the jpg and libpng packages off cygwin but had
to install the jpg headers by getting the jpg source and doing a make make
install-lib.
anyway i had to do some minor modifications to the makefile since the
includes for jpegs are in /usr/local/include and the includes for pngs are
in /usr/include/libpng12 and yada yada yada.
however i get this error when compiling

/bin/sh ./libtool --mode=link gcc -g -O2 -I/usr/local/include
-I/usr/include/libpng12 -I/usr/local/include/SDL -Dmain=SDL_main
-I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin -DLOAD_BMP -DLOAD_GIF
-DLOAD_JPG -DLOAD_LBM -DLOAD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA
-DLOAD_XPM -o libSDL_image.la -rpath /usr/local/lib -release
1.2 -version-info 1:2:1 IMG.lo IMG_bmp.lo IMG_gif.lo IMG_jpg.lo
IMG_lbm.lo IMG_pcx.lo IMG_png.lo IMG_pnm.lo IMG_tga.lo IMG_tif.lo
IMG_xcf.lo IMG_xpm.lo -ljpeg -lpng -lz -L/usr/local/lib -lmingw32
-lSDLmain -lSDL -mwindows -mno-cygwin
rm -fr .libs/libSDL_image.la .libs/libSDL_image.* .libs/libSDL_image-1.2.*

*** Warning: This library needs some functionality provided by -lmingw32.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have.
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.
generating symbol list for libSDL_image.la' test -f .libs/SDL_image.dll-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < ./libtool > .libs/SDL_image.dll-ltdll.c test -f .libs/SDL_image.dll-ltdll.o || (cd .libs && gcc -U__CYGWIN__ -U__CYGWIN32__ -c SDL_image.dll-ltdll.c) dlltool --exclude-symbols _DllMain at 12,_cygwin_dll_entry at 12,_cygwin_noncygwin_dll_entry at 12 --output-def .libs/SDL_image.dll-def .libs/SDL_image.dll-ltdll.o IMG.o IMG_bmp.o IMG_gif.o IMG_jpg.o IMG_lbm.o IMG_pcx.o IMG_png.o IMG_pnm.o IMG_tga.o IMG_tif.o IMG_xcf.o IMG_xpm.o sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < .libs/SDL_image.dll-def > .libs/libSDL_image.exp echo EXPORTS > .libs/SDL_image.dll-def _lt_hint=1; cat .libs/libSDL_image.exp | while read symbol; do set dummy $symbol; case $# in 2) echo " $2 @ $_lt_hint ; " >> .libs/SDL_image.dll-def;; *) echo " $2 @ $_lt_hint $3 ; " >> .libs/SDL_image.dll-def;; esac; _lt_hint=expr 1 + $_lt_hint; done test -f .libs/SDL_image.dll-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < ./libtool > .libs/SDL_image.dll-ltdll.c test -f .libs/SDL_image.dll-ltdll.o || (cd .libs && gcc -U__CYGWIN__ -U__CYGWIN32__ -c SDL_image.dll-ltdll.c) gcc -Wl,--base-file,.libs/SDL_image.dll-base -Wl,--dll -nostartfiles -Wl,-e,_DllMain at 12 -o .libs/SDL_image.dll .libs/SDL_image.dll-ltdll.o IMG.o IMG_bmp.o IMG_gif.o IMG_jpg.o IMG_lbm.o IMG_pcx.o IMG_png.o IMG_pnm.o IMG_tga.o IMG_tif.o IMG_xcf.o IMG_xpm.o -ljpeg -lpng -lz -L/usr/local/lib -lSDLmain -lSDL -L/usr/lib/mingw -mno-cygwin /usr/local/lib/libjpeg.a(jerror.o)(.text+0x1952):jerror.c: undefined reference to___getreent’
collect2: ld returned 1 exit status
make: *** [libSDL_image.la] Error 1

anybody have a working makefile for cygwin? or get SDL_image working for
cygwin?
thanks in advance.