respect prefix option in WIN32
check for rint in configure and use a simple hack to replace it if needed. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@650 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
		
							
								
								
									
										31
									
								
								C/arith1.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								C/arith1.c
									
									
									
									
									
								
							@@ -1274,6 +1274,33 @@ p_ceiling(Term t E_ARGS)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* WIN32 machines do not necessarily have rint. This will do for now */
 | 
			
		||||
#if HAVE_RINT
 | 
			
		||||
#define my_rint(X) rint(X)
 | 
			
		||||
#else
 | 
			
		||||
static
 | 
			
		||||
double my_rint(double x)
 | 
			
		||||
{ 
 | 
			
		||||
  double y, z; 
 | 
			
		||||
  Int n; 
 | 
			
		||||
  
 | 
			
		||||
  if (x >= 0) { 
 | 
			
		||||
    y = x + 0.5; 
 | 
			
		||||
    z = floor(y); 
 | 
			
		||||
    n = (int) z; 
 | 
			
		||||
    if (y == z && n % 2)
 | 
			
		||||
      return(z-1); 
 | 
			
		||||
  } else { 
 | 
			
		||||
    y = x - 0.5; 
 | 
			
		||||
    z = ceil(y); 
 | 
			
		||||
    n = (int) z; 
 | 
			
		||||
    if (y == z && n % 2)
 | 
			
		||||
      return(z+1); 
 | 
			
		||||
  }
 | 
			
		||||
  return(z); 
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
  round(x) integer closest to 0
 | 
			
		||||
*/
 | 
			
		||||
@@ -1364,10 +1391,10 @@ p_round(Term t E_ARGS)
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  if (yap_flags[LANGUAGE_MODE_FLAG] == 1) { /* iso */
 | 
			
		||||
    double vl = rint(dbl);
 | 
			
		||||
    double vl = my_rint(dbl);
 | 
			
		||||
    RBIG_FL(vl);
 | 
			
		||||
  } else {
 | 
			
		||||
    double vl = rint(dbl);
 | 
			
		||||
    double vl = my_rint(dbl);
 | 
			
		||||
    RFLOAT(vl);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -177,6 +177,7 @@
 | 
			
		||||
#undef  HAVE_READLINK
 | 
			
		||||
#undef  HAVE_REGEXEC
 | 
			
		||||
#undef  HAVE_RENAME
 | 
			
		||||
#undef  HAVE_RINT
 | 
			
		||||
#undef  HAVE_RL_SET_PROMPT
 | 
			
		||||
#undef  HAVE_SBRK
 | 
			
		||||
#undef  HAVE_SELECT
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								configure.in
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								configure.in
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
Mdnl
 | 
			
		||||
dnl
 | 
			
		||||
dnl Process this file with autoconf to produce a configure script.
 | 
			
		||||
dnl
 | 
			
		||||
 | 
			
		||||
@@ -281,7 +281,10 @@ then
 | 
			
		||||
  then
 | 
			
		||||
    CC="gcc  -mno-cygwin"
 | 
			
		||||
    AC_CHECK_LIB(wsock32,main)
 | 
			
		||||
    prefix="c:/Program\\ Files/Yap"
 | 
			
		||||
    if test "$prefix" = "NONE"
 | 
			
		||||
    then
 | 
			
		||||
      prefix="c:/Program\\ Files/Yap"
 | 
			
		||||
    fi
 | 
			
		||||
    DLL_LIBS="-L /usr/lib/mingw -lmsvcrt -lmingw32  -lkernel32"
 | 
			
		||||
  else
 | 
			
		||||
    DLL_LIBS=""
 | 
			
		||||
@@ -291,7 +294,10 @@ elif test "$target_os" = "mingw32"
 | 
			
		||||
then
 | 
			
		||||
  INSTALL_COMMAND=install_win32
 | 
			
		||||
  AC_CHECK_LIB(wsock32,main)
 | 
			
		||||
  prefix="c:/Program\\ Files/Yap"
 | 
			
		||||
  if test "$prefix" = "NONE"
 | 
			
		||||
  then
 | 
			
		||||
    prefix="c:/Program\\ Files/Yap"
 | 
			
		||||
  fi
 | 
			
		||||
  DLL_LIBS="-L /usr/mingw/lib -lmsvcrt -lmingw32  -lkernel32"
 | 
			
		||||
else
 | 
			
		||||
  DLL_LIBS=""
 | 
			
		||||
@@ -878,7 +884,7 @@ AC_CHECK_FUNCS(gethrtime getpwnam getrusage gettimeofday getwd)
 | 
			
		||||
AC_CHECK_FUNCS(isatty isnan kill labs link localtime lstat)
 | 
			
		||||
AC_CHECK_FUNCS(memcpy memmove mkstemp mktemp opendir)
 | 
			
		||||
AC_CHECK_FUNCS(putenv rand random readlink regexec)
 | 
			
		||||
AC_CHECK_FUNCS(rename rl_set_prompt sbrk select)
 | 
			
		||||
AC_CHECK_FUNCS(rename rint rl_set_prompt sbrk select)
 | 
			
		||||
AC_CHECK_FUNCS(setbuf setlinebuf sigaction siggetmask siginterrupt)
 | 
			
		||||
AC_CHECK_FUNCS(signal sigprocmask socket stat)
 | 
			
		||||
AC_CHECK_FUNCS(strchr strerror strncat strncpy strtod)
 | 
			
		||||
 
 | 
			
		||||
@@ -926,7 +926,6 @@ break :- '$get_value'('$break',BL), NBL is BL+1,
 | 
			
		||||
	    '$print_message'(informational, loading(consulting, File))
 | 
			
		||||
	),
 | 
			
		||||
	'$loop'(Stream,consult),
 | 
			
		||||
	'$exec_initialisation_goals',
 | 
			
		||||
	'$current_module'(Mod,OldModule),
 | 
			
		||||
	'$end_consult',
 | 
			
		||||
	( LC == 0 -> prompt(_,'   |: ') ; true),
 | 
			
		||||
@@ -943,6 +942,7 @@ break :- '$get_value'('$break',BL), NBL is BL+1,
 | 
			
		||||
	'$set_value'('$consulting',Old),
 | 
			
		||||
	'$set_value'('$consulting_file',OldF),
 | 
			
		||||
	'$cd'(OldD),
 | 
			
		||||
	'$exec_initialisation_goals',
 | 
			
		||||
	!.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -106,7 +106,6 @@ reconsult(Fs) :-
 | 
			
		||||
	'$recorda'('$initialisation','$',_),
 | 
			
		||||
	'$print_message'(informational, loading(reconsulting, File)),
 | 
			
		||||
	'$loop'(Stream,reconsult),
 | 
			
		||||
	'$exec_initialisation_goals',
 | 
			
		||||
	'$current_module'(Mod,OldModule),
 | 
			
		||||
	'$end_consult',
 | 
			
		||||
	'$clear_reconsulting',
 | 
			
		||||
@@ -116,6 +115,7 @@ reconsult(Fs) :-
 | 
			
		||||
	'$set_value'('$consulting',Old),
 | 
			
		||||
	'$set_value'('$consulting_file',OldF),
 | 
			
		||||
	'$cd'(OldD),
 | 
			
		||||
	'$exec_initialisation_goals',
 | 
			
		||||
	!.
 | 
			
		||||
 | 
			
		||||
'$start_reconsulting'(F) :-
 | 
			
		||||
@@ -139,7 +139,6 @@ reconsult(Fs) :-
 | 
			
		||||
	'$recorda'('$initialisation','$',_),
 | 
			
		||||
	'$print_message'(informational, loading(reconsulting, File)),
 | 
			
		||||
	'$loop'(Stream,reconsult),
 | 
			
		||||
	'$exec_initialisation_goals',
 | 
			
		||||
	'$current_module'(Mod,OldModule),
 | 
			
		||||
	'$end_consult',
 | 
			
		||||
	'$clear_reconsulting',
 | 
			
		||||
@@ -149,6 +148,7 @@ reconsult(Fs) :-
 | 
			
		||||
	'$set_value'('$consulting',Old),
 | 
			
		||||
	'$set_value'('$consulting_file',OldF),
 | 
			
		||||
	'$cd'(OldD),
 | 
			
		||||
	'$exec_initialisation_goals',
 | 
			
		||||
	!.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user