Hi I am trying to tune one autoconf at a project I work on to be able to use it when cross-compiling with mingw on a linux box for a win32 target. I have problems using AC_CHECK_LIB and AC_CHECK_FUNC for libraries and functions. >From what I have debugged so far the problem seems to be that the functions in the mingw provided "win32 runtime" are declared with "PASCAL" declaration style and as such they mangle differently for linking than the C ones. So AC_CHECK_LIB and AC_CHECK_FUNC both do dummy C declarations for the functions looked up and the program obviously doesnt link. I had to use AC_LINK_IFELSE with my own source to have the tested source include a proper header (that does the proper PASCAL declarations) instead of generating the dummy C declaration like in: AC_MSG_CHECKING([for select in -lws2_32]) save_libs=$LIBS LIBS="$LIBS -lws2_32" AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include <winsock2.h>]],[[select(0,0,0,0,0);]])], AC_MSG_RESULT( [yes] ) , [ LIBS=$save_libs; AC_MSG_RESULT( [no] ) ] ) I supose I could make a AC macro for this library check and one similar for the AC_CHECK_FUNC equivalent. One problem with the AC_CHECK_FUNC version whould be that I want the same autoconf script to work both in POSIX enviroments (having "select" with a C declaration) and the mingw win32 cross compile enviroment (declaring "select" in a header PASCAL like) and to solve it I whould need first to check for the headers (if the enviroment provides something like "winsock2.h") then the source I use to check for the function should do #ifdef HAVE_WINSOCK2_H # include <winsock2.h> #endif ... All this sounds very hackish to me (I dont expect to be able to #ifdef for the config.h defined macros while running configure heh), I supose there is a cleaner solution so please help, thank you! -- Mihai RUSU Email: dizzy@xxxxxxxxx GPG : http://dizzy.roedu.net/dizzy-gpg.txt WWW: http://dizzy.roedu.net "Linux is obsolete" -- AST _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf