home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / xloadimg.zip / xloadimage.4.1 / autoconfig.c next >
C/C++ Source or Header  |  1993-11-08  |  18KB  |  629 lines

  1. /* autoconfig.c:
  2.  *
  3.  * automatic configuration program
  4.  *
  5.  * jim frost 09.05.93
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #ifdef __STDC__
  12. #include <stdlib.h>
  13. #endif
  14.  
  15. /* system-specific configuration defaults
  16.  */
  17.  
  18. #ifdef sgi
  19. /* C compiler has fixed-size parse tree table that overflows on some
  20.  * of the macro translations.  you'd think compiler writers would be
  21.  * smarter, wouldn't you?
  22.  */
  23. #define DEF_CC "cc -Wf,XNh5000"
  24. #endif /* sgi */
  25.  
  26. /* default versions that work on most systems
  27.  */
  28.  
  29. #ifndef DEF_CC
  30. #define DEF_CC "cc"
  31. #endif
  32.  
  33. #ifndef DEF_OPT_FLAGS
  34. #define DEF_OPT_FLAGS "-O"
  35. #endif
  36.  
  37. #ifndef DEF_INSTALL_DIR
  38. #define DEF_INSTALL_DIR "/usr/local/bin"
  39. #endif
  40.  
  41. /* list of places to look for system libraries
  42.  */
  43. char *SysLibDirList[] =
  44. {
  45.   "/lib",
  46.   "/usr/lib",
  47.   NULL
  48. };
  49.  
  50. /* typical system path for finding binaries
  51.  */
  52. char *SysProgPath[] =
  53. {
  54.   "/bin",
  55.   "/usr/bin",
  56.   NULL
  57. };
  58.  
  59. /* a few miscellaneous names for places people might put graphics libraries
  60.  */
  61. char *MiscIncludeDirList[] = 
  62. {
  63.   "/usr/include",
  64.   "/usr/local/include",
  65.   "/usr/include/graphics",
  66.   "/usr/local/include/graphics",
  67.   ".",  /* why not? */
  68.   NULL
  69. };
  70.  
  71. char *MiscLibDirList[] =
  72. {
  73.   "/lib",
  74.   "/usr/lib",
  75.   "/usr/local/lib",
  76.   "/usr/graphics/lib",
  77.   "/usr/local/graphics/lib",
  78.   ".",
  79.   NULL
  80. };
  81.  
  82. struct X11_dir_list { char *inc_dir; char *lib_dir; } X11DirList[] =
  83. {
  84.   { "/usr/include/X11R6", "/usr/lib/X11R6" }, /* HP style; must be first */
  85.   { "/usr/include/X11R5", "/usr/lib/X11R5" }, /* because they have an X11 */
  86.   { "/usr/include/X11R4", "/usr/lib/X11R4" }, /* dir too, but it's empty */
  87.   { "/usr/include", "/usr/lib" },                 /* MIT standard */
  88.   { "/usr/openwin/include", "/usr/openwin/lib" }, /* SunOS */
  89.   { "/usr/X11R6/include", "/usr/X11R6/lib" },
  90.   { "/usr/X11R5/include", "/usr/X11R5/lib" },
  91.   { "/usr/X11R4/include", "/usr/X11R4/lib" },
  92.   { "/usr/local/X11R6/include", "/usr/local/X11R6/lib" },
  93.   { "/usr/local/X11R5/include", "/usr/local/X11R5/lib" },
  94.   { "/usr/local/X11R4/include", "/usr/local/X11R4/lib" },
  95.   { NULL, NULL }
  96. };
  97.  
  98. struct typical_sys_libs { char *name; char *desc; } TypicalSysLibs[] =
  99. {
  100.   { "socket", "socket support" },
  101.   { "nsl", "network support" },
  102.   { NULL, NULL }
  103. };
  104.  
  105. char config_style[6]; /* configuration style */
  106. char cflags[4096];    /* flags passed to C compiler */
  107. char libs[4096];      /* extra libraries */
  108. char X11_inc[1024];   /* X11 include path */
  109. char X11_lib[1024];   /* X11 library path */
  110. char X11_name[1024];  /* X11 library name */
  111. char cc[1024];        /* C compiler */
  112. char opt_flags[1024]; /* optimization flags */
  113. char ranlib[1024];    /* ranlib program or /bin/true */
  114. char install_dir[1024]; /* install directory */
  115. char optional_srcs[4096]; /* optional source files */
  116. char optional_libs[4096]; /* optional libraries */
  117.  
  118. /* this looks to see if there's a file matching a particular pattern.
  119.  * it uses "echo" as a poor-man's glob.
  120.  */
  121. int hasFileNamed(pattern)
  122.      char *pattern;
  123. {
  124.   static char buf[1024];
  125.   FILE *p;
  126.   int i;
  127.   struct stat stat_buf;
  128.  
  129.   sprintf(buf, "echo %s", pattern);
  130.   p = popen(buf, "r");
  131.   if (p == NULL) { /* bad news */
  132.     perror("popen");
  133.     return(0);
  134.   }
  135.   buf[1023] = '\0';
  136.   if (fgets(buf, 1023, p) == NULL) {
  137.     pclose(p);
  138.     return(0);
  139.   }
  140.   pclose(p);
  141.  
  142.   if ((buf[0] == ' ') || (buf[0] == '\0'))
  143.     return(0);
  144.  
  145.   /* in shared-library environments we may get several matches.  just look
  146.    * for the first one to verify existance of any of them.
  147.    */
  148.   for (i = 0; buf[i]; i++) {
  149.     if ((buf[i] == ' ') || (buf[i] == '\n')) {
  150.       buf[i] = '\0';
  151.       break;
  152.     }
  153.   }
  154.  
  155.   /* technically we could probably get away with avoiding stat()
  156.    */
  157.   if (stat(buf, &stat_buf) < 0)
  158.     return(0);
  159.   return(1);
  160. }
  161.  
  162. /* this tries to find an installed library.  this uses "echo" as a
  163.  * poor-man's "glob" so we can find shared libraries too.
  164.  */
  165. int hasSysLibrary(name)
  166.      char *name;
  167. {
  168.   char **d;
  169.   char libname[1024];
  170.  
  171.   for (d = SysLibDirList; *d != NULL; d++) {
  172.     sprintf(libname, "%s/lib%s.*", *d, name);
  173.     if (hasFileNamed(libname))
  174.       return(1);
  175.   }
  176.   return(0);
  177. }
  178.  
  179. int hasProgram(name)
  180.      char *name;
  181. {
  182.   char **d;
  183.   char pathname[1024];
  184.  
  185.   for (d = SysProgPath; *d != NULL; d++) {
  186.     sprintf(pathname, "%s/%s", *d, name);
  187.     if (hasFileNamed(pathname))
  188.       return(1);
  189.   }
  190.   return(0);
  191. }
  192.  
  193. /* functions to find include files and libraries
  194.  */
  195. char *findInclude(name)
  196. {
  197.   char fullname[1024];
  198.   char **d;
  199.  
  200.   for (d= MiscIncludeDirList; *d; d++) {
  201.     sprintf(fullname, "%s/%s", *d, name);
  202.     if (hasFileNamed(fullname))
  203.       return(*d);
  204.   }
  205.   return(NULL);
  206. }
  207.  
  208. char *findLibrary(name)
  209.      char *name;
  210. {
  211.   char libname[1024];
  212.   char fullname[1024];
  213.   char **d;
  214.  
  215.   if (!strncmp(name, "-l", 2))
  216.     sprintf(libname, "lib%s.*", &name[2]); /* skip -l and glob */
  217.   else
  218.     strcpy(libname, X11_name);
  219.  
  220.   /* ok, go looking
  221.    */
  222.   for (d= MiscLibDirList; *d; d++) {
  223.     sprintf(fullname, "%s/%s", *d, libname);
  224.     if (hasFileNamed(fullname))
  225.       return(*d);
  226.   }
  227.   return(NULL);
  228. }
  229.  
  230. void addOptionalLibrary(desc, define, libdir, libname, srcname)
  231.      char *desc;    /* human-readable name of library */
  232.      char *define;  /* define that activates support in xloadimage */
  233.      char *libdir;  /* directory where file resides */
  234.      char *libname; /* name of library */
  235.      char *srcname; /* name of include file */
  236. {
  237.   char buf[1024];
  238.  
  239.   if (!hasFileNamed(libdir)) {
  240.     printf("\nI know how to use the %s library, but it doesn't seem to be\n\
  241. included in this distribution, too bad.\n", libname);
  242.     return;
  243.   }
  244.  
  245.   printf("\n\
  246. I can include support for the %s format.  Would you like me to do so?\n\
  247. (n=no, default=yes): ", desc);
  248.   gets(buf);
  249.   if (buf[0] == 'n')
  250.     return;
  251.   sprintf(&cflags[strlen(cflags)], " -D%s", define);
  252.   sprintf(&optional_srcs[strlen(optional_srcs)], " %s", srcname);
  253.   sprintf(&optional_libs[strlen(optional_libs)], " %s/%s", libdir, libname);
  254. }
  255.  
  256. void writeConfigFile()
  257. { FILE *f;
  258.  
  259.   f = fopen("Make.conf", "w");
  260.   if (f == NULL) {
  261.     perror("\n*** Could not open Make.conf");
  262.     printf("\
  263. The permissions may be wrong on the file.  Please correct the problem and\n\
  264. try again.\n\n");
  265.     exit(1);
  266.   }
  267.   fprintf(f, "\
  268. # Xloadimage Configuration file.  Normally this file is created by the\n\
  269. # autoconfig program.  If you edit this file, make certain that the\n\
  270. # CONFIG_STYLE line is set to -skip or autoconfig will overwrite your\n\
  271. # changes.\n\
  272. CONFIG_STYLE=%s\n\n", config_style);
  273.   fprintf(f, "\
  274. # C compiler to use, including special flags.\n\
  275. CC=%s\n\n",
  276.       cc);
  277.   fprintf(f, "\
  278. # Configuration and options flags for C compiler.\n\
  279. CC_FLAGS=%s\n\n",
  280.       cflags);
  281.   fprintf(f, "\
  282. # Optimization flags for C compiler.\n\
  283. OPT_FLAGS=%s\n\n",
  284.       opt_flags);
  285.   fprintf(f, "\
  286. # Miscellaneous system libraries.\n\
  287. SYS_LIBS=%s\n\n", libs);
  288.   fprintf(f, "\
  289. # X11 include and library information.\n\
  290. X11_INC_DIR=%s%s\n\
  291. X11_LIB_DIR=%s%s\n\
  292. X11_LIB_NAME=%s\n\n",
  293.       (X11_inc[0] ? "-I" : ""), X11_inc,
  294.       (X11_lib[0] ? "-L" : ""), X11_lib,
  295.       X11_name);
  296.   fprintf(f, "\
  297. INSTALLDIR=%s\n\n", install_dir);
  298.   fprintf(f, "\
  299. # Optional source files, usually integrations for optional loaders.\n\
  300. OPTIONAL_SRCS=%s\n\n",
  301.       optional_srcs);
  302.   fprintf(f, "\
  303. # Optional libraries, usually loaders.\n\
  304. OPTIONAL_LIBS=%s\n\n",
  305.       optional_libs);
  306.   fprintf(f, "# Ranlib program, or /bin/true if unnecessary\nRANLIB=%s\n\n",
  307.       ranlib);
  308.   fprintf(f, "# Other miscellaneous more-or-less standard programs\n");
  309.   fprintf(f, "RM=rm -f\n");
  310.   fprintf(f, "AR=ar cq\n");
  311.   fprintf(f, "CP=cp\n");
  312.   fprintf(f, "MV=mv\n");
  313.   fprintf(f, "LN=ln -s\n");
  314.   fprintf(f, "\n# These fix problems with make cmds that use $SHELL by default\n");
  315.   fprintf(f, "SHELL=/bin/sh\n");
  316.   fprintf(f, "MAKESHELL=/bin/sh\n");
  317.   fclose(f);
  318. }
  319.  
  320. main(argc, argv)
  321.      int argc;
  322.      char *argv[];
  323. {
  324.   int i;
  325.   int is_sysv = 0;
  326.   int is_bsd = 0;
  327.   int is_debugging = 0;
  328.   int tries;
  329.   char buf[1024];       /* misc input buffer */
  330.   struct typical_sys_libs *tsl;
  331.  
  332.   /* process command line arguments
  333.    */
  334.   for (i = 1; i < argc; i++) {
  335.     if (!strcmp(argv[i], "-clean")) {
  336.  
  337.       /* don't use the DEF_* macros here!  these must be VERY generic!
  338.        */
  339.       strcpy(config_style, "-auto");
  340.       strcpy(cc, "cc");
  341.       strcpy(cflags, "");
  342.       strcpy(opt_flags, "");
  343.       strcpy(libs, "");
  344.       strcpy(X11_inc, "");
  345.       strcpy(X11_lib, "");
  346.       strcpy(X11_name, "-lX11");
  347.       strcpy(ranlib, "ranlib");
  348.       strcpy(install_dir, "/usr/local/bin");
  349.       strcpy(optional_srcs, "");
  350.       strcpy(optional_libs, "");
  351.       writeConfigFile();
  352.       exit(0);
  353.     }
  354.     else if (!strcmp(argv[i], "-bsd")) {
  355.       is_bsd = 1;
  356.       is_sysv = 0;
  357.     }
  358.     else if (!strcmp(argv[i], "-sysv")) {
  359.       is_bsd = 0;
  360.       is_sysv = 1;
  361.     }
  362.     else
  363.       printf("autoconfig: ignoring unknown option '%s'\n", argv[i]);
  364.   }
  365.  
  366.   printf("\n\
  367. Welcome to the Xloadimage Automatic Configuration Program.\n\n\
  368. I will attempt to determine your machine configuration automatically\n\
  369. and will ask you some questions about preferred compilers and flags.\n\n");
  370.  
  371.   strcpy(config_style, "-skip");
  372.   strcpy(cflags, "");
  373.   strcpy(libs, "");
  374.  
  375.   printf("Do you want a debugging version built? (y=yes, default=no): ");
  376.   gets(buf);
  377.   printf("\n");
  378.   if (buf[0] == 'y') {
  379.     printf("I will compile this with debugging information and without optimization.\n");
  380.     is_debugging = 1;
  381.     strcat(cflags, " -DDEBUG");
  382.   }
  383.  
  384.   if (is_bsd)
  385.     printf("Assuming that this is a BSD-compatible system, as you specified.\n");
  386.   if (is_sysv)
  387.     printf("Assuming that this is a System-V-compatible system, as you specified.\n");
  388.  
  389.   /* if neither BSD nor SYSV was specified, try to guess which it is.
  390.    * this could be more sophisticated.
  391.    */
  392.   if (!is_bsd && !is_sysv) {
  393.     if (hasFileNamed("/etc/ttytab")) { /* this is a definite BSD-ism */
  394.       printf("This looks like a BSD-compatible system.\n");
  395.       is_bsd = 1;
  396.     }
  397.     else {
  398.       printf("This looks like a System-V-compatible system.\n");
  399.       is_sysv = 1;
  400.     }
  401.   }
  402.  
  403.   if (is_bsd)
  404.     strcat(cflags, " -DIS_BSD");
  405.  
  406.   if (is_sysv)
  407.     strcat(cflags, " -DSYSV"); /* needed for <X11/Xos.h> at least */
  408.  
  409.   /* see if <sys/select.h> exists.  most SysV systems have select()
  410.    * support but require this file to be included in order to use it.
  411.    * if it doesn't exist, look for <poll.h> instead.
  412.    */
  413.   if (hasFileNamed("/usr/include/sys/select.h")) {
  414.     printf("This system has a special header-file for select, so I'll use it.\n");
  415.     strcat(cflags, " -DHAS_SELECT_INCLUDE");
  416.   }
  417.   else if (!is_bsd && hasFileNamed("/usr/include/poll.h")) {
  418.     printf("This system appears to support poll(), so I'll use it.\n");
  419.     strcat(cflags, " -DHAS_POLL");
  420.   }
  421.  
  422.   /* look for system libraries that are often needed
  423.    */
  424.   for (tsl = TypicalSysLibs; tsl->name != NULL; tsl++) {
  425.     if (hasSysLibrary(tsl->name)) {
  426.       printf("This system appears to have a %s library (-l%s), so I'll use it.\n",
  427.          tsl->desc, tsl->name);
  428.       strcat(libs, " -l");
  429.       strcat(libs, tsl->name);
  430.     }
  431.   }
  432.  
  433.   if (hasProgram("ranlib")) {
  434.     printf("This system has ranlib, so I'll use it.\n");
  435.     strcpy(ranlib, "ranlib");
  436.   }
  437.   else
  438.     strcpy(ranlib, "/bin/true");
  439.  
  440.   /* now for the hard stuff -- we have to find the X11 libraries and
  441.    * include files.
  442.    */
  443.   for (i = 0; X11DirList[i].inc_dir != NULL; i++) {
  444.     char include_path[1024];
  445.     char lib_path[1024];
  446.  
  447.     sprintf(include_path, "%s/X11", X11DirList[i].inc_dir);
  448.     sprintf(lib_path, "%s/libX11.*", X11DirList[i].lib_dir);
  449.     if (hasFileNamed(include_path) && hasFileNamed(lib_path)) {
  450.       printf("\nI found X11 include files in %s and\n\
  451. the X11 library in %s.\n\
  452. Do you want to use these? (n=no, default=yes): ", include_path, lib_path);
  453.       gets(buf);
  454.       if (buf[0] != 'n')
  455.     break;
  456.     }
  457.   }
  458.   if (X11DirList[i].inc_dir) {
  459.     strcpy(X11_inc, X11DirList[i].inc_dir);
  460.     strcpy(X11_lib, X11DirList[i].lib_dir);
  461.     strcpy(X11_name, "-lX11");
  462.   }
  463.   else {
  464.     strcpy(X11_inc, "");
  465.     printf("\n\
  466. I could not find the X11 include files and/or libraries, so you will need\n\
  467. to specify them for me.  If you don't know where these are you should ask\n\
  468. to your system administrator.\n\n");
  469.     for (tries = 0;; tries++) {
  470.       printf("Where are the include files (eg /usr/local/X11R5/include):\n");
  471.       gets(X11_inc);
  472.       if ((X11_inc[0] == '\0') || (X11_inc[0] == '\n')) {
  473.     printf("\n\
  474. You didn't supply a path so I'm leaving this information out.  You will need\n\
  475. to modify the X11_INC_DIR line in Make.conf for the compilation to succeed,\n\
  476. or type 'make configure' to try configuring the system again.\n");
  477.     strcpy(X11_inc, "");
  478.     break;
  479.       }
  480.       sprintf(buf, "%s/X11", X11_inc);
  481.       if (hasFileNamed(buf))
  482.     break;
  483.       if (tries < 3)
  484.     printf("I cannot find %s.  Please try again.\n", buf);
  485.       else {
  486.     printf("\n\
  487. I'm sorry, but you seem to be having trouble specifying this path.  I'm\n\
  488. leaving it blank and proceeding.  You will probably need to modify the\n\
  489. X11_INC_DIR line in Make.conf for the compilation to succeed.  If you want\n\
  490. to try again, type 'make configure'.\n");
  491.     strcpy(X11_inc, "");
  492.       }
  493.     }
  494.  
  495.     /* same thing for library path
  496.      */
  497.     for (tries = 0;; tries++) {
  498.       printf("\nWhere are the library files (eg /usr/local/X11R5/lib):\n");
  499.       gets(X11_lib);
  500.       if ((X11_lib[0] == '\0') || (X11_lib[0] == '\n')) {
  501.     printf("\n\
  502. You didn't supply a path so I'm leaving this information out.  You will need\n\
  503. to modify the X11_LIB_DIR line in Make.conf for the compilation to succeed,\n\
  504. or type 'make configure' to try configuring the system again.\n");
  505.     strcpy(X11_lib, "");
  506.     strcpy(X11_name, "-lX11");
  507.     break;
  508.       }
  509.       sprintf(buf, "%s/libX11.*", X11_lib);
  510.       if (hasFileNamed(buf)) {
  511.     strcpy(X11_name, "-lX11");
  512.     break;
  513.       }
  514.       printf("\n\
  515. I can't find %s/libX11.a (or anything that looks like a shared library).\n\
  516. If the library has a different name (eg -lX11R5) type it now, or leave\n\
  517. blank to try again: ", X11_lib);
  518.       gets(X11_name);
  519.       if ((X11_name[0] != '\0') && (X11_name[0] != '\n')) {
  520.     char tmp[1024];
  521.     if (!strncmp(X11_name, "-l", 2))
  522.       sprintf(tmp, "lib%s.*", &X11_name[2]); /* skip -l and glob */
  523.     else
  524.       strcpy(tmp, X11_name);
  525.     sprintf(buf, "%s/%s", X11_lib, tmp);
  526.     if (hasFileNamed(buf))
  527.       break;
  528.     printf("\n\
  529. I couldn't find %s either,\n\
  530. but I'll assume you know what you're doing.  If you have trouble linking\n\
  531. against this library you should edit Make.conf to make the appropriate\n\
  532. changes.\n", buf);
  533.     break;
  534.       }
  535.       if (tries < 3)
  536.     printf("I cannot find %s.  Please try again.\n", buf);
  537.       else {
  538.     printf("\n\
  539. I'm sorry, but you seem to be having trouble specifying this path.  I'm\n\
  540. leaving it blank and proceeding.  You will probably need to modify the\n\
  541. X11_LIB_DIR line in Make.conf for the compilation to succeed.  If you want\n\
  542. to try again, type 'make configure'.\n");
  543.     strcpy(X11_lib, "");
  544.     strcpy(X11_name, "-lX11");
  545.       }
  546.     }
  547.    }
  548.  
  549.   /* ignore default paths
  550.    */
  551.   if (!strcmp(X11_inc, "/usr/include"))
  552.     strcpy(X11_inc, "");
  553.   
  554.   if (!strcmp(X11_lib, "/usr/lib") ||
  555.       !strcmp(X11_lib, "/lib"))
  556.     strcpy(X11_lib, "");
  557.   
  558.   printf("\n\
  559. The default C compiler on this system is:\n\n\
  560.   %s\n\n\
  561. If you would like to use a different C compiler or add special compilation\n\
  562. flags (other than optimization-related flags), specify its name and flags.\n\
  563. (default %s): ", DEF_CC, DEF_CC);
  564.   gets(cc);
  565.   if ((cc[0] == '\0') || (cc[0] == '\n'))
  566.     strcpy(cc, DEF_CC);
  567.   printf("I will invoke the C compiler using %s.\n", cc);
  568.  
  569.   if (is_debugging)
  570.     strcpy(opt_flags, "-g");
  571.   else {
  572.     if ((strlen(cc) >= 3) && !strcmp(&cc[strlen(cc) - 3], "gcc")) {
  573.       printf("\n\
  574. You specified gcc.  Significant performance improvements can be gained\n\
  575. by using the optimization flags -fstrength-reduce -finline-functions.\n\
  576. Would you like me to use those flags? (n=no, default=yes): ");
  577.       gets(buf);
  578.       if (buf[0] == 'n')
  579.     goto get_opt_flags; /* ick, but expedient */
  580.       strcpy(opt_flags, "-O -fstrength-reduce -finline-functions");
  581.       printf("\n\
  582. Gcc version 1.37 has some optimizer bugs that can cause problems, but I can\n\
  583. work around them by supplying additional optimization flags.  Do you have\n\
  584. gcc 1.37?  (n=no, default=yes, select default if you don't know): ");
  585.       gets(buf);
  586.       if (buf[0] == 'n')
  587.     strcat(opt_flags, " -fforce-mem -fforce-addr");
  588.     }
  589.     else {
  590.     get_opt_flags:
  591.       printf("\n\
  592. On this system I use the following optimizer flag(s):\n\n\
  593.   %s\n\n\
  594. If you would like to use a different flag or set of flags, enter it now or\n\
  595. leave blank to use the above flag(s): ", DEF_OPT_FLAGS);
  596.       gets(opt_flags);
  597.       if ((opt_flags[0] == '\0') || (opt_flags[0] == '\n'))
  598.     strcpy(opt_flags, DEF_OPT_FLAGS);
  599.     }
  600.     printf("Using optimization flags: %s\n", opt_flags);
  601.   }
  602.  
  603.   /* ask about the install directory
  604.    */
  605.   printf("\n\
  606. Where would you like the installation installed?  (Installation is NOT\n\
  607. automatic -- you must type 'make install' from an account with the proper\n\
  608. permissions to actually perform the installation.)\n\
  609. (default=%s)? ", DEF_INSTALL_DIR);
  610.   gets(install_dir);
  611.   if ((install_dir[0] == '\0') || (install_dir[0] == '\n'))
  612.     strcpy(install_dir, DEF_INSTALL_DIR);
  613.   printf("Installation directory is %s.\n", install_dir);
  614.  
  615.   /* now ask about optional loaders we can support if the libraries
  616.    * are present.
  617.    */
  618.   addOptionalLibrary("JPEG", "HAS_JPEG", "jpeg", "libjpeg.a", "jpeg.c");
  619.   addOptionalLibrary("TIFF", "HAS_TIFF", "tiff", "libtiff.a", "tiff.c");
  620.  
  621.   writeConfigFile();
  622.  
  623.   printf("\n\
  624. Automatic configuration is complete.  If you need to reconfigure this\n\
  625. installation, type 'make configure'.  If there are problems during\n\
  626. the build process you may need to edit the Make.conf file by hand.\n\n");
  627.   exit(0);
  628. }
  629.