glfer-0.4.2/0000777000175000001440000000000011330653424007616 500000000000000glfer-0.4.2/g_main.c0000644000175000001440000013261411150606475011143 00000000000000/* g_main.c * Copyright (C) 2001-2008 Claudio Girardi * (C) 2006 Edouard Griffiths for modifications implementing * averaging mode * * This file is derived from xspectrum, Copyright (C) 2000 Vincent Arkesteijn * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include #include #include "glfer.h" #include "g_about.h" #include "g_txmsg.h" #include "g_options.h" #include "g_main.h" #include "g_scope.h" #include "g_file_dialogs.h" #include "util.h" #include "fft.h" #include "avg.h" #include "glfer.h" #include "source.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif /* minimum distance between pressing and releasing mouse button for */ /* selection to be acknowledged */ #define MINSEL 5 /* istantaneous spectrum amplitude width */ #define SPEC_DA_WIDTH 200 extern opt_t opt; extern glfer_t glfer; extern avg_data_t avgdata; static GtkWidget *window = NULL, *main_vb, *avg_hb, *drawing_area, *spec_da; static GtkWidget *scrolled_window, *stop_start_bu, *cpu_la, *pwr_la, *peak_la, *avgmax_frame = NULL, *avgmax_la, *avgvar_frame = NULL, *avgvar_la, *avgfill_frame = NULL, *avgfill_la, *peakfreq_frame = NULL, *peakfreq_la; static GdkGC *sel_gc = NULL; static GdkCursor *cursors[2]; static GtkAdjustment *freq_ad; static GdkPixmap *pixmap = NULL, *spec_pixmap = NULL, *spcols_px = NULL; static guchar *rgbbuf = NULL; static short *levbuf = NULL; static int n, n_zoom = 1, l = 600; static int window_width, window_height; static int pixmap_width, pixmap_height, pixmap_ofs; static float min_freq, max_freq, center_freq; static gint x_down, y_down; /* for mouse button press event */ static unsigned char colortab[256 * 3]; static gint sel_width, sel_height; /* area selected for JPEG save */ GdkPixbuf *pixbuf = NULL; /* pixbuf used for saving spectrum images */ /* received signal strenght values */ float sig_pwr = 0, sig_mean_pwr = 0, floor_pwr = 0, floor_mean_pwr = 0; static float peak_pwr; static unsigned int peak_bin; /* function prototypes */ static void selection_button_press_event(GtkWidget * widget, GdkEventButton * event); static void get_main_menu(GtkWidget * window, GtkWidget ** menu_bar); static gint delete_event(GtkWidget * widget, GdkEvent * event, gpointer data); static gboolean drawing_area_expose_event(GtkWidget * widget, GdkEventExpose * event, gpointer user_data); static int drawing_area_configure_event(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data); static gdouble da_to_act_y(gint y); static gboolean drawing_area_motion_event(GtkWidget * widget, GdkEventMotion * event, gpointer data); static void selection_event(GtkWidget * widget, GdkEventMotion * event, gpointer data); static gboolean drawing_area_button_press_event(GtkWidget * widget, GdkEventButton * event); static void select_soundcard_source(GtkWidget * widget, gpointer data); static void select_mode(GtkWidget * widget, gpointer data); static void save_full_pixmap(GtkWidget * widget, gpointer data); static void save_pixmap_region(GtkWidget * widget, gpointer data); static void spectrum_file_save(gchar *filename); static void insert_avg_frames(void); static void remove_avg_frames(void); static int x_cur; // EG current horizontal position in the spectrogram window /* void jason_mode(GtkWidget * widget, gpointer data) { } */ static GtkItemFactoryEntry menu_items[] = { {"/_Source", NULL, NULL, 0, ""}, {"/Source/_Open file", "O", open_file_dialog, 0, NULL}, {"/Source/_Sound card", "S", select_soundcard_source, 0, NULL}, {"/Source/sep1", NULL, NULL, 0, ""}, {"/Source/Quit", "Q", gtk_main_quit, 0, NULL}, {"/_Mode", NULL, NULL, 0, ""}, {"/_Mode/FFT", NULL, select_mode, MODE_FFT, ""}, {"/_Mode/MTM", NULL, select_mode, MODE_MTM, "/Mode/FFT"}, {"/_Mode/HPARMA", NULL, select_mode, MODE_HPARMA, "/Mode/FFT"}, {"/_Mode/LMP", NULL, select_mode, MODE_LMP, "/Mode/FFT"}, {"/Settings", NULL, NULL, 0, ""}, {"/Settings/Spectrum", NULL, spec_settings_dialog, 0, NULL}, {"/Settings/QRSS", NULL, qrss_settings_dialog, 0, NULL}, {"/Settings/Port", NULL, port_settings_dialog, 0, NULL}, {"/Settings/Audio", NULL, audio_settings_dialog, 0, NULL}, {"/QSO", NULL, NULL, 0, ""}, {"/QSO/Message", NULL, create_txmsg_window, 0, NULL}, /* {"/Jason", NULL, jason_mode, 0, NULL}, */ {"/Save", NULL, NULL, 0, ""}, {"/Save/Full Spectrgram", NULL, save_full_pixmap, 0, NULL}, {"/Save/Select region", NULL, save_pixmap_region, 0, NULL}, {"/Test", NULL, tx_test_dialog, 0, NULL}, {"/Scope", NULL, scope_window_init, 0, NULL}, {"/_Help", NULL, NULL, 0, ""}, {"/_Help/About", NULL, show_about, 0, NULL}, {"/_Help/License", NULL, show_license, 0, NULL}, }; static void get_main_menu(GtkWidget * window, GtkWidget ** menu_bar) { GtkItemFactory *item_factory; GtkAccelGroup *accel_group; gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]); accel_group = gtk_accel_group_new(); item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", accel_group); gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, item_factory); /* if startup file not loaded disable transmissions */ glfer.test_menu_item = gtk_item_factory_get_widget(item_factory, "/Test"); glfer.qso_menu_item = gtk_item_factory_get_widget(item_factory, "/QSO"); if (glfer.init_done == FALSE) { gtk_widget_set_sensitive(glfer.qso_menu_item, FALSE); gtk_widget_set_sensitive(glfer.test_menu_item, FALSE); } gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); if (menu_bar) *menu_bar = gtk_item_factory_get_widget(item_factory, "
"); } static gint update_avgmax(gpointer data) { GtkWidget *label; GString *buf_1 = g_string_new(NULL); label = (GtkWidget *) data; if (opt.averaging == AVG_PLAIN) g_string_sprintf(buf_1, " %2.1f/%2.1fdB ", 10.0 * log10(glfer.avgmax), 10.0 * log10(glfer.peakval)); else if (opt.averaging != NO_AVG) g_string_sprintf(buf_1, " %2.1fdB ", 10.0 * log10(glfer.avgmax)); else g_string_sprintf(buf_1, " n/a "); gtk_label_set_text(GTK_LABEL(label), buf_1->str); g_string_free(buf_1, TRUE); /* don't stop calling this idle function */ return TRUE; } static gint update_avgvar(gpointer data) { GtkWidget *label; GString *buf_1 = g_string_new(NULL); label = (GtkWidget *) data; if (opt.averaging == AVG_SUMAVG) g_string_sprintf(buf_1, " %2.1fdB ", 10.0 * log10(glfer.avgmax / glfer.avgvar)); else g_string_sprintf(buf_1, " n/a "); gtk_label_set_text(GTK_LABEL(label), buf_1->str); g_string_free(buf_1, TRUE); /* don't stop calling this idle function */ return TRUE; } static gint update_avgfill(gpointer data) { GtkWidget *label; GString *buf_1 = g_string_new(NULL); label = (GtkWidget *) data; if (glfer.avgfill < opt.avgsamples) g_string_sprintf(buf_1, " %2.1f%% ", 100.0 * ((float) glfer.avgfill / (float) opt.avgsamples)); else g_string_sprintf(buf_1, " 100.0%%"); gtk_label_set_text(GTK_LABEL(label), buf_1->str); g_string_free(buf_1, TRUE); /* don't stop calling this idle function */ return TRUE; } static gint update_peakfreq(gpointer data) { GtkWidget *label; GString *buf_1 = g_string_new(NULL); label = (GtkWidget *) data; if (opt.averaging != NO_AVG) g_string_sprintf(buf_1, " %.1fHz ", glfer.peakfreq + opt.offset_freq); else g_string_sprintf(buf_1, " n/a "); gtk_label_set_text(GTK_LABEL(label), buf_1->str); g_string_free(buf_1, TRUE); /* don't stop calling this idle function */ return TRUE; } static gint update_pwr(gpointer data) { GtkWidget *label; GString *buf_1 = g_string_new(NULL); label = (GtkWidget *) data; //sig_mean_pwr = sig_mean_pwr * 0.999 + sig_pwr * 0.001; //floor_mean_pwr = floor_mean_pwr * 0.999 + floor_pwr * 0.001; sig_mean_pwr = sig_pwr; floor_mean_pwr = floor_pwr; g_string_sprintf(buf_1, " S: %5.1lf N: %5.1lf S/N: %5.1lf ", 10 * log10(sig_mean_pwr), 10 * log10(floor_mean_pwr), 10 * log(sig_mean_pwr) - 10 * log(floor_mean_pwr)); gtk_label_set_text(GTK_LABEL(label), buf_1->str); g_string_free(buf_1, TRUE); /* don't stop calling this idle function */ return TRUE; } static gint update_peak(gpointer data) { GtkWidget *label; GString *buf_1 = g_string_new(NULL); label = (GtkWidget *) data; g_string_sprintf(buf_1, " Power: %5.1le at bin %5.1i ", peak_pwr, peak_bin); gtk_label_set_text(GTK_LABEL(label), buf_1->str); g_string_free(buf_1, TRUE); /* don't stop calling this idle function */ return TRUE; } static gint update_cpu_usage(gpointer data) { GtkWidget *label; GString *buf_1 = g_string_new(NULL); static float cpu_usage = 0.0; label = (GtkWidget *) data; /* filter */ cpu_usage = 0.1 * glfer.cpu_usage + 0.9 * cpu_usage; g_string_sprintf(buf_1, " %.2f%% ", cpu_usage * 100.0); gtk_label_set_text(GTK_LABEL(label), buf_1->str); g_string_free(buf_1, TRUE); /* don't stop calling this idle function */ return TRUE; } static void select_soundcard_source(GtkWidget * widget, gpointer data) { stop_reading_audio(); close_audio(); /* close current audio source (not really needed if we are currently reading from soundcard */ init_audio(NULL); start_reading_audio(); glfer.first_buffer = TRUE; /* need to reinitialize display autoscale */ } static gint delete_event(GtkWidget * widget, GdkEvent * event, gpointer data) { return FALSE; } /* copy spcol_px pixmap content onto spec_da on exposure */ static gboolean cols_da_expose_event(GtkWidget * widget, GdkEventExpose * event, gpointer user_data) { /* copy the relevant portion of the pixmap onto the screen */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], spec_pixmap, event->area.x, pixmap_ofs + event->area.y, event->area.x, event->area.y, event->area.width, event->area.height); return FALSE; } static int spcols_da_configure_event(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data) { if (spcols_px) { gdk_drawable_unref(spcols_px); } /* create a new pixmap */ spcols_px = gdk_pixmap_new(widget->window, SPEC_DA_WIDTH, 20, -1); /* clear the new pixmap */ gdk_draw_rectangle(spcols_px, widget->style->fg_gc[GTK_WIDGET_STATE(drawing_area)], TRUE, 0, 0, SPEC_DA_WIDTH, 20); return TRUE; } /* copy spec_pixmap content onto spec_da on exposure */ static gboolean spec_da_expose_event(GtkWidget * widget, GdkEventExpose * event, gpointer user_data) { /* copy the relevant portion of the pixmap onto the screen */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], spec_pixmap, event->area.x, pixmap_ofs + event->area.y, event->area.x, event->area.y, event->area.width, event->area.height); // g_print("expose event! x=%i y=%i w=%i h=%i pixmap_ofs=%i\n", event->area.x, event->area.y, event->area.width, event->area.height, pixmap_ofs); return FALSE; } static int spec_da_configure_event(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data) { if (spec_pixmap) { gdk_drawable_unref(spec_pixmap); } /* create a new pixmap */ spec_pixmap = gdk_pixmap_new(widget->window, SPEC_DA_WIDTH, pixmap_height, -1); /* clear the new pixmap */ gdk_draw_rectangle(spec_pixmap, widget->style->fg_gc[GTK_WIDGET_STATE(drawing_area)], TRUE, 0, 0, SPEC_DA_WIDTH, pixmap_height); return TRUE; } /* copy pixmap content onto drawing_area on exposure */ static gboolean drawing_area_expose_event(GtkWidget * widget, GdkEventExpose * event, gpointer user_data) { /* copy the relevant portion of the pixmap onto the screen */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, event->area.x, pixmap_ofs + event->area.y, event->area.x, event->area.y, event->area.width, event->area.height); // g_print("expose event! x=%i y=%i w=%i h=%i pixmap_ofs=%i\n", event->area.x, event->area.y, event->area.width, event->area.height, pixmap_ofs); return FALSE; } static int drawing_area_configure_event(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data) { GdkPixmap *new_pixmap; int new_l, new_n_zoom = 0; D(printf("configure event: widget = %p, all_height = %i, all_width = %i\n", widget, widget->allocation.height, widget->allocation.width)); /* for debug */ D(printf("configure event: event_height = %i, event_width = %i\n", event->height, event->width)); /* for debug */ /* do lots of stuff when the window changes size */ /* if the window height isn't an integer multiple of n, set it to one */ //pixmap_height = event->height; //pixmap_width = event->width; /* set the pixmap_width/height to the dimensions of the drawing area */ //pixmap_height = widget->allocation.height; pixmap_width = widget->allocation.width; //gdk_window_resize(drawing_area->window, pixmap_width, pixmap_height); //gtk_widget_set_usize(GTK_WIDGET(drawing_area->window), -1, -1); //gtk_widget_set_usize(GTK_WIDGET(drawing_area->window), pixmap_width, pixmap_height); //gtk_widget_queue_resize(GTK_WIDGET(drawing_area)); /* this is the zoom factor needed to fill the entire drawing area */ //new_n_zoom = pixmap_height / n; if (new_n_zoom == 0) new_n_zoom = 1; /* new drawing area length */ new_l = pixmap_width; /* create a new pixmap */ new_pixmap = gdk_pixmap_new(widget->window, pixmap_width, pixmap_height, -1); /* clear the new pixmap */ gdk_draw_rectangle(new_pixmap, widget->style->fg_gc[GTK_WIDGET_STATE(drawing_area)], TRUE, 0, 0, pixmap_width, pixmap_height); if (pixmap) { gdk_draw_drawable(new_pixmap, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, 0, 0, 0, 0, (new_l > l) ? l : new_l, (new_n_zoom > n_zoom) ? n_zoom * n : new_n_zoom * n); gdk_drawable_unref(pixmap); FREE_MAYBE(rgbbuf); } pixmap = new_pixmap; n_zoom = new_n_zoom; l = new_l; rgbbuf = calloc(3 * n * n_zoom, sizeof(guchar)); if (levbuf) free(levbuf); //fprintf(stderr, "levbuf[%i*%i] size requested = %i\n", pixmap_width, pixmap_height, pixmap_width * pixmap_height * sizeof(short)); levbuf = calloc(pixmap_width * pixmap_height, sizeof(short)); if (!levbuf) { fprintf(stderr, "Error allocating levbuf"); exit(-1); } D(printf("configure event: nzoom = %i, p_height = %i, p_width = %i\n\n", n_zoom, pixmap_height, pixmap_width)); /* for debug */ return TRUE; } /* da_to_act_x, converts the pixmap x-coordinate to its real x-coordinate (time) */ static float da_to_act_x(float x) { float time; float time_unit = ((float) opt.data_block_size / (float) opt.sample_rate) * (1.0 - opt.data_blocks_overlap); if (x - x_cur < 0) time = time_unit * (x - x_cur); else time = time_unit * (x - x_cur - pixmap_width); return time; } /* da_to_act_x, converts the pixmap x-coordinate to its real x-coordinate (time) relative to spectrogram window */ static float da_to_act_x_rel(float x) { float time_unit = ((float) opt.data_block_size / (float) opt.sample_rate) * (1.0 - opt.data_blocks_overlap); return x * time_unit; } /* da_to_act_y, converts the pixmap y-coordinate to its real y-coordinate */ static gdouble da_to_act_y(gint y) { gdouble freq; /* y can go from 0 to (pixmap_height - 1) */ freq = opt.offset_freq + min_freq + (max_freq - min_freq) * (1.0 - y / (pixmap_height - 1.0)); return fabs(freq); } static gint motion_notify_event(GtkWidget * widget, GdkEventMotion * event) { int x, y; GdkModifierType state; if (event->is_hint) gdk_window_get_pointer(event->window, &x, &y, &state); else { x = event->x; y = event->y; state = event->state; } // if (state & GDK_BUTTON1_MASK && pixmap != NULL) draw_brush(widget, x, y); /* let event be processed by any further callback */ return FALSE; } static gboolean drawing_area_motion_event(GtkWidget * widget, GdkEventMotion * event, gpointer data) { GtkWidget *label; GString *buf_1 = g_string_new(NULL); label = (GtkWidget *) data; g_string_sprintf(buf_1, "%.3f Hz %.3f/%.3fs %3.2i dB", da_to_act_y(event->y), da_to_act_x(event->x), da_to_act_x_rel(event->x), levbuf[(int) (event->x * pixmap_height + event->y)]); gtk_label_set_text(GTK_LABEL(label), buf_1->str); g_string_free(buf_1, TRUE); /* let event be processed by any further callback */ return FALSE; } /* selection_event, this callback is registered after a mouse button has been * pressed in the drawing area, it erases the ?last? rectangle and draws * another to represent the area the user has selected. the callback is * unregistered when the user releases the mouse button */ static void selection_event(GtkWidget * widget, GdkEventMotion * event, gpointer data) { static gint x_left = 0, y_top = 0; static gint x_right = 0, y_bottom = 0; gint x, y; /* vanish the last selection */ /* top horizontal line of rectangle */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, x_left, y_top, x_left, y_top, x_right - x_left, 1); /* left vertical line of rectangle */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, x_left, y_top, x_left, y_top, 1, y_bottom - y_top); /* bottom horizontal line of rectangle */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, x_left, y_bottom, x_left, y_bottom, x_right - x_left + 1, 1); /* right vertical line of rectangle */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, x_right, y_top, x_right, y_top, 1, y_bottom - y_top); //gdk_gc_set_foreground(sel_gc, m_colors.sel); gdk_gc_set_line_attributes(sel_gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); x = (gint) event->x; y = (gint) event->y; x_left = (x_down < x) ? x_down : x; x_right = (x_down > x) ? x_down : x; y_top = (y_down < y) ? y_down : y; y_bottom = (y_down > y) ? y_down : y; gdk_draw_rectangle(widget->window, sel_gc, FALSE, x_left, y_top, x_right - x_left, y_bottom - y_top); // fprintf(stderr, "%i %i %i %i\n", x_left, x_right, y_top, y_bottom); } /* release_event, event that occurs when the user releases button on the * drawing area */ static void release_event(GtkWidget * widget, GdkEventButton * event, gpointer data) { gint x_up, y_up; gdouble x_left, x_right; gdouble y_top, y_bottom; /* remove the selection callback, and this callback */ gtk_signal_disconnect_by_func(GTK_OBJECT(widget), G_CALLBACK(selection_button_press_event), NULL); gtk_signal_disconnect_by_func(GTK_OBJECT(widget), G_CALLBACK(release_event), NULL); gtk_signal_disconnect_by_func(GTK_OBJECT(widget), G_CALLBACK(selection_event), NULL); /* put the normal cursor back */ gdk_window_set_cursor(widget->window, cursors[0]); x_up = (gint) event->x; y_up = (gint) event->y; /* if the user pressed and released the button nearby, we'll let 'em off */ if ((abs(x_up - x_down) < MINSEL) && (abs(y_up - y_down) < MINSEL)) return; /* check for zero width or zero height */ if ((x_up == x_down) || (y_up == y_down)) return; x_left = (x_down < x_up) ? x_down : x_up; x_right = (x_down > x_up) ? x_down : x_up; y_top = (y_down < y_up) ? y_down : y_up; y_bottom = (y_down > y_up) ? y_down : y_up; /* vanish the selection */ /* top horizontal line of rectangle */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, x_left, y_top, x_left, y_top, x_right - x_left, 1); /* left vertical line of rectangle */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, x_left, y_top, x_left, y_top, 1, y_bottom - y_top); /* bottom horizontal line of rectangle */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, x_left, y_bottom, x_left, y_bottom, x_right - x_left + 1, 1); /* right vertical line of rectangle */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixmap, x_right, y_top, x_right, y_top, 1, y_bottom - y_top); sel_width = x_right - x_left + 1; sel_height = y_bottom - y_top + 1; D(printf("x_left = %f, y_top = %f, x_right = %f, y_bottom = %f\n", x_left, y_top, x_right, y_bottom)); /* for debug */ if (event->button == 1) { pixbuf = gdk_pixbuf_get_from_drawable(pixbuf, pixmap, gdk_rgb_get_colormap(), x_left, y_top, 0, 0, sel_width, sel_height); save_spect_dialog(widget, NULL); } } /* show the frequency in a suitable place (How suitable is stdout?) */ /* for n_zoom>1, accuracy could be better */ static gboolean drawing_area_button_press_event(GtkWidget * widget, GdkEventButton * event) { if (event->button == 1) { D(printf("frequency: %.0f Hz\n", da_to_act_y(event->y))); /* for debug */ } return FALSE; /* event should be propagated further, as it might be handled by other callbacks */ } void selection_button_press_event(GtkWidget * widget, GdkEventButton * event) { if (event->button == 1) { /* store the press coordinates */ x_down = (gint) event->x; y_down = (gint) event->y; /* connect the motion signal so we see a rectangle */ g_signal_connect(G_OBJECT(widget), "motion_notify_event", G_CALLBACK(selection_event), NULL); /* connect the release signal to process the selected region */ g_signal_connect(G_OBJECT(widget), "button_release_event", G_CALLBACK(release_event), NULL); } } /* 0.3.5 EG became obsolete static void freq_ad_changed(GtkWidget * widget, gpointer data) { GtkAdjustment *adj = GTK_ADJUSTMENT(widget); pixmap_ofs = adj->value; } */ void stop_start_button_set_label(gchar * label) { /* change label on main window button */ gtk_label_set_text(GTK_LABEL(GTK_BIN(stop_start_bu)->child), label); } /* most of this function was taken from specgrm2, */ /* Copyright (C) 1995 Philip VanBaren */ void set_palette(int p_n) { long c, color, _draw_colors = 256; unsigned char *p = colortab; //p[0] = p[1] = p[2] = 0; //p[3] = p[4] = p[5] = 255; //p[6] = p[7] = p[8] = 64; //p += 9; for (c = 0; c < _draw_colors; c++) { color = c * 256; color /= _draw_colors; if (p_n == HSV) { /* HSV */ if (color < 64) { *(p++) = 0; *(p++) = (unsigned char) (color * 4.0); *(p++) = 255; } else if (color < 128) { *(p++) = 0; *(p++) = 255; *(p++) = (unsigned char) (510.0 - color * 4.0); } else if (color < 192) { *(p++) = (unsigned char) (color * 4.0 - 510.0); *(p++) = 255; *(p++) = 0; } else { *(p++) = 255; *(p++) = (unsigned char) (1020.0 - color * 4.0); *(p++) = 0; } } else if (p_n == THRESH) { /* Thresholded HSV */ if (color < 16) { *(p++) = 0; *(p++) = 0; *(p++) = 0; } else if (color < 64) { *(p++) = 0; *(p++) = (unsigned char) (color * 4.0); *(p++) = 255; } else if (color < 128) { *(p++) = 0; *(p++) = 255; *(p++) = (unsigned char) (510.0 - color * 4.0); } else if (color < 192) { *(p++) = (unsigned char) (color * 4.0 - 510.0); *(p++) = 255; *(p++) = 0; } else { *(p++) = 255; *(p++) = (unsigned char) (1020.0 - color * 4.0); *(p++) = 0; } } else if (p_n == COOL) { /* cool */ *(p++) = (unsigned char) color; *(p++) = (unsigned char) (255 - color); *(p++) = 255; } else if (p_n == HOT) { /* hot */ if (color < 96) { *(p++) = (unsigned char) (color * 2.66667 + 0.5); *(p++) = 0; *(p++) = 0; } else if (color < 192) { *(p++) = 255; *(p++) = (unsigned char) (color * 2.66667 - 254); *(p++) = 0; } else { *(p++) = 255; *(p++) = 255; *(p++) = (unsigned char) (color * 4.0 - 766.0); } } else if (p_n == BONE) { /* bone */ if (color < 96) { *(p++) = (unsigned char) (color * 0.88889); *(p++) = (unsigned char) (color * 0.88889); *(p++) = (unsigned char) (color * 1.20000); } else if (color < 192) { *(p++) = (unsigned char) (color * 0.88889); *(p++) = (unsigned char) (color * 1.20000 - 29); *(p++) = (unsigned char) (color * 0.88889 + 29); } else { *(p++) = (unsigned char) (color * 1.20000 - 60); *(p++) = (unsigned char) (color * 0.88889 + 29); *(p++) = (unsigned char) (color * 0.88889 + 29); } } else if (p_n == COPPER) { /* copper */ if (color < 208) { *(p++) = (unsigned char) (color * 1.23); *(p++) = (unsigned char) (color * 0.78); *(p++) = (unsigned char) (color * 0.5); } else { *(p++) = 255; *(p++) = (unsigned char) (color * 0.78); *(p++) = (unsigned char) (color * 0.5); } } else if (p_n == OTD) { /* where did I take this palette ?? */ if (color < 128) { *(p++) = 0; *(p++) = (unsigned char) (2.0 * color - 1.0); *(p++) = (unsigned char) (2.0 * (127.0 - color) + 1.0); } else { *(p++) = (unsigned char) (2.0 * (color - 127.0) - 1.0); *(p++) = (unsigned char) (2.0 * (255.0 - color) + 1.0); *(p++) = 0; } } else { /* Black and white */ *(p++) = (unsigned char) color; *(p++) = (unsigned char) color; *(p++) = (unsigned char) color; } } } GtkWidget *main_window_init(int nr, float min, float max) { GtkWidget *menu_bar; GtkWidget *tmp_hb, *button, *fr_frame, *freq_la, *pwr_frame, *cpu_frame, *peak_frame; if (window == NULL) { set_palette(opt.palette); /* { FILE *fout=fopen("pal", "w"); int c; set_palette(HSV); for (c = 0; c < 256; c++) fprintf(fout, "%i %i %i\n", colortab[3 * c], colortab[3 * c + 1], colortab[3 * c + 2]); fprintf(fout, "\n"); set_palette(THRESH); for (c = 0; c < 256; c++) fprintf(fout, "%i %i %i\n", colortab[3 * c], colortab[3 * c + 1], colortab[3 * c + 2]); fprintf(fout, "\n"); set_palette(COOL); for (c = 0; c < 256; c++) fprintf(fout, "%i %i %i\n", colortab[3 * c], colortab[3 * c + 1], colortab[3 * c + 2]); fprintf(fout, "\n"); set_palette(HOT); for (c = 0; c < 256; c++) fprintf(fout, "%i %i %i\n", colortab[3 * c], colortab[3 * c + 1], colortab[3 * c + 2]); fprintf(fout, "\n"); set_palette(BW); for (c = 0; c < 256; c++) fprintf(fout, "%i %i %i\n", colortab[3 * c], colortab[3 * c + 1], colortab[3 * c + 2]); fprintf(fout, "\n"); set_palette(BONE); for (c = 0; c < 256; c++) fprintf(fout, "%i %i %i\n", colortab[3 * c], colortab[3 * c + 1], colortab[3 * c + 2]); fprintf(fout, "\n"); set_palette(COPPER); for (c = 0; c < 256; c++) fprintf(fout, "%i %i %i\n", colortab[3 * c], colortab[3 * c + 1], colortab[3 * c + 2]); fprintf(fout, "\n"); set_palette(OTD); for (c = 0; c < 256; c++) fprintf(fout, "%i %i %i\n", colortab[3 * c], colortab[3 * c + 1], colortab[3 * c + 2]); fprintf(fout, "\n"); fclose(fout); } */ n = nr; min_freq = min; max_freq = max; center_freq = (max_freq + min_freq) / 2.0; /* main window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window_width = l + SPEC_DA_WIDTH; window_height = (n < 600 ? n : 600) + 200; gtk_window_set_default_size(GTK_WINDOW(window), window_width, window_height); gtk_window_set_title(GTK_WINDOW(window), PACKAGE_STRING); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE); //gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE); /* Create a vbox */ main_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), main_vb); gtk_widget_show(main_vb); /* Create the menu */ get_main_menu(window, &menu_bar); gtk_box_pack_start(GTK_BOX(main_vb), menu_bar, FALSE, FALSE, 0); gtk_widget_show(menu_bar); /* create a scrolled window */ scrolled_window = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); //GTK_POLICY_ALWAYS); gtk_box_pack_start(GTK_BOX(main_vb), scrolled_window, TRUE, TRUE, 0); /* Create a hbox */ tmp_hb = gtk_hbox_new(FALSE, 0); /* istantaneous spectrum drawing area */ spec_da = gtk_drawing_area_new(); gtk_drawing_area_size(GTK_DRAWING_AREA(spec_da), SPEC_DA_WIDTH, pixmap_height); g_signal_connect(G_OBJECT(spec_da), "expose_event", G_CALLBACK(spec_da_expose_event), NULL); g_signal_connect(G_OBJECT(spec_da), "configure_event", G_CALLBACK(spec_da_configure_event), NULL); // g_signal_connect(G_OBJECT(drawing_area), "button_press_event", G_CALLBACK(drawing_area_button_press_event), NULL); gtk_widget_set_events(spec_da, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); gtk_box_pack_start(GTK_BOX(tmp_hb), spec_da, FALSE, FALSE, 1); /* spectrogram drawing area */ drawing_area = gtk_drawing_area_new(); pixmap_height = n; pixmap_width = l; gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area), pixmap_width, pixmap_height); g_signal_connect(G_OBJECT(drawing_area), "expose_event", G_CALLBACK(drawing_area_expose_event), NULL); g_signal_connect(G_OBJECT(drawing_area), "configure_event", G_CALLBACK(drawing_area_configure_event), NULL); g_signal_connect(G_OBJECT(drawing_area), "button_press_event", G_CALLBACK(drawing_area_button_press_event), NULL); gtk_widget_set_events(drawing_area, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); gtk_box_pack_start(GTK_BOX(tmp_hb), drawing_area, TRUE, TRUE, 1); gtk_widget_show(drawing_area); //gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), spec_hbox); //gtk_widget_show(scrolled_window); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), tmp_hb); gtk_widget_show(tmp_hb); gtk_widget_show(spec_da); gtk_widget_show(scrolled_window); /* Create the frequency scrollbar and relative adjustment */ freq_ad = (GtkAdjustment *) gtk_adjustment_new(0, 0, n, 1, 100, pixmap_height); /* spect_vs = gtk_vscrollbar_new(GTK_ADJUSTMENT(freq_ad)); gtk_box_pack_start(GTK_BOX(tmp_hb), spect_vs, FALSE, FALSE, 0); gtk_widget_show(spect_vs); g_signal_connect (GTK_OBJECT (freq_ad), "value_changed", GTK_SIGNAL_FUNC (freq_ad_changed), drawing_area); */ gtk_widget_show(tmp_hb); /* Create a hbox */ tmp_hb = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(main_vb), tmp_hb, FALSE, FALSE, 0); //gtk_container_add(GTK_CONTAINER(main_vb), tmp_hb); /* Spectrogram info frame */ fr_frame = gtk_frame_new("Frequency Time (abs/rel) Power"); gtk_box_pack_start(GTK_BOX(tmp_hb), fr_frame, TRUE, TRUE, 5); gtk_widget_show(fr_frame); freq_la = gtk_label_new(NULL); gtk_container_add(GTK_CONTAINER(fr_frame), freq_la); gtk_widget_show(freq_la); g_signal_connect(G_OBJECT(drawing_area), "motion_notify_event", G_CALLBACK(drawing_area_motion_event), freq_la); g_signal_connect(G_OBJECT(drawing_area), "motion_notify_event", G_CALLBACK(motion_notify_event), freq_la); /* Peak level info frame */ peak_frame = gtk_frame_new("Spectrum peak info"); gtk_box_pack_start(GTK_BOX(tmp_hb), peak_frame, FALSE, FALSE, 5); gtk_widget_show(peak_frame); peak_la = gtk_label_new(NULL); gtk_container_add(GTK_CONTAINER(peak_frame), peak_la); gtk_widget_show(peak_la); gtk_widget_show(tmp_hb); /* Power frame */ pwr_frame = gtk_frame_new("Power level"); gtk_box_pack_start(GTK_BOX(tmp_hb), pwr_frame, FALSE, FALSE, 5); gtk_widget_show(pwr_frame); pwr_la = gtk_label_new(NULL); gtk_container_add(GTK_CONTAINER(pwr_frame), pwr_la); gtk_widget_show(pwr_la); gtk_widget_show(tmp_hb); /* CPU usage frame */ cpu_frame = gtk_frame_new("CPU usage"); gtk_box_pack_start(GTK_BOX(tmp_hb), cpu_frame, FALSE, FALSE, 5); gtk_widget_show(cpu_frame); cpu_la = gtk_label_new(NULL); gtk_container_add(GTK_CONTAINER(cpu_frame), cpu_la); gtk_widget_show(cpu_la); gtk_widget_show(tmp_hb); /* hbox for avg info */ avg_hb = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(main_vb), avg_hb, FALSE, FALSE, 0); /* Stop/Start button */ stop_start_bu = gtk_button_new_with_label("Start"); gtk_box_pack_start(GTK_BOX(main_vb), stop_start_bu, FALSE, FALSE, 10); g_signal_connect(G_OBJECT(stop_start_bu), "clicked", G_CALLBACK(toggle_stop_start), NULL); gtk_widget_show(stop_start_bu); /* ...quit button */ button = gtk_button_new_with_label("Quit"); gtk_box_pack_start(GTK_BOX(main_vb), button, FALSE, FALSE, 10); g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(window)); gtk_widget_show(button); gtk_widget_show(window); //sel_gc = gdk_gc_new(window->window); //gdk_gc_set_function (sel_gc, GDK_COPY); sel_gc = gdk_gc_new(window->window); gdk_gc_copy(sel_gc, window->style->black_gc); gdk_gc_set_function(sel_gc,GDK_INVERT); /* do the cursors */ cursors[0] = gdk_cursor_new(GDK_CROSSHAIR); cursors[1] = gdk_cursor_new(GDK_LEFT_PTR); gdk_window_set_cursor(drawing_area->window, cursors[0]); } else { n = nr; min_freq = min; max_freq = max; center_freq = (max_freq + min_freq) / 2.0; /* drawing area */ //drawing_area = gtk_drawing_area_new(); pixmap_height = n; pixmap_width = l; //freq_ad->lower = 0; freq_ad->upper = n; //freq_ad->pixmap_height = pixmap_height; gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area), pixmap_width, pixmap_height); //gtk_signal_emit_by_name(GTK_OBJECT(drawing_area), "configure_event"); /* force widget using the sdjustment to reconfigure */ gtk_signal_emit_by_name(GTK_OBJECT(freq_ad), "changed"); // gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area), drawing_area->allocation.x, drawing_area->allocation.y); //gtk_widget_show(drawing_area); //gdk_window_resize(drawing_area->window, pixmap_width, pixmap_height); //gtk_widget_queue_resize(GTK_WIDGET(drawing_area)); } /* if needed, insert or remove average info frames */ if (opt.averaging != NO_AVG) insert_avg_frames(); else remove_avg_frames(); glfer.first_buffer = TRUE; return window; } static void insert_avg_frames(void) { if (avgmax_frame == NULL) { // maximum above average spectral power avgmax_frame = gtk_frame_new("Max-Avg"); gtk_box_pack_start(GTK_BOX(avg_hb), avgmax_frame, FALSE, FALSE, 5); gtk_widget_show(avgmax_frame); avgmax_la = gtk_label_new(NULL); gtk_container_add(GTK_CONTAINER(avgmax_frame), avgmax_la); gtk_widget_show(avgmax_la); } if (avgvar_frame == NULL) { // variance above average spectral power avgvar_frame = gtk_frame_new("Max-Var"); gtk_box_pack_start(GTK_BOX(avg_hb), avgvar_frame, FALSE, FALSE, 5); gtk_widget_show(avgvar_frame); avgvar_la = gtk_label_new(NULL); gtk_container_add(GTK_CONTAINER(avgvar_frame), avgvar_la); gtk_widget_show(avgvar_la); } if (avgfill_frame == NULL) { // averaging buffer fill ratio avgfill_frame = gtk_frame_new("Avg Fill"); gtk_box_pack_start(GTK_BOX(avg_hb), avgfill_frame, FALSE, FALSE, 5); gtk_widget_show(avgfill_frame); avgfill_la = gtk_label_new(NULL); gtk_container_add(GTK_CONTAINER(avgfill_frame), avgfill_la); gtk_widget_show(avgfill_la); } if (peakfreq_frame == NULL) { // peak power frequency peakfreq_frame = gtk_frame_new("Peak F"); gtk_box_pack_start(GTK_BOX(avg_hb), peakfreq_frame, FALSE, FALSE, 5); gtk_widget_show(peakfreq_frame); peakfreq_la = gtk_label_new(NULL); gtk_container_add(GTK_CONTAINER(peakfreq_frame), peakfreq_la); gtk_widget_show(peakfreq_la); } gtk_widget_show(avg_hb); } static void remove_avg_frames(void) { /* remove the avg info frames */ if (avgmax_frame != NULL) { /* make sure the widget pointers are NULL after widget destruction */ g_signal_connect(G_OBJECT(avgmax_frame), "destroy", G_CALLBACK(gtk_widget_destroyed), &avgmax_frame); gtk_widget_destroy(avgmax_frame); } if (avgvar_frame != NULL) { g_signal_connect(G_OBJECT(avgvar_frame), "destroy", G_CALLBACK(gtk_widget_destroyed), &avgvar_frame); gtk_widget_destroy(avgvar_frame); } if (avgfill_frame != NULL) { g_signal_connect(G_OBJECT(avgfill_frame), "destroy", G_CALLBACK(gtk_widget_destroyed), &avgfill_frame); gtk_widget_destroy(avgfill_frame); } if (peakfreq_frame != NULL) { g_signal_connect(G_OBJECT(peakfreq_frame), "destroy", G_CALLBACK(gtk_widget_destroyed), &peakfreq_frame); gtk_widget_destroy(peakfreq_frame); } } /* draw the data onto the pixmap */ void main_window_draw(float *psdbuf) { GdkRectangle update_rect; int i, j, i_off; static int x = 0; int sx_old = 0, sx; float f, f_i, f_off; float tmpf = 0.0; static float display_max_lvl = 0, display_min_lvl = 0; float display_max, display_min; float sig_level, thr_level; unsigned char v; int minbin, maxbin; int peakbin; float binsize; int max0; // maximum to 0dB indicator if (x >= l) x = 0; /* avoid warning about unused variables */ i_off = 0; f_i = 0.0; f_off = 0.0; //i_off = opt.data_block_size * (fabs(opt.dfcw_dot_freq - opt.dfcw_dash_freq) / opt.sample_rate); thr_level = opt.thr_level / 100.0; /* normalize threshold level */ /* clear the spectrum amplitude pixmap */ gdk_draw_rectangle(spec_pixmap, spec_da->style->fg_gc[GTK_WIDGET_STATE(drawing_area)], TRUE, 0, 0, SPEC_DA_WIDTH, pixmap_height); #if 0 /* this generates a linear shape spectrum, useful for testing */ for (i = 0; i < n; i++) psdbuf[i] = i / (n - 1); #endif /* total signal power and mean noise floor power */ compute_floor(psdbuf, n, &sig_pwr, &floor_pwr, &peak_pwr, &peak_bin); if (opt.autoscale) { // EG only for (original) autoscale mode if (glfer.first_buffer == TRUE) { /* when settings are changed need to estimate the PSD taking into account that the "old" samples are all zero and only the "overlapped part" is actually filled with real data */ if (opt.data_blocks_overlap > 0.0) { sig_pwr /= opt.data_blocks_overlap; floor_pwr /= opt.data_blocks_overlap; } display_max_lvl = sig_pwr; display_min_lvl = floor_pwr; glfer.first_buffer = FALSE; } else { display_max_lvl = (1.0 - 0.99) * sig_pwr + 0.99 * display_max_lvl; display_min_lvl = (1.0 - 0.99) * floor_pwr + 0.99 * display_min_lvl; } } else { display_max_lvl = pow(10.0, opt.max_level_db / 10.0); display_min_lvl = pow(10.0, opt.min_level_db / 10.0); display_min_lvl = (display_max_lvl > display_min_lvl ? display_min_lvl : display_max_lvl / 10.0); // EG prevent stupid entries //display_max_lvl=1e-5; display_min_lvl=1e-10; // 0.3.4 EG experiment use fixed levels } if ((opt.scale_type == SCALE_LOG) || (opt.scale_type == SCALE_LOG_MAX0)) { // EG added MAX0 /* convert levels to dB */ display_max = 10.0 * log10(display_max_lvl); display_min = 10.0 * log10(display_min_lvl); } else { display_max = display_max_lvl; display_min = display_min_lvl; } //fprintf(stderr, "sig = %.3e\tfloor = %.3e\tdisp_max = %.3e\tdisp_min = %.3e\n", sig_pwr, floor_pwr, display_max_lvl, display_min_lvl); //fprintf(stderr, "display_max = %e\tdisplay_min = %e\n", display_max, display_min); binsize = (float) opt.sample_rate / (float) opt.data_block_size; minbin = (int) (opt.min_avgband / binsize); maxbin = (int) (opt.max_avgband / binsize); if ((opt.scale_type == SCALE_LIN_MAX0) || (opt.scale_type == SCALE_LOG_MAX0)) // EG set the max to 0dB indicator for sumavg and sumextreme max0 = 1; else max0 = 0; switch (opt.averaging) { case NO_AVG: glfer.avgmax = 1e-15; glfer.avgvar = 1e-15; glfer.peakfreq = 0.0; glfer.peakval = 0.0; break; case AVG_SUMAVG: glfer.avgmax = update_avg_sumavg(&avgdata, n, psdbuf, max0, minbin, maxbin, &peakbin, &glfer.avgvar); if (glfer.avgfill < opt.avgsamples) glfer.avgfill++; glfer.peakfreq = ((float) peakbin) * binsize; glfer.peakval = 0.0; break; case AVG_PLAIN: glfer.avgmax = update_avg_plain(&avgdata, n, psdbuf, minbin, maxbin, &peakbin); glfer.avgvar = 1e-15; if (glfer.avgfill < opt.avgsamples) glfer.avgfill++; glfer.peakfreq = ((float) peakbin) * binsize; glfer.peakval = avgdata.avg[peakbin]; break; case AVG_SUMEXTREME: glfer.avgmax = update_avg_sumextreme(&avgdata, n, psdbuf, max0, minbin, maxbin, &peakbin); glfer.avgvar = 1e-15; if (glfer.avgfill < opt.avgsamples) glfer.avgfill++; glfer.peakfreq = ((float) peakbin) * binsize; glfer.peakval = 0.0; break; } /* i is the pixmap y coordinate */ for (i = 0; i < n; i++) { /* max. value for psdbuf[i] should be 1, for sine wave input, due to */ /* the normalization in fft.c. min. value is 0 */ /* input relative value in dB below maximum */ if ((opt.scale_type == SCALE_LOG) || (opt.scale_type == SCALE_LOG_MAX0)) { // EG added MAX0 if (opt.averaging != NO_AVG) { sig_level = levbuf[x * pixmap_height + i] = 10.0 * log10(avgdata.avg[n - i - 1]); } else { sig_level = levbuf[x * pixmap_height + i] = 10.0 * log10(psdbuf[n - i - 1]); } } else { if (opt.averaging != NO_AVG) sig_level = avgdata.avg[n - i - 1]; else sig_level = psdbuf[n - i - 1]; /* levels buffer is always LOG */ levbuf[x * pixmap_height + i] = 10.0 * log10(sig_level); } f = 255 * ((sig_level - display_min) / (display_max - display_min)); /* be careful; v is unsigned char and will rollover when f<0 ! */ /* f_i = psdbuf[n - i - 1]; if (i < i_off) { f_off = psdbuf[n - i - 1]; v = f = 256 + 25 * log10(f_i); } else { f_off = psdbuf[n - i - 1 - i_off]; v = f = 256 + 25 * log10(f_i - f_off); } */ if (f < 255.0 * thr_level) { /* below threshold */ v = 0; D(fprintf(stderr, "below threshold (%.2f%%)!\n", thr_level * 100.0)); } else if (f > 255) { v = 255; D(fprintf(stderr, "over 255!\n")); } else { v = (f - 255.0 * thr_level) / (1.0 - thr_level); } for (j = 0; j < n_zoom; j++) { rgbbuf[3 * (n_zoom * i + j)] = colortab[3 * v]; rgbbuf[3 * (n_zoom * i + j) + 1] = colortab[3 * v + 1]; rgbbuf[3 * (n_zoom * i + j) + 2] = colortab[3 * v + 2]; } if (i == 0) { sx_old = SPEC_DA_WIDTH * f / 255.0; } else { sx = SPEC_DA_WIDTH * f / 255.0; /* draw spectrum amplitude pixmap */ gdk_draw_line(spec_pixmap, spec_da->style->white_gc, sx_old, i - 1, sx, i); sx_old = sx; } } /* draw threshold level line in current spectrum window */ gdk_draw_line(spec_pixmap, spec_da->style->white_gc, SPEC_DA_WIDTH * thr_level, 0, SPEC_DA_WIDTH * thr_level, n_zoom * n); /* draw an entire line of the spectrogram */ x_cur = x; gdk_draw_rgb_image(pixmap, drawing_area->style->fg_gc[GTK_STATE_NORMAL], x, 0, 1, n_zoom * n, GDK_RGB_DITHER_NONE, rgbbuf, 3); /* draw the boundary between old and new spectrogram */ gdk_draw_line(pixmap, drawing_area->style->fg_gc[GTK_STATE_NORMAL], x + 1, 0, x + 2, n_zoom * n); update_rect.x = x; update_rect.width = 2; update_rect.y = 0; update_rect.height = n_zoom * n; gtk_widget_draw(drawing_area, &update_rect); update_rect.x = 0; update_rect.width = SPEC_DA_WIDTH; update_rect.y = 0; update_rect.height = n_zoom * n; gtk_widget_draw(spec_da, &update_rect); update_cpu_usage(cpu_la); update_pwr(pwr_la); update_peak(peak_la); if (opt.averaging != NO_AVG) { update_avgmax(avgmax_la); update_avgvar(avgvar_la); update_avgfill(avgfill_la); update_peakfreq(peakfreq_la); } x++; } void main_window_close() { gdk_cursor_unref(cursors[0]); gdk_cursor_unref(cursors[1]); gdk_gc_unref(sel_gc); FREE_MAYBE(rgbbuf); gtk_main_quit(); } static void select_mode(GtkWidget * widget, gpointer data) { int mode_sel = (int) data; /* GtkCheckMenuItem *item = NULL; item = GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget(GTK_ITEM_FACTORY(widget), "/Mode/FFT")); g_print("FFT active : %i\n", item->active); item = GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget(GTK_ITEM_FACTORY(widget), "/Mode/MTM")); g_print("MTM active : %i\n", item->active); item = GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget(GTK_ITEM_FACTORY(widget), "/Mode/HPARMA")); g_print("HPARMA active : %i\n", item->active); */ #ifdef DEBUG switch (mode_sel) { case MODE_FFT: g_print("select_mode: MODE_FFT\n"); break; case MODE_MTM: g_print("select_mode: MODE_MTM\n"); break; case MODE_HPARMA: g_print("select_mode: MODE_HPARMA\n"); break; case MODE_LMP: g_print("select_mode: MODE_LMP\n"); break; default: g_print("select_mode: MODE_UNKNOWN\n"); } #endif change_params(mode_sel); } void save_full_pixmap(GtkWidget * widget, gpointer data) { pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_rgb_get_colormap(), 0, 0, 0, 0, pixmap_width, pixmap_height); save_spect_dialog(widget, NULL); } void save_pixmap_region(GtkWidget * widget, gpointer data) { /* change to the cursor used for selection */ gdk_window_set_cursor(drawing_area->window, cursors[1]); /* connect the press signal to start selection */ g_signal_connect(G_OBJECT(drawing_area), "button_press_event", G_CALLBACK(selection_button_press_event), NULL); } glfer-0.4.2/glfer.10000644000175000001440000001445611330652436010727 00000000000000.TH GLFER 1 "January 2010" "Version 0.4.2" .SH NAME glfer \- spectrogram display and QRSS keyer .SH SYNOPSIS .B glfer [\fIOPTIONS\fR] ... .SH DESCRIPTION .B glfer is a program that displays the power spectrum of a signal as a function of time in a format known as a waterfall display; this is also called a .B spectrogram. The horizontal axis represents time. The time scale depends on the sample rate and the number of points per FFT. The vertical axis represents frequency, from DC to the Nyquist frequency (half the sample rate). The estimated power of the input signal is indicated by the color; the spectrogram window has an automatic gain control (AGC) that ensures always the maximum visual contrast and which, in the current version, cannot be disabled. .PP Resizing the main window in the horizontal direction just changes the length of the time scale; resizing it in the vertical direction enlarges the portion of spectrum shown in the window. The entire spectrum can be seen by scrolling the spectrogram window using the scrollbar on the right. Moving the mouse pointer on the spectrogram window shows the frequency corresponding to the pointer position and the signal power at that frequency on the status line at the bottom. .PP The first time glfer is run it will ask to select a control port (serial or parallel) for the TX keying functions; if the mouse is connected to the serial port be sure NOT to select its serial port for controlling the TX otherwise the system may hang. All the settings can be saved to a configuration file; in this case they will be automatically loaded when glfer is launched. .PP Please note that the program must be run as root (or suid root) to gain access to the transmitter control (parallel or serial) port. .PP You may have to use a separate mixer program to adjust the input volume and to enable the desired input. .SH SPECTRAL ESTIMATORS \fIglfer\fR can use several different spectral estimators to compute the input signal power spectrum: .SS Periodogram the "classical" periodogram, which is obtained as the squared amplitude of the discrete Fourier transform, after tapering the data with a "window function" selectable among the Hanning, Blackman, Gaussian, Welch, Bartlett, Rectangular, Hamming and Kaiser types. As usual, the FFT number of points and the overlap between data blocks can be freely changed. .SS Multitaper method The multitaper method is a weighted combination of periodograms computed with different windows, all belonging to the same family and having certain peculiar properties. .PP This method was described by David J. Thomson in "Spectrum Estimation and Harmonic Analysis", Proc. IEEE, vol.70, Sep. 1982. Besides the FFT size and overlap, it is possible to change also a relative bandwidth parameter and the number of windows to use for the analysis. .PP This method requires more CPU power than the first one, due to the fact that several FFTs are performed on the same block of data, using different windows. The resulting spectrum is similar to a classical periodogram, but with much less variance (i.e. less variation in the background noise [speckle]). Performances are also similar to the periodogram, maybe it makes detection of QRSS signals a little easier, but this doesn't means they are always more readable. .SS High performance ARMA The (so called) "high performance" ARMA model assumes that the input signal is composed only of white noise plus a certain number of sinusoids and tries to extract the relevant parameters (sinusoids frequency and strenght) from the data. .PP Reference article for this implementation is "Spectral An Overdetermined Rational Model Equation Approach", by James A. Cadzow, Proc. IEEE, vol.70, Sep. 1982. .PP At present this method is still experimental. There are two parameters that can be varied: t is the number of samples used for computing the samples autocorrelation and p_e is the order of the AR model. This latter must be less than t, and both number should be fairly small in order not to overload the CPU. The number of sinusoids is estimated autimatically from the samples autocorrelation. Use the default numbers as a starting point and experiment! Unfortunately this spectral estimator performs poorly with non-white noise (as we have usually in the RX audio, due to the IF filters) and high noise levels. On the other hand it provides a very good visual SNR with signals not buried in the noise .SS LMP This method is experimental .SH OPTIONS .TP .B "\-d, \-\-device FILE\" use \fIFILE\fR as audio device (default: /dev/dsp) .TP .B "\-f, \-\-file FILENAME" take audio input from \fIFILENAME\fR (WAV format) .TP .B "\-s, \-\-sample_rate RATE" set audio sample rate to \fIRATE\fR Hertz (default: 8000) .TP .B "\-n\ N\" number of points per FFT to N (preferably a power of 2, default: 1024) .TP .B "\-h, \-\-help" print the help .TP .B "\-v, \-\-version" display the version of glfer and exit .SH FILES .TP .B "~/.glferrc" User startup file. .SH BUGS There was some report of problems in the audio acquisition routine, it seems that some audio card/driver don't work well with \fIselect\fR; this needs further investigation .SH TODO Maybe the Spectrogram should scroll as in other programs, all the picture moving right to left .PP Jason decoder (in progress) .PP Spectrogram speed independent of FFT size .SH VERSION INFORMATION This man page documents .IR glfer , version 0.4.2 .SH AUTHOR glfer was written by Claudio Girardi .SH "REPORTING BUGS" You are welcome to send bug reports to Claudio Girardi . It would be helpful to include with the bug description also the output of the \fIconfigure\fR script. .SH COPYRIGHT Copyright \(co 2010 Claudio Girardi .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA .br glfer-0.4.2/mtm.c0000644000175000001440000001522511057326412010500 00000000000000/* mtm.c * Copyright (C) 2002 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_LIBRFFTW #include #else #include "fft_radix2.h" #endif /* HAVE_LIBRFFTW */ #include "glfer.h" #include "util.h" #include "mtm.h" #include "fft.h" #include "bell-p-w.h" #include "g-l_dpss.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif extern opt_t opt; static float *psdbuftmp = NULL; static float *hn = NULL; #ifdef HAVE_LIBRFFTW static fftw_real *mu = NULL; #else static float *mu = NULL; #endif /* HAVE_LIBRFFTW */ static float *ftest = NULL; static double *U0 = NULL; static float sum_U0_sqr; static void compute_dspwf(mtm_params_t * params) { int i, j, ifault, totit; int n = params->fft.n; int kmax = params->kmax; double w = params->w; double **v = params->window; double *sig = params->sig; // ifault = dpss(n, kmax, n, w, v, sig, &totit); ifault = gl_dpss(n, kmax, n, w, v, sig, &totit); if (ifault != 0) fprintf(stderr, "Error: ifault = %i\n", ifault); for (j = 0; j <= kmax; j++) { U0[j] = 0.0; for (i = 1; i <= n; i++) { U0[j] += v[i][j]; } D(fprintf(stderr, "sig[%i] = %e\n", j, sig[j])); } } void mtm_init(mtm_params_t * params) { int i, j; int n = params->fft.n; int kmax = params->kmax; double **v = params->window; #ifdef HAVE_LIBRFFTW params->fft.plan = rfftw_create_plan(n, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE); params->fft.inbuf_audio = calloc(n, sizeof(fftw_real)); params->fft.inbuf_fft = calloc(n, sizeof(fftw_real)); params->fft.outbuf = calloc(n, sizeof(fftw_real)); mu = calloc(n, sizeof(fftw_real)); #else params->fft.inbuf_audio = calloc(n, sizeof(float)); params->fft.inbuf_fft = calloc(n, sizeof(float)); params->fft.outbuf = params->fft.inbuf_fft; mu = calloc(n, sizeof(float)); #endif /* HAVE_LIBRFFTW */ params->fft.sub_mean = opt.autoscale; // sub_mean only if autoscale (?) psdbuftmp = calloc(n, sizeof(float)); hn = calloc(n, sizeof(float)); ftest = calloc(n, sizeof(float)); /* allocate space for the dspwf */ params->window = dmatrix(1, n, 0, kmax); params->sig = dvector(0, kmax); U0 = dvector(0, kmax); compute_dspwf(params); v = params->window; sum_U0_sqr = 0.0; for (j = 0; j <= kmax; j++) { sum_U0_sqr += U0[j] * U0[j]; } for (i = 0; i < n; i++) { hn[i] = 0.0; for (j = 0; j <= kmax; j++) { hn[i] += U0[j] * v[i + 1][j]; } hn[i] /= sum_U0_sqr; } #ifdef FIXME for (j = 0; j <= kmax; j++) { FILE *fff; char fffname[10]; sprintf(fffname, "v%i", j); fff = fopen(fffname, "w"); for (i = 0; i < n; i++) { fprintf(fff, "%e\n", v[i + 1][j]); } fclose(fff); } #endif } void mtm_do(float *audio_buf, float *psd_buf, float *phase_buf, mtm_params_t * params) { int i, j; int n_fft = params->fft.n; int k = params->kmax; double tmpr, tmpi, num_ftest; /* apply overlap, limting, windowing, etc. according to active options */ prepare_audio(audio_buf, ¶ms->fft); /* compute mu(f) from the data sequence */ for (i = 0; i < n_fft; i++) { /* apply window hn to the sequence */ params->fft.inbuf_fft[i] = params->fft.inbuf_audio[i] * hn[i]; } /* compute mu(f) with a fft */ #ifdef HAVE_LIBRFFTW rfftw_one(params->fft.plan, params->fft.inbuf_fft, mu); #else fft_real_radix2_transform(params->fft.inbuf_fft, n_fft); #endif /* HAVE_LIBRFFTW */ //fft_psd(psdbuf, NULL, ¶ms->fft); //draw_spect(n_fft / 2, psdbuf, "mu(f)", PLOT_LOG, 470); for (i = 0; i < (n_fft + 1) / 2; i++) { psd_buf[i] = 0.0; ftest[i] = 0.0; } if (n_fft % 2 == 0) { psd_buf[n_fft / 2] = 0.0; ftest[n_fft / 2] = 0.0; } for (j = 0; j <= k; j++) { for (i = 0; i < n_fft; i++) { params->fft.inbuf_fft[i] = params->window[i + 1][j] * params->fft.inbuf_audio[i]; } /* compute the fft */ #ifdef HAVE_LIBRFFTW rfftw_one(params->fft.plan, params->fft.inbuf_fft, params->fft.outbuf); #else fft_real_radix2_transform(params->fft.inbuf_fft, n_fft); #endif /* HAVE_LIBRFFTW */ /* now outbuf contains y_k(f) */ /* compute DC case */ tmpr = params->fft.outbuf[0] - mu[0] * U0[j]; /* real part */ ftest[0] += tmpr * tmpr; /* this is actually the denominator */ for (i = 1; i < (n_fft + 1) / 2; i++) { tmpr = params->fft.outbuf[i] - mu[i] * U0[j]; /* real part */ tmpi = params->fft.outbuf[n_fft - i] - mu[n_fft - i] * U0[j]; /* imag part */ ftest[i] += tmpr * tmpr + tmpi * tmpi; /* this is actually the denominator */ } fft_psd(psdbuftmp, NULL, ¶ms->fft); /* add weighted eigenspectrum estimate */ for (i = 0; i < (n_fft + 1) / 2; i++) { psd_buf[i] += psdbuftmp[i] / (1.0 + params->sig[j]); } if (n_fft % 2 == 0) { psd_buf[n_fft / 2] += psdbuftmp[n_fft / 2] / (1.0 + params->sig[j]); } } /* compute DC case */ num_ftest = k * (mu[0] * mu[0]) * sum_U0_sqr; ftest[0] = num_ftest / ftest[0]; for (i = 1; i < (n_fft + 1) / 2; i++) { num_ftest = k * (mu[i] * mu[i] + mu[n_fft - i] * mu[n_fft - i]) * sum_U0_sqr; ftest[i] = num_ftest / ftest[i]; } if (n_fft % 2 == 0) { i = n_fft / 2; num_ftest = k * (mu[i] * mu[i] + mu[n_fft - i] * mu[n_fft - i]) * sum_U0_sqr; ftest[i] = num_ftest / ftest[i]; } /* for (i = 0; i < (n_fft + 1) / 2; i++) { psd_buf[i] = mu[i] * mu[i]; //psd_buf[i] = ftest[i]; } */} void mtm_close(mtm_params_t * params) { int n = params->fft.n; int kmax = params->kmax; FREE_MAYBE(params->fft.inbuf_audio); FREE_MAYBE(params->fft.inbuf_fft); #ifdef HAVE_LIBRFFTW rfftw_destroy_plan(params->fft.plan); FREE_MAYBE(params->fft.outbuf); #endif /* HAVE_LIBRFFTW */ FREE_MAYBE(psdbuftmp); FREE_MAYBE(hn); FREE_MAYBE(mu); FREE_MAYBE(ftest); free_dmatrix(params->window, 1, n, 0, kmax); params->window = NULL; free_dvector(params->sig, 0, kmax); params->sig = NULL; free_dvector(U0, 0, kmax); U0 = NULL; } glfer-0.4.2/qrs.h0000644000175000001440000000232610744705163010521 00000000000000/* qrs.h * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _QRS_H_ #define _QRS_H_ void send_char(char c); void send_string(char *s); void stop_tx(void); int cw_char_allowed(char c); int get_qrss_char_index(void); void ptt_on(void); void ptt_off(void); void key_down(void); void key_up(void); int open_serial_port(char *device); int open_parport(char *device); void close_serial_port(void); float string_duration(char *str); int open_ksound(void); void close_ksound(void); #endif /* _QRS_H_ */ glfer-0.4.2/glfer.lsm0000644000175000001440000000127211330652343011347 00000000000000Begin4 Title: glfer Version: 0.4.2 Entered-date: 2010-01-29 Description: glfer is a GTK+ application designed for transmitting and receiving QRSS/DFCW transmissions, as used by hams mainly on the 137 and 73 kHz band. It shows the spectrum of the soundcard input signal, using one of several selectable spectral estimators and can control a transmitter through the serial or parallel port. Keywords: glfer, qrss, dfcw, ham, amateur radio, lf, arma, multitaper, fft, spectrum Author: in3otd@qsl.net (Claudio Girardi) Maintained-by: in3otd@qsl.net (Claudio Girardi) Primary-site: http://www.qsl.net/in3otd/glfer-0.4.2.tar.gz Alternate-site: Original-site: Platforms: Linux Copying-policy: GNU GPL End glfer-0.4.2/rcfile.h0000644000175000001440000000171410744705163011160 00000000000000/* rcfile.h * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _RCFILE_H_ #define _RCFILE_H_ int parse_rcfile(void); int rc_file_parse(const char *filename); int rc_file_write(void); void rc_file_done(void); #endif /* #ifndef _RCFILE_H_ */ glfer-0.4.2/g_about.c0000644000175000001440000006050211330653347011325 00000000000000/* g_about.c * * Copyright (C) 2008 Claudio Girardi * (C) 2006 Edouard Griffiths for modifications implementing * averaging mode * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifdef HAVE_CONFIG_H #include #endif /* HAVE_CONFIG_H */ #include #include #include "glfer.h" #include "g_about.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif extern glfer_t glfer; //extern GtkWidget *main_window; /* program main window */ static GtkWidget *about_dialog = NULL; static GtkWidget *license_dialog = NULL; /* locally global data */ static gchar *gpl_text = " GNU GENERAL PUBLIC LICENSE\n" " Version 2, June 1991\n" "\n" " Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n" " 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\n" " Everyone is permitted to copy and distribute verbatim copies\n" " of this license document, but changing it is not allowed.\n" "\n" " Preamble\n" "\n" " The licenses for most software are designed to take away your\n" " freedom to share and change it. By contrast, the GNU General Public\n" " License is intended to guarantee your freedom to share and change free\n" " software--to make sure the software is free for all its users. This\n" " General Public License applies to most of the Free Software\n" " Foundation's software and to any other program whose authors commit to\n" " using it. (Some other Free Software Foundation software is covered by\n" " the GNU Library General Public License instead.) You can apply it to\n" " your programs, too.\n" "\n" " When we speak of free software, we are referring to freedom, not\n" " price. Our General Public Licenses are designed to make sure that you\n" " have the freedom to distribute copies of free software (and charge for\n" " this service if you wish), that you receive source code or can get it\n" " if you want it, that you can change the software or use pieces of it\n" " in new free programs; and that you know you can do these things.\n" "\n" " To protect your rights, we need to make restrictions that forbid\n" " anyone to deny you these rights or to ask you to surrender the rights.\n" " These restrictions translate to certain responsibilities for you if you\n" " distribute copies of the software, or if you modify it.\n" "\n" " For example, if you distribute copies of such a program, whether\n" " gratis or for a fee, you must give the recipients all the rights that\n" " you have. You must make sure that they, too, receive or can get the\n" " source code. And you must show them these terms so they know their\n" " rights.\n" "\n" " We protect your rights with two steps: (1) copyright the software, and\n" " (2) offer you this license which gives you legal permission to copy,\n" " distribute and/or modify the software.\n" "\n" " Also, for each author's protection and ours, we want to make certain\n" " that everyone understands that there is no warranty for this free\n" " software. If the software is modified by someone else and passed on, we\n" " want its recipients to know that what they have is not the original, so\n" " that any problems introduced by others will not reflect on the original\n" " authors' reputations.\n" " \n" " Finally, any free program is threatened constantly by software\n" " patents. We wish to avoid the danger that redistributors of a free\n" " program will individually obtain patent licenses, in effect making the\n" " program proprietary. To prevent this, we have made it clear that any\n" " patent must be licensed for everyone's free use or not licensed at all.\n" "\n" " The precise terms and conditions for copying, distribution and\n" " modification follow.\n" "\n" " GNU GENERAL PUBLIC LICENSE\n" " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n" "\n" " 0. This License applies to any program or other work which contains\n" " a notice placed by the copyright holder saying it may be distributed\n" " under the terms of this General Public License. The \"Program\", below,\n" " refers to any such program or work, and a \"work based on the Program\"\n" " means either the Program or any derivative work under copyright law:\n" " that is to say, a work containing the Program or a portion of it,\n" " either verbatim or with modifications and/or translated into another\n" " language. (Hereinafter, translation is included without limitation in\n" " the term \"modification\".) Each licensee is addressed as \"you\".\n" "\n" " Activities other than copying, distribution and modification are not\n" " covered by this License; they are outside its scope. The act of\n" " running the Program is not restricted, and the output from the Program\n" " is covered only if its contents constitute a work based on the\n" " Program (independent of having been made by running the Program).\n" " Whether that is true depends on what the Program does.\n" "\n" " 1. You may copy and distribute verbatim copies of the Program's\n" " source code as you receive it, in any medium, provided that you\n" " conspicuously and appropriately publish on each copy an appropriate\n" " copyright notice and disclaimer of warranty; keep intact all the\n" " notices that refer to this License and to the absence of any warranty;\n" " and give any other recipients of the Program a copy of this License\n" " along with the Program.\n" "\n" " You may charge a fee for the physical act of transferring a copy, and\n" " you may at your option offer warranty protection in exchange for a fee.\n" "\n" " 2. You may modify your copy or copies of the Program or any portion\n" " of it, thus forming a work based on the Program, and copy and\n" " distribute such modifications or work under the terms of Section 1\n" " above, provided that you also meet all of these conditions:\n" "\n" " a) You must cause the modified files to carry prominent notices\n" " stating that you changed the files and the date of any change.\n" "\n" " b) You must cause any work that you distribute or publish, that in\n" " whole or in part contains or is derived from the Program or any\n" " part thereof, to be licensed as a whole at no charge to all third\n" " parties under the terms of this License.\n" "\n" " c) If the modified program normally reads commands interactively\n" " when run, you must cause it, when started running for such\n" " interactive use in the most ordinary way, to print or display an\n" " announcement including an appropriate copyright notice and a\n" " notice that there is no warranty (or else, saying that you provide\n" " a warranty) and that users may redistribute the program under\n" " these conditions, and telling the user how to view a copy of this\n" " License. (Exception: if the Program itself is interactive but\n" " does not normally print such an announcement, your work based on\n" " the Program is not required to print an announcement.)\n" "\n" " These requirements apply to the modified work as a whole. If\n" " identifiable sections of that work are not derived from the Program,\n" " and can be reasonably considered independent and separate works in\n" " themselves, then this License, and its terms, do not apply to those\n" " sections when you distribute them as separate works. But when you\n" " distribute the same sections as part of a whole which is a work based\n" " on the Program, the distribution of the whole must be on the terms of\n" " this License, whose permissions for other licensees extend to the\n" " entire whole, and thus to each and every part regardless of who wrote it.\n" "\n" " Thus, it is not the intent of this section to claim rights or contest\n" " your rights to work written entirely by you; rather, the intent is to\n" " exercise the right to control the distribution of derivative or\n" " collective works based on the Program.\n" "\n" " In addition, mere aggregation of another work not based on the Program\n" " with the Program (or with a work based on the Program) on a volume of\n" " a storage or distribution medium does not bring the other work under\n" " the scope of this License.\n" "\n" " 3. You may copy and distribute the Program (or a work based on it,\n" " under Section 2) in object code or executable form under the terms of\n" " Sections 1 and 2 above provided that you also do one of the following:\n" "\n" " a) Accompany it with the complete corresponding machine-readable\n" " source code, which must be distributed under the terms of Sections\n" " 1 and 2 above on a medium customarily used for software interchange; or,\n" "\n" " b) Accompany it with a written offer, valid for at least three\n" " years, to give any third party, for a charge no more than your\n" " cost of physically performing source distribution, a complete\n" " machine-readable copy of the corresponding source code, to be\n" " distributed under the terms of Sections 1 and 2 above on a medium\n" " customarily used for software interchange; or,\n" "\n" " c) Accompany it with the information you received as to the offer\n" " to distribute corresponding source code. (This alternative is\n" " allowed only for noncommercial distribution and only if you\n" " received the program in object code or executable form with such\n" " an offer, in accord with Subsection b above.)\n" "\n" " The source code for a work means the preferred form of the work for\n" " making modifications to it. For an executable work, complete source\n" " code means all the source code for all modules it contains, plus any\n" " associated interface definition files, plus the scripts used to\n" " control compilation and installation of the executable. However, as a\n" " special exception, the source code distributed need not include\n" " anything that is normally distributed (in either source or binary\n" " form) with the major components (compiler, kernel, and so on) of the\n" " operating system on which the executable runs, unless that component\n" " itself accompanies the executable.\n" "\n" " If distribution of executable or object code is made by offering\n" " access to copy from a designated place, then offering equivalent\n" " access to copy the source code from the same place counts as\n" " distribution of the source code, even though third parties are not\n" " compelled to copy the source along with the object code.\n" " \n" " 4. You may not copy, modify, sublicense, or distribute the Program\n" " except as expressly provided under this License. Any attempt\n" " otherwise to copy, modify, sublicense or distribute the Program is\n" " void, and will automatically terminate your rights under this License.\n" " However, parties who have received copies, or rights, from you under\n" " this License will not have their licenses terminated so long as such\n" " parties remain in full compliance.\n" "\n" " 5. You are not required to accept this License, since you have not\n" " signed it. However, nothing else grants you permission to modify or\n" " distribute the Program or its derivative works. These actions are\n" " prohibited by law if you do not accept this License. Therefore, by\n" " modifying or distributing the Program (or any work based on the\n" " Program), you indicate your acceptance of this License to do so, and\n" " all its terms and conditions for copying, distributing or modifying\n" " the Program or works based on it.\n" "\n" " 6. Each time you redistribute the Program (or any work based on the\n" " Program), the recipient automatically receives a license from the\n" " original licensor to copy, distribute or modify the Program subject to\n" " these terms and conditions. You may not impose any further\n" " restrictions on the recipients' exercise of the rights granted herein.\n" " You are not responsible for enforcing compliance by third parties to\n" " this License.\n" " \n" " 7. If, as a consequence of a court judgment or allegation of patent\n" " infringement or for any other reason (not limited to patent issues),\n" " conditions are imposed on you (whether by court order, agreement or\n" " otherwise) that contradict the conditions of this License, they do not\n" " excuse you from the conditions of this License. If you cannot\n" " distribute so as to satisfy simultaneously your obligations under this\n" " License and any other pertinent obligations, then as a consequence you\n" " may not distribute the Program at all. For example, if a patent\n" " license would not permit royalty-free redistribution of the Program by\n" " all those who receive copies directly or indirectly through you, then\n" " the only way you could satisfy both it and this License would be to\n" " refrain entirely from distribution of the Program.\n" "\n" " If any portion of this section is held invalid or unenforceable under\n" " any particular circumstance, the balance of the section is intended to\n" " apply and the section as a whole is intended to apply in other\n" " circumstances.\n" "\n" " It is not the purpose of this section to induce you to infringe any\n" " patents or other property right claims or to contest validity of any\n" " such claims; this section has the sole purpose of protecting the\n" " integrity of the free software distribution system, which is\n" " implemented by public license practices. Many people have made\n" " generous contributions to the wide range of software distributed\n" " through that system in reliance on consistent application of that\n" " system; it is up to the author/donor to decide if he or she is willing\n" " to distribute software through any other system and a licensee cannot\n" " impose that choice.\n" "\n" " This section is intended to make thoroughly clear what is believed to\n" " be a consequence of the rest of this License.\n" "\n" " 8. If the distribution and/or use of the Program is restricted in\n" " certain countries either by patents or by copyrighted interfaces, the\n" " original copyright holder who places the Program under this License\n" " may add an explicit geographical distribution limitation excluding\n" " those countries, so that distribution is permitted only in or among\n" " countries not thus excluded. In such case, this License incorporates\n" " the limitation as if written in the body of this License.\n" "\n" " 9. The Free Software Foundation may publish revised and/or new versions\n" " of the General Public License from time to time. Such new versions will\n" " be similar in spirit to the present version, but may differ in detail to\n" " address new problems or concerns.\n" " \n" " Each version is given a distinguishing version number. If the Program\n" " specifies a version number of this License which applies to it and \"any\n" " later version\", you have the option of following the terms and conditions\n" " either of that version or of any later version published by the Free\n" " Software Foundation. If the Program does not specify a version number of\n" " this License, you may choose any version ever published by the Free Software\n" " Foundation.\n" "\n" " 10. If you wish to incorporate parts of the Program into other free\n" " programs whose distribution conditions are different, write to the author\n" " to ask for permission. For software which is copyrighted by the Free\n" " Software Foundation, write to the Free Software Foundation; we sometimes\n" " make exceptions for this. Our decision will be guided by the two goals\n" " of preserving the free status of all derivatives of our free software and\n" " of promoting the sharing and reuse of software generally.\n" "\n" " NO WARRANTY\n" "\n" " 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n" " FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\n" " OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n" " PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n" " OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n" " MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\n" " TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\n" " PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n" " REPAIR OR CORRECTION.\n" "\n" " 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n" " WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n" " REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n" " INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n" " OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n" " TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n" " YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n" " PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n" " POSSIBILITY OF SUCH DAMAGES.\n" "\n" " END OF TERMS AND CONDITIONS\n" "\n" " How to Apply These Terms to Your New Programs\n" "\n" " If you develop a new program, and you want it to be of the greatest\n" " possible use to the public, the best way to achieve this is to make it\n" " free software which everyone can redistribute and change under these terms.\n" "\n" " To do so, attach the following notices to the program. It is safest\n" " to attach them to the start of each source file to most effectively\n" " convey the exclusion of warranty; and each file should have at least\n" " the \"copyright\" line and a pointer to where the full notice is found.\n" "\n" " \n" " Copyright (C) \n" "\n" " This program is free software; you can redistribute it and/or modify\n" " it under the terms of the GNU General Public License as published by\n" " the Free Software Foundation; either version 2 of the License, or\n" " (at your option) any later version.\n" "\n" " This program is distributed in the hope that it will be useful,\n" " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" " GNU General Public License for more details.\n" "\n" " You should have received a copy of the GNU General Public License\n" " along with this program; if not, write to the Free Software\n" " Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\n" "\n" "\n" " Also add information on how to contact you by electronic and paper mail.\n" " \n" " If the program is interactive, make it output a short notice like this\n" " when it starts in an interactive mode:\n" "\n" " Gnomovision version 69, Copyright (C) year name of author\n" " Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n" " This is free software, and you are welcome to redistribute it\n" " under certain conditions; type `show c' for details.\n" " \n" " The hypothetical commands `show w' and `show c' should show the appropriate\n" " parts of the General Public License. Of course, the commands you use may\n" " be called something other than `show w' and `show c'; they could even be\n" " mouse-clicks or menu items--whatever suits your program.\n" " \n" " You should also get your employer (if you work as a programmer) or your\n" " school, if any, to sign a \"copyright disclaimer\" for the program, if\n" " necessary. Here is a sample; alter the names:\n" " \n" " Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n" " `Gnomovision' (which makes passes at compilers) written by James Hacker.\n" "\n" " , 1 April 1989\n" " Ty Coon, President of Vice\n" " \n" " This General Public License does not permit incorporating your program into\n" " proprietary programs. If your program is a subroutine library, you may\n" " consider it more useful to permit linking proprietary applications with the\n" " library. If this is what you want to do, use the GNU Lesser General\n" " Public License instead of this License.\n" "\n" ; void show_about(GtkWidget * widget, gpointer data) { GtkWidget *la, *bu; if (about_dialog && about_dialog->window) { gdk_window_show(about_dialog->window); //gtk_widget_map(about_dialog); gdk_window_raise(about_dialog->window); return; } about_dialog = gtk_dialog_new(); g_signal_connect(G_OBJECT(about_dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &about_dialog); gtk_window_set_wmclass(GTK_WINDOW(about_dialog), "about", "glfer"); gtk_window_set_title(GTK_WINDOW(about_dialog), "About glfer"); gtk_window_set_policy(GTK_WINDOW(about_dialog), FALSE, FALSE, FALSE); gtk_window_position(GTK_WINDOW(about_dialog), GTK_WIN_POS_CENTER); /* FIXME: */ /* gtk_widget_set_parent(GTK_WIDGET(about_dialog), main_window); */ gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox), 5); /* ok button */ bu = gtk_button_new_with_label("Ok"); gtk_tooltips_set_tip(glfer.tt, bu, "Close window", NULL); g_signal_connect_swapped(G_OBJECT(bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(about_dialog)); GTK_WIDGET_SET_FLAGS(bu, GTK_CAN_DEFAULT); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(about_dialog)->action_area), bu, TRUE, TRUE, 0); gtk_widget_grab_default(bu); gtk_widget_show(bu); /* about label */ la = gtk_label_new(PACKAGE_NAME " " PACKAGE_VERSION #ifdef RELDATE " (" RELDATE ")\n" #endif /* RELDATE */ "\n" "(C) 2001-2010 Claudio Girardi, \n" "\n" "(C) 2006 Edouard Griffiths, \n" ); gtk_misc_set_padding(GTK_MISC(la), 40, 40); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(about_dialog)->vbox), la, TRUE, TRUE, 0); gtk_widget_show(la); gtk_widget_show(about_dialog); } void show_license(GtkWidget * widget, gpointer data) { static GdkFont *font = NULL; GtkWidget *bu, *hb, *te, *sw; GtkTextBuffer *b; GtkTextIter end; if (license_dialog && license_dialog->window) { gdk_window_show(license_dialog->window); //gtk_widget_map(license_dialog); gdk_window_raise(license_dialog->window); return; } if (!font) font = gdk_font_load("fixed"); g_assert(font != NULL); license_dialog = gtk_dialog_new(); g_signal_connect(G_OBJECT(license_dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &license_dialog); gtk_window_set_wmclass(GTK_WINDOW(license_dialog), "license", "glfer"); gtk_window_set_title(GTK_WINDOW(license_dialog), "License"); gtk_window_set_policy(GTK_WINDOW(license_dialog), TRUE, TRUE, TRUE); gtk_window_position(GTK_WINDOW(license_dialog), GTK_WIN_POS_NONE); gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(license_dialog)->vbox), 5); hb = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(license_dialog)->vbox), hb, TRUE, TRUE, 0); gtk_widget_show(hb); sw = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show(sw); te = gtk_text_view_new(); gtk_container_add (GTK_CONTAINER (sw), te); gtk_widget_set_usize(te, 81 * gdk_char_width(font, ' '), 400); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (te), GTK_WRAP_WORD); gtk_box_pack_start(GTK_BOX(hb), te, TRUE, TRUE, 0); gtk_widget_show(te); gtk_box_pack_start(GTK_BOX(hb), sw, FALSE, FALSE, 0); bu = gtk_button_new_with_label("Ok"); gtk_tooltips_set_tip(glfer.tt, bu, "Close window", NULL); GTK_WIDGET_SET_FLAGS(bu, GTK_CAN_DEFAULT); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(license_dialog)->action_area), bu, TRUE, TRUE, 0); g_signal_connect_swapped(G_OBJECT(bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(license_dialog)); gtk_widget_grab_default(bu); gtk_widget_show(bu); gtk_widget_show(license_dialog); b = gtk_text_view_get_buffer (GTK_TEXT_VIEW (te)); gtk_text_buffer_get_end_iter (b, &end); gtk_text_buffer_insert (b, &end, gpl_text, -1); } glfer-0.4.2/g_main.h0000644000175000001440000000201610744705162011141 00000000000000/* g_main.h * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _G_MAIN_H_ #define _G_MAIN_H_ void set_palette(int p_n); GtkWidget *main_window_init(int, float, float); void stop_start_button_set_label(gchar *label); void main_window_draw(float *psdbuf); void main_window_close(void); #endif /* _G_MAIN_H_ */ glfer-0.4.2/audio.c0000644000175000001440000002216211063274427011007 00000000000000/* audio.c * * Copyright (C) 2001-2007 Claudio Girardi * * This file is derived from xspectrum, Copyright (C) 2000 Vincent Arkesteijn * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include #include #include #include #include #include "audio.h" #include "util.h" #ifndef AFMT_S16_NE #include #if (__BYTE_ORDER==__LITTLE_ENDIAN) #define AFMT_S16_NE AFMT_S16_LE #else #define AFMT_S16_NE AFMT_S16_BE #endif #endif #include "audio.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif #define DEFAULT_DEV_NAME "/dev/dsp" #define DEFAULT_SAMPLE_RATE 44000 static int audio_fd; static int sample_resolution; /* # of bits / sample */ static int sample_offset; static int bufsize; static int out_len; /* number of samples to acquire */ static unsigned char *buf = NULL, *buf8 = NULL; static short int *buf16 = NULL; static float *buff_f = NULL; static int old_p = 0, old_len = 0; /* initialises the audio interface */ int audio_init(char *device, int *sample_rate, int len) { int format, stereo, version, n; out_len = len; if (!device) device = DEFAULT_DEV_NAME; if ((audio_fd = open(device, O_RDONLY | O_NONBLOCK)) == -1) { perror(device); return (-1); } format = AFMT_S16_NE; /* format = AFMT_U8; */ if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format) == -1) { perror("SNDCTL_DSP_SETFMT"); return (-1); } switch (format) { case (AFMT_U8): sample_resolution = 8; sample_offset = 128; break; case (AFMT_S16_NE): sample_resolution = 16; sample_offset = 0; break; default: format = AFMT_U8; if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format) == -1) { perror("SNDCTL_DSP_SETFMT"); return (-1); } if (format != AFMT_U8) { fprintf(stderr, "Sorry, 8-bit linear audio not supported.\n"); return (-1); } sample_resolution = 8; sample_offset = 128; } len *= sample_resolution / 8; /* OSS User's Guide says there is no need to set explicitely the fragment size... */ n = 0x7fff0001; while (len > 2) { n++; len /= 2; } if (n < 0x7fff0004) /* minimum allowed value */ n = 0x7fff0004; /* first 16 bits are the max. number of fragments; 0x7fff means no limit */ /* last 16 bits are the log2 of the fragment size */ if (ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &n) == -1) { perror("SNDCTL_DSP_SETFRAGMENT"); return (-1); } stereo = 0; if (ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo) == -1) { perror("SNDCTL_DSP_STEREO"); return (-1); } if (stereo != 0) { fprintf(stderr, "Sorry, mono audio not supported.\n"); } if (!*sample_rate) *sample_rate = DEFAULT_SAMPLE_RATE; n = *sample_rate; if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &n) == -1) { perror("SNDCTL_DSP_SPEED"); return (-1); } if (n != *sample_rate) fprintf(stderr, "warning: sample rate changed (%i -> %i)\n", *sample_rate, n); *sample_rate = n; if (ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &bufsize) == -1) { perror("SNDCTL_DSP_GETBLKSIZE"); return (-1); } D(printf("bufsize = %i\n", bufsize)); /* for debug */ /* Read something (one full fragment), to start recording. This shouldn't * be necessary but due to a bug in old versions of OSS, it is. */ #ifdef OSS_GETVERSION if (ioctl(audio_fd, OSS_GETVERSION, &version) == -1) { if (errno == EINVAL) { /* this ioctl was introduced in version 3.6.0 */ version = 0; } else { perror("OSS_GETVERSION"); return (-1); } } if (version < 360) #endif { unsigned char *dummy; dummy = malloc(bufsize); if (read(audio_fd, dummy, bufsize) < bufsize) perror("audio read"); FREE_MAYBE(dummy); } buf = NULL; old_p = 0, old_len = 0; return audio_fd; } /* reads the audio data */ void audio_read(float **buf_out, int *n_out) { int i, s_bufsize, res, n_read; short sample; /* size of the buffer of char (8 bits) */ s_bufsize = bufsize * 8 / sample_resolution; /* when using 16 bit samples the sample buffer will have */ /* twice the size of the buffer used for the 8 bit case, */ /* since we want to be able to store the same number of samples */ if (!buf) { switch (sample_resolution) { case (8): buf = buf8 = (unsigned char *) calloc(s_bufsize, sizeof(unsigned char)); break; case (16): buf16 = calloc(s_bufsize, sizeof(short int)); buf = (unsigned char *) buf16; break; } buff_f = (float *) calloc(s_bufsize + out_len, sizeof(float)); if (!buff_f) { fprintf(stderr, "error allocating buff_f (size %i)\n", s_bufsize + out_len); exit(-1); } } i = 0; for (;;) { /* read 1 or 2 bytes, depending on the desired sample resolution */ res = read(audio_fd, &sample, sample_resolution / 8); if (res == 0) { /* no samples available */ break; } else if (res != sample_resolution / 8) { /* error in reading */ D(fprintf(stderr, "%d %d %s\n", res, errno, strerror(errno))); /* for debug */ if (errno == EINTR) break; /* interrupted */ //continue; if (errno == EAGAIN || errno == EBUSY) /* no data was immediately available */ break; /* otherwise... */ perror("Audio read failed"); exit(1); } /* fill the buffer */ switch (sample_resolution) { case (8): buf8[i++] = (unsigned char) sample; break; case (16): buf16[i++] = (short int) sample; break; } if (i >= s_bufsize) /* should not happen, but... */ fprintf(stderr, "Error !\n"); break; } n_read = i; /* number of acquired samples */ /* fprintf(stderr, "n_read = %i, old_len = %i, old_p = %i n_read+old_len = %i %i\n", n_read, old_len, old_p, n_read + old_len, s_bufsize+out_len); */ /* move the old data to the beginning */ for (i = 0; i < old_len; i++) buff_f[i] = buff_f[old_p + i]; old_p = 0; /* copy the sound driver buffer into the application buffer */ switch (sample_resolution) { case (8): for (i = 0; i < n_read; i++) /* buf8 is an array of char */ buff_f[i + old_len] = ((float) buf8[i] - sample_offset) / 128; break; case (16): for (i = 0; i < n_read; i++) { /* buf16[] is an array of short int */ buff_f[i + old_len] = ((float) buf16[i] - sample_offset) / 32768; } break; } *buf_out = buff_f; *n_out = (old_len + n_read) / out_len; old_p = (*n_out) * out_len; old_len = (old_len + n_read) % out_len; /* return 1; */ } /* reads the audio data */ void audio_read_old(float **buf_out, int *n_out) { int i, s_bufsize; audio_buf_info info; s_bufsize = bufsize * 8 / sample_resolution; if (!buf) { switch (sample_resolution) { case (8): buf = buf8 = (unsigned char *) calloc(s_bufsize, sizeof(unsigned char)); break; case (16): buf16 = (short int *) calloc(s_bufsize, sizeof(short int)); buf = (unsigned char *) buf16; break; } buff_f = (float *) calloc(s_bufsize + out_len, sizeof(float)); if (!buff_f) { fprintf(stderr, "error allocating buff_f (size %i)\n", s_bufsize + out_len); exit(-1); } } for (i = 0; i < old_len; i++) buff_f[i] = buff_f[old_p + i]; old_p = 0; if (ioctl(audio_fd, SNDCTL_DSP_GETISPACE, &info) == -1) { perror("SNDCTL_DSP_GETISPACE"); exit(-1); } if (info.bytes < bufsize) { fprintf(stderr, "Not enough data for audio read (%i<%i).\n", info.bytes, bufsize); *n_out = 0; return; } /* read a full sound driver buffer (as recommended by the OSS) */ if (read(audio_fd, buf, bufsize) < bufsize) { perror("audio read"); return; } /* copy the sound driver buffer into the application buffer */ switch (sample_resolution) { case (8): for (i = 0; i < bufsize; i++) /* buf8 is an array of char */ buff_f[i + old_len] = ((float) buf8[i] - sample_offset) / 128; break; case (16): for (i = 0; i < bufsize / 2; i++) { /* buf16[] is an array of short int */ buff_f[i + old_len] = ((float) buf16[i] - sample_offset) / 32768; } break; } *buf_out = buff_f; *n_out = (old_len + s_bufsize) / out_len; old_p = (*n_out) * out_len; old_len = (old_len + s_bufsize) % out_len; } void audio_close(void) { D(printf("buf16 = %p\n", buf16)); /* for debug */ close(audio_fd); FREE_MAYBE(buf8); FREE_MAYBE(buf16); buf = NULL; /* since buf is the same as buf8 or buf16 it should not be freed */ FREE_MAYBE(buff_f); } glfer-0.4.2/depcomp0000755000175000001440000003541010744705163011120 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2004-04-25.13 # Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit 0 ;; -v | --v*) echo "depcomp $scriptversion" exit 0 ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # Dependencies are output in .lo.d with libtool 1.4. # They are output in .o.d with libtool 1.5. tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.o.d" tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" elif test -f "$tmpdepfile2"; then tmpdepfile="$tmpdepfile2" else tmpdepfile="$tmpdepfile3" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: glfer-0.4.2/glfer.h0000644000175000001440000001203711330653133011002 00000000000000/* glfer.h * * Copyright (C) 2001-2010 Claudio Girardi * (C) 2006 Edouard Griffiths for modifications implementing * averaging mode * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _GLFER_H_ #define _GLFER_H_ #include #define RELDATE "29 Jan 2010" #ifndef FALSE #define FALSE (0) #endif #ifndef TRUE #define TRUE (!FALSE) #endif #define QRSS 1 #define DFCW 2 #define DEV_SERIAL 0 #define DEV_PARALLEL 1 enum { SCALE_LIN, SCALE_LIN_MAX0, SCALE_LOG, SCALE_LOG_MAX0 }; enum {MODE_NONE = -1, MODE_FFT, MODE_MTM, MODE_HPARMA, MODE_LMP}; enum {HSV, THRESH, COOL, HOT, BW, BONE, COPPER, OTD, PALETTES}; typedef enum {SOURCE_NONE, SOUNDCARD_SOURCE, FILE_SOURCE} datasource_t; typedef enum { NO_AVG, AVG_SUMAVG, AVG_PLAIN, AVG_SUMEXTREME} avgmode_t; /* function prototypes */ void show_message(gchar * fmt, ...); typedef struct { char *program_name; /* the name used for invoking the program */ int mode; /* current mode */ int scale_type; /* display scale type */ /* input data processing */ int data_block_size; /* number of samples used for the FFT */ float data_blocks_overlap; /* overlap between FFT blocks */ float display_update_time; /* display update time */ float limiter_a; /* RA9MB nonlinear processing parameter */ int enable_limiter; /* enable limter */ /* MTM parameters */ float mtm_w; /* mtm window relative bandwidth (0 to 0.5) */ int mtm_k; /* number of windows to use */ /* HP-ARMA parameters */ int hparma_t; /* number of equations */ int hparma_p_e; /* number of poles */ /* LMP parameters */ int lmp_av; /* number of data blocks for the internal average */ /* FFT parameters */ int window_type; /* FFT window */ /* input device parameters */ char *audio_device; /* audio device name */ int sample_rate; /* sound card sample rate */ /* CW/QRSS TX parameters */ float dot_time; /* dot duration */ float dfcw_gap_time; /* gap between dots duration in DFCW mode */ int tx_mode; /* transmission mode: QRSS or DFCW */ float dash_dot_ratio; /* dash to dot ratio in QRSS */ float ptt_delay; /* delay in key down after closing PTT */ float sidetone_freq; /* sidetone frequency */ int sidetone; /* optional sidetone enabled ? */ float dfcw_dot_freq; /* DFCW dot tone frequency */ float dfcw_dash_freq; /* DFCW dash tone frequency */ int beacon_mode; /* beacon mode ON or OFF */ float beacon_pause; /* beacon mode pause between messages */ int beacon_tx_pause; /* beacon on or off during pauses */ char *ctrl_device; /* device controlling KEY and PTT */ int device_type; /* control device type */ /* spectrogram parameter */ float offset_freq; /* frequency offset for spectrogram frequency scale */ float thr_level; /* spectrogram display threshold level */ int autoscale; /* enable autoscale mode (otherwise use min and max settings below) */ float max_level_db; /* maximum level to scale display i.e. for 255 (in dB) */ float min_level_db; /* minimum level to scale display i.e. for 0 (in dB) */ avgmode_t averaging; /* averaging mode */ int avgsamples; /* number of samples over which to average (moving average) */ float min_avgband; /* lower frequency cutoff for extreme averaging */ float max_avgband; /* higher frequency cutoff for extreme averaging */ int palette; /* palette type */ } opt_t; typedef struct { GtkTooltips *tt; /* tooltips */ GtkWidget *qso_menu_item; GtkWidget *test_menu_item; int init_done; /* start-up inizialization done */ int first_buffer; /* first data buffer acquired from source */ datasource_t input_source; /* input data source */ float cpu_usage; /* CPU usage */ int current_mode; /* current mode */ GtkWidget *scope_window; float avgmax; /* average psd over spectrum */ double avgvar; /* variance above average psd over spectrum */ int avgfill; /* number of samples in averaging buffer */ float peakfreq; /* peak frequency */ float peakval; /* peak value */ float avgtime; /* averaging time */ } glfer_t; typedef struct { double start; double stop; double delta; } perf_timer_t; #endif /* #ifndef _GLFER_H_ */ glfer-0.4.2/glfer.c0000644000175000001440000002517511223657477011024 00000000000000/* glfer.c * Copyright (C) 2001-2009 Claudio Girardi * (C) 2006 Edouard Griffiths for modifications implementing * averaging mode * * Part of this file was inspired by xspectrum, Copyright (C) 2000 Vincent Arkesteijn * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include "source.h" #include "audio.h" #include "fft.h" #include "avg.h" #include "mtm.h" #include "hparma.h" #include "lmp.h" #include "g_main.h" #include "qrs.h" #include "util.h" #include "rcfile.h" #include "glfer.h" #include "wav_fmt.h" /* #include "jason.h" */ #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif opt_t opt; glfer_t glfer; fft_params_t fft_gram_par; mtm_params_t mtm_gram_par; hparma_params_t hparma_gram_par; lmp_params_t lmp_gram_par; avg_data_t avgdata; static int psd_n; static char *fname = NULL; static float *psdbuf = NULL; static int rc_file_read_ok; /* function prototypes */ void show_message(gchar * fmt, ...); static void destroy(GtkWidget * widget, gpointer data); static void help(char *name); static void usage(char *name); static void version(); static void parse_args(int argc, char *argv[], char **device, int *sample_rate, int *n); /* Function to open a dialog box displaying the message provided. */ /* ...almost entirely from the GTK Reference Manual... */ void show_message(gchar * fmt, ...) { va_list args; gchar *msg_text; GtkWidget *dialog, *label, *ok_button; /* create a new dialog */ dialog = gtk_dialog_new(); /* realize the dialog */ gtk_widget_realize(dialog); /* allow only move and close (no resize) */ gdk_window_set_functions(dialog->window, GDK_FUNC_MOVE | GDK_FUNC_CLOSE); /* show border and title only */ gdk_window_set_decorations(dialog->window, GDK_DECOR_BORDER | GDK_DECOR_TITLE); /* set border width */ gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 5); /* set dialog title */ gtk_window_set_title(GTK_WINDOW(dialog), "Warning"); gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* make the dialog modal */ gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); /* initialise args */ va_start(args, fmt); /* format the whole message into msg_text */ msg_text = g_strdup_vprintf(fmt, args); /* create a label */ label = gtk_label_new(msg_text); /* free unused variable */ g_free(msg_text); gtk_misc_set_padding(GTK_MISC(label), 20, 20); /* FIXME: anyone knows how to make line wrapping work ? */ //gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); //gtk_widget_set_usize (label, 160, 120); /* gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_FILL); */ ok_button = gtk_button_new_with_label("Ok"); GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); /* Ensure that the dialog box is destroyed when the user clicks ok. */ g_signal_connect_swapped(G_OBJECT(ok_button), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog)); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), ok_button); /* make OK the default button */ gtk_widget_grab_default(ok_button); /* Add the label, and show everything we've added to the dialog. */ gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); gtk_widget_show_all(dialog); /* done with variable arguments */ va_end(args); } static void destroy(GtkWidget * widget, gpointer data) { FREE_MAYBE(psdbuf); FREE_MAYBE(opt.ctrl_device); close_serial_port(); close_ksound(); audio_close(); fft_close(&fft_gram_par); main_window_close(); rc_file_done(); } static void help(char *name) { fprintf(stderr, "%s, by IN3OTD, Version " PACKAGE_VERSION " (" RELDATE ")\n" "Usage: %s [options]\n" "Options:\n" "\n" " -d, --device FILE use FILE as audio input device instead of /dev/dsp.\n" " -f, --file FILENAME take audio input from FILENAME (WAV format).\n" " -s, --sample_rate RATE set audio sample rate to RATE [Hz].\n" " -n N set number of points fot the FFT to N.\n" " -h, --help print this help.\n" " -v, --version display the version of glfer and exit.\n", name, name); fprintf(stderr, "\n"); fprintf(stderr, "Mail bug reports and suggestions to <" PACKAGE_BUGREPORT ">\n"); fprintf(stderr, "\n"); exit(1); } static void usage(char *name) { char s[] = "Usage: %s [options]\n" "Try `%s --help' for more informations\n"; fprintf(stderr, s, name, name); } static void version() { fprintf(stderr, /* State the canonical name for the program */ "glfer " PACKAGE_VERSION " (" RELDATE ")\n" "Copyright (C) 2009 Claudio Girardi \n" "\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.\n" "\n"); } static void parse_args(int argc, char *argv[], char **device, int *sample_rate, int *n) { int c; static char shortopts[] = "d:f:n:s:hv"; static struct option longopts[] = { {"device", 1, NULL, 'd'}, {"file", 1, NULL, 'f'}, {"sample_rate", 1, NULL, 's'}, {"help", 0, NULL, 'h'}, {"version", 0, NULL, 'v'}, {"", 0, NULL, 0} }; int option_index = 0; while ((c = getopt_long(argc, argv, shortopts, longopts, &option_index)) != -1) switch (c) { case ('d'): *device = strdup(optarg); break; case ('f'): fname = strdup(optarg); break; case ('n'): *n = atoi(optarg); break; case ('s'): opt.sample_rate = atoi(optarg); break; case ('h'): help(argv[0]); exit(0); break; case ('v'): version(); exit(0); break; case ('?'): usage(argv[0]); exit(-1); break; } } int main(int argc, char *argv[]) { GtkWidget *window; int dev_status = 0; opt.data_block_size = 1024; opt.data_blocks_overlap = 0.0; opt.limiter_a = 0.0; /* with 0.0 we have the classical periodogram, otherwise 0.001 ia a good starting value */ opt.enable_limiter = 0; /* MTM parameters */ opt.mtm_w = 4.0; /* this is actually N * W, according to Thompson notation */ opt.mtm_k = (2 * opt.mtm_w) - 1; /* number of windows */ /* HP ARMA parameters */ opt.hparma_p_e = 16; opt.hparma_t = 96; /* LMP parameters */ opt.lmp_av = 4; opt.sample_rate = 8000; opt.dot_time = 500.0; opt.ptt_delay = 100.0; opt.tx_mode = QRSS; opt.dfcw_gap_time = 100; opt.dash_dot_ratio = 3.0; opt.sidetone_freq = 1000.0; opt.dfcw_dot_freq = 800.0; opt.dfcw_dash_freq = 810.0; opt.beacon_mode = FALSE; opt.beacon_pause = 5; opt.beacon_tx_pause = TRUE; opt.sidetone = FALSE; opt.mode = MODE_FFT; opt.scale_type = SCALE_LOG; opt.ctrl_device = malloc(6 * sizeof(char)); strcpy(opt.ctrl_device, "ttyS1"); opt.audio_device = malloc(9 * sizeof(char)); strcpy(opt.audio_device, "/dev/dsp"); opt.window_type = 7; opt.thr_level = 0.0; opt.autoscale = 1; /* autoscale as default, otherwise may be confusing for a new user */ opt.max_level_db = -3.0; opt.min_level_db = -23.0; opt.min_avgband = 400.0; opt.max_avgband = 1200.0; /* well, this should be more elegant... */ if (parse_rcfile() == 0) rc_file_read_ok = TRUE; else rc_file_read_ok = FALSE; /* ...there's no internationalization support at present, so suppress unnecessary warnings */ gtk_disable_setlocale (); gtk_init(&argc, &argv); parse_args(argc, argv, &opt.audio_device, &opt.sample_rate, &opt.data_block_size); if (opt.avgsamples <= 0) opt.avgsamples = 4; //init_avg(&avgdata); // EG - What's the purpose ? CG //delete_avg(&avgdata); //alloc_avg(&avgdata, opt.data_block_size, opt.avgsamples); glfer.avgfill = 0.0; glfer.input_source = SOURCE_NONE; /* may be modified by init_audio() below */ /* the following code sequence for setting the visual and the colormap */ /* is from the GDK Reference Manual */ gdk_rgb_init(); gtk_widget_set_default_colormap(gdk_rgb_get_colormap()); gtk_widget_set_default_visual(gdk_rgb_get_visual()); /* whole application tooltips */ glfer.tt = gtk_tooltips_new(); /* enable sound, if desired */ if (opt.sidetone == TRUE) open_ksound(); if (rc_file_read_ok) { /* rc file read, open specified control device */ if (opt.device_type == DEV_SERIAL) { dev_status = open_serial_port(opt.ctrl_device); } else if (opt.device_type == DEV_PARALLEL) { dev_status = open_parport(opt.ctrl_device); } else { g_assert_not_reached(); } /* is everything up and running ? */ glfer.init_done = (dev_status == -1 ? FALSE : TRUE); } else { glfer.init_done = FALSE; } /* set current mode FIXME */ glfer.current_mode = MODE_NONE; init_audio(fname); change_params(opt.mode); /* //jason_init(opt.data_block_size); FIXME (calls fft.init) */ psd_n = opt.data_block_size / 2 + 1; window = main_window_init(psd_n, 0, (float) opt.sample_rate / 2); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); if (glfer.init_done == FALSE) { /* there is no valid TX control port */ if (dev_status == 0) { /* no TX control port was defined in the preference file */ show_message("No control port is defined for the transmitter!\n" "\n" "Please go to the Settings/Port menu and select a control\n" "device to enable transmission functions."); } else { /* dev_status = -1 */ /* we tried to open a TX control port but without success */ /* show a warning message */ show_message("Open %s failed !\n" "\n" "Please go to the Settings/Port menu and select a control\n" "device to enable transmission functions.", opt.ctrl_device); } } /* gtk_idle_add(timefn, NULL); */ gtk_main(); return (0); } glfer-0.4.2/bell-p-w.h0000644000175000001440000000154410744705164011335 00000000000000/* bell-p-w.h * * Copyright (C) 2002 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ int dpss(int nmax, int kmax, int n, double w, double **v, double *sig, int *totit); glfer-0.4.2/avg.c0000644000175000001440000002206011056526314010455 00000000000000/* avg.c * * Copyright (C) 2006 Edouard Griffiths (F4EXB) * Copyright (C) 2006-2008 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include #ifdef HAVE_CONFIG_H #include #endif #include "avg.h" #include "util.h" void init_avg(avg_data_t *avgdata) { avgdata->avgwidth = 0; avgdata->avgdepth = 0; avgdata->effdepth = 0; } void alloc_avg(avg_data_t *avgdata, int width, int depth) { int i,j; avgdata->avgwidth = width; avgdata->avgdepth = depth; avgdata->avgarray = malloc(width*sizeof(double)); for (i=0; iavgarray[i] = (double *) malloc(depth*sizeof(double)); for (j=0; javgarray[i][j] = 0.0; } avgdata->avg = (double *) malloc(width*sizeof(double)); avgdata->cum = (double *) malloc(width*sizeof(double)); for (i=0; iavg[i] = 0.0; avgdata->cum[i] = 0.0; } avgdata->effdepth = 0; } void delete_avg(avg_data_t *avgdata) { int i; if (avgdata->avgwidth != 0) { for (i=0; iavgwidth; i++) free(avgdata->avgarray[i]); free(avgdata->avgarray); free(avgdata->avg); free(avgdata->cum); } avgdata->avgwidth = 0; avgdata->avgdepth = 0; avgdata->effdepth = 0; } /* first version double update_avg(avg_data_t *avgdata, int index, double newval) { int i; double oldval; if (avgdata->effdepth < avgdata->avgdepth) // depth not filled yet { avgdata->avgarray[index][avgdata->effdepth] = newval; avgdata->avg[index] = (avgdata->effdepth * avgdata->avg[index] + newval) / (avgdata->effdepth + 1); // accumulate average //avgdata->effdepth++; } else { oldval = avgdata->avgarray[index][0]; avgdata->avg[index] = avgdata->avg[index] + ((newval - oldval)/avgdata->effdepth); // calculate new sliding average for (i=0; i<(avgdata->avgdepth-1); i++) // shift register memcpy(&(avgdata->avgarray[index][i]), &(avgdata->avgarray[index][i+1]), sizeof(double)); avgdata->avgarray[index][avgdata->avgdepth-1] = newval; // put new value } avgdata->cum[index] += newval - avgdata->avg[index]; if (avgdata->cum[index] < 0) avgdata->cum[index] = 1e-15; return avgdata->cum[index]; } */ double update_avg_plain(avg_data_t *avgdata, int N, float *psd, int minbin, int maxbin, int *peakbin) { double avgspec = 0.0; double max=psd[minbin]; int index,i; for (index=minbin; indexeffdepth < avgdata->avgdepth) // depth not filled yet { avgdata->avgarray[index][avgdata->effdepth] = psd[index]; avgdata->cum[index] += psd[index]; } else { avgdata->cum[index] += psd[index] - avgdata->avgarray[index][0]; for (i=0; i<(avgdata->avgdepth-1); i++) // shift register memcpy(&(avgdata->avgarray[index][i]), &(avgdata->avgarray[index][i+1]), sizeof(double)); avgdata->avgarray[index][avgdata->avgdepth-1] = psd[index]; // put new value } if (avgdata->cum[index] > max) { max = avgdata->cum[index]; *peakbin = index; } avgspec += avgdata->cum[index]; } if (avgdata->effdepth < avgdata->avgdepth) // depth not filled yet avgdata->effdepth++; /* printf("max=%le min=%le\n", max, min); printf("avgdata->effdepth=%i\tavgdata->avgdepth=%i\n", avgdata->effdepth, avgdata->avgdepth); */ // calculate average over spectrum and over memory avgspec = (avgspec-max) / ((double) (maxbin-minbin-1) * (double) (avgdata->effdepth+1)); // calculate average over memory for (index=0; index=maxbin)) avgdata->avg[index] = 1e-15; else avgdata->avg[index] = avgdata->cum[index] / (double) (avgdata->effdepth+1); } return avgspec; } double update_avg_sumextreme(avg_data_t *avgdata, int N, float *psd, int max0, int minbin, int maxbin, int *peakbin) { double max = psd[minbin]; double avgspec = 0.0; double min = 1.0; int index,i; int varsamples; for (index=minbin; indexeffdepth < avgdata->avgdepth) // depth not filled yet { avgdata->avgarray[index][avgdata->effdepth] = psd[index]; avgdata->cum[index] += psd[index]; } else { avgdata->cum[index] += psd[index] - avgdata->avgarray[index][0]; for (i=0; i<(avgdata->avgdepth-1); i++) // shift register memcpy(&(avgdata->avgarray[index][i]), &(avgdata->avgarray[index][i+1]), sizeof(double)); avgdata->avgarray[index][avgdata->avgdepth-1] = psd[index]; // put new value } avgspec += avgdata->cum[index]; if (avgdata->cum[index] > max) { max = avgdata->cum[index]; *peakbin = index; } if (avgdata->cum[index] < min) min = avgdata->cum[index]; } if (avgdata->effdepth < avgdata->avgdepth) // depth not filled yet avgdata->effdepth++; avgspec = (avgspec - max) / (double) (maxbin-minbin-1); // average over spectrum // rescale the values for output for (index=0; index=maxbin)) avgdata->avg[index] = 1e-15; else { if (max0) // maximum fixed at 0 dB avgdata->avg[index] = (avgdata->cum[index] - min) / (max - min); else // average fixed at 0 dB avgdata->avg[index] = avgdata->cum[index]/avgspec; /* printf("avgdata->cum[%i]=%le avgdata->avg[%i]=%le min=%le max-min=%le\n", index, avgdata->cum[index], index, avgdata->avg[index], min, max-min); */ } } /* printf("max=%le avgspec=%le m/a=%lf\n", max, avgspec, max / avgspec); */ return max / avgspec; } // same as above but minimum is replaced by average over the spectrum to increase even more S+N/N double update_avg_sumavg(avg_data_t *avgdata, int N, float *psd, int max0, int minbin, int maxbin, int *peakbin, double *variance) { double max = psd[minbin]; double avgspec = 0.0; double sum_avg; int index,i; int varsamples; /* printf("minbin=%i maxbin=%i\n", minbin, maxbin); */ for (index=minbin; indexeffdepth < avgdata->avgdepth) // depth not filled yet { avgdata->avgarray[index][avgdata->effdepth] = psd[index]; avgdata->cum[index] += psd[index]; } else { avgdata->cum[index] += psd[index] - avgdata->avgarray[index][0]; for (i=0; i<(avgdata->avgdepth-1); i++) // shift register memcpy(&(avgdata->avgarray[index][i]), &(avgdata->avgarray[index][i+1]), sizeof(double)); avgdata->avgarray[index][avgdata->avgdepth-1] = psd[index]; // put new value } avgspec += avgdata->cum[index]; if (avgdata->cum[index] > max) { max = avgdata->cum[index]; *peakbin = index; } } if (avgdata->effdepth < avgdata->avgdepth) // depth not filled yet avgdata->effdepth++; avgspec = (avgspec - max) / (double) (maxbin-minbin-1); // average over spectrum excluding maximum *variance = 0.0; // reset variance accumulator varsamples = 0; // rescale the values for output and calculate variance for (index=0; index=maxbin)) avgdata->avg[index] = 1e-15; else { sum_avg = avgdata->cum[index] - avgspec; // sum minus average over spectrum gives (anticipated) signal delta if (sum_avg > 0) { if (max0) avgdata->avg[index] = (avgdata->cum[index] - avgspec) / (max - avgspec); // S+N/N clipped to maximum not scaled to time integration else avgdata->avg[index] = avgdata->cum[index]/avgspec; if (index != *peakbin) // exclude maximum (to match what has been done for the average) { *variance += (avgdata->cum[index]/avgspec)*(avgdata->cum[index]/avgspec); // accumulate varsamples++; } } else { avgdata->avg[index] = 1e-15; } /* printf("avgdata->cum[%i]=%le avgdata->avg[%i]=%le avgspec=%le max-avgspec=%le\n", index, avgdata->cum[index], index, avgdata->avg[index], avgspec, max-avgspec); */ } } // calculate variance *variance = *variance / (double) varsamples; /* printf("max=%le avgspec=%le m/a=%lf\n", max, avgspec, max / avgspec); */ return max / avgspec; } glfer-0.4.2/ChangeLog0000644000175000001440000000335711330652704011314 000000000000002010-01-29 Claudio Girardi * Released 0.4.2 * Changed TX control port selection dialog to support devices other than ttyS[0-3] and lp[0-1] 2008-10-07 Claudio Girardi * Released 0.4.1 * Corrected a bug in the FFT window type selection when loading preferences from file (thanks to Rick Kunath for reporting the bug) 2008-09-14 Claudio Girardi * Lots of changes since the last released version: the following is just an incomplete list... * Released 0.4.0 * Ported to GTK+ 2.x * Included patch from Edouard Griffiths for averaging the spectrum * Rik van Riel patch to avoid cpu hogging * Corrected computation of DPSS tapers for MTM analysis mode * Normalized windows * Added a simple scope window * Changed #include to #include in qrs.c for better portability * Corrected the FSF address everywhere. 2004-09-01 Claudio Girardi * Released 0.3.4 * Added beacon mode * Included and extended a patch from Roberto Tumiati to have a visual threshold on the spectrogram display 2003-07-27 Claudio Girardi * Released 0.3.3, after a limited pre-distribution * Included a little patch from Joop Stakenborg for architectures without sys/io.h (ioperm, inb and outb functions) * Changed the sound acquisition method (not using select() anymore) 2002-10-15 Claudio Girardi * Released 0.3.1 * Added possibility of nonlinear processing to FFT as suggested by RA9MB and selectable limiter on input signal * Corrected dependencies on fftw 2002-10-09 Claudio Girardi * Released 0.3 * New spectral estimator added * Added left bar showing current estimated spectrum * Some general rework glfer-0.4.2/source.c0000644000175000001440000003046211072741121011176 00000000000000/* source.c * Copyright (C) 2002-2008 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifdef HAVE_CONFIG_H #include #endif #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #include #include #include #include #include "source.h" #include "audio.h" #include "fft.h" #include "mtm.h" #include "hparma.h" #include "lmp.h" #include "cw_rx.h" #include "util.h" #include "avg.h" #include "glfer.h" #include "wav_fmt.h" #include "g_main.h" #include "g_scope.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif static int audio_fd = -1; static int psd_n; static char *fname = NULL; static float *psdbuf = NULL; static gint input_tag = -1; static int file_ended = 0; perf_timer_t perf_timer, proc_timer; extern opt_t opt; extern glfer_t glfer; extern avg_data_t avgdata; extern fft_params_t fft_gram_par; extern mtm_params_t mtm_gram_par; extern hparma_params_t hparma_gram_par; extern lmp_params_t lmp_gram_par; static float getclock(void) { clock_t nclock; float nsec; nclock = clock(); nsec = (float) nclock / CLOCKS_PER_SEC; return nsec; } static float timefn(int action) { #ifdef HAVE_GETTIMEOFDAY struct timeval tv; double newtime; static double oldtime = 0.0; if (gettimeofday(&tv, NULL)) perror("gettimeofday"); newtime = (double) tv.tv_sec + (double) tv.tv_usec / 1.0e06; //printf("%e %e %e\n", newtime, oldtime, newtime - oldtime); if (action == 0) oldtime = newtime; return (newtime - oldtime); #endif /* HAVE_GETTIMEOFDAY */ } /* reads the audio data, calls the fft processing function and the drawing * function * (called from within gtk_main whenever data is available */ static void audio_available(gpointer data, gint source, GdkInputCondition condition) { float *audio_buf; int i, n; int n_eff = opt.data_block_size * (1.0 - opt.data_blocks_overlap); if (fname) { /* we have a file open for reading */ wav_read(&audio_buf, &n); if (n == 0) { file_ended = 1; stop_reading_audio(); close_wav_file(); } } else { /* fill audio_buf */ audio_read(&audio_buf, &n); /* n is the number of blocks of requested size read from the audio device */ } for (i = 0; i < n; i++) { /* get current time */ perf_timer.stop = tc_time(); /* elapsed time since last call */ perf_timer.delta = perf_timer.stop - perf_timer.start; glfer.cpu_usage = proc_timer.delta / perf_timer.delta; /* start new period */ perf_timer.start = perf_timer.stop; /* start new data processing period */ proc_timer.start = perf_timer.stop; switch (glfer.current_mode) { case MODE_FFT : fft_do(audio_buf + i * n_eff, &fft_gram_par); fft_psd(psdbuf, NULL, &fft_gram_par); if (glfer.scope_window) scope_window_draw(fft_gram_par); break; case MODE_MTM : mtm_do(audio_buf + i * n_eff, psdbuf, NULL, &mtm_gram_par); if (glfer.scope_window) scope_window_draw(mtm_gram_par.fft); break; case MODE_HPARMA : hparma_do(audio_buf + i * n_eff, psdbuf, NULL, &hparma_gram_par); if (glfer.scope_window) scope_window_draw(hparma_gram_par.fft); break; case MODE_LMP : lmp_do(audio_buf + i * n_eff, psdbuf, NULL, &lmp_gram_par); if (glfer.scope_window) scope_window_draw(lmp_gram_par.fft); break; default: g_print("audio_available: MODE_UNKNOWN\n"); } /* jason_do(audio_buf + i * opt.data_block_size, opt.data_block_size); */ //rx_cw(audio_buf + i * opt.data_block_size, opt.data_block_size); main_window_draw(psdbuf); /* end of data processing */ proc_timer.stop = tc_time(); proc_timer.delta = proc_timer.stop - proc_timer.start; } } void init_audio(char *filename) { int n_eff = opt.data_block_size * (1.0 - opt.data_blocks_overlap); if (filename) { /* use a new file as audio source */ /* in case there is a file currently open as audio source, close it */ if (glfer.input_source == FILE_SOURCE) { close_wav_file(); /* free filename string */ free(fname); /* set pointer to null (to signal that source is not a file anymore) */ fname = NULL; } else if (glfer.input_source == SOUNDCARD_SOURCE) { /* close soundcard */ audio_close(); } /* copy file name, as passed parameter might be deallocated later */ fname = strdup(filename); audio_fd = open_wav_file(fname, n_eff, &opt.sample_rate); file_ended = 0; glfer.input_source = FILE_SOURCE; } else /* no filename specified, continue use current audio source */ if (glfer.input_source == SOUNDCARD_SOURCE) { glfer.input_source = SOUNDCARD_SOURCE; /* not needed... */ } else if (glfer.input_source == FILE_SOURCE) { /* continue to read current file */ glfer.input_source = FILE_SOURCE; /* not needed... */ } else { /* no current audio source and no filename specified; read from soundcard */ audio_fd = audio_init(opt.audio_device, &opt.sample_rate, n_eff); glfer.input_source = SOUNDCARD_SOURCE; } } void close_audio(void) { /* close current source */ if (glfer.input_source == SOUNDCARD_SOURCE) { /* was reading from soundcard */ audio_close(); } else { /* was reading from file */ close_wav_file(); /* free filename string */ free(fname); /* set pointer to null (to signal that source is not a file anymore) */ fname = NULL; } audio_fd = -1; glfer.input_source = SOURCE_NONE; } void toggle_stop_start(GtkWidget * widget, gpointer data) { if (input_tag == -1) { start_reading_audio(); } else { stop_reading_audio(); } } void start_reading_audio() { int n_eff = opt.data_block_size * (1.0 - opt.data_blocks_overlap); if (glfer.input_source == SOUNDCARD_SOURCE) { /* read from soundcard */ /* audio_available() has to be called whenever there's data on audio_fd */ input_tag = gdk_input_add(audio_fd, GDK_INPUT_READ, audio_available, NULL); } else if (glfer.input_source == FILE_SOURCE) { /* read from file */ if (file_ended == 1) { audio_fd = open_wav_file(fname, n_eff, &opt.sample_rate); file_ended = 0; } input_tag = g_idle_add((GSourceFunc)audio_available, NULL); } stop_start_button_set_label("Stop"); } void stop_reading_audio() { if (input_tag != -1) { /* if currently reading from a source */ gtk_input_remove(input_tag); input_tag = -1; stop_start_button_set_label("Start"); /* do not close an open file, so that pressing again the Start/Stop button continues the file processing */ } } void change_params(int mode_sel) { /* save current open file name (if any) */ char *current_fname; if (fname) current_fname = strdup(fname); else current_fname = NULL; /* check if this is the first call at program start-up */ if (glfer.current_mode != MODE_NONE) { /* stop reading from the current data source */ stop_reading_audio(); /* close current mode */ switch (glfer.current_mode) { case MODE_FFT: fft_close(&fft_gram_par); break; case MODE_MTM: mtm_close(&mtm_gram_par); break; case MODE_HPARMA: hparma_close(&hparma_gram_par); break; case MODE_LMP: lmp_close(&lmp_gram_par); break; default: g_print("change_params: MODE_UNKNOWN\n"); } FREE_MAYBE(psdbuf); } /* initialize mode */ switch (mode_sel) { case MODE_FFT : if ((fft_gram_par.n != opt.data_block_size) || (fft_gram_par.overlap != opt.data_blocks_overlap)) { close_audio(); init_audio(current_fname); } if (fft_gram_par.n != opt.data_block_size) { /* delete and reallocate averaging buffer */ delete_avg(&avgdata); alloc_avg(&avgdata, opt.data_block_size, opt.avgsamples); glfer.avgfill = 0; /* reset ratio of average buffer full */ glfer.avgtime = (float) opt.avgsamples * (float) opt.data_block_size * (1.0 / (float) opt.sample_rate)*(1.0-opt.data_blocks_overlap); } psd_n = opt.data_block_size / 2 + 1; psdbuf = calloc(psd_n, sizeof(float)); fft_gram_par.n = opt.data_block_size; fft_gram_par.window_type = opt.window_type; fft_gram_par.overlap = opt.data_blocks_overlap; fft_gram_par.a = opt.limiter_a; fft_gram_par.limiter = opt.enable_limiter; fft_init(&fft_gram_par); break; case MODE_MTM : if ((mtm_gram_par.fft.n != opt.data_block_size) || (mtm_gram_par.fft.overlap != opt.data_blocks_overlap)) { close_audio(); init_audio(current_fname); } if (fft_gram_par.n != opt.data_block_size) { /* delete and reallocate averaging buffer */ delete_avg(&avgdata); alloc_avg(&avgdata, opt.data_block_size, opt.avgsamples); glfer.avgfill = 0; /* reset ratio of average buffer full */ glfer.avgtime = (float) opt.avgsamples * (float) opt.data_block_size * (1.0 / (float) opt.sample_rate)*(1.0-opt.data_blocks_overlap); } psd_n = opt.data_block_size / 2 + 1; psdbuf = calloc(psd_n, sizeof(float)); mtm_gram_par.fft.n = opt.data_block_size;; mtm_gram_par.fft.window_type = RECTANGULAR_WINDOW; /* that is, no windowing is used */ mtm_gram_par.fft.overlap = opt.data_blocks_overlap; mtm_gram_par.fft.a = opt.limiter_a; mtm_gram_par.fft.limiter = opt.enable_limiter; mtm_gram_par.w = opt.mtm_w; mtm_gram_par.kmax = opt.mtm_k; mtm_init(&mtm_gram_par); break; case MODE_HPARMA : if ((hparma_gram_par.fft.n != opt.data_block_size) || (hparma_gram_par.fft.overlap != opt.data_blocks_overlap)) { close_audio(); init_audio(current_fname); } if (fft_gram_par.n != opt.data_block_size) { /* delete and reallocate averaging buffer */ delete_avg(&avgdata); alloc_avg(&avgdata, opt.data_block_size, opt.avgsamples); glfer.avgfill = 0; /* reset ratio of average buffer full */ glfer.avgtime = (float) opt.avgsamples * (float) opt.data_block_size * (1.0 / (float) opt.sample_rate)*(1.0-opt.data_blocks_overlap); } psd_n = opt.data_block_size / 2 + 1; psdbuf = calloc(psd_n, sizeof(float)); hparma_gram_par.fft.n = opt.data_block_size; hparma_gram_par.fft.window_type = RECTANGULAR_WINDOW; hparma_gram_par.fft.overlap = opt.data_blocks_overlap; hparma_gram_par.fft.a = opt.limiter_a; hparma_gram_par.fft.limiter = opt.enable_limiter; hparma_gram_par.t = opt.hparma_t; hparma_gram_par.p_e = opt.hparma_p_e; hparma_gram_par.q_e = -1; hparma_init(&hparma_gram_par); break; case MODE_LMP : if ((lmp_gram_par.fft.n != opt.data_block_size) || (lmp_gram_par.fft.overlap != opt.data_blocks_overlap)) { close_audio(); init_audio(current_fname); } if (fft_gram_par.n != opt.data_block_size) { /* delete and reallocate averaging buffer */ delete_avg(&avgdata); alloc_avg(&avgdata, opt.data_block_size, opt.avgsamples); glfer.avgfill = 0; /* reset ratio of average buffer full */ glfer.avgtime = (float) opt.avgsamples * (float) opt.data_block_size * (1.0 / (float) opt.sample_rate)*(1.0-opt.data_blocks_overlap); } psd_n = opt.data_block_size / 2 + 1; psdbuf = calloc(psd_n, sizeof(float)); lmp_gram_par.fft.n = opt.data_block_size; lmp_gram_par.fft.window_type = RECTANGULAR_WINDOW; lmp_gram_par.fft.overlap = opt.data_blocks_overlap; lmp_gram_par.fft.a = opt.limiter_a; lmp_gram_par.fft.limiter = opt.enable_limiter; lmp_gram_par.avg = opt.lmp_av; lmp_init(&lmp_gram_par); break; default: g_print("change_params: MODE_UNKNOWN\n"); } glfer.current_mode = mode_sel; main_window_init(psd_n, 0, (float) opt.sample_rate / 2); start_reading_audio(); } glfer-0.4.2/aclocal.m40000644000175000001440000011423711330652720011400 00000000000000# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # Configure paths for GTK+ # Owen Taylor 1997-2001 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, dnl pass to pkg-config dnl AC_DEFUN([AM_PATH_GTK_2_0], [dnl dnl Get the cflags and libraries from pkg-config dnl AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], , enable_gtktest=yes) pkg_config_args=gtk+-2.0 for module in . $4 do case "$module" in gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done no_gtk="" AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test x$PKG_CONFIG != xno ; then if pkg-config --atleast-pkgconfig-version 0.7 ; then : else echo "*** pkg-config too old; version 0.7 or better required." no_gtk=yes PKG_CONFIG=no fi else no_gtk=yes fi min_gtk_version=ifelse([$1], ,2.0.0,$1) AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" enable_gtktest=no fi if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then : else no_gtk=yes fi fi if test x"$no_gtk" = x ; then GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK+ is sufficiently new. (Also sanity dnl checks the results of pkg-config to some extent) dnl rm -f conf.gtktest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://pkgconfig.sourceforge.net" else if test -f conf.gtktest ; then : else echo "*** Could not run GTK+ test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK+ or finding the wrong" echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.9.6])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR glfer-0.4.2/config.h.in0000644000175000001440000000525511330652727011571 00000000000000/* config.h.in. Generated from configure.in by autoheader. */ /* "Define if you want to have debug informations" */ #undef DEBUG /* Define to 1 if you have the header file. */ #undef HAVE_DMALLOC_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `dmalloc' library (-ldmalloc). */ #undef HAVE_LIBDMALLOC /* Define to 1 if you have the `fftw' library (-lfftw). */ #undef HAVE_LIBFFTW /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the `rfftw' library (-lrfftw). */ #undef HAVE_LIBRFFTW /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Version number of package */ #undef VERSION /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `int' if doesn't define. */ #undef uid_t glfer-0.4.2/README0000644000175000001440000001726711330652277010434 00000000000000README for glfer 0.4.2 (29 Jan 2010) by Claudio Girardi, IN3OTD Operating --------- *** Please note that you will need to run the program with root *** privileges to gain access to the transmitter control (parallel or *** serial) port; you can use sudo ('sudo glfer') for this. glfer was designed for transmitting and receiving QRSS/DFCW transmissions, as used by hams mainly on the 137 and 73 kHz bands. It is composed of two main parts: - the spectrogram window - the TX keying functions Almost all the program functions have their own help; just keep the mouse pointer over a input box or on a button for more than a second and a brief explanation will appear. Try "glfer -h" for a list of all command line options. The spectrogram window shows the estimated spectrum for the input signal vs. time; input can be taken from the soundcard or from a WAV file specified on the command line with the "-f" switch or opened through the File/Open menu. Starting from release 0.3, it is possible to select a spectral estimator among several different types: - the "classical" periodogram, which is obtained as the squared modulus of the discrete Fourier transform, after tapering the data with a "window function" selectable among the Hanning, Blackman, Gaussian, Welch, Bartlett, Rectangular, Hamming and Kaiser types. As usual, the FFT number of points and the overlap between data blocks can be freely changed. - the multitaper method, which is a weighted combination of periodograms computed with different windows, all belonging to the same family and having certain peculiar properties. This method was described by David J. Thomson in "Spectrum Estimation and Harmonic Analysis", Proc. IEEE, vol.70, Sep. 1982. Besides the FFT size and overlap, it is possible to change also a relative bandwidth parameter and the number of windows used for the analysis. This method requires more CPU power than the first one, due to the fact that several FFTs are performed on the same block of data, using different windows. The resulting spectrum is similar to a classical periodogram, but with much less variance (i.e. less variation in the background noise [speckle]). Performances are also similar to the periodogram, maybe it makes detection of QRSS signals a little easier, but this doesn't means they are always more readable. - a (so called) "high performance" ARMA model, which assumes a certain model for the input data (in this case it assumes white noise plus sinusoids, rather strange eh? 8-)) and tries to extract the parameters of this model (sinusoids frequency and strenght) from the data. Reference article for this implementation is "Spectral Estimation: An Overdetermined Rational Model Equation Approach", by James A. Cadzow, Proc. IEEE, vol.70, Sep. 1982. At present this method is still experimental. There are two parameters that can be varied: t is the number of samples used for computing the samples autocorrelation and p_e is the order of the AR model. This latter must be less than t, and both number should be fairly small in order not to overload the CPU. The number of sinusoids is estimated autimatically from the samples autocorrelation. Use the default numbers as a starting point and experiment! Unfortunately this spectral estimator performs poorly with non-white noise (as we have usually in the RX audio, due to the IF filters) and high noise levels. On the other hand it provides a very good visual SNR with signals not buried in the noise... I will try different related methods in the future, in the hope of finding one really useful for digging weak signals out of noise. - LMP estimator The spectrogram window has an automatic gain control which is enabled by default; you can choose fixed limits for the display in the Display options tab. The spectrogram display can be saved as a graphics image; you can choose to save the entire window or to select a rectangular region to save with the mouse. The transmitter control part of the program is capable of keying the PA according to the QRSS (slow CW) or DFCW modes. The transmission timing, as dot length and PTT delay, can be freely varied. A sidetone function can be used as a monitor for the transmission and gives also the two (freely selectable) tones for DFCW. If you do not hear any sound after enabling the sidetone please check that the 'pcspkr' module is loaded ('lsmod | grep pcspkr' as root); if it is not, check that loading of that module is not disabled in '/etc/modprobe.d/blacklist' . The TX can be controlled through the serial or the parallel port; the pins used for PTT and KEY are the same used also in other digital modes programs (and also the same as in Rik Strobbe QRS). For the serial port, enter the serial port name in the control port dialog (e.g. ttyS0 or ttyUSB0). Pin assignment is RTS = key and DTR = PTT/DFCW . For the parallel port, enter the parallel port name in the control port dialog (e.g. lp0 or lp1). Pin assignment is DB0 = key, DB1 = PTT/DFCW . Compiling --------- To compile glfer, after extracting the tar archive to a suitable directory (which you should have done already since you are reading this...), it should be sufficient just to type ./configure make and at the end of the compilation you should have the executable file, named glfer. See the file INSTALL for detailed, generic, instructions. Please let me know of any strange warning message during compilation or (even worse) if the compilation fails; it would be helpful to have the configure and make outputs in a file (for example: make > log.txt 2>&1 ) for a better analysis. The first time you run glfer you will be asked to select a control port (serial or parallel) for the TX; if your mouse is connected to the serial port be sure NOT to select its serial port for controlling the TX, otherwise a mouse freeze may occur. All the settings can be saved to a configuration file; in this case they will be automatically reloaded when glfer starts. *** Please note that you will need to run the program as root (or suid *** root) to gain access to the transmitter control (parallel or serial) *** port. The FFTW library, by Matteo Frigo and Steven G. Johnson, is not needed to compile glfer, but will be used if available. The FFTW library can be found at FFTW home page, http://www.fftw.org . To adjust the soundcard input sensitivity you can use the mixer control program installed on your system (e.g. aumixer or alsamixer) or the mixer program, which is included in the sources and compiled with glfer. To quickly select the line input instead of the mic input, which is usually the default, you can just type "mixer +rec line" The program source code contains parts derived from: xspectrum by Vincent Arkesteijn specgrm2 by Philip VanBaren Geg by David Bryant Octave files for computing the Slepian tapers by John Kuehne Some gsl (GNU Scientific Library) files by Gerard Jungman bell-p-w.f by Brad Bell, Don Percival and Andrew Walden bplay by David Monro and most of the features available in it are shamelessy copied from : QRS by Rik Strobbe, ON7YD http://www.qsl.net/on7yd/ EasyGram by Petr Maly, OK1FIG; http://www.mujweb.cz/www/OK1FIG/136k.htm Spectrogram by Richard S. Horne; http://www.monumental.com/rshorne/gram.html I would like to thank all the above authors for making their nice programs available to the ham community. Should you have any suggestion, found one of the many bugs, want to add some feature or to correct my english, please drop me a note. For the latest version please check http://www.qsl.net/in3otd/ 73 de Claudio, IN3OTD Local Variables: mode:indented-text mode:auto-fill End: glfer-0.4.2/g_options.c0000644000175000001440000016460311330644301011703 00000000000000/* g_options.c * * Copyright (C) 2001-2009 Claudio Girardi * (C) 2006 Edouard Griffiths for modifications implementing * averaging mode * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include #include #include "g_options.h" #include "g_txmsg.h" #include "util.h" #include "fft.h" #include "avg.h" #include "rcfile.h" #include "qrs.h" #include "glfer.h" #include "source.h" #include "g_main.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif extern opt_t opt; extern glfer_t glfer; extern avg_data_t avgdata; extern fft_window_t fft_windows[]; extern int num_fft_windows; static GtkWidget *spec_window = NULL, *qrss_window = NULL, *tx_test_window = NULL, *port_window = NULL, *audio_window = NULL; static GtkWidget *sn_bu, *be_keyup_bu, *be_keydown_bu, *qrss_bu, *dfcw_bu, *serial_bu, *parallel_bu, *hendrix_bu, *autoscale_bu; static GtkWidget *offset_en, *data_block_size_en, *data_blocks_overlap_en, *display_update_en, *limiter_a_en, *mtm_w_en, *mtm_k_en, *hparma_t_en, *hparma_p_e_en, *lmp_av_en, *sample_rate_en, *dot_time_en, *control_port_en, *wpm_en, *lin_scale_bu, *log_scale_bu, *ptt_delay_en, *sidetone_fr_en, *dfcw_dot_fr_en, *dfcw_dash_fr_en, *be_pause_en, *level_en, *lin_scale_bu, *lin_scale_max0_bu, *log_scale_bu, *log_scale_max0_bu, *avg_sumavg_bu, *avg_plain_bu, *avg_sumextreme_bu, *noavg_bu, *max_level_en, *min_level_en, *avgsamples_en, *minavgband_en, *maxavgband_en, *audio_device_en, *avgtime_la, *avgintdb_la, *bin_size_la; ; typedef struct _palette_t palette_t; struct _palette_t { gchar *name; gint type; }; static palette_t palettes[] = { {"/HSV", HSV}, {"/Thresholded HSV", THRESH}, {"/Cool", COOL}, {"/Hot", HOT}, {"/Black and White", BW}, {"/Bone", BONE}, {"/Copper", COPPER}, {"/IN3OTD", OTD} }; static gint num_palettes = sizeof(palettes) / sizeof(palettes[0]); static void dot_time_en_changed(GtkWidget * widget, gpointer * data); static void wpm_en_changed(GtkWidget * widget, gpointer * data); static void data_blocks_overlap_en_changed(GtkWidget * widget, gpointer * data); static void data_block_size_en_changed(GtkWidget * widget, gpointer * data); static void display_update_en_changed(GtkWidget * widget, gpointer * data); static void autoscale_bu_toggled(GtkWidget * widget, gpointer * data); static void spec_prefs_to_widgets(void); /* save_event, called by the save button, saves the preferences to file */ static void save_event(GtkWidget * widget, gpointer data) { rc_file_write(); } static void ptt_clicked(GtkWidget * widget, gpointer data) { if (GTK_TOGGLE_BUTTON(widget)->active == TRUE) ptt_on(); else ptt_off(); } static void key_clicked(GtkWidget * widget, gpointer data) { if (GTK_TOGGLE_BUTTON(widget)->active == TRUE) key_down(); else key_up(); } static void close_tx_test_dialog(GtkWidget * widget, gpointer data) { /* make sure PTT and KEY are off */ ptt_off(); key_up(); gtk_widget_destroy(widget); } void tx_test_dialog(GtkWidget * widget, gpointer data) { GtkWidget *temp_bu, *ptt_bu, *key_bu; GtkWidget *te_fr; GtkWidget *tmp_hb; if (tx_test_window && tx_test_window->window) { gtk_widget_map(tx_test_window); gdk_window_raise(tx_test_window->window); return; } tx_test_window = gtk_dialog_new(); g_signal_connect(G_OBJECT(tx_test_window), "destroy", G_CALLBACK(gtk_widget_destroyed), &tx_test_window); /* setup window properties */ gtk_window_set_wmclass(GTK_WINDOW(tx_test_window), "txtest", "glfer"); gtk_window_set_title(GTK_WINDOW(tx_test_window), "TX test"); gtk_window_set_policy(GTK_WINDOW(tx_test_window), FALSE, FALSE, FALSE); gtk_window_position(GTK_WINDOW(tx_test_window), GTK_WIN_POS_NONE); gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(tx_test_window)->vbox), 5); /* TX test frame */ te_fr = gtk_frame_new("Test"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(tx_test_window)->vbox), te_fr, FALSE, FALSE, 10); gtk_widget_show(te_fr); /* TX test hbox */ tmp_hb = gtk_hbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(te_fr), tmp_hb); gtk_widget_show(tmp_hb); /* PTT button */ ptt_bu = gtk_check_button_new_with_label("PTT"); gtk_tooltips_set_tip(glfer.tt, ptt_bu, "Toggle PTT", NULL); gtk_box_pack_start(GTK_BOX(tmp_hb), ptt_bu, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(ptt_bu), "clicked", G_CALLBACK(ptt_clicked), NULL); gtk_widget_show(ptt_bu); /* KEY button */ key_bu = gtk_check_button_new_with_label("KEY"); gtk_tooltips_set_tip(glfer.tt, key_bu, "Toggle KEY", NULL); gtk_box_pack_start(GTK_BOX(tmp_hb), key_bu, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(key_bu), "clicked", G_CALLBACK(key_clicked), NULL); gtk_widget_show(key_bu); /* OK button */ temp_bu = gtk_button_new_with_label("Ok"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Close window", NULL); g_signal_connect_swapped(G_OBJECT(temp_bu), "clicked", G_CALLBACK(close_tx_test_dialog), GTK_OBJECT(tx_test_window)); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(tx_test_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); /* make sure PTT and KEY are off */ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(ptt_bu), FALSE); ptt_off(); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(key_bu), FALSE); key_up(); gtk_widget_show(tx_test_window); } /* compound_entry, a convenience function to create a label and an entry in * a horizontal box, and pack it into the vbox provided */ static void compound_entry(gchar * title, GtkWidget ** entry, GtkWidget * vbox) { GtkWidget *hbox, *label; hbox = gtk_hbox_new(FALSE, 0); *entry = gtk_entry_new(); //gtk_widget_set_usize(*entry, 75, -1); gtk_box_pack_end(GTK_BOX(hbox), *entry, FALSE, FALSE, 0); label = gtk_label_new(title); gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(label); gtk_widget_show(*entry); gtk_widget_show(hbox); } /* prefs_to_widgets, takes the information * in the prefs struct, and puts it into the appropriate widgets */ static void spec_prefs_to_widgets(void) { gchar *tmp_str; tmp_str = g_strdup_printf("%.1f", opt.offset_freq); gtk_entry_set_text(GTK_ENTRY(offset_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%.1f", opt.thr_level); gtk_entry_set_text(GTK_ENTRY(level_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%.1f", opt.max_level_db); gtk_entry_set_text(GTK_ENTRY(max_level_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%.1f", opt.min_level_db); gtk_entry_set_text(GTK_ENTRY(min_level_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%i", opt.avgsamples); gtk_entry_set_text(GTK_ENTRY(avgsamples_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%f", opt.min_avgband); gtk_entry_set_text(GTK_ENTRY(minavgband_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%f", opt.max_avgband); gtk_entry_set_text(GTK_ENTRY(maxavgband_en), tmp_str); g_free(tmp_str); /* FFT */ tmp_str = g_strdup_printf("%.2f", opt.data_blocks_overlap * 100.0); gtk_entry_set_text(GTK_ENTRY(data_blocks_overlap_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%.3f", opt.display_update_time); gtk_entry_set_text(GTK_ENTRY(display_update_en), tmp_str); g_free(tmp_str); /* keep this after the preceding two, since it will trigger an update of the related entries... */ tmp_str = g_strdup_printf("%i", opt.data_block_size); gtk_entry_set_text(GTK_ENTRY(data_block_size_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%f", opt.limiter_a); gtk_entry_set_text(GTK_ENTRY(limiter_a_en), tmp_str); g_free(tmp_str); if (opt.enable_limiter == 1) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(hendrix_bu), TRUE); else gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(hendrix_bu), FALSE); /* MTM */ tmp_str = g_strdup_printf("%.1f", opt.mtm_w); gtk_entry_set_text(GTK_ENTRY(mtm_w_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%i", opt.mtm_k); gtk_entry_set_text(GTK_ENTRY(mtm_k_en), tmp_str); g_free(tmp_str); /* HPARMA */ tmp_str = g_strdup_printf("%i", opt.hparma_t); gtk_entry_set_text(GTK_ENTRY(hparma_t_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%i", opt.hparma_p_e); gtk_entry_set_text(GTK_ENTRY(hparma_p_e_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%i", opt.sample_rate); gtk_entry_set_text(GTK_ENTRY(sample_rate_en), tmp_str); g_free(tmp_str); /* LMP */ tmp_str = g_strdup_printf("%i", opt.lmp_av); gtk_entry_set_text(GTK_ENTRY(lmp_av_en), tmp_str); g_free(tmp_str); /* Display */ if (opt.scale_type == SCALE_LIN) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lin_scale_bu), TRUE); else if (opt.scale_type == SCALE_LIN_MAX0) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lin_scale_max0_bu), TRUE); else if (opt.scale_type == SCALE_LOG) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(log_scale_bu), TRUE); else { g_print("opt.scale_type = %i\n", opt.scale_type); g_assert_not_reached(); } switch (opt.averaging) { case AVG_SUMAVG: gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(avg_sumavg_bu), TRUE); break; case AVG_PLAIN: gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(avg_plain_bu), TRUE); break; case AVG_SUMEXTREME: gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(avg_sumextreme_bu), TRUE); break; case NO_AVG: gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(noavg_bu), TRUE); break; } if (opt.autoscale == 1) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(autoscale_bu), TRUE); else gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(autoscale_bu), FALSE); } static void avg_reset(GtkWidget * widget, gpointer data) { gchar *tmp_str; int tmp_int; tmp_str = gtk_editable_get_chars(GTK_EDITABLE(avgsamples_en), 0, -1); tmp_int = atoi(tmp_str); opt.avgsamples = tmp_int; delete_avg(&avgdata); alloc_avg(&avgdata,opt.data_block_size,opt.avgsamples); g_free(tmp_str); glfer.avgfill = 0; // reset fill ratio of averaging buffer } /* widgets_to_prefs, callback for ok button, * puts the information in the widgets into the prefs struct */ static void spec_widgets_to_prefs(GtkWidget * widget, gpointer data) { gchar *tmp_str; int tmp_int; float tmp_float; tmp_str = gtk_editable_get_chars(GTK_EDITABLE(offset_en), 0, -1); opt.offset_freq = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(level_en), 0, -1); opt.thr_level = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(max_level_en), 0, -1); opt.max_level_db = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(min_level_en), 0, -1); opt.min_level_db = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(avgsamples_en), 0, -1); tmp_int = atoi(tmp_str); g_free(tmp_str); if (tmp_int != opt.avgsamples) // FIXME: ahould call alloc_avg also at first average usage (first call) { opt.avgsamples = tmp_int; delete_avg(&avgdata); alloc_avg(&avgdata,opt.data_block_size,opt.avgsamples); tmp_str = g_strdup_printf("Integration gain %.1f dB", 10.0*log10(((float) opt.avgsamples)*(1.0-opt.data_blocks_overlap))); gtk_label_set_text(GTK_LABEL(avgintdb_la), tmp_str); g_free(tmp_str); glfer.avgfill = 0; // reset ratio of average buffer full glfer.avgtime = (float) opt.avgsamples * (float) opt.data_block_size * (1.0 / (float) opt.sample_rate)*(1.0-opt.data_blocks_overlap); tmp_str = g_strdup_printf("Avg time %2.2f s", glfer.avgtime); gtk_label_set_text(GTK_LABEL(avgtime_la), tmp_str); g_free(tmp_str); } tmp_str = gtk_editable_get_chars(GTK_EDITABLE(minavgband_en), 0, -1); opt.min_avgband = atof(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(maxavgband_en), 0, -1); opt.max_avgband = atof(tmp_str); /* FFT */ tmp_str = gtk_editable_get_chars(GTK_EDITABLE(data_block_size_en), 0, -1); opt.data_block_size = atoi(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(data_blocks_overlap_en), 0, -1); opt.data_blocks_overlap = atof(tmp_str) / 100.0; g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(display_update_en), 0, -1); opt.display_update_time = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(limiter_a_en), 0, -1); opt.limiter_a = atof(tmp_str); g_free(tmp_str); if (GTK_TOGGLE_BUTTON(hendrix_bu)->active == TRUE) opt.enable_limiter = 1; else opt.enable_limiter = 0; /* MTM */ tmp_str = gtk_editable_get_chars(GTK_EDITABLE(mtm_w_en), 0, -1); opt.mtm_w = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(mtm_k_en), 0, -1); opt.mtm_k = atoi(tmp_str); g_free(tmp_str); /* HPARMA */ tmp_str = gtk_editable_get_chars(GTK_EDITABLE(hparma_t_en), 0, -1); opt.hparma_t = atoi(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(hparma_p_e_en), 0, -1); opt.hparma_p_e = atoi(tmp_str); g_free(tmp_str); /* LMP */ tmp_str = gtk_editable_get_chars(GTK_EDITABLE(lmp_av_en), 0, -1); opt.lmp_av = atoi(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(sample_rate_en), 0, -1); tmp_int = atoi(tmp_str); g_free(tmp_str); if (tmp_int != opt.sample_rate) // EG changed? { opt.sample_rate = tmp_int; tmp_str = g_strdup_printf("Resulting bin size %3.3f Hz", (float) opt.sample_rate / (float) opt.data_block_size); // update bin size label gtk_label_set_text(GTK_LABEL(bin_size_la), tmp_str); g_free(tmp_str); } if (GTK_TOGGLE_BUTTON(lin_scale_bu)->active) opt.scale_type = SCALE_LIN; else if (GTK_TOGGLE_BUTTON(lin_scale_max0_bu)->active) opt.scale_type = SCALE_LIN_MAX0; else if (GTK_TOGGLE_BUTTON(log_scale_bu)->active) opt.scale_type = SCALE_LOG; else if (GTK_TOGGLE_BUTTON(log_scale_max0_bu)->active) opt.scale_type = SCALE_LOG_MAX0; else g_assert_not_reached(); if (GTK_TOGGLE_BUTTON(avg_sumavg_bu)->active) // EG averaging mode opt.averaging = AVG_SUMAVG; else if (GTK_TOGGLE_BUTTON(noavg_bu)->active) opt.averaging = NO_AVG; else if (GTK_TOGGLE_BUTTON(avg_plain_bu)->active) opt.averaging = AVG_PLAIN; else if (GTK_TOGGLE_BUTTON(avg_sumextreme_bu)->active) opt.averaging = AVG_SUMEXTREME; else g_assert_not_reached(); if (GTK_TOGGLE_BUTTON(autoscale_bu)->active == TRUE) // EG autoscale mode opt.autoscale = 1; else opt.autoscale = 0; change_params(glfer.current_mode); } static void palette_sel_changed(gpointer dummy, guint callback_action, GtkWidget * widget) { opt.palette = callback_action; set_palette(callback_action); } static void fft_windows_sel_changed(gpointer dummy, guint callback_action, GtkWidget * widget) { opt.window_type = callback_action; change_params(glfer.current_mode); } void spec_settings_dialog(GtkWidget * widget, gpointer data) { gint i; gchar *tmp_str; GtkWidget *nb; GtkWidget *temp_la; GtkWidget *temp_bu; GtkWidget *tmp_vb, *tb_vb, *tmp_hb; GtkWidget *pa_fr, *ty_fr; GtkItemFactory *item_factory = NULL; GtkItemFactoryEntry entry; char *menu_title = ""; GtkWidget *menu = NULL; GtkWidget *option_menu = NULL; GSList *scale_type_gr, *avg_type_gr; if (spec_window && spec_window->window) { gtk_widget_map(spec_window); gdk_window_raise(spec_window->window); return; } spec_window = gtk_dialog_new(); g_signal_connect(G_OBJECT(spec_window), "destroy", G_CALLBACK(gtk_widget_destroyed), &spec_window); /* setup window properties */ gtk_window_set_wmclass(GTK_WINDOW(spec_window), "specprefs", "glfer"); gtk_window_set_title(GTK_WINDOW(spec_window), "Spectrogram preferences"); gtk_window_set_policy(GTK_WINDOW(spec_window), FALSE, FALSE, FALSE); gtk_window_position(GTK_WINDOW(spec_window), GTK_WIN_POS_NONE); gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(spec_window)->vbox), 5); nb = gtk_notebook_new(); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(nb), GTK_POS_TOP); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spec_window)->vbox), nb, TRUE, TRUE, 0); gtk_widget_show(nb); /* Input data frame */ pa_fr = gtk_frame_new("Input data"); gtk_widget_show(pa_fr); temp_la = gtk_label_new("Input data"); gtk_notebook_append_page(GTK_NOTEBOOK(nb), pa_fr, temp_la); /* Input data vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); /* Input data entries */ /* number of points */ compound_entry("Points :", &data_block_size_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, data_block_size_en, "Number of points for the data blocks to be analyzed", NULL); /* we connect this function here so when the block size is changed the display update interval is kept constant */ g_signal_connect(G_OBJECT(data_block_size_en), "changed", G_CALLBACK(data_block_size_en_changed), NULL); /* overlap between FFT blocks */ compound_entry("Overlap [%]:", &data_blocks_overlap_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, data_blocks_overlap_en, "Overlap between successive data blocks [0-100%]", NULL); g_signal_connect(G_OBJECT(data_blocks_overlap_en), "changed", G_CALLBACK(data_blocks_overlap_en_changed), NULL); /* display update time */ compound_entry("Update interval [s]:", &display_update_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, display_update_en, "Interval between display updates", NULL); g_signal_connect(G_OBJECT(display_update_en), "changed", G_CALLBACK(display_update_en_changed), NULL); // resulting bin size 0.3.5 EG tmp_str = g_strdup_printf("Resulting bin size %3.3f Hz", (float) opt.sample_rate / (float) opt.data_block_size); bin_size_la = gtk_label_new(tmp_str); gtk_box_pack_start(GTK_BOX(tmp_vb), bin_size_la, TRUE, TRUE, 0); gtk_widget_show(bin_size_la); /* RA9MB nonlinear processing parameter */ compound_entry("RA9MB A parameter :", &limiter_a_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, limiter_a_en, "EXPERIMENTAL: RA9MB nonlinear processing A parameter. 0.0 is conventional periodogram, otherwise 0.001 is a good starting point", NULL); /* "Hendrixizer" button */ hendrix_bu = gtk_check_button_new_with_label("Hendrixizer (limiter)"); gtk_tooltips_set_tip(glfer.tt, hendrix_bu, "Enable strong limiting on input signal", NULL); gtk_box_pack_start(GTK_BOX(tmp_vb), hendrix_bu, TRUE, TRUE, 0); gtk_widget_show(hendrix_bu); /* FFT frame */ pa_fr = gtk_frame_new("FFT"); gtk_widget_show(pa_fr); temp_la = gtk_label_new("FFT"); gtk_notebook_append_page(GTK_NOTEBOOK(nb), pa_fr, temp_la); /* FFT vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); /* FFT entries */ /* FFT window selection */ item_factory = gtk_item_factory_new(GTK_TYPE_MENU, menu_title, NULL); for (i = 0; i < num_fft_windows; i++) { entry.path = fft_windows[i].name; entry.accelerator = NULL; entry.callback = fft_windows_sel_changed; entry.callback_action = fft_windows[i].type;; entry.item_type = NULL; gtk_item_factory_create_item(item_factory, &entry, NULL, 1); } menu = gtk_item_factory_get_widget(item_factory, menu_title); /* create the option menu for the FFT data window type list */ option_menu = gtk_option_menu_new(); gtk_tooltips_set_tip(glfer.tt, option_menu, "FFT data window type", NULL); /* provide the popup menu */ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu); /* add label */ temp_la = gtk_label_new("Window :"); gtk_widget_show(temp_la); tmp_hb = gtk_hbox_new(FALSE, 0); gtk_widget_show(tmp_hb); gtk_box_pack_start(GTK_BOX(tmp_vb), tmp_hb, FALSE, FALSE, 5); gtk_box_pack_end(GTK_BOX(tmp_hb), option_menu, FALSE, FALSE, 0); gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), opt.window_type); gtk_box_pack_end(GTK_BOX(tmp_hb), temp_la, FALSE, FALSE, 0); gtk_widget_show(option_menu); /* MTM frame */ pa_fr = gtk_frame_new("MTM"); gtk_widget_show(pa_fr); temp_la = gtk_label_new("MTM"); gtk_notebook_append_page(GTK_NOTEBOOK(nb), pa_fr, temp_la); /* MTM vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); /* MTM entries */ compound_entry("Relative bandwidth :", &mtm_w_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, mtm_w_en, "Window relative bandwidth (usually between 1.0 and 4.0)", NULL); compound_entry("Number of windows :", &mtm_k_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, mtm_k_en, "Number of windows (tapers) to use for a single block", NULL); /* HPARMA frame */ pa_fr = gtk_frame_new("HPARMA"); gtk_widget_show(pa_fr); temp_la = gtk_label_new("HPARMA"); /* HPARMA vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); gtk_notebook_append_page(GTK_NOTEBOOK(nb), pa_fr, temp_la); compound_entry("t :", &hparma_t_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, hparma_t_en, "Number of equations used to solve the extended Yule-Walker equation", NULL); compound_entry("p_e :", &hparma_p_e_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, hparma_p_e_en, "Number of equations parameters in the AR model", NULL); /* LMP frame */ pa_fr = gtk_frame_new("LMP"); gtk_widget_show(pa_fr); temp_la = gtk_label_new("LMP"); gtk_notebook_append_page(GTK_NOTEBOOK(nb), pa_fr, temp_la); /* LMP vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); /* LMP entries */ compound_entry("Averaged data blocks :", &lmp_av_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, lmp_av_en, "Number of data blocks for the internal average", NULL); /* Acquisition frame */ pa_fr = gtk_frame_new("Acquisition"); gtk_widget_show(pa_fr); temp_la = gtk_label_new("Acquisition"); gtk_notebook_append_page(GTK_NOTEBOOK(nb), pa_fr, temp_la); /* Acquisition vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); /* sample rate */ compound_entry("Sample rate [Hz] :", &sample_rate_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, sample_rate_en, "Soundcard sample rate", NULL); /* Display frame */ pa_fr = gtk_frame_new("Display"); gtk_widget_show(pa_fr); temp_la = gtk_label_new("Display"); gtk_notebook_append_page(GTK_NOTEBOOK(nb), pa_fr, temp_la); /* Display vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); /* offset entry */ compound_entry("Offset [Hz] :", &offset_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, offset_en, "Spectrogram frequency offset", NULL); /* threshold level entry */ compound_entry("Threshold level [%] :", &level_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, level_en, "Display threshold level [0-99.9]", NULL); // max level entry 0.3.5 EG compound_entry("Max level [dB] :", &max_level_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, max_level_en, "Maximum display level [dB]", NULL); // min level entry 0.3.5 EG compound_entry("Min level [dB] :", &min_level_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, min_level_en, "Minimum display level [dB]", NULL); // autoscale button 0.3.5 EG autoscale_bu = gtk_check_button_new_with_label("Autoscale"); gtk_tooltips_set_tip(glfer.tt, autoscale_bu, "set autoscale display mode, max and min are not used then", NULL); gtk_box_pack_start(GTK_BOX(tmp_vb), autoscale_bu, TRUE, TRUE, 0); /* whan autoscale is enabled, gray out min and max fields */ g_signal_connect(G_OBJECT(autoscale_bu), "toggled", G_CALLBACK(autoscale_bu_toggled), NULL); gtk_widget_show(autoscale_bu); /* scale type frame */ ty_fr = gtk_frame_new("Scale"); gtk_box_pack_start(GTK_BOX(tmp_vb), ty_fr, FALSE, FALSE, 10); gtk_widget_show(ty_fr); /* Mode hbox */ tmp_hb = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(ty_fr), tmp_hb); gtk_widget_show(tmp_hb); /* transmissione mode radio buttons */ log_scale_bu = gtk_radio_button_new_with_label(NULL, "Log"); gtk_tooltips_set_tip(glfer.tt, log_scale_bu, "Set logarithmic scale", NULL); scale_type_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(log_scale_bu)); log_scale_max0_bu = gtk_radio_button_new_with_label(scale_type_gr, "Log Max"); gtk_tooltips_set_tip(glfer.tt, log_scale_max0_bu, "Set logarithmic scale with maximum set at 0dB (sumavg and sumextreme only)", NULL); scale_type_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(log_scale_max0_bu)); lin_scale_bu = gtk_radio_button_new_with_label(scale_type_gr, "Lin"); gtk_tooltips_set_tip(glfer.tt, lin_scale_bu, "Set linear scale", NULL); scale_type_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(lin_scale_bu)); lin_scale_max0_bu = gtk_radio_button_new_with_label(scale_type_gr, "Lin Max"); gtk_tooltips_set_tip(glfer.tt, lin_scale_max0_bu, "Set linear scale with maximum set at 0dB (sumavg and sumextreme only)", NULL); scale_type_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(lin_scale_max0_bu)); gtk_box_pack_start(GTK_BOX(tmp_hb), log_scale_bu, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tmp_hb), log_scale_max0_bu, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tmp_hb), lin_scale_bu, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tmp_hb), lin_scale_max0_bu, TRUE, TRUE, 0); gtk_widget_show(lin_scale_bu); gtk_widget_show(log_scale_bu); gtk_widget_show(lin_scale_max0_bu); gtk_widget_show(log_scale_max0_bu); /* palette frame */ pa_fr = gtk_frame_new("Palette"); gtk_box_pack_start(GTK_BOX(tmp_vb), pa_fr, FALSE, FALSE, 10); gtk_widget_show(pa_fr); /* palette selection vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); item_factory = gtk_item_factory_new(GTK_TYPE_MENU, menu_title, NULL); for (i = 0; i < num_palettes; i++) { entry.path = palettes[i].name; entry.accelerator = NULL; entry.callback = palette_sel_changed; entry.callback_action = palettes[i].type; entry.item_type = NULL; gtk_item_factory_create_item(item_factory, &entry, NULL, 1); } menu = gtk_item_factory_get_widget(item_factory, menu_title); /* create the option menu for the file type list */ option_menu = gtk_option_menu_new(); gtk_tooltips_set_tip(glfer.tt, option_menu, "Spectrogram palette", NULL); /* provide the popup menu */ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu); gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), opt.palette); gtk_box_pack_start(GTK_BOX(tmp_vb), option_menu, FALSE, FALSE, 0); gtk_widget_show(option_menu); // Averaging frame 0.3.5 EG pa_fr = gtk_frame_new("Averaging"); gtk_widget_show(pa_fr); temp_la = gtk_label_new("Averaging"); gtk_notebook_append_page(GTK_NOTEBOOK(nb), pa_fr, temp_la); // Display vbox tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); // Averaging selection frame ty_fr = gtk_frame_new("Mode"); gtk_box_pack_start(GTK_BOX(tmp_vb), ty_fr, FALSE, FALSE, 10); gtk_widget_show(ty_fr); // Mode hbox tmp_hb = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(ty_fr), tmp_hb); gtk_widget_show(tmp_hb); // averaging mode radio buttons 0.3.5 EG avg_sumavg_bu = gtk_radio_button_new_with_label(NULL, "Sumavg"); gtk_tooltips_set_tip(glfer.tt, avg_sumavg_bu, "Set sum scaled from average to max mode", NULL); avg_type_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(avg_sumavg_bu)); avg_plain_bu = gtk_radio_button_new_with_label(avg_type_gr, "Plain"); gtk_tooltips_set_tip(glfer.tt, avg_plain_bu, "Set plain average i.e. sum scaled by memory depth mode", NULL); avg_type_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(avg_plain_bu)); avg_sumextreme_bu = gtk_radio_button_new_with_label(avg_type_gr, "Sumextreme"); gtk_tooltips_set_tip(glfer.tt, avg_sumextreme_bu, "Set sum scaled to the extremes average mode", NULL); avg_type_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(avg_sumextreme_bu)); noavg_bu = gtk_radio_button_new_with_label(avg_type_gr, "NoAvg"); gtk_tooltips_set_tip(glfer.tt, noavg_bu, "Set no averaging mode", NULL); avg_type_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(noavg_bu)); gtk_box_pack_start(GTK_BOX(tmp_hb), avg_sumavg_bu, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tmp_hb), avg_plain_bu, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tmp_hb), avg_sumextreme_bu, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tmp_hb), noavg_bu, TRUE, TRUE, 0); gtk_widget_show(avg_sumavg_bu); gtk_widget_show(avg_plain_bu); gtk_widget_show(avg_sumextreme_bu); gtk_widget_show(noavg_bu); // number of samples to average over compound_entry("#Samples :", &avgsamples_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, avgsamples_en, "Number of samples to average over", NULL); // lower cutoff frequency for sum extreme mode compound_entry("Low cutoff [Hz] :", &minavgband_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, minavgband_en, "lower cutoff frequency for sum extreme mode", NULL); // higher cutoff frequency for sum extreme mode compound_entry("High cutoff [Hz] :", &maxavgband_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, maxavgband_en, "higher cutoff frequency for sum extreme mode", NULL); // Integration gain tmp_str = g_strdup_printf("Integration gain %.1f dB", 10.0*log10(((float) opt.avgsamples)*(1.0-opt.data_blocks_overlap))); avgintdb_la = gtk_label_new(tmp_str); gtk_box_pack_start(GTK_BOX(tmp_vb), avgintdb_la, TRUE, TRUE, 0); gtk_widget_show(avgintdb_la); // resulting integration time glfer.avgtime = (float) opt.avgsamples * (float) opt.data_block_size * (1.0 / (float) opt.sample_rate)*(1.0-opt.data_blocks_overlap); tmp_str = g_strdup_printf("Avg time %2.2f s", glfer.avgtime); avgtime_la = gtk_label_new(tmp_str); gtk_box_pack_start(GTK_BOX(tmp_vb), avgtime_la, TRUE, TRUE, 0); gtk_widget_show(avgtime_la); /* button box */ tb_vb = gtk_vbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spec_window)->vbox), tb_vb, TRUE, TRUE, 0); gtk_widget_show(tb_vb); /* OK button */ temp_bu = gtk_button_new_with_label("Ok"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Accept settings and close window", NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(spec_widgets_to_prefs), NULL); g_signal_connect_swapped(G_OBJECT(temp_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(spec_window)); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spec_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); /* Apply button */ temp_bu = gtk_button_new_with_label("Apply"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Accept settings and leave settings window open", NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(spec_widgets_to_prefs), NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spec_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); /* Save button */ temp_bu = gtk_button_new_with_label("Save"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Save settings", NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(spec_widgets_to_prefs), NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(save_event), NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spec_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); /* Cancel button */ temp_bu = gtk_button_new_with_label("Cancel"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Close window", NULL); g_signal_connect_swapped(G_OBJECT(temp_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(spec_window)); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spec_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); // Reset memory button temp_bu = gtk_button_new_with_label("AvgRst"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Reset averaging memory", NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(avg_reset), NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spec_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); /* load current values */ spec_prefs_to_widgets(); gtk_widget_show(spec_window); } static void autoscale_bu_toggled(GtkWidget * widget, gpointer * data) { if (GTK_TOGGLE_BUTTON(autoscale_bu)->active == TRUE) { gtk_widget_set_sensitive(max_level_en, FALSE); gtk_widget_set_sensitive(min_level_en, FALSE); } else { gtk_widget_set_sensitive(max_level_en, TRUE); gtk_widget_set_sensitive(min_level_en, TRUE); } } static void enable_sidetone(GtkWidget * widget, gpointer data) { //printf("file: %s\tline: %d\tfunc: %s\t value: %i\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, GTK_TOGGLE_BUTTON(widget)->active); /* enable/disable the sidetone entry according to the check button status */ //gtk_widget_set_sensitive(averages_en, GTK_TOGGLE_BUTTON(widget)->active); opt.sidetone = GTK_TOGGLE_BUTTON(widget)->active; } static void qrss_prefs_to_widgets(void) { gchar *tmp_str; tmp_str = g_strdup_printf("%.1f", opt.dot_time); gtk_entry_set_text(GTK_ENTRY(dot_time_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%.1f", opt.ptt_delay); gtk_entry_set_text(GTK_ENTRY(ptt_delay_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%.1f", opt.sidetone_freq); gtk_entry_set_text(GTK_ENTRY(sidetone_fr_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%.1f", opt.dfcw_dot_freq); gtk_entry_set_text(GTK_ENTRY(dfcw_dot_fr_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%.1f", opt.dfcw_dash_freq); gtk_entry_set_text(GTK_ENTRY(dfcw_dash_fr_en), tmp_str); g_free(tmp_str); tmp_str = g_strdup_printf("%.1f", opt.beacon_pause); gtk_entry_set_text(GTK_ENTRY(be_pause_en), tmp_str); g_free(tmp_str); if (opt.tx_mode == QRSS) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(qrss_bu), TRUE); else if (opt.tx_mode == DFCW) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(dfcw_bu), TRUE); else { g_print("opt.tx_mode = %i\n", opt.tx_mode); g_assert_not_reached(); } if (opt.beacon_tx_pause == FALSE) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(be_keyup_bu), TRUE); else if (opt.beacon_tx_pause == TRUE) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(be_keydown_bu), TRUE); else { g_print("opt.beacon_tx_pause = %i\n", opt.beacon_tx_pause); g_assert_not_reached(); } } static void qrss_widgets_to_prefs(GtkWidget * widget, gpointer data) { gchar *tmp_str; tmp_str = gtk_editable_get_chars(GTK_EDITABLE(dot_time_en), 0, -1); opt.dot_time = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(ptt_delay_en), 0, -1); opt.ptt_delay = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(sidetone_fr_en), 0, -1); opt.sidetone_freq = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(dfcw_dot_fr_en), 0, -1); opt.dfcw_dot_freq = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(dfcw_dash_fr_en), 0, -1); opt.dfcw_dash_freq = atof(tmp_str); g_free(tmp_str); tmp_str = gtk_editable_get_chars(GTK_EDITABLE(be_pause_en), 0, -1); opt.beacon_pause = atof(tmp_str); g_free(tmp_str); if (GTK_TOGGLE_BUTTON(be_keyup_bu)->active) opt.beacon_tx_pause = FALSE; else if (GTK_TOGGLE_BUTTON(be_keydown_bu)->active) opt.beacon_tx_pause = TRUE; else g_assert_not_reached(); if (GTK_TOGGLE_BUTTON(qrss_bu)->active) opt.tx_mode = QRSS; else if (GTK_TOGGLE_BUTTON(dfcw_bu)->active) opt.tx_mode = DFCW; else g_assert_not_reached(); /* update timers shown in the message transmission window, if it exists */ update_time_indications(); } static void data_block_size_en_changed(GtkWidget * widget, gpointer * data) { gchar *tmp_str; int tmp_i; tmp_str = gtk_editable_get_chars(GTK_EDITABLE(data_block_size_en), 0, -1); tmp_i = atoi(tmp_str); g_free(tmp_str); opt.data_block_size = tmp_i; /* update bin size label */ tmp_str = g_strdup_printf("Resulting bin size %3.3f Hz", (float) opt.sample_rate / (float) tmp_i); gtk_label_set_text(GTK_LABEL(bin_size_la), tmp_str); g_free(tmp_str); /* update average time label */ tmp_str = g_strdup_printf("Avg time %2.2f s", glfer.avgtime); gtk_label_set_text(GTK_LABEL(avgtime_la), tmp_str); g_free(tmp_str); /* keep the overlap constant and change the update interval */ opt.display_update_time = opt.data_block_size * (1.0 - opt.data_blocks_overlap) / opt.sample_rate; tmp_str = g_strdup_printf("%.3f", opt.display_update_time); gtk_signal_handler_block_by_func(GTK_OBJECT(display_update_en), G_CALLBACK(display_update_en_changed), data); gtk_entry_set_text(GTK_ENTRY(display_update_en), tmp_str); gtk_signal_handler_unblock_by_func(GTK_OBJECT(display_update_en), G_CALLBACK(display_update_en_changed), data); g_free(tmp_str); } static void data_blocks_overlap_en_changed(GtkWidget * widget, gpointer * data) { gchar *tmp_str; float tmp_f; tmp_str = gtk_editable_get_chars(GTK_EDITABLE(data_blocks_overlap_en), 0, -1); tmp_f = atof(tmp_str) / 100.0; g_free(tmp_str); /* FIXME: the following check should be improved... */ if ((tmp_f < 0) || (tmp_f >= 1.0)) { show_message("Overlap must be between 0 [included] and 100 [excluded]"); /* reset entry to the current valid value */ tmp_str = g_strdup_printf("%.2f", opt.data_blocks_overlap * 100.0); gtk_entry_set_text(GTK_ENTRY(data_blocks_overlap_en), tmp_str); gtk_editable_select_region(GTK_EDITABLE(data_blocks_overlap_en), 0, -1); g_free(tmp_str); return; } opt.data_blocks_overlap = tmp_f; opt.display_update_time = (1.0 - tmp_f) * opt.data_block_size / opt.sample_rate; tmp_str = g_strdup_printf("%.3f", opt.display_update_time); gtk_signal_handler_block_by_func(GTK_OBJECT(display_update_en), G_CALLBACK(display_update_en_changed), data); gtk_entry_set_text(GTK_ENTRY(display_update_en), tmp_str); gtk_signal_handler_unblock_by_func(GTK_OBJECT(display_update_en), G_CALLBACK(display_update_en_changed), data); g_free(tmp_str); /* update integration gain and average time labels */ tmp_str = g_strdup_printf("Integration gain %.1f dB", 10.0*log10(((float) opt.avgsamples)*(1.0-tmp_f))); gtk_label_set_text(GTK_LABEL(avgintdb_la), tmp_str); g_free(tmp_str); glfer.avgtime = (float) opt.avgsamples * (float) opt.data_block_size * (1.0 / (float) opt.sample_rate)*(1.0-tmp_f); tmp_str = g_strdup_printf("Avg time %2.2f s", glfer.avgtime); gtk_label_set_text(GTK_LABEL(avgtime_la), tmp_str); g_free(tmp_str); } static void display_update_en_changed(GtkWidget * widget, gpointer * data) { gchar *tmp_str; float tmp_update_time, tmp_overlap; tmp_str = gtk_editable_get_chars(GTK_EDITABLE(display_update_en), 0, -1); tmp_update_time = atof(tmp_str); g_free(tmp_str); /* compute resulting overlap */ tmp_overlap = 1.0 - opt.sample_rate * tmp_update_time / opt.data_block_size; if ((tmp_overlap < 0) || (tmp_overlap >= 1.0)) { /* resulting overlap not acceptable */ } else { opt.display_update_time = tmp_update_time; opt.data_blocks_overlap = tmp_overlap; tmp_str = g_strdup_printf("%.1f", opt.data_blocks_overlap * 100.0); gtk_signal_handler_block_by_func(GTK_OBJECT(data_blocks_overlap_en), G_CALLBACK(data_blocks_overlap_en_changed), data); gtk_entry_set_text(GTK_ENTRY(data_blocks_overlap_en), tmp_str); gtk_signal_handler_unblock_by_func(GTK_OBJECT(data_blocks_overlap_en), G_CALLBACK(data_blocks_overlap_en_changed), data); g_free(tmp_str); } } static void wpm_en_changed(GtkWidget * widget, gpointer * data) { gchar *tmp_str; float tmp_f; tmp_str = gtk_editable_get_chars(GTK_EDITABLE(wpm_en), 0, -1); tmp_f = atof(tmp_str); g_free(tmp_str); opt.dot_time = 1000.0 * 60.0 / (tmp_f * 50); tmp_str = g_strdup_printf("%.1f", opt.dot_time); gtk_signal_handler_block_by_func(GTK_OBJECT(dot_time_en), G_CALLBACK(dot_time_en_changed), data); gtk_entry_set_text(GTK_ENTRY(dot_time_en), tmp_str); gtk_signal_handler_unblock_by_func(GTK_OBJECT(dot_time_en), G_CALLBACK(dot_time_en_changed), data); g_free(tmp_str); } static void dot_time_en_changed(GtkWidget * widget, gpointer * data) { gchar *tmp_str; float tmp_f1, tmp_f2; tmp_str = gtk_editable_get_chars(GTK_EDITABLE(dot_time_en), 0, -1); tmp_f1 = atof(tmp_str); g_free(tmp_str); tmp_f2 = 60.0 / (tmp_f1 * 50 / 1000.0); tmp_str = g_strdup_printf("%.1f", tmp_f2); gtk_signal_handler_block_by_func(GTK_OBJECT(wpm_en), G_CALLBACK(wpm_en_changed), data); gtk_entry_set_text(GTK_ENTRY(wpm_en), tmp_str); gtk_signal_handler_unblock_by_func(GTK_OBJECT(wpm_en), G_CALLBACK(wpm_en_changed), data); // gtk_signal_emit_stop_by_name(GTK_OBJECT(wpm_en), "changed"); g_free(tmp_str); } void qrss_settings_dialog(GtkWidget * widget, gpointer data) { GtkWidget *temp_bu; GtkWidget *tmp_vb, *tmp_hb; GtkWidget *ti_fr, *be_fr, *si_fr, *mo_fr; GSList *mode_gr, *be_gr; if (qrss_window && qrss_window->window) { gtk_widget_map(qrss_window); gdk_window_raise(qrss_window->window); return; } qrss_window = gtk_dialog_new(); g_signal_connect(G_OBJECT(qrss_window), "destroy", G_CALLBACK(gtk_widget_destroyed), &qrss_window); /* setup window properties */ gtk_window_set_wmclass(GTK_WINDOW(qrss_window), "qrssprefs", "glfer"); gtk_window_set_title(GTK_WINDOW(qrss_window), "QRSS preferences"); gtk_window_set_policy(GTK_WINDOW(qrss_window), FALSE, FALSE, FALSE); gtk_window_position(GTK_WINDOW(qrss_window), GTK_WIN_POS_NONE); gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(qrss_window)->vbox), 5); /* QRSS/DFCW timings frame */ ti_fr = gtk_frame_new("QRSS/DFCW timings"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(qrss_window)->vbox), ti_fr, FALSE, FALSE, 10); gtk_widget_show(ti_fr); /* Timing vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(ti_fr), tmp_vb); gtk_widget_show(tmp_vb); /* Timing entries */ compound_entry("Dot length [ms] :", &dot_time_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, dot_time_en, "dot time duration", NULL); compound_entry("Words per minute [WPM] :", &wpm_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, wpm_en, "keying speed in word per minute", NULL); g_signal_connect(G_OBJECT(dot_time_en), "changed", G_CALLBACK(dot_time_en_changed), NULL); g_signal_connect(G_OBJECT(wpm_en), "changed", G_CALLBACK(wpm_en_changed), NULL); compound_entry("PTT delay [ms] :", &ptt_delay_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, ptt_delay_en, "delay between PTT and KEY", NULL); /* Beacon mode timings frame */ be_fr = gtk_frame_new("Beacon mode timings"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(qrss_window)->vbox), be_fr, FALSE, FALSE, 10); gtk_widget_show(be_fr); /* Timing vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(be_fr), tmp_vb); gtk_widget_show(tmp_vb); /* Timing entries */ compound_entry("Pause between messages [s] :", &be_pause_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, be_pause_en, "Pause between beacon transmission", NULL); /* beacon pause with key up or down radio buttons */ be_keyup_bu = gtk_radio_button_new_with_label(NULL, "Key up between pauses"); gtk_tooltips_set_tip(glfer.tt, be_keyup_bu, "Transmitter OFF between pauses", NULL); be_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(be_keyup_bu)); be_keydown_bu = gtk_radio_button_new_with_label(be_gr, "Key down between pauses"); gtk_tooltips_set_tip(glfer.tt, be_keydown_bu, "Transmitter ON between pauses", NULL); be_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(be_keydown_bu)); gtk_box_pack_start(GTK_BOX(tmp_vb), be_keyup_bu, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tmp_vb), be_keydown_bu, TRUE, TRUE, 0); gtk_widget_show(be_keyup_bu); gtk_widget_show(be_keydown_bu); /* Sidetone frame */ si_fr = gtk_frame_new("Sidetone"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(qrss_window)->vbox), si_fr, FALSE, FALSE, 10); gtk_widget_show(si_fr); /* Sidetone hbox */ tmp_hb = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(si_fr), tmp_hb); gtk_widget_show(tmp_hb); /* Sound enable check button */ sn_bu = gtk_check_button_new_with_label("Sound"); gtk_tooltips_set_tip(glfer.tt, sn_bu, "Enable/disable sound output", NULL); gtk_box_pack_start(GTK_BOX(tmp_hb), sn_bu, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(sn_bu), "clicked", G_CALLBACK(enable_sidetone), NULL); /* if sidetone is enabled activate the toggle button */ if (opt.sidetone == TRUE) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sn_bu), TRUE); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sn_bu), FALSE); } gtk_widget_show(sn_bu); /* frequencies vbox */ tmp_vb = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(tmp_hb), tmp_vb); gtk_widget_show(tmp_vb); /* Sidetone frequency */ compound_entry("Frequency [Hz] :", &sidetone_fr_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, sidetone_fr_en, "QRSS sidetone frequency", NULL); compound_entry("DFCW dot freq. [Hz] :", &dfcw_dot_fr_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, dfcw_dot_fr_en, "DFCW sidetone dot frequency", NULL); compound_entry("DFCW dash freq. [Hz] :", &dfcw_dash_fr_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, dfcw_dash_fr_en, "DFCW sidetone dash frequency", NULL); /* Mode frame */ mo_fr = gtk_frame_new("Mode"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(qrss_window)->vbox), mo_fr, FALSE, FALSE, 10); gtk_widget_show(mo_fr); /* Mode hbox */ tmp_hb = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(mo_fr), tmp_hb); gtk_widget_show(tmp_hb); /* transmissione mode radio buttons */ qrss_bu = gtk_radio_button_new_with_label(NULL, "QRSS"); gtk_tooltips_set_tip(glfer.tt, qrss_bu, "Set QRSS mode", NULL); mode_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(qrss_bu)); dfcw_bu = gtk_radio_button_new_with_label(mode_gr, "DFCW"); gtk_tooltips_set_tip(glfer.tt, dfcw_bu, "Set DFCW mode", NULL); mode_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(qrss_bu)); gtk_box_pack_start(GTK_BOX(tmp_hb), qrss_bu, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tmp_hb), dfcw_bu, TRUE, TRUE, 0); gtk_widget_show(qrss_bu); gtk_widget_show(dfcw_bu); /* buttons */ temp_bu = gtk_button_new_with_label("Ok"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Accept settings and close window", NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(qrss_widgets_to_prefs), NULL); g_signal_connect_swapped(G_OBJECT(temp_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(qrss_window)); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(qrss_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); temp_bu = gtk_button_new_with_label("Save"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Save settings", NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(qrss_widgets_to_prefs), NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(save_event), NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(qrss_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); temp_bu = gtk_button_new_with_label("Cancel"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Close window", NULL); g_signal_connect_swapped(G_OBJECT(temp_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(qrss_window)); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(qrss_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); /* load current values */ qrss_prefs_to_widgets(); gtk_widget_show(qrss_window); } static void port_change_device(GtkWidget * widget, gpointer data) { int dev_status = -1; /* avoid warning about uninitialized variable */ char *action = (char *) data; /* close currently used port */ if (glfer.init_done == TRUE) switch (opt.device_type) { case DEV_SERIAL: close_serial_port(); break; case DEV_PARALLEL: /* no need to close parallel port */ break; default: break; } if (GTK_TOGGLE_BUTTON(serial_bu)->active) { /* serial device selected */ opt.device_type = DEV_SERIAL; FREE_MAYBE(opt.ctrl_device); opt.ctrl_device = gtk_editable_get_chars(GTK_EDITABLE(control_port_en), 0, -1); dev_status = open_serial_port(opt.ctrl_device); } else if (GTK_TOGGLE_BUTTON(parallel_bu)->active) { opt.device_type = DEV_PARALLEL; FREE_MAYBE(opt.ctrl_device); opt.ctrl_device = gtk_editable_get_chars(GTK_EDITABLE(control_port_en), 0, -1); dev_status = open_parport(opt.ctrl_device); } else { g_assert_not_reached(); } if (dev_status == -1) { /* show warning message */ show_message("Open %s failed !\n" "Please go to the Settings/Port menu and select a control\n" "device to enable transmission functions.", opt.ctrl_device); glfer.init_done = FALSE; gtk_widget_set_sensitive(glfer.qso_menu_item, FALSE); gtk_widget_set_sensitive(glfer.test_menu_item, FALSE); } else { /* show_message("Device%s opened \n", opt.ctrl_device); */ /* control device initialisation ok, enable transmission functions */ glfer.init_done = TRUE; gtk_widget_set_sensitive(glfer.qso_menu_item, TRUE); gtk_widget_set_sensitive(glfer.test_menu_item, TRUE); if ((action != NULL) && (!strcmp(action, "save"))) rc_file_write(); } } static void port_prefs_to_widgets(void) { gtk_entry_set_text(GTK_ENTRY(control_port_en), opt.ctrl_device); if (opt.device_type == DEV_SERIAL) { gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(serial_bu), TRUE); } else if (opt.device_type == DEV_PARALLEL) { gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(parallel_bu), TRUE); } else { g_assert_not_reached(); } } static void port_widgets_to_prefs(GtkWidget * widget, gpointer data) { GtkWidget *dialog, *ok_bu, *cancel_bu, *label; char *selected_device = NULL; selected_device = gtk_editable_get_chars(GTK_EDITABLE(control_port_en), 0, -1); if ((glfer.init_done == FALSE) || strcmp(opt.ctrl_device, selected_device)) { /* first initialisation or different device selected */ dialog = gtk_dialog_new(); g_signal_connect(G_OBJECT(dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &dialog); /* setup window properties */ gtk_window_set_wmclass(GTK_WINDOW(dialog), "warning", "glfer"); /* set dialog title */ gtk_window_set_title(GTK_WINDOW(dialog), "Warning"); gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* make the dialog modal */ gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); /* not user resizable */ gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE); /* set border width */ gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 5); label = gtk_label_new("Selected control port may become unstable during initialisation!\nPlease make sure that the TX is off."); gtk_misc_set_padding(GTK_MISC(label), 20, 20); /* OK button */ ok_bu = gtk_button_new_with_label("Ok"); g_signal_connect(G_OBJECT(ok_bu), "clicked", G_CALLBACK(port_change_device), data); g_signal_connect_swapped(G_OBJECT(ok_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(port_window)); g_signal_connect_swapped(G_OBJECT(ok_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog)); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), ok_bu); /* cancel button */ cancel_bu = gtk_button_new_with_label("Cancel"); g_signal_connect_swapped(G_OBJECT(ok_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(port_window)); g_signal_connect_swapped(G_OBJECT(cancel_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog)); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), cancel_bu); /* Add the label, and show everything we've added to the dialog. */ gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); gtk_widget_show_all(dialog); } } void port_settings_dialog(GtkWidget * widget, gpointer data) { GtkWidget *temp_bu; GtkWidget *tmp_vb; GtkWidget *pa_fr; GtkWidget *tmp_hb; GList *serial_dev_it = NULL, *parallel_dev_it = NULL; GSList *devtype_gr; if (port_window && port_window->window) { gtk_widget_map(port_window); gdk_window_raise(port_window->window); return; } port_window = gtk_dialog_new(); g_signal_connect(G_OBJECT(port_window), "destroy", G_CALLBACK(gtk_widget_destroyed), &port_window); /* setup window properties */ gtk_window_set_wmclass(GTK_WINDOW(port_window), "portprefs", "glfer"); gtk_window_set_title(GTK_WINDOW(port_window), "Device preferences"); gtk_window_set_policy(GTK_WINDOW(port_window), FALSE, FALSE, FALSE); gtk_window_position(GTK_WINDOW(port_window), GTK_WIN_POS_NONE); gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(port_window)->vbox), 5); tmp_hb = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(port_window)->vbox), tmp_hb, FALSE, FALSE, 10); gtk_widget_show(tmp_hb); /* control devices frame */ pa_fr = gtk_frame_new("Control device"); gtk_box_pack_start(GTK_BOX(tmp_hb), pa_fr, FALSE, FALSE, 10); gtk_widget_show(pa_fr); /* control devices vbox */ tmp_vb = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(pa_fr), tmp_vb); gtk_widget_show(tmp_vb); /* control port entry */ compound_entry("/dev/", &control_port_en, tmp_vb); gtk_tooltips_set_tip(glfer.tt, control_port_en, "Control port name (e.g. ttyS0 for serial, lp0 for parallel)", NULL); /* device type radio button */ serial_bu = gtk_radio_button_new_with_label(NULL, "Serial port"); gtk_tooltips_set_tip(glfer.tt, serial_bu, "Enable serial control port", NULL); devtype_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(serial_bu)); gtk_box_pack_start(GTK_BOX(tmp_vb), serial_bu, TRUE, TRUE, 5); gtk_widget_show(serial_bu); /* device type radio button */ parallel_bu = gtk_radio_button_new_with_label(devtype_gr, "Parallel port"); gtk_tooltips_set_tip(glfer.tt, parallel_bu, "Enable parallel control port", NULL); devtype_gr = gtk_radio_button_group(GTK_RADIO_BUTTON(parallel_bu)); gtk_box_pack_start(GTK_BOX(tmp_vb), parallel_bu, TRUE, TRUE, 5); gtk_widget_show(parallel_bu); /* buttons */ temp_bu = gtk_button_new_with_label("Ok"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Accept settings and close window", NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(port_widgets_to_prefs), NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(port_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); temp_bu = gtk_button_new_with_label("Save"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Save settings", NULL); //g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(save_event), NULL); g_signal_connect(G_OBJECT(temp_bu), "clicked", G_CALLBACK(port_widgets_to_prefs), "save"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(port_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); temp_bu = gtk_button_new_with_label("Cancel"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Close window", NULL); g_signal_connect_swapped(G_OBJECT(temp_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(port_window)); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(port_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); /* load current values */ port_prefs_to_widgets(); gtk_widget_show(port_window); } static void audio_prefs_to_widgets(void) { gchar *tmp_str; tmp_str = g_strdup_printf("%s", opt.audio_device); gtk_entry_set_text(GTK_ENTRY(audio_device_en), tmp_str); g_free(tmp_str); } static void audio_widgets_to_prefs(GtkWidget * widget, gpointer data) { gchar *tmp_str; tmp_str = gtk_editable_get_chars(GTK_EDITABLE(audio_device_en), 0, -1); strncpy(opt.audio_device, tmp_str, 9); g_free(tmp_str); close_audio(); /* close current audio device */ init_audio(NULL); /* open new audio device */ } void audio_settings_dialog(GtkWidget * widget, gpointer data) { GtkWidget *temp_bu; GtkWidget *dev_fr; GtkWidget *tmp_hb; if (audio_window && audio_window->window) { gtk_widget_map(audio_window); gdk_window_raise(audio_window->window); return; } audio_window = gtk_dialog_new(); g_signal_connect(G_OBJECT(audio_window), "destroy", G_CALLBACK(gtk_widget_destroyed), &audio_window); /* setup window properties */ gtk_window_set_wmclass(GTK_WINDOW(audio_window), "audioprefs", "glfer"); gtk_window_set_title(GTK_WINDOW(audio_window), "Audio settings"); gtk_window_set_policy(GTK_WINDOW(audio_window), FALSE, FALSE, FALSE); gtk_window_position(GTK_WINDOW(audio_window), GTK_WIN_POS_NONE); gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(audio_window)->vbox), 5); /* Device frame */ dev_fr = gtk_frame_new("Device"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(audio_window)->vbox), dev_fr, FALSE, FALSE, 10); gtk_widget_show(dev_fr); /* Device hbox */ tmp_hb = gtk_hbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(dev_fr), tmp_hb); gtk_widget_show(tmp_hb); compound_entry("Path :", &audio_device_en, tmp_hb); gtk_tooltips_set_tip(glfer.tt, audio_device_en, "Audio device path like /dev/dsp or /dev/dsp1", NULL); /* OK button */ temp_bu = gtk_button_new_with_label("Ok"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Accept changes and close window", NULL); g_signal_connect_swapped(G_OBJECT(temp_bu), "clicked", G_CALLBACK(audio_widgets_to_prefs), GTK_OBJECT(audio_window)); g_signal_connect_swapped(G_OBJECT(temp_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(audio_window)); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(audio_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); /* Cancel button */ temp_bu = gtk_button_new_with_label("Cancel"); gtk_tooltips_set_tip(glfer.tt, temp_bu, "Discard changes and close window", NULL); g_signal_connect_swapped(G_OBJECT(temp_bu), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(audio_window)); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(audio_window)->action_area), temp_bu, TRUE, TRUE, 0); gtk_widget_show(temp_bu); /* load current values */ audio_prefs_to_widgets(); gtk_widget_show(audio_window); } glfer-0.4.2/missing0000755000175000001440000002466610744705161011153 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2003-09-02.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: glfer-0.4.2/Makefile.in0000644000175000001440000005270511330652720011606 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = glfer$(EXEEXT) mixer$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ TODO depcomp install-sh missing mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_glfer_OBJECTS = glfer.$(OBJEXT) fft_radix2.$(OBJEXT) fft.$(OBJEXT) \ audio.$(OBJEXT) avg.$(OBJEXT) cw_rx.$(OBJEXT) util.$(OBJEXT) \ qrs.$(OBJEXT) rcfile.$(OBJEXT) source.$(OBJEXT) \ wav_fmt.$(OBJEXT) mtm.$(OBJEXT) lmp.$(OBJEXT) \ bell-p-w.$(OBJEXT) g-l_dpss.$(OBJEXT) hparma.$(OBJEXT) \ g_main.$(OBJEXT) g_about.$(OBJEXT) g_txmsg.$(OBJEXT) \ g_options.$(OBJEXT) g_scope.$(OBJEXT) g_file_dialogs.$(OBJEXT) glfer_OBJECTS = $(am_glfer_OBJECTS) glfer_DEPENDENCIES = mixer_SOURCES = mixer.c mixer_OBJECTS = mixer.$(OBJEXT) mixer_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(glfer_SOURCES) mixer.c DIST_SOURCES = $(glfer_SOURCES) mixer.c man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ # jason.c # jason.h glfer_SOURCES = \ glfer.c \ glfer.h \ fft_radix2.c \ fft_radix2.h \ fft.c \ fft.h \ audio.c \ audio.h \ avg.c \ avg.h \ cw_rx.c \ cw_rx.h \ util.c \ util.h \ qrs.c \ qrs.h \ rcfile.c \ rcfile.h \ source.c \ source.h \ wav_fmt.c \ wav_fmt.h \ mtm.c \ mtm.h \ lmp.c \ lmp.h \ bell-p-w.c \ bell-p-w.h \ g-l_dpss.c \ g-l_dpss.h \ hparma.c \ hparma.h \ g_main.c \ g_main.h \ g_about.c \ g_about.h \ g_txmsg.c \ g_txmsg.h \ g_options.c \ g_options.h \ g_scope.c \ g_scope.h \ g_file_dialogs.c\ g_file_dialogs.h glfer_LDADD = @GTK_LIBS@ INCLUDES = @GTK_CFLAGS@ mixer_sources = mixer.c man_MANS = glfer.1 EXTRA_DIST = HACKING TODO glfer.lsm $(man_MANS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .o .obj am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) glfer$(EXEEXT): $(glfer_OBJECTS) $(glfer_DEPENDENCIES) @rm -f glfer$(EXEEXT) $(LINK) $(glfer_LDFLAGS) $(glfer_OBJECTS) $(glfer_LDADD) $(LIBS) mixer$(EXEEXT): $(mixer_OBJECTS) $(mixer_DEPENDENCIES) @rm -f mixer$(EXEEXT) $(LINK) $(mixer_LDFLAGS) $(mixer_OBJECTS) $(mixer_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bell-p-w.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cw_rx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fft.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fft_radix2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g-l_dpss.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_about.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_file_dialogs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_scope.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_txmsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glfer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hparma.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mixer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qrs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rcfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wav_fmt.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(MANS) config.h installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-man install-exec-am: install-binPROGRAMS install-info: install-info-am install-man: install-man1 installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man uninstall-man: uninstall-man1 .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-man1 install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ ps ps-am tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-info-am uninstall-man uninstall-man1 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: glfer-0.4.2/cw_rx.c0000644000175000001440000000454010744705163011031 00000000000000/* cw_rx.h * * Copyright (C) 2007 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include "glfer.h" #include "cw_rx.h" extern opt_t opt; extern glfer_t glfer; float *bb_buf_re = NULL; /* buffer for holding baseband data */ float *bb_buf_im = NULL; /* buffer for holding baseband data */ float wpm = 12; /* morse code speed in words per minute */ #define DOWN 8 /* the downsampling factor */ #define SAMP2 (opt.sample_rate / DOWN) /* sample rate after downsampling, in samples/second */ #define DOTSEC (1.2 / wpm) /* duration of one dot in seconds */ #define DOTLEN (SAMP2 * 1.2/ wpm) /* duration of one dot in samples (after downsampling) */ void rx_cw_init(int n_samples) { /* allocate memory for the baseband buffer */ bb_buf_re = malloc(n_samples * sizeof(float)); if (!bb_buf_re) { fprintf(stderr, "error allocating bb_buf_re\n"); exit(-1); } bb_buf_im = malloc(n_samples * sizeof(float)); if (!bb_buf_im) { fprintf(stderr, "error allocating bb_buf_im\n"); exit(-1); } } void rx_cw(float *audio_buf, int n_samples) { float delta; float frequency = 800; /* CW RX fixed at 800 Hz */ float phaseacc; float z_re, z_im; int i; /* compute phase increment expected at our specific rx tone freq */ delta = 2.0 * M_PI * frequency / opt.sample_rate;; for (i = 0; i < n_samples; i++) { /* Mix with the internal NCO to convert do DC */ bb_buf_re[i] = audio_buf[i] * cos(phaseacc); bb_buf_im[i] = audio_buf[i] * sin(phaseacc); phaseacc += delta; if (phaseacc > M_PI) phaseacc -= 2.0 * M_PI; } } glfer-0.4.2/g_txmsg.c0000644000175000001440000002622711051313005011343 00000000000000/* g_txmsg.c * Copyright (C) 2001-2003 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include /* for toupper() and islower() */ #include #include "g_txmsg.h" #include "glfer.h" #include "util.h" #include "qrs.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif extern opt_t opt; extern glfer_t glfer; static GtkWidget *window = NULL; static GtkWidget *entry = NULL, *time_la = NULL, *time_left_la = NULL, *time_left_desc_la = NULL; static GtkWidget *start_button, *stop_button; static guint function_tag = 0; static float msg_time_msec; time_t stop_time; /* function prototypes */ static gint countdown_timer(gpointer data); static void timestr(float time_sec, gchar ** str) { int time_h, time_m, time_s; time_h = time_sec / 3600; time_sec -= time_h * 3600; time_m = time_sec / 60; time_sec -= time_m * 60; time_s = time_sec; *str = g_strdup_printf("%ih%im%is", time_h, time_m, time_s); } static void enable_beacon_mode(GtkWidget * widget, gpointer data) { opt.beacon_mode = GTK_TOGGLE_BUTTON(widget)->active; } static gint countdown_timer(gpointer data) { int msg_char_index; gchar *tmp_str; time_t time_left, curr_time; time(&curr_time); time_left = stop_time - curr_time; if (time_left >= 0) { /* convert to hms string */ timestr(time_left, &tmp_str); gtk_label_set_text(GTK_LABEL(time_left_la), tmp_str); g_free(tmp_str); msg_char_index = get_qrss_char_index(); gtk_editable_select_region(GTK_EDITABLE(entry), msg_char_index, msg_char_index + 1); /* don't stop calling this timeout function */ return TRUE; } else if (opt.beacon_mode) { /* beacon mode */ msg_char_index = get_qrss_char_index(); /* get current time */ time(&stop_time); /* compute stop time */ stop_time += (msg_time_msec / 1000) + opt.beacon_pause; return TRUE; /* don't stop calling this timeout function */ } else { /* end of message */ /* hide time left indications */ gtk_widget_hide(time_left_desc_la); gtk_widget_hide(time_left_la); /* message transmission ended, enable editing of entry text */ gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* enable start and disable stop buttons */ gtk_widget_set_sensitive(start_button, TRUE); gtk_widget_set_sensitive(stop_button, FALSE); /* stop calling this timeout function */ function_tag = 0; return FALSE; } } static void start_message(GtkWidget * widget, gpointer * data) { guint upd_time; /* disable editing of text to be transmitted */ gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE); /* disable start and enable stop buttons */ gtk_widget_set_sensitive(start_button, FALSE); gtk_widget_set_sensitive(stop_button, TRUE); /* select message first character */ gtk_editable_select_region(GTK_EDITABLE(entry), 0, 1); /* get message time duration (might have changed due to mode change) */ msg_time_msec = string_duration(gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1)); gtk_widget_show(time_left_desc_la); gtk_widget_show(time_left_la); /* get current time */ time(&stop_time); /* compute stop time */ stop_time += (msg_time_msec / 1000) + 0.5; if (opt.beacon_mode == TRUE) stop_time += opt.beacon_pause; /* add countdown timer function to be called every second or every dot duration, whichever is less */ upd_time = (opt.dot_time < 1000 ? opt.dot_time : 1000); function_tag = gtk_timeout_add(upd_time, countdown_timer, NULL); D(g_print("%f\n", string_duration(gtk_editable_get_chars(GTK_EDITABLE(data), 0, -1)))); /* for debug */ /* send message */ send_string(gtk_editable_get_chars(GTK_EDITABLE(data), 0, -1)); } static void stop_message(GtkWidget * widget, gpointer * data) { /* stop transmissions */ stop_tx(); /* hide time left indications */ gtk_widget_hide(time_left_desc_la); gtk_widget_hide(time_left_la); /* enable editing of entry text */ gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* enable start and disable stop buttons */ gtk_widget_set_sensitive(start_button, TRUE); gtk_widget_set_sensitive(stop_button, FALSE); /* remove countdown timer */ if (function_tag != 0) gtk_timeout_remove(function_tag); } static void filter_entry_text(GtkEntry * entry, const gchar * text, gint length, gint * position, gpointer data) { GtkEditable *editable = GTK_EDITABLE(entry); int i, count = 0; gchar *result = g_new(gchar, length); /* analyze char by char */ for (i = 0; i < length; i++) { /* check if char is allowed in CW transmission */ if (!cw_char_allowed(text[i]) == TRUE) /* if not, skip to next */ continue; /* force uppercase */ result[count++] = islower(text[i]) ? toupper(text[i]) : text[i]; } if (count > 0) { gtk_signal_handler_block_by_func(GTK_OBJECT(editable), G_CALLBACK(filter_entry_text), data); gtk_editable_insert_text(editable, result, count, position); gtk_signal_handler_unblock_by_func(GTK_OBJECT(editable), G_CALLBACK(filter_entry_text), data); } gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text"); g_free(result); } static void entry_changed(GtkWidget * widget, gpointer * data) { gchar *tmp_str; float tmp_time_msec; /* get message time duration */ tmp_time_msec = string_duration(gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1)); /* round to the nearest second */ tmp_time_msec += 500.0; if (opt.beacon_mode == TRUE) tmp_time_msec += opt.beacon_pause * 1000.0; /* convert to hms string */ timestr(tmp_time_msec / 1000, &tmp_str); gtk_label_set_text(GTK_LABEL(time_la), tmp_str); gtk_label_set_text(GTK_LABEL(time_left_la), tmp_str); g_free(tmp_str); } void update_time_indications(void) { if (window) entry_changed(entry, NULL); } void create_txmsg_window(void) { GtkWidget *vbox, *temp_hb, *temp_la, *be_bu, *cancel_button; if (!window) { window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_widget_destroyed), &window); gtk_window_set_title(GTK_WINDOW(window), "TX Message"); gtk_container_border_width(GTK_CONTAINER(window), 0); /* Create a vbox */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show(vbox); /* hbox for the text entry */ temp_hb = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), temp_hb, FALSE, FALSE, 5); /* create the text entry */ entry = gtk_entry_new(); gtk_tooltips_set_tip(glfer.tt, entry, "Text to be transmitted", "qqq"); /* just make the width greater than the default */ gtk_widget_set_usize(entry, 200, -1); gtk_box_pack_end(GTK_BOX(temp_hb), entry, TRUE, TRUE, 5); /* filter the input in the entry (from the GTK+ FAQ) */ g_signal_connect(G_OBJECT(entry), "insert_text", G_CALLBACK(filter_entry_text), NULL); /* update timers with message */ g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(entry_changed), NULL); /* pressing ENTER is the same as clicking on the Start button */ g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(start_message), GTK_OBJECT(entry)); gtk_widget_show(entry); /* entry description */ temp_la = gtk_label_new("Text:"); gtk_box_pack_end(GTK_BOX(temp_hb), temp_la, FALSE, FALSE, 5); gtk_widget_show(temp_la); gtk_widget_show(temp_hb); /* hbox for the text duration labels */ temp_hb = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), temp_hb, FALSE, FALSE, 5); /* description label */ temp_la = gtk_label_new("Time:"); gtk_box_pack_start(GTK_BOX(temp_hb), temp_la, FALSE, FALSE, 5); gtk_widget_show(temp_la); /* message duration time */ time_la = gtk_label_new(NULL); gtk_box_pack_start(GTK_BOX(temp_hb), time_la, FALSE, FALSE, 5); gtk_widget_show(time_la); /* time left to message end */ time_left_la = gtk_label_new(NULL); gtk_box_pack_end(GTK_BOX(temp_hb), time_left_la, FALSE, FALSE, 5); //gtk_widget_show(time_left_la); /* description label */ time_left_desc_la = gtk_label_new("Time left:"); gtk_box_pack_end(GTK_BOX(temp_hb), time_left_desc_la, FALSE, FALSE, 5); //gtk_widget_show(time_left_desc_la); gtk_widget_show(temp_hb); /* default message */ gtk_entry_set_text(GTK_ENTRY(entry), "cq"); /* beacon mode enable check button */ be_bu = gtk_check_button_new_with_label("Beacon mode"); gtk_tooltips_set_tip(glfer.tt, be_bu, "Enable/disable beacon mode (repeated message)", NULL); gtk_box_pack_start(GTK_BOX(vbox), be_bu, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(be_bu), "clicked", G_CALLBACK(enable_beacon_mode), NULL); /* if beacon mode enabled activate the toggle button */ if (opt.beacon_mode == TRUE) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(be_bu), TRUE); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(be_bu), FALSE); } gtk_widget_show(be_bu); /* Create the buttons area */ temp_hb = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), temp_hb, TRUE, TRUE, 5); /* cancel button */ cancel_button = gtk_button_new_with_label("Cancel"); gtk_tooltips_set_tip(glfer.tt, cancel_button, "Close window", NULL); gtk_box_pack_end(GTK_BOX(temp_hb), cancel_button, TRUE, TRUE, 0); /* pressing Cancel is the same as pressing Stop end closing the window */ g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(stop_message), GTK_OBJECT(entry)); g_signal_connect_swapped(G_OBJECT(cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(window)); gtk_widget_show(cancel_button); /* transmission start button */ start_button = gtk_button_new_with_label("Start"); gtk_tooltips_set_tip(glfer.tt, start_button, "Start message transmission", NULL); gtk_box_pack_start(GTK_BOX(temp_hb), start_button, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(start_button), "clicked", G_CALLBACK(start_message), GTK_OBJECT(entry)); gtk_widget_show(start_button); /* transmission stop button */ stop_button = gtk_button_new_with_label("Stop"); gtk_tooltips_set_tip(glfer.tt, stop_button, "Stop message transmission", NULL); gtk_box_pack_start(GTK_BOX(temp_hb), stop_button, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(stop_button), "clicked", G_CALLBACK(stop_message), GTK_OBJECT(entry)); gtk_widget_show(stop_button); gtk_widget_show(temp_hb); } if (!GTK_WIDGET_VISIBLE(window)) { gtk_widget_show(window); } else { gtk_widget_destroy(window); } } glfer-0.4.2/g-l_dpss.c0000644000175000001440000002075711056556614011431 00000000000000/* g-l_dpss.c * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ /* eigen/jacobi.c * eigen/eigen_sort.c * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman */ #include #include #include #include "util.h" /* The eigen_sort below is not very good, but it is simple and * self-contained. We can always implement an improved sort later. */ int eigen_symmv_sort(double *eval, double **evec, unsigned int N) { size_t i; for (i = 0; i < N - 1; i++) { size_t j; size_t k = i; double ek = eval[i]; double dtmp; /* search for something to swap */ for (j = i + 1; j < N; j++) { int test; const double ej = eval[j]; test = (fabs(ej) > fabs(ek)); if (test) { k = j; ek = ej; } } if (k != i) { /* swap eigenvalues */ dtmp = eval[i]; eval[i] = eval[k]; eval[k] = dtmp; /* swap eigenvectors */ for (j = 0; j < N; j++) { dtmp = evec[j][i]; evec[j][i] = evec[j][k]; evec[j][k] = dtmp; } } } return 0; /* success */ } static void jac_rotate(double **a, unsigned int i, unsigned int j, unsigned int k, unsigned int l, double *g, double *h, double s, double tau) { *g = a[i][j]; *h = a[k][l]; a[i][j] = (*g) - s * ((*h) + (*g) * tau); a[k][l] = (*h) + s * ((*g) - (*h) * tau); } int eigen_jacobi(double **a, double *eval, double **evec, unsigned int n, unsigned int max_rot, unsigned int *nrot) { unsigned int i, j, iq, ip; double t, s; double *b = (double *) malloc(n * sizeof(double)); double *z = (double *) malloc(n * sizeof(double)); if (b == 0 || z == 0) { if (b != 0) free(b); if (z != 0) free(z); fprintf(stderr, "could not allocate memory for workspace"); exit(-1); /* out of memory */ } /* Set eigenvectors to coordinate basis. */ for (ip = 0; ip < n; ip++) { for (iq = 0; iq < n; iq++) { evec[ip][iq] = 0.0; } evec[ip][ip] = 1.0; } /* Initialize eigenvalues and workspace. */ for (ip = 0; ip < n; ip++) { double a_ipip = a[ip][ip]; z[ip] = 0.0; b[ip] = a_ipip; eval[ip] = a_ipip; } *nrot = 0; for (i = 1; i <= max_rot; i++) { double thresh; double tau; double g, h, c; double sm = 0.0; /* compute the sum of the off-diagonal elements absolute value */ for (ip = 0; ip < n - 1; ip++) { for (iq = ip + 1; iq < n; iq++) { sm += fabs(a[ip][iq]); } } if (sm == 0.0) { /* converged */ free(z); free(b); return 0; /* success */ } if (i < 4) thresh = 0.2 * sm / (n * n); else thresh = 0.0; for (ip = 0; ip < n - 1; ip++) { for (iq = ip + 1; iq < n; iq++) { const double d_ip = eval[ip]; const double d_iq = eval[iq]; const double a_ipiq = a[ip][iq]; g = 100.0 * fabs(a_ipiq); /* after for sweeps, skip the rotation for small off-diagonal element */ if ((i > 4) && (fabs(d_ip) + g == fabs(d_ip)) && (fabs(d_iq) + g == fabs(d_iq))) { a[ip][iq] = 0.0; } else if (fabs(a_ipiq) > thresh) { h = d_iq - d_ip; if (fabs(h) + g == fabs(h)) { t = a_ipiq / h; } else { double theta = 0.5 * h / a_ipiq; t = 1.0 / (fabs(theta) + sqrt(1.0 + theta * theta)); if (theta < 0.0) t = -t; } c = 1.0 / sqrt(1.0 + t * t); s = t * c; tau = s / (1.0 + c); h = t * a_ipiq; z[ip] -= h; z[iq] += h; eval[ip] = d_ip - h; eval[iq] = d_iq + h; a[ip][iq] = 0.0; for (j = 0; j < ip; j++) { jac_rotate(a, j, ip, j, iq, &g, &h, s, tau); } for (j = ip + 1; j < iq; j++) { jac_rotate(a, ip, j, j, iq, &g, &h, s, tau); } for (j = iq + 1; j < n; j++) { jac_rotate(a, ip, j, iq, j, &g, &h, s, tau); } for (j = 0; j < n; j++) { jac_rotate(evec, j, ip, j, iq, &g, &h, s, tau); } ++(*nrot); } } } for (ip = 0; ip < n; ip++) { b[ip] += z[ip]; z[ip] = 0.0; eval[ip] = b[ip]; } /* continue iteration */ } return (-1); /* max iteration exceeded */ } /* function [evc,evl] = w2(l,f) % [evc,evl] = window2(l,f) % Generate the window functions using the approximation method outlined % in Appendix A of Thomson in Proc. of the IEEE, September 1987. evc is % a matrix whose columns are the eigenvectors (windows) with corresponding % eigenvalues in the column vector evl. Only the first 2lf eigenvectors % are returned. l is the number of window terms to compute, and f is the % bandwidth. evl is sorted from small to large eigenvalues. % This program uses a 32-point Gauss-Legendre quadrature (c.f. Appendix A). % By John Kuehne, August 1990. */ /* Zeros of Legendre(32) polynomial (abscissas) */ double gl_x[] = { -.997263861849481563545, -.985611511545268335400, -.964762255587506430774, -.934906075937739689171, -.896321155766052123965, -.849367613732569970134, -.794483795967942406963, -.732182118740289680387, -.663044266930215200975, -.587715757240762329041, -.506899908932229390024, -.421351276130635345364, -.331868602282127649780, -.239287362252137074545, -.144471961582796493485, -.048307665687738316235, .048307665687738316235, .144471961582796493485, .239287362252137074545, .331868602282127649780, .421351276130635345364, .506899908932229390024, .587715757240762329041, .663044266930215200975, .732182118740289680387, .794483795967942406963, .849367613732569970134, .896321155766052123965, .934906075937739689171, .964762255587506430774, .985611511545268335400, .997263861849481563545 }; /* and weights for quadrature */ double gl_w[] = { .007018610009470096600, .016274394730905670605, .025392065309262059456, .034273862913021433103, .042835898022226680657, .050998059262376176196, .058684093478535547145, .065822222776361846838, .072345794108848506225, .078193895787070306472, .083311924226946755222, .087652093004403811143, .091173878695763884713, .093844399080804565639, .095638720079274859419, .096540088514727800567, .096540088514727800567, .095638720079274859419, .093844399080804565639, .091173878695763884713, .087652093004403811143, .083311924226946755222, .078193895787070306472, .072345794108848506225, .065822222776361846838, .058684093478535547145, .050998059262376176196, .042835898022226680657, .034273862913021433103, .025392065309262059456, .016274394730905670605, .007018610009470096600 }; int gl_dpss(int nmax, int kmax, int n, double w, double **v, double *sig, int *totit) { int i, j, ik; int errcode, nrot; double **k, *eigen_val, **eigen_vec; double dtmp, c; /* c = n * M_PI * w; */ /* our definition of w is actually N*w */ c = M_PI * w; k = dmatrix(0, 31, 0, 31); eigen_val = dvector(0, 31); eigen_vec = dmatrix(0, 31, 0, 31); for (i = 0; i < 32; i++) { for (j = 0; j < 32; j++) { if (i == j) k[i][j] = c / M_PI; else k[i][j] = sin(c * (gl_x[i] - gl_x[j])) / (M_PI * (gl_x[i] - gl_x[j])); /* Multiply weights to complete k(m,j) */ k[i][j] *= sqrt(gl_w[i] * gl_w[j]); } } /* compute matrix eigenvalues and eigenvectors */ errcode = eigen_jacobi(k, eigen_val, eigen_vec, 32, 1000, &nrot); eigen_symmv_sort(eigen_val, eigen_vec, 32); /* interpolate */ for (i = 0; i < n; i++) { for (ik = 0; ik <= kmax; ik++) { dtmp = 0.0; for (j = 0; j < 32; j++) { double argm = (2.0 * (i + 0.5) / n) - 1.0 - gl_x[j]; dtmp += sqrt(gl_w[j]) * eigen_vec[j][ik] * sin(c * argm) / (M_PI * argm); } v[i + 1][ik] = dtmp; } } /* normalize */ for (ik = 0; ik <= kmax; ik++) { dtmp = 0.0; for (i = 0; i < n; i++) { dtmp += (v[i + 1][ik]) * (v[i + 1][ik]); } for (i = 0; i < n; i++) { v[i + 1][ik] /= sqrt(dtmp); } } /* eigenvalues */ for (ik = 0; ik <= kmax; ik++) { sig[ik] = eigen_val[ik] - 1.0; } return errcode; } glfer-0.4.2/rcfile.c0000644000175000001440000002511111057571505011147 00000000000000/* rcfile.c * * Copyright (C) 2001-2002 Claudio Girardi * (C) 2006 Edouard Griffiths for modifications implementing * averaging mode * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include /* for time() and ctime() */ #include "util.h" #include "rcfile.h" #include "glfer.h" #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif extern opt_t opt; /* rc filename; it is set after the first call to rc_file_parse() */ char *rc_filename = NULL; /* parse rcfile */ int parse_rcfile(void) { char *env_home; char *rc_name = PACKAGE_NAME "rc"; char *filename = NULL; int result; env_home = getenv("HOME"); filename = (char *) malloc(strlen(env_home) + strlen(rc_name) + 3); sprintf(filename, "%s/.%s", env_home, rc_name); /* load preferences */ result = rc_file_parse(filename); free(filename); return result; } /* skip_equals, skips to the first non-whitespace character after equals sign */ static int skip_equals(char **buf) { int i; for (i = 0; i < 200; i++) { if (**buf == '=') { (*buf)++; while (**buf == ' ') (*buf)++; return (TRUE); } (*buf)++; } fprintf(stderr, "error in rcfile, expected equals\n"); return (FALSE); } int rc_file_parse(const char *filename) { FILE *fp; char buf[256], *i; if (rc_filename) free(rc_filename); /* save the filename for when we write back the preferences */ rc_filename = strdup(filename); fp = fopen(filename, "r"); if (!fp) /* problems opening file */ return -1; while (fgets(buf, 256, fp)) { i = &buf[0]; /* skip spaces */ while ((*i == ' ') || (*i == '\t')) i++; /* don't process empty lines */ if ((*i == '#') || (*i == '\n')) continue; /* work out what the setting is */ if (!strncasecmp(i, "mode", 4)) { if (skip_equals(&i)) { opt.mode = atoi(i); } } else if (!strncasecmp(i, "scale_type", 10)) { if (skip_equals(&i)) { opt.scale_type = atoi(i); } } else if (!strncasecmp(i, "data_block_size", 15)) { if (skip_equals(&i)) { opt.data_block_size = atoi(i); } } else if (!strncasecmp(i, "data_blocks_overlap", 19)) { if (skip_equals(&i)) { opt.data_blocks_overlap = atof(i); } } else if (!strncasecmp(i, "mtm_w", 5)) { if (skip_equals(&i)) { opt.mtm_w = atof(i); } } else if (!strncasecmp(i, "mtm_k", 5)) { if (skip_equals(&i)) { opt.mtm_k = atoi(i); } } else if (!strncasecmp(i, "hparma_t", 8)) { if (skip_equals(&i)) { opt.hparma_t = atof(i); } } else if (!strncasecmp(i, "hparma_p_e", 10)) { if (skip_equals(&i)) { opt.hparma_p_e = atof(i); } } else if (!strncasecmp(i, "window_type", 11)) { if (skip_equals(&i)) { opt.window_type = atoi(i); } } else if (!strncasecmp(i, "sample_rate", 11)) { if (skip_equals(&i)) { opt.sample_rate = atoi(i); } } else if (!strncasecmp(i, "offset_freq", 11)) { if (skip_equals(&i)) { opt.offset_freq = atof(i); } } else if (!strncasecmp(i, "dot_time", 8)) { if (skip_equals(&i)) { opt.dot_time = atof(i); } } else if (!strncasecmp(i, "beacon_mode", 11)) { if (skip_equals(&i)) { if (!strncasecmp(i, "ON", 2)) opt.beacon_mode = TRUE; else if (!strncasecmp(i, "OFF", 3)) opt.beacon_mode = FALSE; else fprintf(stderr, "error in rcfile %s: %s\n", filename, buf); } } else if (!strncasecmp(i, "beacon_pause", 12)) { if (skip_equals(&i)) { opt.beacon_pause = atof(i); } } else if (!strncasecmp(i, "beacon_tx_pause", 15)) { if (skip_equals(&i)) { if (!strncasecmp(i, "ON", 2)) opt.beacon_tx_pause = TRUE; else if (!strncasecmp(i, "OFF", 3)) opt.beacon_tx_pause = FALSE; else fprintf(stderr, "error in rcfile %s: %s\n", filename, buf); } } else if (!strncasecmp(i, "dfcw_gap_time", 13)) { if (skip_equals(&i)) { opt.dfcw_gap_time = atof(i); } } else if (!strncasecmp(i, "tx_mode", 7)) { if (skip_equals(&i)) { if (!strncasecmp(i, "QRSS", 4)) opt.tx_mode = QRSS; else if (!strncasecmp(i, "DFCW", 4)) opt.tx_mode = DFCW; else fprintf(stderr, "error in rcfile %s: %s\n", filename, buf); } } else if (!strncasecmp(i, "dash_dot_ratio", 14)) { if (skip_equals(&i)) { opt.dash_dot_ratio = atof(i); } } else if (!strncasecmp(i, "ptt_delay", 9)) { if (skip_equals(&i)) { opt.ptt_delay = atof(i); } } else if (!strncasecmp(i, "sidetone_freq", 13)) { if (skip_equals(&i)) { opt.sidetone_freq = atof(i); } } else if (!strncasecmp(i, "sidetone", 8)) { if (skip_equals(&i)) { if (!strncasecmp(i, "ON", 2)) opt.sidetone = TRUE; else if (!strncasecmp(i, "OFF", 3)) opt.sidetone = FALSE; else fprintf(stderr, "error in rcfile %s: %s\n", filename, buf); } } else if (!strncasecmp(i, "dfcw_dot_freq", 13)) { if (skip_equals(&i)) { opt.dfcw_dot_freq = atof(i); } } else if (!strncasecmp(i, "dfcw_dash_freq", 14)) { if (skip_equals(&i)) { opt.dfcw_dash_freq = atof(i); } } else if (!strncasecmp(i, "ctrl_device", 11)) { if (skip_equals(&i)) { char *iend; /* Get the ending position. */ for (iend = i; *iend && *iend != '\n'; iend++); opt.ctrl_device = (char *) malloc(iend - i + 1); memcpy(opt.ctrl_device, i, iend - i); opt.ctrl_device[iend - i] = '\0'; } } else if (!strncasecmp(i, "device_type", 11)) { if (skip_equals(&i)) { if (!strncasecmp(i, "DEV_SERIAL", 10)) opt.device_type = DEV_SERIAL; else if (!strncasecmp(i, "DEV_PARALLEL", 12)) opt.device_type = DEV_PARALLEL; else fprintf(stderr, "error in rcfile %s: %s\n", filename, buf); } } else if (!strncasecmp(i, "audio_device", 11)) { if (skip_equals(&i)) { char *iend; /* Get the ending position. */ for (iend = i; *iend && *iend != '\n'; iend++); opt.audio_device = (char *) malloc(iend - i + 1); memcpy(opt.audio_device, i, iend - i); opt.audio_device[iend - i] = '\0'; } } else if (!strncasecmp(i, "thr_level", 5)) { if (skip_equals(&i)) { opt.thr_level = atof(i); } } else if (!strncasecmp(i, "autoscale", 9)) { if (skip_equals(&i)) { opt.autoscale = atoi(i); } } else if (!strncasecmp(i, "max_level_db", 12)) { if (skip_equals(&i)) { opt.max_level_db = atof(i); } } else if (!strncasecmp(i, "min_level_db", 12)) { if (skip_equals(&i)) { opt.min_level_db = atof(i); } } else if (!strncasecmp(i, "palette", 7)) { if (skip_equals(&i)) { opt.palette = atoi(i); } } else if (!strncasecmp(i, "avg_mode", 8)) { if (skip_equals(&i)) { opt.averaging = atoi(i); } } else if (!strncasecmp(i, "avg_nsamples", 12)) { if (skip_equals(&i)) { opt.avgsamples = atoi(i); } } else if (!strncasecmp(i, "avg_min_avgband", 15)) { if (skip_equals(&i)) { opt.min_avgband = atof(i); } } else if (!strncasecmp(i, "avg_max_avgband", 15)) { if (skip_equals(&i)) { opt.max_avgband = atof(i); } } else fprintf(stderr, "error in rcfile %s: %s\n", filename, buf); } fclose(fp); /* everything went ok */ return 0; } /* rc_file_write, writes the user's preferences back to file */ int rc_file_write(void) { FILE *fp; time_t date; time(&date); fp = fopen(rc_filename, "w+"); if (!fp) return (-1); /* write header */ fprintf(fp, "# This is the startup file for " PACKAGE_STRING "\n"); fprintf(fp, "# automatically generated on %s", ctime(&date)); fprintf(fp, "\n"); fprintf(fp, "# Lines starting with \'#\' are ignored\n"); fprintf(fp, "\n"); fprintf(fp, "mode = %i\n", opt.mode); fprintf(fp, "scale_type = %i\n", opt.scale_type); fprintf(fp, "data_block_size = %i\n", opt.data_block_size); fprintf(fp, "data_blocks_overlap = %f\n", opt.data_blocks_overlap); fprintf(fp, "mtm_w = %f\n", opt.mtm_w); fprintf(fp, "mtm_k = %i\n", opt.mtm_k); fprintf(fp, "hparma_t = %i\n", opt.hparma_t); fprintf(fp, "hparma_p_e = %i\n", opt.hparma_p_e); fprintf(fp, "window_type = %i\n", opt.window_type); fprintf(fp, "sample_rate = %i\n", opt.sample_rate); fprintf(fp, "offset_freq = %f\n", opt.offset_freq); fprintf(fp, "dot_time = %f\n", opt.dot_time); fprintf(fp, "beacon_mode = %s\n", opt.beacon_mode == TRUE ? "ON" : "OFF"); fprintf(fp, "beacon_pause = %f\n", opt.beacon_pause); fprintf(fp, "beacon_tx_pause = %s\n", opt.beacon_tx_pause == TRUE ? "ON" : "OFF"); fprintf(fp, "dfcw_gap_time = %f\n", opt.dfcw_gap_time); fprintf(fp, "tx_mode = %s\n", opt.tx_mode == QRSS ? "QRSS" : "DFCW"); fprintf(fp, "dash_dot_ratio = %f\n", opt.dash_dot_ratio); fprintf(fp, "ptt_delay = %f\n", opt.ptt_delay); fprintf(fp, "sidetone_freq = %f\n", opt.sidetone_freq); fprintf(fp, "sidetone = %s\n", opt.sidetone == TRUE ? "ON" : "OFF"); fprintf(fp, "dfcw_dot_freq = %f\n", opt.dfcw_dot_freq); fprintf(fp, "dfcw_dash_freq = %f\n", opt.dfcw_dash_freq); fprintf(fp, "ctrl_device = %s\n", opt.ctrl_device); fprintf(fp, "device_type = %s\n", opt.device_type == DEV_SERIAL ? "DEV_SERIAL" : "DEV_PARALLEL"); fprintf(fp, "audio_device = %s\n", opt.audio_device); fprintf(fp, "thr_level = %f\n", opt.thr_level); fprintf(fp, "autoscale = %i\n", opt.autoscale); fprintf(fp, "max_level_db = %f\n", opt.max_level_db); fprintf(fp, "min_level_db = %f\n", opt.min_level_db); fprintf(fp, "palette = %i\n", opt.palette); fprintf(fp, "avg_mode = %i\n", opt.averaging); fprintf(fp, "avg_nsamples = %i\n", opt.avgsamples); fprintf(fp, "avg_min_avgband = %f\n", opt.min_avgband); fprintf(fp, "avg_max_avgband = %f\n", opt.max_avgband); fclose(fp); return (0); } void rc_file_done(void) { FREE_MAYBE(rc_filename); } glfer-0.4.2/Makefile.am0000644000175000001440000000136311150606433011567 00000000000000bin_PROGRAMS = glfer mixer # jason.c # jason.h glfer_SOURCES = \ glfer.c \ glfer.h \ fft_radix2.c \ fft_radix2.h \ fft.c \ fft.h \ audio.c \ audio.h \ avg.c \ avg.h \ cw_rx.c \ cw_rx.h \ util.c \ util.h \ qrs.c \ qrs.h \ rcfile.c \ rcfile.h \ source.c \ source.h \ wav_fmt.c \ wav_fmt.h \ mtm.c \ mtm.h \ lmp.c \ lmp.h \ bell-p-w.c \ bell-p-w.h \ g-l_dpss.c \ g-l_dpss.h \ hparma.c \ hparma.h \ g_main.c \ g_main.h \ g_about.c \ g_about.h \ g_txmsg.c \ g_txmsg.h \ g_options.c \ g_options.h \ g_scope.c \ g_scope.h \ g_file_dialogs.c\ g_file_dialogs.h glfer_LDADD = @GTK_LIBS@ INCLUDES = @GTK_CFLAGS@ mixer_sources = mixer.c man_MANS = glfer.1 EXTRA_DIST = HACKING TODO glfer.lsm $(man_MANS)glfer-0.4.2/COPYING0000644000175000001440000004311410744705161010574 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. glfer-0.4.2/AUTHORS0000644000175000001440000000004110744705163010603 00000000000000Claudio Girardi glfer-0.4.2/configure0000755000175000001440000060625311330652721011454 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for glfer 0.4.2. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='glfer' PACKAGE_TARNAME='glfer' PACKAGE_VERSION='0.4.2' PACKAGE_STRING='glfer 0.4.2' PACKAGE_BUGREPORT='in3otd@qsl.net' ac_unique_file="glfer.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS EGREP GREP CPP GTK_LIBS GTK_CFLAGS PKG_CONFIG am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_gtktest enable_debug enable_dmalloc ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { $as_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { $as_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { $as_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures glfer 0.4.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/glfer] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of glfer 0.4.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-gtktest do not try to compile and run a test GTK+ program --enable-debug enable support for debugging output --enable-dmalloc enable support for the dmalloc debugging library Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF glfer configure 0.4.2 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by glfer $as_me 0.4.2, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version="1.9" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 $as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 $as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 $as_echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 $as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=glfer VERSION=0.4.2 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { $as_echo "$as_me:$LINENO: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 $as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi fi fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { $as_echo "$as_me:$LINENO: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:$LINENO: checking for fftw_create_plan in -lfftw" >&5 $as_echo_n "checking for fftw_create_plan in -lfftw... " >&6; } if test "${ac_cv_lib_fftw_fftw_create_plan+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfftw -lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char fftw_create_plan (); int main () { return fftw_create_plan (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_fftw_fftw_create_plan=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fftw_fftw_create_plan=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_fftw_fftw_create_plan" >&5 $as_echo "$ac_cv_lib_fftw_fftw_create_plan" >&6; } if test "x$ac_cv_lib_fftw_fftw_create_plan" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBFFTW 1 _ACEOF LIBS="-lfftw $LIBS" fi { $as_echo "$as_me:$LINENO: checking for rfftw_create_plan in -lrfftw" >&5 $as_echo_n "checking for rfftw_create_plan in -lrfftw... " >&6; } if test "${ac_cv_lib_rfftw_rfftw_create_plan+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrfftw -lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char rfftw_create_plan (); int main () { return rfftw_create_plan (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_rfftw_rfftw_create_plan=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_rfftw_rfftw_create_plan=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_rfftw_rfftw_create_plan" >&5 $as_echo "$ac_cv_lib_rfftw_rfftw_create_plan" >&6; } if test "x$ac_cv_lib_rfftw_rfftw_create_plan" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBRFFTW 1 _ACEOF LIBS="-lrfftw $LIBS" fi # Check whether --enable-gtktest was given. if test "${enable_gtktest+set}" = set; then enableval=$enable_gtktest; else enable_gtktest=yes fi pkg_config_args=gtk+-2.0 for module in . do case "$module" in gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done no_gtk="" # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test x$PKG_CONFIG != xno ; then if pkg-config --atleast-pkgconfig-version 0.7 ; then : else echo "*** pkg-config too old; version 0.7 or better required." no_gtk=yes PKG_CONFIG=no fi else no_gtk=yes fi min_gtk_version=2.1.0 { $as_echo "$as_me:$LINENO: checking for GTK+ - version >= $min_gtk_version" >&5 $as_echo_n "checking for GTK+ - version >= $min_gtk_version... " >&6; } if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" enable_gtktest=no fi if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then : else no_gtk=yes fi fi if test x"$no_gtk" = x ; then GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" rm -f conf.gtktest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_gtk=yes fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then { $as_echo "$as_me:$LINENO: result: yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&5 $as_echo "yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&6; } : else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://pkgconfig.sourceforge.net" else if test -f conf.gtktest ; then : else echo "*** Could not run GTK+ test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK+ or finding the wrong" echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK+ is incorrectly installed." fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" { { $as_echo "$as_me:$LINENO: error: Cannot find GTK: Is gtk-config in path?" >&5 $as_echo "$as_me: error: Cannot find GTK: Is gtk-config in path?" >&2;} { (exit 1); exit 1; }; } fi rm -f conf.gtktest { $as_echo "$as_me:$LINENO: checking for sin in -lm" >&5 $as_echo_n "checking for sin in -lm... " >&6; } if test "${ac_cv_lib_m_sin+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sin (); int main () { return sin (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_m_sin=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_sin=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_sin" >&5 $as_echo "$ac_cv_lib_m_sin" >&6; } if test "x$ac_cv_lib_m_sin" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h sys/ioctl.h sys/io.h sys/time.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to in3otd@qsl.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const /**/ _ACEOF fi { $as_echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if test "${ac_cv_type_uid_t+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then cat >>confdefs.h <<\_ACEOF #define uid_t int _ACEOF cat >>confdefs.h <<\_ACEOF #define gid_t int _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_time=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if test "${ac_cv_prog_gcc_traditional+set}" = set; then $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if test "${ac_cv_type_signal+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_signal=int else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in gettimeofday strdup do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; cat >>confdefs.h <<\_ACEOF #define DEBUG 1 _ACEOF fi # Check whether --enable-dmalloc was given. if test "${enable_dmalloc+set}" = set; then enableval=$enable_dmalloc; ac_cv_dmalloc="$enableval" else ac_cv_dmalloc="no" fi case "$ac_cv_dmalloc" in yes) for ac_header in dmalloc.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to in3otd@qsl.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking for dmalloc_shutdown in -ldmalloc" >&5 $as_echo_n "checking for dmalloc_shutdown in -ldmalloc... " >&6; } if test "${ac_cv_lib_dmalloc_dmalloc_shutdown+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dmalloc_shutdown (); int main () { return dmalloc_shutdown (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_dmalloc_dmalloc_shutdown=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dmalloc_dmalloc_shutdown=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dmalloc_dmalloc_shutdown" >&5 $as_echo "$ac_cv_lib_dmalloc_dmalloc_shutdown" >&6; } if test "x$ac_cv_lib_dmalloc_dmalloc_shutdown" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBDMALLOC 1 _ACEOF LIBS="-ldmalloc $LIBS" fi CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK" ;; esac ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by glfer $as_me 0.4.2, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ glfer config.status 0.4.2 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { $as_echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { $as_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 $as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 $as_echo "$as_me: error: could not setup config headers machinery" >&2;} { (exit 1); exit 1; }; } fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 $as_echo "$as_me: error: could not create -" >&2;} { (exit 1); exit 1; }; } fi # Compute "$ac_file"'s index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in "$ac_file" | "$ac_file":* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for "$ac_file"" >`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { $as_echo "$as_me:$LINENO: result: $PACKAGE-$VERSION is now configured Source directory: $srcdir Installation prefix: $prefix C compiler: $CC $XTRA_CFLAGS $CFLAGS Libraries: ${LIBS} " >&5 $as_echo " $PACKAGE-$VERSION is now configured Source directory: $srcdir Installation prefix: $prefix C compiler: $CC $XTRA_CFLAGS $CFLAGS Libraries: ${LIBS} " >&6; } glfer-0.4.2/install-sh0000755000175000001440000001273610744705163011555 00000000000000#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 glfer-0.4.2/mtm.h0000644000175000001440000000240510744705164010510 00000000000000/* mtm.h * * Copyright (C) 2002 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _MTM_H_ #define _MTM_H_ #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_LIBRFFTW #include #else #include "fft_radix2.h" #endif /* HAVE_LIBRFFTW */ #include "fft.h" typedef struct { fft_params_t fft; double **window; double *sig; float w; int kmax; } mtm_params_t; void mtm_init(mtm_params_t * params); void mtm_do(float *audio_buf, float *psd_buf, float *phase_buf, mtm_params_t * params); void mtm_close(mtm_params_t * params); #endif /* #ifndef _MTM_H_ */ glfer-0.4.2/g_about.h0000644000175000001440000000172310744705162011333 00000000000000/* g_about.h * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _G_ABOUT_H_ #define _G_ABOUT_H_ #include void show_about(GtkWidget * widget, gpointer data); void show_license(GtkWidget * widget, gpointer data); #endif /* _G_ABOUT_H_ */ glfer-0.4.2/util.c0000644000175000001440000002367510744705164010677 00000000000000/* util.c * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #if TIME_WITH_SYS_TIME # include /* for gettimeofday() */ # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include /* for gettimeofday() */ #include #include "util.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif #define GSL_DBL_EPSILON 2.22e-16 #define GSL_SQRT_DBL_EPSILON 1.5e-8 #define NR_END 1 #define FREE_ARG char* static double start_secnds; static double secnds; static struct timeval tv; #ifndef HAVE_STRDUP char *strdup(const char *s) { int l = strlen(s); char *s1 = malloc(l + 1); if (!s1) memfatal("strdup"); memcpy(s1, s, l + 1); return s1; } #endif /* HAVE_STRDUP */ int tc_zero(void) { #ifdef HAVE_GETTIMEOFDAY if (gettimeofday(&tv, NULL)) perror("gettimeofday"); start_secnds = tv.tv_sec + tv.tv_usec / 1.0e06; D(printf("tc_zero: tv.tv_sec = %li\n", tv.tv_sec)); /* for debug */ D(printf("tc_zero: tv.tv_usec = %li\n", tv.tv_usec)); /* for debug */ D(printf("tc_zero: start_secnds = %f\n", start_secnds)); /* for debug */ #endif /* HAVE_GETTIMEOFDAY */ return 0; } double tc_time(void) { #ifdef HAVE_GETTIMEOFDAY if (gettimeofday(&tv, NULL)) perror("gettimeofday"); secnds = tv.tv_sec + tv.tv_usec / 1.0e06; // - start_secnds; D(printf("start_secnds = %f\n", start_secnds)); /* for debug */ D(printf("secnds = %f\n", secnds)); /* for debug */ return secnds; #else return 0; #endif /* HAVE_GETTIMEOFDAY */ } void nrerror(char error_text[]) /* Numerical Recipes standard error handler */ { fprintf(stderr, "Numerical Recipes run-time error...\n"); fprintf(stderr, "%s\n", error_text); fprintf(stderr, "...now exiting to system...\n"); exit(1); } float *vector(long nl, long nh) /* allocate a float vector with subscript range v[nl..nh] */ { float *v; v = (float *) malloc((size_t) ((nh - nl + 1 + NR_END) * sizeof(float))); if (!v) nrerror("allocation failure in vector()"); return v - nl + NR_END; } double *dvector(long nl, long nh) /* allocate a double vector with subscript range v[nl..nh] */ { double *v; v = (double *) malloc((size_t) ((nh - nl + 1 + NR_END) * sizeof(double))); if (!v) nrerror("allocation failure in dvector()"); return v - nl + NR_END; } float **matrix(long nrl, long nrh, long ncl, long nch) /* allocate a float matrix with subscript range m[nrl..nrh][ncl..nch] */ { long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1; float **m; /* allocate pointers to rows */ m = (float **) malloc((size_t) ((nrow + NR_END) * sizeof(float *))); if (!m) nrerror("allocation failure 1 in matrix()"); m += NR_END; m -= nrl; /* allocate rows and set pointers to them */ m[nrl] = (float *) malloc((size_t) ((nrow * ncol + NR_END) * sizeof(float))); if (!m[nrl]) nrerror("allocation failure 2 in matrix()"); m[nrl] += NR_END; m[nrl] -= ncl; for (i = nrl + 1; i <= nrh; i++) m[i] = m[i - 1] + ncol; /* return pointer to array of pointers to rows */ return m; } double **dmatrix(long nrl, long nrh, long ncl, long nch) /* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */ { long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1; double **m; /* allocate pointers to rows */ m = (double **) malloc((size_t) ((nrow + NR_END) * sizeof(double *))); if (!m) nrerror("allocation failure 1 in matrix()"); m += NR_END; m -= nrl; /* allocate rows and set pointers to them */ m[nrl] = (double *) malloc((size_t) ((nrow * ncol + NR_END) * sizeof(double))); if (!m[nrl]) nrerror("allocation failure 2 in matrix()"); m[nrl] += NR_END; m[nrl] -= ncl; for (i = nrl + 1; i <= nrh; i++) m[i] = m[i - 1] + ncol; /* return pointer to array of pointers to rows */ return m; } void free_vector(float *v, long nl, long nh) /* free a float vector allocated with vector() */ { free((FREE_ARG) (v + nl - NR_END)); } void free_dvector(double *v, long nl, long nh) /* free a double vector allocated with dvector() */ { free((FREE_ARG) (v + nl - NR_END)); } void free_matrix(float **m, long nrl, long nrh, long ncl, long nch) /* free a float matrix allocated by matrix() */ { free((FREE_ARG) (m[nrl] + ncl - NR_END)); free((FREE_ARG) (m + nrl - NR_END)); } void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch) /* free a double matrix allocated by dmatrix() */ { free((FREE_ARG) (m[nrl] + ncl - NR_END)); free((FREE_ARG) (m + nrl - NR_END)); } double bessel_I0(double x) { /* modified Bessel function of the first kind */ double ax, ans; double y; if ((ax = fabs(x)) < 3.75) { y = x / 3.75; y *= y; ans = 1.0 + y * (3.5156229 + y * (3.0899424 + y * (1.2067492 + y * (0.2659732 + y * (0.360768e-01 + y * 0.45813e-02))))); } else { y = 3.75 / ax; ans = (exp(ax) / sqrt(ax)) * (0.39894228 + y * (0.1328592e-01 + y * (0.225319e-02 + y * (-0.157565e-02 + y * (0.916281e-02 + y * (-0.2057706e-01 + y * (0.2635537e-01 + y * (-0.1647633e-01 + y * 0.392377e-02)))))))); } return ans; } /* Author: G. Jungman */ /* This is a the jacobi version */ /* * Algorithm due to J.C. Nash, Compact Numerical Methods for * Computers (New York: Wiley and Sons, 1979), chapter 3. * See also Algorithm 4.1 in * James Demmel, Kresimir Veselic, "Jacobi's Method is more * accurate than QR", Lapack Working Note 15 (LAWN15), October 1989. * Available from netlib. * * Based on code by Arthur Kosowsky, Rutgers University * kosowsky@physics.rutgers.edu * * Another relevant paper is, P.P.M. De Rijk, "A One-Sided Jacobi * Algorithm for computing the singular value decomposition on a * vector computer", SIAM Journal of Scientific and Statistical * Computing, Vol 10, No 2, pp 359-371, March 1989. * */ int compute_svd(float **A, int nrow, int ncol, float S[], float **Q) /* Given a matrix A[0..nrow-1][0..ncol-1], this routine computes its singular values decomposition A=U*S*(Q**T). The matrix U replaces A on output. The diagonal matrix of singular values S is output as a vector S[0..ncol-1]. The matrix Q (not the transpose (Q**T)) is output as Q[0..ncol-1][0..ncol-1] */ { double tolerance = 1.0e-12; int i, j, k; /* Initialize the rotation counter and the sweep counter. */ int count = 1; int sweep = 0; int sweepmax = ncol; if (A == NULL || S == NULL || Q == NULL) { return (-1); } else if (nrow == 0 || ncol == 0) { return (-1); } else { /* Always do at least 12 sweeps. */ sweepmax = (sweepmax > 12 ? sweepmax : 12); /* Set Q to the identity matrix. */ for (i = 0; i < ncol; i++) { for (j = 0; j < ncol; j++) { Q[i][j] = 0.0; } Q[i][i] = 1.0; } /* Orthogonalize A by plane rotations. */ while (count > 0 && sweep <= sweepmax) { /* Initialize rotation counter. */ count = ncol * (ncol - 1) / 2; for (j = 0; j < ncol - 1; j++) { for (k = j + 1; k < ncol; k++) { double p = 0.0; double q = 0.0; double r = 0.0; double cosine, sine; double v; for (i = 0; i < nrow; i++) { /* quantities in rotation angles */ const double Aij = A[i][j]; const double Aik = A[i][k]; p += Aij * Aik; q += Aij * Aij; r += Aik * Aik; } if (q * r < GSL_DBL_EPSILON) { /* column elements of A small */ count--; continue; } if (p * p / (q * r) < tolerance) { /* columns j,k orthogonal */ count--; continue; } /* calculate rotation angles */ if (q < r) { cosine = 0.0; sine = 1.0; } else { q -= r; v = sqrt(4.0 * p * p + q * q); cosine = sqrt((v + q) / (2.0 * v)); sine = p / (v * cosine); } /* apply rotation to A */ for (i = 0; i < nrow; i++) { double Aik = A[i][k]; double Aij = A[i][j]; A[i][j] = Aij * cosine + Aik * sine; A[i][k] = -Aij * sine + Aik * cosine; } /* apply rotation to Q */ for (i = 0; i < ncol; i++) { double Qij = Q[i][j]; double Qik = Q[i][k]; Q[i][j] = Qij * cosine + Qik * sine; Q[i][k] = -Qij * sine + Qik * cosine; } } } /* Sweep completed. */ sweep++; } /* * Orthogonalization complete. Compute singular values. */ if (count > 0) { /* reached sweep limit */ } for (j = 0; j < ncol; j++) { double q = 0.0; /* Calculate singular values. */ for (i = 0; i < nrow; i++) { double Aij = A[i][j]; q += Aij * Aij; } S[j] = sqrt(q); /* Normalize vectors. */ for (i = 0; i < nrow; i++) { double Aij = A[i][j]; double Sj = S[j]; A[i][j] = Aij / Sj; } } return 0; /* success */ } } void dump_octave_file(char *name, float *a, int nrows, int ncols) { FILE *fout; int i, j; fout = fopen(name, "w"); if (!fout) { /* problems opening file */ fprintf(stderr, "cannot open %s.\n", name); return; } fprintf(fout, "# name: %s\n", name); fprintf(fout, "# type: matrix\n"); fprintf(fout, "# rows: %i\n", nrows); fprintf(fout, "# columns: %i\n", ncols); for (i = 0; i < nrows; i++) { for (j = 0; j < ncols; j++) { // fprintf(fout, "%f ", a[i][j]); } fprintf(fout, "\n"); } fclose(fout); } glfer-0.4.2/INSTALL0000644000175000001440000001722710744705164010603 00000000000000Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. glfer-0.4.2/fft.h0000644000175000001440000000466511072737526010506 00000000000000/* fft.h * * Copyright (C) 2001-2008 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _FFT_H_ #define _FFT_H_ #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_LIBRFFTW #include #else #include "fft_radix2.h" #endif /* HAVE_LIBRFFTW */ #ifdef HAVE_LIBRFFTW typedef struct { fftw_plan plan; fftw_real *inbuf_audio; fftw_real *inbuf_fft; fftw_real *outbuf; int n; /* FFT size */ float *window; /* FFT window data */ int window_type; /* FFT window type */ float overlap; /* percentage of overlap between FFT blocks */ float a; /* RA9MB nonlinear processing parameter */ int limiter; int sub_mean; } fft_params_t; #else typedef struct { float *inbuf_audio; float *inbuf_fft; float *outbuf; int n; float *window; int window_type; float overlap; float a; /* RA9MB nonlinear processing parameter */ int limiter; int sub_mean; } fft_params_t; #endif /* HAVE_LIBRFFTW */ enum {HANNING_WINDOW = 0, BLACKMAN_WINDOW, GAUSSIAN_WINDOW, WELCH_WINDOW, BARTLETT_WINDOW, RECTANGULAR_WINDOW, HAMMING_WINDOW, KAISER_WINDOW}; typedef struct _fft_window_t fft_window_t; struct _fft_window_t { char *name; int type; }; void prepare_audio(float *audio_buf, fft_params_t * params); void fft_init(fft_params_t * params); void fft_do(float *audio_buf, fft_params_t * params); void fft_psd(float *psd_buf, float *phase_buf, fft_params_t * params); void fft_close(fft_params_t * params); void compute_floor(float *psd_buf, int n, float *sig_pwr_p, float *floor_pwr_p , float *peak_pwr_p, unsigned int *peak_bin_p); void goertzel(float *audio_buf, float *psd_buf, float *phase_buf, fft_params_t * params); #endif /* #ifndef _FFT_H_ */ glfer-0.4.2/wav_fmt.c0000644000175000001440000000671311052063142011341 00000000000000/* wav_fmt.c * Copyright (C) 2001 Claudio Girardi * This file is derived from bplay, (C) David Monro 1996 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include #include #include "util.h" #include "wav_fmt.h" #define MSPEED 1 #define MBITS 2 #define MSTEREO 4 int speed, bits, stereo; /* Audio parameters */ static unsigned char *buf = NULL, *buf8 = NULL; static short int *buf16 = NULL; static float *buff = NULL; static wavhead wavhd; static int fd_in; static int out_len = 1024; //FIXME int open_wav_file(char *fname, int n, int *speed) { int count; char hd_buf[20]; /* Holds first 20 bytes */ /* sets size of data block to be read */ out_len = n; D(fprintf(stderr, "out_len = %i\n", out_len);) if ((fd_in = open(fname, O_RDONLY)) == -1) { fprintf(stderr, "error opening %s\n", fname); exit(-1); } count = read(fd_in, hd_buf, 20); if (count < 0) fprintf(stderr, "error reading WAV file\n"); if (count < 20) fprintf(stderr, "input file less than 20 bytes long\n"); if (strstr(hd_buf, "RIFF") == NULL) fprintf(stderr, "input file not in WAV format\n"); memcpy((void *) &wavhd, (void *) hd_buf, 20); count = read(fd_in, ((char *) &wavhd) + 20, sizeof(wavhd) - 20); if (wavhd.format != 1) fprintf(stderr, "input is not a PCM WAV file"); *speed = wavhd.sample_fq; bits = wavhd.bit_p_spl; stereo = wavhd.modus - 1; D(fprintf(stderr, "WAVE format: %d bit, Speed %d %s ...\n", bits, *speed, (stereo) ? "Stereo" : "Mono");) return fd_in; } /* reads the audio data */ void wav_read(float **buf_out, int *n_out) { int i; int n_read; int s_bufsize; s_bufsize = out_len * wavhd.bit_p_spl / 8; if (!buf) { switch (wavhd.bit_p_spl) { case (8): buf = buf8 = (unsigned char *) calloc(out_len, sizeof(unsigned char)); break; case (16): buf16 = (short int *) calloc(out_len, sizeof(short int)); buf = (unsigned char *) buf16; break; } buff = (float *) calloc(out_len, sizeof(float)); } n_read = read(fd_in, buf, s_bufsize); switch (wavhd.bit_p_spl) { case (8): for (i = 0; i < n_read; i++) /* buf8 is an array of char */ buff[i] = ((float) buf8[i] - 128) / 128; break; case (16): for (i = 0; i < n_read / 2; i++) { /* buf16[] is an array of short int */ buff[i] = (float) buf16[i] / 32768; //buff[i] = (buf16[i] / 256) + (buf16[i] % 256) * 256; } break; } *n_out = (n_read == 0 ? 0 : 1); *buf_out = buff; } void close_wav_file() { D(printf("%s: buf16 = %p\n", __PRETTY_FUNCTION__, buf16)); /* for debug */ close(fd_in); FREE_MAYBE(buf8); FREE_MAYBE(buf16); buf = NULL; /* since buf is the same as buf8 or buf16 it should not be freed */ FREE_MAYBE(buff); } glfer-0.4.2/NEWS0000644000175000001440000000027011330653241010225 00000000000000Changed the TX control port selection dialog to support devices other than ttyS[0-3] and lp[0-1]; now any device in /dev is supported, just enter its name in the port selection dialog.glfer-0.4.2/source.h0000644000175000001440000000203410744705164011211 00000000000000/* source.h * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _SOURCE_H_ #define _SOURCE_H_ void init_audio(char *fname); void close_audio(void); void toggle_stop_start(GtkWidget * widget, gpointer data); void start_reading_audio(); void stop_reading_audio(); void change_params(int mode_sel); #endif /* not _SOURCE_H_ */ glfer-0.4.2/cw_rx.h0000644000175000001440000000166010744705165011040 00000000000000/* cw_rx.h * * Copyright (C) 2007 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _CW_RX_H_ #define _CW_RX_H_ #ifdef HAVE_CONFIG_H #include #endif void rx_cw(float *audio_buf, int n_samples); #endif /* #ifndef _CW_RX_H_ */ glfer-0.4.2/bell-p-w.c0000644000175000001440000002301011051641613011306 00000000000000/* bell-p-w.c * * Copyright (C) 2008 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ /* * This file is derived from FORTRAN 77 code by Brad Bell, Don Percival * and Andrew Walden. Original note says * " Comments / queries * to dbp@apl.washington.edu or a.walden@ic.ac.uk. This software may be freely used for non-commercial purposes and can be freely distributed. Equation numbers and comments refer to the article: Bell, B., Percival, D.B. and Walden, A.T. "Calculating Thomson's Spectral Multitapers by Inverse Iteration ", J. Comput. and Graph. Stat., 1993. " */ #include #include #include #include "util.h" #define MIN(a,b) ((a) < (b) ? (a) : (b)) int sytoep(int n, double *r, double *g, double *f) { /* Finds filter corresponding to a symmetric Toeplitz matrix with first row r[] and crosscorrelation vector g[] i.e., "r" f = g To be used with DPSS and SPOL. See Bell, B., Percival, D.B. and Walden, A.T. "Calculating Thomson's Spectral Multitapers by Inverse Iteration", J. Comput. and Graph. Stat., 1993. +++++++++++++++++++++++++++++++++++++++++++++++++++++++ N integer input: dimension of Toeplitz matrix and cross-correlation vector R(N) real input: autocovariances from lag 0 to N-1 G(N) real input: cross-correlation vector F(N) real output: required filter W(N) real input: work array IFAULT integer output: 0 indicates successful 1 if N < 1 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This program is a substantially corrected and modified version of "EUREKA" in Robinson, E.A. (1967) "Multichannel Time Series Analysis with Digital Computer Programs", Holden-Day. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ int i, l, l1, l2, l3, j, k; double *w, v, d, q, hold; w = dvector(1, n); /* check for special "matrix" sizes */ if (n < 1) return 1; v = r[0]; f[1] = g[1] / v; if (n == 1) return 0; d = r[1]; w[1] = 1.0; q = f[1] * r[1]; for (l = 2; l <= n; l++) { w[l] = -d / v; if (l > 2) { l1 = (l - 2) / 2; l2 = l1 + 1; if (l != 3) { for (j = 2; j <= l2; j++) { hold = w[j]; k = l - j + 1; w[j] = w[j] + w[l] * w[k]; w[k] = w[k] + w[l] * hold; } } if (((2 * l1) != (l - 2)) || (l == 3)) w[l2 + 1] = w[l2 + 1] + w[l] * w[l2 + 1]; } v = v + w[l] * d; f[l] = (g[l] - q) / v; l3 = l - 1; for (j = 1; j <= l3; j++) { k = l - j + 1; f[j] = f[j] + f[l] * w[k]; } if (l == n) return 0; d = 0.0; q = 0.0; for (i = 1; i <= l; i++) { k = l - i + 2; d = d + w[i] * r[k - 1]; q = q + f[i] * r[k - 1]; } } free_dvector(w, 1, n);; return 0; } int spol(int n, double *v, int k) { /* Scales the discrete prolate spheroidal sequence and sets the polarity to agree with Slepian's convention. To be used with DPSS and SYTOEP. See Bell, B., Percival, D.B. and Walden, A.T. "Calculating Thomson's Spectral Multitapers by Inverse Iteration", J. Comput. and Graph. Stat., 1993. (Section 1.2.) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ N Integer input length of dpss sequence V Real(N) input eigenvector (dpss) with unit energy output unit energy dpss conforming to Slepian's polarity convention K Integer input the order of the dpss 0= 1/2 2 if N < 2 3 if NMAX < N; matrix too small 4 if KMAX < 0 5 failure in SYTOEP 6 > MAXIT its required for some order (Output values are undefined for IFAULT in the range 1 to 5.) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ int j, jj, k, k1, m, isig, ilow, ihigh, it, maxit, ifail, ifault; double *u, *vold, *sines; double *scr1, delta, rootn; double proj, snorm, ssnorm, diff, sum, rone; double eps = 0.5e-6; sines = dvector(0, n - 1); vold = dvector(1, n); u = dvector(1, n); scr1 = dvector(1, n); /* initialize max number of iterations flag */ ifail = 0; /* check input parameters */ if (w > 0.5) return 1; if (n < 2) return 2; if (nmax < n) return 3; if ((kmax < 0) || (kmax > n - 1)) return 4; /* set up SINES so that S in eqn. (1) is given by */ /* S(n,m)=SINES(n-m) for n not equal to m */ for (m = 1; m < n; m++) sines[m] = sin(2.0 * M_PI * w * m) / (M_PI * m); /* set total iteration counter and constant */ *totit = 0; rootn = sqrt(n); rone = 1.0 / rootn; /* major loop over dpss orders 0 to KMAX */ /* modify SINES(0) so that B_k in Section 2.2 is given by */ /* B_k(n,m)=SINES(n-m) */ for (k = 0; k <= kmax; k++) { if (k == 0) { sines[0] = 2.0 * w - 1.0; } else { sines[0] = 2.0 * w - (1.0 + sig[k - 1]); } /* define suitable starting vector for inverse iteration; */ /* see Section 2.2 */ isig = 1; k1 = k + 1; for (j = 1; j <= k1; j++) { ilow = ((j - 1) * n / k1) + 1; ihigh = (j * n / k1); for (jj = ilow; jj <= ihigh; jj++) { u[jj] = isig * rone; } isig = -isig; } if (((k % 2) != 0) && ((n % 2) > 0)) u[n / 2 + 1] = 0.0; /* maximum number of iterations */ maxit = (k + 3) * rootn; /* carry out inverse iteration */ for (it = 1; it <= maxit; it++) { /* copy U into old V; VOLD = previous iterate */ for (j = 1; j <= n; j++) vold[j] = u[j]; /* solve symmetric Toeplitz matrix equation B_k*U=VOLD for U */ ifail = sytoep(n, sines, vold, u); /* check no problems */ if (ifail != 0) return 5; /* new vector must be orthogonal to previous eigenvectors */ if (k > 0) { for (k1 = 0; k1 < k; k1++) { /* projection of u onto v(*,k1) */ proj = 0.0; for (j = 1; j <= n; j++) proj = proj + u[j] * v[j][k1]; /* subtract projection */ for (j = 1; j <= n; j++) u[j] = u[j] - proj * v[j][k1]; } } /* normalize */ snorm = 0.0; for (j = 1; j <= n; j++) snorm = snorm + u[j] * u[j]; ssnorm = sqrt(snorm); for (j = 1; j <= n; j++) u[j] = u[j] / ssnorm; /* check for convergence */ sum = 0.0; diff = 0.0; for (j = 1; j <= n; j++) { /* first previous-current */ diff = diff + (vold[j] - u[j]) * (vold[j] - u[j]); /* next, previous+current */ sum = sum + (vold[j] + u[j]) * (vold[j] + u[j]); } delta = sqrt(MIN(diff, sum)); if (delta < eps) { ifail = 0; goto endloop; } } /* FIXME */ /* if here, max number of iterations exceeded for this order dpss */ it = maxit; ifail = 1; endloop: *totit += it; if (sum < diff) { if (k == 0) { sig[0] = -1.0 / ssnorm; } else { sig[k] = sig[k - 1] - 1.0 / ssnorm; } } else { if (k == 0) { sig[0] = 1.0 / ssnorm; } else { sig[k] = sig[k - 1] + 1.0 / ssnorm; } } /* ensure tapers satisfy Slepian convention */ ifault = spol(n, u, k); for (j = 1; j <= n; j++) v[j][k] = u[j]; } /* one order of dpss did not converge set IFAULT to 6 */ if (ifail == 1) return 6; else return 0; } glfer-0.4.2/configure.in0000644000175000001440000000344511330652240012044 00000000000000dnl Process this file with autoconf to produce a configure script. AC_INIT(glfer, 0.4.2, in3otd@qsl.net) AC_CONFIG_SRCDIR(glfer.c) dnl For automake AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) AM_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL dnl you should add CFLAGS="" here, 'cos it is set to -g by PROG_CC dnl CFLAGS="-ggdb -O2 -Wall" dnl Checks for libraries. AC_CHECK_LIB(fftw, fftw_create_plan, , , -lm) AC_CHECK_LIB(rfftw, rfftw_create_plan, , , -lm) AM_PATH_GTK_2_0(2.1.0, , AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?)) AC_CHECK_LIB(m, sin) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/io.h sys/time.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_UID_T AC_HEADER_TIME dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_TYPE_SIGNAL AC_CHECK_FUNCS(gettimeofday strdup) dnl Check for debug AC_ARG_ENABLE(debug, [ --enable-debug enable support for debugging output], AC_DEFINE(DEBUG, 1, "Define if you want to have debug informations"),) dnl Check for dmalloc usage AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc enable support for the dmalloc debugging library], [ac_cv_dmalloc="$enableval"], [ac_cv_dmalloc="no"]) dnl Allow building with dmalloc. Do this last to avoid screwing up any dnl other checks above. case "$ac_cv_dmalloc" in yes) AC_CHECK_HEADERS(dmalloc.h) AC_CHECK_LIB(dmalloc, dmalloc_shutdown) CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK" ;; esac AC_OUTPUT(Makefile) dnl output $canonical_host_type ?? AC_MSG_RESULT([ $PACKAGE-$VERSION is now configured Source directory: $srcdir Installation prefix: $prefix C compiler: $CC $XTRA_CFLAGS $CFLAGS Libraries: ${LIBS} ]) glfer-0.4.2/g_file_dialogs.c0000644000175000001440000001507711166734501012642 00000000000000/* g_file_dialogs.c * Copyright (C) 2009 Claudio Girardi * * This file is derived from xspectrum, Copyright (C) 2000 Vincent Arkesteijn * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include "glfer.h" #include "g_file_dialogs.h" extern glfer_t glfer; extern GdkPixbuf *pixbuf; static void spectrum_file_save(gchar *filename); void open_file_dialog(GtkWidget * widget, gpointer data) { GtkWidget *dialog; GtkFileFilter *filter; dialog = gtk_file_chooser_dialog_new ("Open File", NULL, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); filter = gtk_file_filter_new(); gtk_file_filter_set_name (filter, "Wav"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); gtk_file_filter_add_pattern (filter, "*.[Ww][Aa][Vv]"); filter = gtk_file_filter_new(); gtk_file_filter_set_name (filter, "All files"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); gtk_file_filter_add_pattern (filter, "*"); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { char *filename; filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); stop_reading_audio(); init_audio(filename); start_reading_audio(); glfer.first_buffer = TRUE; /* need to reinitialize display autoscale */ g_free(filename); } gtk_widget_destroy (dialog); } void save_spect_dialog(GtkWidget * widget, gpointer data) { GtkWidget *dialog; GtkFileFilter *filter; gchar *filter_name, *filename_ext = NULL, *tmps; gboolean file_format_ok; dialog = gtk_file_chooser_dialog_new ("Save File", NULL, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER(dialog), TRUE); /* filter = gtk_file_filter_new(); gtk_file_filter_set_name (filter, "Supported formats"); gtk_file_filter_add_pixbuf_formats(filter); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter); */ filter = gtk_file_filter_new(); gtk_file_filter_set_name (filter, "JPEG"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); gtk_file_filter_add_pattern (filter, "*.[Jj][Pp][Gg]"); filter = gtk_file_filter_new(); gtk_file_filter_set_name (filter, "PNG"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); gtk_file_filter_add_pattern (filter, "*.[Pp][Nn][Gg]"); filter = gtk_file_filter_new(); gtk_file_filter_set_name (filter, "BMP"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); gtk_file_filter_add_pattern (filter, "*.[Bb][Mm][Pp]"); filter = gtk_file_filter_new(); gtk_file_filter_set_name (filter, "All files"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); gtk_file_filter_add_pattern (filter, "*"); //if (user_edited_a_new_document) { // gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), default_folder_for_saving); //gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), "glfer.jpg"); //} else // gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), filename_for_existing_document); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { char *filename; filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); /* get current selected filter */ filter = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog)); filter_name = gtk_file_filter_get_name(filter); file_format_ok = FALSE; /* check if selected filensme has an extension */ filename_ext = strrchr(filename, '.'); if (filename_ext) { filename_ext++; /* point to extension following the dot */ if (g_str_has_suffix(filename, "jpg") || g_str_has_suffix(filename, "JPG") || g_str_has_suffix(filename, "png") || g_str_has_suffix(filename, "PNG") || g_str_has_suffix(filename, "bmp") || g_str_has_suffix(filename, "BMP")) { /* user has specified a known extension, so file format to use is known */ /* filename already has the correct extension */ file_format_ok = TRUE; } } else { /* user did not specify file estension, use the one from the filter */ if (!strcmp(filter_name, "JPEG")) { filename_ext = strdup(".jpg"); } else if (!strcmp(filter_name, "PNG")) { filename_ext = strdup(".png"); } else if(!strcmp(filter_name, "BMP")) { filename_ext = strdup(".bmp"); } if (strcmp(filter_name, "All files")) {/* if a filter other than "All files" is selected */ /* add suffix to filename */ tmps = g_strconcat(filename, filename_ext, NULL); g_free(filename); /* no longer needed */ g_free(filename_ext); /* no longer needed */ filename = tmps; file_format_ok = TRUE; } /* else file_format_ok = FALSE */ } if (file_format_ok == TRUE) { g_printf("filename = %s\n", filename); spectrum_file_save(filename); } g_free (filename); } gtk_widget_destroy (dialog); } static void spectrum_file_save(gchar *filename) { GError *error = NULL; gboolean save_ok = 0; if (g_str_has_suffix(filename, ".jpg") || g_str_has_suffix(filename, ".JPG")) save_ok = gdk_pixbuf_save (pixbuf, filename, "jpeg", &error, "quality", "100", NULL); else if (g_str_has_suffix(filename, ".png") || g_str_has_suffix(filename, ".PNG")) save_ok = gdk_pixbuf_save (pixbuf, filename, "png", &error, NULL); else if (g_str_has_suffix(filename, ".bmp") || g_str_has_suffix(filename, ".BMP")) save_ok = gdk_pixbuf_save (pixbuf, filename, "bmp", &error, NULL); if (!save_ok) { /* something went wrong, print error message and free memory */ g_warning("%s\n", error->message); g_error_free(error); gdk_pixbuf_unref(pixbuf); //g_string_free(filename, TRUE); //return FALSE; } /* everything went OK, free memory */ //g_string_free(filename, TRUE); gdk_pixbuf_unref(pixbuf); //return TRUE; } glfer-0.4.2/qrs.c0000644000175000001440000004605110744705161010515 00000000000000/* qrs.c * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include /* for toupper() */ #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include #include /* for KIOCSOUND */ #include /* file control definitions */ #include /* #include *//* for inb() and outb() in libc5 only ? */ #include "qrs.h" #include "glfer.h" #include "util.h" #include /* string function definitions */ /* ioperm is in unistd.h in libc5 */ #include /* UNIX standard function definitions */ /* ioperm is in sys/io.h in glibc */ /* conditionals for architectures without sys/io.h added by Joop Stakenborg */ #if HAVE_SYS_IO_H # include #endif #include /* error number definitions */ #include /* POSIX terminal control definitions */ #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif #define PP_BIT0 1 /* parallel port DATA0 line */ #define PP_BIT1 2 /* parallel port DATA1 line */ #define PP_PTT PP_BIT1 #define PP_KEY PP_BIT0 #define PP_BASE0 0x378 /* printer port 0 base address */ #define PP_BASE1 0x278 /* printer port 1 base address */ extern opt_t opt; static int ksound_fd = -1; /* console file descriptor */ static int serial_fd = -1; /* serial port file descriptor */ static int ksound_opened = FALSE; static int repeat_msg = FALSE; /* repeat message transmission (beacon mode) */ /* function prototypes */ static void send_next_element(int signal); static void set_alarm_timer(float sec); void send_next_char(int trig_signal); static void emit_sound(float freq); /* morse code characters table */ static struct { char key; char *cw; } cw_chars[] = { { 'A', ".-"}, { 'B', "-..."}, { 'C', "-.-."}, { 'D', "-.."}, { 'E', "."}, { 'F', "..-."}, { 'G', "--."}, { 'H', "...."}, { 'I', ".."}, { 'J', ".---"}, { 'K', "-.-"}, { 'L', ".-.."}, { 'M', "--"}, { 'N', "-."}, { 'O', "---"}, { 'P', ".--."}, { 'Q', "--.-"}, { 'R', ".-."}, { 'S', "..."}, { 'T', "-"}, { 'U', "..-"}, { 'V', "...-"}, { 'W', ".--"}, { 'X', "-..-"}, { 'Y', "-.--"}, { 'Z', "--.."}, { '0', "-----"}, { '1', ".----"}, { '2', "..---"}, { '3', "...--"}, { '4', "....-"}, { '5', "....."}, { '6', "-...."}, { '7', "--..."}, { '8', "---.."}, { '9', "----."}, { '?', "..--.."}, { '/', "-..-."}, { '.', ".-.-.-"}, { '@', ".-.-."}, /* AR */ { '$', "...-.-"}, /* SK */ { '%', "-...-.-"}, /* BK */ { '*', "-.-.-"} , /* CT */ /*{ '(', "-.--." }, { ')', "-.--.-" }, { '"', ".-..-." }, { '\'', ".----." }, { ',', "--..--" }, { '-', "-....-" }, { ':', "---..." }, { ';', "-.-.-." }, { '=', "-...-" }, { '_', "..--.-" },*/ { ' ', " "}, { 0, ""} /* end of CW char list */ }; char *s; static int str_index; /* string index */ static int str_len; /* string length */ static int cw_char_index; /* cw char string index */ static int tab_index; /* cw lookup table index */ static int cw_char_len; /* cw char string length */ static void set_alarm_timer(float msec) { struct itimerval element_time; long sec, usec; sec = floor(msec / 1000.0); usec = 1e03 * (msec - 1000.0 * sec); element_time.it_interval.tv_sec = 0; element_time.it_interval.tv_usec = 0; element_time.it_value.tv_sec = sec; element_time.it_value.tv_usec = usec; setitimer(ITIMER_REAL, &element_time, NULL); } static void emit_sound(float freq) { int kparam; /* sanity check */ if (ksound_opened == TRUE) { /* parameter for KIOCSOUND ioctl for setting the frequency */ kparam = (freq != 0.0 ? (1193180 / freq) : 0); signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); if (ioctl(ksound_fd, KIOCSOUND, kparam) == -1) perror("emit_sound(): KIOCSOUND ioctl returned -1"); signal(SIGINT, SIG_DFL); signal(SIGQUIT, SIG_DFL); } } int open_parport(char *device) { #if HAVE_SYS_IO_H uid_t real_uid; gid_t real_gid; /* checking I/O permissions */ if (ioperm(PP_BASE0, 3, 1)) { /* can not access the parallel port */ fprintf(stderr, "Error: Couldn't get the parallel port at %x\n", PP_BASE0); fprintf(stderr, "You need root privileges to run this program.\n"); return -1; } else { /* OK, now drop root privileges */ real_uid = getuid(); setuid(real_uid); real_gid = getgid(); setgid(real_gid); /* make sure PTT and KEY are off */ ptt_off(); key_up(); } #endif return 0; } /* open_serial_port() - open serial port * * returns the file descriptor on success or -1 on error */ int open_serial_port(char *device) { struct termios options; int status; char *dev_full_name; char error_string[] = "open_serial_port: unable to open "; char *error_message; /* allocate enough space for the complete device name */ dev_full_name = malloc((strlen(device) + 6) * sizeof(char)); /* it will be in "/dev" */ strcpy(dev_full_name, "/dev/"); /* add the device name */ strcat(dev_full_name, device); /* try to open the device */ serial_fd = open(dev_full_name, O_RDWR | O_NOCTTY | O_NDELAY); if (serial_fd == -1) { /* could not open the port */ error_message = (char *) malloc((strlen(error_string) + strlen(dev_full_name) + 1) * sizeof(char)); strcpy(error_message, error_string); strcat(error_message, dev_full_name); perror(error_message); free(dev_full_name); free(error_message); return -1; } else { /* set normal behaviour */ fcntl(serial_fd, F_SETFL, 0); } /* get the current options */ if (tcgetattr(serial_fd, &options) < 0) { fprintf(stderr, "open_serial_port: error in tcgetattr\n"); return -1; } /* set raw input, 1 second timeout */ options.c_iflag = IGNBRK; options.c_cflag |= (CLOCAL | CREAD); options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); options.c_oflag &= ~OPOST; options.c_cc[VMIN] = 0; options.c_cc[VTIME] = 10; /* set the options */ if (tcsetattr(serial_fd, TCSANOW, &options) < 0) { fprintf(stderr, "open_serial_port: error in tcsetattr\n"); return -1; } /* get serial port current status */ ioctl(serial_fd, TIOCMGET, &status); /* clear DTR and RTS */ status &= ~(TIOCM_DTR | TIOCM_RTS); ioctl(serial_fd, TIOCMSET, &status); /* device name is not used anynmore here */ free(dev_full_name); return (serial_fd); } void close_serial_port(void) { if (serial_fd != -1) { /* port opened */ if (close(serial_fd) == -1) { /* an error occurred */ perror("close_serial_port"); } else { /* serial port released */ serial_fd = -1; } } } void ptt_on(void) { int status; #if HAVE_SYS_IO_H unsigned short pp_status; /* parallel port status */ #endif switch (opt.device_type) { case DEV_SERIAL: /* get serial port current status */ ioctl(serial_fd, TIOCMGET, &status); /* set DTR */ status |= TIOCM_DTR; ioctl(serial_fd, TIOCMSET, &status); break; #if HAVE_SYS_IO_H case DEV_PARALLEL: pp_status = inb(PP_BASE0); pp_status |= PP_BIT1; outb((unsigned char) pp_status, PP_BASE0); break; #endif default: fprintf(stderr, "ptt_on: invalid opt.device_type\n"); break; } D(printf("PTT ON\n")); /* for debug */ } void ptt_off(void) { int status; #if HAVE_SYS_IO_H unsigned short pp_status; /* parallel port status */ #endif switch (opt.device_type) { case DEV_SERIAL: /* get serial port current status */ ioctl(serial_fd, TIOCMGET, &status); /* clear DTR */ status &= ~TIOCM_DTR; ioctl(serial_fd, TIOCMSET, &status); break; #if HAVE_SYS_IO_H case DEV_PARALLEL: pp_status = inb(PP_BASE0); pp_status &= ~PP_BIT1; outb((unsigned char) pp_status, PP_BASE0); break; #endif default: fprintf(stderr, "ptt_off: invalid opt.device_type\n"); break; } D(printf("PTT OFF\n")); /* for debug */ } void key_down(void) { int status; #if HAVE_SYS_IO_H unsigned short pp_status; /* parallel port status */ #endif switch (opt.device_type) { case DEV_SERIAL: /* get serial port current status */ ioctl(serial_fd, TIOCMGET, &status); /* set RTS */ status |= TIOCM_RTS; ioctl(serial_fd, TIOCMSET, &status); break; #if HAVE_SYS_IO_H case DEV_PARALLEL: pp_status = inb(PP_BASE0); pp_status |= PP_BIT0; outb((unsigned char) pp_status, PP_BASE0); break; #endif default: fprintf(stderr, "key_down: invalid opt.device_type\n"); break; } D(printf("KEY DOWN\n")); /* for debug */ } void key_up(void) { int status; #if HAVE_SYS_IO_H unsigned short pp_status; /* parallel port status */ #endif switch (opt.device_type) { case DEV_SERIAL: /* get serial port current status */ ioctl(serial_fd, TIOCMGET, &status); /* clear RTS */ status &= ~TIOCM_RTS; ioctl(serial_fd, TIOCMSET, &status); break; #if HAVE_SYS_IO_H case DEV_PARALLEL: pp_status = inb(PP_BASE0); pp_status &= ~PP_BIT0; outb((unsigned char) pp_status, PP_BASE0); break; #endif default: fprintf(stderr, "key_up: invalid opt.device_type\n"); break; } D(printf("KEY UP\n")); /* for debug */ } static void dfcw_dot_pause(int trig_signal) { if (cw_char_index < (cw_char_len - 1)) { /* not at the end of the char */ cw_char_index++; /* if previous element was a dot insert a gap */ if (cw_chars[tab_index].cw[cw_char_index - 1] == '.') { /* stop sidetone */ emit_sound(0); /* TX off */ key_up(); set_alarm_timer(opt.dfcw_gap_time); signal(SIGALRM, send_next_element); } else { /* otherwise make no pause and start sending next char */ send_next_element(SIGALRM); } } else if (str_index < (str_len - 1)) { /* stop sidetone */ emit_sound(0); /* TX off */ key_up(); /* not at the end of the string to be transmitted */ str_index++; D(printf(", str_index = %i\n", str_index)); /* for debug */ /* pause between chars */ set_alarm_timer(3.0 * opt.dot_time); signal(SIGALRM, send_next_char); } else { /* stop sidetone */ emit_sound(0); /* end of transmission */ key_up(); /* release PTT (not needed) */ ptt_off(); } } static void qrss_dot_pause(int trig_signal) { /* switch off emission */ key_up(); /* stop sidetone */ emit_sound(0); if (cw_char_index < (cw_char_len - 1)) { /* not at the end of the char */ cw_char_index++; /* one dot pause between chars */ signal(SIGALRM, send_next_element); set_alarm_timer(opt.dot_time); } else if (str_index < (str_len - 1)) { /* not at the end of the string to be transmitted */ str_index++; D(printf(", str_index = %i\n", str_index)); /* for debug */ /* pause between chars */ signal(SIGALRM, send_next_char); set_alarm_timer(5.0 * opt.dot_time); } else if (str_index < str_len) { /* end of the string, end of transmission */ if (repeat_msg == FALSE) { /* not in beacon mode */ str_index++; /* signal that last character was sent */ signal(SIGALRM, qrss_dot_pause); set_alarm_timer(opt.ptt_delay); } else { /* in beacon mode */ if (opt.beacon_tx_pause == TRUE) { key_down(); if (opt.sidetone == TRUE) emit_sound(opt.sidetone_freq); } str_index = 0; /* reset pointer to beginning of string */ signal(SIGALRM, send_next_char); /* start transmissions after */ set_alarm_timer(opt.beacon_pause * 1000); /* pause is in seconds */ } } else { /* not in beacon mode */ ptt_off(); /* transmission ends here */ } } static void send_dot(void) { switch (opt.tx_mode) { case QRSS: /* make sure the TX is off */ key_up(); /* stop sidetone */ emit_sound(0); signal(SIGALRM, qrss_dot_pause); set_alarm_timer(opt.dot_time); D(putchar('.'); fflush(stdout)); /* for debug */ if (opt.sidetone == TRUE) emit_sound(opt.sidetone_freq); key_down(); break; case DFCW: key_down(); /* "normal" DFCW has DTR=high for dash */ ptt_on(); if (opt.sidetone == TRUE) emit_sound(opt.dfcw_dot_freq); signal(SIGALRM, dfcw_dot_pause); set_alarm_timer(opt.dot_time - opt.dfcw_gap_time); break; default: break; } } static void send_dash(void) { switch (opt.tx_mode) { case QRSS: /* make sure the TX is off */ key_up(); /* stop sidetone */ emit_sound(0); signal(SIGALRM, qrss_dot_pause); set_alarm_timer(opt.dash_dot_ratio * opt.dot_time); D(putchar('-'); fflush(stdout); ) /* for debug */ if (opt.sidetone == TRUE) emit_sound(opt.sidetone_freq); key_down(); break; case DFCW: key_down(); /* "normal" DFCW has DTR=low for dot */ ptt_off(); if (opt.sidetone == TRUE) emit_sound(opt.dfcw_dash_freq); signal(SIGALRM, dfcw_dot_pause); set_alarm_timer(opt.dot_time); break; default: break; } } static void send_space(void) { switch (opt.tx_mode) { case QRSS: signal(SIGALRM, qrss_dot_pause); set_alarm_timer(5.0 * opt.dot_time); D(putchar(' '); fflush(stdout)); /* for debug */ break; case DFCW: signal(SIGALRM, dfcw_dot_pause); set_alarm_timer(3.0 * opt.dot_time); D(putchar(' '); fflush(stdout)); /* for debug */ break; default: break; } } static void send_next_element(int trig_signal) { /* signal type is ignored, only SIGALRM should trigger this function */ /* send a dot, dash or space */ if (cw_chars[tab_index].cw[cw_char_index] == '-') { send_dash(); } else if (cw_chars[tab_index].cw[cw_char_index] == '.') { send_dot(); } else { /* is space */ send_space(); } //key_down(); } /* * send_char - routine to send a given ASCII character as cw, and echo * to stdout, and optionally wait for the post-character gap */ void send_next_char(int trig_signal) { char c; c = s[str_index]; /* ensure uppercase */ c = toupper(c); /* check table to find character to send */ tab_index = 0; while (cw_chars[tab_index].key != 0) { if (cw_chars[tab_index].key == c) { /* if found, send character */ /* echo the character */ D(putchar(c); putchar(':'); putchar(' '); fflush(stdout)); /* for debug */ /* sound the elements of the cw equivalent */ cw_char_len = strlen(cw_chars[tab_index].cw); cw_char_index = 0; send_next_element(SIGALRM); return; } else { tab_index++; } } /* not found - print an error message */ fprintf(stderr, "send_next_char: char not recognized\n"); } int cw_char_allowed(char c) { /* ensure uppercase */ c = toupper(c); /* scan table to find character */ tab_index = 0; while (cw_chars[tab_index].key != 0) { if (cw_chars[tab_index].key == c) { /* found, character is allowed */ return TRUE; } else { tab_index++; } } /* not found - character is not allowed */ return FALSE; } int get_qrss_char_index(void) { return str_index; } /* * send_string - routine to send a given ASCII string as cw, and echo * to stdout; can also send multi-char items */ void send_string(char *str) { s = str; /* simply send every character in the string */ str_index = 0; str_len = strlen(s); repeat_msg = opt.beacon_mode; switch (opt.tx_mode) { case QRSS: /* close PTT */ ptt_on(); signal(SIGALRM, send_next_char); /* start transmissions after ptt_delay */ set_alarm_timer(opt.ptt_delay); break; case DFCW: /* close KEY */ key_down(); signal(SIGALRM, send_next_char); /* start transmissions after ptt_delay */ set_alarm_timer(opt.ptt_delay); break; default: break; } } void stop_tx(void) { /* avoid restart of message transmission */ repeat_msg = FALSE; /* stop sidetone */ emit_sound(0); /* hack, pretend we are at the end of the string */ cw_char_index = cw_char_len; str_index = str_len - 1; switch (opt.tx_mode) { case QRSS: /* switch off TX */ key_up(); signal(SIGALRM, qrss_dot_pause); break; case DFCW: signal(SIGALRM, dfcw_dot_pause); break; default: break; } /* schedule next event to be (almost) now */ set_alarm_timer(1e-03); } float string_duration(char *str) { int i, j, k; char c; float overall_time = 0.0; /* add the PTT delay at start and end of transmissions */ overall_time += 2.0 * opt.ptt_delay; for (i = 0; i < strlen(str); i++) { /* ensure uppercase */ c = toupper(str[i]); /* scan table to find character */ for (j = 0; cw_chars[j].key != 0; j++) if (cw_chars[j].key == c) { for (k = 0; k < strlen(cw_chars[j].cw); k++) { if (cw_chars[j].cw[k] == '-') { /* dash duration; different between QRSS and DFCW */ switch (opt.tx_mode) { case QRSS: overall_time += opt.dash_dot_ratio * opt.dot_time; break; case DFCW: overall_time += opt.dot_time; break; default: break; } } else if (cw_chars[j].cw[k] == '.') { /* dot duration */ overall_time += opt.dot_time; } else { /* space duration; different between QRSS and DFCW */ switch (opt.tx_mode) { case QRSS: overall_time += 5.0 * opt.dot_time; break; case DFCW: overall_time += 3.0 * opt.dot_time; break; default: break; } } if (k < (strlen(cw_chars[j].cw) - 1)) { /* not at end of char */ /* space between elements */ switch (opt.tx_mode) { case QRSS: overall_time += opt.dot_time; break; case DFCW: /* no space between elements */ break; default: break; } } else if (i < (strlen(str) - 1)) { /* at end of char but not at end of string */ /* space between chars */ switch (opt.tx_mode) { case QRSS: overall_time += 5.0 * opt.dot_time; break; case DFCW: overall_time += 3.0 * opt.dot_time; break; default: break; } } /* else string is finished */ } } } return overall_time; } int open_ksound(void) { /* To be used as the ksound_fd in ioctl(). */ if ((ksound_fd = open("/dev/console", O_NOCTTY)) == -1) { perror("open_ksound: unable to open /dev/console"); return (ksound_opened = FALSE); } else return (ksound_opened = TRUE); } void close_ksound(void) { if (ksound_opened == TRUE) close(ksound_fd); } glfer-0.4.2/fft_radix2.c0000644000175000001440000000742310744705164011743 00000000000000/* fft_radix2.c * Copyright (C) 2001 Claudio Girardi * * This file is derived from the files in the fft directory of gsl-0.9.3, * which are Copyright (C) 1996-2000 Brian Gough * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include static int fft_binary_logn(const size_t n) { size_t ntest; size_t binary_logn = 0; size_t k = 1; while (k < n) { k *= 2; binary_logn++; } ntest = (1 << binary_logn); if (n != ntest) { return -1; /* n is not a power of 2 */ } return binary_logn; } static int fft_real_bitreverse_order(float data[], const size_t n) { /* This is the Gold-Rader bit-reversal algorithm */ size_t i; size_t j = 0; for (i = 0; i < n - 1; i++) { size_t k = n / 2; if (i < j) { const float tmp = data[i]; data[i] = data[j]; data[j] = tmp; } while (k <= j) { j = j - k; k = k / 2; } j += k; } return 0; } int fft_real_radix2_transform(float data[], const size_t n) { int result; size_t p, p_1, q; size_t i; size_t logn = 0; int status; if (n == 1) { /* identity operation */ return 0; } /* make sure that n is a power of 2 */ result = fft_binary_logn(n); if (result == -1) { fprintf(stderr, "n is not a power of 2"); } else { logn = result; } /* bit reverse the ordering of input data for decimation in time algorithm */ status = fft_real_bitreverse_order(data, n); /* apply fft recursion */ p = 1; q = n; for (i = 1; i <= logn; i++) { size_t a, b; p_1 = p; p = 2 * p; q = q / 2; /* a = 0 */ for (b = 0; b < q; b++) { float t0_real = data[b * p] + data[b * p + p_1]; float t1_real = data[b * p] - data[b * p + p_1]; data[b * p] = t0_real; data[b * p + p_1] = t1_real; } /* a = 1 ... p_{i-1}/2 - 1 */ { float w_real = 1.0; float w_imag = 0.0; const double theta = -2.0 * M_PI / p; const float s = sin(theta); const float t = sin(theta / 2.0); const float s2 = 2.0 * t * t; for (a = 1; a < (p_1) / 2; a++) { /* trignometric recurrence for w-> exp(i theta) w */ { const float tmp_real = w_real - s * w_imag - s2 * w_real; const float tmp_imag = w_imag + s * w_real - s2 * w_imag; w_real = tmp_real; w_imag = tmp_imag; } for (b = 0; b < q; b++) { float z0_real = data[b * p + a]; float z0_imag = data[b * p + p_1 - a]; float z1_real = data[b * p + p_1 + a]; float z1_imag = data[b * p + p - a]; /* t0 = z0 + w * z1 */ float t0_real = z0_real + w_real * z1_real - w_imag * z1_imag; float t0_imag = z0_imag + w_real * z1_imag + w_imag * z1_real; /* t1 = z0 - w * z1 */ float t1_real = z0_real - w_real * z1_real + w_imag * z1_imag; float t1_imag = z0_imag - w_real * z1_imag - w_imag * z1_real; data[b * p + a] = t0_real; data[b * p + p - a] = t0_imag; data[b * p + p_1 - a] = t1_real; data[b * p + p_1 + a] = -t1_imag; } } } if (p_1 > 1) { for (b = 0; b < q; b++) { /* a = p_{i-1}/2 */ data[b * p + p - p_1 / 2] *= -1; } } } return 0; } glfer-0.4.2/avg.h0000644000175000001440000000346110744705164010473 00000000000000/* avg.h * * Copyright (C) 2006 Edouard Griffiths (F4EXB) * Copyright (C) 2006-2008 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _AVG_H_ #define _AVG_H_ #ifdef HAVE_CONFIG_H #include #endif typedef struct { int avgwidth; /* spectrum width to average, in pixels */ int avgdepth; /* number of spectra to average */ int effdepth; /* number of spectra effectively averaged sofar */ double *avg; /* current average array */ double *cum; /* current cumulative sum array */ double **avgarray; /* record array */ } avg_data_t; extern void init_avg(avg_data_t *avgdata); extern void alloc_avg(avg_data_t *avgdata, int width, int depth); extern void delete_avg(avg_data_t *avgdata); extern double update_avg_plain(avg_data_t *avgdata, int N, float *psd, int minbin, int maxbin, int *peakbin); extern double update_avg_sumextreme(avg_data_t *avgdata, int N, float *psd, int max0, int minbin, int maxbin, int *peakbin); extern double update_avg_sumavg(avg_data_t *avgdata, int N, float *psd, int max0, int minbin, int maxbin, int *peakbin, double *variance); #endif /* #ifndef _AVG_H_ */ glfer-0.4.2/g_scope.h0000644000175000001440000000216310744705165011334 00000000000000/* g_scope.h * Copyright (C) 2005 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _G_SCOPE_H_ #define _G_SCOPE_H_ #include "fft.h" enum {AUDIO_SOURCE, FFT_SOURCE}; typedef struct _input_source_t input_source_t; struct _input_source_t { char *name; int type; }; void scope_window_init(GtkWidget * widget, gpointer data); void scope_window_draw(fft_params_t params); void scope_window_close(void); #endif /* _G_SCOPE_H_ */ glfer-0.4.2/g_scope.c0000644000175000001440000001627511063251564011332 00000000000000/* g_scope.c * Copyright (C) 2005-2008 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include #include #include "glfer.h" #include "g_scope.h" #include "fft.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif #define SCOPE_DA_WIDTH 1024 extern opt_t opt; extern glfer_t glfer; static GtkWidget *scope_da; static GdkPixmap *scope_pixmap = NULL; static guchar *rgbbuf = NULL; static int window_width, window_height; static int pixmap_width, pixmap_height, pixmap_ofs; static int autoscale = 0; static int scope_source = 0; input_source_t input_sources[] = { {"/Audio", AUDIO_SOURCE}, {"/FFT", FFT_SOURCE} }; /* function prototypes */ static gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) { glfer.scope_window = NULL; return FALSE; } /* copy scope_pixmap content onto scope_da on exposure */ static gboolean scope_da_expose_event(GtkWidget * widget, GdkEventExpose * event, gpointer user_data) { /* copy the relevant portion of the pixmap onto the screen */ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], scope_pixmap, event->area.x, pixmap_ofs + event->area.y, event->area.x, event->area.y, event->area.width, event->area.height); // g_print("expose event! x=%i y=%i w=%i h=%i pixmap_ofs=%i\n", event->area.x, event->area.y, event->area.width, event->area.height, pixmap_ofs); return FALSE; } static int scope_da_configure_event(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data) { if (scope_pixmap) { gdk_drawable_unref(scope_pixmap); } /* create a new pixmap */ scope_pixmap = gdk_pixmap_new(widget->window, SCOPE_DA_WIDTH, pixmap_height, -1); /* clear the new pixmap */ gdk_draw_rectangle(scope_pixmap, widget->style->fg_gc[GTK_WIDGET_STATE(scope_da)], TRUE, 0, 0, SCOPE_DA_WIDTH, pixmap_height); return TRUE; } static void input_source_sel_changed(gpointer dummy, guint callback_action, GtkWidget * widget) { scope_source = callback_action; /* 0 = Audio, 1 = FFT */ } static void autoscale_callback (GtkWidget* widget, gpointer data) { autoscale = TRUE; } void scope_window_init(GtkWidget * widget, gpointer data) { gint i; GtkWidget *vbox; GtkWidget *temp_la, *tmp_hb, *tmp_bu; GtkWidget *window = glfer.scope_window; GtkItemFactory *item_factory = NULL; GtkItemFactoryEntry entry; char *menu_title = ""; GtkWidget *menu = NULL; GtkWidget *option_menu = NULL; if (window == NULL) { pixmap_height = 300; pixmap_width = 300; /* scope window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window_width = 400; window_height = 300; gtk_window_set_default_size(GTK_WINDOW(window), window_width, window_height); gtk_window_set_title(GTK_WINDOW(window), "Oscilloscope"); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); /* Create a vbox */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show(vbox); /* time-domain signal drawing area */ scope_da = gtk_drawing_area_new(); gtk_drawing_area_size(GTK_DRAWING_AREA(scope_da), SCOPE_DA_WIDTH, pixmap_height); g_signal_connect(G_OBJECT(scope_da), "expose_event", G_CALLBACK(scope_da_expose_event), NULL); g_signal_connect(G_OBJECT(scope_da), "configure_event", G_CALLBACK(scope_da_configure_event), NULL); gtk_widget_set_events(scope_da, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); gtk_box_pack_start(GTK_BOX(vbox), scope_da, FALSE, FALSE, 1); gtk_widget_show(scope_da); /* input source selection */ item_factory = gtk_item_factory_new(GTK_TYPE_MENU, menu_title, NULL); for (i = 0; i < 2; i++) { entry.path = input_sources[i].name; entry.accelerator = NULL; entry.callback = input_source_sel_changed; entry.callback_action = input_sources[i].type;; entry.item_type = NULL; gtk_item_factory_create_item(item_factory, &entry, NULL, 1); } menu = gtk_item_factory_get_widget(item_factory, menu_title); /* create the option menu for the input source list */ option_menu = gtk_option_menu_new(); //gtk_tooltips_set_tip(glfer.tt, option_menu, "Input source for oscilloscope", NULL); /* provide the popup menu */ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu); /* add label */ temp_la = gtk_label_new("Input :"); gtk_widget_show(temp_la); tmp_hb = gtk_hbox_new(FALSE, 0); gtk_widget_show(tmp_hb); gtk_box_pack_start(GTK_BOX(vbox), tmp_hb, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(tmp_hb), temp_la, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(tmp_hb), option_menu, FALSE, FALSE, 0); gtk_widget_show(option_menu); tmp_bu = gtk_button_new_with_label("Autoscale"); gtk_box_pack_start(GTK_BOX(tmp_hb), tmp_bu, FALSE, FALSE, 10); g_signal_connect(G_OBJECT(tmp_bu), "clicked", G_CALLBACK(autoscale_callback), NULL); gtk_widget_show(tmp_bu); gtk_widget_show(window); } glfer.scope_window = window; } /* draw the data onto the pixmap */ void scope_window_draw(fft_params_t params) { GdkRectangle update_rect; double *data, datamax, y_gain; int i; int N = params.n; int y1, y2; if (scope_source == 0) data = params.inbuf_audio; else data = params.inbuf_fft; if (autoscale) { /* get maximum data value */ datamax = 0; for (i = 0; i < N; i++) { if (fabs(data[i]) > datamax) datamax = fabs(data[i]); } /* make the waveform fill the pixmap */ if (datamax < 1e-3) datamax = 1e-3; /* avoid division by zero */ y_gain = (pixmap_height / 2) / datamax; } else { /* fixed gain */ y_gain = 20; } /* clear the spectrum amplitude pixmap */ gdk_draw_rectangle(scope_pixmap, scope_da->style->fg_gc[GTK_WIDGET_STATE(scope_da)], TRUE, 0, 0, SCOPE_DA_WIDTH, pixmap_height); /* i is the pixmap y coordinate */ for (i = 0; i < N; i++) { y1 = pixmap_height / 2 + data[i] * y_gain; y2 = pixmap_height / 2 + data[i + 1] * y_gain; /* draw spectrum amplitude pixmap */ //gdk_draw_point(scope_pixmap, scope_da->style->white_gc, i, y); gdk_draw_line(scope_pixmap, scope_da->style->white_gc, i, y1, i + 1, y2); } update_rect.x = 0; update_rect.width = SCOPE_DA_WIDTH; update_rect.y = 0; update_rect.height = pixmap_height; gtk_widget_draw(scope_da, &update_rect); } void scope_window_close() { glfer.scope_window = NULL; } glfer-0.4.2/mkinstalldirs0000755000175000001440000000132210744705163012344 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here glfer-0.4.2/wav_fmt.h0000644000175000001440000000352010744705164011355 00000000000000/* wav_fmt.h * * Copyright (C) 2001 Claudio Girardi * This file is derived from bplay, (C) David Monro 1996 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _WAV_FMT_H_ #define _WAV_FMT_H_ int open_wav_file(char *fname, int n, int *speed); void close_wav_file(void); void wav_read(float **buf_out, int *n_out); /* Definitions for Microsoft WAVE format */ /* it's in chunks like .voc and AMIGA iff, but my source say there are in only in this combination, so I combined them in one header; it works on all WAVE-file I have */ typedef struct wavhead { u_long main_chunk; /* 'RIFF' */ u_long length; /* Length of rest of file */ u_long chunk_type; /* 'WAVE' */ u_long sub_chunk; /* 'fmt ' */ u_long sc_len; /* length of sub_chunk, =16 (rest of chunk) */ u_short format; /* should be 1 for PCM-code */ u_short modus; /* 1 Mono, 2 Stereo */ u_long sample_fq; /* frequence of sample */ u_long byte_p_sec; u_short byte_p_spl; /* samplesize; 1 or 2 bytes */ u_short bit_p_spl; /* 8, 12 or 16 bit */ u_long data_chunk; /* 'data' */ u_long data_length; /* samplecount (lenth of rest of block?) */ } wavhead; #endif /* #ifndef _WAV_FMT_H_ */ glfer-0.4.2/g-l_dpss.h0000644000175000001440000000165310744705164011427 00000000000000/* g-l_dpss.h * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _G_L_DPSS_ #define _G_L_DPSS_ int gl_dpss(int nmax, int kmax, int n, double w, double **v, double *sig, int *totit); #endif /* not _G_L_DPSS_ */ glfer-0.4.2/lmp.h0000644000175000001440000000242010744705165010501 00000000000000/* lmp.h * * Copyright (C) 2004 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _LMP_H_ #define _LMP_H_ #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_LIBRFFTW #include #else #include "fft_radix2.h" #endif /* HAVE_LIBRFFTW */ #include "fft.h" typedef struct { fft_params_t fft; int avg; double **window; double *sig; float w; int kmax; } lmp_params_t; void lmp_init(lmp_params_t * params); void lmp_do(float *audio_buf, float *psd_buf, float *phase_buf, lmp_params_t * params); void lmp_close(lmp_params_t * params); #endif /* #ifndef _LMP_H_ */ glfer-0.4.2/g_options.h0000644000175000001440000000222410744705163011712 00000000000000/* g_options.h * * Copyright (C) 2001-2007 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _G_OPTIONS_H_ #define _G_OPTIONS_H_ void tx_test_dialog(GtkWidget * widget, gpointer data); void spec_settings_dialog(GtkWidget * widget, gpointer data); void qrss_settings_dialog(GtkWidget * widget, gpointer data); void port_settings_dialog(GtkWidget * widget, gpointer data); void audio_settings_dialog(GtkWidget * widget, gpointer data); #endif /* _G_OPTIONS_H_ */ glfer-0.4.2/g_file_dialogs.h0000644000175000001440000000211611146352515012634 00000000000000/* g_file_dialogs.h * Copyright (C) 2009 Claudio Girardi * * This file is derived from xspectrum, Copyright (C) 2000 Vincent Arkesteijn * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _G_FILE_DIALOGS_H_ #define _G_FILE_DIALOGS_H_ #include void open_file_dialog(GtkWidget * widget, gpointer data); void save_spect_dialog(GtkWidget * widget, gpointer data); #endif /* #ifndef _G_FILE_DIALOGS_H_ */ glfer-0.4.2/lmp.c0000644000175000001440000001131610744705163010476 00000000000000/* lmp.c * Copyright (C) 2004 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_LIBRFFTW #include #else #include "fft_radix2.h" #endif /* HAVE_LIBRFFTW */ #include "glfer.h" #include "util.h" #include "lmp.h" #include "fft.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif extern opt_t opt; static float **psdbufl = NULL; static double *my = NULL; static double *sy = NULL; #ifdef HAVE_LIBRFFTW static fftw_real *mu = NULL; #else static float *mu = NULL; #endif /* HAVE_LIBRFFTW */ int nl; void lmp_init(lmp_params_t * params) { int i, j; int n = params->fft.n; int kmax = params->kmax; double **v = params->window; #ifdef HAVE_LIBRFFTW params->fft.plan = rfftw_create_plan(n, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE); params->fft.inbuf_audio = calloc(n, sizeof(fftw_real)); params->fft.inbuf_fft = calloc(n, sizeof(fftw_real)); params->fft.outbuf = calloc(n, sizeof(fftw_real)); mu = calloc(n, sizeof(fftw_real)); #else params->fft.inbuf_audio = calloc(n, sizeof(float)); params->fft.inbuf_fft = calloc(n, sizeof(float)); params->fft.outbuf = params->fft.inbuf_fft; mu = calloc(n, sizeof(float)); #endif /* HAVE_LIBRFFTW */ params->fft.sub_mean = opt.autoscale; // sub_mean only if autoscale (?) nl = params->avg; /* spectra of the subsequences */ psdbufl = matrix(0, nl - 1, 0, n - 1); /* clear psdbufl */ for (j = 0; j < nl; j++) { for (i = 0; i < n / 2 + 1; i++) { psdbufl[j][i] = 0.0; } } /* mean */ my = calloc(n, sizeof(double)); /* variance */ sy = calloc(n, sizeof(double)); } void lmp_do(float *audio_buf, float *psd_buf, float *phase_buf, lmp_params_t * params) { int i, j; static int j_l = 0; int n_fft = params->fft.n; double v_hat; /* apply overlap, limting, windowing, etc. according to active options */ prepare_audio(audio_buf, ¶ms->fft); /* compute the FFT for the subsequences */ // for (j = 0; j < nll; j++) { for (i = 0; i < n_fft; i++) { params->fft.inbuf_fft[i] = params->fft.inbuf_audio[i]; } /* compute the fft */ #ifdef HAVE_LIBRFFTW rfftw_one(params->fft.plan, params->fft.inbuf_fft, params->fft.outbuf); #else fft_real_radix2_transform(params->fft.inbuf_fft, n_fft); #endif /* HAVE_LIBRFFTW */ /* compute the power spectrum of the subsequence */ fft_psd(psdbufl[j_l], NULL, ¶ms->fft); // } /* for (i = 0; i < n_fft / 2 + 1; i++) { psdbufl[j_l][i] = rand() / (RAND_MAX + 1.0); if (i == 100) psdbufl[j_l][i] += 0.5; } */ /* compute my */ for (i = 0; i < n_fft / 2 + 1; i++) { my[i] = 0.0; for (j = 0; j < nl; j++) { my[i] += psdbufl[j][i]; } my[i] /= nl; } /* compute sy */ for (i = 0; i < n_fft / 2 + 1; i++) { sy[i] = 0.0; for (j = 0; j < nl; j++) { sy[i] += (psdbufl[j][i] - my[i]) * (psdbufl[j][i] - my[i]); } sy[i] /= (nl - 1); } for (i = 0; i < n_fft / 2 + 1; i++) { //v_hat = 0.5 * (my[i] - sqrt(fabs(my[i] * my[i] - sy[i]))); v_hat = my[i] * my[i] - sy[i]; if (v_hat < 0.0) v_hat = 0.0; v_hat = 0.5 * (my[i] - sqrt(v_hat)); psd_buf[i] = -sqrt(nl / 2.0) + (nl * my[i]) / (2.0 * sqrt(2.0 * nl) * v_hat); if (psd_buf[i] <= 1.0e-3 ) psd_buf[i] = 1e-3; } psd_buf[0] = 1e-3; for (i = 0; i < n_fft / 2 + 1; i++) { //fprintf(stderr, "%i %e\t", i, psd_buf[i]); } /* for (i = 0; i < n_fft / 2 + 1; i++) { psd_buf[i] = 0.0; for (j = 0; j < nl; j++) { if (psdbufl[j][i] < 1e-13)psdbufl[j][i] = 1e-13; psd_buf[i] += 1.0 / psdbufl[j][i]; } psd_buf[i] /= nl; psd_buf[i] = 1.0 / psd_buf[i]; } */ j_l++; if (j_l == nl) j_l = 0; } void lmp_close(lmp_params_t * params) { int n = params->fft.n; FREE_MAYBE(params->fft.inbuf_audio); FREE_MAYBE(params->fft.inbuf_fft); #ifdef HAVE_LIBRFFTW rfftw_destroy_plan(params->fft.plan); FREE_MAYBE(params->fft.outbuf); #endif /* HAVE_LIBRFFTW */ } glfer-0.4.2/mixer.c0000644000175000001440000000712510744705164011036 00000000000000/* * This is an example of a mixer program for Linux * * updated 1/1/93 to add stereo, level query, broken * devmask kludge - cmetz@thor.tjhsst.edu * * slightly modified by in3otd@qsl.net * * (C) Craig Metz and Hannu Savolainen 1993. * * You may do anything you wish with this program. */ #include #include #include #include #include #include #include void usage(void); void print_recsrc(void); char *names[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; int devmask = 0, recmask = 0, recsrc = 0; void usage(void) { int i, n = 0; printf("Usage: mixer { "); for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) if ((1 << i) & devmask) { if (n) putchar('|'); printf(names[i]); n = 1; } printf(" } \n or mixer { +rec|-rec } \n"); exit(1); } void print_recsrc(void) { int i, n = 0; fprintf(stderr, "Recording source: "); for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) if ((1 << i) & recsrc) { if (n) fprintf(stderr, ", "); fprintf(stderr, names[i]); n = 1; } fprintf(stderr, "\n"); } int main(int argc, char *argv[]) { int foo, bar, baz, dev; char name[30] = "/dev/mixer"; if (!strcmp(argv[0], "mixer0")) strcpy(name, "/dev/mixer"); else if (!strcmp(argv[0], "mixer1")) strcpy(name, "/dev/mixer1"); else if (!strcmp(argv[0], "mixer2")) strcpy(name, "/dev/mixer2"); else if (!strcmp(argv[0], "mixer3")) strcpy(name, "/dev/mixer3"); else if (!strcmp(argv[0], "mixer4")) strcpy(name, "/dev/mixer4"); else if (!strcmp(argv[0], "mixer5")) strcpy(name, "/dev/mixer5"); if ((baz = open(name, O_RDWR)) < 0) { perror(name); exit(1); } if (ioctl(baz, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) { perror("SOUND_MIXER_READ_DEVMASK"); exit(-1); } if (ioctl(baz, SOUND_MIXER_READ_RECMASK, &recmask) == -1) { perror("SOUND_MIXER_READ_RECMASK"); exit(-1); } if (ioctl(baz, SOUND_MIXER_READ_RECSRC, &recsrc) == -1) { perror("SOUND_MIXER_READ_RECSRC"); exit(-1); } switch (argc) { case 3: bar = 1; break; case 2: bar = 0; break; default: usage(); } for (foo = 0; foo < SOUND_MIXER_NRDEVICES && strcmp(names[foo], argv[1]); foo++); if (foo >= SOUND_MIXER_NRDEVICES) { if (!strcmp("+rec", argv[1]) || !strcmp("-rec", argv[1])) { for (dev = 0; dev < SOUND_MIXER_NRDEVICES && strcmp(names[dev], argv[2]); dev++); if (dev >= SOUND_MIXER_NRDEVICES) usage(); if (!((1 << dev) & recmask)) { fprintf(stderr, "Invalid recording source %s\n", argv[2]); exit(-1); } if (argv[1][0] == '+') recsrc |= (1 << dev); else recsrc &= ~(1 << dev); if (ioctl(baz, SOUND_MIXER_WRITE_RECSRC, &recsrc) == -1) { perror("SOUND_MIXER_WRITE_RECSRC"); exit(-1); } print_recsrc(); } else usage(); } else { if (bar) { if (strchr(argv[2], ':') == NULL) { sscanf(argv[2], "%d", &bar); dev = bar; } else sscanf(argv[2], "%d:%d", &bar, &dev); if (bar < 0) bar = 0; if (dev < 0) dev = 0; if (bar > 100) bar = 100; if (dev > 100) dev = 100; printf("Setting the mixer %s to %d:%d.\n", names[foo], bar, dev); bar |= dev << 8; if (ioctl(baz, MIXER_WRITE(foo), &bar) == -1) perror("WRITE_MIXER"); return (0); } else { if (ioctl(baz, MIXER_READ(foo), &bar) == -1) perror("MIXER_READ"); printf("The mixer %s is currently set to %d:%d.\n", names[foo], bar & 0x7f, (bar >> 8) & 0x7f); } } close(baz); return (0); } glfer-0.4.2/g_txmsg.h0000644000175000001440000000161610744705162011364 00000000000000/* g_txmsg.h * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _TXMSG_H_ #define _TXMSG_H_ void create_txmsg_window(void); void update_time_indications(void); #endif /* _TXMSG_H_ */ glfer-0.4.2/hparma.c0000644000175000001440000001063410744705164011161 00000000000000/* hparma.c * Copyright (C) 2002 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_LIBRFFTW #include #else #include "fft_radix2.h" #endif /* HAVE_LIBRFFTW */ #include "glfer.h" #include "util.h" #include "hparma.h" extern opt_t opt; static float *a = NULL, *s = NULL, **v = NULL; static float **r_xx = NULL; void hparma_init(hparma_params_t * params) { int n = params->fft.n; int t = params->t; int p_e = params->p_e; #ifdef HAVE_LIBRFFTW params->fft.plan = rfftw_create_plan(n, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE); params->fft.inbuf_audio = calloc(n, sizeof(fftw_real)); params->fft.inbuf_fft = calloc(n, sizeof(fftw_real)); params->fft.outbuf = calloc(n, sizeof(fftw_real)); #else params->fft.inbuf_audio = calloc(n, sizeof(float)); params->fft.inbuf_fft = calloc(n, sizeof(float)); params->fft.outbuf = params->fft.inbuf_fft; #endif /* HAVE_LIBRFFTW */ params->fft.sub_mean = opt.autoscale; // sub_mean only if autoscale (?) r_xx = matrix(0, t, 0, p_e); s = vector(0, t); v = matrix(0, p_e, 0, p_e); a = vector(0, p_e); } void hparma_do(float *audio_buf, float *psd_buf, float *phase_buf, hparma_params_t * params) { int i, j, k; int n_fft = params->fft.n; double ftmp, numtmp, dentmp, nu, sum_sigma2; int t = params->t; int p_e = params->p_e; int q_e = params->q_e; int p = 4; /* apply overlap, limting, windowing, etc. according to active options */ prepare_audio(audio_buf, ¶ms->fft); /* compute autocorrelation vector */ for (i = 0; i <= q_e + t; i++) { ftmp = 0.0; for (k = 0; k < n_fft - i; k++) { ftmp += params->fft.inbuf_audio[k + i] * params->fft.inbuf_audio[k]; } r_xx[0][i] = ftmp / (n_fft - i); } /* fill the symmetric Toeplitz autocorrelation matrix */ for (i = 1; i < t; i++) { for (j = 0; j <= p_e; j++) { r_xx[i][j] = r_xx[0][abs(j - i)]; } } compute_svd(r_xx, t, p_e + 1, s, v); /* compute the sum of eigenvalues squared */ /* note that p_e + 1 <= t, so there are at most p_e + 1 nozero eigenvalues */ sum_sigma2 = 0.0; for (i = 0; i < p_e + 1; i++) { sum_sigma2 += s[i] * s[i]; } ftmp = 0.0; for (i = 0; i < p_e + 1; i++) { ftmp += s[i] * s[i]; nu = sqrt(ftmp / sum_sigma2); // printf("s[%i] = %e\tnu[%i] = %f\tsumsigma2 = %e \n", i, s[i], i, nu, sum_sigma2); if (nu > 0.995) { p = i; break; } } /* p=3; */ for (i = 0; i <= p_e; i++) { numtmp = dentmp = 0.0; for (k = p + 1; k <= p_e; k++) { numtmp += v[0][k] * v[i][k]; dentmp += v[0][k] * v[0][k]; } if (p < p_e) { a[i] = numtmp / dentmp; } else { a[i] = (i == 0 ? 1.0 : 0.0); } // printf("a[%i] = %e = %e/%e\n", i, a[i], numtmp, dentmp); } for (i = 0; i <= p_e; i++) { params->fft.inbuf_fft[i] = a[i]; } for (i = p_e + 1; i < n_fft; i++) { params->fft.inbuf_fft[i] = 0.0; } /* compute the fft */ #ifdef HAVE_LIBRFFTW rfftw_one(params->fft.plan, params->fft.inbuf_fft, params->fft.outbuf); #else fft_real_radix2_transform(params->fft.inbuf_fft, n_fft); #endif /* HAVE_LIBRFFTW */ fft_psd(psd_buf, NULL, ¶ms->fft); for (i = 0; i < n_fft / 2; i++) { psd_buf[i] = 1.0 / psd_buf[i]; } } void hparma_close(hparma_params_t * params) { int t = params->t; int p_e = params->p_e; FREE_MAYBE(params->fft.inbuf_audio); FREE_MAYBE(params->fft.inbuf_fft); #ifdef HAVE_LIBRFFTW rfftw_destroy_plan(params->fft.plan); FREE_MAYBE(params->fft.outbuf); #endif /* HAVE_LIBRFFTW */ FREE_MAYBE(params->fft.window); free_matrix(r_xx, 0, t, 0, p_e); free_vector(s, 0, t); free_matrix(v, 0, p_e, 0, p_e); free_vector(a, 0, p_e); } glfer-0.4.2/TODO0000644000175000001440000000156511330644326010232 00000000000000Please tell me if you feel like volunteering for any of these ideas. Features or problems that need some work: ---------------------------------------- handle MP3 format record input to a file There was some report of problems in the audio acquisition routine, it seems that some audio card/driver don't work well with select; this need further investigation Spectrogram "normal" scrolling (all the picture, right to left) Jason decoder (in progress) JPEG quality should be selectable before saving Palette editor and loader XPM icon for glfer ...many other things... Code cleanups and optimizations: ------------------------------- Check DFCW code File not beginning with "g_" should not need to include gtk/gtk.h Pay attention to WMCLASS (gtk_window_set_wmclass) (important ?) Local Variables: mode:indented-text mode:auto-fill End: glfer-0.4.2/HACKING0000644000175000001440000000361511051330001010505 00000000000000These are some brief notes for the brave people attempting to understand and (hopefully) improve the sources; as you will have already noticed, I am not a professional programmer, only a ham who likes writing C code in his spare time, trying to solve some practical problem (and often ending creating new ones). I began to write glfer to have a versatile spectrogram software to use with Linux and also to learn how to use the Gtk+ library; I don't know if I really succeeded in one of these goals 8-) Anyway, here is some info about the code (dis)organization: * files containing code for the user interface, thus needing Gtk+, have names beginning with "g_" * files containing "low-level" functions (i.e. fft, audio, writing/reading files, etc) do not have such "g_" prefix. * exception to the above rules (what will be a rule without an exception ? 8-) ) is the main file glfer.c To compile glfer you should need a Unix system with an ANSI C compiler and the Gtk+ library. The fftw library will be used for the FFT calculations, if available, otherwise glfer will use its own fft routine. On the other hand if you want to make changes to the code (please contribute with your ideas !) you will need the following tools to generate the Makefile and the configuration scripts: Autoconf - available at "ftp://ftp.gnu.org/pub/gnu/autoconf" Automake - available at "ftp://ftp.gnu.org/pub/gnu/automake" You can define the DEBUG flag (and obtain a lot of debug messages at runtime) by passing --enable-debug to the configure script. If you have the dmalloc debugging library installed you can enable it passing --enable-dmalloc to the configure script. The Debug Malloc Library, by Gray Watson, is available at http://dmalloc.com/ ; I used Version 4.8.2 (February 2001) 73 de Claudio, IN3OTD Local Variables: mode:indented-text mode:auto-fill End: glfer-0.4.2/util.h0000644000175000001440000000355011063270470010662 00000000000000/* util.h * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _UTIL_H_ #define _UTIL_H_ #ifdef HAVE_CONFIG_H #include #endif int _do_nothing(const char *format, ...); #ifdef DEBUG #define D(x) x #else #define D(x) #endif #ifndef HAVE_STRDUP char *strdup(const char *s); #endif /* HAVE_STRDUP */ /* Free FOO if it is non-NULL. */ #define FREE_MAYBE(foo) do { \ if (foo) {\ free (foo); foo = NULL;\ } else \ D(printf("Attempt to free a NULL pointer in %s()\n", __FUNCTION__)); \ } while (0) int tc_zero(void); double tc_time(void); float *vector(long nl, long nh); double *dvector(long nl, long nh); float **matrix(long nrl, long nrh, long ncl, long nch); double **dmatrix(long nrl, long nrh, long ncl, long nch); void free_vector(float *v, long nl, long nh); void free_dvector(double *v, long nl, long nh); void free_matrix(float **m, long nrl, long nrh, long ncl, long nch); void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch); double bessel_I0(double x); int compute_svd(float **A, int nrow, int ncol, float S[], float **Q); void dump_octave_file(char *name, float *a, int nrows, int ncols); #endif /* _UTIL_H_ */ glfer-0.4.2/audio.h0000644000175000001440000000166010744705161011013 00000000000000/* audio.h * * Copyright (C) 2006 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _AUDIO_H_ #define _AUDIO_H_ int audio_init(char *, int *, int); void audio_read(float **, int *); void audio_close(void); #endif /* #ifndef _AUDIO_H_ */ glfer-0.4.2/fft_radix2.h0000644000175000001440000000166110744705164011746 00000000000000/* fft_radix2.h * * Copyright (C) 2001 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _FFT_RADIX2_H_ #define _FFT_RADIX2_H_ #include int fft_real_radix2_transform(float data[], const size_t n); #endif /* _FFT_RADIX2_H_ */ glfer-0.4.2/fft.c0000644000175000001440000003062611072743655010475 00000000000000/* fft.c * Copyright (C) 2001-2005 Claudio Girardi * * This file is derived from xspectrum, Copyright (C) 2000 Vincent Arkesteijn * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_LIBRFFTW #include #else #include "fft_radix2.h" #endif /* HAVE_LIBRFFTW */ #include "glfer.h" #include "fft.h" #include "util.h" #ifdef HAVE_DMALLOC_H #include /* dmalloc.h should be included last */ #endif extern opt_t opt; extern glfer_t glfer; fft_window_t fft_windows[] = { {"/Hanning", HANNING_WINDOW}, {"/Blackman", BLACKMAN_WINDOW}, {"/Gaussian", GAUSSIAN_WINDOW}, {"/Welch", WELCH_WINDOW}, {"/Bartlett", BARTLETT_WINDOW}, {"/Rectangular", RECTANGULAR_WINDOW}, {"/Hamming", HAMMING_WINDOW}, {"/Kaiser", KAISER_WINDOW} }; int num_fft_windows = sizeof(fft_windows) / sizeof(fft_windows[0]); void compute_window(fft_params_t *params); void prepare_audio(float *audio_buf, fft_params_t *params) { int i; int N = params->n; int n_eff = N * (1.0 - params->overlap); int n_overlap = N - n_eff; float sig_mean; float inp_val; float ftmp; int submean = params->sub_mean; #if 0 /* test signal */ for (i = 0; i < N; i++) { /* sine wave */ audio_buf[i] = sin(2 * M_PI * i / 9 ); } #endif /* subtract mean value */ if (submean) // EG made conditional to "autoscale" mode compatible with versions <0.3.5. CG ?? { sig_mean = 0.0; for (i = 0; i < n_eff; i++) { sig_mean += audio_buf[i]; } sig_mean /= n_eff; for (i = 0; i < n_eff; i++) { audio_buf[i] -= sig_mean; } } /* copy old samples into FFT buffer */ if (glfer.first_buffer == FALSE) { for (i = 0; i < n_overlap; i++) { params->inbuf_audio[i] = params->inbuf_audio[N - n_overlap + i]; } } else { /* delete old data from buffer */ for (i = 0; i < n_overlap; i++) { params->inbuf_audio[i] = 0.0; } } /* acquire new samples */ for (i = 0; i < n_eff; i++) { params->inbuf_audio[i + n_overlap] = audio_buf[i]; } /* experiment: signal envelope sig_mean = 0.0; for (i = 0; i < N; i++) { params->inbuf_audio[i] = fabs(params->inbuf_audio[i]); sig_mean += params->inbuf_audio[i]; } sig_mean /= N; for (i = 0; i < N; i++) { params->inbuf_audio[i] -= sig_mean; } */ if (params->a > 0.0) { /* apply non-linear processing to the input signal */ for (i = 0; i < N; i++) { inp_val = params->inbuf_audio[i]; params->inbuf_fft[i] = inp_val / (params->a + inp_val * inp_val); if (params->window_type != RECTANGULAR_WINDOW) { /* window the entire buffer */ params->inbuf_fft[i] *= params->window[i]; } } } else { /* conventional processing */ if (params->window_type != RECTANGULAR_WINDOW) { /* window the entire buffer */ for (i = 0; i < N; i++) { //printf("%f\n", audio_buf[i]); params->inbuf_fft[i] = params->window[i] * params->inbuf_audio[i]; //params->inbuf_fft[i] = 5 * sin(2 * M_PI * i * 576.0 / 8000.0); } } else for (i = 0; i < N; i++) params->inbuf_fft[i] = params->inbuf_audio[i]; } if (params->limiter == 1) { for (i = 0; i < N; i++) { ftmp = log(fabs(params->inbuf_fft[i])); params->inbuf_fft[i] = (params->inbuf_fft[i] > 0 ? exp(ftmp * 0.1) : -exp(ftmp * 0.1)); } } #if 0 /* test signal */ for (i = 0; i < N; i++) { /* sine wave at 1/8 of the sampling rate, will have no leakage */ params->inbuf_audio[i] = sin(2 * M_PI * i / 8 ); } #endif } void fft_init(fft_params_t * params) { #ifdef HAVE_LIBRFFTW params->plan = rfftw_create_plan(params->n, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE); params->inbuf_audio = calloc(params->n, sizeof(fftw_real)); params->inbuf_fft = calloc(params->n, sizeof(fftw_real)); params->outbuf = calloc(params->n, sizeof(fftw_real)); D(fprintf(stderr, "fft_init (FFTW): n = %i\n", params->n)); #else params->inbuf_audio = calloc(params->n, sizeof(float)); params->inbuf_fft = calloc(params->n, sizeof(float)); params->outbuf = params->inbuf_fft; D(fprintf(stderr, "fft_init (NO FFTW): n = %i\n", params->n)); #endif /* HAVE_LIBRFFTW */ D(fprintf(stderr, "overlap = %f\n", params->overlap)); params->window = malloc(params->n * sizeof(float)); compute_window(params); params->sub_mean = opt.autoscale; // sub_mean only if autoscale (?) } void fft_do(float *audio_buf, fft_params_t * params) { /* apply overlap, limting, windowing, etc. according to active options */ prepare_audio(audio_buf, params); #ifdef HAVE_LIBRFFTW rfftw_one(params->plan, params->inbuf_fft, params->outbuf); #else fft_real_radix2_transform(params->inbuf_fft, params->n); #endif /* HAVE_LIBRFFTW */ } void fft_psd(float *psd_buf, float *phase_buf, fft_params_t * params) { int i; int N = params->n; if (psd_buf) { /* compute the power spectrum */ /* almost verbatim from the fftw tutorial: */ /* division by N is for normalizing the fft */ psd_buf[0] = params->outbuf[0] * params->outbuf[0] / N; /* DC component */ for (i = 1; i < (N + 1) / 2; i++) /* i < N/2 rounded up */ psd_buf[i] = (params->outbuf[i] * params->outbuf[i] + params->outbuf[N - i] * params->outbuf[N - i]) / N; if (N % 2 == 0) /* N is even */ psd_buf[N / 2] = params->outbuf[N / 2] * params->outbuf[N / 2] / N; /* Nyquist freq */ } if (phase_buf) { /* compute the phase spectrum */ phase_buf[0] = 0; for (i = 1; i < (N + 1) / 2; i++) phase_buf[i] = atan2(params->outbuf[i], params->outbuf[N - i]); if (N % 2 == 0) phase_buf[N / 2] = 0; } } static int cmp_float(const void *num1_p, const void *num2_p) { float *num1, *num2; num1 = (float *) num1_p; num2 = (float *) num2_p; return (*num1 < *num2); } void compute_floor(float *psd_buf, int n, float *sig_pwr_p, float *floor_pwr_p , float *peak_pwr_p, unsigned int *peak_bin_p) { int i; //int N2 = (n + 1) / 2; /* N/2 rounded up */ int N2 = n; float *tmp_buf = NULL; float sig_pwr = 0.0, floor_pwr = 0.0; tmp_buf = malloc(N2 * sizeof(float)); if (tmp_buf == NULL) { fprintf(stderr, "compute_floor: error allocating tmp_buf, size %i\n", N2); exit(-1); } /* copy psd_buf to working area */ memcpy(tmp_buf, psd_buf, N2 * sizeof(float)); /* compute total power */ for (i = 0; i < N2; i++) sig_pwr += tmp_buf[i]; //fprintf(stderr, "sig_pwr : %e\n", sig_pwr); /* total mean power in one bin, i.e. mean spectral density */ sig_pwr /= N2; /* sort the power estimates in each bin in descending order */ qsort(tmp_buf, N2, sizeof(float), cmp_float); //for (i = 0; i < N2; i++) fprintf(stderr, "%i %e\t", i, tmp_buf[i]); //fprintf(stderr, "psdbuf MAX : %e\n", tmp_buf[0]); /* compute noise floor power from the last 5% */ for (i = N2 * 0.95; i < N2; i++) floor_pwr += tmp_buf[i]; /* total noise power, using estimate from the last 5% */ floor_pwr /= 0.05; /* noise mean power in one bin, i.e. spectral density */ floor_pwr /= N2; // *sig_pwr_p = sig_pwr; *sig_pwr_p = tmp_buf[0]; *floor_pwr_p = floor_pwr; /* FIXME: can be done in a lighter way... */ /* compute peak data */ *peak_pwr_p = 0.0; *peak_bin_p = 0; for (i = 0; i < N2; i++) { if (psd_buf[i] > *peak_pwr_p) { *peak_pwr_p = psd_buf[i]; *peak_bin_p = i; } } free(tmp_buf); } void fft_close(fft_params_t * params) { FREE_MAYBE(params->inbuf_audio); FREE_MAYBE(params->inbuf_fft); #ifdef HAVE_LIBRFFTW rfftw_destroy_plan(params->plan); FREE_MAYBE(params->outbuf); #endif /* HAVE_LIBRFFTW */ FREE_MAYBE(params->window); } void compute_window(fft_params_t * params) { int i; float t; float alpha = 1.0; float w_pwr; int N = params->n; int window_type = params->window_type; /* Calculate FFT Windowing function */ for (i = 0; i < N; i++) { switch (window_type) { case HANNING_WINDOW: /* Hanning */ params->window[i] = 0.5 - 0.5 * cos(2.0 * M_PI * i / (N - 1.0)); break; case BLACKMAN_WINDOW: /* Blackman */ params->window[i] = 0.42 - 0.5 * cos(2.0 * M_PI * i / (N - 1.0)) + 0.08 * cos(4.0 * M_PI * i / (N - 1.0)); break; case GAUSSIAN_WINDOW: /* Gaussian */ alpha = 1.0; params->window[i] = exp(-alpha * (2.0 * i - N + 1.0) * (2.0 * i - N + 1.0) / ((N - 1.0) * (N - 1.0))); break; case WELCH_WINDOW: /* Welch */ params->window[i] = 1.0 - ((2.0 * i - N + 1.0) / (N - 1.0)) * ((2.0 * i - N + 1.0) / (N - 1.0)); break; case BARTLETT_WINDOW: /* Parzen or Bartlett (?) */ params->window[i] = 1.0 - fabs((2.0 * i - N + 1.0) / (N - 1.0)); break; case RECTANGULAR_WINDOW: /* Rectangular */ params->window[i] = 1.0; break; case HAMMING_WINDOW: /* Hamming */ params->window[i] = 0.54 - 0.46 * cos(2.0 * M_PI * i / (N - 1.0)); break; case KAISER_WINDOW: /* Kaiser */ t = (N - 1.0) / 2.0; alpha = 6.0 / t; /* from 4.0 / t to 9.0 / t */ params->window[i] = bessel_I0(alpha * sqrt(t * t - (i - t) * (i - t))) / bessel_I0(alpha * t); break; default: params->window[i] = 1.0; } } /* normalize window to preserve power */ w_pwr = 0.0; for (i = 0; i < N; i++) { w_pwr += params->window[i] * params->window[i]; } for (i = 0; i < N; i++) { params->window[i] /= sqrt(w_pwr); } } void test_wind(void) { /* save the window function. (for the curious) */ int i, j; FILE *fp; fft_params_t par; if ((fp = fopen("windfile", "w")) == NULL) { printf("Error opening window output file\n"); puts("Press to continue..."); getchar(); } else { for (i = 0; i < par.n; i++) { for (j = 1; j <= 8; j++) { par.window_type = j; compute_window(&par); fprintf(fp, "%f ", par.window[i]); } fprintf(fp, "\n"); } fclose(fp); } } void goertzel(float *audio_buf, float *psd_buf, float *phase_buf, fft_params_t * params) { int i, r; double yt1, yt2, yt3; float jason_f_low = 800; float jason_f_high = 812; float sample_rate = 8000; double cos_fac; int N = params->n; int i_low = N * jason_f_low / sample_rate; int i_high = N * jason_f_high / sample_rate; for (i = 0; i < N; i++) params->inbuf_audio[i] = params->window[i] * audio_buf[i]; //params->inbuf[i] = (i == 0 ? 1.0 : 0.0); for (i = i_low; i < i_high; i++) { yt1 = yt2 = yt3 = 0.0; cos_fac = 2.0 * cos(2.0 * M_PI * i / N); for (r = 0; r < N; r++) { yt3 = yt2; yt2 = yt1; yt1 = params->inbuf_audio[r] + yt2 * cos_fac - yt3; } params->outbuf[i] = yt1 - yt2 * cos(2.0 * M_PI * i / N); /* real part */ params->outbuf[N - i] = -yt2 * sin(2.0 * M_PI * i / N); /* imag. part */ /* sign of imag. part is wrong ? */ } /* for (i = i_low; i < i_high; i++) { printf("G %i %f %f\n", i, params->outbuf[i], params->outbuf[N - i]); } printf("\n"); rfftw_one(params->plan, params->inbuf, params->outbuf); for (i = i_low; i < i_high; i++) { printf("F %i %f %f\n", i, params->outbuf[i], params->outbuf[N - i]); } */ if (psd_buf) { /* compute the power spectrum */ /* almost verbatim from the fftw tutorial: */ /* division by N^2 is for normalizing the fft */ psd_buf[0] = params->outbuf[0] * params->outbuf[0] / (N * N); /* DC component */ for (i = 1; i < (N + 1) / 2; i++) /* (k < N/2 rounded up) */ psd_buf[i] = (params->outbuf[i] * params->outbuf[i] + params->outbuf[N - i] * params->outbuf[N - i]) / (N * N); if (N % 2 == 0) /* N is even */ psd_buf[N / 2] = params->outbuf[N / 2] * params->outbuf[N / 2] / (N * N); /* Nyquist freq-> */ } if (phase_buf) { /* compute the phase spectrum */ phase_buf[0] = 0; for (i = 1; i < (N + 1) / 2; i++) phase_buf[i] = atan2(params->outbuf[i], params->outbuf[N - i]); if (N % 2 == 0) phase_buf[N / 2] = 0; } } glfer-0.4.2/hparma.h0000644000175000001440000000216510744705164011166 00000000000000/* hparma.h * * Copyright (C) 2002 Claudio Girardi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _HPARMA_H_ #define _HPARMA_H_ #include typedef struct { fft_params_t fft; int t; int p_e; int q_e; } hparma_params_t; void hparma_init(hparma_params_t * params); void hparma_do(float *audio_buf, float *psd_buf, float *phase_buf, hparma_params_t * params); void hparma_close(hparma_params_t * params); #endif /* not _HPARMA_H_ */