📄 config.c
字号:
fprintf(fpmake,"LIBS = %s\n\n",isc_libs);}voidgen_sun_ldflags(){ fputs("LDFLAGS = \\\n",fpmake); fputs("\t$(SYMBOLIC) $(LDFLAGS_EXTRA)\n\n",fpmake); fprintf(fpmake,"LIBS = %s\n\n",sun_libs);}voidgen_svr4_ldflags(){ fputs("LDFLAGS = \\\n",fpmake); fputs("\t$(SYMBOLIC) $(LDFLAGS_EXTRA)\n\n",fpmake); fprintf(fpmake,"LIBS = %s\n\n",svr4_libs);}voidgen_linux_ldflags(){ fputs("LDFLAGS = \\\n",fpmake); fputs("\t-s $(SYMBOLIC) $(LDFLAGS_EXTRA)\n\n",fpmake); fprintf(fpmake,"LIBS = %s\n\n",linux_libs);}voidgenerate_config(mdir)char *mdir;{ char mksrc[128]; char mkfl[128]; char s128[128]; FILE *fpsrc; FILE *local = fopen("config.local","r"); static int reported_config_local = 0; sprintf(mksrc,"%s/Make.src",mdir); sprintf(mkfl,"%s/Makefile",mdir); printf("Configuring %s from %s\n",mkfl,mksrc); if(!(fpsrc = fopen(mksrc,"r"))) { perror(mksrc); return; } if(debug) fpmake = stdout; else { if(!(fpmake = fopen(mkfl,"w"))) { perror(mkfl); fclose(fpsrc); if(local) fclose(local); return; } } fprintf(fpmake,"#---- configured by Configure revision %s for ECU 3.%02d\n", rev,PATCHLEVEL); fprintf(fpmake,"#---- edit %s and rerun Configure to produce this file\n\n", mksrc); if(local) { fprintf(fpmake,"# config.local inclusions\n"); fprintf(fpmake,"# -----------------------\n"); if(!reported_config_local) fputs("found config.local:\n",stdout); while(fgets(s128,sizeof(s128),local)) { if(!reported_config_local) fputs(s128,stdout); fputs(s128,fpmake); } if(!reported_config_local) fputs("\n",stdout); reported_config_local = 1; fclose(local); fprintf(fpmake,"# -----------------------\n"); fputs("\n",fpmake); } switch(sys) { case S_SCO: fprintf(fpmake,"SIGTYPE = %s\n\n",sco_sigtype[sco_type]); break; case S_ISC: fprintf(fpmake,"SIGTYPE = %s\n\n",isc_sigtype); break; case S_SUN: fprintf(fpmake,"SIGTYPE = %s\n\n",sun_sigtype); break; case S_ISCSVR4: case S_ESIXSVR4: fprintf(fpmake,"SIGTYPE = %s\n\n",svr4_sigtype); break; case S_LINUX: fprintf(fpmake,"SIGTYPE = %s\n\n",linux_sigtype); break; } switch(compiler) { case C_CC: fputs("CC = cc\n",fpmake); gen_cc_cflags(); break; case C_GCC: fputs("CC = gcc\n",fpmake); gen_gcc_cflags(); break; } switch(sys) { case S_SCO: gen_sco_ldflags(); break; case S_ISC: gen_isc_ldflags(); break; case S_SUN: gen_sun_ldflags(); break; case S_ISCSVR4: case S_ESIXSVR4: gen_svr4_ldflags(); break; case S_LINUX: gen_linux_ldflags(); break; } fprintf(fpmake,"LBIN = %s\n",bindir); fprintf(fpmake,"ECULIBDIR = %s\n",libdir); /* * we need this info in Makefiles, so it is put here rather * than ecu.h; must also have this passed thru in CFLAGS */ switch(sys) { case S_SCO: fprintf(fpmake,"SYSTEM = %s\n",sco_system[sco_type]); fputs("HDBLIBDIR = /usr/lib/uucp\n",fpmake); use_ecuungetty = "yes"; break; case S_ISC: fputs("SYSTEM = ISC-SVR3\n",fpmake); fputs("HDBLIBDIR = /usr/lib/uucp\n",fpmake); use_ecuungetty = "yes"; break; case S_SUN: fputs("SYSTEM = SunOS-4.1\n",fpmake); fputs("HDBLIBDIR = /etc/uucp\n",fpmake); use_ecuungetty = "no"; break; case S_ISCSVR4: case S_ESIXSVR4: if(sys == S_ISCSVR4) fputs("SYSTEM = ISC-SVR4\n",fpmake); else fputs("SYSTEM = ESIX-SVR4\n",fpmake); fputs("HDBLIBDIR = /etc/uucp\n",fpmake); use_ecuungetty = "no"; break; case S_LINUX: fputs("SYSTEM = Linux\n",fpmake); fputs("HDBLIBDIR = /usr/lib/uucp\n",fpmake); use_ecuungetty = "no"; break; } fprintf(fpmake,"USE_ECUUNGETTY = %s\n",use_ecuungetty);#if !defined(WHT) fputs("#",fpmake);#endif fputs("BINTIME = /bin/time\n",fpmake); fprintf(fpmake,"\n#---- end of configured make variables\n"); while(!debug && fgets(s128,sizeof(s128),fpsrc)) fputs(s128,fpmake); fclose(fpsrc); if(!debug) fclose(fpmake);}main(argc,argv)int argc;char **argv;{ int itmp; int getopt_libdir = 0; int getopt_bindir = 0; int getopt_tty = 0; int getopt_baud = 0; int getopt_parity = 0; int have_lng353 = 0; char s128[128]; char **makedir; char *tlib; char *tcap; struct stat fst; extern int optind; extern char *optarg; setbuf(stdin,NULL); setbuf(stdout,NULL); while((itmp = getopt(argc,argv,"dsiSL234ugcT:B:P:b:l:")) != -1) { switch(itmp) { case 'd': debug = 1; break; case 's': sys = S_SCO; break; case 'i': sys = S_ISC; break; case 'S': sys = S_SUN; break; case 'I': sys = S_ISCSVR4; break; case 'E': sys = S_ESIXSVR4; break; case 'L': sys = S_LINUX; break; case '2': sco_type = X_X286; break; case '3': sco_type = X_X386; break; case 'u': sco_type = X_UNIX; break; case 'v': sco_type = X_32v4; pid_type = "\t-DPID_T=short \\\n"; have_lng353 = !stat("/etc/perms/ccsls",&fst); break; case 'g': compiler = C_GCC; break; case 'c': compiler = C_CC; break; case 'T': tty = optarg; getopt_tty = 1; break; case 'B': baud = optarg; getopt_baud = 1; break; case 'P': parity = *optarg; if(isupper(parity)) parity = tolower(parity); getopt_parity = 1; break; case 'b': bindir = optarg; getopt_bindir = 1; break; case 'l': libdir = optarg; getopt_libdir = 1; break; } } /* * set up raw/cooked tty setty() macro */ ioctl(0,TCGETA,&tty0); tty1 = tty0; tty1.c_lflag &= ~(ICANON); tty1.c_cc[VMIN] = 1; tty1.c_cc[VTIME] = 0; for(itmp = 1; itmp < 32; itmp++) signal(itmp,goodbye); if(!debug) { tputstrs(strs_intro1); printf("ECU 3.%02d, config version %s\n",PATCHLEVEL,rev); tputstrs(strs_intro2); } /* * try to make a stab at default * two vendor compilers have thoughtfully provided a reliable built-in * default to ISC if not one of those two */ itmp = 'i';#ifdef M_SYSV itmp = 's';#endif#ifdef sun itmp = 'S';#endif#ifdef linux itmp = 'L'; compiler = C_GCC;#endif if(sys < 0) { switch(tgetopt("\Choose your system type (or the 'nearest equivalent') \n\ s SCO,\n\ i ISC,\n\ S SunOS 4.1,\n\ I ISC SVR4 or\n\ E ESIX SVR4 system\n\ L Linux 0.99p10\n\", "siSIEL",itmp)) { case 's': sys = S_SCO; tty = "tty1a"; break; case 'i': sys = S_ISC; tty = "acu00"; break; case 'S': sys = S_SUN; tty = "ttya"; printf("You need System V IPC configured in your kernel. I didn't check for it.\n"); break; case 'I': sys = S_ISCSVR4; tty = "tty00"; break; case 'E': sys = S_ESIXSVR4; tty = "tty00"; break; case 'L': sys = S_LINUX; tty = "cua0"; break; } } if((sys == S_SCO) && (sco_type < 0)) { switch(tgetopt("\Choose between 2 XENIX/286,\n\ 3 XENIX/386,\n\ u ODT 1.0.x, ODT 1.1, UNIX 3.20-3.2v2 or\n\ v ODT 2.0, UNIX 3.2v4\n\(The choice between 'u' and 'v' is for the Development System you have.\n\Using the 3.2v2DS with 3.2v4OS will \"work\" but erratic behavior is most\n\certain to occur (e.g., long filenames will confuse the 3.2v2 library).\n\ ","23uv",#ifdef M_UNIX'u'#else#ifdef M_I286'2'#else#ifdef M_I286'3'#else#ifdef sun'S'#else'i'#endif#endif#endif#endif )) { case '2': sco_type = X_X286; tlib = "/lib/Llibtermlib.a"; tcap = "/lib/Llibtermcap.a"; break; case '3': sco_type = X_X386; tlib = "/lib/386/Slibtermlib.a"; tcap = "/lib/386/Slibtermcap.a"; break; case 'u': sco_type = X_UNIX; tlib = "/usr/lib/libtermlib.a"; tcap = "/usr/lib/libtermcap.a";#ifdef S_IFLNK /* 3.2v2 DS with 3.2v4 OS */ fputs("OK, we will try to make for 3.2v4 with a 3.2v2 DS\n", stdout);#endif break; case 'v': sco_type = X_32v4; pid_type = "\t-DPID_T=short\\\n"; tlib = "/usr/lib/libtermlib.a"; tcap = "/usr/lib/libtermcap.a"; have_lng353 = !stat("/etc/perms/ccsls",&fst); break; } /* * Some of the following may have minor flaws making it * open to political nitpicking (this is 1992 :-!), but * here is truth: * * With the advent of terminfo curses in XENIX 2.?.?, * SCO until 3.2v2 had a question at install time asking what * kind of curses installation you want. It was somebody's * bright idea to settle the differences between XENIX V7/BSD * -lcurses+-ltermcap curses vs. the System V -lcurses terminfo * method. Well, bright people go on to other things and * continutity gets lost. The hard link driven, logical ld time * -lcurses = (XENIX/BSD/V7) ? -ltcap : -ltinfo * -ltermlib = (XENIX/BSD/V7) ? -ltermcap : -ltinfo * stuff appears to have disappeared in 3.2v2. I hope it is not * too late to get it back into 3.2v4, but the degenerate 3.2v2 * case adds yet another variation on the "ever-improved-but- * multivariate" SCO development environment. */ if(!access(tcap,0)) sco_libs = _sco2_libs; else if(!access(tlib,0)) sco_libs = _sco_libs; else { sleep(1); /* psychological */ printf("\nI find neither %s nor %s.\n",tcap,tlib); printf("Do you have curses support installed? I cannot proceed.\n"); goodbye(1); } } if((sys == S_SCO) && (sco_type == X_X286)) { /* don't know about gcc on 286 systems */ compiler = C_CC; } else { if(compiler < 0) { switch(tgetopt("Do you wish to use cc or gcc","cg",'c')) { case 'c': compiler = C_CC; if(sco_type == X_32v4) { if(have_lng353) tputstrs(strs_lng353); else tputstrs(strs_nolng353); } break; case 'g': compiler = C_GCC;#ifdef PEDANTIC printf("I see we are being brave, er pedantic.\n");#endif switch(tgetopt("Answer no if you are not sure.\n\WARNING: The default answer for this question is now YES\n\Do you have gcc 1.40 or later","yn",'y')) { case 'y': have_gcc_140 = 1; break; } switch(sys) { case S_SUN: case S_ISCSVR4: case S_ESIXSVR4: case S_LINUX: can_pipe = 1; /* native as reads from stdin ok */ break; default: switch(tgetopt("Answer no if you are not sure.\n\Can I use -pipe (do you have gas?)","yn",'n')) { case 'y': can_pipe = 1; break; } break; } break; } } } if(!debug) { if(!getopt_tty) { printf("\nWhat do you want for a default tty? [%s]\n:",tty); tgets(s128); if(s128[0]) tty = strdup(s128); } if(!getopt_baud) { printf("\nWhat do you want for a default baud rate? [%s]\n:",baud); tgets(s128); if(s128[0]) baud = strdup(s128); } if(!getopt_parity) { parity = tgetopt( "What do you want for default parity","neo",'n'); } if(!getopt_bindir) { printf( "\nWhere do you want the public executables placed? [%s]\n: ", bindir); tgets(s128); if(s128[0]) bindir = strdup(s128); } if(!getopt_libdir) { printf( "\nWhere do you want the ECU library placed? [%s]\n: ",libdir); tgets(s128); if(s128[0]) libdir = strdup(s128); } } printf("\nThank you.\n\n"); makedir = makedirs; while(*makedir) { if(!strcmp(*makedir,"./ecuungetty") && (*use_ecuungetty == 'n')) { makedir++; continue; } generate_config(*makedir++); } if(!debug) tputstrs(strs_mkdep);#ifdef WHT printf("\7Doing it anyway for WHT\n"); sleep(2); system("make depend");#endif goodbye(0);}/* vi: set tabstop=4 shiftwidth=4: *//* end of config.c */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -