⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configure.ac

📁 测试内存泄露工具
💻 AC
📖 第 1 页 / 共 2 页
字号:
[ AC_DEFINE(SIGNAL_OKAY, 0) AC_MSG_RESULT([no]) ])## check the safety of the getenv function#AC_CHECK_FUNCS(getenv)AC_MSG_CHECKING([getenv safe])AC_RUN_IFELSE([[static char heap_mem[102400], *heap_p = heap_mem;free (char *pnt) {}char *malloc (int size) {  char *pnt;  getenv("PATH");  pnt = heap_p;  heap_p += size;  return pnt;}char *calloc (int number, int size) {  char *start, *pnt, *end;  getenv("PATH");  /* it should be already 0s */  start = malloc (number * size);  pnt = start;  end = start + size;  while (pnt < end) { *pnt++ = '\0'; }  return start;}char *realloc (char *old_pnt, int new_size) {  char *start, *pnt, *end;  getenv("PATH");  start = malloc (new_size);  pnt = start;  end = start + new_size;  while (pnt < end) { *pnt++ = *old_pnt++; }  return start;}main() { malloc(10); _exit(0); }]],[ AC_DEFINE(GETENV_SAFE, 1)  AC_MSG_RESULT([yes])  getenv_safe=yes ],# if it succeeds then something called free on the way out[ AC_DEFINE(GETENV_SAFE, 0)  AC_MSG_RESULT([no])  getenv_safe=no ],[ AC_DEFINE(GETENV_SAFE, 1)  AC_MSG_RESULT([yes])  getenv_safe=yes ])# now check to see if we can replace getenv with GetEnvironmentVariableAAC_CHECK_HEADER([sys/cygwin.h],		[AC_DEFINE(HAVE_SYS_CYGWIN_H,1) AC_SUBST([HAVE_SYS_CYGWIN_H],1)],		[AC_DEFINE(HAVE_SYS_CYGWIN_H,0) AC_SUBST([HAVE_SYS_CYGWIN_H],0)])AC_CHECK_HEADER([w32api/windef.h],		[AC_DEFINE(HAVE_W32API_WINDEF_H,1) AC_SUBST([HAVE_W32API_WINDEF_H],1)],		[AC_DEFINE(HAVE_W32API_WINDEF_H,0) AC_SUBST([HAVE_W32API_WINDEF_H],0)])AC_CHECK_HEADER([w32api/winbase.h],		[AC_DEFINE(HAVE_W32API_WINBASE_H,1) AC_SUBST([HAVE_W32API_WINBASE_H],1)],		[AC_DEFINE(HAVE_W32API_WINBASE_H,0) AC_SUBST([HAVE_W32API_WINBASE_H],0)],		[[#if HAVE_W32API_WINDEF_H# include <w32api/windef.h>#endif]])AC_MSG_CHECKING([for GetEnvironmentVariableA])AC_RUN_IFELSE([[#if HAVE_SYS_CYGWIN_H# include <sys/cygwin.h>#endif#if HAVE_STDARG_H# include <stdarg.h>#endif#if HAVE_W32API_WINDEF_H# include <w32api/windef.h>#endif#if HAVE_W32API_WINBASE_H# include <w32api/winbase.h>#endifmain() {  char env_buf[256];  GetEnvironmentVariableA("PATH", env_buf, sizeof(env_buf));}]],[ AC_DEFINE(HAVE_GETENVIRONMENTVARIABLEA, 1)  AC_MSG_RESULT([yes])  have_getenvironmentvariablea=yes ],[ AC_DEFINE(HAVE_GETENVIRONMENTVARIABLEA, 0)  AC_MSG_RESULT([no])  have_getenvironmentvariablea=no ],[ AC_DEFINE(HAVE_GETENVIRONMENTVARIABLEA, 1)  AC_MSG_RESULT([yes])  have_getenvironmentvariablea=yes ])if test x$getenv_safe != xyes && x$have_getenvironmentvariablea != xyes ; then  AC_MSG_WARN([Since getenv is not safe, you MUST add the following])  AC_MSG_WARN([code to the front of main():])  AC_MSG_WARN([[  #ifdef DMALLOC]])  AC_MSG_WARN([[    dmalloc_debug_setup(getenv("DMALLOC_OPTIONS"));]])  AC_MSG_WARN([[  #endif]])  AC_MSG_WARN([You will need to compile your program with: -DDMALLOC])fi############## check for constructor attribute support#AC_MSG_CHECKING([constructor attribute])AC_RUN_IFELSE([[/* if we call the loc_con constructor then exit with error code 0 */static void loc_con() __attribute__((constructor));static void loc_con() { exit(0); }int main() { exit(1); }]],[ AC_DEFINE(CONSTRUCTOR_WORKS, 1) AC_MSG_RESULT([yes]) ],[ AC_DEFINE(CONSTRUCTOR_WORKS, 0) AC_MSG_RESULT([no]) ],[ AC_DEFINE(CONSTRUCTOR_WORKS, 1) AC_MSG_RESULT([yes]) ])## check for destructor attribute support#AC_MSG_CHECKING([destructor attribute])AC_RUN_IFELSE([[/* if we call the loc_decon destructor then exit with error code 0 */static void loc_decon() __attribute__((destructor));static void loc_decon() { exit(0); }int main() { return 1; }]],[ AC_DEFINE(DESTRUCTOR_WORKS, 1)  AC_MSG_RESULT([yes])  destructor_works=yes ],[ AC_DEFINE(DESTRUCTOR_WORKS, 0)  AC_MSG_RESULT([no])  destructor_works=no ],[ AC_DEFINE(DESTRUCTOR_WORKS, 1)  AC_MSG_RESULT([yes])  destructor_works=yes ],)################################################################################ check if the return.h macros work#AC_MSG_CHECKING([return.h macros work])AC_RUN_IFELSE([#define __CONF_H__#define USE_RETURN_MACROS 1#define RETURN_MACROS_WORK 1#include "return.h"static void foo (void){  char	*ret_addr;  GET_RET_ADDR(ret_addr);}main(){  foo();  exit(0);}],[ AC_DEFINE(RETURN_MACROS_WORK, 1) AC_MSG_RESULT([yes]) ],[ AC_DEFINE(RETURN_MACROS_WORK, 0) AC_MSG_RESULT([no]) ],[ AC_DEFINE(RETURN_MACROS_WORK, 0) AC_MSG_RESULT([no]) ])################################################################################ check to see if ident workds#AC_MSG_CHECKING([if ident works])AC_COMPILE_IFELSE([#ident "$Id: configure.ac,v 1.29 2004/10/19 14:50:52 gray Exp $"static void foo (void) { }],[AC_DEFINE(IDENT_WORKS, 1) AC_MSG_RESULT([yes])],[AC_DEFINE(IDENT_WORKS, 0) AC_MSG_RESULT([no])])##############################################################################AC_MSG_NOTICE([pthread particulars])XX_OLD_LIBS=$LIBSAC_SEARCH_LIBS(pthread_mutex_init, pthread pthreads c_r)AC_CHECK_HEADER([pthread.h],		[AC_DEFINE(HAVE_PTHREAD_H,1) AC_SUBST([HAVE_PTHREAD_H],1)],		[AC_DEFINE(HAVE_PTHREAD_H,0) AC_SUBST([HAVE_PTHREAD_H],0)])AC_CHECK_HEADER([pthreads.h],		[AC_DEFINE(HAVE_PTHREADS_H,1) AC_SUBST([HAVE_PTHREADS_H],1)],		[AC_DEFINE(HAVE_PTHREADS_H,0) AC_SUBST([HAVE_PTHREADS_H],0)])AC_CHECK_FUNCS(pthread_mutex_init pthread_mutex_lock pthread_mutex_unlock)AC_MSG_CHECKING([pthread mutex type])AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_PTHREAD_H#  include <pthread.h>#endif#if HAVE_PTHREADS_H#  include <pthreads.h>#endif]],[[   pthread_mutex_t dmalloc_mutex;]])],[AC_DEFINE(THREAD_MUTEX_T,pthread_mutex_t) AC_MSG_RESULT([pthread_mutex_t])],[AC_MSG_RESULT([unknown])])AC_MSG_CHECKING([pthread attribute initialization])AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_PTHREAD_H#  include <pthread.h>#endif#if HAVE_PTHREADS_H#  include <pthreads.h>#endif]], [[	THREAD_MUTEX_T dmalloc_mutex;	pthread_mutex_init(&dmalloc_mutex, pthread_mutexattr_default);]])],[AC_DEFINE(THREAD_LOCK_INIT_VAL,pthread_mutexattr_default) AC_MSG_RESULT([pthread_mutexattr_default])],[AC_DEFINE(THREAD_LOCK_INIT_VAL,0) AC_MSG_RESULT([0])])LIBS=$XX_OLD_LIBS##############################################################################AC_MSG_NOTICE([functions])# auto-shutdown functionsAC_CHECK_FUNCS(atexit on_exit)if test $ac_cv_func_atexit = no \   && test $ac_cv_func_on_exit = no \   && test $destructor_works = no; then	AC_MSG_WARN()	AC_MSG_WARN(WARNING: The library cannot automatically shut itself down)	AC_MSG_WARN(without atexit, on_exit, or destructor support.  You will)	AC_MSG_WARN(need to call dmalloc_shutdown directly before exit to get)	AC_MSG_WARN(get the final statistics and unfreed memory information.)	AC_MSG_WARN()fi# other bells and whistlesAC_CHECK_FUNCS(fork gethostname getpid getuid time ctime)AC_CHECK_FUNCS(vprintf snprintf vsnprintf)AC_CHECK_FUNCS(recalloc memalign valloc)# required although we have code for them in compat.cAC_CHECK_FUNCS(memcmp memcpy memmove memset)AC_CHECK_FUNCS(strchr strrchr)AC_CHECK_FUNCS(strlen strcmp strcpy strsep)##############################################################################AC_MSG_NOTICE([various functions for argv files])# NOTE: some duplicated from aboveAC_CHECK_FUNCS(atoi atol getenv)AC_CHECK_FUNCS(strchr strcmp strcpy strlen strncmp strncpy strsep)##############################################################################AC_MSG_NOTICE([various functions for argument checking])# NOTE: some duplicated from aboveAC_CHECK_FUNCS(atoi atol)AC_CHECK_FUNCS(bcmp bcopy bzero)AC_CHECK_FUNCS([[index]])AC_CHECK_FUNCS(memccpy memchr memcmp memcpy memmove memset)AC_CHECK_FUNCS(rindex)AC_CHECK_FUNCS(strcasecmp strcat strchr strcmp strcpy strcspn strlen)AC_CHECK_FUNCS(strncasecmp strncat strncmp strncpy)AC_CHECK_FUNCS(strpbrk strrchr strspn strstr strtok)AC_CONFIG_FILES(Makefile)AC_CONFIG_COMMANDS([dmalloc.h.2],[newfile=dmalloc.h.2rm -f $newfile.techo '/* this is dmalloc.h.2 */' > $newfile.techo '/* produced by configure, inserted into dmalloc.h */' >> $newfile.techo '' >> $newfile.tif test "$ac_cv_c_const" = "yes"; then	echo '/* const is available */' >> $newfile.telse        echo '/* const is not available */' >> $newfile.t	echo '#ifndef const' >> $newfile.t	echo '#define const' >> $newfile.t	echo '#endif' >> $newfile.tfiif test "$ac_cv_strdup_macro" = "yes"; then	echo '/* strdup is a macro */' >> $newfile.t	echo '#define DMALLOC_STRDUP_MACRO' >> $newfile.telse	echo '/* strdup is not a macro */' >> $newfile.t	echo '#undef DMALLOC_STRDUP_MACRO' >> $newfile.tfiecho '' >> $newfile.techo '/*' >> $newfile.techo ' * the definition of DMALLOC_SIZE' >> $newfile.techo ' *' >> $newfile.techo ' * NOTE: some architectures have malloc, realloc, etc.' >> $newfile.techo ' * using unsigned instead of unsigned long.  You may' >> $newfile.techo ' * have to edit this by hand to fix any compilation' >> $newfile.techo ' * warnings or errors.' >> $newfile.techo ' */' >> $newfile.tif test "$ac_cv_type_size_t" = "yes"; then	echo "#include <sys/types.h>" >> $newfile.t	echo "#define DMALLOC_SIZE size_t" >> $newfile.telse	echo "/* no include file needed */" >> $newfile.t	echo "#define DMALLOC_SIZE unsigned long" >> $newfile.tfiecho '' >> $newfile.techo '/*' >> $newfile.techo ' * We use stdarg.h for the dmalloc_message and' >> $newfile.techo ' * dmalloc_vmessage functions.' >> $newfile.techo ' */' >> $newfile.tif test "$ac_cv_header_stdarg_h" = "yes"; then	echo "#include <stdarg.h>" >> $newfile.t	echo "#define DMALLOC_STDARG 1" >> $newfile.telse	echo "/* no stdarg.h available */" >> $newfile.t	echo "#define DMALLOC_STDARG 0" >> $newfile.tfiecho '' >> $newfile.tif cmp -s $newfile $newfile.t 2>/dev/null; then	AC_MSG_NOTICE([$newfile is unchanged])	rm -f $newfile.telse	rm -f $newfile	mv $newfile.t $newfilefi],[# initialization commandsac_cv_c_const=$ac_cv_c_constac_cv_strdup_macro=$ac_cv_strdup_macroac_cv_type_size_t=$ac_cv_type_size_tac_cv_header_stdarg_h=$ac_cv_header_stdarg_h])AC_CONFIG_COMMANDS([settings.h],[newfile=settings.hrm -f $newfile.techo '/*' > $newfile.techo ' * WARNING: this file was produced from settings.dist' >> $newfile.techo ' * by the configure program.  The configure script, when' >> $newfile.techo ' * run again, will overwrite changed made here.' >> $newfile.techo ' */' >> $newfile.techo '' >> $newfile.tcat $srcdir/settings.dist >> $newfile.tif cmp -s $newfile.t $newfile 2>/dev/null; then	AC_MSG_NOTICE([$newfile is unchanged])	rm -f $newfile.telse	rm -f $newfile	mv $newfile.t $newfilefi])AC_OUTPUTAC_MSG_NOTICE([])AC_MSG_NOTICE([Please check-out Makefile and conf.h to make sure that])AC_MSG_NOTICE([sane configuration values were a result.])AC_MSG_NOTICE([])AC_MSG_NOTICE([You may want to change values in settings.h before])AC_MSG_NOTICE([running 'make'.])AC_MSG_NOTICE([])AC_MSG_NOTICE([To run the basic library tests, you can execute:])AC_MSG_NOTICE([  make light])AC_MSG_NOTICE([or])AC_MSG_NOTICE([  make heavy])AC_MSG_NOTICE([])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -