mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-23 22:33:28 +00:00
Tidied up changes to search for xxx.dll before libxxx.dll.a in which_lib
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@21862 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d8b6b57a04
commit
5ade593d4e
2 changed files with 37 additions and 49 deletions
|
@ -1,4 +1,10 @@
|
|||
2005-10-24 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
2005-10-23 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* which_lib.c (search_for_lib_with_suffix_and_ext): Enhanced
|
||||
changes to make the code simpler and easier to understand and
|
||||
avoid duplicate checks for static libs. Needs testing.
|
||||
|
||||
2005-10-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* which_lib.c: Tidied a little on lines suggested by David Ayers
|
||||
* configure.ac: Check for ctype.h
|
||||
|
|
78
which_lib.c
78
which_lib.c
|
@ -284,22 +284,36 @@ static int search_for_lib_with_suffix_and_ext (const char *library_name,
|
|||
char full_filename[PATH_MAX + 1];
|
||||
struct stat statbuf;
|
||||
|
||||
strcpy (full_filename, library_paths[i]);
|
||||
#ifdef __MINGW32__
|
||||
/* Mingw can link against dlls directly, so we should look for
|
||||
* library_name.dll then liblibrary_name.dll.a then liblibrary_name.a
|
||||
*/
|
||||
strcat (full_filename, "/");
|
||||
#else
|
||||
strcat (full_filename, "/lib");
|
||||
if (strcmp (ext, ".dll.a") == 0)
|
||||
{
|
||||
/* Mingw can link against dlls directly, so if we're
|
||||
* currently searching for libxxx.dll.a, make a try first at
|
||||
* xxx.dll. The standard algorithm will search for
|
||||
* libxxx.dll.a (and failing that libxxx.a) later.
|
||||
*/
|
||||
strcpy (full_filename, library_paths[i]);
|
||||
strcat (full_filename, "/");
|
||||
strcat (full_filename, library_name);
|
||||
strcat (full_filename, suffix);
|
||||
strcat (full_filename, ".dll");
|
||||
if (show_all)
|
||||
{
|
||||
fprintf (stderr, " %s\n", full_filename);
|
||||
}
|
||||
|
||||
if (stat (full_filename, &statbuf) >= 0)
|
||||
{
|
||||
goto library_found;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
strcpy (full_filename, library_paths[i]);
|
||||
strcat (full_filename, "/lib");
|
||||
strcat (full_filename, library_name);
|
||||
strcat (full_filename, suffix);
|
||||
#ifdef __MINGW32__
|
||||
strcat (full_filename, ".dll");
|
||||
#else
|
||||
strcat (full_filename, ext);
|
||||
#endif
|
||||
|
||||
if (show_all)
|
||||
{
|
||||
|
@ -309,45 +323,13 @@ static int search_for_lib_with_suffix_and_ext (const char *library_name,
|
|||
if (stat (full_filename, &statbuf) < 0)
|
||||
/* Error - likely that file doesn't exist. */
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
// On windows a shared library probably has a static "import" library
|
||||
// called liblibrary_name.dll.a
|
||||
strcpy (full_filename, library_paths[i]);
|
||||
strcat (full_filename, "/lib");
|
||||
strcat (full_filename, library_name);
|
||||
strcat (full_filename, suffix);
|
||||
strcat (full_filename, ext);
|
||||
|
||||
if (show_all)
|
||||
{
|
||||
fprintf (stderr, " %s\n", full_filename);
|
||||
}
|
||||
if (stat (full_filename, &statbuf) < 0)
|
||||
{
|
||||
// then look for liblibrary_name.a
|
||||
strcpy (full_filename, library_paths[i]);
|
||||
strcat (full_filename, "/lib");
|
||||
strcat (full_filename, library_name);
|
||||
strcat (full_filename, suffix);
|
||||
strcat (full_filename, ".a");
|
||||
|
||||
if (show_all)
|
||||
{
|
||||
fprintf (stderr, " %s\n", full_filename);
|
||||
}
|
||||
if (stat (full_filename, &statbuf) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (stat (full_filename, &statbuf) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
library_found:
|
||||
#endif
|
||||
|
||||
if ((statbuf.st_mode & S_IFMT) == S_IFREG)
|
||||
/* Found it! */
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue