Commit caedc60d authored by Ryan C. Gordon's avatar Ryan C. Gordon

Removed legacy Mac OS X dlcompat code.

It was only needed for Mac OS X 10.0 through 10.2, so it seems silly to keep
 it around for SDL 1.3.

I'll leave it in the 1.2 branch for now, though.
parent 5089e0b3
...@@ -204,7 +204,6 @@ ...@@ -204,7 +204,6 @@
04BD007112E6671800899322 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; }; 04BD007112E6671800899322 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; };
04BD007212E6671800899322 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; }; 04BD007212E6671800899322 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; };
04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; }; 04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; };
04BD008A12E6671800899322 /* SDL_dlcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3712E6671700899322 /* SDL_dlcompat.c */; };
04BD009412E6671800899322 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; }; 04BD009412E6671800899322 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; };
04BD009612E6671800899322 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; }; 04BD009612E6671800899322 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; };
04BD009B12E6671800899322 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; }; 04BD009B12E6671800899322 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; };
...@@ -362,7 +361,6 @@ ...@@ -362,7 +361,6 @@
04BD028C12E6671800899322 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; }; 04BD028C12E6671800899322 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; };
04BD028D12E6671800899322 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; }; 04BD028D12E6671800899322 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; };
04BD02A312E6671800899322 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; }; 04BD02A312E6671800899322 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; };
04BD02A512E6671800899322 /* SDL_dlcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3712E6671700899322 /* SDL_dlcompat.c */; };
04BD02AE12E6671800899322 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; }; 04BD02AE12E6671800899322 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; };
04BD02B012E6671800899322 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; }; 04BD02B012E6671800899322 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; };
04BD02B512E6671800899322 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; }; 04BD02B512E6671800899322 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; };
...@@ -692,7 +690,6 @@ ...@@ -692,7 +690,6 @@
04BDFE1712E6671700899322 /* SDL_joystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_joystick_c.h; sourceTree = "<group>"; }; 04BDFE1712E6671700899322 /* SDL_joystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_joystick_c.h; sourceTree = "<group>"; };
04BDFE1812E6671700899322 /* SDL_sysjoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick.h; sourceTree = "<group>"; }; 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick.h; sourceTree = "<group>"; };
04BDFE3312E6671700899322 /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = "<group>"; }; 04BDFE3312E6671700899322 /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = "<group>"; };
04BDFE3712E6671700899322 /* SDL_dlcompat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dlcompat.c; sourceTree = "<group>"; };
04BDFE4B12E6671700899322 /* SDL_syspower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syspower.c; sourceTree = "<group>"; }; 04BDFE4B12E6671700899322 /* SDL_syspower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syspower.c; sourceTree = "<group>"; };
04BDFE4E12E6671700899322 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = "<group>"; }; 04BDFE4E12E6671700899322 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = "<group>"; };
04BDFE5512E6671700899322 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert_c.h; path = ../../src/SDL_assert_c.h; sourceTree = SOURCE_ROOT; }; 04BDFE5512E6671700899322 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert_c.h; path = ../../src/SDL_assert_c.h; sourceTree = SOURCE_ROOT; };
...@@ -1299,14 +1296,6 @@ ...@@ -1299,14 +1296,6 @@
path = dlopen; path = dlopen;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
04BDFE3612E6671700899322 /* macosx */ = {
isa = PBXGroup;
children = (
04BDFE3712E6671700899322 /* SDL_dlcompat.c */,
);
path = macosx;
sourceTree = "<group>";
};
04BDFE4512E6671700899322 /* power */ = { 04BDFE4512E6671700899322 /* power */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -2098,7 +2087,6 @@ ...@@ -2098,7 +2087,6 @@
04BD006612E6671800899322 /* SDL_sysjoystick.c in Sources */, 04BD006612E6671800899322 /* SDL_sysjoystick.c in Sources */,
04BD007012E6671800899322 /* SDL_joystick.c in Sources */, 04BD007012E6671800899322 /* SDL_joystick.c in Sources */,
04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */, 04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */,
04BD008A12E6671800899322 /* SDL_dlcompat.c in Sources */,
04BD009412E6671800899322 /* SDL_syspower.c in Sources */, 04BD009412E6671800899322 /* SDL_syspower.c in Sources */,
04BD009612E6671800899322 /* SDL_power.c in Sources */, 04BD009612E6671800899322 /* SDL_power.c in Sources */,
04BD009C12E6671800899322 /* SDL_assert.c in Sources */, 04BD009C12E6671800899322 /* SDL_assert.c in Sources */,
...@@ -2210,7 +2198,6 @@ ...@@ -2210,7 +2198,6 @@
04BD028112E6671800899322 /* SDL_sysjoystick.c in Sources */, 04BD028112E6671800899322 /* SDL_sysjoystick.c in Sources */,
04BD028B12E6671800899322 /* SDL_joystick.c in Sources */, 04BD028B12E6671800899322 /* SDL_joystick.c in Sources */,
04BD02A312E6671800899322 /* SDL_sysloadso.c in Sources */, 04BD02A312E6671800899322 /* SDL_sysloadso.c in Sources */,
04BD02A512E6671800899322 /* SDL_dlcompat.c in Sources */,
04BD02AE12E6671800899322 /* SDL_syspower.c in Sources */, 04BD02AE12E6671800899322 /* SDL_syspower.c in Sources */,
04BD02B012E6671800899322 /* SDL_power.c in Sources */, 04BD02B012E6671800899322 /* SDL_power.c in Sources */,
04BD02B612E6671800899322 /* SDL_assert.c in Sources */, 04BD02B612E6671800899322 /* SDL_assert.c in Sources */,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2282,15 +2282,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ...@@ -2282,15 +2282,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
CheckDiskAudio CheckDiskAudio
CheckDummyAudio CheckDummyAudio
CheckDLOPEN CheckDLOPEN
# Set up files for the shared object loading library
# (this needs to be done before the dynamic X11 check)
if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
AC_DEFINE(SDL_LOADSO_DLCOMPAT, 1, [ ])
SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
have_loadso=yes
fi
CheckCOCOA CheckCOCOA
CheckX11 CheckX11
CheckMacGL CheckMacGL
......
...@@ -219,7 +219,6 @@ ...@@ -219,7 +219,6 @@
/* Enable various shared object loading systems */ /* Enable various shared object loading systems */
#undef SDL_LOADSO_BEOS #undef SDL_LOADSO_BEOS
#undef SDL_LOADSO_DLCOMPAT
#undef SDL_LOADSO_DLOPEN #undef SDL_LOADSO_DLOPEN
#undef SDL_LOADSO_DUMMY #undef SDL_LOADSO_DUMMY
#undef SDL_LOADSO_LDG #undef SDL_LOADSO_LDG
......
/*
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
#ifdef SDL_LOADSO_DLCOMPAT
/* Please note that dlcompat apparently ships in current Mac OS X versions
* as a system library that provides compatibility with the Unix "dlopen"
* interface. In order to allow SDL to work on older OS X releases and also
* not conflict with the system lib on newer versions, we include dlcompat
* in SDL and change the symbols to prevent symbol clash with any existing
* system libraries. --ryan.
*/
/* here is the dlcompat license: */
/*
Copyright (c) 2002 Jorge Acereda <jacereda@users.sourceforge.net> &
Peter O'Gorman <ogorman@users.sourceforge.net>
Portions may be copyright others, see the AUTHORS file included with this
distribution.
Maintained by Peter O'Gorman <ogorman@users.sourceforge.net>
Bug Reports and other queries should go to <ogorman@users.sourceforge.net>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <limits.h>
#include <mach-o/dyld.h>
#include <mach-o/nlist.h>
#include <mach-o/getsect.h>
#include "SDL_stdinc.h"
/* Just playing to see if it would compile with the freebsd headers, it does,
* but because of the different values for RTLD_LOCAL etc, it would break binary
* compat... oh well
*/
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
/*include "dlfcn.h"*/
#ifdef __cplusplus
extern "C"
{
#endif
#if defined (__GNUC__) && __GNUC__ > 3
#define dl_restrict __restrict
#else
#define dl_restrict
#endif
#if 0
#ifndef _POSIX_SOURCE
/*
* Structure filled in by dladdr().
*/
typedef struct SDL_OSX_dl_info
{
const char *dli_fname; /* Pathname of shared object */
void *dli_fbase; /* Base address of shared object */
const char *dli_sname; /* Name of nearest symbol */
void *dli_saddr; /* Address of nearest symbol */
} SDL_OSX_Dl_info;
static int SDL_OSX_dladdr(const void *dl_restrict,
SDL_OSX_Dl_info * dl_restrict);
#endif /* ! _POSIX_SOURCE */
#endif /* 0 */
static int SDL_OSX_dlclose(void *handle);
static const char *SDL_OSX_dlerror(void);
static void *SDL_OSX_dlopen(const char *path, int mode);
static void *SDL_OSX_dlsym(void *dl_restrict handle,
const char *dl_restrict symbol);
#define RTLD_LAZY 0x1
#define RTLD_NOW 0x2
#define RTLD_LOCAL 0x4
#define RTLD_GLOBAL 0x8
#ifndef _POSIX_SOURCE
#define RTLD_NOLOAD 0x10
#define RTLD_NODELETE 0x80
/*
* Special handle arguments for SDL_OSX_dlsym().
*/
#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */
#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */
#endif /* ! _POSIX_SOURCE */
#ifdef __cplusplus
}
#endif
#ifndef dl_restrict
#define dl_restrict __restrict
#endif
/* This is not available on 10.1 */
#ifndef LC_LOAD_WEAK_DYLIB
#define LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD)
#endif
/* With this stuff here, this thing may actually compile/run on 10.0 systems
* Not that I have a 10.0 system to test it on anylonger
*/
#ifndef LC_REQ_DYLD
#define LC_REQ_DYLD 0x80000000
#endif
#ifndef NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED
#define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4
#endif
#ifndef NSADDIMAGE_OPTION_RETURN_ON_ERROR
#define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1
#endif
#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0
#endif
#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
#define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4
#endif
/* These symbols will be looked for in dyld */
static const struct mach_header *(*dyld_NSAddImage) (const char *,
unsigned long) = 0;
static int (*dyld_NSIsSymbolNameDefinedInImage) (const struct mach_header *,
const char *) = 0;
static NSSymbol(*dyld_NSLookupSymbolInImage) (const struct mach_header *,
const char *, unsigned long) =
0;
/* Define this to make dlcompat reuse data block. This way in theory we save
* a little bit of overhead. However we then couldn't correctly catch excess
* calls to SDL_OSX_dlclose(). Hence we don't use this feature
*/
#undef REUSE_STATUS
/* Size of the internal error message buffer (used by dlerror()) */
#define ERR_STR_LEN 251
/* Maximum number of search paths supported by getSearchPath */
#define MAX_SEARCH_PATHS 32
#define MAGIC_DYLIB_OFI ((NSObjectFileImage) 'DYOF')
#define MAGIC_DYLIB_MOD ((NSModule) 'DYMO')
/* internal flags */
#define DL_IN_LIST 0x01
/* our mutex */
static pthread_mutex_t dlcompat_mutex;
/* Our thread specific storage
*/
static pthread_key_t dlerror_key;
struct dlthread
{
int lockcnt;
unsigned char errset;
char errstr[ERR_STR_LEN];
};
/* This is our central data structure. Whenever a module is loaded via
* SDL_OSX_dlopen(), we create such a struct.
*/
struct dlstatus
{
struct dlstatus *next; /* pointer to next element in the linked list */
NSModule module;
const struct mach_header *lib;
int refs; /* reference count */
int mode; /* mode in which this module was loaded */
dev_t device;
ino_t inode;
int flags; /* Any internal flags we may need */
};
/* Head node of the dlstatus list */
static struct dlstatus mainStatus =
{ 0, MAGIC_DYLIB_MOD, NULL, -1, RTLD_GLOBAL, 0, 0, 0 };
static struct dlstatus *stqueue = &mainStatus;
/* Storage for the last error message (used by dlerror()) */
/* static char err_str[ERR_STR_LEN]; */
/* static int err_filled = 0; */
/* Prototypes to internal functions */
static void debug(const char *fmt, ...);
static void error(const char *str, ...);
static const char *safegetenv(const char *s);
static const char *searchList(void);
static const char *getSearchPath(int i);
static const char *getFullPath(int i, const char *file);
static const struct stat *findFile(const char *file, const char **fullPath);
static int isValidStatus(struct dlstatus *status);
static inline int isFlagSet(int mode, int flag);
static struct dlstatus *lookupStatus(const struct stat *sbuf);
static void insertStatus(struct dlstatus *dls, const struct stat *sbuf);
static int promoteLocalToGlobal(struct dlstatus *dls);
static void *reference(struct dlstatus *dls, int mode);
static void *dlsymIntern(struct dlstatus *dls, const char *symbol,
int canSetError);
static struct dlstatus *allocStatus(void);
static struct dlstatus *loadModule(const char *path, const struct stat *sbuf,
int mode);
static NSSymbol search_linked_libs(const struct mach_header *mh,
const char *symbol);
static const char *get_lib_name(const struct mach_header *mh);
static const struct mach_header *get_mach_header_from_NSModule(NSModule mod);
static void dlcompat_init_func(void);
static inline void dlcompat_init_check(void);
static inline void dolock(void);
static inline void dounlock(void);
static void dlerrorfree(void *data);
static void resetdlerror(void);
static const struct mach_header *my_find_image(const char *name);
static const struct mach_header *image_for_address(const void *address);
static inline char *dyld_error_str(void);
#if FINK_BUILD
/* Two Global Functions */
static void *dlsym_prepend_underscore(void *handle, const char *symbol);
static void *dlsym_auto_underscore(void *handle, const char *symbol);
/* And their _intern counterparts */
static void *dlsym_prepend_underscore_intern(void *handle,
const char *symbol);
static void *dlsym_auto_underscore_intern(void *handle, const char *symbol);
#endif
/* Functions */
static void
debug(const char *fmt, ...)
{
#if DEBUG > 1
va_list arg;
va_start(arg, fmt);
fprintf(stderr, "DLDEBUG: ");
vfprintf(stderr, fmt, arg);
fprintf(stderr, "\n");
fflush(stderr);
va_end(arg);
#endif
}
static void
error(const char *str, ...)
{
va_list arg;
struct dlthread *tss;
char *err_str;
va_start(arg, str);
tss = pthread_getspecific(dlerror_key);
err_str = tss->errstr;
SDL_strlcpy(err_str, "dlcompat: ", ERR_STR_LEN);
vsnprintf(err_str + 10, ERR_STR_LEN - 10, str, arg);
va_end(arg);
debug("ERROR: %s\n", err_str);
tss->errset = 1;
}
static void
warning(const char *str)
{
#if DEBUG > 0
fprintf(stderr, "WARNING: dlcompat: %s\n", str);
#endif
}
static const char *
safegetenv(const char *s)
{
const char *ss = SDL_getenv(s);
return ss ? ss : "";
}
/* because this is only used for debugging and error reporting functions, we
* don't really care about how elegant it is... it could use the load
* commands to find the install name of the library, but...
*/
static const char *
get_lib_name(const struct mach_header *mh)
{
unsigned long count = _dyld_image_count();
unsigned long i;
const char *val = NULL;
if (mh) {
for (i = 0; i < count; i++) {
if (mh == _dyld_get_image_header(i)) {
val = _dyld_get_image_name(i);
break;
}
}
}
return val;
}
/* Returns the mach_header for the module bu going through all the loaded images
* and finding the one with the same name as the module. There really ought to be
* an api for doing this, would be faster, but there isn't one right now
*/
static const struct mach_header *
get_mach_header_from_NSModule(NSModule mod)
{
const char *mod_name = NSNameOfModule(mod);
const struct mach_header *mh = NULL;
unsigned long count = _dyld_image_count();
unsigned long i;
debug("Module name: %s", mod_name);
for (i = 0; i < count; i++) {
if (!SDL_strcmp(mod_name, _dyld_get_image_name(i))) {
mh = _dyld_get_image_header(i);
break;
}
}
return mh;
}
/* Compute and return a list of all directories that we should search when
* trying to locate a module. We first look at the values of LD_LIBRARY_PATH
* and DYLD_LIBRARY_PATH, and then finally fall back to looking into
* /usr/lib and /lib. Since both of the environments variables can contain a
* list of colon seperated paths, we simply concat them and the two other paths
* into one big string, which we then can easily parse.
* Splitting this string into the actual path list is done by getSearchPath()
*/
static const char *
searchList()
{
size_t buf_size;
static char *buf = NULL;
const char *ldlp = safegetenv("LD_LIBRARY_PATH");
const char *dyldlp = safegetenv("DYLD_LIBRARY_PATH");
const char *stdpath = SDL_getenv("DYLD_FALLBACK_LIBRARY_PATH");
if (!stdpath)
stdpath = "/usr/local/lib:/lib:/usr/lib";
if (!buf) {
buf_size =
SDL_strlen(ldlp) + SDL_strlen(dyldlp) + SDL_strlen(stdpath) + 4;
buf = SDL_malloc(buf_size);
SDL_snprintf(buf, buf_size, "%s%s%s%s%s%c", dyldlp,
(dyldlp[0] ? ":" : ""), ldlp, (ldlp[0] ? ":" : ""),
stdpath, '\0');
}
return buf;
}
/* Returns the ith search path from the list as computed by searchList() */
static const char *
getSearchPath(int i)
{
static const char *list = 0;
static char **path = (char **) 0;
static int end = 0;
static int numsize = MAX_SEARCH_PATHS;
static char **tmp;
/* So we can call SDL_free() in the "destructor" we use i=-1 to return the alloc'd array */
if (i == -1) {
return (const char *) path;
}
if (!path) {
path = (char **) SDL_calloc(MAX_SEARCH_PATHS, sizeof(char **));
}
if (!list && !end)
list = searchList();
if (i >= (numsize)) {
debug("Increasing size for long PATH");
tmp =
(char **) SDL_calloc((MAX_SEARCH_PATHS + numsize),
sizeof(char **));
if (tmp) {
SDL_memcpy(tmp, path, sizeof(char **) * numsize);
SDL_free(path);
path = tmp;
numsize += MAX_SEARCH_PATHS;
} else {
return 0;
}
}
while (!path[i] && !end) {
path[i] = strsep((char **) &list, ":");
if (path[i][0] == 0)
path[i] = 0;
end = (list == 0);
}
return path[i];
}
static const char *
getFullPath(int i, const char *file)
{
static char buf[PATH_MAX];
const char *path = getSearchPath(i);
if (path) {
SDL_snprintf(buf, PATH_MAX, "%s/%s", path, file);
}
return path ? buf : 0;
}
/* Given a file name, try to determine the full path for that file. Starts
* its search in the current directory, and then tries all paths in the
* search list in the order they are specified there.
*/
static const struct stat *
findFile(const char *file, const char **fullPath)
{
int i = 0;
static struct stat sbuf;
char *fileName;
debug("finding file %s", file);
*fullPath = file;
if (0 == stat(file, &sbuf))
return &sbuf;
if (SDL_strchr(file, '/'))
return 0; /* If the path had a / we don't look in env var places */
fileName = NULL;
if (!fileName)
fileName = (char *) file;
while ((*fullPath = getFullPath(i++, fileName))) {
if (0 == stat(*fullPath, &sbuf))
return &sbuf;
}
;
return 0;
}
/* Determine whether a given dlstatus is valid or not */
static int
isValidStatus(struct dlstatus *status)
{
/* Walk the list to verify status is contained in it */
struct dlstatus *dls = stqueue;
while (dls && status != dls)
dls = dls->next;
if (dls == 0)
error("invalid handle");
else if ((dls->module == 0) || (dls->refs == 0))
error("handle to closed library");
else
return TRUE;
return FALSE;
}
static inline int
isFlagSet(int mode, int flag)
{
return (mode & flag) == flag;
}
static struct dlstatus *
lookupStatus(const struct stat *sbuf)
{
struct dlstatus *dls = stqueue;
debug("looking for status");
while (dls && ( /* isFlagSet(dls->mode, RTLD_UNSHARED) */ 0
|| sbuf->st_dev != dls->device
|| sbuf->st_ino != dls->inode))
dls = dls->next;
return dls;
}
static void
insertStatus(struct dlstatus *dls, const struct stat *sbuf)
{
debug("inserting status");
dls->inode = sbuf->st_ino;
dls->device = sbuf->st_dev;
dls->refs = 0;
dls->mode = 0;
if ((dls->flags & DL_IN_LIST) == 0) {
dls->next = stqueue;
stqueue = dls;
dls->flags |= DL_IN_LIST;
}
}
static struct dlstatus *
allocStatus()
{
struct dlstatus *dls;
#ifdef REUSE_STATUS
dls = stqueue;
while (dls && dls->module)
dls = dls->next;
if (!dls)
#endif
dls = SDL_calloc(sizeof(*dls), 1);
return dls;
}
static int
promoteLocalToGlobal(struct dlstatus *dls)
{
static int (*p) (NSModule module) = 0;
debug("promoting");
if (!p)
_dyld_func_lookup("__dyld_NSMakePrivateModulePublic", (void **) &p);
return (dls->module == MAGIC_DYLIB_MOD) || (p && p(dls->module));
}
static void *
reference(struct dlstatus *dls, int mode)
{
if (dls) {
if (dls->module == MAGIC_DYLIB_MOD && isFlagSet(mode, RTLD_LOCAL)) {
warning("trying to open a .dylib with RTLD_LOCAL");
error("unable to open a .dylib with RTLD_LOCAL");
return NULL;
}
if (isFlagSet(mode, RTLD_GLOBAL) && !isFlagSet(dls->mode, RTLD_GLOBAL)
&& !promoteLocalToGlobal(dls)) {
error("unable to promote local module to global");
return NULL;
}
dls->mode |= mode;
dls->refs++;
} else
debug("reference called with NULL argument");
return dls;
}
static const struct mach_header *
my_find_image(const char *name)
{
const struct mach_header *mh = 0;
const char *id = NULL;
int i = _dyld_image_count();
int j;
mh = (struct mach_header *)
dyld_NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED |
NSADDIMAGE_OPTION_RETURN_ON_ERROR);
if (!mh) {
for (j = 0; j < i; j++) {
id = _dyld_get_image_name(j);
if (!SDL_strcmp(id, name)) {
mh = _dyld_get_image_header(j);
break;
}
}
}
return mh;
}
/*
* dyld adds libraries by first adding the directly dependant libraries in link order, and
* then adding the dependencies for those libraries, so we should do the same... but we don't
* bother adding the extra dependencies, if the symbols are neither in the loaded image nor
* any of it's direct dependencies, then it probably isn't there.
*/
static NSSymbol
search_linked_libs(const struct mach_header *mh, const char *symbol)
{
unsigned int n;
struct load_command *lc = 0;
struct mach_header *wh;
NSSymbol nssym = 0;
if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage
&& dyld_NSLookupSymbolInImage) {
lc = (struct load_command *) ((char *) mh +
sizeof(struct mach_header));
for (n = 0; n < mh->ncmds;
n++, lc = (struct load_command *) ((char *) lc + lc->cmdsize)) {
if ((LC_LOAD_DYLIB == lc->cmd)
|| (LC_LOAD_WEAK_DYLIB == lc->cmd)) {
if ((wh = (struct mach_header *)
my_find_image((char
*) (((struct dylib_command *) lc)->dylib.
name.offset + (char *) lc)))) {
if (dyld_NSIsSymbolNameDefinedInImage(wh, symbol)) {
nssym = dyld_NSLookupSymbolInImage(wh,
symbol,
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
|
NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
break;
}
}
}
}
if ((!nssym) && NSIsSymbolNameDefined(symbol)) {
/* I've never seen this debug message... */
debug("Symbol \"%s\" is defined but was not found", symbol);
}
}
return nssym;
}
/* Up to the caller to SDL_free() returned string */
static inline char *
dyld_error_str()
{
NSLinkEditErrors dylder;
int dylderno;
const char *dylderrstr;
const char *dyldfile;
char *retStr = NULL;
NSLinkEditError(&dylder, &dylderno, &dyldfile, &dylderrstr);
if (dylderrstr && *dylderrstr) {
retStr = SDL_strdup(dylderrstr);
}
return retStr;
}
static void *
dlsymIntern(struct dlstatus *dls, const char *symbol, int canSetError)
{
NSSymbol nssym = 0;
#ifdef __GCC__
void *caller = __builtin_return_address(1); /* Be *very* careful about inlining */
#else
void *caller = NULL;
#endif
const struct mach_header *caller_mh = 0;
char *savedErrorStr = NULL;
resetdlerror();
#ifndef RTLD_SELF
#define RTLD_SELF ((void *) -3)
#endif
if (NULL == dls)
dls = RTLD_SELF;
if ((RTLD_NEXT == dls) || (RTLD_SELF == dls)) {
if (dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage
&& caller) {
caller_mh = image_for_address(caller);
if (RTLD_SELF == dls) {
/* FIXME: We should be using the NSModule api, if SELF is an MH_BUNDLE
* But it appears to work anyway, and looking at the code in dyld_libfuncs.c
* this is acceptable.
*/
if (dyld_NSIsSymbolNameDefinedInImage(caller_mh, symbol)) {
nssym = dyld_NSLookupSymbolInImage(caller_mh,
symbol,
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
|
NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
}
}
if (!nssym) {
if (RTLD_SELF == dls)
savedErrorStr = dyld_error_str();
nssym = search_linked_libs(caller_mh, symbol);
}
} else {
if (canSetError)
error("RTLD_SELF and RTLD_NEXT are not supported");
return NULL;
}
}
if (!nssym) {
if (RTLD_DEFAULT == dls) {
dls = &mainStatus;
}
if (!isValidStatus(dls))
return NULL;
if (dls->module != MAGIC_DYLIB_MOD) {
nssym = NSLookupSymbolInModule(dls->module, symbol);
if (!nssym && NSIsSymbolNameDefined(symbol)) {
debug("Searching dependencies");
savedErrorStr = dyld_error_str();
nssym =
search_linked_libs(get_mach_header_from_NSModule
(dls->module), symbol);
}
} else if (dls->lib && dyld_NSIsSymbolNameDefinedInImage
&& dyld_NSLookupSymbolInImage) {
if (dyld_NSIsSymbolNameDefinedInImage(dls->lib, symbol)) {
nssym = dyld_NSLookupSymbolInImage(dls->lib,
symbol,
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
|
NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
} else if (NSIsSymbolNameDefined(symbol)) {
debug("Searching dependencies");
savedErrorStr = dyld_error_str();
nssym = search_linked_libs(dls->lib, symbol);
}
} else if (dls->module == MAGIC_DYLIB_MOD) {
/* Global context, use NSLookupAndBindSymbol */
if (NSIsSymbolNameDefined(symbol)) {
/* There doesn't seem to be a return on error option for this call???
this is potentially broken, if binding fails, it will improperly
exit the application. */
nssym = NSLookupAndBindSymbol(symbol);
} else {
if (savedErrorStr)
SDL_free(savedErrorStr);
savedErrorStr = SDL_malloc(256);
SDL_snprintf(savedErrorStr, 256,
"Symbol \"%s\" not in global context", symbol);
}
}
}
/* Error reporting */
if (!nssym) {
if (!savedErrorStr || !SDL_strlen(savedErrorStr)) {
if (savedErrorStr)
SDL_free(savedErrorStr);
savedErrorStr = SDL_malloc(256);
SDL_snprintf(savedErrorStr, 256, "Symbol \"%s\" not found",
symbol);
}
if (canSetError) {
error(savedErrorStr);
} else {
debug(savedErrorStr);
}
if (savedErrorStr)
SDL_free(savedErrorStr);
return NULL;
}
return NSAddressOfSymbol(nssym);
}
static struct dlstatus *
loadModule(const char *path, const struct stat *sbuf, int mode)
{
NSObjectFileImage ofi = 0;
NSObjectFileImageReturnCode ofirc;
struct dlstatus *dls;
NSLinkEditErrors ler;
int lerno;
const char *errstr;
const char *file;
void (*init) (void);
ofirc = NSCreateObjectFileImageFromFile(path, &ofi);
switch (ofirc) {
case NSObjectFileImageSuccess:
break;
case NSObjectFileImageInappropriateFile:
if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage
&& dyld_NSLookupSymbolInImage) {
if (isFlagSet(mode, RTLD_LOCAL)) {
warning("trying to open a .dylib with RTLD_LOCAL");
error("unable to open this file with RTLD_LOCAL");
return NULL;
}
} else {
error("opening this file is unsupported on this system");
return NULL;
}
break;
case NSObjectFileImageFailure:
error("object file setup failure");
return NULL;
case NSObjectFileImageArch:
error("no object for this architecture");
return NULL;
case NSObjectFileImageFormat:
error("bad object file format");
return NULL;
case NSObjectFileImageAccess:
error("can't read object file");
return NULL;
default:
error("unknown error from NSCreateObjectFileImageFromFile()");
return NULL;
}
dls = lookupStatus(sbuf);
if (!dls) {
dls = allocStatus();
}
if (!dls) {
error("unable to allocate memory");
return NULL;
}
// dls->lib = 0;
if (ofirc == NSObjectFileImageInappropriateFile) {
if ((dls->lib =
dyld_NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR))) {
debug("Dynamic lib loaded at %ld", dls->lib);
ofi = MAGIC_DYLIB_OFI;
dls->module = MAGIC_DYLIB_MOD;
ofirc = NSObjectFileImageSuccess;
/* Although it is possible with a bit of work to modify this so it works and
functions with RTLD_NOW, I don't deem it necessary at the moment */
}
if (!(dls->module)) {
NSLinkEditError(&ler, &lerno, &file, &errstr);
if (!errstr || (!SDL_strlen(errstr)))
error("Can't open this file type");
else
error(errstr);
if ((dls->flags & DL_IN_LIST) == 0) {
SDL_free(dls);
}
return NULL;
}
} else {
dls->module = NSLinkModule(ofi, path,
NSLINKMODULE_OPTION_RETURN_ON_ERROR |
NSLINKMODULE_OPTION_PRIVATE |
(isFlagSet(mode, RTLD_NOW) ?
NSLINKMODULE_OPTION_BINDNOW : 0));
NSDestroyObjectFileImage(ofi);
if (dls->module) {
dls->lib = get_mach_header_from_NSModule(dls->module);
}
}
if (!dls->module) {
NSLinkEditError(&ler, &lerno, &file, &errstr);
if ((dls->flags & DL_IN_LIST) == 0) {
SDL_free(dls);
}
error(errstr);
return NULL;
}
insertStatus(dls, sbuf);
dls = reference(dls, mode);
if ((init = dlsymIntern(dls, "__init", 0))) {
debug("calling _init()");
init();
}
return dls;
}
inline static void
dlcompat_init_check(void)
{
static pthread_mutex_t l = PTHREAD_MUTEX_INITIALIZER;
static int init_done = 0;
pthread_mutex_lock(&l);
if (!init_done) {
dlcompat_init_func();
init_done = 1;
}
pthread_mutex_unlock(&l);
}
static void
dlcompat_init_func(void)
{
_dyld_func_lookup("__dyld_NSAddImage", (void **) &dyld_NSAddImage);
_dyld_func_lookup("__dyld_NSIsSymbolNameDefinedInImage",
(void **) &dyld_NSIsSymbolNameDefinedInImage);
_dyld_func_lookup("__dyld_NSLookupSymbolInImage",
(void **) &dyld_NSLookupSymbolInImage);
if (pthread_mutex_init(&dlcompat_mutex, NULL))
exit(1);
if (pthread_key_create(&dlerror_key, &dlerrorfree))
exit(1);
}
static void
resetdlerror()
{
struct dlthread *tss;
tss = pthread_getspecific(dlerror_key);
tss->errset = 0;
}
static void
dlerrorfree(void *data)
{
SDL_free(data);
}
/* We kind of want a recursive lock here, but meet a little trouble
* because they are not available pre OS X 10.2, so we fake it
* using thread specific storage to keep a lock count
*/
static inline void
dolock(void)
{
int err = 0;
struct dlthread *tss;
dlcompat_init_check();
tss = pthread_getspecific(dlerror_key);
if (!tss) {
tss = SDL_malloc(sizeof(struct dlthread));
tss->lockcnt = 0;
tss->errset = 0;
if (pthread_setspecific(dlerror_key, tss)) {
fprintf(stderr, "dlcompat: pthread_setspecific failed\n");
exit(1);
}
}
if (!tss->lockcnt)
err = pthread_mutex_lock(&dlcompat_mutex);
tss->lockcnt = tss->lockcnt + 1;
if (err)
exit(err);
}
static inline void
dounlock(void)
{
int err = 0;
struct dlthread *tss;
tss = pthread_getspecific(dlerror_key);
tss->lockcnt = tss->lockcnt - 1;
if (!tss->lockcnt)
err = pthread_mutex_unlock(&dlcompat_mutex);
if (err)
exit(err);
}
static void *
SDL_OSX_dlopen(const char *path, int mode)
{
const struct stat *sbuf;
struct dlstatus *dls;
const char *fullPath;
dolock();
resetdlerror();
if (!path) {
dls = &mainStatus;
goto dlopenok;
}
if (!(sbuf = findFile(path, &fullPath))) {
error("file \"%s\" not found", path);
goto dlopenerror;
}
/* Now checks that it hasn't been closed already */
if ((dls = lookupStatus(sbuf)) && (dls->refs > 0)) {
/* debug("status found"); */
dls = reference(dls, mode);
goto dlopenok;
}
#ifdef RTLD_NOLOAD
if (isFlagSet(mode, RTLD_NOLOAD)) {
error("no existing handle and RTLD_NOLOAD specified");
goto dlopenerror;
}
#endif
if (isFlagSet(mode, RTLD_LAZY) && isFlagSet(mode, RTLD_NOW)) {
error("how can I load something both RTLD_LAZY and RTLD_NOW?");
goto dlopenerror;
}
dls = loadModule(fullPath, sbuf, mode);
dlopenok:
dounlock();
return (void *) dls;
dlopenerror:
dounlock();
return NULL;
}
#if !FINK_BUILD
static void *
SDL_OSX_dlsym(void *dl_restrict handle, const char *dl_restrict symbol)
{
int sym_len = SDL_strlen(symbol);
void *value = NULL;
char *malloc_sym = NULL;
dolock();
malloc_sym = SDL_malloc(sym_len + 2);
if (malloc_sym) {
SDL_snprintf(malloc_sym, sym_len + 2, "_%s", symbol);
value = dlsymIntern(handle, malloc_sym, 1);
SDL_free(malloc_sym);
} else {
error("Unable to allocate memory");
goto dlsymerror;
}
dounlock();
return value;
dlsymerror:
dounlock();
return NULL;
}
#endif
#if FINK_BUILD
static void *
dlsym_prepend_underscore(void *handle, const char *symbol)
{
void *answer;
dolock();
answer = dlsym_prepend_underscore_intern(handle, symbol);
dounlock();
return answer;
}
static void *
dlsym_prepend_underscore_intern(void *handle, const char *symbol)
{
/*
* A quick and easy way for porting packages which call dlsym(handle,"sym")
* If the porter adds -Ddlsym=dlsym_prepend_underscore to the CFLAGS then
* this function will be called, and will add the required underscore.
*
* Note that I haven't figured out yet which should be "standard", prepend
* the underscore always, or not at all. These global functions need to go away
* for opendarwin.
*/
int sym_len = SDL_strlen(symbol);
void *value = NULL;
char *malloc_sym = NULL;
malloc_sym = SDL_malloc(sym_len + 2);
if (malloc_sym) {
SDL_snprintf(malloc_sym, sym_len + 2, "_%s", symbol);
value = dlsymIntern(handle, malloc_sym, 1);
SDL_free(malloc_sym);
} else {
error("Unable to allocate memory");
}
return value;
}
static void *
dlsym_auto_underscore(void *handle, const char *symbol)
{
void *answer;
dolock();
answer = dlsym_auto_underscore_intern(handle, symbol);
dounlock();
return answer;
}
static void *
dlsym_auto_underscore_intern(void *handle, const char *symbol)
{
struct dlstatus *dls = handle;
void *addr = 0;
addr = dlsymIntern(dls, symbol, 0);
if (!addr)
addr = dlsym_prepend_underscore_intern(handle, symbol);
return addr;
}
static void *
SDL_OSX_dlsym(void *dl_restrict handle, const char *dl_restrict symbol)
{
struct dlstatus *dls = handle;
void *addr = 0;
dolock();
addr = dlsymIntern(dls, symbol, 1);
dounlock();
return addr;
}
#endif
static int
SDL_OSX_dlclose(void *handle)
{
struct dlstatus *dls = handle;
dolock();
resetdlerror();
if (!isValidStatus(dls)) {
goto dlcloseerror;
}
if (dls->module == MAGIC_DYLIB_MOD) {
const char *name;
if (!dls->lib) {
name = "global context";
} else {
name = get_lib_name(dls->lib);
}
warning("trying to close a .dylib!");
error("Not closing \"%s\" - dynamic libraries cannot be closed",
name);
goto dlcloseerror;
}
if (!dls->module) {
error("module already closed");
goto dlcloseerror;
}
if (dls->refs == 1) {
unsigned long options = 0;
void (*fini) (void);
if ((fini = dlsymIntern(dls, "__fini", 0))) {
debug("calling _fini()");
fini();
}
options |= NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES;
#ifdef RTLD_NODELETE
if (isFlagSet(dls->mode, RTLD_NODELETE))
options |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
#endif
if (!NSUnLinkModule(dls->module, options)) {
error("unable to unlink module");
goto dlcloseerror;
}
dls->refs--;
dls->module = 0;
/* Note: the dlstatus struct dls is neither removed from the list
* nor is the memory it occupies freed. This shouldn't pose a
* problem in mostly all cases, though.
*/
}
dounlock();
return 0;
dlcloseerror:
dounlock();
return 1;
}
static const char *
SDL_OSX_dlerror(void)
{
struct dlthread *tss;
const char *err_str = NULL;
dlcompat_init_check();
tss = pthread_getspecific(dlerror_key);
if (tss != NULL && tss->errset != 0) {
tss->errset = 0;
err_str = tss->errstr;
}
return (err_str);
}
/* Given an address, return the mach_header for the image containing it
* or zero if the given address is not contained in any loaded images.
*/
static const struct mach_header *
image_for_address(const void *address)
{
unsigned long i;
unsigned long j;
unsigned long count = _dyld_image_count();
const struct mach_header *mh = 0;
struct load_command *lc = 0;
unsigned long addr = 0;
for (i = 0; i < count; i++) {
addr = (unsigned long) address - _dyld_get_image_vmaddr_slide(i);
mh = _dyld_get_image_header(i);
if (mh) {
lc = (struct load_command *) ((char *) mh +
sizeof(struct mach_header));
for (j = 0; j < mh->ncmds;
j++, lc =
(struct load_command *) ((char *) lc + lc->cmdsize)) {
if (LC_SEGMENT == lc->cmd &&
addr >= ((struct segment_command *) lc)->vmaddr &&
addr <
((struct segment_command *) lc)->vmaddr +
((struct segment_command *) lc)->vmsize) {
goto image_found;
}
}
}
mh = 0;
}
image_found:
return mh;
}
#if 0 /* unused */
static int
SDL_OSX_dladdr(const void *dl_restrict p, SDL_OSX_Dl_info * dl_restrict info)
{
/*
FIXME: USe the routine image_for_address.
*/
unsigned long i;
unsigned long j;
unsigned long count = _dyld_image_count();
struct mach_header *mh = 0;
struct load_command *lc = 0;
unsigned long addr = NULL;
unsigned long table_off = (unsigned long) 0;
int found = 0;
if (!info)
return 0;
dolock();
resetdlerror();
info->dli_fname = 0;
info->dli_fbase = 0;
info->dli_sname = 0;
info->dli_saddr = 0;
/* Some of this was swiped from code posted by Douglas Davidson <ddavidso AT apple DOT com>
* to darwin-development AT lists DOT apple DOT com and slightly modified
*/
for (i = 0; i < count; i++) {
addr = (unsigned long) p - _dyld_get_image_vmaddr_slide(i);
mh = _dyld_get_image_header(i);
if (mh) {
lc = (struct load_command *) ((char *) mh +
sizeof(struct mach_header));
for (j = 0; j < mh->ncmds;
j++, lc =
(struct load_command *) ((char *) lc + lc->cmdsize)) {
if (LC_SEGMENT == lc->cmd &&
addr >= ((struct segment_command *) lc)->vmaddr &&
addr <
((struct segment_command *) lc)->vmaddr +
((struct segment_command *) lc)->vmsize) {
info->dli_fname = _dyld_get_image_name(i);
info->dli_fbase = (void *) mh;
found = 1;
break;
}
}
if (found)
break;
}
}
if (!found) {
dounlock();
return 0;
}
lc = (struct load_command *) ((char *) mh + sizeof(struct mach_header));
for (j = 0; j < mh->ncmds;
j++, lc = (struct load_command *) ((char *) lc + lc->cmdsize)) {
if (LC_SEGMENT == lc->cmd) {
if (!SDL_strcmp
(((struct segment_command *) lc)->segname, "__LINKEDIT"))
break;
}
}
table_off =
((unsigned long) ((struct segment_command *) lc)->vmaddr) -
((unsigned long) ((struct segment_command *) lc)->fileoff) +
_dyld_get_image_vmaddr_slide(i);
debug("table off %x", table_off);
lc = (struct load_command *) ((char *) mh + sizeof(struct mach_header));
for (j = 0; j < mh->ncmds;
j++, lc = (struct load_command *) ((char *) lc + lc->cmdsize)) {
if (LC_SYMTAB == lc->cmd) {
struct nlist *symtable =
(struct nlist *) (((struct symtab_command *) lc)->symoff +
table_off);
unsigned long numsyms = ((struct symtab_command *) lc)->nsyms;
struct nlist *nearest = NULL;
unsigned long diff = 0xffffffff;
unsigned long strtable =
(unsigned long) (((struct symtab_command *) lc)->stroff +
table_off);
debug("symtable %x", symtable);
for (i = 0; i < numsyms; i++) {
/* Ignore the following kinds of Symbols */
if ((!symtable->n_value) /* Undefined */
||(symtable->n_type >= N_PEXT) /* Debug symbol */
||(!(symtable->n_type & N_EXT)) /* Local Symbol */
) {
symtable++;
continue;
}
if ((addr >= symtable->n_value)
&& (diff >= (symtable->n_value - addr))) {
diff = (unsigned long) symtable->n_value - addr;
nearest = symtable;
}
symtable++;
}
if (nearest) {
info->dli_saddr = nearest->n_value + ((void *) p - addr);
info->dli_sname = (char *) (strtable + nearest->n_un.n_strx);
}
}
}
dounlock();
return 1;
}
#endif
/*
* Implement the dlfunc() interface, which behaves exactly the same as
* dlsym() except that it returns a function pointer instead of a data
* pointer. This can be used by applications to avoid compiler warnings
* about undefined behavior, and is intended as prior art for future
* POSIX standardization. This function requires that all pointer types
* have the same representation, which is true on all platforms FreeBSD
* runs on, but is not guaranteed by the C standard.
*/
#if 0
static dlfunc_t
SDL_OSX_dlfunc(void *dl_restrict handle, const char *dl_restrict symbol)
{
union
{
void *d;
dlfunc_t f;
} rv;
int sym_len = SDL_strlen(symbol);
char *malloc_sym = NULL;
dolock();
malloc_sym = SDL_malloc(sym_len + 2);
if (malloc_sym) {
SDL_snprintf(malloc_sym, sym_len + 2, "_%s", symbol);
rv.d = dlsymIntern(handle, malloc_sym, 1);
SDL_free(malloc_sym);
} else {
error("Unable to allocate memory");
goto dlfuncerror;
}
dounlock();
return rv.f;
dlfuncerror:
dounlock();
return NULL;
}
#endif
/* dlcompat ends, here's the SDL interface... --ryan. */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent library loading routines */
#include "SDL_loadso.h"
void *
SDL_LoadObject(const char *sofile)
{
void *handle = SDL_OSX_dlopen(sofile, RTLD_NOW);
const char *loaderror = SDL_OSX_dlerror();
if (handle == NULL) {
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
}
return (handle);
}
void *
SDL_LoadFunction(void *handle, const char *name)
{
void *symbol = SDL_OSX_dlsym(handle, name);
if (symbol == NULL) {
SDL_SetError("Failed loading %s: %s", name, SDL_OSX_dlerror());
}
return (symbol);
}
void
SDL_UnloadObject(void *handle)
{
if (handle != NULL) {
SDL_OSX_dlclose(handle);
}
}
#endif /* SDL_LOADSO_DLCOMPAT */
/* vi: set ts=4 sw=4 expandtab: */
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65. # Generated by GNU Autoconf 2.67.
# #
# #
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
# Inc. # Foundation, Inc.
# #
# #
# This configure script is free software; the Free Software Foundation # This configure script is free software; the Free Software Foundation
...@@ -315,7 +315,7 @@ $as_echo X"$as_dir" | ...@@ -315,7 +315,7 @@ $as_echo X"$as_dir" |
test -d "$as_dir" && break test -d "$as_dir" && break
done done
test -z "$as_dirs" || eval "mkdir $as_dirs" test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p } # as_fn_mkdir_p
...@@ -355,19 +355,19 @@ else ...@@ -355,19 +355,19 @@ else
fi # as_fn_arith fi # as_fn_arith
# as_fn_error ERROR [LINENO LOG_FD] # as_fn_error STATUS ERROR [LINENO LOG_FD]
# --------------------------------- # ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with status $?, using 1 if that was 0. # script with STATUS, using 1 if that was 0.
as_fn_error () as_fn_error ()
{ {
as_status=$?; test $as_status -eq 0 && as_status=1 as_status=$1; test $as_status -eq 0 && as_status=1
if test "$3"; then if test "$4"; then
as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi fi
$as_echo "$as_me: error: $1" >&2 $as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status as_fn_exit $as_status
} # as_fn_error } # as_fn_error
...@@ -529,7 +529,7 @@ test -n "$DJDIR" || exec 7<&0 </dev/null ...@@ -529,7 +529,7 @@ test -n "$DJDIR" || exec 7<&0 </dev/null
exec 6>&1 exec 6>&1
# Name of the host. # Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too. # so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
...@@ -699,7 +699,8 @@ do ...@@ -699,7 +699,8 @@ do
fi fi
case $ac_option in case $ac_option in
*=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*=) ac_optarg= ;;
*) ac_optarg=yes ;; *) ac_optarg=yes ;;
esac esac
...@@ -745,7 +746,7 @@ do ...@@ -745,7 +746,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names. # Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error "invalid feature name: $ac_useropt" as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in case $ac_user_opts in
...@@ -771,7 +772,7 @@ do ...@@ -771,7 +772,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names. # Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error "invalid feature name: $ac_useropt" as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in case $ac_user_opts in
...@@ -975,7 +976,7 @@ do ...@@ -975,7 +976,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names. # Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error "invalid package name: $ac_useropt" as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in case $ac_user_opts in
...@@ -991,7 +992,7 @@ do ...@@ -991,7 +992,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names. # Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error "invalid package name: $ac_useropt" as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in case $ac_user_opts in
...@@ -1021,8 +1022,8 @@ do ...@@ -1021,8 +1022,8 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;; x_libraries=$ac_optarg ;;
-*) as_fn_error "unrecognized option: \`$ac_option' -*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information." Try \`$0 --help' for more information"
;; ;;
*=*) *=*)
...@@ -1030,7 +1031,7 @@ Try \`$0 --help' for more information." ...@@ -1030,7 +1031,7 @@ Try \`$0 --help' for more information."
# Reject names that are not valid shell variable names. # Reject names that are not valid shell variable names.
case $ac_envvar in #( case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* ) '' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error "invalid variable name: \`$ac_envvar'" ;; as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac esac
eval $ac_envvar=\$ac_optarg eval $ac_envvar=\$ac_optarg
export $ac_envvar ;; export $ac_envvar ;;
...@@ -1048,13 +1049,13 @@ done ...@@ -1048,13 +1049,13 @@ done
if test -n "$ac_prev"; then if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'` ac_option=--`echo $ac_prev | sed 's/_/-/g'`
as_fn_error "missing argument to $ac_option" as_fn_error $? "missing argument to $ac_option"
fi fi
if test -n "$ac_unrecognized_opts"; then if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in case $enable_option_checking in
no) ;; no) ;;
fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac esac
fi fi
...@@ -1077,7 +1078,7 @@ do ...@@ -1077,7 +1078,7 @@ do
[\\/$]* | ?:[\\/]* ) continue;; [\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac esac
as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done done
# There might be people who depend on the old broken behavior: `$host' # There might be people who depend on the old broken behavior: `$host'
...@@ -1091,8 +1092,8 @@ target=$target_alias ...@@ -1091,8 +1092,8 @@ target=$target_alias
if test "x$host_alias" != x; then if test "x$host_alias" != x; then
if test "x$build_alias" = x; then if test "x$build_alias" = x; then
cross_compiling=maybe cross_compiling=maybe
$as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used." >&2 If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes cross_compiling=yes
fi fi
...@@ -1107,9 +1108,9 @@ test "$silent" = yes && exec 6>/dev/null ...@@ -1107,9 +1108,9 @@ test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" && ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` && ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
as_fn_error "working directory cannot be determined" as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" || test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
as_fn_error "pwd does not report name of working directory" as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified. # Find the source files, if location was not specified.
...@@ -1148,11 +1149,11 @@ else ...@@ -1148,11 +1149,11 @@ else
fi fi
if test ! -r "$srcdir/$ac_unique_file"; then if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`( ac_abs_confdir=`(
cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)` pwd)`
# When building in place, set srcdir=. # When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then if test "$ac_abs_confdir" = "$ac_pwd"; then
...@@ -1192,7 +1193,7 @@ Configuration: ...@@ -1192,7 +1193,7 @@ Configuration:
--help=short display options specific to this package --help=short display options specific to this package
--help=recursive display the short help of all the included packages --help=recursive display the short help of all the included packages
-V, --version display version information and exit -V, --version display version information and exit
-q, --quiet, --silent do not print \`checking...' messages -q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled] --cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache' -C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files -n, --no-create do not create output files
...@@ -1340,9 +1341,9 @@ test -n "$ac_init_help" && exit $ac_status ...@@ -1340,9 +1341,9 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
configure configure
generated by GNU Autoconf 2.65 generated by GNU Autoconf 2.67
Copyright (C) 2009 Free Software Foundation, Inc. Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it. gives unlimited permission to copy, distribute and modify it.
_ACEOF _ACEOF
...@@ -1500,7 +1501,7 @@ $as_echo "$ac_try_echo"; } >&5 ...@@ -1500,7 +1501,7 @@ $as_echo "$ac_try_echo"; } >&5
mv -f conftest.er1 conftest.err mv -f conftest.er1 conftest.err
fi fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } >/dev/null && { test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err test ! -s conftest.err
}; then : }; then :
...@@ -1520,7 +1521,7 @@ This file contains any messages produced by compilers while ...@@ -1520,7 +1521,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was It was created by $as_me, which was
generated by GNU Autoconf 2.65. Invocation command line was generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@ $ $0 $@
...@@ -1630,11 +1631,9 @@ trap 'exit_status=$? ...@@ -1630,11 +1631,9 @@ trap 'exit_status=$?
{ {
echo echo
cat <<\_ASBOX $as_echo "## ---------------- ##
## ---------------- ##
## Cache variables. ## ## Cache variables. ##
## ---------------- ## ## ---------------- ##"
_ASBOX
echo echo
# The following way of writing the cache mishandles newlines in values, # The following way of writing the cache mishandles newlines in values,
( (
...@@ -1668,11 +1667,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ...@@ -1668,11 +1667,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
) )
echo echo
cat <<\_ASBOX $as_echo "## ----------------- ##
## ----------------- ##
## Output variables. ## ## Output variables. ##
## ----------------- ## ## ----------------- ##"
_ASBOX
echo echo
for ac_var in $ac_subst_vars for ac_var in $ac_subst_vars
do do
...@@ -1685,11 +1682,9 @@ _ASBOX ...@@ -1685,11 +1682,9 @@ _ASBOX
echo echo
if test -n "$ac_subst_files"; then if test -n "$ac_subst_files"; then
cat <<\_ASBOX $as_echo "## ------------------- ##
## ------------------- ##
## File substitutions. ## ## File substitutions. ##
## ------------------- ## ## ------------------- ##"
_ASBOX
echo echo
for ac_var in $ac_subst_files for ac_var in $ac_subst_files
do do
...@@ -1703,11 +1698,9 @@ _ASBOX ...@@ -1703,11 +1698,9 @@ _ASBOX
fi fi
if test -s confdefs.h; then if test -s confdefs.h; then
cat <<\_ASBOX $as_echo "## ----------- ##
## ----------- ##
## confdefs.h. ## ## confdefs.h. ##
## ----------- ## ## ----------- ##"
_ASBOX
echo echo
cat confdefs.h cat confdefs.h
echo echo
...@@ -1762,7 +1755,12 @@ _ACEOF ...@@ -1762,7 +1755,12 @@ _ACEOF
ac_site_file1=NONE ac_site_file1=NONE
ac_site_file2=NONE ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then if test -n "$CONFIG_SITE"; then
ac_site_file1=$CONFIG_SITE # We do not want a PATH search for config.site.
case $CONFIG_SITE in #((
-*) ac_site_file1=./$CONFIG_SITE;;
*/*) ac_site_file1=$CONFIG_SITE;;
*) ac_site_file1=./$CONFIG_SITE;;
esac
elif test "x$prefix" != xNONE; then elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site ac_site_file2=$prefix/etc/config.site
...@@ -1777,7 +1775,11 @@ do ...@@ -1777,7 +1775,11 @@ do
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;} $as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5 sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file" . "$ac_site_file" \
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
See \`config.log' for more details" "$LINENO" 5 ; }
fi fi
done done
...@@ -1853,7 +1855,7 @@ if $ac_cache_corrupted; then ...@@ -1853,7 +1855,7 @@ if $ac_cache_corrupted; then
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi fi
## -------------------- ## ## -------------------- ##
## Main body of script. ## ## Main body of script. ##
...@@ -1869,16 +1871,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ...@@ -1869,16 +1871,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir= ac_aux_dir=
for ac_dir in $srcdir/../build-scripts; do for ac_dir in $srcdir/../build-scripts; do
for ac_t in install-sh install.sh shtool; do if test -f "$ac_dir/install-sh"; then
if test -f "$ac_dir/$ac_t"; then
ac_aux_dir=$ac_dir ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/$ac_t -c" ac_install_sh="$ac_aux_dir/install-sh -c"
break 2 break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi fi
done
done done
if test -z "$ac_aux_dir"; then if test -z "$ac_aux_dir"; then
as_fn_error "cannot find install-sh, install.sh, or shtool in $srcdir/../build-scripts" "$LINENO" 5 as_fn_error $? "cannot find install-sh, install.sh, or shtool in $srcdir/../build-scripts" "$LINENO" 5
fi fi
# These three variables are undocumented and unsupported, # These three variables are undocumented and unsupported,
...@@ -1892,7 +1900,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ...@@ -1892,7 +1900,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub. # Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; } $as_echo_n "checking build system type... " >&6; }
...@@ -1903,16 +1911,16 @@ else ...@@ -1903,16 +1911,16 @@ else
test "x$ac_build_alias" = x && test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x && test "x$ac_build_alias" = x &&
as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; } $as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in case $ac_cv_build in
*-*-*) ;; *-*-*) ;;
*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
esac esac
build=$ac_cv_build build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-' ac_save_IFS=$IFS; IFS='-'
...@@ -1937,7 +1945,7 @@ else ...@@ -1937,7 +1945,7 @@ else
ac_cv_host=$ac_cv_build ac_cv_host=$ac_cv_build
else else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi fi
fi fi
...@@ -1945,7 +1953,7 @@ fi ...@@ -1945,7 +1953,7 @@ fi
$as_echo "$ac_cv_host" >&6; } $as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in case $ac_cv_host in
*-*-*) ;; *-*-*) ;;
*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
esac esac
host=$ac_cv_host host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-' ac_save_IFS=$IFS; IFS='-'
...@@ -2263,8 +2271,8 @@ fi ...@@ -2263,8 +2271,8 @@ fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "no acceptable C compiler found in \$PATH as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details." "$LINENO" 5; } See \`config.log' for more details" "$LINENO" 5 ; }
# Provide some information about the compiler. # Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
...@@ -2378,9 +2386,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ...@@ -2378,9 +2386,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ as_fn_set_status 77 as_fn_error 77 "C compiler cannot create executables
as_fn_error "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5 ; }
See \`config.log' for more details." "$LINENO" 5; }; }
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
...@@ -2422,8 +2429,8 @@ done ...@@ -2422,8 +2429,8 @@ done
else else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "cannot compute suffix of executables: cannot compile and link as_fn_error $? "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." "$LINENO" 5; } See \`config.log' for more details" "$LINENO" 5 ; }
fi fi
rm -f conftest conftest$ac_cv_exeext rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
...@@ -2480,9 +2487,9 @@ $as_echo "$ac_try_echo"; } >&5 ...@@ -2480,9 +2487,9 @@ $as_echo "$ac_try_echo"; } >&5
else else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "cannot run C compiled programs. as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'. If you meant to cross compile, use \`--host'.
See \`config.log' for more details." "$LINENO" 5; } See \`config.log' for more details" "$LINENO" 5 ; }
fi fi
fi fi
fi fi
...@@ -2533,8 +2540,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ...@@ -2533,8 +2540,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "cannot compute suffix of object files: cannot compile as_fn_error $? "cannot compute suffix of object files: cannot compile
See \`config.log' for more details." "$LINENO" 5; } See \`config.log' for more details" "$LINENO" 5 ; }
fi fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi fi
...@@ -3176,7 +3183,7 @@ rm -f core conftest.err conftest.$ac_objext \ ...@@ -3176,7 +3183,7 @@ rm -f core conftest.err conftest.$ac_objext \
fi fi
SDL_CFLAGS="" SDL_CFLAGS=""
SDL_LIBS="" SDL_LIBS=""
as_fn_error "*** SDL version $SDL_VERSION not found!" "$LINENO" 5 as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5
fi fi
...@@ -3228,7 +3235,7 @@ else ...@@ -3228,7 +3235,7 @@ else
# Broken: fails on valid input. # Broken: fails on valid input.
continue continue
fi fi
rm -f conftest.err conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers # OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how. # can be detected and how.
...@@ -3244,11 +3251,11 @@ else ...@@ -3244,11 +3251,11 @@ else
ac_preproc_ok=: ac_preproc_ok=:
break break
fi fi
rm -f conftest.err conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
done done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then : if $ac_preproc_ok; then :
break break
fi fi
...@@ -3287,7 +3294,7 @@ else ...@@ -3287,7 +3294,7 @@ else
# Broken: fails on valid input. # Broken: fails on valid input.
continue continue
fi fi
rm -f conftest.err conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers # OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how. # can be detected and how.
...@@ -3303,18 +3310,18 @@ else ...@@ -3303,18 +3310,18 @@ else
ac_preproc_ok=: ac_preproc_ok=:
break break
fi fi
rm -f conftest.err conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
done done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then : if $ac_preproc_ok; then :
else else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "C preprocessor \"$CPP\" fails sanity check as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." "$LINENO" 5; } See \`config.log' for more details" "$LINENO" 5 ; }
fi fi
ac_ext=c ac_ext=c
...@@ -3339,7 +3346,7 @@ if test "x$with_x" = xno; then ...@@ -3339,7 +3346,7 @@ if test "x$with_x" = xno; then
have_x=disabled have_x=disabled
else else
case $x_includes,$x_libraries in #( case $x_includes,$x_libraries in #(
*\'*) as_fn_error "cannot use X directory names containing '" "$LINENO" 5;; #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #(
*,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then : *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
...@@ -3357,7 +3364,7 @@ libdir: ...@@ -3357,7 +3364,7 @@ libdir:
@echo libdir='${LIBDIR}' @echo libdir='${LIBDIR}'
_ACEOF _ACEOF
if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
# GNU make sometimes prints "make[1]: Entering...", which would confuse us. # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
for ac_var in incroot usrlibdir libdir; do for ac_var in incroot usrlibdir libdir; do
eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
done done
...@@ -3443,7 +3450,7 @@ else ...@@ -3443,7 +3450,7 @@ else
fi fi
done done
fi fi
rm -f conftest.err conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
fi # $ac_x_includes = no fi # $ac_x_includes = no
if test "$ac_x_libraries" = no; then if test "$ac_x_libraries" = no; then
...@@ -3754,6 +3761,7 @@ DEFS=`sed -n "$ac_script" confdefs.h` ...@@ -3754,6 +3761,7 @@ DEFS=`sed -n "$ac_script" confdefs.h`
ac_libobjs= ac_libobjs=
ac_ltlibobjs= ac_ltlibobjs=
U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed. # 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
...@@ -3915,19 +3923,19 @@ export LANGUAGE ...@@ -3915,19 +3923,19 @@ export LANGUAGE
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# as_fn_error ERROR [LINENO LOG_FD] # as_fn_error STATUS ERROR [LINENO LOG_FD]
# --------------------------------- # ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with status $?, using 1 if that was 0. # script with STATUS, using 1 if that was 0.
as_fn_error () as_fn_error ()
{ {
as_status=$?; test $as_status -eq 0 && as_status=1 as_status=$1; test $as_status -eq 0 && as_status=1
if test "$3"; then if test "$4"; then
as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi fi
$as_echo "$as_me: error: $1" >&2 $as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status as_fn_exit $as_status
} # as_fn_error } # as_fn_error
...@@ -4123,7 +4131,7 @@ $as_echo X"$as_dir" | ...@@ -4123,7 +4131,7 @@ $as_echo X"$as_dir" |
test -d "$as_dir" && break test -d "$as_dir" && break
done done
test -z "$as_dirs" || eval "mkdir $as_dirs" test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p } # as_fn_mkdir_p
...@@ -4177,7 +4185,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ...@@ -4177,7 +4185,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by $as_me, which was This file was extended by $as_me, which was
generated by GNU Autoconf 2.65. Invocation command line was generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_HEADERS = $CONFIG_HEADERS
...@@ -4230,10 +4238,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ...@@ -4230,10 +4238,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
config.status config.status
configured by $0, generated by GNU Autoconf 2.65, configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"
Copyright (C) 2009 Free Software Foundation, Inc. Copyright (C) 2010 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it." gives unlimited permission to copy, distribute and modify it."
...@@ -4248,11 +4256,16 @@ ac_need_defaults=: ...@@ -4248,11 +4256,16 @@ ac_need_defaults=:
while test $# != 0 while test $# != 0
do do
case $1 in case $1 in
--*=*) --*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=: ac_shift=:
;; ;;
--*=)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=
ac_shift=:
;;
*) *)
ac_option=$1 ac_option=$1
ac_optarg=$2 ac_optarg=$2
...@@ -4274,6 +4287,7 @@ do ...@@ -4274,6 +4287,7 @@ do
$ac_shift $ac_shift
case $ac_optarg in case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
'') as_fn_error $? "missing file argument" ;;
esac esac
as_fn_append CONFIG_FILES " '$ac_optarg'" as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;; ac_need_defaults=false;;
...@@ -4284,7 +4298,7 @@ do ...@@ -4284,7 +4298,7 @@ do
ac_cs_silent=: ;; ac_cs_silent=: ;;
# This is an error. # This is an error.
-*) as_fn_error "unrecognized option: \`$1' -*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;; Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1" *) as_fn_append ac_config_targets " $1"
...@@ -4335,7 +4349,7 @@ do ...@@ -4335,7 +4349,7 @@ do
case $ac_config_target in case $ac_config_target in
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
esac esac
done done
...@@ -4371,7 +4385,7 @@ $debug || ...@@ -4371,7 +4385,7 @@ $debug ||
{ {
tmp=./conf$$-$RANDOM tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp") (umask 077 && mkdir "$tmp")
} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
# Set up the scripts for CONFIG_FILES section. # Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES. # No need to generate them if there are no CONFIG_FILES.
...@@ -4388,7 +4402,7 @@ if test "x$ac_cr" = x; then ...@@ -4388,7 +4402,7 @@ if test "x$ac_cr" = x; then
fi fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\r' ac_cs_awk_cr='\\r'
else else
ac_cs_awk_cr=$ac_cr ac_cs_awk_cr=$ac_cr
fi fi
...@@ -4402,18 +4416,18 @@ _ACEOF ...@@ -4402,18 +4416,18 @@ _ACEOF
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF" echo "_ACEOF"
} >conf$$subs.sh || } >conf$$subs.sh ||
as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# ' ac_delim='%!_!# '
for ac_last_try in false false false false false :; do for ac_last_try in false false false false false :; do
. ./conf$$subs.sh || . ./conf$$subs.sh ||
as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then if test $ac_delim_n = $ac_delim_num; then
break break
elif $ac_last_try; then elif $ac_last_try; then
as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! " ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi fi
...@@ -4502,20 +4516,28 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then ...@@ -4502,20 +4516,28 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
else else
cat cat
fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
|| as_fn_error "could not setup config files machinery" "$LINENO" 5 || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF _ACEOF
# VPATH may cause trouble with some makes, so we remove $(srcdir), # VPATH may cause trouble with some makes, so we remove sole $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty # trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers). # (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=/{ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
s/:*\$(srcdir):*/:/ h
s/:*\${srcdir}:*/:/ s///
s/:*@srcdir@:*/:/ s/^/:/
s/^\([^=]*=[ ]*\):*/\1/ s/[ ]*$/:/
s/:\$(srcdir):/:/g
s/:\${srcdir}:/:/g
s/:@srcdir@:/:/g
s/^:*//
s/:*$// s/:*$//
x
s/\(=[ ]*\).*/\1/
G
s/\n//
s/^[^=]*=[ ]*$// s/^[^=]*=[ ]*$//
}' }'
fi fi
...@@ -4533,7 +4555,7 @@ do ...@@ -4533,7 +4555,7 @@ do
esac esac
case $ac_mode$ac_tag in case $ac_mode$ac_tag in
:[FHL]*:*);; :[FHL]*:*);;
:L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
:[FH]-) ac_tag=-:-;; :[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac esac
...@@ -4561,7 +4583,7 @@ do ...@@ -4561,7 +4583,7 @@ do
[\\/$]*) false;; [\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac || esac ||
as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
esac esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'" as_fn_append ac_file_inputs " '$ac_f'"
...@@ -4588,7 +4610,7 @@ $as_echo "$as_me: creating $ac_file" >&6;} ...@@ -4588,7 +4610,7 @@ $as_echo "$as_me: creating $ac_file" >&6;}
case $ac_tag in case $ac_tag in
*:-:* | *:-) cat >"$tmp/stdin" \ *:-:* | *:-) cat >"$tmp/stdin" \
|| as_fn_error "could not create $ac_file" "$LINENO" 5 ;; || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac esac
;; ;;
esac esac
...@@ -4714,22 +4736,22 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t ...@@ -4714,22 +4736,22 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
$ac_datarootdir_hack $ac_datarootdir_hack
" "
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
|| as_fn_error "could not create $ac_file" "$LINENO" 5 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined." >&5 which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined." >&2;} which seems to be undefined. Please make sure it is defined" >&2;}
rm -f "$tmp/stdin" rm -f "$tmp/stdin"
case $ac_file in case $ac_file in
-) cat "$tmp/out" && rm -f "$tmp/out";; -) cat "$tmp/out" && rm -f "$tmp/out";;
*) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
esac \ esac \
|| as_fn_error "could not create $ac_file" "$LINENO" 5 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
;; ;;
...@@ -4744,7 +4766,7 @@ _ACEOF ...@@ -4744,7 +4766,7 @@ _ACEOF
ac_clean_files=$ac_clean_files_save ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 || test $ac_write_fail = 0 ||
as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status. # configure is writing to config.log, and then calls config.status.
...@@ -4765,7 +4787,7 @@ if test "$no_create" != yes; then ...@@ -4765,7 +4787,7 @@ if test "$no_create" != yes; then
exec 5>>config.log exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which # Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction. # would make configure fail if this is the last instruction.
$ac_cs_success || as_fn_exit $? $ac_cs_success || as_fn_exit 1
fi fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment