replace a lot of win32 ifdef hacks with autoconf checks

SVN revision: 33616
This commit is contained in:
Mike Frysinger 2008-01-26 05:40:53 +00:00
parent 2c87820492
commit 184812f289
12 changed files with 62 additions and 56 deletions

View File

@ -25,6 +25,7 @@ AC_HEADER_SYS_WAIT
AC_LIBTOOL_WIN32_DLL
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
AC_PROG_LIBTOOL
AC_DEFINE_UNQUOTED(SHARED_LIB_SUFFIX, "$shrext_cmds", [Suffix for shared objects])
VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
@ -56,7 +57,7 @@ PKG_PROG_PKG_CONFIG
dnl check common functions and headers
AC_CHECK_FUNCS(gettimeofday)
AC_CHECK_FUNCS(strlcpy)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS_ONCE(dlfcn.h features.h langinfo.h locale.h netinet/in.h sys/mman.h sys/time.h windows.h winsock2.h)
AC_CHECK_LIB(dl, dlopen, dlopen_libs=-ldl)
AC_SUBST(dlopen_libs)

View File

@ -129,9 +129,6 @@ extern "C" {
typedef struct _Ecore_Exe_Event_Data_Line Ecore_Exe_Event_Data_Line; /**< Lines from a child process */
typedef struct _Ecore_Exe_Event_Data Ecore_Exe_Event_Data; /**< Data from a child process */
#ifndef _WIN32
#endif
struct _Ecore_Event_Signal_User /** User signal event */
{
int number; /**< The signal number. Either 1 or 2 */

View File

@ -1,11 +1,16 @@
#include <locale.h>
#ifndef _WIN32
#include <config.h>
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#else
#endif
#ifdef HAVE_WINDOWS_H
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef WIN32_LEAN_AND_MEAN
#endif /* _WIN32 */
#endif
#include "ecore_private.h"
#include "Ecore.h"

View File

@ -2,9 +2,11 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef _WIN32
#include <config.h>
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif /* _WIN32 */
#endif
#include <math.h>
#include <sys/time.h>

View File

@ -1,6 +1,9 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include <config.h>
#include "ecore_private.h"
#include "Ecore_Data.h"
#include "Ecore_Str.h"
@ -183,11 +186,7 @@ ecore_path_group_available(Ecore_Path_Group *group)
ext = strrchr(d->d_name, '.');
#ifndef _WIN32
if (!ext || strncmp(ext, ".so", 3))
#else
if (!ext || strncmp(ext, ".dll", 4))
#endif /* _WIN32 */
if (!ext || strncmp(ext, SHARED_LIB_SUFFIX, sizeof(SHARED_LIB_SUFFIX)))
continue;
snprintf(ppath, PATH_MAX, "%s/%s", path, d->d_name);
@ -259,11 +258,7 @@ ecore_plugin_available_get(Ecore_Path_Group *group)
if (*d->d_name == '.')
continue;
#ifndef _WIN32
if (!ecore_str_has_suffix(d->d_name, ".so"))
#else
if (!ecore_str_has_suffix(d->d_name, ".dll"))
#endif /* _WIN32 */
if (!ecore_str_has_suffix(d->d_name, SHARED_LIB_SUFFIX))
continue;
snprintf(ppath, PATH_MAX, "%s/%s", path, d->d_name);

View File

@ -2,21 +2,26 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifndef _WIN32
#include <config.h>
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#else
#endif
#ifdef HAVE_WINDOWS_H
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef WIN32_LEAN_AND_MEAN
# include <stdlib.h>
# include <stdio.h>
#endif /* _WIN32 */
#endif
#include <stdlib.h>
#include <stdio.h>
#include "ecore_private.h"
#include "Ecore_Data.h"
/* FIXME: that hack is a temporary one. That code will be in MinGW soon */
#ifdef _WIN32
#if defined(_WIN32) && !defined(HAVE_DLFCN_H)
# define RTLD_LAZY 1 /* lazy function call binding */
# define RTLD_NOW 2 /* immediate function call binding */
@ -86,7 +91,7 @@ char *dlerror (void)
return NULL;
}
#endif /* _WIN32 */
#endif
static Ecore_List *loaded_plugins = NULL;
@ -118,28 +123,19 @@ ecore_plugin_load(Ecore_Path_Group *group, const char *plugin_name, const char *
CHECK_PARAM_POINTER_RETURN("plugin_name", plugin_name, NULL);
#ifndef _WIN32
if (!version || *version == '\0')
snprintf(temp, sizeof(temp), "%s.so", plugin_name);
snprintf(temp, sizeof(temp), "%s" SHARED_LIB_SUFFIX, plugin_name);
else
snprintf(temp, sizeof(temp), "%s.so.%s", plugin_name, version);
#else
if (!version || *version == '\0')
snprintf(temp, sizeof(temp), "%s.dll", plugin_name);
else
snprintf(temp, sizeof(temp), "%s-%s.dll", plugin_name, version);
#endif /* _WIN32 */
snprintf(temp, sizeof(temp), "%s" SHARED_LIB_SUFFIX ".%s", plugin_name, version);
path = ecore_path_group_find(group, temp);
#ifndef _WIN32
if (!path && version)
{
/* if this file doesn't exist try a different order */
snprintf(temp, sizeof(temp), "%s.%s.so", plugin_name, version);
snprintf(temp, sizeof(temp), "%s.%s" SHARED_LIB_SUFFIX, plugin_name, version);
path = ecore_path_group_find(group, temp);
}
#endif /* _WIN32 */
if (!path)
return NULL;

View File

@ -1,6 +1,10 @@
#ifndef _ECORE_PRIVATE_H
#define _ECORE_PRIVATE_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -13,14 +17,10 @@
#include <limits.h>
#include <dirent.h>
#ifndef _WIN32
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef EAPI
# undef EAPI
#endif

View File

@ -2,11 +2,13 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef _WIN32
#include <config.h>
#ifdef HAVE_WINDOWS_H
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef WIN32_LEAN_AND_MEAN
#else
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include "ecore_private.h"

View File

@ -9,7 +9,7 @@
#include <errno.h>
#include <netdb.h>
#include "config.h"
#include <config.h>
#if USE_OPENSSL
#include <time.h>
@ -21,9 +21,10 @@
#include "ecore_con_private.h"
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#elif _WIN32
#include <winsock2.h>
# include <netinet/in.h>
#endif
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
static void _ecore_con_cb_dns_lookup(void *data, struct hostent *he);

View File

@ -4,13 +4,17 @@
#ifndef _ECORE_EVAS_PRIVATE_H
#define _ECORE_EVAS_PRIVATE_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Ecore_Data.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifndef _WIN32
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif

View File

@ -2,11 +2,13 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include <config.h>
#ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
#endif
#ifdef __linux__
#ifdef HAVE_FEATURES_H
# include <features.h>
#endif
#include <ctype.h>

View File

@ -1,14 +1,15 @@
#include "Ecore.h"
#include "config.h"
#include <config.h>
#include "Ecore_Con.h"
#include "ecore_private.h"
#include "ecore_ipc_private.h"
#include "Ecore_Ipc.h"
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#elif _WIN32
#include <winsock2.h>
# include <netinet/in.h>
#endif
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
#define DLT_ZERO 0