Example #1
0
EXPORT void webqq_end()
{
	DBG (("webqq_ending"));
	webqq_running = 0;
	pthread_join( thread_guarder, NULL );
	loop_cleanup( &user_loop );
	config_end();
//	qqsocket_end();
	DBG (("webqq_ended"));
}
/* This is: php/Zend/configure.in

	This is going to be different from FLTK, mainly, since we have to be a tard bit different.
	Noamlly, Zend is configured within php's main configure.in. We are doing this independently, 
	so that we can do a components based build.
	
	Files that need to be generated:
		- php/zend/zend_config.h
		
	Notes:
		- Zend obviously has windows optimized files (.d/.dsp)!
		- It has some head-breaking checks. All added now, cDetect however might wants to adopt the dlsym check.
*/
int main(int argc, char** argv) {
	config_begin();
	ac_register();

	// We register some options here.
	// cachefile is very neccessary for our caching...
   	config_option_register_group("cDetect extra");
	config_option_register("cache",0,"cache.txt",0,"cDetect cache file to use.");
	config_option_register("out",0,"php/Zend/_zend_config.h",0,"Output config.h.");
	
	// Zend options
	config_option_register_group("Zend Engine");
	config_option_register(
		"with-zend-vm",0,"CALL",0,
		"Set virtual machine dispatch method. "
		"Type is one of \"CALL\", \"SWITCH\" or \"GOTO\""
	);
	config_option_register("enable-maintainer-zts",0,"no","yes","Enable thread safety - for code maintainers only!!");
	config_option_register("disable-inline-optimization",0,"no","yes","If building zend_execute.lo fails, try this switch");
	config_option_register("enable-debug",0,"no","yes","If building zend_execute.lo fails, try this switch");

	config_option_register("enable-zend-signals",0,"no","yes","Use zend signal handling");
	config_option_register("enable-debug",0,"no","yes","If building zend_execute.lo fails, try this switch");
	
	if(config_options(argc, argv)) {
	// Build stuff
	config_build_register("util/zend_config.h.in","php/Zend/zend_config.h");

		// The main logic happens here, just as always.
		zend_config_process();
		
		// Zend defines a top part, we define it too.
		// NOTE: It is obvious, that it wants to define this stuff if we are NOT on microsoft!
		// This check could be made simpler by FAR...
		config_tool_define(
			"ZEND_TOP",
			"#if defined(__GNUC__) && __GNUC__ >= 4\n"
			"# define ZEND_API __attribute__ ((visibility(\"default\")))\n"
			"# define ZEND_DLEXPORT __attribute__ ((visibility(\"default\")))\n"
			"#else\n"
			"# define ZEND_API\n"
			"# define ZEND_DLEXPORT\n"
			"#endif\n"
			"\n"
			"#define ZEND_DLIMPORT\n"
			"\n"
			"/* Define if you want to enable memory limit support */\n"
			"#define MEMORY_LIMIT 0\n"
		);
		
		// Aaaand of course, a bottom.
		// Again, this could be simplified.
		config_tool_define(
			"ZEND_BOTTOM",
			"#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS\n"
			"\n"
			"#ifdef HAVE_STDLIB_H\n"
			"# include <stdlib.h>\n"
			"#endif\n"
			"\n"
			"#ifdef HAVE_SYS_TYPES_H\n"
			"# include <sys/types.h>\n"
			"#endif\n"
			"\n"
			"#ifdef HAVE_SYS_SELECT_H\n"
			"#include <sys/select.h>\n"
			"#endif\n"
			"\n"
			"#ifdef HAVE_IEEEFP_H\n"
			"# include <ieeefp.h>\n"
			"#endif\n"
			"\n"
			"#ifdef HAVE_STRING_H\n"
			"# include <string.h>\n"
			"#else\n"
			"# include <strings.h>\n"
			"#endif\n"
			"\n"
			"#if ZEND_BROKEN_SPRINTF\n"
			"int zend_sprintf(char *buffer, const char *format, ...);\n"
			"#else\n"
			"# define zend_sprintf sprintf\n"
			"#endif\n"
			"\n"
			"#include <math.h>\n"
			"\n"
			"/* To enable the is_nan, is_infinite and is_finite PHP functions */\n"
			"#ifdef NETWARE\n"
			"	#define HAVE_ISNAN 1\n"
			"	#define HAVE_ISINF 1\n"
			"	#define HAVE_ISFINITE 1\n"
			"#endif\n"
			"\n"
			"#ifndef zend_isnan\n"
			"#ifdef HAVE_ISNAN\n"
			"#define zend_isnan(a) isnan(a)\n"
			"#elif defined(HAVE_FPCLASS)\n"
			"#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))\n"
			"#else\n"
			"#define zend_isnan(a) 0\n"
			"#endif\n"
			"#endif\n"
			"\n"
			"#ifdef HAVE_ISINF\n"
			"#define zend_isinf(a) isinf(a)\n"
			"#elif defined(INFINITY)\n"
			"/* Might not work, but is required by ISO C99 */\n"
			"#define zend_isinf(a) (((a)==INFINITY)?1:0)\n"
			"#elif defined(HAVE_FPCLASS)\n"
			"#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))\n"
			"#else\n"
			"#define zend_isinf(a) 0\n"
			"#endif\n"
			"\n"
			"#ifdef HAVE_FINITE\n"
			"#define zend_finite(a) finite(a)\n"
			"#elif defined(HAVE_ISFINITE) || defined(isfinite)\n"
			"#define zend_finite(a) isfinite(a)\n"
			"#elif defined(fpclassify)\n"
			"#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)\n"
			"#else\n"
			"#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)\n"
			"#endif\n"
			"\n"
			"#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */\n"
			"\n"
			"#ifdef NETWARE\n"
			"#ifdef USE_WINSOCK\n"
			"#/*This detection against winsock is of no use*/ undef HAVE_SOCKLEN_T\n"
			"#/*This detection against winsock is of no use*/ undef HAVE_SYS_SOCKET_H\n"
			"#endif\n"
			"#endif\n"
		);
		
		// Do some checks
		ac_header_stdc();
		zend_mature_stdc();
		ac_type_size_t();
		zend_type_checks();
		ac_header_mmap_anonymous();
		ac_header_dirent();
		
		config_function_check_library("dlopen", "dl");
		config_function_check("vprintf");
		config_function_check("memcmp");
		config_function_check("alloca");
		config_function_check("memcpy");
		config_function_check("strdup");
		config_function_check("getpid");
		config_function_check("kill");
		config_function_check("strtod");
		config_function_check("strtol");
		config_function_check("finite");
		config_function_check("fpclass");
		config_function_check("sigsetjmp");
		config_function_check("finite");
		config_function_check("isfinite");
		config_function_check("isinf");
		config_function_check("isnan");
		config_function_check("sigaction");
		
		// An OS check.
		#if __APPLE__ || __DARWIN__
		config_macro_define("DARWIN","1");
		#endif
		
		// Complex checks
		zend_dlsym_check();
		zend_mm_test();
		zend_mmap_zero();
	}
	config_end();
}
Example #3
0
EXPORT void libqq_cleanup()
{
	config_end();
	qqsocket_end();
}
// Cool. TSRM is uber-easy. Lets take advantage of this ~100 configure.in.
// Generate: php/TSRM/tsrm_config.h
int main(int argc, char** argv){
	config_begin();
	ac_register();
	
   	config_option_register_group("cDetect extra");
	config_option_register("cache",0,"cache.txt",0,"cDetect cache file to use.");
	config_option_register("out",0,"php/TSRM/_tsrm_config.h",0,"Output config.h.");
	
	// TSRM options
	config_option_register_group("TSRM: ThreadSafe Resource Management");
	config_option_register("with-tsrm-pth",0,"no",0,"Use GNU Pth (supply PATH or \"yes\")");
	config_option_register("with-tsrm-st",0,"no",0,"Use SGI's State Threads (supply PATH or \"yes\")");
	config_option_register("with-tsrm-pthreads",0,"no","yes","Use POSIX pthreads (Default)");
	config_option_register("with-tsrm-zts",0,"no","yes","Use POSIX pthreads (Default)");
	
	if(config_options(argc, argv)) {
		// And encore!
		config_cache_register( config_option_get("cache") );
		config_header_register( config_option_get("out") );
		
		// options.
		if( // If neither of these are set, use the default.
			config_equal( config_option_get("with-tsrm-pth"), "no" )
			|| config_equal( config_option_get("with-tsrm-st"), "no" )
		) {
			config_option_set("with-tsrm-pthreads","yes");
			config_macro_define("PTHREADS","1");
		}
		if(config_equal( config_option_get("with-tsrm-zts"), "yes" )) {
			config_macro_define("ZTS","1");
		}
		
		// Header
		ac_header_stdc();
		ac_header_dirent();
		config_header_check("utime.h");
		config_header_check("dirent.h");
		config_header_check("stdarg.h");
		config_header_check("alloca.h");
		config_header_check("unistd.h");
		config_header_check("limits.h");
		config_header_check("stdlib.h");
		config_header_check("stdarg.h");
		config_header_check("string.h");
		config_header_check("float.h");
		config_header_check("st.h");
		
		// Function
		config_function_check("sigprocmask");
		
		// Customs
		config_function_check_library("pthread_create","pthread")
			|| config_macro_define("PTHREADS","1");
		
		// Write a bit of extra chunk...
		char* tsrm_config_h = "php/TSRM/tsrm_config.h";
		config_report("Writing %s\n", tsrm_config_h);
		cdetect_string_t src = cdetect_string_format(
			"#include \"_tsrm_config.h\"\n"
			"#ifdef HAVE_STDLIB_H\n"
			"#include <stdlib.h>\n"
			"#endif\n"
		);
		cdetect_bool_t sc = cdetect_file_overwrite(tsrm_config_h, src);
		if(sc != CDETECT_TRUE) {
			config_report("!! Error: Could not write php/TSRM/tsrm_config.h!\n");
			config_abort();
		}
		cdetect_string_destroy(src);
	}
	config_end();
}