Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
+144 -96
View File
@@ -1,4 +1,4 @@
/* $Id: liblist.c,v 1.14 2002/05/03 12:59:08 gcosmo Exp $ */
/* $Id: liblist.c,v 1.17 2002/11/22 11:53:10 gcosmo Exp $ */
/*
Given a "libname.map" file on standard input and a list or directory
@@ -9,7 +9,9 @@ of .d dependency files liblist produces:
original libname.map file, then reordered according to the dependencies
found in the .d files. This option is used for compiling the file
libname.map from all the dependencies.
The .d files are specfied in the argument(s).
c) with -m <lpath> option, the whole existing libraries list ordered
according to the libname.map, where libraries are placed in <lpath>.
The .d files are specified in the argument(s).
The libname.map is on standard input.
Usage:
@@ -18,8 +20,11 @@ Usage:
liblist -l *.d < libname.map
liblist -ld <ddir> < libname.map
liblist -l -d <ddir> < libname.map
where <ddir> is a directory name of a directory which is recursively
searched for dependency files.
liblist -m <lpath> < libname.map
where:
<ddir> is a directory name of a directory which is recursively
searched for dependency files
<lpath> is the path where libraries are located
Frank Behner, John Allison 13th February 1999.
*/
@@ -103,7 +108,13 @@ char** parsedir(char *directory,int *argc)
}
}
else
perror(" No status");
{
fprintf
(stderr,
" No status - perhaps file %s does not exist.\n",
directory);
exit(1);
}
}
if(buffer) free(buffer);
@@ -116,9 +127,10 @@ char** parsedir(char *directory,int *argc)
int main (int argc, char** argv) {
char static buffer[BUFSIZE],*bufferPtr,workbuf[256];
char *ptr,*p,**pp,**pp1,**pp2,*directory=0;
char *ptr,*p,**pp,**pp1,**pp2,*directory=0,*libpath=0;
char **rargv;
int i,optl=0,swapping,c,rargc;
char libname[128];
int i,optl=0,optm=0,swapping,c,rargc;
FILE *fp;
#if defined ( _WIN32 ) || defined ( __CYGWIN__ ) || defined ( __CYGWIN32__ )
@@ -138,7 +150,7 @@ int main (int argc, char** argv) {
struct libmap_ *libmap=0,*libmapPtr=0,*libmapPtr1=0,*libmapPtr2=0,
*prevPtr1,*prevPtr2,*tmpp,*userLibmapPtr;
while((c=getopt(argc,argv,"ld:"))!=EOF)
while((c=getopt(argc,argv,"ld: m:"))!=EOF)
{
switch(c)
{
@@ -148,6 +160,10 @@ int main (int argc, char** argv) {
case 'd':
directory=strdup(optarg);
break;
case 'm':
optm=1;
libpath=strdup(optarg);
break;
}
}
@@ -172,8 +188,10 @@ int main (int argc, char** argv) {
}
else
{
fprintf(stderr," ERROR: If you specify a directory don't also specify files\n");
exit(-1);
fprintf
(stderr,
" ERROR: If you specify a directory don't also specify files\n");
exit(1);
}
}
@@ -215,7 +233,7 @@ int main (int argc, char** argv) {
libmapPtr->uses=(char**)calloc(NLIBMAX,sizeof(char*));
/* If option -l not specified, fill uses list... */
if(!optl)
if(!optl && !optm)
{
pp=libmapPtr->uses;
if(ptr)
@@ -230,34 +248,39 @@ int main (int argc, char** argv) {
}
}
/* Get directory name... */
gets(buffer);
ptr=strtok(buffer,"/");
if(!ptr)
{
fprintf(stderr," ERROR: \"/\" before \"source\" expected.\n");
exit(1);
}
while(ptr&&strcmp (ptr,"source"))ptr=strtok(NULL,"/");
ptr=strtok(NULL,"/");
if(!ptr)
{
fprintf(stderr," ERROR: \"source\" expected.\n");
exit(1);
}
libmapPtr->trigger=(char*)malloc(TRIGSIZE);
strcpy(libmapPtr->trigger,ptr);
ptr=strtok(NULL,"/");
while(ptr&&strcmp(ptr,"GNUmakefile"))
{
strcat(libmapPtr->trigger,"/");
strcat(libmapPtr->trigger,ptr);
ptr=strtok(NULL,"/");
}
if(!ptr)
{
fprintf(stderr," ERROR: \"source/<unique-sub-path>/GNUmakefile\" expected.\n");
exit(1);
if(!optm)
{
/* Get directory name... */
gets(buffer);
ptr=strtok(buffer,"/");
if(!ptr)
{
fprintf(stderr," ERROR: \"/\" before \"source\" expected.\n");
exit(1);
}
while(ptr&&strcmp (ptr,"source"))ptr=strtok(NULL,"/");
ptr=strtok(NULL,"/");
if(!ptr)
{
fprintf(stderr," ERROR: \"source\" expected.\n");
exit(1);
}
libmapPtr->trigger=(char*)malloc(TRIGSIZE);
strcpy(libmapPtr->trigger,ptr);
ptr=strtok(NULL,"/");
while(ptr&&strcmp(ptr,"GNUmakefile"))
{
strcat(libmapPtr->trigger,"/");
strcat(libmapPtr->trigger,ptr);
ptr=strtok(NULL,"/");
}
if(!ptr)
{
fprintf
(stderr,
" ERROR: \"source/<unique-sub-path>/GNUmakefile\" expected.\n");
exit(1);
}
}
}
@@ -310,69 +333,72 @@ int main (int argc, char** argv) {
userLibmapPtr=0;
}
/* Look for a "used" library and add it to the "user" uses list... */
bufferPtr=strtok(NULL,"\n"); /* Start *after* ":". */
if (!bufferPtr)
if(!optm)
{
fprintf(stderr," WARNING: It seems there is nothing after \':\' in dependency file %s.\n", rargv[i]);
}
else {
do
{
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
/* Look for trigger string. */
strcpy(workbuf,libmapPtr->trigger);
strcat(workbuf,"/include");
ptr=strstr(bufferPtr,workbuf);
if(ptr && (userLibmapPtr != libmapPtr))
{
libmapPtr->used=1;
if(userLibmapPtr)
{
for(pp=userLibmapPtr->uses;*pp;pp++)
{
if(strcmp(*pp,libmapPtr->lib)==0)break;
}
if(!*pp)*pp=libmapPtr->lib;
}
}
/* Also look for library name in case header files are
placed in temporary directories under a subdirectory
with the same name as the library name. This can
happen with Objectivity which makes header files
from .ddl files and places them in a temporary
directory. */
strcpy(workbuf,libmapPtr->lib);
strcat(workbuf,"/");
ptr=strstr(bufferPtr,workbuf);
if(ptr && (userLibmapPtr != libmapPtr))
{
libmapPtr->used=1;
if(userLibmapPtr)
{
for(pp=userLibmapPtr->uses;*pp;pp++)
{
if(strcmp(*pp,libmapPtr->lib)==0)break;
}
if(!*pp)*pp=libmapPtr->lib;
}
}
}
fgets(buffer,BUFSIZE,fp);
bufferPtr=buffer;
/* Look for a "used" library and add it to the "user" uses list... */
bufferPtr=strtok(NULL,"\n"); /* Start *after* ":". */
if (!bufferPtr)
{
fprintf(stderr," WARNING: It seems there is nothing after \':\' in dependency file %s.\n", rargv[i]);
}
else {
do
{
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
/* Look for trigger string. */
strcpy(workbuf,libmapPtr->trigger);
strcat(workbuf,"/include");
ptr=strstr(bufferPtr,workbuf);
if(ptr && (userLibmapPtr != libmapPtr))
{
libmapPtr->used=1;
if(userLibmapPtr)
{
for(pp=userLibmapPtr->uses;*pp;pp++)
{
if(strcmp(*pp,libmapPtr->lib)==0)break;
}
if(!*pp)*pp=libmapPtr->lib;
}
}
/* Also look for library name in case header files are
placed in temporary directories under a subdirectory
with the same name as the library name. This can
happen with Objectivity which makes header files
from .ddl files and places them in a temporary
directory. */
strcpy(workbuf,libmapPtr->lib);
strcat(workbuf,"/");
ptr=strstr(bufferPtr,workbuf);
if(ptr && (userLibmapPtr != libmapPtr))
{
libmapPtr->used=1;
if(userLibmapPtr)
{
for(pp=userLibmapPtr->uses;*pp;pp++)
{
if(strcmp(*pp,libmapPtr->lib)==0)break;
}
if(!*pp)*pp=libmapPtr->lib;
}
}
}
fgets(buffer,BUFSIZE,fp);
bufferPtr=buffer;
#if defined ( _WIN32 ) || defined ( __CYGWIN__ ) || defined ( __CYGWIN32__ )
while ( ptr=strchr(buffer,'\\') ) *ptr='/';
while ( ptr=strchr(buffer,'\\') ) *ptr='/';
while (ntg4tmp1 && (ptr=strstr(buffer,ntg4tmp1)) )
{
for(nti=0;nti<strlen(ntg4tmp1);nti++) ptr[nti]=' ';
}
while (ntg4tmp1 && (ptr=strstr(buffer,ntg4tmp1)) )
{
for(nti=0;nti<strlen(ntg4tmp1);nti++) ptr[nti]=' ';
}
#endif
} while(!feof(fp));
fclose(fp);
} while(!feof(fp));
fclose(fp);
}
}
}
@@ -509,6 +535,28 @@ int main (int argc, char** argv) {
printf("source/%s/GNUmakefile\n",libmapPtr->trigger);
}
}
else if (optm)
{
/* Write out full library list... */
for(libmapPtr=libmap;libmapPtr;libmapPtr=libmapPtr->next)
{
/* Check existance of libraries and print out only installed ones */
sprintf(libname, "%s/lib%s.a", libpath, libmapPtr->lib);
if (access(libname,R_OK))
{
sprintf(libname, "%s/lib%s.so", libpath, libmapPtr->lib);
if (!access(libname,R_OK))
{
printf("-l%s ",libmapPtr->lib);
}
}
else
{
printf("-l%s ",libmapPtr->lib);
}
libmapPtr=libmapPtr->next;
}
}
else
{
/* Add dependent libraries... */