@@ -1,7 +1,7 @@ dnl -*- Autoconf -*- -dnl Copyright (C) 1993-2009 Free Software Foundation, Inc. +dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. @@ -28,11 +28,15 @@ #ifndef HAVE_GETPAGESIZE #include #define getpagesize() PAGESIZE #else ]AC_LANG_EXTERN[ +#if defined(__STDC__) || defined(__cplusplus) RETGETPAGESIZETYPE getpagesize (void); +#else +RETGETPAGESIZETYPE getpagesize(); +#endif #endif char foo; int main () { unsigned long pagesize = getpagesize(); #define page_align(address) (char*)((unsigned long)(address) & -pagesize) @@ -45,43 +49,43 @@ mprotect_prog="$mprotect_prog"' char* area = (char*) malloc(6*pagesize); char* fault_address = area + pagesize*7/2; ' if test -z "$no_mprotect"; then -AC_TRY_RUN(GL_NOCRASH[$mprotect_prog - nocrash_init(); - if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) exit(0); - foo = *fault_address; /* this should cause an exception or signal */ - exit(0); }], no_mprotect=1, , -: # When cross-compiling, don't assume anything. -) -fi -if test -z "$no_mprotect"; then -AC_TRY_RUN(GL_NOCRASH[$mprotect_prog - nocrash_init(); - if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) exit(0); - *fault_address = 'z'; /* this should cause an exception or signal */ - exit(0); }], no_mprotect=1, , -: # When cross-compiling, don't assume anything. -) -fi -if test -z "$no_mprotect"; then -AC_TRY_RUN(GL_NOCRASH[$mprotect_prog - nocrash_init(); - if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) exit(0); - *fault_address = 'z'; /* this should cause an exception or signal */ - exit(0); }], no_mprotect=1, , -: # When cross-compiling, don't assume anything. -) -fi -if test -z "$no_mprotect"; then -AC_TRY_RUN(GL_NOCRASH[$mprotect_prog - nocrash_init(); - if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) exit(1); - if (mprotect(page_align(fault_address),pagesize,PROT_READ|PROT_WRITE) < 0) exit(1); - *fault_address = 'z'; /* this should not cause an exception or signal */ - exit(0); }], , no_mprotect=1, +AC_TRY_RUN([$mprotect_prog + if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) exit(0); + foo = *fault_address; /* this should cause a core dump */ + exit(0); }], + no_mprotect=1, rm -f core, +: # When cross-compiling, don't assume anything. +) +fi +if test -z "$no_mprotect"; then +AC_TRY_RUN([$mprotect_prog + if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) exit(0); + *fault_address = 'z'; /* this should cause a core dump */ + exit(0); }], + no_mprotect=1, rm -f core, +: # When cross-compiling, don't assume anything. +) +fi +if test -z "$no_mprotect"; then +AC_TRY_RUN([$mprotect_prog + if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) exit(0); + *fault_address = 'z'; /* this should cause a core dump */ + exit(0); }], + no_mprotect=1, rm -f core, +: # When cross-compiling, don't assume anything. +) +fi +if test -z "$no_mprotect"; then +AC_TRY_RUN([$mprotect_prog + if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) exit(1); + if (mprotect(page_align(fault_address),pagesize,PROT_READ|PROT_WRITE) < 0) exit(1); + *fault_address = 'z'; /* this should not cause a core dump */ + exit(0); }], , no_mprotect=1 +rm -f core, : # When cross-compiling, don't assume anything. ) fi if test -z "$no_mprotect"; then cl_cv_func_mprotect_works=yes @@ -88,9 +92,9 @@ else cl_cv_func_mprotect_works=no fi ]) if test $cl_cv_func_mprotect_works = yes; then - AC_DEFINE([HAVE_WORKING_MPROTECT],[],[have a working mprotect() function]) + AC_DEFINE(HAVE_WORKING_MPROTECT,,[have a working mprotect() function]) fi fi ])