AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
-AC_ARG_WITH(with_newt, [ --with-newt use newt window library])
AC_ARG_WITH(ssl,
[ --with-ssl=PATH Specify path to OpenSSL installation ],
[
AC_DEFINE(HAVE_ZLIB)
fi
-dnl Checks for the newt window library.
-if test "x$with_newt" != xno ; then
- AC_CHECK_HEADERS(newt.h,
- [AC_CHECK_LIB(newt, newtInit,
- [ok_newt=yes],,
- )])
-fi
-
-if test "x$ok_newt" = xyes ; then
- SETUP_LIBS="-lnewt $SETUP_LIBS"
- AC_DEFINE(HAVE_NEWT)
-fi
-
# The big search for OpenSSL
if test "$with_ssl" != "no"; then
saved_LIBS="$LIBS"
#include "webserver.h"
-#ifdef HAVE_NEWT
-#include <newt.h>
-#endif
-
-
#define UI_TEXT 0 /* Default setup type -- text only */
#define UI_DIALOG 2 /* Use the 'dialog' program */
#define UI_SILENT 3 /* Silent running, for use in scripts */
-#define UI_NEWT 4 /* Use the "newt" window library */
int setup_type;
char setup_directory[SIZ];
void cleanup(int exitcode)
{
-#ifdef HAVE_NEWT
- newtCls();
- newtRefresh();
- newtFinished();
-#endif
exit(exitcode);
}
int yesno(char *question)
{
-#ifdef HAVE_NEWT
- newtComponent form = NULL;
- newtComponent yesbutton = NULL;
- newtComponent nobutton = NULL;
-#endif
int i = 0;
int answer = 0;
char buf[SIZ];
}
break;
-#ifdef HAVE_NEWT
- case UI_NEWT:
- newtCenteredWindow(76, 10, "Question");
- form = newtForm(NULL, NULL, 0);
- for (i=0; i<num_tokens(question, '\n'); ++i) {
- extract_token(buf, question, i, '\n', sizeof buf);
- newtFormAddComponent(form, newtLabel(1, 1+i, buf));
- }
- yesbutton = newtButton(10, 5, "Yes");
- nobutton = newtButton(60, 5, "No");
- newtFormAddComponent(form, yesbutton);
- newtFormAddComponent(form, nobutton);
- if (newtRunForm(form) == yesbutton) {
- answer = 1;
- }
- else {
- answer = 0;
- }
- newtPopWindow();
- newtFormDestroy(form);
-
- break;
-#endif
-
}
return (answer);
}
void set_value(char *prompt, char str[])
{
-#ifdef HAVE_NEWT
- newtComponent form;
- char *result;
- int i;
-#endif
char buf[SIZ];
char dialog_result[PATH_MAX];
char setupmsg[SIZ];
}
break;
-#ifdef HAVE_NEWT
- case UI_NEWT:
-
- newtCenteredWindow(76, 10, "WebCit setup");
- form = newtForm(NULL, NULL, 0);
- for (i=0; i<num_tokens(prompt, '\n'); ++i) {
- extract_token(buf, prompt, i, '\n', sizeof buf);
- newtFormAddComponent(form, newtLabel(1, 1+i, buf));
- }
- newtFormAddComponent(form, newtEntry(1, 8, str, 74, (const char **) &result,
- NEWT_FLAG_RETURNEXIT));
- newtRunForm(form);
- strcpy(str, result);
-
- newtPopWindow();
- newtFormDestroy(form);
-
-#endif
}
}
void important_message(char *title, char *msgtext)
{
-#ifdef HAVE_NEWT
- newtComponent form = NULL;
- int i = 0;
-#endif
char buf[SIZ];
switch (setup_type) {
msgtext);
system(buf);
break;
-
-#ifdef HAVE_NEWT
- case UI_NEWT:
- newtCenteredWindow(76, 10, title);
- form = newtForm(NULL, NULL, 0);
- for (i=0; i<num_tokens(msgtext, '\n'); ++i) {
- extract_token(buf, msgtext, i, '\n', sizeof buf);
- newtFormAddComponent(form, newtLabel(1, 1+i, buf));
- }
- newtFormAddComponent(form, newtButton(35, 5, "OK"));
- newtRunForm(form);
- newtPopWindow();
- newtFormDestroy(form);
- break;
-#endif
-
}
}
void progress(char *text, long int curr, long int cmax)
{
-#ifdef HAVE_NEWT
-
- /* These variables are static because progress() gets called
- * multiple times during the course of whatever operation is
- * being performed. This makes setup non-threadsafe, but who
- * cares?
- */
- static newtComponent form = NULL;
- static newtComponent scale = NULL;
-#endif
static long dots_printed = 0L;
long a = 0;
char buf[SIZ];
}
}
break;
-
-#ifdef HAVE_NEWT
- case UI_NEWT:
- if (curr == 0) {
- newtCenteredWindow(76, 8, text);
- form = newtForm(NULL, NULL, 0);
- scale = newtScale(1, 3, 74, cmax);
- newtFormAddComponent(form, scale);
- newtDrawForm(form);
- newtRefresh();
- }
- if ((curr > 0) && (curr <= cmax)) {
- newtScaleSet(scale, curr);
- newtRefresh();
- }
- if (curr == cmax) {
- newtFormDestroy(form);
- newtPopWindow();
- newtRefresh();
- }
- break;
-#endif
-
}
}
return UI_DIALOG;
}
-#ifdef HAVE_NEWT
- newtInit();
- newtCls();
- newtDrawRootText(0, 0, "WebCit Setup");
- return UI_NEWT;
-#endif
return UI_TEXT;
}