[project @ 2004-01-06 17:20:51 by panne]
authorpanne <unknown>
Tue, 6 Jan 2004 17:20:52 +0000 (17:20 +0000)
committerpanne <unknown>
Tue, 6 Jan 2004 17:20:52 +0000 (17:20 +0000)
Use new FP_CHECK_FUNC macro instead of the slightly obscure FPTOOLS_TRY_LINK_NOWARN

aclocal.m4
configure.ac

index ab6ec27..c4b1eb8 100644 (file)
@@ -758,6 +758,25 @@ undefine([AC_CV_NAME])dnl
 undefine([AC_CV_NAME_supported])dnl
 ])
 
+
+# FP_CHECK_FUNC(FUNCTION, PROLOGUE, BODY, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# ---------------------------------------------------------------------------------
+# A variant of AC_CHECK_FUNCS, limited to a single FUNCTION, but with the
+# additional flexibility of specifying the PROLOGUE and BODY.
+AC_DEFUN([FP_CHECK_FUNC],
+[AS_VAR_PUSHDEF([fp_func], [fp_cv_func_$1])dnl
+AC_CACHE_CHECK([for $1], fp_func,
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
+                [AS_VAR_SET(fp_func, yes)],
+                [AS_VAR_SET(fp_func, no)])])
+AS_IF([test AS_VAR_GET(fp_func) = yes],
+      [AC_DEFINE(AS_TR_CPP(HAVE_$1), [1],
+                [Define to 1 if you have the `]$1[' function.]) $4],
+      [$5])dnl
+AS_VAR_POPDEF([fp_func])dnl
+])# FP_CHECK_FUNC
+
+
 dnl Based on AC_TRY_LINK - run iftrue if links cleanly with no warning
 
 dnl FPTOOLS_TRY_LINK_NOWARN(flags,main?,iftrue,iffalse)
index 9bcbe61..f25589c 100644 (file)
@@ -1061,41 +1061,11 @@ FP_CHECK_CONSTS([E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EADV EAFNOSUPPORT EAGAIN
 dnl ** can we open files in binary mode?
 FP_CHECK_CONST([O_BINARY], [#include <fcntl.h>], [0])
 
-dnl ** check for GetModuleFileName and WinExec (windows only)
-dnl Old: AC_CHECK_FUNCS(WinExec GetModuleFileName)       dnl Windows
-dnl Doesn't work because the linker can't see the functions if
-dnl you omit the #include <windows.h>.  (I've no idea why not...)
-
-FPTOOLS_TRY_LINK_NOWARN(,[
-#if HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-main() { 
-  WinExec("",0);
-  exit(0);
-}
-],
-[have_winexec=1],
-[have_winexec=0])
-if test "$have_winexec" = "1"; then
-  AC_DEFINE([HAVE_WINEXEC], [1], [Define to 1 if you have the WinExec function.])
-fi
+FP_CHECK_FUNC([WinExec],
+  [@%:@include <windows.h>], [WinExec("",0)])
 
-FPTOOLS_TRY_LINK_NOWARN(,[
-#if HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-main() { 
-  char* dir;
-  GetModuleFileName((HMODULE)0,dir,0);
-  exit(0);
-}
-],
-[have_getmodulefilename=1],
-[have_getmodulefilename=0])
-if test "$have_getmodulefilename" = "1"; then
-AC_DEFINE([HAVE_GETMODULEFILENAME], [1], [Define to 1 if you have the GetModuleFileName function.])
-fi
+FP_CHECK_FUNC([GetModuleFileName],
+  [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
 
 dnl ** check return type of signal handlers
 dnl Foo: assumes we can use prototypes.