mozplugger-1.14.5/0000755000175000001440000000000011722504427013037 5ustar peterusersmozplugger-1.14.5/mozplugger-helper.c0000600000175000001440000015607211722504427016656 0ustar peterusers/***************************************************************************** * * Original Author: Fredrik Hübinette * * Current Authors: Louis Bavoil * Peter Leese * * This code is based on and is a branch of plugger written * by Fredrik Hübinette * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * *****************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #define _GNU_SOURCE /* for getsid() */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "mozplugger.h" #include "child.h" #include "debug.h" /***************************************************************************** * Type declarations *****************************************************************************/ static struct { int noWmRunning; int mapped; int reparented; int reparentedAttemptCount; Window window; int borderWidth; int x; int y; int width; int height; pid_t pid; } victimDetails; static struct { Window window; int width; int height; } parentDetails; /***************************************************************************** * Global variables *****************************************************************************/ static Display * display = 0; static int pipe_fd; static int flags; static int repeats; static char *winname; static char *command; static char *file; static XWindowAttributes wattr; #ifdef USE_MUTEX_LOCK static Atom swallowMutex; static int swallowMutexTaken; #endif static Atom windowOwnerMark; static int xaspect; static int yaspect; #define MAX_POSS_VICTIMS 100 static unsigned int possible_victim_count = 0; static Window possible_victim_windows[MAX_POSS_VICTIMS]; /*****************************************************************************/ /** * @brief Error handler callback * * Callback from X when there is an error. If debug defined error message is * printed to debug log, otherise nothing is done * * @param[in] dpy The display pointer * @param[in] err Pointer to the error event data * * @return Always returns zero * *****************************************************************************/ static int error_handler(Display *dpy, XErrorEvent *err) { char buffer[1024]; XGetErrorText(dpy, err->error_code, buffer, sizeof(buffer)); D("!!!ERROR_HANDLER!!!: %s\n", buffer); return 0; } #ifdef USE_MUTEX_LOCK /*****************************************************************************/ /** * Initialise semaphore (swallow mutex semaphore protection) * * @return none * *****************************************************************************/ static void initSwallowMutex(void) { D("Initialising Swallow Mutex\n"); if(display == 0) { fprintf(stderr, "Display not set so cannot initialise semaphore!\n"); } else { swallowMutex = XInternAtom(display, "MOZPLUGGER_SWALLOW_MUTEX", 0); swallowMutexTaken = 0; } } #endif /*****************************************************************************/ /** * Initialise the X atom used to mark windows as owned by mozplugger * * @return None * *****************************************************************************/ static void initWindowOwnerMarker(void) { windowOwnerMark = XInternAtom(display, "MOZPLUGGER_OWNER", 0); } /*****************************************************************************/ /** * Get Host ID - construct a host ID using host name as source of information * * @return The host ID * *****************************************************************************/ static uint32_t getHostId(void) { char hostName[128]; uint32_t id; int i; memset(hostName, 0, sizeof(hostName)); gethostname(hostName, sizeof(hostName)-1); D("Host Name = \"%s\"\n", hostName); /* OK, Create a 32 bit hash value from the host name.... use this as a host ID, the possiblity of a collison of hash keys effecting the swallow of victims is so infinitimisally small! */ id = 0; for(i=0; i < (int)(sizeof(hostName)/sizeof(uint32_t)); i++) { id = ((id << 5) ^ (id >> 27)) ^ ((uint32_t *)hostName)[i]; } return id; } /*****************************************************************************/ /** * Extract host Id and pid from window property. This is common code used in * various places and is factored out due to complexity of 64 bit versus * 32 bit machines. * * @param[in] w The window to get property from * @param[in] name The name of property to get * @param[out] hostId The ID of the host currently owning the mutex * @param[out] pid The process ID of the mutex * * @return 1(true) if owner found, 0 otherwise * *****************************************************************************/ static int getOwnerFromProperty(Window w, Atom name, uint32_t * hostId, uint32_t * pid) { unsigned long nitems; unsigned long bytes; int fmt; Atom type; unsigned char * property = NULL; int success = 0; /* Get hold of the Host & PID that current holds the semaphore for this display! - watch out for the bizarre 64-bit platform behaviour where property returned is actually an array of 2 x 64bit ints with the top 32bits set to zero! */ XGetWindowProperty(display, w, name, 0, 2, 0, XA_INTEGER, &type, &fmt, &nitems, &bytes, &property); if(property) { D("XGetWindowProperty() passed\n"); /* Just check all is correct! */ if((type != XA_INTEGER) || (fmt!=32) || (nitems!=2)) { fprintf(stderr, "XGetWindowProperty returned bad values " "%ld,%d,%lu,%lu\n", (long) type, fmt, nitems, bytes); } else { *hostId = (uint32_t)((unsigned long *)property)[0]; *pid = (uint32_t)((unsigned long *)property)[1]; success = 1; } XFree(property); } else { D("XGetWindowProperty() failed\n"); } return success; } #ifdef USE_MUTEX_LOCK /*****************************************************************************/ /** * Get owner of mutex semaphore. Returns the current owner of the semaphore * * @param[out] hostId The ID of the host currently owning the mutex * @param[out] pid The process ID of the mutex * * @return 1(true) if owner found, 0 otherwise * *****************************************************************************/ static int getSwallowMutexOwner(uint32_t * hostId, uint32_t * pid) { return getOwnerFromProperty(wattr.root, swallowMutex, hostId, pid); } /*****************************************************************************/ /** * Set owner of mutex semaphore * * @param[in] hostId The ID of the new owner of the mutex * @param[in] pid The process ID of the mutex * * @return none * *****************************************************************************/ static void setSwallowMutexOwner(uint32_t hostId, uint32_t pid) { unsigned long temp[2] = {hostId, pid}; D("Setting swallow mutex owner, hostId = 0x%08X, pid=%u\n", (unsigned) hostId, (unsigned) pid); XChangeProperty(display, wattr.root, swallowMutex, XA_INTEGER, 32, PropModeAppend, (unsigned char*) (&temp), 2); } /*****************************************************************************/ /** * Take mutex semaphore ownership. * * @return none * *****************************************************************************/ static void takeSwallowMutex(void) { int countDown; const uint32_t ourPid = (uint32_t)getpid(); const uint32_t ourHostId = getHostId(); uint32_t otherPid; uint32_t otherHostId; uint32_t prevOtherPid = 0; if((display == 0) || (swallowMutex == 0)) { return; } D("Attempting to take Swallow Mutex\n"); /* Try up tp forty times ( 40 * 250ms = 10 seconds) to take the semaphore... */ countDown = 40; while(1) { /* While someone owns the semaphore */ while(getSwallowMutexOwner(&otherHostId, &otherPid)) { if( otherHostId == ourHostId) { if(otherPid == ourPid) { /* Great we have either successfully taken the semaphore OR (unlikely) we previously had the semaphore! Exit the function...*/ swallowMutexTaken = 1; D("Taken Swallow Mutex\n"); return; } D("Semaphore currently taken by pid=%ld\n", (long) otherPid); /* Check that the process that has the semaphore exists... Bit of a hack, I cant find a function to directly check if process exists. */ if( (getsid(otherPid) < 0 ) && (errno == ESRCH)) { D("Strange other Pid(%lu) cannot be found\n",(unsigned long) otherPid); XDeleteProperty(display, wattr.root, swallowMutex); break; /* OK force early exit of inner while loop */ } } /* Check if the owner of semaphore hasn't recently changed if it has restart timer */ if(prevOtherPid != otherPid) { D("Looks like semaphore's owner has changed pid=%ld\n", (long) otherPid); countDown = 40; prevOtherPid = otherPid; } /* Do one step of the timer... */ countDown--; if(countDown <= 0) { D("Waited long enough for Pid(%lu)\n", (unsigned long) otherPid); XDeleteProperty(display, wattr.root, swallowMutex); break; } usleep(250000); /* 250ms */ } /* else no one has semaphore, timeout, or owner is dead - Set us as the owner, but we need to check if we weren't beaten to it so once more around the loop. Note even doing the recheck does not work in 100% of all cases due to task switching occuring at just the wrong moment see Mozdev bug 20088 - the fix is done use the stillHaveMutex function */ setSwallowMutexOwner(ourHostId, ourPid); } } /*****************************************************************************/ /** * Check if we still have the mutex semaphore * * @return true if we still have the Mutex semaphore * *****************************************************************************/ static int stillHaveMutex(void) { uint32_t otherPid; uint32_t otherHostId; if(getSwallowMutexOwner(&otherHostId, &otherPid)) { const uint32_t ourHostId = getHostId(); if( otherHostId == ourHostId) { const uint32_t ourPid = (uint32_t)getpid(); if(otherPid == ourPid) { return 1; } } } D("Race condition detected, semaphore pinched by Pid(%lu)\n", (unsigned long) otherPid); return 0; } /*****************************************************************************/ /** * Gives away ownership of the mutex semaphore * * @return none * *****************************************************************************/ static void giveSwallowMutex(void) { if((display == 0) || (swallowMutex == 0) || (swallowMutexTaken ==0)) { return; } D("Giving Swallow Mutex\n"); XDeleteProperty(display, wattr.root, swallowMutex); swallowMutexTaken = 0; } #endif /*****************************************************************************/ /** * Mark the victim window with a property that indicates that this instance * of mozplugger-helper has made a claim to this victim. This is used to * guard against two instances of mozplugger-helper claiming the same victim. * * @param[in] w The window * * @return True(1) if taken, False(0) if not * *****************************************************************************/ static int chkAndMarkVictimWindow(Window w) { unsigned long temp[2]; uint32_t ourPid; uint32_t ourHostId; uint32_t pid; uint32_t hostId; int gotIt = 0; /* See if some other instance of Mozplugger has already 'marked' this * window */ if(getOwnerFromProperty(w, windowOwnerMark, &hostId, &pid)) { return 0; /* Looks like someone else has marked this window */ } /* OK lets claim it for ourselves... */ ourPid = (uint32_t)getpid(); ourHostId = getHostId(); temp[0] = ourHostId; temp[1] = ourPid; XChangeProperty(display, w, windowOwnerMark, XA_INTEGER, 32, PropModeAppend, (unsigned char*) (&temp), 2); /* See if we got it */ if(getOwnerFromProperty(w, windowOwnerMark, &hostId, &pid)) { if( (pid == ourPid) && (hostId == ourHostId) ) { gotIt = 1; } } else { D("Strange, couldn't set windowOwnerMark\n"); gotIt = 1; } return gotIt; } /*****************************************************************************/ /** * Calculate scaling factor. Given a and b calculate a number that both a * and b can be divided by * * @param[in] a First value * @param[in] b Second value * * @return Scaling factor * *****************************************************************************/ static int gcd(int a, int b) { if (a < b) { return gcd(b,a); } if (b == 0) { return a; } return gcd(b, a % b); } /*****************************************************************************/ /** * Set aspect ratio. Store away the aspect ratio * * @param[in] x X value * @param[in] y Y value * * @return 1(true) if change has occurred * *****************************************************************************/ static int set_aspect(int x, int y) { const int ox = xaspect; const int oy = yaspect; const int d = gcd(x, y); xaspect = x / d; yaspect = y / d; D("xaspect=%d yaspect=%d\n", xaspect, yaspect); return ((ox != xaspect) || (oy != yaspect)); } /*****************************************************************************/ /** * Adjust window size * * @return none * *****************************************************************************/ static void adjust_window_size(void) { int x = 0; int y = 0; int w = parentDetails.width; int h = parentDetails.height; if (flags & H_FILL) { D("Resizing window 0x%x with FILL\n", (unsigned) victimDetails.window); } else if (flags & H_MAXASPECT) { if (xaspect && yaspect) { int tmpw, tmph; D("Resizing window 0x%x with MAXASPECT\n", (unsigned) victimDetails.window); tmph = h / yaspect; tmpw = w / xaspect; if (tmpw < tmph) { tmph = tmpw; } tmpw = tmph * xaspect; tmph = tmph * yaspect; x = (w - tmpw) / 2; y = (h - tmph) / 2; w = tmpw; h = tmph; } else { D("Not resizing window\n"); return; } } /* Compensate for the Victims border width (usually set to zero anyway) */ w -= 2 * victimDetails.borderWidth; h -= 2 * victimDetails.borderWidth; D("New size: %dx%d+%d+%d\n", w, h, x, y); if((victimDetails.x == x) && (victimDetails.y == y) && (victimDetails.width == w) && (victimDetails.height == h)) { XEvent event; D("No change in window size so sending ConfigureNotify instead\n"); /* According to X11 ICCCM specification, a compliant window * manager, (or proxy in this case) should sent a ConfigureNotify * event to the client even if no size change has occurred! * The code below is taken and adapted from the * TWM window manager and fixed movdev bug #18298. */ event.type = ConfigureNotify; event.xconfigure.display = display; event.xconfigure.event = victimDetails.window; event.xconfigure.window = victimDetails.window; event.xconfigure.x = x; event.xconfigure.y = y; event.xconfigure.width = w; event.xconfigure.height = h; event.xconfigure.border_width = victimDetails.borderWidth; event.xconfigure.above = Above; event.xconfigure.override_redirect = False; XSendEvent(display, victimDetails.window, False, StructureNotifyMask, &event); } /* Always resize the window, even when the target size has not changed. This is needed for gv. */ XMoveResizeWindow(display, victimDetails.window, x, y, (unsigned)w, (unsigned)h); victimDetails.x = x; victimDetails.y = y; victimDetails.width = w; victimDetails.height = h; } /*****************************************************************************/ /** * Change the leader of the window. Peter - not sure why this code is needed * as it does say in the ICCCM that only client applications should change * client HINTS. Also all the window_group does is hint to the window manager * that there is a group of windows that should be handled together. * * @return none * *****************************************************************************/ static void change_leader(void) { D("Changing leader of window 0x%x\n", (unsigned) victimDetails.window); XWMHints *leader_change; if ((leader_change = XGetWMHints(display, victimDetails.window))) { if((leader_change->flags & WindowGroupHint) != 0) { D("Old window leader was 0x%x\n", (unsigned) leader_change->window_group); } if((leader_change->flags & InputHint) != 0) { D("Input hint = %i\n", leader_change->input); } if((leader_change->flags & StateHint) != 0) { D("InitialState hint = %i\n", (unsigned) leader_change->initial_state); } leader_change->flags |= WindowGroupHint; leader_change->window_group = wattr.root; D("New window leader is 0x%x\n", (unsigned) leader_change->window_group); XSetWMHints(display,victimDetails.window,leader_change); XFree(leader_change); } else { D("XGetWMHints returned NULL\n"); } } /*****************************************************************************/ /** * Reparent the window, a count is kept of the number of attempts. If this * exceeds 10, give up (i.e. avoid two instances of helper fighting over * the same application). Originally this was done with a semaphore, but this * caused more problems than it fixed. So alternative is to assume that it is * such an unlikely occurance that two instances of helper will run at exactly * the same time and try to get the same window, that we give up. * * @return none * *****************************************************************************/ static void reparent_window(void) { if (!victimDetails.window) { D("reparent_window: No victim to reparent\n"); return; } if (!parentDetails.window) { D("reparent_window: No parent to reparent to\n"); return; } if(victimDetails.reparentedAttemptCount > 10) { D("Giving up reparenting to avoid - tried 10 times\n"); return; } victimDetails.reparentedAttemptCount++; D("Reparenting window 0x%x into 0x%x\n", (unsigned)victimDetails.window, (unsigned)parentDetails.window); XReparentWindow(display, victimDetails.window, parentDetails.window, 0, 0); } /******************************************************************************/ /** * Traditionally strcmp returns -1, 0 and +1 depending if name comes before * or after windowname, this function also returns +1 if error * * @param[in] windowname The window name to compare against * @param[in] name The name to compare against window name * * @return 0 if match, -1/+1 if different * *****************************************************************************/ static int my_strcmp(const char *windowname, const char *name) { if (!name) { return 1; } if (!windowname) { return 1; } switch (name[0]) { case '=': return strcmp(name+1, windowname); case '~': return strcasecmp(name+1, windowname); case '*': return strncasecmp(name+1, windowname, strlen(name)-1); default: /* Return 0 for success so need to invert logic as strstr returns pointer to the match or NULL if no match */ return !strstr(windowname, name); } } /******************************************************************************/ /** * Check name against the name of the passed window * * @param[in] w The window to compare against * @param[in] name The name to compare against window name * * @return 1 if match, 0 if not * *****************************************************************************/ static char check_window_name(Window w, const char *name) { char * windowname; XClassHint windowclass; if (XFetchName(display, w, &windowname)) { const char match = (my_strcmp(windowname, name) == 0); D("XFetchName, checking window NAME 0x%x (%s %s %s)\n", (unsigned)w, windowname, match ? "==" : "!=", name); XFree(windowname); if (match) { return 1; } } else { D("XFetchName, window has no NAME\n"); } if (XGetClassHint(display, w, &windowclass)) { const char match = (my_strcmp(windowclass.res_name, name) == 0); D("XGetClassHint, checking window CLASS 0x%x (%s %s %s)\n", (unsigned)w, windowclass.res_name, match ? "==" : "!=", name); XFree(windowclass.res_class); XFree(windowclass.res_name); return match; } else { D("XGetClassHint, window has no CLASS\n"); } return 0; } /*****************************************************************************/ /** * Setup display ready for any reparenting of the application window. If the * WINDOW is NULL (can happen see mozdev bug #18837), then return failed * code from this function to indicate no window available. This then means * no swallowing will occur (even if requested). * * @return 1(true) if success, 0(false) if not * *****************************************************************************/ static int setup_display(void) { char *displayname; if(parentDetails.window == 0) /* mozdev bug #18837 */ { D("setup_display() WINDOW is Null - so nothing setup\n"); return 0; } displayname = getenv("DISPLAY"); D("setup_display(%s)\n", displayname); XSetErrorHandler(error_handler); display = XOpenDisplay(displayname); if(display == 0) { D("setup_display() failed cannot open display!!\n"); return 0; } if (!XGetWindowAttributes(display, parentDetails.window, &wattr)) { D("setup_display() failed cannot get window attributes!!\n"); XCloseDisplay(display); display = 0; return 0; } D("display=0x%x\n", (unsigned) display); D("WINDOW =0x%x\n", (unsigned) parentDetails.window); D("rootwin=0x%x\n", (unsigned) wattr.root); D("setup_display() done\n"); return 1; } /*****************************************************************************/ /** * Add to list of possible victim windows. Called whenever we get a * CREATE_NOTIFY on the root window. * * @param[in] window The window * * @return none * *****************************************************************************/ static void add_possible_victim(Window window) { possible_victim_windows[possible_victim_count] = window; if(possible_victim_count < MAX_POSS_VICTIMS) { possible_victim_count++; } } /*****************************************************************************/ /** * Checks if the passed window is the victim. * * @param[in] window The window * * @return True if found our victim for first time. * *****************************************************************************/ static int find_victim(Window window) { if (!victimDetails.window) { Window found = 0; D("Looking for victim... (%s)\n", winname); /* New way, check through list of newly created windows */ int i; for(i = 0; i < possible_victim_count; i++) { if(window == possible_victim_windows[i]) { if (check_window_name(window, winname)) { found = true; break; } } } if (found) { XWindowAttributes ca; if(XGetWindowAttributes(display, window, &ca)) { /* See if some instance of mozplugger got the window * before us, if not mark it as ours */ if(chkAndMarkVictimWindow(window)) { victimDetails.window = window; victimDetails.borderWidth = ca.border_width; victimDetails.x = ca.x; victimDetails.y = ca.y; victimDetails.width = ca.width; victimDetails.height = ca.height; D("Found victim=0x%x, x=%i, y=%i, width=%i, height=%i, " "border=%i\n", (unsigned) victimDetails.window, victimDetails.x, victimDetails.y, victimDetails.width, victimDetails.height, victimDetails.borderWidth); /* To avoid losing events, enable monitoring events on * victim at earlist opportunity */ XSelectInput(display, victimDetails.window, StructureNotifyMask); XSync(display, False); XSelectInput(display, wattr.root, 0); #ifdef USE_MUTEX_LOCK giveSwallowMutex(); #endif if (flags & H_MAXASPECT) { set_aspect(ca.width, ca.height); } return true; } else { D("Window 0x%x already claimed by another" " instance of mozplugger\n", (unsigned) window); } } else { D("XGetWindowAttributes failed for 0x%x\n", (unsigned) window); } } } return false; } /******************************************************************************/ /** * handle X event for the root window. Mozplugger in effect is acting like a * window manager by intercepting root window events. The one event it would * like to intercept, but cannot is the MapRequest. It cannot because only one * client is allowed to intercept that event (i.e. the real window manager). When * the real window manager receives the MapRequest, it will most likely try and * reparent that window into a frame containing decorations (i.e. title bar, * etc). The only way mozplugger knows this has happened is when it sees the * ReparentNotify. Ideally Mozplugger needs to over-ride this reparenting, the * current solution is to reparent that window again. Result is a fight with * window manager. The alternative is to set the override_redirect attribute * on the window (this stops the MapRequest event). But according to ICCCM this * is bad practice, so mozplugger only does it as a last resort (see * reparent_window function above). * * An alternative would be to reparent the window before the MapRequest i.e. * when the window is invisible. Unfortunately some apps create many invisible * root windows and it is difficult to know which window is the one to grab until * the application makes it clear by Mapping that window. * * @param[in] ev the event * * @return none * *****************************************************************************/ static void handle_rootWindow_event(const XEvent * const ev) { switch (ev->type) { case CreateNotify: D("***CreateNotify for root, window=0x%x, " "override_redirect=%i\n", (unsigned) ev->xcreatewindow.window, ev->xcreatewindow.override_redirect); /* All toplevel new app windows will be created on desktop (root), * so lets keep a list as they are created */ add_possible_victim(ev->xcreatewindow.window); break; case MapNotify: D("***MapNotify for root, window=0x%x, override_redirect=%i\n", (unsigned) ev->xmap.window, ev->xmap.override_redirect); /* A window has been mapped, if window manager is allowed to * fiddle, lets see if this is the window */ if(!ev->xmap.override_redirect) { Window wnd = ev->xmap.window; if(find_victim(wnd)) { /* If we get MapNotify on root before ReparentNotify for our * victim this means either:- * (1) There is no reparenting window manager running * (2) We are running over NX * With NX, we get the MapNotify way too early! (window not * mapped yet on the server), so need to be clever? * Set flag, this will be used later in the select loop */ D("Looks like no reparenting WM running\n"); change_leader(); victimDetails.noWmRunning = true; reparent_window(); } } break; case ReparentNotify: D("***ReparentNotify for root, parent=0x%x, window=0x%x, " "x=%i, y=%i, override_redirect=%i\n", (unsigned) ev->xreparent.parent, (unsigned) ev->xreparent.window, ev->xreparent.x, ev->xreparent.y, ev->xreparent.override_redirect); /* A window has been reparented, if window manager is allowed to * fiddle, lets see if this is the window we are looking for */ if(!ev->xreparent.override_redirect) { Window wnd = ev->xreparent.window; if(find_victim(wnd)) { /* Avoid the fight with window manager to get reparent, * instead be kind and withdraw window and wait for WM * to reparent window back to root */ D("Withdraw window 0x%x\n", (unsigned) wnd); XWithdrawWindow(display, wnd, DefaultScreen(display)); #if 0 change_leader(); reparent_window(); #endif } } break; case ConfigureNotify: D("***ConfigureNotify for root, window=0x%x, " "x=%i, y=%i, width=%i, height=%i, override_redirect=%i\n", (unsigned) ev->xconfigure.window, ev->xconfigure.x, ev->xconfigure.y, ev->xconfigure.width, ev->xconfigure.height, ev->xconfigure.override_redirect); break; case UnmapNotify: D("***UnmapNotify for root, window=0x%x, from_configure=%i, " "send_event=%i\n", (unsigned) ev->xunmap.window, ev->xunmap.from_configure, ev->xunmap.send_event); break; case DestroyNotify: D("***DestroyNotify for root, window=0x%x\n", (unsigned) ev->xdestroywindow.window); break; case ClientMessage: D("***ClientMessage for root\n"); break; default: D("!!Got unhandled event for root->%d\n", ev->type); break; } } /******************************************************************************/ /** * handle X event for the victim window * * @param[in] ev the event * * @return none * *****************************************************************************/ static void handle_victimWindow_event(const XEvent * const ev) { switch (ev->type) { case UnmapNotify: D("UNMAPNOTIFY for victim, window=0x%x, from_configure=%i, " "send_event=%i\n", (unsigned) ev->xunmap.window, ev->xunmap.from_configure, ev->xunmap.send_event); victimDetails.mapped = false; break; case MapNotify: D("MAPNOTIFY for victim, window=0x%x, override_redirect=%i\n", (unsigned) ev->xmap.window, ev->xmap.override_redirect); victimDetails.mapped = true; if(victimDetails.reparented) { adjust_window_size(); } break; case ReparentNotify: if (ev->xreparent.parent == parentDetails.window) { D("REPARENT NOTIFY on victim to the right window, " "parent=0x%x, window=0x%x, " "x=%i, y=%i, override_redirect=%i\n", (unsigned) ev->xreparent.parent, (unsigned) ev->xreparent.window, ev->xreparent.x, ev->xreparent.y, ev->xreparent.override_redirect); victimDetails.reparented = true; if(!victimDetails.mapped) { D("XMapWindow(0x%x)\n", (unsigned) victimDetails.window); XMapWindow(display, victimDetails.window); } else { adjust_window_size(); } } else { D("REPARENT NOTIFY on victim to some other window! " "parent=0x%x, window=0x%x, " "x=%i, y=%i, override_redirect=%i\n", (unsigned) ev->xreparent.parent, (unsigned) ev->xreparent.window, ev->xreparent.x, ev->xreparent.y, ev->xreparent.override_redirect); victimDetails.noWmRunning = false; victimDetails.reparented = false; reparent_window(); } break; case ConfigureNotify: D("CONFIGURE NOTIFY for victim, window=0x%x," " x=%d, y=%d, w=%d, h=%d, " "border_width=%d, override_redirect=%i\n", (unsigned) ev->xconfigure.window, ev->xconfigure.x, ev->xconfigure.y, ev->xconfigure.width, ev->xconfigure.height, ev->xconfigure.border_width, ev->xconfigure.override_redirect); break; case ClientMessage: D("CLIENT MESSAGE for victim\n"); /* I see this with evince! perhaps it needs to be handled? */ break; case DestroyNotify: D("DESTROY NOTIFY for victim, window=0x%x\n", (unsigned) ev->xdestroywindow.window); if(ev->xdestroywindow.window == victimDetails.window) { XSelectInput(display, victimDetails.window, 0); victimDetails.window = 0; } break; default: D("!!Got unhandled event for victim->%d\n", ev->type); break; } } /******************************************************************************/ /** * handle X event for the parent window * * @param[in] ev the event * * @return none * *****************************************************************************/ static void handle_parentWindow_event(const XEvent * const ev) { unsigned long mask; switch (ev->type) { case ConfigureRequest: mask = ev->xconfigurerequest.value_mask; D("ConfigureRequest to WINDOW mask=0x%lx\n", mask); if(ev->xconfigurerequest.window != victimDetails.window) { D("- Strange Configure Request not for victim\n"); } else { int adjustWindow = false; if(mask & (CWHeight | CWWidth)) { D(" - request to set width & height\n"); set_aspect(ev->xconfigurerequest.width, ev->xconfigurerequest.height); adjustWindow = true; } if(mask & (CWBorderWidth)) { const int w = ev->xconfigurerequest.border_width; D("- request to set border width=%d\n", w); if(victimDetails.borderWidth != w) { victimDetails.borderWidth = w; adjustWindow = true; } XSetWindowBorderWidth(display, victimDetails.window, (unsigned) w); } /* Only adjust if window has been mapped and reparented */ if(adjustWindow && victimDetails.mapped && victimDetails.reparented) { adjust_window_size(); } } break; default: D("!!Got unhandled event for PARENT->%d\n", ev->type); break; } } /******************************************************************************/ /** * Check events from X * Read in events from X and process, keep reading in events until no more * and then exit. It is important that all events have been processed and * not left pending. * * @return none * *****************************************************************************/ static void check_x_events(void) { int numEvents = XPending(display); /* While some events pending... Get and action */ while (numEvents > 0) { XEvent ev; XNextEvent(display, &ev); if (ev.xany.window == wattr.root) { handle_rootWindow_event(&ev); } else if (victimDetails.window && ev.xany.window == victimDetails.window) { handle_victimWindow_event(&ev); } else if (parentDetails.window && (ev.xany.window == parentDetails.window)) { handle_parentWindow_event(&ev); } else { D("!!Got unhandled event for unknown->%d\n", ev.type); } /* If this is the last of this batch, check that more havent * been added in the meantime as a result of an action */ numEvents--; if(numEvents == 0) { numEvents = XPending(display); } } } /******************************************************************************/ /** * Check events from pipe connected to mozplugger * Read in events from pipe connected to mozplugger and process * * @return none * *****************************************************************************/ static void check_pipe_fd_events(void) { static NPWindow wintmp; int n; Window oldwindow = parentDetails.window; D("Got pipe_fd data, old parent=0x%x pipe_fd=%d\n", (unsigned) oldwindow, pipe_fd); n = read(pipe_fd, ((char *)& wintmp), sizeof(wintmp)); if (n < 0) { if (errno == EINTR) { return; } D("Winddata read error, exiting\n"); #ifdef USE_MUTEX_LOCK giveSwallowMutex(); #endif exit(EX_UNAVAILABLE); } if (n == 0) { D("Winddata EOF, exiting\n"); #ifdef USE_MUTEX_LOCK giveSwallowMutex(); #endif exit(EX_UNAVAILABLE); } if (n != sizeof(wintmp)) { return; } parentDetails.window = (Window) wintmp.window; parentDetails.width = (int) wintmp.width; parentDetails.height = (int) wintmp.height; D("Got pipe_fd data, new parent=0x%x\n", (unsigned) parentDetails.window); if (parentDetails.window && display ) { if(parentDetails.window != oldwindow) { victimDetails.reparented = false; /* To avoid losing events, enable monitoring events on new parent * before disabling monitoring events on the old parent */ XSelectInput(display, parentDetails.window, SubstructureRedirectMask); XSync(display, False); XSelectInput(display, oldwindow, 0); if(victimDetails.window) { reparent_window(); } else { D("Victim window not ready to be reparented\n"); } } if(victimDetails.window && victimDetails.mapped && victimDetails.reparented) { /* The window has been resized. */ adjust_window_size(); } else { D("Victim window not ready to be adjusted\n"); } } } /******************************************************************************/ /** * Keep checking all events until application dies * Use select to check if any events need processing * * @return none * *****************************************************************************/ static void check_all_events(pid_t pid) { int maxfd; fd_set fds; int status; while(1) { int selectRetVal; int sig_chld_fd; struct timeval timeout; struct timeval * pTimeout = 0; if (display) { check_x_events(); } FD_ZERO(&fds); FD_SET(ConnectionNumber(display), &fds); FD_SET(pipe_fd, &fds); maxfd = MAX(ConnectionNumber(display), pipe_fd); sig_chld_fd = get_SIGCHLD_fd(); if(sig_chld_fd >= 0) { FD_SET(sig_chld_fd, &fds); maxfd = MAX(maxfd, sig_chld_fd); } /* If NX is is use and nxagent is configured as rootless, it can * appear that there is no WM running, but actually there is and its * actions (reparenting to add decorations) is invisible. In this * case just reparent 4 times in a row with 1 second gaps. If the * link latency > 4 seconds this may fail? */ if((victimDetails.noWmRunning) && (victimDetails.reparentedAttemptCount < 4)) { pTimeout = &timeout; pTimeout->tv_usec = 50000; pTimeout->tv_sec = 0; } D("SELECT IN %s\n", pTimeout ? "with timeout" : ""); selectRetVal = select(maxfd + 1, &fds, NULL, NULL, pTimeout); if(selectRetVal > 0) { if (FD_ISSET(pipe_fd, &fds)) { check_pipe_fd_events(); } if( FD_ISSET(sig_chld_fd, &fds)) { handle_SIGCHLD_event(); } } else if((selectRetVal == 0) && pTimeout) { D("Select timeout and suspect invisible WM\n"); reparent_window(); } else { D("Select exited unexpected, errno = %i\n", errno); } D("SELECT OUT\n"); if(pid >= 0) { if(waitpid(pid, &status, WNOHANG)) { pid = -1; if((flags & H_DAEMON) == 0) { D("Child process has died status=%i\n", status); return; } else { D("Child process has detached, keep going\n"); } } } } } /******************************************************************************/ /** * Handle the application * Wait for application to finish and exit helper if a problem * * @param[in] pid process ID of the application * * @return none * *****************************************************************************/ static void handle_app(pid_t pid) { int status; victimDetails.pid = pid; if (flags & H_SWALLOW) { /* Whilst waiting for the Application to complete, check X events */ check_all_events(pid); #ifdef USE_MUTEX_LOCK /* Make sure the semaphore has been released */ giveSwallowMutex(); #endif } else if(flags & H_DAEMON) { victimDetails.pid = -1; /* If Daemon, then it is not supposed to exit, so we exit instead */ exit(0); } else { /* Just wait for the Application to complete dont check X events */ waitpid(pid, &status, 0); } victimDetails.pid = -1; /* If Application completed is a bad way, then lets give up now */ if (!WIFEXITED(status)) { D("Process dumped core or something...\n"); exit(EX_UNAVAILABLE); } if (WEXITSTATUS(status) && !(flags & H_IGNORE_ERRORS)) { D("Process exited with error code: %d\n", WEXITSTATUS(status)); exit(WEXITSTATUS(status)); } D("Exited OK!\n"); } /******************************************************************************/ /** * Exit early due to problem. Prints a message to stderr and then exits * the application * * @return none * *****************************************************************************/ static void exitEarly(void) { fprintf(stderr,"MozPlugger version " VERSION " helper application.\n" "Please see 'man mozplugger' for details.\n"); exit(1); } /******************************************************************************/ /** * Expands the winname if it contains %f or %p by replacing %f by the file * name part of the URL or %p by the whole of thr URL. * * @return none * *****************************************************************************/ static void expand_winname(char * buffer, int bufferLen, const char * winame, const char * file) { const char * p = winame; char * q = buffer; char * end = &buffer[bufferLen-1]; D("winame before expansion is '%s'\n", winname); while((*p != '\0') && (q < end)) { if( *p != '%') { *q++ = *p++; } else { const char * r; switch(p[1]) { case '%' : *q++ = '%'; p += 2; break; case 'f' : /* %f = insert just the filename no path */ r = strrchr(file, '/'); /* Find the filename start */ if(r == 0) { r = file; } else { r++; /* Skip the slash */ } while((*r != '\0') && (q < end)) { *q++ = *r++; } p += 2; /* Skip the %f */ break; case 'p' : r = file; while((*r != '\0') && (q < end)) { *q++ = *r++; } p += 2; break; default : *q++ = *p++; break; } } } *q = '\0'; D("winame after expansion is '%s'\n", buffer); } /******************************************************************************/ /** * Handle the SIGTERM signal. Terminate the helper and child. * * @return none * *****************************************************************************/ static void sigTerm() { D("SIGTERM received\n"); #ifdef USE_MUTEX_LOCK giveSwallowMutex(); #endif if(display) { XCloseDisplay(display); display = 0; } if(victimDetails.pid >= 0) { my_kill(-victimDetails.pid); victimDetails.pid = -1; } _exit(0); } /****************************************************************************** ** * main() - normally called from the child process started by mozplugger.so * * @param[in] argc The number of arguments * @param[in] argv List of arguments * * @return Never returns (unless app exits) * *****************************************************************************/ int main(int argc, char **argv) { char buffer[100]; unsigned long temp = 0; int x, y, i; D("Helper started.....\n"); if (argc < 3) { exitEarly(); } memset(&victimDetails, 0, sizeof(victimDetails)); victimDetails.pid = -1; memset(&parentDetails, 0, sizeof(parentDetails)); i = sscanf(argv[1],"%d,%d,%d,%lu,%d,%d,%d,%d", &flags, &repeats, &pipe_fd, &temp, &x, /* Not needed and not used */ &y, /* Not needed and not used */ &parentDetails.width, &parentDetails.height); if(i < 8) { exitEarly(); } parentDetails.window = (Window)temp; command = argv[2]; winname = getenv("winname"); file = getenv("file"); if(winname) { expand_winname(buffer, sizeof(buffer), winname, file); winname = buffer; } D("HELPER: %s %s %s %s\n", argv[0], argv[1], file, command); redirect_SIGCHLD_to_fd(); /* Create handler for when terminating the helper */ signal(SIGTERM, sigTerm); if (!setup_display()) { if( (flags & H_SWALLOW) != 0) { D("Failed to open X display - canceling swallow functionality\n"); flags &=~ H_SWALLOW; } } if (repeats < 1) { repeats = 1; } while (repeats > 0) { int loops = 1; pid_t pid; int maxFd; /* This application will use the $repeat variable */ if (flags & H_REPEATCOUNT) { loops = repeats; } /* Expecting the application to loop */ if (flags & H_LOOP) { loops = MAXINT; } if (flags & H_SWALLOW) { initWindowOwnerMarker(); #ifdef USE_MUTEX_LOCK /* If we are swallowing a victim window we need to guard against more than one instance of helper running in parallel, this is done using a global mutex semaphore. Although its not successful in all cases! */ initSwallowMutex(); /* There is a race condition when taking the semaphore that * means occasionally we think we have it but we dont * This do-while loop checks for that case - this * is better than putting a wait in the take semaphore * rechecking loop fixes Mozdev bug 20088 */ do { takeSwallowMutex(); } while(!stillHaveMutex()); #endif XSelectInput(display, parentDetails.window, SubstructureRedirectMask); XSelectInput(display, wattr.root, SubstructureNotifyMask); XSync(display, False); } maxFd = pipe_fd; if(display && (ConnectionNumber(display) > maxFd)) { maxFd = ConnectionNumber(display); } pid = spawn_app(command, flags, maxFd); if(pid == -1) { #ifdef USE_MUTEX_LOCK giveSwallowMutex(); #endif exit(EX_UNAVAILABLE); } D("Waiting for pid=%d\n", pid); handle_app(pid); D("Wait done (repeats=%d, loops=%d)\n", repeats, loops); if (repeats < MAXINT) { repeats -= loops; } } if(display) { XCloseDisplay(display); display = 0; } exit(0); } mozplugger-1.14.5/debug.c0000600000175000001440000001152311722504427014263 0ustar peterusers/***************************************************************************** * * Original Author: Fredrik Hübinette * * Current Authors: Louis Bavoil * Peter Leese * * This code is based on and is a branch of plugger written * by Fredrik Hübinette * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * *****************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "debug.h" #ifdef DEBUG static int debug_on = 1; static FILE * debug_output = NULL; static char * debug_path = ""; /*******************************************************************************/ /** * Open the debug file for appending to * * @return The FILE pointer, or NULL if problem * ******************************************************************************/ static FILE *getout(void) { char debug_filename[128]; char *tmpdir; if (debug_output) { return debug_output; } if(!debug_on) { return NULL; } tmpdir = getenv("MOZPLUGGER_TMP"); if(tmpdir == NULL) { tmpdir = getenv("TMPDIR"); debug_path = "$MOZPLUGGER_TMP"; snprintf(debug_filename, sizeof(debug_filename), "%s/%s", tmpdir, DEBUG_FILENAME); } if(tmpdir == NULL) { /* If (as on default Fedora 7 install) the environment variable * TMPDIR is not defined, just assume $HOME/tmp */ char * homedir = getenv("HOME"); if(homedir == NULL) { fprintf(stderr, "Failed to open debug file - " "neither HOME or TMPDIR defined\n"); return NULL; } debug_path = "$HOME/tmp"; /* For display purposes */ snprintf(debug_filename, sizeof(debug_filename), "%s/tmp/%s", homedir, DEBUG_FILENAME); } else { debug_path = "$TMDIR"; /* For display purposes */ snprintf(debug_filename, sizeof(debug_filename), "%s/%s", tmpdir, DEBUG_FILENAME); } debug_output = fopen(debug_filename,"a+"); if (debug_output == NULL) { fprintf(stderr,"Failed to open debug file \'%s'\n", debug_filename); debug_on = 0; return NULL; } else { fprintf(stderr,"Opened debug file \'%s\'\n", debug_filename); } fprintf(debug_output, "------------\n"); return debug_output; } /*******************************************************************************/ /** * Close debug file * * Close the debug file * ******************************************************************************/ void close_debug(void) { FILE * f = getout(); if(f) { fclose(f); } debug_output = NULL; } /*******************************************************************************/ /** * Take the standard printf type arguments and write the output to the debug * file * * @param[in] fmt The printf format args * @param[in] ... The printf style arguments * ******************************************************************************/ void D(char *fmt, ...) { char buffer[9999]; va_list ap; FILE * f = getout(); if(f) { va_start(ap,fmt); vsnprintf(buffer,sizeof(buffer),fmt,ap); va_end(ap); fprintf(f,"PID%4d: %s",(int) getpid(), buffer); fflush(f); } } /*******************************************************************************/ /** * Get path to the debug file (for display purposes only!) * * @return String containing debug path name * ******************************************************************************/ char * get_debug_path(void) { if(debug_path[0] == '\0') { getout(); } return debug_path; } #else void D(char *fmt, ...) { } void close_debug(void) { } char * get_debug_path(void) { return NULL; }; #endif mozplugger-1.14.5/mozplugger.h0000600000175000001440000000551311722504427015377 0ustar peterusers/***************************************************************************** * * Original author: Fredrik Hübinette * * Current Authors: Louis Bavoil * Peter Leese * * This code is based on and is a branch of plugger written * by Fredrik Hübinette * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * *****************************************************************************/ #ifndef _MOZPLUGGER_H_ #define _MOZPLUGGER_H_ /***************************************************************************** * Defines *****************************************************************************/ #ifndef MAXINT #define MAXINT 0x7fffffff #endif #define MAX(X,Y) ((X)>(Y)?(X):(Y)) /* Time to wait for a process to exit */ #define KILL_TIMEOUT_USEC 100000 #define MAX_STATIC_MEMORY_POOL 65536 /* Maximum size of the buffer used for environment variables. */ #define ENV_BUFFER_SIZE 16348 #define LARGE_BUFFER_SIZE 16384 #define LARGE_BUFFER_SIZE_STR "16384" #define SMALL_BUFFER_SIZE 128 #define SMALL_BUFFER_SIZE_STR "128" #define FIND_CACHE_SIZE 10 /* Flags */ #define H_LOOP 0x00001u #define H_DAEMON 0x00002u #define H_STREAM 0x00004u #define H_NOISY 0x00008u #define H_REPEATCOUNT 0x00010u #define H_EMBED 0x00020u #define H_NOEMBED 0x00040u #define H_IGNORE_ERRORS 0x00080u #define H_SWALLOW 0x00100u #define H_MAXASPECT 0x00200u #define H_FILL 0x00400u #define H_NEEDS_XEMBED 0x00800u #define H_CONTROLS 0x01000u #define H_LINKS 0x02000u #define H_FMATCH 0x04000u #define H_AUTOSTART 0x08000u /***************************************************************************** * Control use of semaphore in mozplugger-helper, define if one wants * semaphores (rare cases doesnt work) *****************************************************************************/ #define USE_MUTEX_LOCK /***************************************************************************** * mozplugger-common.c functions *****************************************************************************/ void my_kill(pid_t pid); #endif mozplugger-1.14.5/npn-get-helpers.h0000600000175000001440000000242711722504427016215 0ustar peterusers/***************************************************************************** * * Current Authors: Louis Bavoil * Peter Leese * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ #ifndef _NPN_GET_HELPERS_H_ #define _NPN_GET_HELPERS_H_ extern void get_api_version(void); extern NPBool does_browser_have_resize_bug(void); extern NPBool does_browser_support_xembed(void); extern NPNToolkitType get_browser_toolkit(NPP instance); extern NPBool does_browser_support_key_handling(NPP instance); #endif mozplugger-1.14.5/mozplugger-controller.c0000600000175000001440000006321411722504427017555 0ustar peterusers/***************************************************************************** * * Original author: Fredrik Hübinette * * Current Authors: Louis Bavoil * Peter Leese * * This code is based on and is a branch of plugger written * by Fredrik Hübinette * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * *****************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include "mozplugger.h" #include "child.h" #include "debug.h" #define MAX_CONTROLS_WIDTH 300 #define MAX_CONTROLS_HEIGHT 100 #define DEFAULT_CONTROLS_WIDTH 60 #define DEFAULT_CONTROLS_HEIGHT 20 #define MIN_CONTROLS_WIDTH 48 #define MIN_CONTROLS_HEIGHT 16 #define WINDOW_BORDER_WIDTH 1 #define BUTTON_DEPTH 2 static Display *dpy=0; static Window topLevel; static int buttonsize=10; #define STATE_PLAY 1 #define STATE_PAUSE 2 #define STATE_STOP 3 static int state=STATE_STOP; static int buttonDown = -1; static pid_t pid=-1; static int repeats = 0; static int repeatsResetVal; static int pipe_fd; static int flags; static GC gc_white; static GC gc_black; static GC gc_onColor; static GC gc_offColor; static int bx; static int smallControls=0; /******************************************************************************/ /** * @brief scale * * Given v when buttonsize is 16 scale to v if buttonsize was buttonsize, * make sure we round up or down correctly. * * @param[in] v The value to scale * * @return The scaled value * *****************************************************************************/ static int scale(int v) { return (v * buttonsize +8) / 16; } /******************************************************************************/ /** * @brief coordAdd * * Given origin point and an x and y translation, calculate new point * * @param[in] origin The origin * @param[in] x The X translation * @param[in] y The Y translation * * @return The co-ordinates as a XPoint structure * *****************************************************************************/ static XPoint coordAdd(const XPoint * const origin, int x, int y) { XPoint ret; ret.x = origin->x + x; ret.y = origin->y + y; return ret; } /******************************************************************************/ /** * @brief draw 3D rectangle * * Draw a rectangle, if pressed is false, give the rectangle shadow to give * impress of a raised button * * @param[in] x X-coordinate * @param[in] y Y-coordinate * @param[in] w width * @param[in] h height * @param[in] d depth * @param[in] c The color of the button * @param[in] pressed If the button is pressed * *****************************************************************************/ static void draw3dRectangle(const int x, const int y, const unsigned w, const unsigned h, const GC c, const int d, const int pressed) { if(pressed) { XFillRectangle(dpy, topLevel, c, x, y, w, h); /* erase left bit of previous not pressed button */ XFillRectangle(dpy, topLevel, gc_white, x-d, y-d, d, h+d); /* erase top bit of previous not pressed button */ XFillRectangle(dpy, topLevel, gc_white, x, y-d, w, d); } else { int i; XFillRectangle(dpy, topLevel, c, x-d, y-d, w, h); /* Draw shadow */ for(i=BUTTON_DEPTH; i > 0; i--) { XDrawLine(dpy, topLevel, gc_black, x+w-i, y+1-i, x+w-i, y+h-i); XDrawLine(dpy, topLevel, gc_black, x+1-i, y+h-i, x+w-i, y+h-i); } } } /******************************************************************************/ /** * @brief redraw * * Redraw the three control buttons * *****************************************************************************/ static void redraw(void) { static int old_buttonsize = -1; XWindowAttributes attr; XPoint points[6]; XPoint base; int x, y; const int d = BUTTON_DEPTH; unsigned w, h; GC c; XGetWindowAttributes(dpy, topLevel, &attr); buttonsize = attr.width/3; if(attr.height < buttonsize) { buttonsize=attr.height; } if(old_buttonsize != buttonsize) { old_buttonsize=buttonsize; XFillRectangle(dpy, topLevel, gc_white, 0,0,(unsigned)attr.width, (unsigned)attr.height); } base.x = (attr.width - buttonsize*3)/2; base.y = (attr.height - buttonsize)/2; /* Set global variable, required by button press event */ bx = base.x; /***** play ******/ { int s = (buttonDown != 0) ? d : 0; points[0] = coordAdd(&base, scale(5)-s, scale(2)-s); points[1] = coordAdd(&points[0], scale(2), 0); points[2] = coordAdd(&points[1], scale(5), scale(5)); points[5] = coordAdd(&base, scale(5)-s, scale(13)-s); points[4] = coordAdd(&points[5], scale(2), 0); points[3] = coordAdd(&points[4], scale(5), -scale(5)); } c = (state==STATE_PLAY) ? gc_onColor : gc_offColor; if(buttonDown != 0) { int i; XFillPolygon(dpy, topLevel, c, points, 6, Convex, CoordModeOrigin); points[2].y++; points[5].x++; /* Draw the shadow */ for(i = BUTTON_DEPTH; i > 0; i--) { XDrawLines(dpy, topLevel, gc_black, &points[2], 4, CoordModeOrigin); XDrawLine(dpy, topLevel, gc_black, points[3].x-1, points[3].y, points[4].x-1, points[4].y); points[2].x++; points[2].y++; points[3].x++; points[3].y++; points[4].x++; points[4].y++; points[5].x++; points[5].y++; } } else { XFillPolygon(dpy, topLevel, c, points, 6, Convex, CoordModeOrigin); x = points[0].x; y = points[0].y; w = points[2].x - points[0].x; h = points[4].y - points[0].y; /* erase left bit of previous not pressed button */ XFillRectangle(dpy, topLevel, gc_white, x-d, y-d, d, h+d); /* erase top bit of previous not pressed button */ XFillRectangle(dpy, topLevel, gc_white, x, y-d, w, d); } /***** pause *****/ base.x += buttonsize; y = base.y + scale(2); w = (unsigned) scale(3) + 1; h = (unsigned) scale(11) + 1; c = (state==STATE_PAUSE) ? gc_onColor : gc_offColor; draw3dRectangle(base.x + scale(3), y, w, h, c, d, buttonDown == 1); draw3dRectangle(base.x + scale(9), y, w, h, c, d, buttonDown == 1); /***** stop *****/ base.x += buttonsize; w = (unsigned) scale(9); draw3dRectangle(base.x + scale(3) + 1, base.y + scale(3) + 1, w, w, (state==STATE_STOP) ? gc_onColor : gc_offColor, d, buttonDown == 2); } /******************************************************************************/ /** * @brief Get environment variable as integer * * Get the value of environment variable 'var' and convert to an integer value * - use 'def' if enviroment variable does not exist * * @param[in] var The name of the variable * @param[in] def The default value to use * * @return The integer value * *****************************************************************************/ static int igetenv(char *var, int def) { char *tmp=getenv(var); if(!tmp) { return def; } return atoi(tmp); } /******************************************************************************/ /** * @brief Play * * Called when the user clicks on the play button * * @param[in] command The command to execute * *****************************************************************************/ static void my_play(char * command) { int maxFd; if(state != STATE_STOP) { if(!kill(-pid, SIGCONT)) { state=STATE_PLAY; return; } } maxFd = pipe_fd; if(dpy && ConnectionNumber(dpy) > maxFd) { maxFd = ConnectionNumber(dpy); } pid = spawn_app(command, flags, maxFd); if(pid == -1) { state=STATE_STOP; return; } state=STATE_PLAY; if(!repeats) { repeats = repeatsResetVal; } if((repeats > 0) && (repeats != MAXINT)) { repeats--; } } /******************************************************************************/ /** * @brief Pause * * Called when the user clicks on the pause button * * @param[in] command The command to execute (not used) * *****************************************************************************/ static void my_pause(char * command) { if(state != STATE_STOP) { if(!kill(-pid, SIGSTOP)) { state = STATE_PAUSE; } else { state = STATE_STOP; } return; } } /******************************************************************************/ /** * @brief Wrapper for kill * * Terminate the controller application * *****************************************************************************/ static void low_die(void) { if(pid > 0) { my_kill(-pid); } _exit(0); } /******************************************************************************/ /** * @brief Stop * * Called when the user clicks on the stop button * * @param[in] command The command to execute (not used) * *****************************************************************************/ static void my_stop(char * command) { if(state == STATE_PAUSE) { my_play(command); } if(state == STATE_PLAY) { if(pid > 0) { my_kill(-pid); } state=STATE_STOP; repeats=0; } } /******************************************************************************/ /** * @brief Wrapper for kill * * Callback function passed to X for when error occurs. This terminates the * controlled application * * @param[in] dpy The display pointer (not used) * @param[in] ev The X event (not used) * * @return Always returns zero * *****************************************************************************/ static int die(Display *dpy, XErrorEvent *ev) { low_die(); return 0; } /******************************************************************************/ /** * @brief Wrapper for kill * * Callback function passed to X for when error occurs. This terminates the * controlled application * * @param[in] dpy The display pointer (not used) * * @return Always returns zero * *****************************************************************************/ static int die2(Display *dpy) { low_die(); return 0; } /******************************************************************************/ /** * @brief Wrapper for kill * * Callback function attached as a signal handler. This terminates the * controlled application * * @param[in] sig The signal (not used) * *****************************************************************************/ static void sigdie(int sig) { low_die(); } /******************************************************************************/ /** * Checks for X events and processes them. Returns when no more events left * to process. * * @return nothing * *****************************************************************************/ static void check_x_events(char * command) { int numEvents = XPending(dpy); while(numEvents > 0) { XEvent ev; XNextEvent(dpy, &ev); switch(ev.type) { case ButtonPress: if(ev.xbutton.button == 1) { buttonDown = (ev.xbutton.x - bx) / buttonsize; redraw(); /* do first gives quicker visual feedback */ XSync(dpy, False); switch(buttonDown) { case 0: /* play */ my_play(command); break; case 1: /* pause*/ my_pause(command); break; case 2: /* stop */ my_stop(command); break; } } break; case ButtonRelease: if(buttonDown != -1) { buttonDown = -1; redraw(); } break; case Expose: if(ev.xexpose.count) { break; } case ResizeRequest: case MapNotify: redraw(); break; default: D("Unknown event %d\n",ev.type); break; } /* If this is the last of this batch, check that more havent * been added in the meantime as a result of an action */ numEvents--; if(numEvents == 0) { numEvents = XPending(dpy); } } } /******************************************************************************/ /** * @brief Normalise window co-ordinates * * Given initial width & height of the window containing the buttons * limit the width and aspect ratio and place in the center of the * window (calculate x & y) * * @param[in,out] width The width before and after * @param[in,out] height The height before and after * @param[in,out] x The x co-ordinate before and after * @param[in,out] y The y co-ordinate before and after * ******************************************************************************/ static void normalise_window_coords(unsigned * width, unsigned * height, int * x, int * y) { unsigned w = *width; unsigned h = *height; const unsigned target_aspect = DEFAULT_CONTROLS_WIDTH / DEFAULT_CONTROLS_HEIGHT; if(smallControls) { *y = *x = 0; *width = MIN_CONTROLS_WIDTH; *height = MIN_CONTROLS_HEIGHT; return; } if(flags & H_FILL) /* Dont bother if user wants to fill the window */ { *x = *y = 0; return; } if((w > MAX_CONTROLS_WIDTH) & !(flags & H_MAXASPECT)) { w = MAX_CONTROLS_WIDTH; } /* Keep the controls as close to default ratio as possible */ if(h > w / target_aspect) { h = w / target_aspect; } *x = (int) (*width - w)/2; *y = (int) (*height - h)/2; *height = h; *width = w; } /******************************************************************************/ /** * @brief Check incoming pipe * * Check to see if new window size information has arrived from plugin and if * so resize the controls accordingly * ******************************************************************************/ static void check_pipe_fd_events(void) { NPWindow wintmp; int n; int x, y; unsigned w, h; D("Got pipe_fd data, pipe_fd=%d\n", pipe_fd); n = read(pipe_fd, ((char *)& wintmp), sizeof(wintmp)); if (n < 0) { if (errno == EINTR) { return; } exit(EX_UNAVAILABLE); } if (n == 0) { exit(EX_UNAVAILABLE); } if (n != sizeof(wintmp)) { return; } /* Adjust the width & height to compensate for the window border width */ w = (unsigned) wintmp.width - 2 * WINDOW_BORDER_WIDTH; h = (unsigned) wintmp.height - 2 * WINDOW_BORDER_WIDTH; normalise_window_coords(&w, &h, &x, &y); D("Controller window: x=%i, y=%i, w=%u, h=%u\n", x, y, w, h); XMoveResizeWindow(dpy, topLevel, x, y, w, h); } /******************************************************************************/ /** * @brief Exit early * * Called if we exit main() early because of invalid passed argument into * the main function. print to both debug and stderr (just in case someone * called mozplugger-controller directly) * *****************************************************************************/ static void exitEarly(void) { D("Invalid parameters passed to Controller - controller exiting\n"); fprintf(stderr,"MozPlugger version " VERSION " controller application.\n" "Please see 'man mozplugger' for details.\n"); exit(1); } /******************************************************************************/ /** * mozplugger-controller takes two arguments. The first is a shell command line * to run when the 'play' button is pressed (or if autostart is set). The second * parameter is optional and is the ID of the parent window into which to draw * the controls. * * If the command line contains the string "$window", then no controls are * drawn. * * @param[in] argc The number of arguments * @param[in] argv Array of the arguments * @param[out] pWidth Width of window * @param[out] pHeight Height of window * @param[out] pWindow The Window ID * @param[out] command The command line * * @return True if all Ok * ******************************************************************************/ static int readCommandLine(int argc, char **argv, unsigned int * pWidth, unsigned int * pHeight, Window * pWindow, char ** pCommand) { unsigned long temp = 0; int x, y ; int i; char * fileName; D("Controller started.....\n"); if (argc < 3) { return 0; } /* Global variables set are: - repeatsResetVal - pipe_fd - flags */ i = sscanf(argv[1],"%d,%d,%d,%lu,%d,%d,%d,%d", &flags, &repeatsResetVal, &pipe_fd, &temp, (int *)&x, /* Not needed and not used */ (int *)&y, /* Not needed and not used */ (int *)pWidth, (int *)pHeight); if(i < 8) { return 0; } *pWindow = (Window)temp; *pCommand = argv[2]; fileName = getenv("file"); D("CONTROLLER: %s %s %s %s\n", argv[0], argv[1], fileName ? fileName : "NULL", argv[2]); return 1; } /******************************************************************************/ /** * mozplugger-controller main() * * If the command line contains the string "$window", then no controls are * drawn. * * @param[in] argc The number of arguments * @param[in] argv Array of the arguments * * @return Never returns unless the application exits * ******************************************************************************/ int main(int argc, char **argv) { int old_state; /* Set defaults, may be changed later */ unsigned int width = DEFAULT_CONTROLS_WIDTH; unsigned int height = DEFAULT_CONTROLS_HEIGHT; int x, y; Window parentWid = 0; char * command = 0; XColor colour; XClassHint classhint; XSetWindowAttributes attr; XSizeHints wmHints; if(!readCommandLine(argc, argv, &width, &height, &parentWid, &command)) { exitEarly(); } /* The application will use the $repeat variable */ if (flags & H_REPEATCOUNT) { repeatsResetVal = 1; } if(!(dpy = XOpenDisplay(getenv("DISPLAY")))) { D("%s: unable to open display %s\n", argv[0], XDisplayName(getenv("DISPLAY"))); exitEarly(); } /* If the command contains a reference to window it is likely that that * application also wants to draw into the same window as the controls * so lets use small controls in top left corner */ if(strstr(command,"$window") || strstr(command,"$hexwindow")) { smallControls=1; } /* Adjust the width & height to compensate for the window border * width */ width -= 2 * WINDOW_BORDER_WIDTH; height -= 2 * WINDOW_BORDER_WIDTH; /* x, y co-ords of the parent is of no interest, we need to know * the x, y relative to the parent. */ normalise_window_coords(&width, &height, &x, &y); D("Controller window: x=%i, y=%i, w=%u, h=%u\n", x, y, width, height); wmHints.x=0; wmHints.y=0; wmHints.min_width = MIN_CONTROLS_WIDTH; wmHints.min_height = MIN_CONTROLS_HEIGHT; wmHints.base_width = DEFAULT_CONTROLS_WIDTH; wmHints.base_height = DEFAULT_CONTROLS_HEIGHT; wmHints.flags=PPosition | USPosition | PMinSize; attr.border_pixel = 0; attr.background_pixel = WhitePixelOfScreen(DefaultScreenOfDisplay(dpy)); attr.event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask; attr.override_redirect=0; topLevel = XCreateWindow(dpy, parentWid, x, y, width, height, WINDOW_BORDER_WIDTH, CopyFromParent, InputOutput, (Visual *) CopyFromParent, (unsigned long)(CWBorderPixel| CWEventMask| CWOverrideRedirect| CWBackPixel), &attr); classhint.res_name = "mozplugger-controller"; classhint.res_class = "mozplugger-controller"; XSetClassHint(dpy, topLevel, &classhint); XStoreName(dpy, topLevel, "mozplugger-controller"); gc_black=XCreateGC(dpy,topLevel,0,0); XSetForeground(dpy,gc_black,BlackPixel(dpy,DefaultScreen(dpy))); gc_white=XCreateGC(dpy,topLevel,0,0); XSetForeground(dpy,gc_white,WhitePixel(dpy,DefaultScreen(dpy))); gc_onColor=XCreateGC(dpy,topLevel,0,0); colour.red=0x0000; colour.green=0xa000; colour.blue=0x0000; colour.pixel=0; colour.flags=0; XAllocColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), &colour); XSetForeground(dpy,gc_onColor,colour.pixel); gc_offColor=XCreateGC(dpy,topLevel,0,0); colour.red=0x8000; colour.green=0x8000; colour.blue=0x8000; colour.pixel=0; colour.flags=0; XAllocColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), &colour); XSetForeground(dpy,gc_offColor,colour.pixel); XSetWMNormalHints(dpy, topLevel, &wmHints); /* Map the window, if the parent has asked for redirect this does nothing * (i.e. if swallow has been used in mozplugger.c) */ XMapWindow(dpy, topLevel); XSetIOErrorHandler(die2); XSetErrorHandler(die); old_state=state; redirect_SIGCHLD_to_fd(); signal(SIGHUP, sigdie); signal(SIGINT, sigdie); signal(SIGTERM, sigdie); if(igetenv("autostart",1)) { my_play(command); } while(1) { fd_set fds; int maxFd; int sig_chld_fd; if(state != old_state) { redraw(); old_state=state; } check_x_events(command); FD_ZERO(&fds); FD_SET(ConnectionNumber(dpy), &fds); FD_SET(pipe_fd, &fds); maxFd = MAX(ConnectionNumber(dpy), pipe_fd); sig_chld_fd = get_SIGCHLD_fd(); if(sig_chld_fd >= 0) { FD_SET(sig_chld_fd, &fds); maxFd = MAX(maxFd, sig_chld_fd); } D("SELECT IN maxFd = %i\n", maxFd); if( select(maxFd + 1, &fds, NULL, NULL, 0) > 0) { if (FD_ISSET(pipe_fd, &fds)) { check_pipe_fd_events(); } if(FD_ISSET(sig_chld_fd, &fds)) { handle_SIGCHLD_event(); } } D("SELECT OUT\n"); if(pid != -1) { int status; if(waitpid(pid, &status, WNOHANG) > 0) { pid=-1; if(state == STATE_PLAY) { state = STATE_STOP; if(repeats > 0) { my_play(command); } } } } } } mozplugger-1.14.5/child.c0000600000175000001440000001437011722504427014263 0ustar peterusers/***************************************************************************** * * Author: Peter Leese * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * *****************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "mozplugger.h" #include "debug.h" static int sig_fds[2]; #define SIG_RD_FD 0 #define SIG_WR_FD 1 /******************************************************************************/ /** * Restore the SIG CHLD handler to default behaviour * * @return None * *****************************************************************************/ void restore_SIGCHLD_to_default(void) { if(sig_fds[SIG_WR_FD] >= 0) { signal(SIGCHLD, SIG_DFL); close(sig_fds[SIG_WR_FD]); } if(sig_fds[SIG_RD_FD] >= 0) { close(sig_fds[SIG_RD_FD]); } sig_fds[SIG_WR_FD] = sig_fds[SIG_RD_FD] = -1; } /******************************************************************************/ /** * Convert signal to message in pipe - Callback function attached as a signal * handler. This sends a message over a pipe about the signal that has * just happened. This allows signals to be handled by select() * * @param[in] sig The signal * * @return nothing * *****************************************************************************/ static void sig_to_fd(int sig) { D("Signal %i routed to pipe\n", sig); if(write(sig_fds[SIG_WR_FD], &sig, sizeof(int)) != sizeof(int)) { D("Signal write to pipe failed\n"); } } /******************************************************************************/ /** * This function creates a signal handler for SIGCHLD that causes a file descriptor * to be ready when the signal occurs. This makes it easy to handle the signal * within a select loop. * * @return N/A * ******************************************************************************/ void redirect_SIGCHLD_to_fd(void) { if(pipe(sig_fds) != 0) { D("Failed to create pipe to handle signals"); sig_fds[SIG_RD_FD] = sig_fds[SIG_WR_FD] = -1; } if(sig_fds[SIG_WR_FD] >= 0) { /* Re-direct SIGCHLD events through a pipe to be see by select() */ signal(SIGCHLD, sig_to_fd); } } /******************************************************************************/ /** * This function is called to get the value of the file descriptor for the * SIGCHLD events. * * @return file descriptor * ******************************************************************************/ int get_SIGCHLD_fd(void) { return sig_fds[SIG_RD_FD]; } /******************************************************************************/ /** * This function is called to handle the SIGCHLD file descriptor when select * detects an event on that file descriptor. * * @return None * ******************************************************************************/ void handle_SIGCHLD_event(void) { int sig; read(sig_fds[SIG_RD_FD], &sig, sizeof(int)); } /*****************************************************************************/ /** * Wrapper for execlp() that calls the application. * * WARNING: This function runs in the daughter process so one must assume the * daughter uses a copy (including) heap memory of the parent's memory space * i.e. any write to memory here does not affect the parent memory space. * Since Linux uses copy-on-write, best leave memory read-only and once execlp * is called, all daughter memory is wiped anyway (except the stack). * * @param[in] argv Pointer to list of arguments * @param[in] flags The flags * * @return Process ID * *****************************************************************************/ pid_t spawn_app(char * command, const int flags, int maxFd) { pid_t pid = fork(); if(pid == 0) { int i; char * app_argv[4]; if( (flags & (H_CONTROLS | H_LINKS)) != 0) { setpgid(pid, 0); } app_argv[0] = "/bin/sh"; app_argv[1] = "-c"; app_argv[2] = command; app_argv[3] = 0; /* Redirect stdout & stderr to /dev/null */ if( (flags & (H_NOISY | H_DAEMON)) != 0) { const int ofd = open("/dev/null", O_RDONLY); D("Redirecting stdout and stderr\n"); if(ofd == -1) { exit(EX_UNAVAILABLE); } dup2(ofd, 1); dup2(ofd, 2); close(ofd); } /* For a DAEMON we must also redirect STDIN to /dev/null * otherwise we can get some weird behaviour especially with realplayer * (I suspect it uses stdin to communicate with its peers) */ if( (flags & H_DAEMON) != 0) { const int ifd = open("/dev/null", O_WRONLY); D("Redirecting stdin also\n"); if(ifd == -1) { exit(EX_UNAVAILABLE); } dup2(ifd, 0); close(ifd); } D("Running %s\n", command); close_debug(); /* Close up those file descriptors */ for(i = 0; i < 2; i++) { close(sig_fds[i]); } for(i = 3; i <= maxFd; i++) { close(i); } execvp(app_argv[0], app_argv); D("Execvp failed. (errno=%d)\n", errno); exit(EX_UNAVAILABLE); } return pid; } mozplugger-1.14.5/mozplugger-linker.c0000600000175000001440000005001511722504427016651 0ustar peterusers/***************************************************************************** * * Original author: Fredrik Hübinette * * Current Authors: Louis Bavoil * Peter Leese * * This code is based on and is a branch of plugger written * by Fredrik Hübinette * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * *****************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include "mozplugger.h" #include "child.h" #include "debug.h" #define MAX_BUTTON_SIZE 100 #define DEFAULT_BUTTON_SIZE 20 #define MIN_BUTTON_SIZE 16 #define WINDOW_BORDER_WIDTH 1 #define BUTTON_DEPTH 2 static Display *dpy=0; static Window topLevel; static int buttonsize=10; static int buttonDown = 0; static pid_t pid = -1; static int repeats = 0; static int repeatsResetVal; static int pipe_fd; static int flags; static struct { Window window; int x; int y; unsigned int width; unsigned int height; } parentDetails; static GC gc_white; static GC gc_black; static GC gc_onColor; static GC gc_offColor; static const char * nextHelper = NULL; /******************************************************************************/ /** * @brief scale * * Given v when buttonsize is 16 scale to v if buttonsize was buttonsize, * make sure we round up or down correctly. * * @param[in] v The value to scale * * @return The scaled value * *****************************************************************************/ static int scale(int v) { return (v * buttonsize +8) / 16; } /******************************************************************************/ /** * @brief coordAdd * * Given origin point and an x and y translation, calculate new point * * @param[in] origin The origin * @param[in] x The X translation * @param[in] y The Y translation * * @return The co-ordinates as a XPoint structure * *****************************************************************************/ static XPoint coordAdd(const XPoint * const origin, int x, int y) { XPoint ret; ret.x = origin->x + x; ret.y = origin->y + y; return ret; } /******************************************************************************/ /** * @brief redraw * * Redraw the link button * *****************************************************************************/ static void redraw(void) { static int old_buttonsize = -1; XWindowAttributes attr; XPoint points[6]; XPoint base; const int d = BUTTON_DEPTH; GC c = (pid > 0) ? gc_onColor : gc_offColor; const int s = (!buttonDown) ? d : 0; XGetWindowAttributes(dpy, topLevel, &attr); buttonsize = attr.width; if(attr.height < buttonsize) { buttonsize=attr.height; } if(old_buttonsize != buttonsize) { old_buttonsize=buttonsize; XFillRectangle(dpy, topLevel, gc_white, 0,0,(unsigned)attr.width, (unsigned)attr.height); } base.x = (attr.width - buttonsize)/2; base.y = (attr.height - buttonsize)/2; points[0] = coordAdd(&base, scale(5)-s, scale(2)-s); points[1] = coordAdd(&points[0], scale(2), 0); points[2] = coordAdd(&points[1], scale(5), scale(5)); points[5] = coordAdd(&base, scale(5)-s, scale(13)-s); points[4] = coordAdd(&points[5], scale(2), 0); points[3] = coordAdd(&points[4], scale(5), -scale(5)); if(!buttonDown) { int i; XFillPolygon(dpy, topLevel, c, points, 6, Convex, CoordModeOrigin); points[2].y++; points[5].x++; /* Draw the shadow */ for(i = BUTTON_DEPTH; i > 0; i--) { XDrawLines(dpy, topLevel, gc_black, &points[2], 4, CoordModeOrigin); XDrawLine(dpy, topLevel, gc_black, points[3].x-1, points[3].y, points[4].x-1, points[4].y); points[2].x++; points[2].y++; points[3].x++; points[3].y++; points[4].x++; points[4].y++; points[5].x++; points[5].y++; } } else { const int x = points[0].x; const int y = points[0].y; const unsigned w = points[2].x - points[0].x; const unsigned h = points[4].y - points[0].y; XFillPolygon(dpy, topLevel, c, points, 6, Convex, CoordModeOrigin); /* erase left bit of previous not pressed button */ XFillRectangle(dpy, topLevel, gc_white, x-d, y-d, d, h+d); /* erase top bit of previous not pressed button */ XFillRectangle(dpy, topLevel, gc_white, x, y-d, w, d); } } /******************************************************************************/ /** * @brief Play * * Called when the user clicks on the play button * * @param[in] command The command to execute * *****************************************************************************/ static void my_start(char * command) { int maxFd; if(pid > 0) { return; } /* If another helper application, switch to that one */ if(nextHelper) { char buffer[ENV_BUFFER_SIZE]; char *cmd[4]; XDestroyWindow(dpy, topLevel); close(ConnectionNumber(dpy)); restore_SIGCHLD_to_default(); cmd[0] = (char *) nextHelper; snprintf(buffer, sizeof(buffer), "%d,%d,%d,%lu,%d,%d,%d,%d", flags, repeats, pipe_fd, (unsigned long int) parentDetails.window, (int) parentDetails.x, (int) parentDetails.y, (int) parentDetails.width, (int) parentDetails.height); cmd[1] = buffer; cmd[2] = command; cmd[3] = 0; D("Switching to helper\n"); execvp(nextHelper, cmd); exit(EX_UNAVAILABLE); } /* else linker is used to launch command */ maxFd = pipe_fd; if(dpy && ConnectionNumber(dpy) > maxFd) { maxFd = ConnectionNumber(dpy); } pid = spawn_app(command, flags, maxFd); if(pid == -1) { return; } if(!repeats) { repeats = repeatsResetVal; } if((repeats > 0) && (repeats != MAXINT)) { repeats--; } } /******************************************************************************/ /** * @brief Wrapper for kill * * Terminate the linked application * *****************************************************************************/ static void low_die(void) { if(pid > 0) { my_kill(-pid); } _exit(0); } /******************************************************************************/ /** * @brief Wrapper for kill * * Callback function passed to X for when error occurs. This terminates the * linked application * * @param[in] dpy The display pointer (not used) * @param[in] ev The X event (not used) * * @return Always returns zero * *****************************************************************************/ static int die(Display *dpy, XErrorEvent *ev) { low_die(); return 0; } /******************************************************************************/ /** * @brief Wrapper for kill * * Callback function passed to X for when error occurs. This terminates the * linked application * * @param[in] dpy The display pointer (not used) * * @return Always returns zero * *****************************************************************************/ static int die2(Display *dpy) { low_die(); return 0; } /******************************************************************************/ /** * @brief Wrapper for kill * * Callback function attached as a signal handler. This terminates the * linked application * * @param[in] sig The signal (not used) * *****************************************************************************/ static void sigdie(int sig) { low_die(); } /******************************************************************************/ /** * Checks for X events and processes them. Returns when no more events left * to process. * * @param[in] command - The command to execute if play pressed. * * @return nothing * *****************************************************************************/ static void check_x_events(char * command) { int numEvents = XPending(dpy); while(numEvents > 0) { XEvent ev; XNextEvent(dpy, &ev); switch(ev.type) { case ButtonPress: if(ev.xbutton.button == 1) { buttonDown = 1; redraw(); /* do first gives quicker visual feedback */ XSync(dpy, False); my_start(command); } break; case ButtonRelease: if(buttonDown) { buttonDown = 0; redraw(); } break; case Expose: if(ev.xexpose.count) { break; } case ResizeRequest: case MapNotify: redraw(); break; default: D("Unknown event %d\n",ev.type); break; } /* If this is the last of this batch, check that more havent * been added in the meantime as a result of an action */ numEvents--; if(numEvents == 0) { numEvents = XPending(dpy); } } } /******************************************************************************/ /** * @brief Normalise window co-ordinates * * Given initial width & height of the window containing the buttons * limit the width and aspect ratio and place in the center of the * window (calculate x & y) * * @param[in,out] width The width before and after * @param[in,out] height The height before and after * @param[out] x The x co-ordinate after * @param[out] y The y co-ordinate after * ******************************************************************************/ static void normalise_window_coords(unsigned * width, unsigned * height, int * x, int * y) { unsigned w = *width; unsigned h = *height; if(flags & H_FILL) /* Dont bother if user wants to fill the window */ { *x = *y = 0; return; } if((w > MAX_BUTTON_SIZE) & !(flags & H_MAXASPECT)) { w = MAX_BUTTON_SIZE; } /* Keep the link button in a square window */ if(h < w) { w = h; } else if(h > w) { h = w; } *x = (int) (*width - w)/2; *y = (int) (*height - h)/2; *height = h; *width = w; } /******************************************************************************/ /** * @brief Check incoming pipe * * Check to see if new window size information has arrived from plugin and if * so resize the button accordingly * ******************************************************************************/ static void check_pipe_fd_events(void) { NPWindow wintmp; int n; int x, y; unsigned w, h; D("Got pipe_fd data, pipe_fd=%d\n", pipe_fd); n = read(pipe_fd, ((char *)& wintmp), sizeof(wintmp)); if (n < 0) { if (errno == EINTR) { return; } exit(EX_UNAVAILABLE); } if (n == 0) { exit(EX_UNAVAILABLE); } if (n != sizeof(wintmp)) { return; } parentDetails.window = (Window) wintmp.window; parentDetails.x = wintmp.x; parentDetails.y = wintmp.y; parentDetails.width = wintmp.width; parentDetails.height = wintmp.height; /* Adjust the width & height to compensate for the window border width */ w = (unsigned) wintmp.width - 2 * WINDOW_BORDER_WIDTH; h = (unsigned) wintmp.height - 2 * WINDOW_BORDER_WIDTH; normalise_window_coords(&w, &h, &x, &y); D("Linker window: x=%i, y=%i, w=%u, h=%u\n", x, y, w, h); XMoveResizeWindow(dpy, topLevel, x, y, w, h); } /******************************************************************************/ /** * @brief Exit early * * Called if we exit main() early because of invalid passed argument into * the main function. print to both debug and stderr (just in case someone * called mozplugger-linker directly) * *****************************************************************************/ static void exitEarly(void) { D("Invalid parameters passed to Linker - linker exiting\n"); fprintf(stderr,"MozPlugger version " VERSION " linker application.\n" "Please see 'man mozplugger' for details.\n"); exit(1); } /******************************************************************************/ /** * @brief main * * mozplugger-linker takes two arguments. The first is a shell command line * to run when the 'play' button is pressed (or if autostart is set). The second * parameter is optional and is the ID of the parent window into which to draw * the button. * * @param[in] argc The number of arguments * @param[in] argv Array of the arguments * * @return Never returns unless the application exits * ******************************************************************************/ int main(int argc, char **argv) { int old_pid; unsigned long temp = 0; int x, y; unsigned int width, height; char * command; int i; XColor colour; XClassHint classhint; XSetWindowAttributes attr; XSizeHints wmHints; D("Linker started.....\n"); if (argc < 3) { exitEarly(); } i = sscanf(argv[1],"%d,%d,%d,%lu,%d,%d,%d,%d", &flags, &repeatsResetVal, &pipe_fd, &temp, (int *)&parentDetails.x, (int *)&parentDetails.y, (unsigned int *)&parentDetails.width, (unsigned int *)&parentDetails.height); if(i < 8) { exitEarly(); } parentDetails.window = (Window)temp; command = argv[2]; D("LINKER: %s %s %s %s\n", argv[0], argv[1], getenv("file"), command); if(argc > 3) { nextHelper = argv[3]; } else { nextHelper = NULL; } /* The application will use the $repeat variable */ if (flags & H_REPEATCOUNT) { repeatsResetVal = 1; } if(!(dpy = XOpenDisplay(getenv("DISPLAY")))) { D("%s: unable to open display %s\n", argv[0], XDisplayName(getenv("DISPLAY"))); exitEarly(); } /* Adjust the width & height to compensate for the window border * width */ width = parentDetails.width - 2 * WINDOW_BORDER_WIDTH; height = parentDetails.height - 2 * WINDOW_BORDER_WIDTH; /* x, y co-ords of the parent is of no interest, we need to know * the x, y relative to the parent. */ normalise_window_coords(&width, &height, &x, &y); D("Linker window: x=%i, y=%i, w=%u, h=%u\n", x, y, width, height); wmHints.x=0; wmHints.y=0; wmHints.min_width = MIN_BUTTON_SIZE; wmHints.min_height = MIN_BUTTON_SIZE; wmHints.base_width = DEFAULT_BUTTON_SIZE; wmHints.base_height = DEFAULT_BUTTON_SIZE; wmHints.flags=PPosition | USPosition | PMinSize; attr.border_pixel = 0; attr.background_pixel = WhitePixelOfScreen(DefaultScreenOfDisplay(dpy)); attr.event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask; attr.override_redirect=0; topLevel = XCreateWindow(dpy, parentDetails.window, x, y, width, height, WINDOW_BORDER_WIDTH, CopyFromParent, InputOutput, (Visual *) CopyFromParent, (unsigned long)(CWBorderPixel| CWEventMask| CWOverrideRedirect| CWBackPixel), &attr); classhint.res_name = "mozplugger-linker"; classhint.res_class = "mozplugger-linker"; XSetClassHint(dpy, topLevel, &classhint); XStoreName(dpy, topLevel, "mozplugger-linker"); gc_black=XCreateGC(dpy,topLevel,0,0); XSetForeground(dpy,gc_black,BlackPixel(dpy,DefaultScreen(dpy))); gc_white=XCreateGC(dpy,topLevel,0,0); XSetForeground(dpy,gc_white,WhitePixel(dpy,DefaultScreen(dpy))); gc_onColor=XCreateGC(dpy,topLevel,0,0); colour.red=0x0000; colour.green=0xa000; colour.blue=0x0000; colour.pixel=0; colour.flags=0; XAllocColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), &colour); XSetForeground(dpy,gc_onColor,colour.pixel); gc_offColor=XCreateGC(dpy,topLevel,0,0); colour.red=0x8000; colour.green=0x8000; colour.blue=0x8000; colour.pixel=0; colour.flags=0; XAllocColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), &colour); XSetForeground(dpy,gc_offColor,colour.pixel); XSetWMNormalHints(dpy, topLevel, &wmHints); /* Map the window, if the parent has asked for redirect this does nothing * (i.e. if swallow has been used in mozplugger.c) */ XMapWindow(dpy, topLevel); XSetIOErrorHandler(die2); XSetErrorHandler(die); old_pid=pid; redirect_SIGCHLD_to_fd(); signal(SIGHUP, sigdie); signal(SIGINT, sigdie); signal(SIGTERM, sigdie); while(1) { fd_set fds; int maxFd; int sig_chld_fd; if(pid != old_pid) { redraw(); old_pid=pid; } check_x_events(command); FD_ZERO(&fds); FD_SET(ConnectionNumber(dpy),&fds); FD_SET(pipe_fd,&fds); maxFd = MAX(ConnectionNumber(dpy), pipe_fd); sig_chld_fd = get_SIGCHLD_fd(); if(sig_chld_fd >= 0) { FD_SET(sig_chld_fd, &fds); maxFd = MAX(maxFd, sig_chld_fd); } D("SELECT IN maxFd = %i\n", maxFd); if( select(maxFd + 1, &fds, NULL, NULL, 0) > 0) { if (FD_ISSET(pipe_fd, &fds)) { check_pipe_fd_events(); } if(FD_ISSET(sig_chld_fd, &fds)) { handle_SIGCHLD_event(); } } D("SELECT OUT\n"); if(pid != -1) { int status; if(waitpid(pid, &status, WNOHANG) > 0) { if(pid > 0) { pid = -1; if(repeats > 0) { my_start(command); } } } } } } mozplugger-1.14.5/mozplugger.spec0000600000175000001440000000265011722504427016101 0ustar peterusers%define name mozplugger %define version 1.14.4 %define release 1 Summary: A generic mozilla plug-in Name: %{name} Version: %{version} Release: %{release} Source0: http://mozdev.mirrors.nyphp.org/mozplugger/%{name}-%{version}.tar.gz Patch0: Makefile.patch License: GPL Group: Networking/WWW BuildRoot: %{_tmppath}/%{name}-buildroot Requires: m4 URL: http://mozplugger.mozdev.org/ %description MozPlugger is a generic Mozilla plug-in that allows the use of standard Linux programs as plug-ins for media types on the Internet. %pre %ifarch x86_64 if [ ! -d /usr/lib64/mozilla ]; then ln -s /usr/lib64/mozilla-* /usr/lib/mozilla fi %else if [ ! -d /usr/lib/mozilla ]; then ln -s /usr/lib/mozilla-* /usr/lib/mozilla fi %endif %prep %setup -q %patch0 -p1 %build make linux %install make install root=$RPM_BUILD_ROOT %clean rm -rf %{buildroot} %files %defattr(-,root,root) %config /etc/mozpluggerrc %{_bindir}/* %ifarch x86_64 /usr/lib64/mozilla/plugins/mozplugger.so %else /usr/lib/mozilla/plugins/mozplugger.so %endif %{_mandir}/man7/mozplugger.7* %changelog * Mon Feb 20 2006 William Bell - Modified to allow 64bit version to be built. * Mon Dec 20 2004 Louis Bavoil - removed dependency with Mozilla. * Mon Feb 2 2004 MATSUURA Takanori - rebuilt from spec file in mozplugger-1.5.0.tar.gz - mozpluggerrc is packed as config file. - added URL to spec file # end of file mozplugger-1.14.5/COPYING0000600000175000001440000004307611722504427014074 0ustar peterusers GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, 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 Appendix: 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) 19yy 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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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 Library General Public License instead of this License. mozplugger-1.14.5/mozplugger-common.c0000600000175000001440000000473111722504427016661 0ustar peterusers/***************************************************************************** * * Original Author: Fredrik Hübinette * * Current Authors: Louis Bavoil * Peter Leese * * This code is based on and is a branch of plugger written * by Fredrik Hübinette * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * *****************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "mozplugger.h" #include "debug.h" /*****************************************************************************/ /** * @brief Wrapper for kill * * Adaptive kill(), keep calling kill with higher and higher signal level, * * NOTE: kill return zero on successfully sending the signal so the code * only exits the nested ifs when kill no longer can send the signal! * * @param[in] pid The process ID of process to kill * *****************************************************************************/ void my_kill(pid_t pid) { int status; D("Killing PID %d with SIGTERM\n", pid); if (!kill(pid, SIGTERM)) /* '!kill' == true if signal sent! */ { usleep(KILL_TIMEOUT_USEC); D("Killing PID %d with SIGTERM\n", pid); if (!kill(pid, SIGTERM)) { usleep(KILL_TIMEOUT_USEC); D("Killing PID %d with SIGTERM\n", pid); if (!kill(pid, SIGTERM)) { D("Killing PID %d with SIGKILL\n", pid); kill(pid, SIGKILL); } } } D("Waiting for sons\n"); while (waitpid(-1, &status, WNOHANG) > 0); } mozplugger-1.14.5/mozplugger.c0000600000175000001440000030052311722504427015371 0ustar peterusers/***************************************************************************** * * Original author: Fredrik Hübinette * * Current Authors: Louis Bavoil * Peter Leese * * This code is based on and is a branch of plugger written * by Fredrik Hübinette * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "mozplugger.h" #include "debug.h" #include "npn-get-helpers.h" #ifndef __GNUC__ #define __inline #endif #define CHUNK_SIZE (8196) /***************************************************************************** * Type declarations *****************************************************************************/ /** Element of fixed size array created when parsing NPP_New call */ typedef struct argument { char *name; char *value; } argument_t; /** Data associated with an instance of an embed object, can be more than * one */ typedef struct data { Display *display; char *displayname; NPWindow windata; pid_t pid; int commsPipeFd; int repeats; unsigned int cmd_flags; /**< flags associated with command selected */ const char *command; /**< command to execute */ const char *winname; /**< Window name used by app */ unsigned int mode_flags; /**< flags associated with browser calls */ char *mimetype; char *href; /**< If QT this is set to handle special case */ char *url; /**< The URL */ char browserCantHandleIt; /**< Is set if browser cant handle protocol */ char *urlFragment; int tmpFileFd; /**< File descriptor of temp file */ const char * tmpFileName; /**< Name of the temp file */ int tmpFileSize; /**< Size of temp file so far */ char autostart; char autostartNotSeen; int num_arguments; struct argument *args; } data_t; /** Element of linked list of mimetypes created when parsing config file */ typedef struct mimetype { const char * type; struct mimetype * pNext; } mimetype_t; /** Element of linked list of commands created when parsing config file */ typedef struct command { int flags; const char * cmd; const char * winname; const char * fmatchStr; struct command * pNext; } command_t; /** Element of linked list of handlers created when parsing config file */ typedef struct handle { mimetype_t * types; command_t * cmds; struct handle * pNext; } handler_t; typedef struct { char name[SMALL_BUFFER_SIZE]; short exists; } cacheEntry_t; typedef struct { struct NPObject objHead; NPP assocInstance; } our_NPObject_t; /***************************************************************************** * Global variables *****************************************************************************/ static const char *errMsg = NULL; static const char *config_fname; static const char *helper_fname; static const char *controller_fname; static const char *linker_fname; static handler_t * handlers = 0; static NPBool browserSupportsXEmbed; static char staticPool[MAX_STATIC_MEMORY_POOL]; static int staticPoolIdx = 0; static NPClass pluginClass; /*****************************************************************************/ /** * Wrapper for putenv(). Instead of writing to the envirnoment, the envirnoment * variables are written to a buffer. * * @param[in,out] buffer The buffer where the envirnoment variables are written * @param[in,out] offset The current position in the buffer * @param[in] var The name of the environment variable * @param[in] value The value of the environment variable * * @return none * *****************************************************************************/ static void my_putenv(char *buffer, int *offset, const char *var, const char *value) { if(value) { const int l = strlen(var) + strlen(value) + 2; if (*offset + l >= ENV_BUFFER_SIZE) { D("Buffer overflow in putenv(%s=%s)\n", var, value); return; } snprintf(buffer+*offset, l, "%s=%s", var, value); putenv(buffer+*offset); *offset += l; } else { D("putenv did nothing, no value for %s\n", var); } } /*****************************************************************************/ /** * Wrapper for execlp() that calls the helper. * * WARNING: This function runs in the daughter process so one must assume the * daughter uses a copy (including) heap memory of the parent's memory space * i.e. any write to memory here does not affect the parent memory space. * Since Linux uses copy-on-write, best leave memory read-only and once execlp * is called, all daughter memory is wiped anyway (except the stack). * * @param[in] THIS Pointer to the data associated with this instance of the * plugin * @param[in] file The url of the embedded object * @param[in] pipeFd The file descriptor of the pipe to the helper application * * @return none * *****************************************************************************/ static void run(data_t * const THIS, const char *file, int pipeFd) { char buffer[ENV_BUFFER_SIZE]; char foo[SMALL_BUFFER_SIZE]; int offset = 0; int i; unsigned int flags = THIS->cmd_flags; int autostart = THIS->autostart; const char * launcher = NULL; const char * nextHelper = NULL; /* If there is no window to draw the controls in then * dont use controls -> mozdev bug #18837 */ if(THIS->windata.window == 0) { if(flags & (H_CONTROLS | H_LINKS)) { D("Cannot use controls or link button as no window to draw" " controls in\n"); flags &= ~(H_CONTROLS | H_LINKS); } } /* If no autostart seen and using controls dont autostart by default */ if ((flags & (H_CONTROLS | H_LINKS)) && (THIS->autostartNotSeen)) { autostart = 0; } snprintf(buffer, sizeof(buffer), "%d,%d,%d,%lu,%d,%d,%d,%d", flags, THIS->repeats, pipeFd, (unsigned long int) THIS->windata.window, (int) THIS->windata.x, (int) THIS->windata.y, (int) THIS->windata.width, (int) THIS->windata.height); offset = strlen(buffer)+1; snprintf(foo, sizeof(foo), "%lu", (long unsigned)THIS->windata.window); my_putenv(buffer, &offset, "window", foo); snprintf(foo, sizeof(foo), "0x%lx", (long unsigned)THIS->windata.window); my_putenv(buffer, &offset, "hexwindow", foo); snprintf(foo, sizeof(foo), "%ld", (long)THIS->repeats); my_putenv(buffer, &offset, "repeats", foo); snprintf(foo, sizeof(foo), "%ld", (long)THIS->windata.width); my_putenv(buffer, &offset, "width", foo); snprintf(foo, sizeof(foo), "%ld", (long)THIS->windata.height); my_putenv(buffer, &offset, "height", foo); my_putenv(buffer, &offset, "mimetype", THIS->mimetype); my_putenv(buffer, &offset, "file", file); my_putenv(buffer, &offset, "fragment", THIS->urlFragment); my_putenv(buffer, &offset, "autostart", autostart ? "1" : "0"); my_putenv(buffer, &offset, "winname", THIS->winname); my_putenv(buffer, &offset, "DISPLAY", THIS->displayname); for (i = 0; i < THIS->num_arguments; i++) { my_putenv(buffer, &offset, THIS->args[i].name, THIS->args[i].value); } if(flags & H_CONTROLS) { launcher = controller_fname; } else if(flags & H_LINKS) { launcher = linker_fname; } else if(!autostart && !(flags & H_AUTOSTART) && (THIS->windata.window != 0)) { /* Application doesn't do autostart and autostart is false and * we have a window to draw in */ nextHelper = helper_fname; launcher = linker_fname; } else { launcher = helper_fname; } if(launcher == 0) { D("No launcher defined"); _exit(EX_UNAVAILABLE); /* Child exit, that's OK */ } D("Executing helper: %s %s %s %s %s %s\n", launcher, buffer, file, THIS->displayname, THIS->command, THIS->mimetype); if(nextHelper) { execlp(launcher, launcher, buffer, THIS->command, nextHelper, NULL); } else { execlp(launcher, launcher, buffer, THIS->command, NULL); } D("EXECLP FAILED!\n"); _exit(EX_UNAVAILABLE); /* Child exit, that's OK */ } /*****************************************************************************/ /** * Check if 'file' is somewhere to be found in the user PATH. Performs a stat * of the path/file to see if the file exists * * @param[in] path The path part of the whole path/file name * @param[in] file The file part of the whole path/file name * * @return 1(true) if in path, 0(false) if not * *****************************************************************************/ static int inpath(const char *path, const char *file) { int start, i; const int fileLen = strlen(file); start = i = 0; do { /* Reached separator or end of $PATH? */ if((path[i] == ':') || (path[i] == '\0')) { /* Split out the individual path */ const int pathLen = i-start; if((pathLen > 0) && (pathLen + fileLen + 2 < 1024)) { char buf[1024]; struct stat filestat; strncpy(buf, &path[start], pathLen); /* if individual path doesnt end with slash, add one */ if(buf[pathLen-1] != '/') { buf[pathLen] = '/'; strcpy(&buf[pathLen+1], file); } else { strcpy(&buf[pathLen], file); } /* Check if file exists */ if (stat(buf, &filestat) == 0) { D("stat(%s) = yes\n", buf); return 1; } D("stat(%s) = no\n", buf); } if(path[i] == '\0') { return 0; } start = i+1; /* Move start forward, skipping the ':' */ } i++; } while(1); } /*****************************************************************************/ /** * String dup function that correctly uses NPN_MemAlloc as opposed to malloc * * WARNING, this function will not work if directly or indirectly called from * NPP_GetMimeDescription. * * @param[in] str The string to duplicate * * @return Pointer to the duplicate. * *****************************************************************************/ static char * NP_strdup(const char * str) { const int len = strlen(str); char * dupStr = NPN_MemAlloc(len + 1); if(dupStr != NULL) { strcpy(dupStr, str); } else { D("NPN_MemAlloc failed, size=%i\n", len+1); } return dupStr; } /*****************************************************************************/ /** * Check if 'file' exists. Uses a cache of previous finds to avoid performing * a stat call on the same file over and over again. * * @param[in] file The file to find * * @return 1(true) if in path, 0(false) if not * *****************************************************************************/ static int find(const char *file) { static cacheEntry_t cache[FIND_CACHE_SIZE]; static int cacheSize = 0; static int cacheHead = 0; struct stat filestat; int i; int exists = 0; D("find(%s)\n", file); for(i = 0; i < cacheSize; i++) { if( strcmp(cache[i].name, file) == 0) { const int exists = cache[i].exists; D("find cache hit exists = %s\n", exists ? "yes" : "no"); return exists; } } if (file[0] == '/') { exists = (stat(file, &filestat) == 0); } else { /* Get the environment variable PATH */ const char *env_path = getenv("PATH"); if(env_path == NULL) { D("No $PATH\n"); exists = 0; } else { exists = inpath(env_path, file); } } strncpy(cache[cacheHead].name, file, SMALL_BUFFER_SIZE); cache[cacheHead].name[SMALL_BUFFER_SIZE-1] = '\0'; cache[cacheHead].exists = exists; cacheHead++; if(cacheHead > cacheSize) { cacheSize = cacheHead; } if(cacheHead >= FIND_CACHE_SIZE) /* Wrap around the head */ { cacheHead = 0; } return exists; } /*****************************************************************************/ /** * Allocate some memory from the static pool. We use a static pool for * the database because Mozilla can unload the plugin after use and this * would lead to memory leaks if we use the heap. * * @param[in] size The size of the memory to allocate * * @return Pointer to the memory allocated or NULL * *****************************************************************************/ static void * allocStaticMem(int size) { void * retVal; const int newIdx = staticPoolIdx + size; if(newIdx > MAX_STATIC_MEMORY_POOL) { D("Out of static memory"); errMsg = "MozPlugger: config file mozpluggerrc is too big - delete" \ "some handlers/commands or mimetypes"; fprintf(stderr, "%s\n", errMsg); return NULL; } retVal = &staticPool[staticPoolIdx]; staticPoolIdx = newIdx; return retVal; } /*****************************************************************************/ /** * Make a dynamic string static by copying to static memory. * Given a pointer to a string in temporary memory, return the same string * but this time stored in permanent (i.e. static) memory. Will only be deleted * when the plugin is unloaded by Mozilla. * * @param[in] str Pointer to the string * @param[in] len The length of the string * * @return Pointer to the copied string * *****************************************************************************/ static const char * makeStrStatic(const char * str, int len) { /* plus one for string terminator */ char * const buf = allocStaticMem(len + 1); if(buf) { strncpy(buf, str, len); buf[len] = '\0'; } return buf; } /*****************************************************************************/ /** * get parameter from mozpluggerrc. Match a word to a flag that takes a * parameter e.g. swallow(name). * * @param[in] x Pointer to position in text being parsed * @param[in] flag Pointer to flag being checked for * @param[out] c Pointer to the found parameter * * @return Pointer to new position in text being parsed or NULL if error * *****************************************************************************/ static char *get_parameter(char *x, const char *flag, const char **c) { char *end; int len; /* skip spaces or tabs between flag name and parameter */ while ((*x == ' ' || *x == '\t')) { x++; } if (*x != '(') { D("Config error - expected '(' after '%s'\n", flag); errMsg = "MozPlugger: syntax error in mozpluggerrc config file"; fprintf(stderr, "%s - expected '(' after '%s'\n", errMsg, flag); return NULL; } x++; end = strchr(x,')'); if (end) { len = end - x; /* Cant use NPN_MemAlloc in NPP_GetMimeDescription, use * makeStrStatic as opposed to strdup otherwise we get a * memory leak */ *c = makeStrStatic(x, len); /* No need to test if NULL as test done else where */ x = end+1; } else { D("Config error - expected ')'\n"); errMsg = "MozPlugger: syntax error in mozpluggerrc config file"; fprintf(stderr, "%s - expected ')' found nothing\n", errMsg); return NULL; } return x; } /*****************************************************************************/ /** * Checks if 'line' starts with 'kw' (keyword), if 'line' is longer than 'kw', * checks that there is not an additional alpha-numeric letter in the 'line' * after the 'kw'. * * @param[in] line The input text line being parsed * @param[in] kw The keyword to match against * * @return 1(true) if match, 0(false) if not * *****************************************************************************/ __inline static int match_word(const char *line, const char *kw) { const unsigned kwLen = strlen(kw); return (strncasecmp(line, kw, kwLen) == 0) && !isalnum(line[kwLen]); } /*****************************************************************************/ /** * Parse for flags. Scan a line for all the possible flags. * * @param [in,out] x The position in the line that is being parsed * (before & after) * @param[in,out] commandp The data structure to hold the details found * * @return 1(true) if sucessfully parsed, 0(false) otherwise * *****************************************************************************/ static int parse_flags(char **x, command_t *commandp) { typedef struct { const char *name; unsigned int value; } flag_t; const static flag_t flags[] = { { "repeat", H_REPEATCOUNT }, { "loop", H_LOOP }, { "stream", H_STREAM }, { "ignore_errors", H_IGNORE_ERRORS }, { "exits", H_DAEMON }, { "nokill", H_DAEMON }, { "maxaspect", H_MAXASPECT }, { "fill", H_FILL }, { "noisy", H_NOISY }, { "embed", H_EMBED }, { "noembed", H_NOEMBED }, { "links", H_LINKS }, { "controls", H_CONTROLS }, { "swallow", H_SWALLOW }, { "fmatch", H_FMATCH }, { "autostart", H_AUTOSTART }, { "needs_xembed", H_NEEDS_XEMBED }, { "hidden", 0 }, /* Deprecated */ { NULL, 0 } }; const flag_t *f; for (f = flags; f->name; f++) { if (match_word(*x, f->name)) { *x += strlen(f->name); commandp->flags |= f->value; /* Get parameter for thoses commands with parameters */ if(f->value & H_SWALLOW) { char * p = get_parameter(*x, f->name, &commandp->winname); if(p) { *x = p; return 1; } } else if(f->value & H_FMATCH) { char * p = get_parameter(*x, f->name, &commandp->fmatchStr); if(p) { *x = p; return 1; } } else { return 1; } } } return 0; } /*****************************************************************************/ /** * Read the configuration file into memory. * * @param[in] f The FILE pointer * *****************************************************************************/ static void read_config(FILE *f) { int num_handlers = 0; handler_t * prev_handler = NULL; handler_t * handler = NULL; command_t * cmd = NULL; command_t * prev_cmd = NULL; mimetype_t * type = NULL; mimetype_t * prev_type = NULL; char buffer[LARGE_BUFFER_SIZE]; char file[SMALL_BUFFER_SIZE]; int seen_commands = 0; /* Force the creation of first handler */ D("read_config\n"); handler = (handler_t *) allocStaticMem(sizeof(handler_t)); if(handler == NULL) { return; } memset(handler, 0, sizeof(handler_t)); while (fgets(buffer, sizeof(buffer), f)) { if (buffer[0] == '\n' || buffer[0] == '\0') { continue; } D("::: %s", buffer); if (buffer[0] == '#') { continue; } if (buffer[strlen(buffer)-1] == '\n') { buffer[strlen(buffer)-1] = 0; } if (!isspace(buffer[0])) { /* Mime type */ if (seen_commands) { /* Store details of previous handler, if it has something * to offer */ if(handler->cmds && handler->types) { /* Add at end of link list so this is the last */ if(prev_handler) { /* Add to end of linked list of handlers */ prev_handler->pNext = handler; } else { /* Add at header of link list of handlers */ handlers = handler; } /* Remember the current end of linked list */ prev_handler = handler; num_handlers++; } else { /* else - notice we dont free the static memory this is so * we always reserve same amount of memory irrespect of * what applications are currently installed */ D("previous handler has no commands, so dropped\n"); } D("------------ Starting new handler ---------\n"); handler = (handler_t *) allocStaticMem(sizeof(handler_t)); if(handler == 0) { return; } memset(handler, 0, sizeof(handler_t)); prev_type = NULL; prev_cmd = NULL; seen_commands = 0; } D("New mime type\n"); type = (mimetype_t *) allocStaticMem(sizeof(mimetype_t)); if(type == 0) { continue; } memset(type, 0, sizeof(mimetype_t)); /* Cant use NPN_MemAlloc in NPP_GetMimeDescription, use * makeStrStatic as opposed to strdup otherwise we get a * memory leak */ type->type = makeStrStatic(buffer, strlen(buffer)); if(type->type == 0) { continue; } if(prev_type) { /* Add to end of linked list of handlers */ prev_type->pNext = type; } else { /* Add at header of link list of handlers */ handler->types = type; } /* Remember the current end of linked list */ prev_type = type; } else { /* Command */ char *x = buffer + 1; while (isspace(*x)) { x++; } if (!*x) { D("Empty command.\n"); seen_commands = 1; continue; } D("New command\n"); seen_commands = 1; cmd = (command_t *) allocStaticMem(sizeof(command_t)); if(cmd == NULL) { continue; } memset(cmd, 0, sizeof(command_t)); D("Parsing %s\n", x); while (*x != ':' && *x) { if (*x == ',' || *x == ' ' || *x == '\t') { x++; } else if (!parse_flags(&x, cmd)) { D("Config error - unknown directive %s\n", x); errMsg = "MozPlugger: syntax error in mozpluggerrc config file"; fprintf(stderr, "%s - unknown directive: %s\n", errMsg, x); x += strlen(x); } } if (*x == ':') { x++; while (isspace(*x)) { x++; } if (sscanf(x, "if %"SMALL_BUFFER_SIZE_STR"s", file) != 1 && sscanf(x, "%"SMALL_BUFFER_SIZE_STR"s", file) != 1) { continue; } if (!find(file)) { continue; } /* Use makeStrStatic as opposed to strdup otherwise we get a * memory leak */ cmd->cmd = makeStrStatic(x, strlen(x)); if(cmd->cmd == 0) { continue; } } else { D("No column? (%s)\n", x); continue; } if(prev_cmd) { /* Add to end of linked list of handlers */ prev_cmd->pNext = cmd; } else { /* Add at header of link list of handlers */ handler->cmds = cmd; } /* Remember the current end of linked list */ prev_cmd = cmd; } } if(handler->cmds && handler->types) { if(prev_handler) { prev_handler->pNext = handler; } else { handlers = handler; } num_handlers++; } else { /* else - notice we dont free the static memory this is so * we always reserve same amount of memory irrespect of * what applications are currently installed */ D("previous handler has no commands, so dropped\n"); } D("Num handlers: %d\n", num_handlers); } /*****************************************************************************/ /** * Find the config file or the helper file in function of the function cb. * * @param[in] basename File or app name (without path) * @param[in] cb Function pointer to function to call when helper found * * @return 1(true) if found, 0(false) if not * *****************************************************************************/ static int find_helper_file(const char *basename, int (*cb)(const char *)) { char fname[LARGE_BUFFER_SIZE]; char *tmp; D("find_helper_file '%s'\n", basename); if ((tmp = getenv("MOZPLUGGER_HOME"))) { snprintf(fname, sizeof(fname), "%s/%s", tmp, basename); if (cb(fname)) { return 1; } } if ((tmp = getenv("HOME"))) { snprintf(fname, sizeof(fname), "%s/.mozplugger/%s", tmp, basename); if (cb(fname)) { return 1; } snprintf(fname, sizeof(fname), "%s/.netscape/%s", tmp, basename); if (cb(fname)) { return 1; } snprintf(fname, sizeof(fname), "%s/.mozilla/%s", tmp, basename); if (cb(fname)) { return 1; } snprintf(fname, sizeof(fname), "%s/.opera/%s", tmp, basename); if (cb(fname)) { return 1; } } if ((tmp = getenv("MOZILLA_HOME"))) { snprintf(fname, sizeof(fname), "%s/%s", tmp, basename); if (cb(fname)) { return 1; } } if ((tmp = getenv("OPERA_DIR"))) { snprintf(fname, sizeof(fname), "%s/%s", tmp, basename); if (cb(fname)) { return 1; } } #ifdef SYSCONFDIR snprintf(fname, sizeof(fname), SYSCONFDIR "/%s", basename); if (cb(fname)) { return 1; } #else snprintf(fname, sizeof(fname), "/etc/%s", basename); if (cb(fname)) { return 1; } snprintf(fname, sizeof(fname), "/usr/etc/%s", basename); if (cb(fname)) { return 1; } #endif snprintf(fname, sizeof(fname), "/usr/local/mozilla/%s", basename); if (cb(fname)) { return 1; } snprintf(fname, sizeof(fname), "/usr/local/netscape/%s", basename); if (cb(fname)) { return 1; } if (cb(basename)) { return 1; } return 0; } /*****************************************************************************/ /** * Read config callback function. Open and run the configuration file (fname) * through M4 and then call read_config() to parse the output * * @param[in] fname Full name (and path) of configuration file * * @return 1(true) if success, 0(false) if not * ****************************************************************************/ static int read_config_cb(const char *fname) { int m4out[2]; pid_t pid; int fd; FILE *fp; fd = open(fname, O_RDONLY); if (fd < 0) { /* Not an error! */ D("READ_CONFIG(%s) - could not open\n", fname); return 0; } D("READ_CONFIG(%s) - file opened\n", fname); if (pipe(m4out) < 0) { D("Failed to create pipe\n"); perror("pipe"); return 0; } if ((pid = fork()) == -1) { D("Failed to fork\n"); return 0; } if (!pid) { close(m4out[0]); dup2(m4out[1], 1); close(m4out[1]); dup2(fd, 0); close(fd); execlp("m4", "m4", NULL); fprintf(stderr, "MozPlugger: Error: Failed to execute m4.\n"); exit(1); /* Child exit, that's OK */ } else { close(m4out[1]); close(fd); fp = fdopen(m4out[0], "r"); if (!fp) { D("Failed to open pipe\n"); return 0; } read_config(fp); fclose(fp); int status; waitpid(pid, &status, 0); D("M4 exit status was %i\n", WEXITSTATUS(status)); if(WEXITSTATUS(status) != 0) { errMsg = "Mozplugger: M4 parsing of config generated error"; fprintf(stderr, "%s\n",errMsg); D("%s\n", errMsg); } /* Use makeStrStatic as opposed to strdup otherwise we get a * memory leak */ config_fname = makeStrStatic(fname, strlen(fname)); /* No need to test config_fname is NULL, done elsewhere */ } return 1; } /*****************************************************************************/ /** * Find mozplugger helper app callback function. * Check if the helper executable exists (using stat), if so save the filename * to the global 'helper_fname' variable * * @param[in] fname Full application name (including path) * * @return 1(true) if success, 0(false) if not * *****************************************************************************/ static int find_plugger_helper_cb(const char *fname) { D("FIND_HELPER(%s)\n", fname); struct stat buf; if (stat(fname, &buf) != 0) { return 0; } /* Use makeStrStatic as opposed to strdup otherwise we get a * memory leak */ helper_fname = makeStrStatic(fname, strlen(fname)); /* No need to test helper_fname is NULL, done elsewhere */ return 1; } /*****************************************************************************/ /** * Find mozplugger helper app callback function. * Check if the helper executable exists (using stat), if so save the filename * to the global 'controller_fname' variable * * @param[in] fname Full application name (including path) * * @return 1(true) if success, 0(false) if not * *****************************************************************************/ static int find_plugger_controller_cb(const char *fname) { struct stat buf; if (stat(fname, &buf) != 0) { return 0; } /* Use makeStrStatic as opposed to strdup otherwise we get a * memory leak */ controller_fname = makeStrStatic(fname, strlen(fname)); /* No need to test controller_fname is NULL, done elsewhere */ return 1; } /*****************************************************************************/ /** * Find mozplugger helper app callback function. * Check if the helper executable exists (using stat), if so save the filename * to the global 'linker_fname' variable * * @param[in] fname Full application name (including path) * * @return 1(true) if success, 0(false) if not * *****************************************************************************/ static int find_plugger_linker_cb(const char *fname) { struct stat buf; if (stat(fname, &buf) != 0) { return 0; } /* Use makeStrStatic as opposed to strdup otherwise we get a * memory leak */ linker_fname = makeStrStatic(fname, strlen(fname)); /* No need to test linker_fname is NULL, done elsewhere */ return 1; } /*****************************************************************************/ /** * Find configuration file, helper and controller executables. Call the * appropriate xxx_cb function to handle the action (e.g. for configuration * file, the parsering and reading into memory). * * @return none * *****************************************************************************/ static void do_read_config(void) { if (handlers) { return; } D("do_read_config\n"); if (!find_helper_file("mozpluggerrc", read_config_cb)) { errMsg = "Mozplugger: Installation error - failed to locate mozpluggerrc"; fprintf(stderr, "%s\n",errMsg); D("%s\n", errMsg); return; } if (!find_helper_file("mozplugger-helper", find_plugger_helper_cb)) { if (find("mozplugger-helper")) { helper_fname = "mozplugger-helper"; } else { errMsg = "Mozplugger: Installation error - failed to locate mozplugger-helper"; fprintf(stderr, "%s\n",errMsg); D("%s\n", errMsg); return; } } if (!find_helper_file("mozplugger-controller", find_plugger_controller_cb)) { if (find("mozplugger-controller")) { controller_fname = "mozplugger-controller"; } else { errMsg = "Mozplugger: Installation error - failed to locate mozplugger-controller"; fprintf(stderr, "%s\n",errMsg); D("%s\n", errMsg); return; } } if (!find_helper_file("mozplugger-linker", find_plugger_linker_cb)) { if (find("mozplugger-linker")) { linker_fname = "mozplugger-linker"; } else { errMsg = "Mozplugger: Installation error - failed to locate mozplugger-linker"; fprintf(stderr, "%s\n",errMsg); D("%s\n", errMsg); return; } } D("do_read_config done\n"); } /*****************************************************************************/ /** * Check URL is safe. Since href's are passed to an app as an argument, just * check for ways that a shell can be tricked into executing a command. * * @param[in] name The name to check * @param[in] isURL Is the name a URL or filename? * * @return 1(true) if OK, 0(false) if not * *****************************************************************************/ static int safeName(const char* name, int isURL) { int i = 0; const int len = strlen(name); if ((name[0] == '/') && (isURL)) { D("safeName() - reject URL '%s' as starts with '/'\n", name); return 0; } for (i = 0; i < len; i++) { if (name[i] == '`' || name[i] == ';') { D("safeName() - reject '%s' as contains either ';' or '`'\n", name); /* Somebody's trying to do something naughty. */ return 0; } } return 1; } /*****************************************************************************/ /** * Extract the file name from the HTTP Headers (if present). This is passed * via the fragment environment variable to the helper application. Copy * a suitable filename for the URL to be used for the cached temporay file * name. * * @param[in] THIS Pointer to the instance data * @param[in] headers The HTTP headers to parse * @param[out] fileName The file Name extracted from the headers * * @return None * *****************************************************************************/ static void parseHeaders(data_t * const THIS, const char * headers, char * fileName, int maxFileNameLen) { const char * p = headers; if (!headers) { return; } while((p = strstr(p, "Content-Disposition:")) != NULL) { size_t len = strcspn(p, "\n\r"); const char * start = strstr(p, "filename=\""); if (len == 0) { break; } if((start ==0) || (start - p > len)) { p += len; continue; } start += strlen("filename=\""); len = len - (start - p) - 1; if(len > 0) { strncpy(fileName, start, len); fileName[len] = '\0'; } p += len; } } /*****************************************************************************/ /** * Extract the 'fragment' from the end of the URL if present. This is passed * via the fragment environment variable to the helper application. Copy * a suitable filename for the URL to be used for the cached temporay file * name. * * @param[in] THIS Pointer to the instance data * @param[in] url The URL to parse * @param[out] fileName The file Name extracted from the URL * * @return None * *****************************************************************************/ static void parseURL(data_t * const THIS, const char * url, char * fileName, int maxFileNameLen) { const char * frag = strchr(url, '#'); if(frag) { if(THIS->urlFragment) { D("parseURL - replacing previous fragment\n"); NPN_MemFree(THIS->urlFragment); } D("parseURL - fragment '%s' found at end of URL\n", &frag[1]); THIS->urlFragment = NP_strdup(&frag[1]); } if(fileName) { const char * end = strrchr(url, '?'); const char * start; int len; /* Find end or url (but dont include variable params or fragment */ if(!end) { if(frag) { end = frag; } else { end = &url[strlen(url)]; } } /* Work backwards to the first forward slash */ start = &end[-1]; while( (start > url) && (*start != '/')) { start--; } if(*start == '/') { start++; } len = end-start; if(len > maxFileNameLen) { start = end - maxFileNameLen; len = maxFileNameLen; } strncpy(fileName, start, len); fileName[len] = '\0'; } } /*****************************************************************************/ /** * See if the URL matches out match criteria. * * @param[in] matchStr The string to match * @param[in] url The url * * @return 1(true) if matched, zero otherwise * *****************************************************************************/ __inline static int match_url(const char * matchStr, const char * url) { int matchStrLen; const char * end; switch (matchStr[0]) { case '*': /* Does the URL start with the match String */ matchStr++; /* Step over the asterisk */ return (strncasecmp(matchStr, url, strlen(matchStr)) == 0); case '%': /* Does the URL end with the match String */ matchStr++; /* Step over the percent sign */ /* Need to find the end of the url, before any * extra params i.e'?=xxx' or '#yyy' */ end = strchr(url, '?'); if(end == NULL) { end = strchr(url, '#'); if(end == NULL) { end = &url[strlen(url)]; } } matchStrLen = strlen(matchStr); if(end - matchStrLen < url) { return 0; } return (strncasecmp(matchStr, end-matchStrLen, matchStrLen) == 0); default: /* Is the match string anywhere in the URL */ return (strstr(url, matchStr) != NULL); } } /*****************************************************************************/ /** * Go through the commands in the config file and find one that fits our needs. * * @param[in] THIS Pointer to the data associated with this instance of the * plugin * @param[in] streamOnly If true select entry sith stream set only * @param[in] c Pointer to command structure to match against * * @return 1(true) if match, else zero otherwise * *****************************************************************************/ __inline static int match_command(data_t * const THIS, int streamOnly, command_t *c) { #define MODE_MASK (H_NOEMBED | H_EMBED | H_LINKS) D("Checking command: %s\n", c->cmd); /* If command is specific to a particular mode... */ if (c->flags & MODE_MASK) { /* Check it matches the current mode... */ if ( (THIS->mode_flags & MODE_MASK) != (c->flags & MODE_MASK) ) { D("Flag mismatch: mode different %x != %x\n", THIS->mode_flags & MODE_MASK, c->flags & MODE_MASK); return 0; } } if ((c->flags & H_LOOP) && (THIS->repeats != MAXINT)) { D("Flag mismatch: loop\n"); return 0; } if (streamOnly && !(c->flags & H_STREAM)) { D("Flag mismatch: stream only required\n"); return 0; } if(c->fmatchStr) { if(!match_url(c->fmatchStr, THIS->url)) { D("fmatch mismatch: url '%s' doesnt have '%s'\n", THIS->url, c->fmatchStr); return 0; } } D("Match found!\n"); return 1; } /*****************************************************************************/ /** * See if mimetype matches. * * @param[in] THIS pointer to data associated with this instance of the * plugin * @param[in] m Mimetype to match against * * @return 1(true) if match, else zero otherwise * *****************************************************************************/ __inline static int match_mime_type(data_t * const THIS, mimetype_t *m) { char mimetype[SMALL_BUFFER_SIZE]; sscanf(m->type, "%"SMALL_BUFFER_SIZE_STR"[^:]", mimetype); sscanf(mimetype, "%s", mimetype); int retVal; if ((strcasecmp(mimetype, THIS->mimetype) != 0) && (strcmp(mimetype,"*") != 0)) { retVal = 0; } else { retVal = 1; } D("Checking '%s' ?= '%s', %s\n", mimetype, THIS->mimetype, retVal == 1 ? "same" : "different"); return retVal; } /*****************************************************************************/ /** * See if handler matches. * * @param[in] h Pointer to handler to match against * @param[in] THIS Pointer to data associated with this instance of plugin * @param[in] streamOnly If True select only entry with stream flag * * @return 1(true) if match, else zero otherwise * *****************************************************************************/ __inline static int match_handler(handler_t *h, data_t * const THIS, int streamOnly) { mimetype_t *m; command_t *c; D("-------------------------------------------\n"); D("Commands for this handle at (%p):\n", h->cmds); m = h->types; while(m) { if (match_mime_type(THIS, m)) { c = h->cmds; while(c) { if (match_command(THIS, streamOnly, c)) { THIS->cmd_flags = c->flags; THIS->command = c->cmd; THIS->winname = c->winname; return 1; } c = c->pNext; } } m = m->pNext; } return 0; } /*****************************************************************************/ /** * Find the appropriate command * * @param[in] THIS Pointer to plugin instance data * @param[in] streamOnly If true select only the command with stream flag * * @return 1(true) if match, else zero otherwise * *****************************************************************************/ static int find_command(data_t * const THIS, int streamOnly) { handler_t * h; D("find_command...\n"); /* Reset any previous command we may have found */ THIS->command = 0; THIS->cmd_flags = 0; THIS->winname = 0; do_read_config(); h = handlers; while(h) { if (match_handler(h, THIS, streamOnly)) { D("Command found.\n"); return 1; } h = h->pNext; } D("No command found.\n"); return 0; } /*****************************************************************************/ /** * NPP get Mime decription * Construct a MIME Description string for netscape so that mozilla shall know * when to call us back. * * @return Pointer to string containing mime decription for this plugin * *****************************************************************************/ const char *NPP_GetMIMEDescription(void) { char *x,*y; handler_t *h; mimetype_t *m; int size_required; D("NPP_GetMIMEDescription()\n"); do_read_config(); { const int free = MAX_STATIC_MEMORY_POOL - staticPoolIdx; D("Static Pool used=%i, free=%i\n", staticPoolIdx, free); } size_required = 0; h = handlers; while(h) { m = h->types; while(m) { size_required += strlen(m->type)+1; m = m->pNext; } h = h->pNext; } D("Size required=%d\n", size_required); if (!(x = (char *)malloc(size_required+1))) { return 0; } D("Malloc did not fail\n"); y = x; h = handlers; while(h) { m = h->types; while(m) { memcpy(y,m->type,strlen(m->type)); y+=strlen(m->type); *(y++)=';'; m = m->pNext; } h = h->pNext; } if (x != y) { y--; } *(y++) = 0; D("Getmimedescription done: %s\n", x); return (const char *)x; } /*****************************************************************************/ /** * Provides plugin HasMethod that can be called from broswer * * @return True if has that method * *****************************************************************************/ static void debugLogIdentifier(NPIdentifier name) { if(NPN_IdentifierIsString(name)) { char * str = NPN_UTF8FromIdentifier(name); D("NPIdentifier = %s\n", str ? (char *)str : "NULL"); NPN_MemFree(str); } else { D("NPIdentifier = %i\n", NPN_IntFromIdentifier(name)); } } /*****************************************************************************/ /** * Provides plugin HasMethod that can be called from broswer * * @return True if has that method * *****************************************************************************/ bool NPP_HasMethod(NPObject *npobj, NPIdentifier name) { D("NPP_HasMethod called\n"); debugLogIdentifier(name); return 0; } /*****************************************************************************/ /** * Provides plugin Invoke that can be called from broswer * * @return True if method was invoked * *****************************************************************************/ bool NPP_Invoke(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result) { D("NPP_Invoke called\n"); debugLogIdentifier(name); return 0; } /*****************************************************************************/ /** * Provides plugin HasProperty that can be called from broswer * * @return True if has property * *****************************************************************************/ bool NPP_HasProperty(NPObject *npobj, NPIdentifier name) { bool retVal = 0; D("NPP_HasProperty called\n"); debugLogIdentifier(name); char * str = NPN_UTF8FromIdentifier(name); if(str) { if (strcasecmp("isplaying", str) == 0) { retVal = 1; } NPN_MemFree(str); } return retVal; } /*****************************************************************************/ /** * Provides plugin GetProperty that can be called from broswer * * @return True if got property * *****************************************************************************/ bool NPP_GetProperty(NPObject *npobj, NPIdentifier name, NPVariant *result) { bool retVal = 0; D("NPP_GetProperty called\n"); debugLogIdentifier(name); char * str = NPN_UTF8FromIdentifier(name); if(str) { if (strcasecmp("isplaying", str) == 0) { result->type = NPVariantType_Bool; result->value.boolValue = 0; retVal = 1; NPP instance = ((our_NPObject_t *)npobj)->assocInstance; if(instance) { data_t * THIS = instance->pdata; if (THIS) { if((THIS->commsPipeFd >= 0) || (THIS->pid > -1)) { int status; if(waitpid(THIS->pid, &status, WNOHANG) == 0) { /* If no status available from child then child * must still be running!? */ result->value.boolValue = 1; } } } } } NPN_MemFree(str); } return retVal; } /*****************************************************************************/ /** * Provides plugin SetProperty that can be called from broswer * * @return True if set property * *****************************************************************************/ bool NPP_SetProperty(NPObject *npobj, NPIdentifier name, const NPVariant *value) { D("NPP_SetProperty called\n"); debugLogIdentifier(name); return 0; } /*****************************************************************************/ /** * Get plugin Name * * @return Returns the Name of the plugin * *****************************************************************************/ static const char * getPluginName(void) { return "MozPlugger " VERSION " handles QuickTime and Windows Media Player Plugin"; } /*****************************************************************************/ /** * Get plugin Description * * @return Returns the Description of the plugin * *****************************************************************************/ static const char * getPluginDescription(void) { static char desc_buffer[8192]; const char * dbgPath = get_debug_path(); snprintf(desc_buffer, sizeof(desc_buffer), "MozPlugger version " VERSION #ifdef GCOV "(gcov)" #endif ", maintained by Louis Bavoil and Peter Leese, a fork of plugger" " written by Fredrik Hübinette.
" "For documentation on how to configure mozplugger, " "check the man page. (type man mozplugger)" " " " " " " " " " " "%s%s%s" "
Configuration file:%s
Helper binary:%s
Controller binary:%s
Link launcher binary:%s
%s" "
", config_fname ? config_fname : "Not found!", helper_fname ? helper_fname : "Not found!", controller_fname ? controller_fname : "Not found!", linker_fname ? linker_fname : "Not found!", dbgPath ? " Debug file:" : "", dbgPath ? dbgPath : "", dbgPath ? "/" DEBUG_FILENAME " " : "", errMsg ? errMsg : "" ); errMsg = NULL; return (const char *)desc_buffer; } /*****************************************************************************/ /** * Get plugin needs Xembed * * @return Returns True if Xembed required * *****************************************************************************/ static NPBool getPluginNeedsXembed(NPP instance, NPError *pErr) { data_t * this; if (instance == NULL) { *pErr = NPERR_GENERIC_ERROR; return 0; } this = instance->pdata; if(this == NULL) { *pErr = NPERR_GENERIC_ERROR; return 0; } if( ((this->cmd_flags & H_NEEDS_XEMBED) != 0) && browserSupportsXEmbed) { D("Plugin needs XEmbed\n"); return 1; } else { D("Plugin does not need XEmbed\n"); return 0; } } /*****************************************************************************/ /** * Create a JavaScript object * * @return Pointer to created object * *****************************************************************************/ static NPObject * NPP_AllocateObj(NPP instance, NPClass * aClass) { our_NPObject_t * pObj = NPN_MemAlloc(sizeof(our_NPObject_t)); pObj->assocInstance = instance; return (NPObject *) pObj; } /*****************************************************************************/ /** * Get plugin Scritable Object * * @return Returns True if Xembed required * *****************************************************************************/ static NPObject * getPluginScritableObject(NPP instance, NPError * pErr) { if (instance == 0) { *pErr = NPERR_GENERIC_ERROR; return 0; } D("Scritable object created..\n"); memset(&pluginClass, 0, sizeof(NPClass)); pluginClass.structVersion = NP_CLASS_STRUCT_VERSION; pluginClass.allocate = NPP_AllocateObj; pluginClass.hasMethod = NPP_HasMethod; pluginClass.invoke = NPP_Invoke; pluginClass.hasProperty = NPP_HasProperty; pluginClass.getProperty = NPP_GetProperty; pluginClass.setProperty = NPP_SetProperty; return NPN_CreateObject(instance, &pluginClass); } /*****************************************************************************/ /** * NPP Get value * Let Mozilla know things about mozplugger. This single function actually * covers two interface functions NP_GetValue and NPP_GetValue. The first is * called without an instance pointer (instance = future = null) and the second * with an instance pointer. The mozilla documentation is a bit confusing in this * respect. * * @param[in] instance Pointer to plugin instance data (or null if call came * though the NP_GetValue interface (as opposed to * NPP_GetValue) see NPAPI code if you need more details. * @param[in] variable Name of variable to get (enum) * @param[out] value The value got * * @return Returns error code if problem * *****************************************************************************/ NPError NPP_GetValue(void *instance, NPPVariable variable, void *value) { NPError err = NPERR_NO_ERROR; switch (variable) { case NPPVpluginNameString: D("NP_GetValue(NPPVpluginNameString)\n"); *((const char **)value) = getPluginName(); break; case NPPVpluginDescriptionString: D("NP_GetValue(NPPVpluginDescriptionString)\n"); *((const char **)value) = getPluginDescription(); break; case NPPVpluginNeedsXEmbed: D("NPP_GetValue(NPPVpluginNeedsXEmbed)\n"); #ifdef ALWAYS_NEEDS_XEMBED /* For Chromium always return 1 */ *((NPBool *)value) = 1; #else *((NPBool *)value) = getPluginNeedsXembed(instance, &err); #endif break; case NPPVpluginScriptableNPObject : D("NP_GetValue(NPPVpluginScriptableNPObject\n"); *((NPObject **)value) = getPluginScritableObject(instance, &err); break; default : { /* The following I've never seen in a NPP_GetValue call */ const char * varName; switch(variable) { case NPPVpluginWindowBool: varName = "NPPVpluginWindowBool"; break; case NPPVpluginTransparentBool: varName = "NPPVpluginTransparentBool"; break; case NPPVjavaClass: varName = "NPPVjavaClass"; break; case NPPVpluginWindowSize: varName = "NPPVpluginWindowSize"; break; case NPPVpluginTimerInterval: varName = "NPPVpluginTimerInterval"; break; case NPPVpluginScriptableInstance: varName = "NPPVpluginScriptableInstance"; break; case NPPVpluginScriptableIID: varName = "NPPVpluginScriptableIID"; break; case NPPVjavascriptPushCallerBool: varName = "NPPVjavascriptPushCallerBool"; break; case NPPVpluginKeepLibraryInMemory: varName = "NPPVpluginKeepLibraryInMemory"; break; case NPPVformValue: varName = "NPPVformValue"; break; case NPPVpluginUrlRequestsDisplayedBool: varName = "NPPVpluginUrlRequestsDisplayedBool"; break; case NPPVpluginWantsAllNetworkStreams: varName = "NPPVpluginWantsNetworkStreams"; break; case NPPVpluginNativeAccessibleAtkPlugId: varName = "NPPVpluginNativeAccessibleAtkPlugId"; break; case NPPVpluginCancelSrcStream: varName = "NPPVpluginCancelSrcStream"; break; case NPPVsupportsAdvancedKeyHandling: varName = "NPPVsupportsAdvancedKeyHandling"; break; case NPPVpluginUsesDOMForCursorBool: varName = "NPPVpluginUsesDOMForCursorBool"; break; default: varName = ""; break; } D("NPP_GetValue('%s' - %d) not implemented\n", varName, variable); } err = NPERR_GENERIC_ERROR; break; } return err; } /*****************************************************************************/ /** * NPP Set value * Let Mozilla set things on mozplugger. * * @param[in] instance Pointer to plugin instance data * @param[in] variable Name of variable to get (enum) * @param[in] value The value to set * * @return Returns error code if problem * *****************************************************************************/ NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) { NPError err = NPERR_NO_ERROR; switch (variable) { default: D("NPP_SetValue( %d) not implemented\n", variable); err = NPERR_GENERIC_ERROR; break; } return err; } /*****************************************************************************/ /** * Convert a string to an integer. * The string can be true, false, yes or no. * * @param[in] s String to convert * @param[in] my_true The value associated with true * @param[in] my_false The value associated with false * * @return The value * *****************************************************************************/ static int my_atoi(const char *s, int my_true, int my_false) { switch (s[0]) { case 't': case 'T': case 'y': case 'Y': return my_true; case 'f': case 'F': case 'n': case 'N': return my_false; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return atoi(s); } return -1; } /*****************************************************************************/ /** * NPP New * Initialize another instance of mozplugger. It is important to know * that there might be several instances going at one time. * * @param[in] pluginType Type of embedded object (mime type) * @param[in] instance Pointer to plugin instance data * @param[in] mode Embedded or not * @param[in] argc The number of associated tag attributes * @param[in] argn Array of attribute names * @param[in] argv Array of attribute values# * @param[in] saved Pointer to any previously saved data * * @return Returns error code if problem * *****************************************************************************/ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved) { int e; int src_idx = -1; int href_idx = -1; int data_idx = -1; int alt_idx = -1; int autostart_idx = -1; int autohref_idx = -1; int target_idx = -1; data_t * THIS; char *url = NULL; D("NPP_New(%s) - instance=%p\n", pluginType, instance); if (!instance) { return NPERR_INVALID_INSTANCE_ERROR; } if (!pluginType) { return NPERR_INVALID_INSTANCE_ERROR; } THIS = NPN_MemAlloc(sizeof(data_t)); if (THIS == NULL) { return NPERR_OUT_OF_MEMORY_ERROR; } instance->pdata = THIS; memset((void *)THIS, 0, sizeof(data_t)); /* Only initialise the non-zero fields */ THIS->pid = -1; THIS->commsPipeFd = -1; THIS->repeats = 1; THIS->autostart = 1; THIS->autostartNotSeen = 1; THIS->tmpFileFd = -1; if(mode == NP_EMBED) { THIS->mode_flags = H_EMBED; } else { THIS->mode_flags = H_NOEMBED; } if (!(THIS->mimetype = NP_strdup(pluginType))) { return NPERR_OUT_OF_MEMORY_ERROR; } THIS->num_arguments = argc; if (!(THIS->args = (argument_t *)NPN_MemAlloc( (uint32_t)(sizeof(argument_t) * argc)))) { return NPERR_OUT_OF_MEMORY_ERROR; } for (e = 0; e < argc; e++) { if (strcasecmp("loop", argn[e]) == 0) { THIS->repeats = my_atoi(argv[e], MAXINT, 1); } /* realplayer also uses numloop tag */ /* windows media player uses playcount */ else if((strcasecmp("numloop", argn[e]) == 0) || (strcasecmp("playcount", argn[e]) == 0)) { THIS->repeats = atoi(argv[e]); } else if((strcasecmp("autostart", argn[e]) == 0) || (strcasecmp("autoplay", argn[e]) == 0)) { autostart_idx = e; } /* get the index of the src attribute if this is a 'embed' tag */ else if (strcasecmp("src", argn[e]) == 0) { src_idx = e; } /* get the index of the data attribute if this is a 'object' tag */ else if (strcasecmp("data", argn[e]) == 0) { data_idx = e; } /* Special case for quicktime. If there's an href or qtsrc attribute, * remember it for now */ else if (((strcasecmp("href", argn[e]) == 0) || (strcasecmp("qtsrc", argn[e]) == 0)) && href_idx == -1) { href_idx = e; } else if (((strcasecmp("filename", argn[e]) == 0) || (strcasecmp("url", argn[e]) == 0) || (strcasecmp("location", argn[e]) == 0)) && alt_idx == -1) { alt_idx = e; } /* Special case for quicktime. If there's an autohref or target * attributes remember them for now */ else if (strcasecmp("target", argn[e]) == 0) { target_idx = e; } else if(strcasecmp("autohref", argn[e]) == 0) { autohref_idx = e; } /* copy the flag to put it into the environment later */ D("VAR_%s=%s\n", argn[e], argv[e]); { const int len = strlen(argn[e]) + 5; if (!(THIS->args[e].name = (char *)NPN_MemAlloc(len))) { return NPERR_OUT_OF_MEMORY_ERROR; } snprintf(THIS->args[e].name, len, "VAR_%s", argn[e]); THIS->args[e].value = argv[e] ? NP_strdup(argv[e]) : NULL; } } if (src_idx >= 0) { url = THIS->args[src_idx].value; /* Special case for quicktime. If there's an href or qtsrc * attribute, we want that instead of src but we HAVE to * have a src first. */ if (href_idx >= 0) { D("Special case QT detected\n"); THIS->href = THIS->args[href_idx].value; autostart_idx = autohref_idx; if(target_idx >= 0) { /* One of those clickable Quicktime linking objects! */ THIS->mode_flags &= ~(H_EMBED | H_NOEMBED); THIS->mode_flags |= H_LINKS; } } } else if (data_idx >= 0) { D("Looks like an object tag with data attribute\n"); url = THIS->args[data_idx].value; } else if (alt_idx >= 0) { D("Fall-back use alternative tags\n"); url = THIS->args[alt_idx].value; } /* Do the autostart check here, AFTER we have processed the QT special * case which can change the autostart attribute */ if(autostart_idx > 0) { THIS->autostart = !!my_atoi(argv[autostart_idx], 1, 0); THIS->autostartNotSeen = 0; } if (url) { THIS->url = url; /* Mozilla does not support the following protocols directly and * so it never calls NPP_NewStream for these protocols */ if( (strncmp(url, "mms://", 6) == 0) || (strncmp(url, "mmsu://", 7) == 0) /* MMS over UDP */ || (strncmp(url, "mmst://", 7) == 0) /* MMS over TCP */ || (strncmp(url, "rtsp://", 7) == 0) || (strncmp(url, "rtspu://", 8) == 0) /* RTSP over UDP */ || (strncmp(url, "rtspt://", 8) == 0)) /* RTSP over TCP */ { D("Detected MMS -> url=%s\n", url); THIS->browserCantHandleIt = true; find_command(THIS,1); /* Needs to be done early! so xembed flag is correctly set*/ /* The next call from browser will be NPP_SetWindow() & * NPP_NewStream will never be called */ } else { find_command(THIS,0); /* Needs to be done early so xembed flag is correctly set*/ /* For protocols that Mozilla does support, sometimes * the browser will call NPP_NewStream straight away, some * times it wont (depends on the nature of the tag). So that * it works in all cases call NPP_GetURL, this may result * in NPP_NewStream() being called twice (i.e. if this is an * embed tag with src attribute or object tag with data * attribute) */ if (mode == NP_EMBED) { const NPError retVal = NPN_GetURL(instance, url, 0); if(retVal != NPERR_NO_ERROR) { D("NPN_GetURL(%s) failed with %i\n", url, retVal); fprintf(stderr, "MozPlugger: Warning: Couldn't get" "%s\n", url); return NPERR_GENERIC_ERROR; } } } } D("New finished\n"); return NPERR_NO_ERROR; } /*****************************************************************************/ /** * NPP Destroy * Free data, kill processes, it is time for this instance to die. * * @param[in] instance Pointer to the plugin instance data * @param[out] save Pointer to any data to be saved (none in this case) * * @return Returns error code if a problem * *****************************************************************************/ NPError NPP_Destroy(NPP instance, NPSavedData** save) { int e; data_t * THIS; D("NPP_Destroy() - instance=%p\n", instance); if (!instance) { return NPERR_INVALID_INSTANCE_ERROR; } THIS = instance->pdata; if (THIS) { /* Kill the mozplugger-helper process and his sons */ if (THIS->pid > 0) { my_kill(-THIS->pid); THIS->pid = 0; } if (THIS->commsPipeFd >= 0) { close(THIS->commsPipeFd); THIS->commsPipeFd = -1; } if(THIS->tmpFileFd >= 0) { close(THIS->tmpFileFd); THIS->tmpFileFd = -1; } if(THIS->tmpFileName != 0) { char * p; D("Deleting temp file '%s'\n", THIS->tmpFileName); unlink(THIS->tmpFileName); p = strrchr(THIS->tmpFileName, '/'); if(p) { *p = '\0'; D("Deleting temp dir '%s'\n", THIS->tmpFileName); rmdir(THIS->tmpFileName); } NPN_MemFree((char *)THIS->tmpFileName); } for (e = 0; e < THIS->num_arguments; e++) { NPN_MemFree((char *)THIS->args[e].name); NPN_MemFree((char *)THIS->args[e].value); } NPN_MemFree((char *)THIS->args); NPN_MemFree(THIS->mimetype); THIS->href = NULL; THIS->url = NULL; NPN_MemFree(THIS->urlFragment); THIS->urlFragment = NULL; NPN_MemFree(instance->pdata); instance->pdata = NULL; } D("Destroy finished\n"); return NPERR_NO_ERROR; } /*****************************************************************************/ /** * Check that no child is already running before forking one. * * @param[in] THIS Pointer to the plugin instance data * @param[in] fname The filename of the embedded object * @param[in] isURL Is the filename a URL? * * @return Nothing * *****************************************************************************/ static void new_child(NPP instance, const char* fname, int isURL) { int commsPipe[2]; data_t * THIS; sigset_t set; sigset_t oset; D("NEW_CHILD(%s)\n", fname ? fname : "NULL"); if(fname == NULL) { return; } THIS = instance->pdata; if (THIS->pid != -1) { D("Child already running\n"); return; } /* Guard against spawning helper if no command! */ if(THIS->command == 0) { D("Child has no command\n"); return; } if(!safeName(fname, isURL) || (THIS->urlFragment && !safeName(THIS->urlFragment, 0))) { NPN_Status(instance, "MozPlugger: Detected unsafe URL aborting!"); return; } if (socketpair(AF_UNIX, SOCK_STREAM, 0, commsPipe) < 0) { NPN_Status(instance, "MozPlugger: Failed to create a pipe!"); return; } /* Mask all the signals to avoid being interrupted by a signal */ sigfillset(&set); sigprocmask(SIG_SETMASK, &set, &oset); D(">>>>>>>>Forking<<<<<<<<\n"); THIS->pid = fork(); if(THIS->pid == 0) { int signum; int i; int maxFds; const int commsFd = commsPipe[1]; alarm(0); if (!(THIS->cmd_flags & H_DAEMON)) { setsid(); } for (signum=0; signum < NSIG; signum++) { signal(signum, SIG_DFL); } close_debug(); /* Close all those File descriptors inherited from the * parent, except the pipes and stdin, stdout, stderr */ maxFds = sysconf(_SC_OPEN_MAX); for(i = 3; i < maxFds; i++) { if(i != commsFd) { close(i); } } D("Closed up to %i Fds, except %i\n", maxFds, commsFd); /* Restore the signal mask */ sigprocmask(SIG_SETMASK, &oset, &set); run(THIS, fname, commsFd); _exit(EX_UNAVAILABLE); /* Child exit, that's OK */ } /* Restore the signal mask */ sigprocmask(SIG_SETMASK, &oset, &set); if(THIS->pid == -1) { NPN_Status(instance, "MozPlugger: Failed to fork helper!"); } D("Child running with pid=%d\n", THIS->pid); THIS->commsPipeFd = commsPipe[0]; close(commsPipe[1]); } /*****************************************************************************/ /** * Guess a temporary file name * * Creates a temporary file name based on the fileName provided. Checks that * the filename created does not include any dangereous or awkward characters. * * @return file descriptor * *****************************************************************************/ static int guessTmpFile(const char * fileName, int soFar, char * tmpFilePath, int maxTmpFilePathLen) { int i; int fd = -1; const int spaceLeft = maxTmpFilePathLen - soFar; for(i = 0; i <= 100; i++) { if(i == 0) { /* Whilst creating a pdf watch out for characters that may * cause issues... */ char * dst = &tmpFilePath[soFar]; const char * src = fileName; int left = spaceLeft; while(left > 0) { char ch = *src++; if((ch == ';') || (ch == '`') || (ch == '&') || (ch == ' ') || (ch == '\t')) { ch = '_'; } else if(ch == '\0') { break; } *dst++ = ch; } strncpy(&tmpFilePath[soFar], fileName, spaceLeft); } else if (i == 100) { strncpy(&tmpFilePath[soFar], "XXXXXX", spaceLeft); fd = mkstemp(tmpFilePath); break; } else { snprintf(&tmpFilePath[soFar], spaceLeft, "%03i-%s", i, fileName); } tmpFilePath[maxTmpFilePathLen-1] = '\0'; fd = open(tmpFilePath, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR); if(fd >= 0) { break; } } return fd; } /*****************************************************************************/ /** * From the url create a temporary file to hold a copy of th URL contents. * * @param[in] url Pointer to url string * @param[out] tmpFileName Pointer to place tmp file name string * @param[in] maxTmpFileLen * * @return -1 on error or file descriptor * *****************************************************************************/ static int createTmpFile(const char * fileName, char * tmpFilePath, int maxTmpFilePathLen) { int fd = -1; const char * root; const pid_t pid = getpid(); D("Creating temp file for '%s'\n", fileName); root = getenv("MOZPLUGGER_TMP"); if(root) { int soFar; strncpy(tmpFilePath, root, maxTmpFilePathLen); soFar = strlen(tmpFilePath); soFar += snprintf(&tmpFilePath[soFar], maxTmpFilePathLen-soFar, "/tmp-%i", pid); if( (mkdir(tmpFilePath, S_IRWXU) == 0) || (errno == EEXIST)) { D("Creating temp file in '%s'\n", tmpFilePath); tmpFilePath[soFar++] = '/'; fd = guessTmpFile(fileName, soFar, tmpFilePath, maxTmpFilePathLen); } } if(fd < 0) { root = getenv("TMPDIR"); if(!root) { root = "/tmp"; } snprintf(tmpFilePath, maxTmpFilePathLen, "%s/mozplugger-%i", root, pid); if((mkdir(tmpFilePath, S_IRWXU) == 0) || (errno == EEXIST)) { int soFar = strlen(tmpFilePath); D("Creating temp file in '%s'\n", tmpFilePath); tmpFilePath[soFar++] = '/'; fd = guessTmpFile(fileName, soFar, tmpFilePath, maxTmpFilePathLen); } } if(fd >= 0) { D("Opened temporary file '%s'\n", tmpFilePath); } return fd; } /*****************************************************************************/ /** * NPP New stream * Open a new stream. * Each instance can only handle one stream at a time. * * @param[in] instance Pointer to the plugin instance data * @param[in] type The mime type * @param[in] stream Pointer to the stream data structure * @param[in] seekable Flag to say if stream is seekable * @param[out] stype How the plugin will handle the stream * * @return Returns error code if a problem * *****************************************************************************/ NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16_t *stype) { char fileName[SMALL_BUFFER_SIZE]; char * savedMimetype = NULL; data_t * THIS; char refind_command = 0; D("NPP_NewStream() - instance=%p\n", instance); if (instance == NULL) { return NPERR_INVALID_INSTANCE_ERROR; } THIS = instance->pdata; /* Looks like browser can handle this stream so we can clear the flag */ THIS->browserCantHandleIt = 0; if((THIS->pid != -1) || (THIS->tmpFileFd >= 0)) { D("NewStream() exiting process already running\n"); return NPERR_GENERIC_ERROR; } /* Replace the stream's URL with the URL in THIS->href if it * exists. */ if(THIS->href != NULL) { D("Replacing SRC with HREF... \n"); if((THIS->url == 0) || (strcmp(THIS->href, THIS->url) != 0)) { /* URL has changed */ D("URL has changed to %s\n", THIS->href); THIS->url = THIS->href; refind_command = 1; } } else if((THIS->url == 0) || (strcmp(stream->url, THIS->url) != 0)) { /* URL has changed */ D("URL has changed to %s\n", stream->url); THIS->url = (char *) stream->url; refind_command = 1; } D("Url is %s (seekable=%d)\n", THIS->url, seekable); /* Ocassionally the MIME type here is different to that passed to the * NEW function - this is because of either badly configure web server * who's HTTP response content-type does not match the mimetype in the * preceding embebbed, object or link tag. Or badly constructed embedded * tag or ambiguity in the file extension to mime type mapping. Lets * first assume the HTTP response was correct and if not fall back to * the original tag in the mime type. */ if(strcmp(type, THIS->mimetype) != 0) { D("Mismatching mimetype reported, originally was \'%s\' now '\%s' " "for url %s\n", THIS->mimetype, type, THIS->url); savedMimetype = THIS->mimetype; THIS->mimetype = NP_strdup(type); if(!find_command(THIS, 0)) { NPN_MemFree(THIS->mimetype); THIS->mimetype = savedMimetype; find_command(THIS, 0); } else { NPN_MemFree(savedMimetype); } } else if(refind_command) { find_command(THIS, 0); D("Mime type %s\n", type); } /* Extract from the URL the various additional information */ parseURL(THIS, THIS->url, fileName, sizeof(fileName)/sizeof(char)-1); /* Extract the fileName from HTTP headers, overide URL fileName */ parseHeaders(THIS, stream->headers, fileName, sizeof(fileName)/sizeof(char)-1); if(THIS->command == 0) { NPN_Status(instance, "MozPlugger: No appropriate application found."); return NPERR_GENERIC_ERROR; } if( (THIS->cmd_flags & H_STREAM) == 0) { char tmpfile[LARGE_BUFFER_SIZE]; THIS->tmpFileFd = createTmpFile(fileName, tmpfile, sizeof(tmpfile)); if(THIS->tmpFileFd < 0) { NPN_Status(instance, "MozPlugger: Failed to create tmp file"); return NPERR_GENERIC_ERROR; } else { THIS->tmpFileName = NP_strdup(tmpfile); THIS->tmpFileSize = 0; } } else { new_child(instance, THIS->url, 1); } *stype = NP_NORMAL; return NPERR_NO_ERROR; } /*****************************************************************************/ /** * NPP stream as file * Called after NPP_NewStream if *stype = NP_ASFILEONLY. * * @param[in] instance Pointer to plugin instance data * @param[in] stream Pointer to the stream data structure * @param[in] fname Name of the file to stream * * @return none * *****************************************************************************/ void NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) { D("NPP_StreamAsFile() - instance=%p\n", instance); if (instance != NULL) { new_child(instance, fname, 0); } } /*****************************************************************************/ /** * The browser should have resized the window for us, but this function was * added because of a bug in Mozilla 1.7 (see Mozdev bug #7734) and * https://bugzilla.mozilla.org/show_bug.cgi?id=201158 * * Bug was fixed in Mozilla CVS repositary in version 1.115 of * ns4xPluginInstance.cpp (13 Nov 2003), at the time version was 0.13. * version 0.14 happened on 14th July 2004 * * @param[in] instance Pointer to plugin instance data * * @return none * ****************************************************************************/ static void resize_window(NPP instance) { XSetWindowAttributes attrib; data_t * THIS; if(!does_browser_have_resize_bug()) { return; } THIS = instance->pdata; attrib.override_redirect = True; XChangeWindowAttributes(THIS->display, (Window)THIS->windata.window, (unsigned long) CWOverrideRedirect, &attrib); D("Bug #7734 work around - resizing WIN 0x%x to %ux%u!?\n", (unsigned) THIS->windata.window, (unsigned) THIS->windata.width, (unsigned) THIS->windata.height); XResizeWindow(THIS->display, (Window)THIS->windata.window, (unsigned) THIS->windata.width, (unsigned) THIS->windata.height); } /*****************************************************************************/ /** * NPP Set window * The browser calls NPP_SetWindow after creating the instance to allow drawing * to begin. Subsequent calls to NPP_SetWindow indicate changes in size or * position. If the window handle is set to null, the window is destroyed. In * this case, the plug-in must not perform any additional graphics operations * on the window and should free any associated resources. * * @param[in] instance Pointer to plugin instance data * @param[in] window Pointer to NPWindow data structure * * @return Returns error code if problem * ****************************************************************************/ NPError NPP_SetWindow(NPP instance, NPWindow* window) { data_t * THIS; D("NPP_SetWindow() - instance=%p\n", instance); if (!instance) { return NPERR_INVALID_INSTANCE_ERROR; } if (!window) { return NPERR_NO_ERROR; } /* TODO - Should really pass to helper / controller the fact that the * window has disappeared! - need to check the consequences first * before deleting these 2 lines */ if (!window->window) { D("SetWindow() - NULL window passed in so exit\n"); return NPERR_NO_ERROR; } if (!window->ws_info) { return NPERR_NO_ERROR; } THIS = instance->pdata; THIS->display = ((NPSetWindowCallbackStruct *)window->ws_info)->display; THIS->displayname = XDisplayName(DisplayString(THIS->display)); THIS->windata = *window; if ((THIS->url) && (THIS->browserCantHandleIt)) { if(THIS->command == 0) { /* Can only use streaming commands, as Mozilla cannot handle * these types (mms) of urls */ if (!find_command(THIS, 1)) { if(errMsg) { NPN_Status(instance, errMsg); errMsg = NULL; } else { NPN_Status(instance, "MozPlugger: No appropriate application found."); } return NPERR_GENERIC_ERROR; } } /* Extract from the URL the various additional information */ parseURL(THIS, THIS->url, 0, 0); new_child(instance, THIS->url, 1); THIS->url = NULL; /* Stops new_child from being called again */ return NPERR_NO_ERROR; } if (THIS->commsPipeFd >= 0) { ssize_t ret; D("Writing WIN 0x%x to fd %d\n", (unsigned) window->window, THIS->commsPipeFd); ret = write(THIS->commsPipeFd, (char *)window, sizeof(*window)); if(ret < sizeof(*window)) { D("Writing to comms pipe failed\n"); close(THIS->commsPipeFd); THIS->commsPipeFd = -1; } } resize_window(instance); /* In case Mozilla would call NPP_SetWindow() in a loop. */ usleep(4000); // get_browser_toolkit(instance); // does_browser_support_key_handling(instance); return NPERR_NO_ERROR; } /*****************************************************************************/ /** * NPP Destroy stream * Called from the Browser when the streaming has been completed by the Browser * (the reason code indicates whether this was due to a User action, Network * issue or that streaming has been done. * * @param[in] instance Pointer to plugin instance data * @param[in] stream Pointer to the stream data structure * @param[in] reason Reason for stream being destroyed * * @return Returns error code if a problem * *****************************************************************************/ NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) { D("NPP_DestroyStream() - instance=%p\n", instance); if (!instance) { return NPERR_INVALID_INSTANCE_ERROR; } data_t * const THIS = instance->pdata; if(THIS->tmpFileFd >= 0) { close(THIS->tmpFileFd); THIS->tmpFileFd = -1; if( THIS->tmpFileName != NULL) { D("Closing Temporary file \'%s\'\n", THIS->tmpFileName); if(THIS->commsPipeFd < 0) { new_child(instance, THIS->tmpFileName, 0); } } else { D("Closing stdin pipe\n"); } } return NPERR_NO_ERROR; } /*****************************************************************************/ /** * NPP Initialize * The browser calls this function only once; when the plug-in is loaded, * before the first instance is created. NPP_Initialize tells the plug-in that * the browser has loaded it. * * @return Returns error code if a problem * *****************************************************************************/ NPError NPP_Initialize(void) { D("NPP_Initialize(void)\n"); get_api_version(); browserSupportsXEmbed = does_browser_support_xembed(); do_read_config(); { const int free = MAX_STATIC_MEMORY_POOL - staticPoolIdx; D("Static Pool used=%i, free=%i\n", staticPoolIdx, free); } return NPERR_NO_ERROR; } /*****************************************************************************/ /** * NPP Shutdown * The browser calls this function just before it unloads the plugin from * memory. So this function should do any tidy up - in this case nothing is * required. * * @return none * *****************************************************************************/ void NPP_Shutdown(void) { D("NPP_Shutdown()\n"); } /*****************************************************************************/ /** * NPP Print * Called when user as requested to print the webpage that contains a visible * plug-in. For mozplugger this is ignored. * * @param[in] instance Pointer to the plugin instance data * @param[in] printInfo Pointer to the print info data structure * * @return none * *****************************************************************************/ void NPP_Print(NPP instance, NPPrint* printInfo) { D("NPP_Print() - instance=%p\n", instance); } /*****************************************************************************/ /** * NPP write * Called when the Browser wishes to deliver a block of data from a stream to * the plugin. Since streaming is handled directly by the application specificed * in the configuration file, mozplugger has no need for this data. Here it * just pretends the data has been taken by returning 'len' to indicate all * bytes consumed. Actaully this function should never be called by the * Browser. * * @param[in] instance Pointer to the plugin instance data * @param[in] stream Pointer to the stream data structure * @param[in] offset Where the data starts in 'buf' * @param[in] len The amount of data * @param[in] buf The data to be delivered * * @return Always returns value of passed in 'len' * *****************************************************************************/ int32_t NPP_Write(NPP instance, NPStream *stream, int32_t offset, int32_t len, void * buf) { D("NPP_Write(%d,%d) - instance=%p\n", offset, (int) len, instance); if(instance) { data_t * const THIS = instance->pdata; if(THIS->tmpFileFd >= 0) { if(offset != THIS->tmpFileSize) { D("Strange, there's a gap?\n"); } len = write(THIS->tmpFileFd, buf, len); THIS->tmpFileSize += len; D("Temporary file size now=%i\n", THIS->tmpFileSize); } } return len; } /*****************************************************************************/ /** * NPP Write ready * Browser calls this function before calling NPP_Write to see how much data * the plugin is ready to accept. Since streaming is handled directly by the * application specified in the configuration file, mozplugger does not need * the stream data from the Browser, therefore this function terminates * the streaming by calling NPN_DestoryStream. * * @param[in] instance Pointer to the plugin instance data * @param[in] stream Pointer to the stream data structure * * @return Always returns zero * *****************************************************************************/ int32_t NPP_WriteReady(NPP instance, NPStream *stream) { int32_t size = 0; D("NPP_WriteReady() - instance=%p\n", instance); if (instance != 0) { data_t * const THIS = instance->pdata; if(THIS->tmpFileFd >= 0) { size = CHUNK_SIZE; } else { D("Nothing to do - Application will handle stream\n"); /* STREAM, close NPAPI stream and pass URL to application */ } if(size == 0) { /* Tell the browser that it can finish with the stream (actually we just wanted the name of the stream!) And not the stream data. */ NPN_DestroyStream(instance, stream, NPRES_DONE); } } return size; } /*****************************************************************************/ /** * NPP URL Notify * Browser calls this function to notify when a GET or POST has completed * Currently not used by mozplugger * * @param[in] instance Pointer to the plugin instance data * @param[in] url The URL that was GET or POSTed * @param[in] reason The reason for the notify event * @param[in] notifyData Data that was passed in the original call to Get or Post URL * * @return none * *****************************************************************************/ void NPP_URLNotify(NPP instance, const char * url, NPReason reason, void * notifyData) { D("NPP_URLNotify() - instance=%p url=%s reason=%i\n", instance, url, reason); } /*****************************************************************************/ /** * NPP Got Focus * Called by the browser when the browser intends to focus an instance. * Instance argument indicates the instance getting focus. * Direction argument indicates the direction in which focus advanced to the instance. * Return value indicates whether or not the plugin accepts focus. * Currently not used by mozplugger * * @param[in] instance Pointer to the plugin instance data * @param[in] direction The advancement direction * * @return True or False * *****************************************************************************/ NPBool NPP_GotFocus(NPP instance, NPFocusDirection direction) { D("NPP_GotFocus() - instance=%p, direction=%i\n", instance, direction); return false; } /*****************************************************************************/ /** * NPP Lost Focus * Called by the browser when the browser intends to take focus. * Instance argument indicates the instances losing focus. * There is no return value, plugins will lose focus when this is called. * Currently not used by mozplugger * * @param[in] instance Pointer to the plugin instance data * * @return True or False * *****************************************************************************/ void NPP_LostFocus(NPP instance) { D("NPP_LostFocus() - instance=%p\n", instance); } /*****************************************************************************/ /** * NPP URL Redirect Notify * Currently not used by mozplugger * * @param[in] instance Pointer to the plugin instance data * @param[in] url The URL that was GET or POSTed * @param[in] status ?? * @param[in] notifyData Data that was passed in the original call to Get or Post URL * * @return None * *****************************************************************************/ void NPP_URLRedirectNotify(NPP instance, const char * url, int32_t status, void * noifyData) { D("NPP_URLRedirectNotify() - instance=%p, url=%s, status=%i\n", instance, url, status); } /*****************************************************************************/ /** * NPP Clear Site Data * Clear site data held by plugin (should this clear tmp files?) * Currently not used by mozplugger * * @param[in] site The site name * @param[in] flags * @param[in] maxAge * * @return Error status * *****************************************************************************/ NPError NPP_ClearSiteData(const char * site, uint64_t flags, uint64_t maxAge) { D("NPP_ClearSiteData() - site=%s\n", site); return NPERR_NO_ERROR; } /*****************************************************************************/ /** * NPP Ge Site Data * Get list of sites plugin has data for (should this be list of tmp files?) * Currently not used by mozplugger * * @param[in] site The site name * @param[in] flags * @param[in] maxAge * * @return Error status * *****************************************************************************/ char** NPP_GetSitesWithData(void) { D("NPP_GetSitesWithData()\n"); return 0; } mozplugger-1.14.5/configure.ac0000600000175000001440000001132511722504427015317 0ustar peterusers# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.68]) AC_INIT([mozplugger], [1.14.5]) #AC_INIT([mozplugger], [CVS-2012-Feb-26]) AC_CONFIG_SRCDIR([child.c]) AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_LN_S AC_PROG_MAKE_SET #AC_PROG_MKDIR_P # Determine the linker flags for mozplugger.so LDSHARED='gcc -shared' PLATFORM="x`uname`" XCFLAGS="-fPIC -Wall -O2" if test "${PLATFORM}" = xIRIX; then XCFLAGS="-fPIC -O2" LDSHARED='ld -shared -n32' fi if test "${PLATFORM}" = xAIX; then XCFLAGS="-fPIC -O2" LDSHARED='ld -G -bexpall' fi if test "${PLATFORM}${CC}" = "xHP-UXgcc"; then XCFLAGS="-fPIC -O2" LDSHARED='ld -b' fi if test "${PLATFORM}${CC}" = "xHP-UXcc"; then XCFLAGS='+DAportable -Ae +z +02' LDSHARED='ld -b +e NP_GetValue +e NP_Initialize +e NP_Shutdown +e NP_GetMIMEDescription' fi if test "${PLATFORM}${CC}" = "xSunOSgcc"; then XCFLAGS="-fPIC -O2" LDSHARED='ld -G' fi if test "${PLATFORM}${CC}" = "xSunOScc"; then XCFLAGS='-Kpic -O' LDSHARED='ln -G' fi if test "${PLATFORM}" = "xOSF1"; then XCFLAGS='-shared' LDSHARED='ld -expect_unresolved "*" -shared -msym -O3' fi #freebsd-aout: # ${MAKE} all XCFLAGS='-fPIC -aout' XLDFLAGS='-shared -aout' XCPPFLAGS= # Checks for X path AC_PATH_X if test "x$x_includes" != x; then XCPPFLAGS="$XCPPFLAGS -I$x_includes" fi if test "x$x_libraries" != x; then LDFLAGS="$LDFLAGS -L$x_libraries" fi # Work out where plugins should be installed PLUGINDIRS= if test "$libdir" = '${exec_prefix}/lib64'; then PLUGINLIB=lib64 else PLUGINLIB=lib fi #/usr/lib/mozilla/plugins/ #/usr/lib/netscape/plugins #/usr/lib/firefox/plugins #$MOZILLA_HOME/plugins #/usr/lib/chromium/plugins PLUGINDIR=${MOZ_PLUGIN_PATH} AC_CHECK_FILE([${PLUGINDIR}], [PLUGINDIRS="${PLUGINDIR} ${PLUGINDIRS}"]) PLUGINDIR=/usr/${PLUGINLIB}/mozilla/plugins AC_CHECK_FILE([${PLUGINDIR}], [PLUGINDIRS="${PLUGINDIR} ${PLUGINDIRS}"]) PLUGINDIR=/usr/${PLUGINLIB}/firefox/plugins AC_CHECK_FILE([${PLUGINDIR}], [PLUGINDIRS="${PLUGINDIR} ${PLUGINDIRS}"]) # Checks for libraries. AC_CHECK_LIB([X11], [XDisplayName]) # Check to see if gcov required... AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [enable test coverage with gcov @<:@default=no@:>@]), [case "${enableval}" in yes) gcov=true ;; no) gcov=false ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-gcov]) ;; esac], [gcov=false]) if test "x$gcov" = xtrue; then AC_CHECK_LIB([gcov], [main]) XCFLAGS="-g -fprofile-arcs -ftest-coverage -fstack-protector-all -Wall" AC_DEFINE([GCOV]) fi #Check to see if debug required... AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debug output @<:@default=no@:>@]), [case "${enableval}" in yes) debug=true ;; no) debug=false ;; *) AC_MSG_ERROR([Bad value ${enableval} for --enable-debug]) ;; esac], [debug=false]) if test "x$debug" = xtrue; then AC_DEFINE([DEBUG]) else AC_DEFINE([NODEBUG]) fi #Check to see if Always Xembed... AC_ARG_ENABLE(always-xembed, AS_HELP_STRING([--enable-always-xembed], [enable build with xembed always enabled @<:@default=no@:>@]), [case "${enableval}" in yes) xembed=true ;; no) xembed=false ;; *) AC_MSG_ERROR([Bad value ${enableval} for --enable-always-xembed]) ;; esac], [xembed=false]) if test "x${xembed}" = xtrue; then AC_DEFINE([ALWAYS_NEEDS_XEMBED]) fi # Checks for header files. AC_CHECK_HEADERS([fcntl.h inttypes.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T # Check to see if -lsocket and -lnsl is required (solaris) AC_SEARCH_LIBS([gethostbyname], [nsl]) AC_SEARCH_LIBS([socket], [socket], [], [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], [], [-lnsl])]) # Checks for library functions. AC_FUNC_FORK AC_FUNC_MALLOC AC_CHECK_FUNCS([alarm dup2 gethostname memset mkdir putenv rmdir select strcasecmp strchr strcspn strncasecmp strrchr strstr]) AC_CONFIG_FILES([Makefile]) AC_SUBST([XCFLAGS]) AC_SUBST([XCPPFLAGS]) AC_SUBST([LDSHARED]) AC_SUBST([PLUGINDIRS]) AC_DEFINE([XP_UNIX]) AC_DEFINE_UNQUOTED([VERSION], ["${PACKAGE_VERSION}"]) AC_OUTPUT mozplugger-1.14.5/Makefile.old0000600000175000001440000001766511722504427015263 0ustar peterusers# Where is your Xwindows located? X11=/usr/X11R6 # # For building rpms root= # # For installing prefix=/usr sysconfdir=/etc exec_prefix= # On 64 bit arch change libprefix to lib64 libprefix=/lib #libprefix=/lib64 # # RPMDIR=/usr/src/RPM # Choose compiler CC=gcc LD=gcc BINFORMAT=bin #Debug or not debug build BUILD=NODEBUG #BUILD=DEBUG any: @echo 'This Makefile is deprecated, but still works see README' @echo 'Choose target:' @echo ' ${MAKE} linux - for Linux' @echo ' ${MAKE} solaris-gcc - for Solaris with gcc' @echo ' ${MAKE} solaris-cc - for Solaris with cc' @echo ' ${MAKE} du - for Digital/Compac Unix or OSF1' @echo ' ${MAKE} freebsd-aout - for FreeBSD with a.out netscape' @echo ' ${MAKE} hp-gcc - for HP-UX with gcc' @echo ' ${MAKE} hp-cc - for HP-UX with cc' @echo ' ${MAKE} irix - for Irix' @echo ' ${MAKE} aix - for AIX >= 4.2' @echo ' ${MAKE} freebsd - for FreeBSD 4.x' @echo ' ${MAKE} openbsd - for OpenBSD' @echo ' ${MAKE} linux-gcov - for linux with coverage/profiling' @echo ' ${MAKE} xx BUILD=DEBUG - for xx with debug' @echo 'Always run $(MAKE) clean first when switching target type' linux-gcov: ${MAKE} all CC=gcc XCFLAGS='-fPIC -g -fprofile-arcs -ftest-coverage -fstack-protector-all -Wall' LD=gcc XLDFLAGS=-shared EXTRA_LIBS=-lgcov irix: ${MAKE} all CC=gcc XCFLAGS=-fPIC LD=ld XLDFLAGS='-shared -n32' aix: ${MAKE} all CC=gcc XCFLAGS=-fPIC LD=ld XLDFLAGS='-G -bexpall' hp-gcc: ${MAKE} all CC=gcc XCFLAGS=-fPIC LD=ld XLDFLAGS=-b X11=/usr/include/X11R6 hp-cc: ${MAKE} all CC=cc XCFLAGS='+DAportable -Ae +z' LD=ld XLDFLAGS='-b +e NP_GetValue +e NP_Initialize +e NP_Shutdown +e NP_GetMIMEDescription' RPM_OPT_FLAGS=+O2 X11=/usr/include/X11R6 linux: ${MAKE} all CC=gcc XCFLAGS='-fPIC -Wall' LD=gcc XLDFLAGS=-shared solaris-gcc: ${MAKE} all CC=gcc XCFLAGS=-fPIC LD=ld XLDFLAGS=-G XLIBS='-lX11 -lsocket -lnsl' X11=/usr/openwin/ solaris-cc: ${MAKE} all CC=cc XCFLAGS=-Kpic RPM_OPT_FLAGS=-O LD=ld XLDFLAGS=-G XLIBS='-lX11 -lsocket -lnsl' X11=/usr/openwin/ du: ${MAKE} all CC=cc LD=ld XLDFLAGS='-expect_unresolved "*" -shared -msym -O3' freebsd-aout: ${MAKE} all CC=gcc XCFLAGS='-fPIC -aout' LD=gcc XLDFLAGS='-shared -aout' freebsd: ${MAKE} all CC=gcc XCFLAGS=-fPIC LD=gcc XLDFLAGS=-shared X11=/usr/X11R6/ openbsd: ${MAKE} all CC=gcc XCFLAGS=-fPIC LD=gcc XLDFLAGS=-shared X11=/usr/X11R6/ auto: @case "x`uname`" in \ xLinux) ${MAKE} linux ;; \ xSunOS) ${MAKE} solaris-gcc ;; \ xHP-UX) ${MAKE} hp-gcc ;; \ xOSF1) ${MAKE} du ;; \ xIRIX) ${MAKE} irix ;; \ xAIX) ${MAKE} aix ;; \ xFreeBSD) ${MAKE} freebsd ;; \ xOpenBSD) ${MAKE} openbsd ;; \ esac # For other systems, look at the example Makefiles in the # PluginSDK30b5/examples/UnixTemplate/Unix directory # # No user servicable parts beyond this point # VERSION=1.14.3 BASE_FILES=Makefile \ mozplugger.7 \ README \ COPYING \ mozpluggerrc SOURCE_FILES=mozplugger.c \ mozplugger-common.c \ mozplugger-helper.c \ mozplugger.spec \ child.c \ debug.c \ mozplugger.h BIN_FILES=mozplugger.so \ mozplugger-helper \ mozplugger-controller \ mozplugger-linker DEFINES= -DXP_UNIX -DVERSION=\"$(VERSION)\" -D$(BUILD) -DSYSCONFDIR=\"${sysconfdir}\" #-D__amd64__ INCLUDES= -Inpapi/include -I$(X11)/include RPM_OPT_FLAGS ?= -O2 COMMON_CFLAGS=$(RPM_OPT_FLAGS) $(INCLUDES) $(DEFINES) XCFLAGS=-shared XLDFLAGS=-shared XLIBDIR = $(X11)$(libprefix) XLIBS=-lX11 -L$(XLIBDIR) EXTRA_LIBS= LDSHARED=$(LD) $(XLDFLAGS) LDFLAGS= CFLAGS=$(COMMON_CFLAGS) $(XCFLAGS) all: mozplugger.so mozplugger-helper mozplugger-controller mozplugger-linker mozplugger-helper: mozplugger-helper.o mozplugger-common.o child.o debug.o $(CC) $(LDFLAGS) -o mozplugger-helper mozplugger-helper.o mozplugger-common.o child.o debug.o $(XLIBS) $(EXTRA_LIBS) mozplugger-helper.o: mozplugger-helper.c mozplugger.h child.h debug.h Makefile $(CC) -c $(CFLAGS) -o mozplugger-helper.o mozplugger-helper.c mozplugger.so: mozplugger.o npunix.o mozplugger-common.o debug.o Makefile $(LDSHARED) $(LDFLAGS) -o mozplugger.so mozplugger.o mozplugger-common.o npunix.o debug.o $(EXTRA_LIBS) mozplugger-common.o: mozplugger-common.c mozplugger.h Makefile $(CC) -c $(CFLAGS) -o mozplugger-common.o mozplugger-common.c mozplugger.o: mozplugger.c mozplugger.h Makefile $(CC) -c $(CFLAGS) -o mozplugger.o mozplugger.c npunix.o: npapi/common/npunix.c $(CC) -c $(CFLAGS) -o npunix.o npapi/common/npunix.c child.o: child.c child.h debug.h mozplugger.h Makefile $(CC) -c $(CFLAGS) -o child.o child.c debug.o: debug.c debug.h Makefile $(CC) -c $(CFLAGS) -o debug.o debug.c mozplugger-controller: mozplugger-controller.o mozplugger-common.o child.o debug.o $(CC) -o mozplugger-controller mozplugger-controller.o mozplugger-common.o child.o debug.o $(LDFLAGS) $(XLIBS) $(EXTRA_LIBS) mozplugger-controller.o: mozplugger-controller.c mozplugger.h child.h debug.h Makefile $(CC) -c $(CFLAGS) -o mozplugger-controller.o mozplugger-controller.c mozplugger-linker: mozplugger-linker.o mozplugger-common.o child.o debug.o $(CC) -o mozplugger-linker mozplugger-linker.o mozplugger-common.o child.o debug.o $(LDFLAGS) $(XLIBS) $(EXTRA_LIBS) mozplugger-linker.o: mozplugger-linker.c mozplugger.h child.h debug.h Makefile $(CC) -c $(CFLAGS) -o mozplugger-linker.o mozplugger-linker.c clean: -rm -f *.o npapi/common/*.o -rm -f mozplugger-helper mozplugger-controller mozplugger-linker mozplugger.so spotless: clean -rm *.so *~ core mozplugger -rm -rf rpmtmp localinstall: mozplugger.so mozplugger-helper mozplugger-controller mozplugger-linker -@mkdir -p $$HOME/$(BROWSERDIR)/plugins cp mozplugger.so $$HOME/$(BROWSERDIR)/plugins/ cp mozplugger-helper $$HOME/$(BROWSERDIR)/ cp mozplugger-controller $$HOME/$(BROWSERDIR)/ cp mozplugger-linker $$HOME/$(BROWSERDIR)/ if [ -f $$HOME/$(BROWSERDIR)/mozpluggerrc ]; then mv $$HOME/$(BROWSERDIR)/mozpluggerrc $$HOME/$(BROWSERDIR)/mozpluggerrc.old; fi cp mozpluggerrc $$HOME/$(BROWSERDIR)/ localinstall_mozilla: make localinstall BROWSERDIR=.mozilla localinstall_netscape: make localinstall BROWSERDIR=.netscape localinstall_opera: make localinstall BROWSERDIR=.opera install: -@mkdir -p $(exec_prefix)/bin -@mkdir -p $(prefix)$(libprefix)/mozilla/plugins -@mkdir -p $(exec_prefix)/share/man/man7 -@mkdir -p ${sysconfdir} cp mozplugger-helper $(exec_prefix)/bin/ cp mozplugger-controller $(exec_prefix)/bin/ cp mozplugger-linker $(exec_prefix)/bin/ cp mozplugger.so $(prefix)$(libprefix)/mozilla/plugins/ cp mozpluggerrc ${sysconfdir}/ cp mozplugger.7 $(exec_prefix)/share/man/man7/ mozplugger.tar.gz: $(BASE_FILES) $(SOURCE_FILES) @( DIR=`pwd`;\ BASE=`basename $$DIR`;\ cd .. ; \ if [ "$$BASE" != "mozplugger" ]; then \ ln -s "$$BASE" mozplugger ; \ fi ;\ tar cf - `for a in $(BASE_FILES) $(SOURCE_FILES); do echo mozplugger/$$a ; done` | gzip -9 >mozplugger/mozplugger.tar.gz ;\ if [ "$$BASE" != "mozplugger" ]; then \ rm mozplugger ; \ fi ;\ ) export: mozplugger.tar.gz bin_export: mozplugger-$(BINFORMAT).tar.gz echo_version: @echo $(VERSION) rpm: $(RPMDIR)/SOURCES/mozplugger.tar.gz ./mozplugger.spec rm -rf rpmtmp ||: mkdir rpmtmp mkdir rpmtmp/usr mkdir rpmtmp/etc mkdir rpmtmp/opt mkdir rpmtmp/usr/local rpm -ba --buildroot `pwd`/rpmtmp mozplugger.spec cp $(RPMDIR)/SRPMS/mozplugger-1.src.rpm . cp $(RPMDIR)/RPMS/*/mozplugger-1.*.rpm . rm -rf rpmtmp $(RPMDIR)/SOURCES/mozplugger.tar.gz: mozplugger.tar.gz cp mozplugger.tar.gz $(RPMDIR)/SOURCES/mozplugger.tar.gz mozplugger-$(BINFORMAT).tar.gz: $(BASE_FILES) $(SOURCE_FILES) $(BIN_FILES) @( DIR=`pwd`;\ BASE=`basename $$DIR`;\ cd .. ; \ if [ "$$BASE" != "mozplugger" ]; then \ ln -s "$$BASE" mozplugger ; \ fi ;\ tar cf - `for a in $(BASE_FILES) $(BIN_FILES); do echo mozplugger/$$a ; done` | gzip -9 >mozplugger/mozplugger-$(BINFORMAT).tar.gz ;\ if [ "$$BASE" != "mozplugger" ]; then \ rm mozplugger ; \ fi ;\ ) mozplugger-1.14.5/mozplugger.70000600000175000001440000003536111722504427015322 0ustar peterusers.PU .TH mozplugger 7 "2012 Jan 04" .SH NAME mozplugger \- a streaming multimedia plugin for UNIX mozilla .SH DESCRIPTION .I MozPlugger is a Mozilla plugin which can show many types of multimedia inside your Mozilla. To accomplish this, MozPlugger uses external programs such as mplayer, xanim, mtv, timidity and tracker. .SH CONFIGURE FILE You can configure mozplugger by changing the file .I mozpluggerrc which can be located in any of the following directories: $MOZPLUGGER_HOME/ .br $HOME/.mozplugger/ .br $HOME/.netscape/ .br $HOME/.mozilla/ .br $HOME/.opera/ .br $MOZILLA_HOME/ .br $OPERA_HOME/ .br /usr/local/netscape/ .br /etc/ .br /usr/local/mozilla/ .br /usr/local/netscape/ MozPlugger will use the first mozpluggerrc it finds and ignore any others. The search order is from top of the list above. The format of .I mozpluggerrc is very simple. The general layout is to have one or more lines describing mime types followed by one or more lines describing commands used to handle those mime types. Lines beginning with # are considered comments and are ignored. Here is a simple example: video/mpeg: mpeg: Mpeg video .br video/quicktime: qt,mov: Mpeg video .br : xanim +W$window -Zr +q +Ze +f $file Each line describing a mime type has three fields: .B mime type : .B extensions : .B description .TP .B mime type The mime type is the standardized name for the content type you want MozPlugger to handle. This must be the same type as the web server claims the file to be, or MozPlugger will not be used for that file, regardless of the extension. Note: Some web servers incorrectly report the wrong mime type, blame the web server adminstrator not mozplugger. .TP .B extensions This is a comma separated list of extensions that should be associated with this particular mime type. The extensions are only used when a web server does not report what type of file it is, or when loading files directly from disk. .TP .B description This is the description that shows up in about:plugins and in the application preferences section in Mozilla. .TP Lines that describe what command to use for a mime type must begin with a whitespace and have two fields: .B flags : .B command .TP .B flags This is a space separated list of flags associated with the command and tells mozplugger how to handle this command. See below for further details. .TP .B command This is a command which is sent to /bin/sh when handling this mime type. Mozplugger assumes the command line starts with the name of an application followed by various arguments passed to that application. .SH USING M4 When loading, MozPlugger will pass the mozpluggerrc file through m4, a general purpose macro processor (assuming m4 is installed). This provides the ablity to use macros within mozpluggerrc especially for those commonly used command lines. m4 brings text replacement, parameter substitution, file inclusion, string manipulation, conditional evaluation, arthemtic expressions, etc to mozpluggerrc. Please see m4 documentation for more details. .SH FINDING THE RIGHT COMMAND When MozPlugger is called from your browser, it looks through the configuration file and finds a matching mime type. When a matching mimetype is found, it tries to figure out which command to use. Commands that have the flags .B loop, embed, noembed, link and .B fmatch will be rejected if they do not match what is expected from the associated HTML code (see later for details). In addition for a command to be choosen the application has to be available. That is, MozPlugger will assume the first word of the command is the name of an application and search $PATH for that application. If that application is not found MozPlugger will skip that command line. Of the commands that remain, Mozplugger looks for the first command that has the .B stream flag set. If there is not such a command line, Mozplugger then downloads the file and picks the first (of the remaining) commands. .SH WORKING WITH JAVA SCRIPT Mozplugger supports a JavaScript interface that allows the state of the embedded object (i.e. mozplugger) to be queried from JavaScript. Currently mozplugger supports the following properties. .TP .B isPlaying This property has the value true if the application that mozplugger launched to handle the embedded object is running and false if either no application was launched or that application has now terminated. .SH WHEN IT DOESNT WORK If for some reason the embedded object fails to be rendered in the browser, this could be a fault with the application as opposed to MozPlugger. To diagnosis the fault it is suggested that first you make sure that any output from the application will be visible to you by removing the .B noisy flag (if set in mozpluggerrc). Next run the browser from the shell (xterm or equivalent) passing the appropriate browser command line flag to enable output from stdout and stderr to be displayed. For example, for firefox the command line string is: .B firefox -debug This should allow any output from the application to be visible at the shell and hopefully lead to a diagnosis of the fault. .SH FLAGS .TP .B autostart This flag indicates that the command uses the $autostart environment variable. That is mozplugger will run the command on the assumption that the command/application will check the value of the $autostart environment variable. If this flag is not present and the HTML code for the embedded object indicates autostart is false, mozplugger will not run the command but instead draw a single start button. .TP .B repeat This flag indicates that the command uses the $repeats environment variable. That is mozplugger will run the command on the assumption that the command/application will check the value of the $repeats environment variable and perform the repeats. If this flag is not set, mozplugger will perform the required number of repeats as indicated in the HTML code by calling the command $repeats times. .TP .B loop This indicates that the command loops forever. If the HTML code for the embedded object indicates don't loop/repeat forever (e.g. the loop attribute is not present or not set to true), the command on this line will not be used. .TP .B stream This indicates that this command can take an url. In this case, the environment variable $file contains the URL of the file to play and the browser does not download it. It is assumed that the command can handle the URL. Note: if a username and password is required for this URL, the command/application will have to obtain this as it is not passed to it from the browser. .TP .B ignore_errors This flag tells MozPlugger to ignore the exit status of the command. For example is mozplugger is repeating the command 'n' times and the command exits with an error, normally mozplugger would terminate at this time. With this flag set, mozplugger continues the repeats. .TP .B noisy This flag tells MozPlugger to redirect the stdout and stderr of the command to /dev/null. .TP .B swallow (name) This flag tells mozplugger that the command will open a window with the specified name and that Mozplugger will then move this window inside your browser. If name is prefixed with '=' then mozplugger looks for an exact match with the window name, if the prefix is '~' then mozplugger looks for a case insensitive match, if prefixed with '*' then mozplugger looks for a window name that starts with 'name' and is case insensitive. If none of these prefixes then, mozplugger checks if name occurs anywhere in the window name, but is case sensitive. Note any spaces between the brackets are counted as part of the window name. The window name to use in mozpluggerrc can be obtained by using the utility xprop(). Run the command in question, type "xprop WM_CLASS" at a shell prompt and then click on the application window. In addition any occurance of %f in the name is replaced with the filename being loaded (without path), %p is replaced with the full filename including path. .TP .B fmatch (string) This flag defines a command that will be used only if the filename or url (i.e. $file) contains 'string'. If 'string' is prefixed with '*' then mozplugger defines a match when the file starts with 'string' (the check is case insensitive). If 'string' is prefixed with '%' then mozplugger defines a match when the file ends with 'string' (the check is case insenstive and ignores any parameters at the end of a url {i.e. '?xxx=yyy'}). If none of these prefixes then mozplugger defines a match when the 'string' is found somewhere in the file (but this time match is case sensitive). Note any spaces between the brackets are counted as part of the 'string'. .TP .B nokill This flag tells MozPlugger to not try to kill the command when leaving the page, and to not start the command in a loop. This is normally used for applications that are not swallowed and can play multiple files, such as xmms. .TP .B exits This flag tells MozPlugger that the command will exits straight away and hence does not need to be killed when leaving the page, and to not start the command in a loop. This is normally used for applications that just display an image in the $window and then exit. .TP .B fill This flag tells MozPlugger to maximize a swallowed window. .TP .B maxaspect This flag tells Mozplugger to maximize a swallowed window while keeping the width/height ratio constant. .TP .B controls This flag tells MozPlugger to draw controls and is typically used with audio files to display a controller with the buttons play, pause and stop. Be aware if the embedded object has no sub-window defined within the browser's window (e.g. if the HTML uses the tag hidden = true) then the controls will not appear. .TP .B embed This flags tells Mozplugger to only use this command if the associated HTML refers to an embedded object that is a small part of a HTML page. .TP .B noembed This flags tells Mozplugger to only use this command if the associated HTML refers to a separate window that only contains the object. .TP .B links This flag tells Mozplugger to only use this command for embedded objects that are really links to external applications (such objects typically use the target and href variables to indicate a clickable link). Embedded Quicktime objects sometimes use this mechanism. .TP .B needs_xembed Some applications when embedded requires the Xembed protocol, other applications dont want the Xembed protocol. Add or remove this flag if you find that you cannot move keyboard focus to the embedded window. Curently it appears QT4 based applications require this flag. .SH ENVIRONMENT VARIABLES There are some envirnoment variables that control the behaviour of Mozplugger. .TP .B MOZPLUGGER_HOME If MOZPLUGGER_HOME is defined, the folder $MOZPLUGGER_HOME is checked for the configuration file mozpluggerrc .TP .B MOZPLUGGER_TMP If MOZPLUGGER_TMP is defined, then any temporary files are placed in $MOZPLUGGER_TMP. .TP .B TMPDIR If MOZPLUGGER_TMP is not defined, but TMPDIR is defined, then any temporary files are placed in $TMPDIR/mozplugger-xxx/ where xxx = PID. .TP .B PATH Mozplugger uses PATH to look for executables .TP MozPlugger gives some variables to /bin/sh when running the command, these variables are: .TP .B $autostart This variable contains 1 or 0. When set to 1 it indicates that the command should start playing/showing the associated media. By default it is 0 if controls flag is present and 1 otherwise, but it is overridden if the associated HTML contains the attribute autostart or autoplay. Command/applications that use this environment variable should also have the .B autostart flag set. .TP .B $repeats This variable contains how many times the file should be played. By default it is once, but it is overridden if the associated HTML contains the attribute loop, numloop or playcount. Command/applications which use this environment variable should also have the .B repeat flag set. .TP .B $window This is the X window Mozilla has given the plugin. This can be used with applications such as MPlayer to display graphics inside the mozilla window. Be aware if the embedded object has no sub-window defined within the browser's window (e.g. if the HTML uses the tag hidden = true) then the variable will have the value zero (null). .TP .B $hexwindow Same as $window except the value is expressed as an hexidecimal string in the form 0xNNNNNN where NNNNNN is the hexadecimal digits. .TP .B $width This is the horizontal resolution in pixels and is taken from the width attribute in the HTML code. .TP .B $height This is the vertical resolution in pixels and is taken from the height attribute in the HTML code. .TP .B $file This is the file to play. If the command has the .B stream flag set, this variable contains the URL of the file to play. This is taken from the associated HTML code. The value is that of the attribute src, data, href, qtsrc, filename, url or location depending on which is present and whether the or tag is used. If the .B stream is not set, this variable contains a local temporary file that the browser has created. .TP .B $fragment This is the part of the original URL that appears after the # if it exists. Sometimes this contains additional information that could be useful for the application e.g. starting page number in a pdf document .TP .B $mimetype This variable contains the mime type of $file. .TP .B $VAR_ All the parameters of the or tags are made available in mozpluggerrc through environment variables. For example the parameter loop="1" in an tag defines the variable VAR_loop=1. .SH BUGS You have to remove ~/.netscape/plugin-list or ~/.mozilla/firefox/pluginreg.dat after changing the configuration, or nothing will happen. This is a Netscape/Mozilla/Firefox bug, not a MozPlugger bug. Netscape 3.x will not play anything for tags for which height or width are zero. This too is a Netscape bug. Occassionally you may notice some zombie mozplugger-helper processes (defunct), this is not a bug, this is by design. The zombie processes occur when either the application exits or when using .B nokill flag (without exiting the page with the embedded object). The zombie(s) are reaped when closing the web page containing the associated embedded objects. If using behind a non-transparent HTTP proxy, it may be found that the commands using the .B stream flag do not work. This is because the proxy settings are not passed to the application in the command line. To work around this situation, dont use the stream flag OR edit the mozpluggerrc file and passed in necessary proxy setiings via the command line. It has been found that certain combinations of browser and embedded application dont allow keyboard focus in the embedded application, if this happens to you try adding or removing the "needs_xembed" flag from the associated command in mozpluggerrc. .SH AUTHORS Fredrik Hubinette, hubbe@hubbe.net .br Louis Bavoil, louis@bavoil.net .br Peter Leese, peter@leese.net mozplugger-1.14.5/mozpluggerrc0000600000175000001440000003122511722504427015475 0ustar peterusers# Configure file for MozPlugger 1.14.4 # Version: Jan 04, 2012 # # Commands which are not installed on your system will not be used. # # 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. ################### ### m4 macros ### ################### changequote([,]) ### Helpers ### MPlayer define(MP_CMD,[mplayer -really-quiet -nojoystick -nofs -zoom -vo xv,x11 -ao esd,alsa,oss,arts,null -osdlevel 0 $1 /dev/audio audio/wav:wav:Microsoft wave file audio/x-wav:wav:Microsoft wave file audio/x-pn-wav:wav:Microsoft wave file audio/x-pn-windows-acm:wav:Microsoft wave file controls: play "$file" controls: wavplay -q "$file" controls noisy: bplay "$file" controls: splay "$file" nokill noisy : xmms -e -p "$file" repeat noisy swallow(alsaplayer): alsaplayer -q "$file" audio/x-pn-realaudio-plugin:rpm:RealPlayer Plugin Metafile audio/x-pn-realaudio:ra,rm,ram:Realaudio-plugin resource locator audio/x-realaudio:ra,rm,ram:RealAudio file application/vnd.rn-realmedia:rm:RealMedia file application/smil:smi:RealPlayer audio/vnd.rn-realaudio:ra,ram:RealAudio file audio/vnd.rn-realvideo:rv:RealVideo file nokill stream: hxplay "$file" nokill stream: realplay "$file" audio/x-ms-wax:wax:Windows Media Audio MP_AUDIO_STREAM(-playlist-playlist)) TM_AUDIO_STREAM() audio/x-ms-wma:wma:Windows Media Audio MP_AUDIO_STREAM() TM_AUDIO_STREAM() ####################### ### Documents ### ####################### image/sun-raster:rs:SUN raster image image/x-sun-raster:rs:SUN raster image image/x-rgb:rgb:RGB Image image/x-portable-pixmap:ppm:PPM Image image/x-portable-graymap:pgm:PGM Image image/x-portable-bitmap:pbm:PBM Image image/x-portable-anymap:pnm:PBM Image image/tiff:tiff,tif:TIFF image image/x-tiff:tiff,tif:TIFF image exits: display -window $window -backdrop "$file" repeat noisy swallow(gqview) fill: gqview -t "$file" swallow(:) maxaspect: xv -ima -igeom +9000+9000 -geometry +9000+9000 "$file" repeat swallow(display): display "$file" repeat swallow(Sdtimage) fill: sdtimage "$file" swallow(*qiv:) fill maxaspect: qiv -n "$file" image/x-xcf:xcf:Gimp Image image/xcf:xcf:Gimp Image application/x-gimp:xcf:Gimp Image application/gimp:xcf:Gimp Image application/photoshop:psd:PhotoShop Image application/x-photoshop:psd:PhotoShop Image exits: display -window $window -backdrop "$file" repeat swallow(display) fill: display "$file" application/pdf:pdf:PDF file application/x-pdf:pdf:PDF file text/pdf:pdf:PDF file text/x-pdf:pdf:PDF file ACROREAD() repeat noisy swallow(kpdf) fill: kpdf "$file" repeat noisy swallow(Xpdf) fill: xpdf -g +9000+9000 "$file" repeat noisy swallow(okular) fill: okular "$file" repeat noisy swallow(epdfview) fill: epdfview "$file" GV() repeat noisy fill exits: evince "$file" application/x-dvi:dvi:DVI file repeat swallow(kdvi) fill: kdvi "$file" repeat swallow(xdvi) fill: xdvi -safer -hush -geometry +9000+9000 "$file" application/x-postscript:ps:PostScript file application/postscript:ps:PostScript file GV() repeat noisy fill exits: evince "$file" application/x-rtf:rtf:Rich Text Format application/rtf:rtf:Rich Text Format text/rtf:rtf:Rich Text Format OO() repeat noisy swallow(AbiWord) fill: abiword --nosplash --geometry +9000+9000 "$file" repeat noisy swallow(kword): kword "$file" repeat noisy swallow(Ted) fill: Ted "$file" application/x-msword:doc,dot:Microsoft Word Document application/msword:doc,dot:Microsoft Word Document OO() repeat noisy swallow(kword): kword "$file" repeat noisy swallow(AbiWord) fill: abiword --nosplash --geometry +9000+9000 "$file" application/vnd.ms-excel:xls,xlb:Microsoft Excel Document OO() repeat swallow(Gnumeric) fill: gnumeric "$file" # OpenOffice MimeTypes (http://framework.openoffice.org/documentation/mimetypes/mimetypes.html) application/vnd.sun.xml.writer:sxw:OpenOffice Writer 6.0 documents application/so7_vnd.sun.xml.writer:sxw:OpenOffice Writer 7.0 documents application/vnd.sun.xml.writer.template:stw:OpenOffice Writer 6.0 templates application/vnd.sun.xml.writer.global:sxg:OpenOffice Writer 6.0 global documents application/vnd.stardivision.writer:sdw:StarWriter 5.x documents application/vnd.stardivision.writer-global:sgl:StarWriter 5.x global documents application/x-starwriter:sdw:StarWriter 4.x documents application/vnd.sun.xml.calc:sxc:OpenOffice Calc 6.0 spreadsheets application/so7_vnd.sun.xml.calc:sxc:OpenOffice Calc 7.0 spreadsheets application/vnd.sun.xml.calc.template:stc:OpenOffice Calc 6.0 templates application/vnd.stardivision.calc:sdc:StarCalc 5.x spreadsheets application/x-starcalc:sdc:StarCalc 4.x spreadsheets application/vnd.lotus-1-2-3: 123, wk1: Lotus 1-2-3 Document application/vnd.sun.xml.draw:sxd:OpenOffice Draw 6.0 documents application/so7_vnd.sun.xml.draw:sxc:StarOffice Draw 7.0 documents application/vnd.sun.xml.draw.template:std:OpenOffice Draw 6.0 templates application/vnd.stardivision.draw:sda:StarDraw 5.x documents application/x-stardraw:sda:StarDraw 4.x documents application/vnd.sun.xml.impress:sxi:OpenOffice Impress 6.0 presentations application/so7_vnd.sun.xml.impress:sxi:StarOffice 7.0 Impress presentations application/vnd.sun.xml.impress.template:sti:OpenOffice Impress 6.0 templates application/vnd.stardivision.impress:sdd:StarImpress 5.x presentations application/vnd.stardivision.impress-packed:sdp:StarImpress Packed 5.x files application/x-starimpress:sdd:StarImpress 4.x presentations application/vnd.ms-powerpoint:ppt:PowerPoint Slideshow application/mspowerpoint:ppt,ppz,pps,pot:PowerPoint Slideshow application/vnd.sun.xml.math:sxm:OpenOffice Math 6.0 documents application/so7_vnd.sun.xml.math:sxm:StarOffice 7.0 Math documents application/vnd.stardivision.math:smf:StarMath 5.x documents application/x-starmath:smf:StarMath 4.x documents application/vnd.oasis.opendocument.text:odt,ODT:OASIS OpenDocument Text application/vnd.oasis.opendocument.spreadsheet:ods,ODS:OASIS OpenDocument SpreadSheet application/vnd.oasis.opendocument.presentation:odp,ODP:OASIS OpenDocument Presentation OO() chemical/x-pdb:pdb: Protein Data Bank file model/x-pdb:pdb: Protein Data Bank file swallow(rasmol) fill: rasmol "$file" swallow(molecule) fill: /usr/X11R6/lib/xscreensaver/molecule -delay 20000 -geometry +9000+9000 -no-spin -molecule "$file" application/bge:blend:Blender Game Engine swallow(%f): blenderplayer $file mozplugger-1.14.5/ChangeLog0000600000175000001440000005726411722504427014617 0ustar peterusers2012-02-26 release 1.14.5 * npapi: Updated to NPAPI version 27 - mozdev bug #24760 * mozplugger.c: split out some code to npn-get-helpers.c to reduce size of mozplugger.c, plus added new stubs for the new NPAPI functions. 2012-01-04 release 1.14.4 * Makefile.in: Use 'install' not 'cp' as install will also correctly set file permissions. * child.c: Use setgpid() only in the controller and linker cases as was the case in version 1.13.1 before common code factored out into child.c mozdev bug #24544. 2011-03-03 release 1.14.3 * config.h.in, mozplugger.c, Makefile.in, configure.ac, configure: Add option to build for chromium by setting --enable-always-xembed, mozdev bug #23735 * Makefile: Introduce autoconf to build mozplugger. mozdev bug #23734 * mozplugger.c : Added code to handle URLs with semicolons in a safe manner. URL will still be rejected when streaming as the URL will be passes to the shell. mozdev bug #23733 * mozplugger.c : Added fix for mozdev bug #23732 2010-09-18 release 1.14.2 * mozplugger.c : Added fix for mozdev bug #23188 2010-08-07 release 1.14.1 * mozplugger.c: Added fix for mozdev bug #23007 * mozplugger.c: Added further improvements for mozdev bug #22863 (patches provided by Coretin Chary) * mozplugger.c: Added support for javascript mozdev bug #22717 2010-06-12 release 1.14.0 * mozplugger.c: Added code to check browser supports XEmbed, before reporting that plugin needs XEmbed. See mozdev bug #22890 * mozplugger.c: Added fix for mozdev bug #22863. * mozpluggerrc: Added suggested line to mozpluggerrc for epdfview. See mozdev bug#22597 2010-04-14 release 1.13.3 * mozplugger.h, mozplugger.c, mozplugger.7, mozpluggerrc: Remove H_HIDDEN as it doesnt actual do anything. * mozplugger.h, mozplugger.c, mozplugger.7: Added H_NEEDS_XEMBED as it is only required in certain cases otherwise it causes problems with keyboard focus. See Mozdev bugs #22723, #22715 and #22065 2010-02-17 release 1.13.2 * mozplugger-helper.c: Tidy-up - removed the repeated open display close display when repeats > 1. First withdraw window before reparenting. This makes it more robust as mozplugger is no longer fighting with the window manager. This fixes. Mozdev bug #22440. * mozplugger-child.c: Remove duplication of code by moving common child (app) handling code to a common file "mozplugger-child.c". 2010-01-24 release 1.13.1 * npapi : Updated to version 23 from the mozilla SDK. Not an exact copy but merge in of changes from mozilla SDK into mozplugger. * mozplugger-helper.c : Changed code to look for victim and reparent in a different way part of attempt to fix NX bug - using NX in particular configuration it was found that the swallow flag didnt work. * mozplugger.c : Added patch from Zhao for allowing mozplugger to work with QT/Webkit based browsers. Mozdev bug #22065 2009-08-22 release 1.13.0 * mozpluggerrc : Removed the outdated test for acroread version this avoids the misleading message about "sh: acroread: command not found" that appears on stderr. Mozdev bug #21144 * mozpluggerrc : Removed the incorrect test to see if mplayer supports vorbis. The user should edit mozpluggerrc to include or exclude mplayer based on what codecs that have compiled in or out of mplayer. Mozdev bug #21119 * mozplugger.c : Removed unecessary calls to exit() in mozplugger.c plus spotted fixed segmentation fault. Mozdev bug #21118 * mozplugger.c, mozpluggerrc: Fixed limit on number of handlers, mime types and commands. Instead there is now one limit which is on the amount of static memory allocated. Mozdev bug #21117 * mozplugger-helper.c: Added ability to expand the winname used in swallow to include the $file variable. This allows to capture those windows that take the name of the file they are displaying. Thanks to Przemek Króliszewski for providing the idea and intial patch. Mozdev bug #21071. * mozplugger.c, npunix.c, npapi.h & npupp.h: Bring API up to date by adding in missing functions. The API version is now 0.22. Note, no new functionality added yet. Also switched over to using nptypes.h which defines things like uint32_t etc. 2009-04-16 release 1.12.1 * mozplugger-helper.c, mozplugger-linker.c, mozplugger-controller.c: Removed select timeout to avoid CPU wakeups, add signal handler & pipe to monitor when the child process dies (as opposed to a polling loop) Mozdev bug #20662 * mozplugger-helper.c, mozpluggerrc: When starting a second instance of evince, the second process will die and hand over control to the first process. This causes mozplugger-helper to fail to swallow the window as it thinks evince has died. Solution is to set the exits flag in mozpluggerrc and alter the code to allow for both exits & swallow flags to be set at the same time. Mozdev bug #20686 * npapi: Removed the obsolote JRI code. That is removal of the jri* header files, the include of those header files in npapi.h, etc and the removal of the NPN_GetJavaClass call from mozplugger. 2008-11-13 release 1.12.0 * mozplugger-helper.c: Added additional checks to see if still have ownership of mutex semaphore to fix Mozdev bug #20088 * mozpluggerrc: Applied patch to provide support for okular (KDE 4). Mozdev bug #20114 (Laurent Leonard) * mozplugger,c, mozplugger.7, mozpluggerrc: Added the enviroment variable $fragment so that the trailing fragment (the bit after the #) can be passed to the application if so required. Updated mozpluggerrc with changes provided by Walter Neumann to use the $fragment for acroread. Mozdev bug #20087 (Peter Leese & Walter Neumann) * mozplugger-helper.c: Fix the problem that mozplugger always picks the command with stream flag set even if it is lower down the list of commands. Really mozplugger should test each in order. Mozdev bug #20079 2008-09-12 release 1.11.0 * mozplugger-helper.c: For gv, always call XMoveResizeWindow in adjust_window_size(), even when the target size has not changed. (Louis Bavoil) * mozplugger.c, mozplugger-linker.c: Added the functionality that if autostart=0 and the application doesnt handle autostart=0 that the linker will be used instead. * mozplugger-linker.c: Add new binary to handle the QT link special case that was previously done by the controller. (Peter Leese) * mozplugger-helper.c: Added patch from Ari Pollak to fix failure to swallow mozdev bug #19485 (Ari Pollak) * mozplugger-controller.c: Controls now have a 3 dimension look and go in when pressed. (Peter Leese) * npapi.h, npupp.h, npunix.c: Updated to as close to the latest versions from mozilla SDK but without breaking backwards compatibility. Result is that NPP_GetValue now works as expected - no new functionality added. (Peter Leese) * Makefile: Added fix for Mozdev bug #18943. (Ville Skytta) * mozplugger.c, mozplugger-common.c, mozplugger-helper.c, mozplugger.h: Tidy up - Moved include files out of mozplugger.h into various source files and deleted unnecessary ones. (Peter Leese) Corrected minor error where controller application incorrectly had the helper name (as see wehn using ps command). * mozplugger.c: Added call to safeURL for mms URLs. (Peter Leese) * mozplugger.c, mozplugger-common.c, mozplugger.h: Code modified so that location of mozdebug file shown in the about:plugins page is always correct. (Peter Leese) * mozplugger-helper.c, mozplugger.c, mozplugger.7: Code modfied not to use controls if mozilla passed null as the window to draw controls in. Updated man page to warn user of this possible situaton. Some debug messages were also changed so as not generate error messages but more friendly debug messages when this null window event occurs. - fix for Mozdev bug #18837 (Peter Leese) 2008-03-22 release 1.10.2 * mozplugger-controller.c: If mozpluggerrc command contains both the controls flag and $window macro, the old behaviour was a bit odd. This has been changed to instead put a small controller widget in top left corner of the window. This allows controls to still work and also it only obscures a small part of the window. (Peter Leese) * mozplugger.7: Added reference to (as well as ) to man page (Peter Leese) * mozplugger.c: Removed the redundant passed parameter 'data' from all the xxx_cb functions. (Peter Leese) Fixed minor memory leak (Peter Leese) 2008-01-06 release 1.10.1 * mozplugger-helper.c: Fixed XFree on uninitialized pointer in init_winrecur(). (Louis Bavoil) 2008-01-04 release 1.10.0 * mozplugger-helper.c: Added code to send ConfigureNotify event to the victim. (Peter Leese) [Mozdev bug #18298] * mozplugger.c: Added code to cache applications already previous found and thereby reduce the number of 'lstat' calls. (Peter Leese) * mozplugger.c, mozplugger.h & mozpluggerrc: Add the flag 'fmatch' so that its now possible to match particular commands with the contents of the URL e.g. if url ends with .asx use mplayer -playlist $file. (Peter Leese) This fixes Mozdev bug #10244 * mozplugger-helper.c: Fixed race condition when swallowing more than one window in parallel (peter leese) - [Mozdev bug #17775] and [Mozdev bug #13048] * mozplugger.c: Dramatically reduce size of allocated static memory (Peter Leese) * mozplugger-helper.c: Removed dependency on stdint.h (Peter Leese) [Mozdev bug #17532] 2007-12-02 release 1.9.0 * mozplugger.c: Added support for direct rtsp:// protocol urls (Peter Leese) * mozplugger.c: Allow controls to be drawn for full window objects (Peter Leese) * mozplugger.c: Only apply the work around to fix Mozdev bug #7734 for Mozilla API less than version 0.14 (Peter Leese) * mozplugger.7: Added some additional text to help user debug problems (Peter Leese) * mozplugger.h: Added new flag H_LINKS to cope with Quicktime using clickable link (Peter Leese) [Mozdev bug #18105] * mozplugger.c: Added new flag H_LINKS to cope with Quicktime using clickable link (Peter Leese) [Mozdev bug #18105] * mozpluggerrc: Added new flag H_LINKS to cope with Quicktime using clickable link Added the command for Mplayer, totem and Xine (Peter Leese) [Mozdev bug #18105] * mozplugger.7: Updated man to explain new "links" flag to cope with Quicktime using clickable link (Peter Leese) [Mozdev bug #18105] * mozplugger-helper.c: Removed launching of mozplugger-controller from helper, now launched directly from mozplugger.c hence no mozplugger-helper process is created (halving the number of processes running) (Peter Leese) [Mozdev bug #17775] * mozplugger.c: "controls" no longer use "swallow" mechanism (Peter Leese) [Mozdev bug #17775] * mozplugger-controller.c: mozplugger-controller now called directly from mozplugger.c hence no mozplugger-helper process is created (halving the number of processes running) (Peter Leese) [Mozdev bug #17775] * mozplugger-helper.c: Do not redirect SubstructureRequestMask events when H_SWALLOW is false (Peter Leese). [Mozdev bug #17787] * mozplugger-helper.c: Fixed race condition in setSwallowMutexOwner() (Peter Leese). [Mozdev bug #17775] * mozplugger-controller.c: Do not restart when repeats is 0 (Peter Leese). [Mozdev bug #17672] * mozplugger.c: Added support for OBJECT tags (Peter Leese). [Mozdev bug #17375] * Makefile: Fixed solaris-cc target. [Mozdev bug #17532] 2007-04-07 version 1.8.1 * mozplugger-helper.c: The mutex code did not work on amd64, causing the helper to hang forever (Ari Pollak). 2007-02-25 version 1.8.0 * mozplugger.c: Default "autostart" to off when using "controls" (Peter Leese). [Mozdev bug #16445] * mozplugger-helper.c: Added a mutex mechanism to avoid conflicts between multiple mozplugger-helper instances (Peter Leese). [Mozdev bug #16427] * mozplugger.c: In versions 1.7.x, for "stream" commands, the browser was downloading in parallel with the forked player. This has been fixed using NPN_DestroyStream (Peter Leese). [Mozdev bug #16423] 2007-01-17 version 1.7.4 * mozplugger.7: Updated mozpluggerrc paths. [Mozdev bug #14253] * mozpluggerrc: Merged with Mandriva package (Giuseppe Ghibò). Added Gimp (xcf) and Photoshop (psd). Added OASIS OpenDocument (odt, ods, odp). Added Protein Data Bank (pdb). Added Lotus 1-2-3 (123, wk1). Added FLAC audio. * mozplugger-helper.c: Removed hack which was resizing windows multiple times. * mozplugger.h, mozplugger-controller.c: Removed X11/Intrinsic.h includes. * mozplugger-helper.c: Clamp loop counter to 1 if less than 1. [Mozdev bug #11776] * mozplugger.c: Handle asterisks in mime-types. [Mozdev bug #11509] 2005-08-30 version 1.7.3 * mozplugger-helper.c: Fixed hidden-windows bug with Window Maker by mapping windows that are correctly reparented but not mapped yet, in the X event handler. [Mozdev bug #9971] * mozplugger-helper.c: Restored ConfigureRequest handler. * mozpluggerrc: Fixed GV command line for version 3.6.1. * mozpluggerrc: Switched mpg123 and mpg321. [Mozdev bug #10363] * mozpluggerrc: Added Totem support. * mozplugger.c: Added Quicktime and Windows Media Player spoof to plugin name. [Mozdev bug #9979] * mozplugger.c: Added call to do_read_config() in NPP_Initialize(). * mozplugger.c: Code cleanup. 2005-04-16 version 1.7.2 * mozplugger.c: Fixed parts of display obscured on firefox resize. [Mozdev bug #7734] * mozpluggerrc: Added support for Acrobat Reader 7. (Tim Clymo) Added support for evince for PDF and PS. [MozDev bug #9825] Removed spaces in mime types. [MozDev bug #9539] * mozplugger-controller.c: Replaced setpgrp() with setpgid(pid,0). [MozDev bug #8839] * mozplugger-helper.c: Removed the SubstructureRedirectMask handlers. * mozplugger.c: Now shows if DEBUG is enabled in "about:plugins". (Giuseppe Ghibò) 2005-01-04 version 1.7.1 * Makefile, README: Added make install prefix=/usr/local, make localinstall_mozilla, make localinstall_netscape, and make make localinstall_opera. * mozplugger.c: Code cleanup. * mozplugger.c: Fixed a memory leak with Mozilla >= 1.7. The old code made the assumption that global variables were shared between instances but this is not always true with Mozilla >= 1.7. * mozplugger.c: Now filters out mime-type handlers with no command. * mozpluggerrc: Updated MPlayer, acroread, gnumeric, and OpenOffice. (Giuseppe Ghibò) Disabled AbiWord because of problems reading from cache. Added hxplay and kwrite. Added stream flag to timitidy. * mozplugger-helper.c: Fixed not-maximized windows in adjust_window_size(). 2004-12-24 version 1.7.0 * npapi/include/npapi.h: Applied ia64 patch (David Mosberger-Tang). * mozpluggerrc: Disabled mpg321 with m3u files. [MozDev bug #7825] * mozplugger.7.bz2: There were multiple name lines. This made it impossible to translate the page to DocBook (Eric S. Raymond). * mozplugger.c: Disabled the no-browser-download feature to fix a bug with recent versions of Mozilla and Firefox when playing videos multiple times [MozDev bug #7296]. * mozplugger-common.c, mozplugger.h: Increased the timeout for a process to exit from 4ms to 100ms to let enough time to Acrobat Reader to save its preferences when killed by SIGTERM. * mozplugger-helper.c: Fixed bug on ConfigureRequest: the window was not always resized. Resize the window before calling XMapWindow() on ReparentNotify. * mozplugger-helper.c: Removed XMapWindow() on UnmapNotify to fix flashing windows when swallowing applications. * mozplugger-helper.c: Fixed a regression over MozPlugger 1.5.2: When an application was previously opened outside of Mozilla, MozPlugger swallowed its window instead of the right window. 2004-09-27 version 1.6.2 * mozpluggerrc: The Acrobat Reader entry does not rely on -tempFileTitle anymore. * mozplugger-helper.c: Removed loop on XReparentWindow(). Added XMapWindow(display, victim) on UnmapNotify. * mozplugger.c: Returns NPERR_GENERIC_ERROR in NPP_NewStream() when streaming to fix a caching bug with Firefox. * mozplugger-helper.c: Removed unnecessary calls to XSync() and XMapWindow(). * mozplugger-helper.c: Changed the default string comparaison function used with swallow() from strncasecmp() to strstr(). * mozpluggerrc: More reliable OpenOffice swallowing. Fixed bug with XV 3.10. 2004-08-18 version 1.6.1 * mozplugger-helper.c: Fixed bug introduced in the version 1.6.0. MozPlugger was not waiting for applications that didn't use the swallow feature. [MozDev bug #7032] * mozplugger-helper.c: Changed the string comparaison function used with swallow() from strcasecmp() to strncasecmp() to fix problems with Xpdf and Ted. [MozDev bug #6945] * mozplugger-helper.c: Now calls XReparentWindow() multiple times to fix the swallow feature on some X servers. [Debian bug #264955] * mozpluggerrc: Don't specify audio output driver for mplayer (should be specified in mplayer config). Added the openoffice command to the OO() macro. Added the -e and -p options to xmms. Removed the -window and -backdrop options from display. 2004-07-11 version 1.6.0 New features from Plugger 5.1.2. * mozplugger-helper.c: New swallowing mechanism. Removed the "event_swallow" flag. * mozplugger.c: Now uses m4 to expand the config file. Added the "hidden" flag. * mozplugger.c, mozplugger-helper.c: Fixed window resizing. * mozpluggerrc: Now swallows OpenOffice windows. Disabled helper applications by default. * mozplugger-common.c: When compiled with DEBUG defined, the mozdebug file is now created in $TMPDIR instead of /tmp. 2004-03-28 version 1.5.2 * mozplugger.c: Now uses the event_swallow method with mozplugger-controller. * mozplugger-controller.c: Fixed a buffer overflow. * mozplugger-controller.c: Does not pop up the window anymore. * mozplugger-helper.c: Fixed a bug with event_swallow that made it fail if the target window was created before the event selection had been actually done by the helper. 2004-02-24 version 1.5.1 * mozplugger-helper.c: Added XMapWindow() again to fix windows not appearing on some X servers. * mozplugger-helper.c: Returned to the "event_swallow" behavior of 1.4.2 to fix windows not being reparented on some computers. 2004-01-15 version 1.5.0 * mozplugger.c: Added MMS support. * mozplugger.c: Can now loop when using the "controls" flag. * mozplugger-helper.c: Better Quicktime support using the qtsrc field of EMBED tags when available. (Kees Cook) * mozplugger-helper.c: Fixed window reparent failing randomly with the "event_swallow" flag. (Eric Kerin) * mozplugger-helper.c: In the event_swallow mode, MozPlugger now waits passively for X events. * mozpluggerrc: Now uses "event_swallow" with Acrobat Reader. * mozpluggerrc: Removed -nocache 100 to avoid mplayer to hang after some seconds of playback. * mozplugger.c, mozplugger-helper.c: Removed dead code which was using SIGWINCH. 2003-12-16 version 1.4.2 * mozpluggerrc: Added the "stream" flag to RealPlayer. * mozplugger.c: Fixed a segmentation fault when exporting variables with no value. * mozplugger.c: Fixed a free() on a literal string which made the plugin crash when parsing commands with the "controls" flag. 2003-12-07 version 1.4.1 * mozpluggerrc: Added soffice. * mozpluggerrc: Added the option -cache 100 to mplayer. * mozplugger.c, mozpluggerrc: Merged the flags "nokill" and "exits" into "nokill". * mozplugger-helper.c: Removed the flags "many" and "nofull". * mozplugger-controller.c: New file created. * mozplugger.c, mozpluggerrc: Added the flag "controls" to display a controller with the buttons play, pause and stop while playing. * mozplugger.c: Added the flags "embed" and "noembed" to enable to define embed-only or full-window-only applications in the rc file. * mozplugger.c: All the paramters of the tags are made available in mozpluggerrc through environment variables. * Makefile: Renamed the helper application from mozplugger to mozplugger-helper and added mozplugger-controller. 2003-09-10 version 1.3.2 * mozplugger-helper.c: Improved swallowing accuracy by scanning windows twice faster. * mozplugger.c: Fixed regression: the mozplugger helper could not be found in ~/.mozilla, ~/.netscape or ~/.opera. 2003-08-30 version 1.3.1 * Makefile: Now works with the HP-UX compilation tools. * mozplugger-helper.c: Removed some dead code. * mozpluggerrc: Fixed bug with timidity that prevented midi files to be played in loop. 2003-07-05 version 1.3.0 Major code cleanup. * mozplugger-common.c: New file created. * mozplugger-helper.c, mozplugger.c: Added the flag "event_swallow" to use an alternative event driven code. (Eric Kerin) * mozplugger.c: In some conditions, MozPlugger now uses the href field of embed tags. (Rafael Santiago) * mozplugger.c: The memory of an instance was not freed when the instance was destroyed. * mozplugger.c: Some embeded applications were not killed when leaving a page. * mozplugger.c: For some files, Mozilla did not give the right MIME type to Mozplugger when creating a new stream. Mozplugger now uses the type given at instanciation time. * mozplugger.c: Embeded files with loop=0 were not played. * mozplugger.c: The files begining with a / were not accepted. * mozplugger-helper.c: The "maxaspect" flag did not work correctly. * mozpluggerrc: Removed -guiwid from mplayer lines; Uses the new event_swallow() with gv and Ted. 2003-06-14 version 1.2.1 * mozplugger-helper.c: The swallow feature did not work on some computers. Mozplugger now scans potential victim windows faster. It takes a little more CPU in the initialization of the swallow but it is more accurate. 2003-05-28 version 1.2.0 * mozplugger.c: MIME types for which no application is found are not registered into Mozilla. * mozplugger.c: Some Windows did not resize properly. (Eric Kerin) * mozplugger.c: Added the flag "nofull" to restrict swallow. 2003-04-24 version 1.1.3 * mozpluggerrc: Added Ted and fixed Abiword. * mozplugger.c: Fixed a bug with Mozilla 1.3 when re-opening media files. * mozplugger.c: By default, plugins are now repeated once. * mozplugger-helper.c: Mozplugger swallows the most recently opened instance of a window, not the first found. (Bernard Blackham) 2003-03-14 version 1.1.2 * mozpluggerrc: Multiple invocations of Acrobat Reader continually spawned new processes. * mozplugger.c: Could not play mpeg mail attachments within mail using mplayer. * mozplugger.c, mozplugger-helper.c: Fixed bug on 64-bit architectures. * mozplugger-helper.c: New environment variables : $width and $height 2003-02-17 version 1.1.1 * mozpluggerrc: Added OGG and StarOffice support * mozplugger.c: It is no more useful to duplicate a command in the rc file with and without the "stream" flag. * mozplugger.c: Some embeded files were played twice. 2003-02-16 version 1.1 * mozpluggerrc: Added the support of PDF files Added xine after mplayer for MPEG 1 and 2 Fixed bug with mplayer : fork bomb on some unplayable files Fixed bug with xmms : temporary files undeleted in /tmp/plugtmp * mozplugger.c: When using the "exits" flag, mozplugger (and plugger 4.0) let a process in the system, until Mozilla exits. 2003-02-08 version 1.0 * mozplugger.c, mozplugger-helper.c: The "stream" flag of the file pluggerrc has been changed to make the browser just pass an URL to the player without downloading the file. The old behaviour is no more supported by Mozilla. * mozplugger.c: Fixed bug with Mozilla 1.x : a zombie process was created for each loaded plugin, until Mozilla exits. * mozplugger.c: "Running helper..." is no more displayed in the status bar. mozplugger-1.14.5/README0000600000175000001440000000555611722504427013722 0ustar peterusersThis is MozPlugger version 1.14.4 Originally written by Fredrik Hübinette (c) 1997-2001 Maintained by Louis Bavoil and Peter Leese (c) 2002-2012 Homepage : http://mozplugger.mozdev.org This software is distributed under the General Public License. Absolutely no warranties. Use this software on your own risk. See the file COPYING for more information. As of Feb 2011, the distrubtion includes configure.ac and Makefile.in. Eventually the standard GNU ./configure && make && make install mechanism will supercede the previous Makefile. For advantageous users (i.e. this will overwrite the Makefile) to compile do the following: 1/ 'cp Makefile Makefile.old' 2/ 'autoconf' 3/ 'chmod +x configure' 4/ './configure --help' to view possible options 5/ './configure --prefix=/usr --sysconfdir=/etc' for same behaviour as before 6/ 'make xx' as before... If this fails report bug and do the following 1/ 'cp Makefile.old Makefile' To re-compile: If necessary, edit Makefile to suit to your system. Type 'make xx'. Where xx = the platform and/or type of build you want. e.g. 1/ 'make linux' - builds for linux 2/ 'make linux BUILD=DEBUG' - builds debug version for linux 3/ 'make linux libprefix=/lib64' - builds and links against the for 64bit libraries If you just type 'make' it should list the options available Notes: * You will need X-libs development pacakge installed so that the build can find the appropriate include files. To install in your own directory: (for Mozilla/Firefox) make localinstall_mozilla To install in your own directory: (for Netscape) make localinstall_netscape To install in your own directory: (for Opera) make localinstall_opera To install globally: make install or: make install prefix=/usr/local or: make install libprefix=/lib64 By default, the plugin is installed in /usr/lib/mozilla/plugins/ On some systems, the plugin directory may be elsewhere, for example /usr/lib/netscape/plugins /usr/lib/firefox/plugins $MOZILLA_HOME/plugins If you find that your browser fails to detect the plugin, you need to place place a symbolic link in your paricular plugin directory that points to /usr/lib/mozilla/plugins/mozplugger.so. I believe this is the case for Ubuntu where firefox looks in /usr/lib/firefox/plugins If you don't want to put mozpluggerrc in /etc/ you can put it in one of: $MOZPLUGGER_HOME/ $HOME/.mozplugger/ $HOME/.netscape/ $HOME/.mozilla/ $HOME/.opera/ $MOZILLA_HOME/ $OPERA_HOME/ /usr/local/netscape/ /etc/ /usr/local/mozilla/ /usr/local/netscape/ You might also want to customize your 'mozpluggerrc' file before installing it. In case of problem with this version, submit a bug report on http://mozplugger.mozdev.org describing your problem, your system and an URL which causes the problem if possible. mozplugger-1.14.5/child.h0000600000175000001440000000246611722504427014273 0ustar peterusers/***************************************************************************** * * Author: Peter Leese * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * *****************************************************************************/ #ifndef _MOZPLUGGER_CHILD_ #define _MOZPLUGGER_CHILD_ extern void restore_SIGCHLD_to_default(void); /* Use this to redirct the SIGCHLD signal to a file descriptor so we can * select on this signal */ extern void redirect_SIGCHLD_to_fd(void); extern int get_SIGCHLD_fd(void); extern void handle_SIGCHLD_event(void); extern pid_t spawn_app(char * command, const int flags, const int maxOpenFd); #endif mozplugger-1.14.5/npapi/0000755000175000001440000000000011722504427014146 5ustar peterusersmozplugger-1.14.5/npapi/include/0000755000175000001440000000000011722504427015571 5ustar peterusersmozplugger-1.14.5/npapi/include/npruntime.h0000600000175000001440000003777611722504427017777 0ustar peterusers/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Copyright (c) 2004, Apple Computer, Inc. and The Mozilla Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla * Foundation ("Mozilla") nor the names of their contributors may be used * to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR * THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef _NP_RUNTIME_H_ #define _NP_RUNTIME_H_ #ifdef __cplusplus extern "C" { #endif #include "nptypes.h" /* This API is used to facilitate binding code written in C to script objects. The API in this header does not assume the presence of a user agent. That is, it can be used to bind C code to scripting environments outside of the context of a user agent. However, the normal use of the this API is in the context of a scripting environment running in a browser or other user agent. In particular it is used to support the extended Netscape script-ability API for plugins (NP-SAP). NP-SAP is an extension of the Netscape plugin API. As such we have adopted the use of the "NP" prefix for this API. The following NP{N|P}Variables were added to the Netscape plugin API (in npapi.h): NPNVWindowNPObject NPNVPluginElementNPObject NPPVpluginScriptableNPObject These variables are exposed through NPN_GetValue() and NPP_GetValue() (respectively) and are used to establish the initial binding between the user agent and native code. The DOM objects in the user agent can be examined and manipulated using the NPN_ functions that operate on NPObjects described in this header. To the extent possible the assumptions about the scripting language used by the scripting environment have been minimized. */ #define NP_BEGIN_MACRO do { #define NP_END_MACRO } while (0) /* Objects (non-primitive data) passed between 'C' and script is always wrapped in an NPObject. The 'interface' of an NPObject is described by an NPClass. */ typedef struct NPObject NPObject; typedef struct NPClass NPClass; typedef char NPUTF8; typedef struct _NPString { const NPUTF8 *UTF8Characters; uint32_t UTF8Length; } NPString; typedef enum { NPVariantType_Void, NPVariantType_Null, NPVariantType_Bool, NPVariantType_Int32, NPVariantType_Double, NPVariantType_String, NPVariantType_Object } NPVariantType; typedef struct _NPVariant { NPVariantType type; union { bool boolValue; int32_t intValue; double doubleValue; NPString stringValue; NPObject *objectValue; } value; } NPVariant; /* NPN_ReleaseVariantValue is called on all 'out' parameters references. Specifically it is to be called on variants that own their value, as is the case with all non-const NPVariant* arguments after a successful call to any methods (except this one) in this API. After calling NPN_ReleaseVariantValue, the type of the variant will be NPVariantType_Void. */ void NPN_ReleaseVariantValue(NPVariant *variant); #define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void) #define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null) #define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool) #define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32) #define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double) #define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String) #define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object) #define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue) #define NPVARIANT_TO_INT32(_v) ((_v).value.intValue) #define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue) #define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue) #define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue) #define VOID_TO_NPVARIANT(_v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Void; \ (_v).value.objectValue = NULL; \ NP_END_MACRO #define NULL_TO_NPVARIANT(_v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Null; \ (_v).value.objectValue = NULL; \ NP_END_MACRO #define BOOLEAN_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Bool; \ (_v).value.boolValue = !!(_val); \ NP_END_MACRO #define INT32_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Int32; \ (_v).value.intValue = _val; \ NP_END_MACRO #define DOUBLE_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Double; \ (_v).value.doubleValue = _val; \ NP_END_MACRO #define STRINGZ_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_String; \ NPString str = { _val, (uint32_t)(strlen(_val)) }; \ (_v).value.stringValue = str; \ NP_END_MACRO #define STRINGN_TO_NPVARIANT(_val, _len, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_String; \ NPString str = { _val, (uint32_t)(_len) }; \ (_v).value.stringValue = str; \ NP_END_MACRO #define OBJECT_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Object; \ (_v).value.objectValue = _val; \ NP_END_MACRO /* Type mappings (JavaScript types have been used for illustration purposes): JavaScript to C (NPVariant with type:) undefined NPVariantType_Void null NPVariantType_Null Boolean NPVariantType_Bool Number NPVariantType_Double or NPVariantType_Int32 String NPVariantType_String Object NPVariantType_Object C (NPVariant with type:) to JavaScript NPVariantType_Void undefined NPVariantType_Null null NPVariantType_Bool Boolean NPVariantType_Int32 Number NPVariantType_Double Number NPVariantType_String String NPVariantType_Object Object */ typedef void *NPIdentifier; /* NPObjects have methods and properties. Methods and properties are identified with NPIdentifiers. These identifiers may be reflected in script. NPIdentifiers can be either strings or integers, IOW, methods and properties can be identified by either strings or integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be compared using ==. In case of any errors, the requested NPIdentifier(s) will be NULL. NPIdentifier lifetime is controlled by the browser. Plugins do not need to worry about memory management with regards to NPIdentifiers. */ NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name); void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers); NPIdentifier NPN_GetIntIdentifier(int32_t intid); bool NPN_IdentifierIsString(NPIdentifier identifier); /* The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed. */ NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier); /* Get the integer represented by identifier. If identifier is not an integer identifier, the behaviour is undefined. */ int32_t NPN_IntFromIdentifier(NPIdentifier identifier); /* NPObject behavior is implemented using the following set of callback functions. The NPVariant *result argument of these functions (where applicable) should be released using NPN_ReleaseVariantValue(). */ typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass); typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj); typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj); typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name); typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name); typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name, NPVariant *result); typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name, const NPVariant *value); typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj, NPIdentifier name); typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value, uint32_t *count); typedef bool (*NPConstructFunctionPtr)(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); /* NPObjects returned by create, retain, invoke, and getProperty pass a reference count to the caller. That is, the callee adds a reference count which passes to the caller. It is the caller's responsibility to release the returned object. NPInvokeFunctionPtr function may return 0 to indicate a void result. NPInvalidateFunctionPtr is called by the scripting environment when the native code is shutdown. Any attempt to message a NPObject instance after the invalidate callback has been called will result in undefined behavior, even if the native code is still retaining those NPObject instances. (The runtime will typically return immediately, with 0 or NULL, from an attempt to dispatch to a NPObject, but this behavior should not be depended upon.) The NPEnumerationFunctionPtr function may pass an array of NPIdentifiers back to the caller. The callee allocs the memory of the array using NPN_MemAlloc(), and it's the caller's responsibility to release it using NPN_MemFree(). */ struct NPClass { uint32_t structVersion; NPAllocateFunctionPtr allocate; NPDeallocateFunctionPtr deallocate; NPInvalidateFunctionPtr invalidate; NPHasMethodFunctionPtr hasMethod; NPInvokeFunctionPtr invoke; NPInvokeDefaultFunctionPtr invokeDefault; NPHasPropertyFunctionPtr hasProperty; NPGetPropertyFunctionPtr getProperty; NPSetPropertyFunctionPtr setProperty; NPRemovePropertyFunctionPtr removeProperty; NPEnumerationFunctionPtr enumerate; NPConstructFunctionPtr construct; }; #define NP_CLASS_STRUCT_VERSION 3 #define NP_CLASS_STRUCT_VERSION_ENUM 2 #define NP_CLASS_STRUCT_VERSION_CTOR 3 #define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass) \ ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM) #define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass) \ ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR) struct NPObject { NPClass *_class; uint32_t referenceCount; /* * Additional space may be allocated here by types of NPObjects */ }; /* If the class has an allocate function, NPN_CreateObject invokes that function, otherwise a NPObject is allocated and returned. This method will initialize the referenceCount member of the NPObject to 1. */ NPObject *NPN_CreateObject(NPP npp, NPClass *aClass); /* Increment the NPObject's reference count. */ NPObject *NPN_RetainObject(NPObject *npobj); /* Decremented the NPObject's reference count. If the reference count goes to zero, the class's destroy function is invoke if specified, otherwise the object is freed directly. */ void NPN_ReleaseObject(NPObject *npobj); /* Functions to access script objects represented by NPObject. Calls to script objects are synchronous. If a function returns a value, it will be supplied via the result NPVariant argument. Successful calls will return true, false will be returned in case of an error. Calls made from plugin code to script must be made from the thread on which the plugin was initialized. */ bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result); bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script, NPVariant *result); bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, NPVariant *result); bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value); bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName); bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count); bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); /* NPN_SetException may be called to trigger a script exception upon return from entry points into NPObjects. Typical usage: NPN_SetException (npobj, message); */ void NPN_SetException(NPObject *npobj, const NPUTF8 *message); #ifdef __cplusplus } #endif #endif mozplugger-1.14.5/npapi/include/npapi.h0000700000175000001440000005126211722504427017050 0ustar peterusers/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef npapi_h_ #define npapi_h_ #include "nptypes.h" /* * npapi.h Mozilla 3.48 But with MACOS and WINDOWS stuff removed and * some stuff commented out for backwards compatibility * Netscape client plug-in API spec */ #if defined(XP_UNIX) # include # include # include #endif /*----------------------------------------------------------------------*/ /* Plugin Version Constants */ /*----------------------------------------------------------------------*/ #define NP_VERSION_MAJOR 0 #define NP_VERSION_MINOR 27 /*----------------------------------------------------------------------*/ /* Definition of Basic Types */ /*----------------------------------------------------------------------*/ typedef unsigned char NPBool; typedef int16_t NPError; typedef int16_t NPReason; typedef char* NPMIMEType; /*----------------------------------------------------------------------*/ /* Structures and definitions */ /*----------------------------------------------------------------------*/ /* * NPP is a plug-in's opaque instance handle */ typedef struct _NPP { void* pdata; /* plug-in private data */ void* ndata; /* netscape private data */ } NPP_t; typedef NPP_t* NPP; typedef struct _NPStream { void* pdata; /* plug-in private data */ void* ndata; /* netscape private data */ const char* url; uint32_t end; uint32_t lastmodified; void* notifyData; const char* headers; /* Response headers from host. * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. * Used for HTTP only; NULL for non-HTTP. * Available from NPP_NewStream onwards. * Plugin should copy this data before storing it. * Includes HTTP status line and all headers, * preferably verbatim as received from server, * headers formatted as in HTTP ("Header: Value"), * and newlines (\n, NOT \r\n) separating lines. * Terminated by \n\0 (NOT \n\n\0). */ } NPStream; typedef struct _NPByteRange { int32_t offset; /* negative offset means from the end */ uint32_t length; struct _NPByteRange* next; } NPByteRange; typedef struct _NPSavedData { int32_t len; void* buf; } NPSavedData; typedef struct _NPRect { uint16_t top; uint16_t left; uint16_t bottom; uint16_t right; } NPRect; typedef struct _NPSize { int32_t width; int32_t height; } NPSize; typedef enum { NPFocusNext = 0, NPFocusPrevious = 1 } NPFocusDirection; /* Return values for NPP_HandleEvent */ #define kNPEventNotHandled 0 #define kNPEventHandled 1 /* Exact meaning must be spec'd in event model. */ #define kNPEventStartIME 2 #if defined(XP_UNIX) /* * Unix specific structures and definitions */ /* * Callback Structures. * * These are used to pass additional platform specific information. */ enum { NP_SETWINDOW = 1, NP_PRINT }; typedef struct { int32_t type; } NPAnyCallbackStruct; typedef struct { int32_t type; Display* display; Visual* visual; Colormap colormap; unsigned int depth; } NPSetWindowCallbackStruct; typedef struct { int32_t type; FILE* fp; } NPPrintCallbackStruct; #endif /* XP_UNIX */ /* * The following masks are applied on certain platforms to NPNV and * NPPV selectors that pass around pointers to COM interfaces. Newer * compilers on some platforms may generate vtables that are not * compatible with older compilers. To prevent older plugins from * not understanding a new browser's ABI, these masks change the * values of those selectors on those platforms. To remain backwards * compatible with different versions of the browser, plugins can * use these masks to dynamically determine and use the correct C++ * ABI that the browser is expecting. This does not apply to Windows * as Microsoft's COM ABI will likely not change. */ #define NP_ABI_GCC3_MASK 0x10000000 /* * gcc 3.x generated vtables on UNIX and OSX are incompatible with * previous compilers. */ #if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK #else #define _NP_ABI_MIXIN_FOR_GCC3 0 #endif #define _NP_ABI_MIXIN_FOR_MACHO 0 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) /* * List of variable names for which NPP_GetValue shall be implemented */ typedef enum { NPPVpluginNameString = 1, NPPVpluginDescriptionString, NPPVpluginWindowBool, NPPVpluginTransparentBool, NPPVjavaClass, NPPVpluginWindowSize, NPPVpluginTimerInterval, NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), NPPVpluginScriptableIID = 11, /* Introduced in Mozilla 0.9.9 */ NPPVjavascriptPushCallerBool = 12, /* Introduced in Mozilla 1.0 */ NPPVpluginKeepLibraryInMemory = 13, NPPVpluginNeedsXEmbed = 14, /* Get the NPObject for scripting the plugin. Introduced in Firefox * 1.0 (NPAPI minor version 14). */ NPPVpluginScriptableNPObject = 15, /* Get the plugin value (as \0-terminated UTF-8 string data) for * form submission if the plugin is part of a form. Use * NPN_MemAlloc() to allocate memory for the string data. Introduced * in NPAPI minor version 15. */ NPPVformValue = 16, NPPVpluginUrlRequestsDisplayedBool = 17, /* Checks if the plugin is interested in receiving the http body of * all http requests (including failed ones, http status != 200). */ NPPVpluginWantsAllNetworkStreams = 18, /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */ NPPVpluginNativeAccessibleAtkPlugId = 19, /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ NPPVpluginCancelSrcStream = 20, NPPVsupportsAdvancedKeyHandling = 21, NPPVpluginUsesDOMForCursorBool = 22 #ifdef MOZ_PLATFORM_HILDON , NPPVpluginWindowlessLocalBool = 2002 #endif } NPPVariable; /* * List of variable names for which NPN_GetValue should be implemented. */ typedef enum { NPNVxDisplay = 1, NPNVxtAppContext, NPNVnetscapeWindow, NPNVjavascriptEnabledBool, NPNVasdEnabledBool, NPNVisOfflineBool, /* 10 and over are available on Mozilla builds starting with 0.9.4 */ NPNVserviceManager = (10 | NP_ABI_MASK), NPNVDOMElement = (11 | NP_ABI_MASK), NPNVDOMWindow = (12 | NP_ABI_MASK), NPNVToolkit = (13 | NP_ABI_MASK), NPNVSupportsXEmbedBool = 14, /* Get the NPObject wrapper for the browser window. */ NPNVWindowNPObject = 15, /* Get the NPObject wrapper for the plugins DOM element. */ NPNVPluginElementNPObject = 16, NPNVSupportsWindowless = 17, NPNVprivateModeBool = 18, NPNVsupportsAdvancedKeyHandling = 21, NPNVdocumentOrigin = 22 #ifdef MOZ_PLATFORM_HILDON , NPNVSupportsWindowlessLocal = 2002 #endif } NPNVariable; typedef enum { NPNURLVCookie = 501, NPNURLVProxy } NPNURLVariable; /* * The type of Toolkit the widgets use */ typedef enum { NPNVGtk12 = 1, NPNVGtk2 } NPNToolkitType; /* * The type of a NPWindow - it specifies the type of the data structure * returned in the window field. */ typedef enum { NPWindowTypeWindow = 1, NPWindowTypeDrawable } NPWindowType; typedef struct _NPWindow { void* window; /* Platform specific window handle */ /* OS/2: x - Position of bottom left corner */ /* OS/2: y - relative to visible netscape window */ int32_t x; /* Position of top left corner relative */ int32_t y; /* to a netscape page. */ uint32_t width; /* Maximum window size */ uint32_t height; NPRect clipRect; /* Clipping rectangle in port coordinates */ #if defined(XP_UNIX) void * ws_info; /* Platform-dependent additional data */ #endif /* XP_UNIX */ NPWindowType type; /* Is this a window or a drawable? */ } NPWindow; typedef struct _NPImageExpose { char* data; /* image pointer */ int32_t stride; /* Stride of data image pointer */ int32_t depth; /* Depth of image pointer */ int32_t x; /* Expose x */ int32_t y; /* Expose y */ uint32_t width; /* Expose width */ uint32_t height; /* Expose height */ NPSize dataSize; /* Data buffer size */ float translateX; /* translate X matrix value */ float translateY; /* translate Y matrix value */ float scaleX; /* scale X matrix value */ float scaleY; /* scale Y matrix value */ } NPImageExpose; typedef struct _NPFullPrint { NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ NPBool printOne; /* TRUE if plugin should print one copy to default printer */ void* platformPrint; /* Platform-specific printing info */ } NPFullPrint; typedef struct _NPEmbedPrint { NPWindow window; void* platformPrint; /* Platform-specific printing info */ } NPEmbedPrint; typedef struct _NPPrint { uint16_t mode; /* NP_FULL or NP_EMBED */ union { NPFullPrint fullPrint; /* if mode is NP_FULL */ NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ } print; } NPPrint; #if defined (XP_UNIX) typedef XEvent NPEvent; #else typedef void* NPEvent; #endif #if defined(XP_UNIX) typedef Region NPRegion; #else typedef void *NPRegion; #endif typedef struct _NPNSString NPNSString; typedef struct _NPNSWindow NPNSWindow; typedef struct _NPNSMenu NPNSMenu; typedef void *NPMenu; typedef enum { NPCoordinateSpacePlugin = 1, NPCoordinateSpaceWindow, NPCoordinateSpaceFlippedWindow, NPCoordinateSpaceScreen, NPCoordinateSpaceFlippedScreen } NPCoordinateSpace; /* * Values for mode passed to NPP_New: */ #define NP_EMBED 1 #define NP_FULL 2 /* * Values for stream type passed to NPP_NewStream: */ #define NP_NORMAL 1 #define NP_SEEK 2 #define NP_ASFILE 3 #define NP_ASFILEONLY 4 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1) /*----------------------------------------------------------------------*/ /* Error and Reason Code definitions */ /*----------------------------------------------------------------------*/ /* * Values of type NPError: */ #define NPERR_BASE 0 #define NPERR_NO_ERROR (NPERR_BASE + 0) #define NPERR_GENERIC_ERROR (NPERR_BASE + 1) #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) #define NPERR_INVALID_PARAM (NPERR_BASE + 9) #define NPERR_INVALID_URL (NPERR_BASE + 10) #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) #define NPERR_NO_DATA (NPERR_BASE + 12) #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) #define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14) #define NPERR_MALFORMED_SITE (NPERR_BASE + 15) /* * Values of type NPReason: */ #define NPRES_BASE 0 #define NPRES_DONE (NPRES_BASE + 0) #define NPRES_NETWORK_ERR (NPRES_BASE + 1) #define NPRES_USER_BREAK (NPRES_BASE + 2) /* * Don't use these obsolete error codes any more. */ #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK /* * Version feature information */ #define NPVERS_HAS_STREAMOUTPUT 8 #define NPVERS_HAS_NOTIFICATION 9 #define NPVERS_HAS_LIVECONNECT 9 #define NPVERS_68K_HAS_LIVECONNECT 11 #define NPVERS_HAS_WINDOWLESS 11 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13 #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 #define NPVERS_HAS_FORM_VALUES 15 #define NPVERS_HAS_POPUPS_ENABLED_STATE 16 #define NPVERS_HAS_RESPONSE_HEADERS 17 #define NPVERS_HAS_NPOBJECT_ENUM 18 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 #define NPVERS_HAS_ALL_NETWORK_STREAMS 20 #define NPVERS_HAS_URL_AND_AUTH_INFO 21 #define NPVERS_HAS_PRIVATE_MODE 22 #define NPVERS_MACOSX_HAS_COCOA_EVENTS 23 #define NPVERS_HAS_ADVANCED_KEY_HANDLING 25 #define NPVERS_HAS_URL_REDIRECT_HANDLING 26 #define NPVERS_HAS_CLEAR_SITE_DATA 27 /*----------------------------------------------------------------------*/ /* Function Prototypes */ /*----------------------------------------------------------------------*/ #define NP_LOADDS #ifdef __cplusplus extern "C" { #endif /* NPP_* functions are provided by the plugin and called by the navigator. */ #if defined(XP_UNIX) const char* NPP_GetMIMEDescription(void); #endif NPError NP_LOADDS NPP_Initialize(); void NP_LOADDS NPP_Shutdown(); NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event); void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData); NPError NP_LOADDS NPP_GetValue(void * instance, NPPVariable variable, void *value); NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction); void NP_LOADDS NPP_LostFocus(NPP instance); void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData); NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge); char** NP_LOADDS NPP_GetSitesWithData(void); /* NPN_* functions are provided by the navigator and called by the plugin. */ void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor); NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, const char* target, void* notifyData); NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, const char* target); NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData); NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file); NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream); int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer); NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); void NP_LOADDS NPN_Status(NPP instance, const char* message); const char* NP_LOADDS NPN_UserAgent(NPP instance); void* NP_LOADDS NPN_MemAlloc(uint32_t size); void NP_LOADDS NPN_MemFree(void* ptr); uint32_t NP_LOADDS NPN_MemFlush(uint32_t size); void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, void *value); NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, void *value); void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); void NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion); void NP_LOADDS NPN_ForceRedraw(NPP instance); void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance); void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData); NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char *url, char **value, uint32_t *len); NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len); NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID); NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu); NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled); NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction); void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow); #ifdef __cplusplus } /* end extern "C" */ #endif #endif /* npapi_h_ */ mozplugger-1.14.5/npapi/include/nptypes.h0000600000175000001440000000740511722504427017442 0ustar peterusers/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * mozilla.org. * Portions created by the Initial Developer are Copyright (C) 2004 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Johnny Stenback (Original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nptypes_h_ #define nptypes_h_ /* * Header file for ensuring that C99 types ([u]int32_t, [u]int64_t and bool) and * true/false macros are available. */ #if defined(WIN32) || defined(OS2) /* * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool * is predefined tho, both in C and C++. */ typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; #elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX) /* * AIX and SunOS ship a inttypes.h header that defines [u]int32_t, * but not bool for C. */ #include #ifndef __cplusplus typedef int bool; #define true 1 #define false 0 #endif #elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) /* * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and * u_int32_t. */ #include /* * BSD/OS ships no header that defines uint32_t, nor bool (for C) */ #if defined(bsdi) typedef u_int32_t uint32_t; typedef u_int64_t uint64_t; #if !defined(__cplusplus) typedef int bool; #define true 1 #define false 0 #endif #else /* * FreeBSD and OpenBSD define uint32_t and bool. */ #include #include #endif #elif defined(BEOS) #include #else /* * For those that ship a standard C99 stdint.h header file, include * it. Can't do the same for stdbool.h tho, since some systems ship * with a stdbool.h file that doesn't compile! */ #include #ifndef __cplusplus #if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95) #include #else /* * GCC 2.91 can't deal with a typedef for bool, but a #define * works. */ #define bool int #define true 1 #define false 0 #endif #endif #endif #endif /* nptypes_h_ */ mozplugger-1.14.5/npapi/include/npupp.h0000755000175000001440000003300611722504427017111 0ustar peterusers/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef npfunctions_h_ #define npfunctions_h_ /* * npupp.h Mozilla Revision:3.26 * BUT (Peter Leese) - commented out new stuff for backwards compatibility * function call mecahnics needed by platform specific glue code. */ #include "npapi.h" #include "npruntime.h" typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save); typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window); typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream); typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname); typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint); typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event); typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData); /* Any NPObjects returned to the browser via NPP_GetValue should be retained by the plugin on the way out. The browser is responsible for releasing. */ typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value); typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value); typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction); typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance); typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData); typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge); typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void); typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value); typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value); typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData); typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData); typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window); typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file); typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList); typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream); typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer); typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message); /* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't depend on it sticking around and don't free it. */ typedef const char* (*NPN_UserAgentProcPtr)(NPP instance); typedef void* (*NPN_MemAllocProcPtr)(uint32_t size); typedef void (*NPN_MemFreeProcPtr)(void* ptr); typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size); typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages); typedef void* (*NPN_GetJavaEnvProcPtr)(void); typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance); typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect); typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region); typedef void (*NPN_ForceRedrawProcPtr)(NPP instance); typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name); typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers); typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid); typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier); typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier); typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier); typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass); typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj); typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj); typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result); typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result); typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value); typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant); typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message); typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled); typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp); typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count); typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData); typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len); typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len); typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID); typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu); typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled); typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction); typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow); typedef struct _NPPluginFuncs { uint16_t size; uint16_t version; NPP_NewProcPtr newp; NPP_DestroyProcPtr destroy; NPP_SetWindowProcPtr setwindow; NPP_NewStreamProcPtr newstream; NPP_DestroyStreamProcPtr destroystream; NPP_StreamAsFileProcPtr asfile; NPP_WriteReadyProcPtr writeready; NPP_WriteProcPtr write; NPP_PrintProcPtr print; NPP_HandleEventProcPtr event; NPP_URLNotifyProcPtr urlnotify; void* javaClass; NPP_GetValueProcPtr getvalue; NPP_SetValueProcPtr setvalue; NPP_GotFocusPtr gotfocus; NPP_LostFocusPtr lostfocus; NPP_URLRedirectNotifyPtr urlredirectnotify; NPP_ClearSiteDataPtr clearsitedata; NPP_GetSitesWithDataPtr getsiteswithdata; } NPPluginFuncs; typedef struct _NPNetscapeFuncs { uint16_t size; uint16_t version; NPN_GetURLProcPtr geturl; NPN_PostURLProcPtr posturl; NPN_RequestReadProcPtr requestread; NPN_NewStreamProcPtr newstream; NPN_WriteProcPtr write; NPN_DestroyStreamProcPtr destroystream; NPN_StatusProcPtr status; NPN_UserAgentProcPtr uagent; NPN_MemAllocProcPtr memalloc; NPN_MemFreeProcPtr memfree; NPN_MemFlushProcPtr memflush; NPN_ReloadPluginsProcPtr reloadplugins; NPN_GetJavaEnvProcPtr getJavaEnv; NPN_GetJavaPeerProcPtr getJavaPeer; NPN_GetURLNotifyProcPtr geturlnotify; NPN_PostURLNotifyProcPtr posturlnotify; NPN_GetValueProcPtr getvalue; NPN_SetValueProcPtr setvalue; NPN_InvalidateRectProcPtr invalidaterect; NPN_InvalidateRegionProcPtr invalidateregion; NPN_ForceRedrawProcPtr forceredraw; NPN_GetStringIdentifierProcPtr getstringidentifier; NPN_GetStringIdentifiersProcPtr getstringidentifiers; NPN_GetIntIdentifierProcPtr getintidentifier; NPN_IdentifierIsStringProcPtr identifierisstring; NPN_UTF8FromIdentifierProcPtr utf8fromidentifier; NPN_IntFromIdentifierProcPtr intfromidentifier; NPN_CreateObjectProcPtr createobject; NPN_RetainObjectProcPtr retainobject; NPN_ReleaseObjectProcPtr releaseobject; NPN_InvokeProcPtr invoke; NPN_InvokeDefaultProcPtr invokeDefault; NPN_EvaluateProcPtr evaluate; NPN_GetPropertyProcPtr getproperty; NPN_SetPropertyProcPtr setproperty; NPN_RemovePropertyProcPtr removeproperty; NPN_HasPropertyProcPtr hasproperty; NPN_HasMethodProcPtr hasmethod; NPN_ReleaseVariantValueProcPtr releasevariantvalue; NPN_SetExceptionProcPtr setexception; NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate; NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate; NPN_EnumerateProcPtr enumerate; NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall; NPN_ConstructProcPtr construct; NPN_GetValueForURLPtr getvalueforurl; NPN_SetValueForURLPtr setvalueforurl; NPN_GetAuthenticationInfoPtr getauthenticationinfo; NPN_ScheduleTimerPtr scheduletimer; NPN_UnscheduleTimerPtr unscheduletimer; NPN_PopUpContextMenuPtr popupcontextmenu; NPN_ConvertPointPtr convertpoint; NPN_HandleEventPtr handleevent; NPN_UnfocusInstancePtr unfocusinstance; NPN_URLRedirectResponsePtr urlredirectresponse; } NPNetscapeFuncs; #if defined(XP_UNIX) /* GCC 3.3 and later support the visibility attribute. */ #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default"))) #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) #define NP_VISIBILITY_DEFAULT __global #else #define NP_VISIBILITY_DEFAULT #endif #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type #endif #ifdef XP_UNIX #ifdef __cplusplus extern "C" { #endif typedef char* (*NP_GetPluginVersionFunc)(void); NP_EXPORT(char*) NP_GetPluginVersion(void); typedef const char* (*NP_GetMIMEDescriptionFunc)(void); NP_EXPORT(const char*) NP_GetMIMEDescription(void); typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*); NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs); typedef NPError (*NP_ShutdownFunc)(void); NP_EXPORT(NPError) NP_Shutdown(void); typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *); NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue); #ifdef __cplusplus } #endif #endif #endif /* npfunctions_h_ */ mozplugger-1.14.5/npapi/common/0000755000175000001440000000000011722504427015436 5ustar peterusersmozplugger-1.14.5/npapi/common/npunix.c0000700000175000001440000006445311722504427017130 0ustar peterusers/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Stephen Mak * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * npunix.c * * Netscape Client Plugin API * - Wrapper function to interface with the Netscape Navigator * * dp Suresh * Peter Leese - modified for mozplugger * */ #ifdef HAVE_CONFIG_H #include "config.h" /* For VERSION */ #endif #define XP_UNIX 1 #include #include #include "npapi.h" #include "npupp.h" /*********************************************************************** * * Globals * ***********************************************************************/ static NPNetscapeFuncs gNetscapeFuncs; /* Netscape Function table */ /*********************************************************************** * * Wrapper functions : plugin calling Netscape Navigator * * These functions let the plugin developer just call the APIs * as documented and defined in npapi.h, without needing to know * about the function table and call macros in npupp.h. * ***********************************************************************/ void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor) { *plugin_major = NP_VERSION_MAJOR; *plugin_minor = NP_VERSION_MINOR; /* Major version is in high byte */ *netscape_major = gNetscapeFuncs.version >> 8; /* Minor version is in low byte */ *netscape_minor = gNetscapeFuncs.version & 0xFF; } /******************************************************************************/ NPError NPN_GetValue(NPP instance, NPNVariable variable, void *r_value) { NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; NPN_GetValueProcPtr func = gNetscapeFuncs.getvalue; if(func) { retVal = (*func)(instance, variable, r_value); } return retVal; } /******************************************************************************/ NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value) { NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; NPN_SetValueProcPtr func = gNetscapeFuncs.setvalue; if(func) { retVal = (*func)(instance, variable, value); } return retVal; } /******************************************************************************/ NPError NPN_GetURL(NPP instance, const char* url, const char* window) { NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; NPN_GetURLProcPtr func = gNetscapeFuncs.geturl; if(func) { retVal = (*func)(instance, url, window); } return retVal; } /******************************************************************************/ NPError NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData) { NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; NPN_GetURLNotifyProcPtr func = gNetscapeFuncs.geturlnotify; if(func) { retVal = (*func)(instance, url, window, notifyData); } return retVal; } /******************************************************************************/ NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file) { NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; NPN_PostURLProcPtr func = gNetscapeFuncs.posturl; if(func) { retVal = (*func)(instance, url, window, len, buf, file); } return retVal; } /******************************************************************************/ NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData) { NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; NPN_PostURLNotifyProcPtr func = gNetscapeFuncs.posturlnotify; if(func) { retVal = (*func)(instance, url, window, len, buf, file, notifyData); } return retVal; } /******************************************************************************/ NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList) { NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; NPN_RequestReadProcPtr func = gNetscapeFuncs.requestread; if(func) { retVal = (*func)(stream, rangeList); } return retVal; } /******************************************************************************/ NPError NPN_NewStream(NPP instance, NPMIMEType type, const char *window, NPStream** stream_ptr) { NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; NPN_NewStreamProcPtr func = gNetscapeFuncs.newstream; if(func) { retVal = (*func)(instance, type, window, stream_ptr); } return retVal; } /******************************************************************************/ int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer) { int32_t retVal = 0; NPN_WriteProcPtr func = gNetscapeFuncs.write; if(func) { retVal = (*func)(instance, stream, len, buffer); } return retVal; } /******************************************************************************/ NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason) { NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; NPN_DestroyStreamProcPtr func = gNetscapeFuncs.destroystream; if(func) { retVal = (*func)(instance, stream, reason); } return retVal; } /******************************************************************************/ void NPN_Status(NPP instance, const char* message) { NPN_StatusProcPtr func = gNetscapeFuncs.status; if(func) { (*func)(instance, message); } } /******************************************************************************/ const char* NPN_UserAgent(NPP instance) { const char * retVal = 0; NPN_UserAgentProcPtr func = gNetscapeFuncs.uagent; if(func) { retVal = (*func)(instance); } return retVal; } /******************************************************************************/ void* NPN_MemAlloc(uint32_t size) { void * retVal = 0; NPN_MemAllocProcPtr func = gNetscapeFuncs.memalloc; if(func) { retVal = (*func)(size); } return retVal; } /******************************************************************************/ void NPN_MemFree(void* ptr) { NPN_MemFreeProcPtr func = gNetscapeFuncs.memfree; if(func) { (*func)(ptr); } } /******************************************************************************/ uint32_t NPN_MemFlush(uint32_t size) { uint32_t retVal = 0; NPN_MemFlushProcPtr func = gNetscapeFuncs.memflush; if(func) { retVal = (*func)(size); } return retVal; } /******************************************************************************/ void NPN_ReloadPlugins(NPBool reloadPages) { NPN_ReloadPluginsProcPtr func = gNetscapeFuncs.reloadplugins; if(func) { (*func)(reloadPages); } } /******************************************************************************/ void NPN_InvalidateRect(NPP instance, NPRect *invalidRect) { NPN_InvalidateRectProcPtr func = gNetscapeFuncs.invalidaterect; if(func) { (*func)(instance, invalidRect); } } /******************************************************************************/ void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion) { NPN_InvalidateRegionProcPtr func = gNetscapeFuncs.invalidateregion; if(func) { (*func)(instance, invalidRegion); } } /******************************************************************************/ void NPN_ForceRedraw(NPP instance) { NPN_ForceRedrawProcPtr func = gNetscapeFuncs.forceredraw; if(func) { (*func)(instance); } } /******************************************************************************/ void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled) { NPN_PushPopupsEnabledStateProcPtr func = gNetscapeFuncs.pushpopupsenabledstate; if(func) { (*func)(instance, enabled); } } /******************************************************************************/ void NPN_PopPopupsEnabledState(NPP instance) { NPN_PopPopupsEnabledStateProcPtr func = gNetscapeFuncs.poppopupsenabledstate; if(func) { (*func)(instance); } } /******************************************************************************/ NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name) { NPIdentifier retVal = 0; NPN_GetStringIdentifierProcPtr func = gNetscapeFuncs.getstringidentifier; if(func) { retVal = (*func)(name); } return retVal; } /******************************************************************************/ void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers) { NPN_GetStringIdentifiersProcPtr func = gNetscapeFuncs.getstringidentifiers; if(func) { (*func)(names, nameCount, identifiers); } } /******************************************************************************/ NPIdentifier NPN_GetIntIdentifier(int32_t intid) { NPIdentifier retVal = 0; NPN_GetIntIdentifierProcPtr func = gNetscapeFuncs.getintidentifier; if(func) { retVal = (*func)(intid); } return retVal; } /******************************************************************************/ bool NPN_IdentifierIsString(NPIdentifier identifier) { bool retVal = false; NPN_IdentifierIsStringProcPtr func = gNetscapeFuncs.identifierisstring; if(func) { retVal = (*func)(identifier); } return retVal; } /******************************************************************************/ NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier) { NPUTF8 * retVal = 0; NPN_UTF8FromIdentifierProcPtr func = gNetscapeFuncs.utf8fromidentifier; if(func) { retVal = (*func)(identifier); } return retVal; } /******************************************************************************/ int32_t NPN_IntFromIdentifier(NPIdentifier identifier) { int32_t retVal = 0; NPN_IntFromIdentifierProcPtr func = gNetscapeFuncs.intfromidentifier; if(func) { retVal = (*func)(identifier); } return retVal; } /******************************************************************************/ NPObject *NPN_CreateObject(NPP npp, NPClass *aClass) { NPObject * retVal = 0; NPN_CreateObjectProcPtr func = gNetscapeFuncs.createobject; if(func) { retVal = (*func)( npp, aClass); } return retVal; } /******************************************************************************/ NPObject *NPN_RetainObject(NPObject *obj) { NPObject * retVal = 0; NPN_RetainObjectProcPtr func = gNetscapeFuncs.retainobject; if(func) { retVal = (*func)( obj); } return retVal; } /******************************************************************************/ void NPN_ReleaseObject(NPObject *obj) { NPN_ReleaseObjectProcPtr func = gNetscapeFuncs.releaseobject; if(func) { (*func)(obj); } } /******************************************************************************/ bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result) { bool retVal = false; NPN_InvokeProcPtr func = gNetscapeFuncs.invoke; if(func) { retVal = (*func)(npp, obj, methodName, args, argCount, result); } return retVal; } /******************************************************************************/ bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result) { bool retVal = false; NPN_InvokeDefaultProcPtr func = gNetscapeFuncs.invokeDefault; if(func) { retVal = (*func)(npp, obj, args, argCount, result); } return retVal; } /******************************************************************************/ bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script, NPVariant *result) { bool retVal = false; NPN_EvaluateProcPtr func = gNetscapeFuncs.evaluate; if(func) { retVal = (*func)(npp, obj, script, result); } return retVal; } /******************************************************************************/ bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, NPVariant *result) { bool retVal = false; NPN_GetPropertyProcPtr func = gNetscapeFuncs.getproperty; if(func) { retVal = (*func)(npp, obj, propertyName, result); } return retVal; } /******************************************************************************/ bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, const NPVariant *value) { bool retVal = false; NPN_SetPropertyProcPtr func = gNetscapeFuncs.setproperty; if(func) { retVal = (*func)(npp, obj, propertyName, value); } return retVal; } /******************************************************************************/ bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) { bool retVal = false; NPN_RemovePropertyProcPtr func = gNetscapeFuncs.removeproperty; if(func) { retVal = (*func)(npp, obj, propertyName); } return retVal; } /******************************************************************************/ bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) { bool retVal = false; NPN_HasPropertyProcPtr func = gNetscapeFuncs.hasproperty; if(func) { retVal = (*func)(npp, obj, propertyName); } return retVal; } /******************************************************************************/ bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName) { bool retVal = false; NPN_HasMethodProcPtr func = gNetscapeFuncs.hasmethod; if(func) { retVal = (*func)(npp, obj, methodName); } return retVal; } /******************************************************************************/ void NPN_ReleaseVariantValue(NPVariant *variant) { NPN_ReleaseVariantValueProcPtr func = gNetscapeFuncs.releasevariantvalue; if(func) { (*func)(variant); } } /******************************************************************************/ void NPN_SetException(NPObject* obj, const NPUTF8 *message) { NPN_SetExceptionProcPtr func = gNetscapeFuncs.setexception; if(func) { (*func)(obj, message); } } /******************************************************************************/ bool NPN_Enumerate(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count) { NPN_EnumerateProcPtr func = gNetscapeFuncs.enumerate; bool retVal = false; if(func) { retVal = (*func)(npp, obj, identifier, count); } return retVal; } /******************************************************************************/ void NPN_PluginThreadAsyncCall(NPP instance, void (*func)(void *), void *userData) { NPN_PluginThreadAsyncCallProcPtr func2 = gNetscapeFuncs.pluginthreadasynccall; if(func2) { (*func2)(instance, func, userData); } } /******************************************************************************/ bool NPN_Construct(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result) { NPN_ConstructProcPtr func = gNetscapeFuncs.construct; bool retVal= false; if(func) { retVal = (*func)(npp, obj, args, argCount, result); } return retVal; } /******************************************************************************/ NPError NPN_GetValueForURL(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len) { NPN_GetValueForURLPtr func = gNetscapeFuncs.getvalueforurl; NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; if(func) { retVal = (*func)(npp, variable, url, value, len); } return retVal; } /******************************************************************************/ NPError NPN_SetValueForURL(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len) { NPN_SetValueForURLPtr func = gNetscapeFuncs.setvalueforurl; NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; if(func) { retVal = (*func)(npp, variable, url, value, len); } return retVal; } /******************************************************************************/ NPError NPN_GetAuthenticationInfo(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen) { NPN_GetAuthenticationInfoPtr func = gNetscapeFuncs.getauthenticationinfo; NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; if(func) { retVal = (*func)(npp, protocol, host, port, scheme, realm, username, ulen, password, plen); } return retVal; } /******************************************************************************/ uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)) { NPN_ScheduleTimerPtr func = gNetscapeFuncs.scheduletimer; uint32_t retVal = 0; if(func) { retVal = (*func)(instance, interval, repeat, timerFunc); } return retVal; } /******************************************************************************/ void NPN_UnscheduleTimer(NPP instance, uint32_t timerID) { NPN_UnscheduleTimerPtr func = gNetscapeFuncs.unscheduletimer; if(func) { (*func)(instance, timerID); } } /******************************************************************************/ NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu) { NPN_PopUpContextMenuPtr func = gNetscapeFuncs.popupcontextmenu; NPError retVal = NPERR_INVALID_FUNCTABLE_ERROR; if(func) { retVal = (*func)(instance, menu); } return retVal; } /******************************************************************************/ NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace) { NPN_ConvertPointPtr func = gNetscapeFuncs.convertpoint; NPBool retVal = false; if(func) { retVal = (*func)(instance, sourceX, sourceY, sourceSpace, destX, destY, destSpace); } return retVal; } /******************************************************************************/ NPBool NPN_HandleEvent(NPP instance, void *event, NPBool handled) { NPN_HandleEventPtr func = gNetscapeFuncs.handleevent; NPBool retVal = false; if(func) { retVal = (*func)(instance, event, handled); } return retVal; } /******************************************************************************/ NPBool NPN_UnfocusInstance(NPP instance, NPFocusDirection direction) { NPN_UnfocusInstancePtr func = gNetscapeFuncs.unfocusinstance; NPBool retVal = False; if(func) { retVal = (*func)(instance, direction); } return retVal; } /******************************************************************************/ void NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow) { NPN_URLRedirectResponsePtr func = gNetscapeFuncs.urlredirectresponse; if(func) { (*func)(instance, notifyData, allow); } } /*********************************************************************** * * These functions are located automagically by netscape. * ***********************************************************************/ /* * NP_GetPluginVersion [optional] * - The browser uses the return value to indicate to the user what version of * this plugin is installed. */ char * NP_GetPluginVersion(void) { return VERSION; } /* * NP_GetMIMEDescription * - Netscape needs to know about this symbol * - Netscape uses the return value to identify when an object instance * of this plugin should be created. */ const char * NP_GetMIMEDescription(void) { return NPP_GetMIMEDescription(); } /* * NP_GetValue [optional] * - Netscape needs to know about this symbol. * - Interfaces with plugin to get values for predefined variables * that the navigator needs. */ NPError NP_GetValue(void* future, NPPVariable variable, void *value) { return NPP_GetValue(future, variable, value); } /* * NP_Initialize * - Netscape needs to know about this symbol. * - It calls this function after looking up its symbol before it * is about to create the first ever object of this kind. * * PARAMETERS * nsTable - The netscape function table. If developers just use these * wrappers, they don't need to worry about all these function * tables. * RETURN * pluginFuncs * - This functions needs to fill the plugin function table * pluginFuncs and return it. Netscape Navigator plugin * library will use this function table to call the plugin. * */ NPError NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs) { NPError err = NPERR_NO_ERROR; /* Zero everything */ memset(&gNetscapeFuncs, 0, sizeof(gNetscapeFuncs)); /* validate input parameters */ if(nsTable != NULL) { uint32_t size; /* * Check the major version passed in Netscape's function table. */ if ((nsTable->version >> 8) > NP_VERSION_MAJOR) { err = NPERR_INCOMPATIBLE_VERSION_ERROR; } if (nsTable->size > sizeof(NPNetscapeFuncs)) { /* Looks like more functions provided than we know about..*/ size = sizeof(NPNetscapeFuncs); } else { /* Copy across only those entries that were passed in (i.e. size) */ size = nsTable->size; } memcpy(&gNetscapeFuncs, nsTable, size); gNetscapeFuncs.size = size; } else { err = NPERR_INVALID_FUNCTABLE_ERROR; } if (pluginFuncs != NULL) { /* Create a temporary local copy */ NPPluginFuncs funcs; /* Zero to start */ memset(&funcs, 0, sizeof(NPPluginFuncs)); /* First create a local copy of the table */ funcs.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; funcs.newp = NPP_New; funcs.destroy = NPP_Destroy; funcs.setwindow = NPP_SetWindow; funcs.newstream = NPP_NewStream; funcs.destroystream = NPP_DestroyStream; funcs.asfile = NPP_StreamAsFile; funcs.writeready = NPP_WriteReady; funcs.write = NPP_Write; funcs.print = NPP_Print; funcs.urlnotify = NPP_URLNotify; funcs.getvalue = (NPP_GetValueProcPtr) NPP_GetValue; funcs.setvalue = NPP_SetValue; funcs.gotfocus = NPP_GotFocus; funcs.lostfocus = NPP_LostFocus; funcs.urlredirectnotify = NPP_URLRedirectNotify; funcs.clearsitedata = NPP_ClearSiteData; funcs.getsiteswithdata = NPP_GetSitesWithData; if(pluginFuncs->size > sizeof(NPPluginFuncs)) { /* Zero the fields we dont have anything for */ memset(&pluginFuncs[sizeof(NPPluginFuncs)], 0, pluginFuncs->size - sizeof(NPPluginFuncs)); funcs.size = sizeof(NPPluginFuncs); } else { funcs.size = pluginFuncs->size; } /* Copy across */ memcpy(pluginFuncs, &funcs, funcs.size); } else { err = NPERR_INVALID_FUNCTABLE_ERROR; } if(err == NPERR_NO_ERROR) { err = NPP_Initialize(); } return err; } /* * NP_Shutdown [optional] * - Netscape needs to know about this symbol. * - It calls this function after looking up its symbol after * the last object of this kind has been destroyed. * */ NPError NP_Shutdown(void) { NPP_Shutdown(); return NPERR_NO_ERROR; } mozplugger-1.14.5/npn-get-helpers.c0000600000175000001440000001022611722504427016204 0ustar peterusers/***************************************************************************** * * Current Authors: Louis Bavoil * Peter Leese * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ #include #include "debug.h" static int browserApiMajorVer = 0; static int browserApiMinorVer = 0; /*****************************************************************************/ /** * Get information about the browser this plugin is running under * */ void get_api_version(void) { int pluginApiMajorVer; int pluginApiMinorVer; NPN_Version(&pluginApiMajorVer, &pluginApiMinorVer, &browserApiMajorVer, &browserApiMinorVer); D("NPN_Version() - API versions plugin=%d.%d Browser=%d.%d\n", pluginApiMajorVer, pluginApiMinorVer, browserApiMajorVer, browserApiMinorVer); } /*****************************************************************************/ /** * Find out if browser has the resize bug * */ NPBool does_browser_have_resize_bug(void) { /* Mozilla work around not require for versions > 0.13 */ if((browserApiMajorVer > 0) || (browserApiMinorVer > 13)) { return 0; } return 1; } /*****************************************************************************/ /** * Find out if browser supports XEmbed * */ NPBool does_browser_support_xembed(void) { NPBool value; /* Check if browser supports XEmbed and also what toolkit the browser * uses */ NPError err = NPN_GetValue((void *)0, NPNVSupportsXEmbedBool, (void*) &value); if(err != NPERR_NO_ERROR) { D("NPN_GetValue(NPNVSupportsXEmbedBool) - Browser returned err=%i\n", err); return 0; } D("NPN_GetValue(NPNSupportsXEmbedBool) - Browser returned %i\n", value); return value; } /*****************************************************************************/ /** * Find out which toolkit the browser supports * */ NPNToolkitType get_browser_toolkit(NPP instance) { NPNToolkitType value; /* Get tool kit supported */ NPError err = NPN_GetValue(instance, NPNVToolkit, (void *) &value); if(err != NPERR_NO_ERROR) { D("NPN_GetValue(NPNVToolkit) - Browser returned err=%i\n", err); return 0; } switch(value) { case NPNVGtk12: D("NPN_GetValue(NPNVToolkit) - Browser supports GTK1.2\n"); break; case NPNVGtk2: D("NPN_GetValue(NPNToolkit) - Browser supports GTK2\n"); break; } return value; } /*****************************************************************************/ /** * Find out if browser supports advanced key handling for this instance of the * plugin * */ NPBool does_browser_support_key_handling(NPP instance) { NPBool value; /* Get Advanced Keyboard focus */ NPError err = NPN_GetValue(instance, NPNVsupportsAdvancedKeyHandling, (void *) &value); if(err != NPERR_NO_ERROR) { D("NPN_GetValue(NPNVSupportsAdvancedKeyHandling) - " "Browser returned err=%i\n", err); return 0; } D("NPN_GetValue(NPNVSupportsAdvancedKeyHandling) - " "Browser returned %i\n", value); return value; } mozplugger-1.14.5/config.h.in0000600000175000001440000000014611722504427015053 0ustar peterusers#undef DEBUG #undef NODEBUG #undef XP_UNIX #undef VERSION #undef GCOV #undef ALWAYS_NEEDS_XEMBED mozplugger-1.14.5/Makefile.in0000644000175000001440000001515611722504427015114 0ustar peterusers# @configure_input@ # For building rpms root= # For installing prefix=@prefix@ exec_prefix=@exec_prefix@ datarootdir=@datarootdir@ #For building away from source directory srcdir=@srcdir@ VPATH=@srcdir@ PLUGINDIRS=@PLUGINDIRS@ # On 64 bit arch change libprefix to lib64 libprefix=/lib #libprefix=/lib64 # # RPMDIR=/usr/src/RPM # Choose compiler CC=@CC@ MKDIR=mkdir -p SOURCE_FILES=mozplugger.c \ mozplugger-common.c \ mozplugger-helper.c \ mozplugger-controller.c \ mozplugger-linker.c \ mozplugger.spec \ child.c \ debug.c \ mozplugger.h \ child.h \ debug.h \ npn-get-helpers.h \ npn-get-helpers.c \ npapi/common/npunix.c \ npapi/include/npapi.h \ npapi/include/npupp.h \ npapi/include/nptypes.h \ npapi/include/npruntime.h \ Makefile.in \ Makefile.old \ mozplugger.7 \ README \ COPYING \ ChangeLog \ mozpluggerrc \ configure.ac \ config.h.in \ configure BIN_FILES=mozplugger.so \ mozplugger-helper \ mozplugger-controller \ mozplugger-linker \ Makefile \ mozplugger.7 \ README \ COPYING \ ChangeLog \ mozpluggerrc \ config.h DEFINES= @DEFS@ @XCPPFLAGS@ -DSYSCONFDIR=\"@sysconfdir@\" #-D__amd64__ INCLUDES= -I. -I$(srcdir) -I$(srcdir)/npapi/include COMMON_CFLAGS=$(INCLUDES) $(DEFINES) XLIBS=@LIBS@ LDSHARED=@LDSHARED@ LDFLAGS=@LDFLAGS@ CFLAGS=$(COMMON_CFLAGS) $(XCFLAGS) @XCFLAGS@ all: mozplugger.so mozplugger-helper mozplugger-controller mozplugger-linker mozplugger-helper: mozplugger-helper.o mozplugger-common.o child.o debug.o $(CC) $(LDFLAGS) -o mozplugger-helper mozplugger-helper.o mozplugger-common.o child.o debug.o $(XLIBS) mozplugger-helper.o: mozplugger-helper.c mozplugger.h child.h debug.h config.h $(CC) -c $(CFLAGS) -o mozplugger-helper.o '$(srcdir)/mozplugger-helper.c' mozplugger.so: mozplugger.o npunix.o mozplugger-common.o debug.o npn-get-helpers.o $(LDSHARED) $(LDFLAGS) -o mozplugger.so mozplugger.o mozplugger-common.o npunix.o debug.o npn-get-helpers.o $(XLIBS) mozplugger-common.o: mozplugger-common.c mozplugger.h config.h $(CC) -c $(CFLAGS) -o mozplugger-common.o '$(srcdir)/mozplugger-common.c' mozplugger.o: mozplugger.c mozplugger.h config.h npn-get-helpers.h $(CC) -c $(CFLAGS) -o mozplugger.o '$(srcdir)/mozplugger.c' npunix.o: $(srcdir)/npapi/common/npunix.c config.h $(CC) -c $(CFLAGS) -o npunix.o '$(srcdir)/npapi/common/npunix.c' child.o: child.c child.h debug.h mozplugger.h config.h $(CC) -c $(CFLAGS) -o child.o '$(srcdir)/child.c' debug.o: debug.c debug.h config.h $(CC) -c $(CFLAGS) -o debug.o '$(srcdir)/debug.c' npn-get-helpers.o: npn-get-helpers.c npn-get-helpers.h debug.h $(CC) -c $(CFLAGS) -o npn-get-helpers.o '$(srcdir)/npn-get-helpers.c' mozplugger-controller: mozplugger-controller.o mozplugger-common.o child.o debug.o $(CC) -o mozplugger-controller mozplugger-controller.o mozplugger-common.o child.o debug.o $(LDFLAGS) $(XLIBS) mozplugger-controller.o: mozplugger-controller.c mozplugger.h child.h debug.h config.h $(CC) -c $(CFLAGS) -o mozplugger-controller.o '$(srcdir)/mozplugger-controller.c' mozplugger-linker: mozplugger-linker.o mozplugger-common.o child.o debug.o $(CC) -o mozplugger-linker mozplugger-linker.o mozplugger-common.o child.o debug.o $(LDFLAGS) $(XLIBS) mozplugger-linker.o: mozplugger-linker.c mozplugger.h child.h debug.h config.h $(CC) -c $(CFLAGS) -o mozplugger-linker.o '$(srcdir)/mozplugger-linker.c' $(srcdir)/configure: configure.ac cd '$(srcdir)' && autoconf Makefile: Makefile.in config.status ./config.status config.h: config.h.in config.status ./config.status config.status: configure ./config.status --recheck clean: -rm -f *.o npapi/common/*.o *.gcda *.gcno *.so -rm -f mozplugger-helper mozplugger-controller mozplugger-linker distclean: clean -rm -f *~ core -rm -f config.h config.status config.log Makefile -rm -rf autom4te.cache -rm -rf rpmtmp localinstall: mozplugger.so mozplugger-helper mozplugger-controller mozplugger-linker -@$(MKDIR) $$HOME/$(BROWSERDIR)/plugins cp mozplugger.so $$HOME/$(BROWSERDIR)/plugins/ cp mozplugger-helper $$HOME/$(BROWSERDIR)/ cp mozplugger-controller $$HOME/$(BROWSERDIR)/ cp mozplugger-linker $$HOME/$(BROWSERDIR)/ if [ -f $$HOME/$(BROWSERDIR)/mozpluggerrc ]; then mv $$HOME/$(BROWSERDIR)/mozpluggerrc $$HOME/$(BROWSERDIR)/mozpluggerrc.old; fi cp mozpluggerrc $$HOME/$(BROWSERDIR)/ localinstall_mozilla: make localinstall BROWSERDIR=.mozilla localinstall_netscape: make localinstall BROWSERDIR=.netscape localinstall_opera: make localinstall BROWSERDIR=.opera install: -@install -d @bindir@ -@install -d $(prefix)$(libprefix)/mozilla/plugins -@install -d @mandir@/man7 -@install -d @sysconfdir@ install mozplugger-helper @bindir@ install mozplugger-controller @bindir@ install mozplugger-linker @bindir@ for a in ${PLUGINDIRS}; do install mozplugger.so $$a ; done # cp mozplugger.so $(prefix)$(libprefix)/mozilla/plugins/ install $(srcdir)/mozpluggerrc @sysconfdir@ install $(srcdir)/mozplugger.7 @mandir@/man7/ uninstall: rm -f @mandir@/man7/mozplugger.7 rm -f @sysconfdir@/mozpluggerrc for target in ${PLUGINDIRS}; do rm -f $${target}/mozplugger.so; done rm -f @bindir@/mozplugger-linker rm -f @bindir@/mozplugger-controller rm -f @bindir@/mozplugger-helper -rmdir @sysconfdir@ -rmdir @mandir@/man7 -rmdir @mandir@ -rmdir @bindir@ MOZ_PACKAGE=mozplugger-@PACKAGE_VERSION@ ${MOZ_PACKAGE}.tar.gz: $(SOURCE_FILES) rm -rf ${MOZ_PACKAGE} mkdir -p ${MOZ_PACKAGE}/npapi/common mkdir -p ${MOZ_PACKAGE}/npapi/include for a in $(SOURCE_FILES); do cp ${srcdir}/$$a ${MOZ_PACKAGE}/$$a ; done tar -zcvf ${MOZ_PACKAGE}.tar.gz ${MOZ_PACKAGE} rm -rf ${MOZ_PACKAGE} dist: ${MOZ_PACKAGE}.tar.gz bin_export: mozplugger-bin.tar.gz echo_version: @echo @PACKAGE_VERSION@ rpm: $(RPMDIR)/SOURCES/mozplugger.tar.gz $(srcdir)/mozplugger.spec rm -rf rpmtmp ||: mkdir rpmtmp mkdir rpmtmp/usr mkdir rpmtmp/etc mkdir rpmtmp/opt mkdir rpmtmp/usr/local rpm -ba --buildroot `pwd`/rpmtmp mozplugger.spec cp $(RPMDIR)/SRPMS/mozplugger-1.src.rpm . cp $(RPMDIR)/RPMS/*/mozplugger-1.*.rpm . rm -rf rpmtmp $(RPMDIR)/SOURCES/mozplugger.tar.gz: ${MOZ_PACKAGE}.tar.gz cp ${MOZ_PACKAGE}.tar.gz $(RPMDIR)/SOURCES/mozplugger.tar.gz mozplugger-bin.tar.gz: $(SOURCE_FILES) $(BIN_FILES) @( DIR=`pwd`;\ BASE=`basename $$DIR`;\ cd .. ; \ if [ "$$BASE" != "mozplugger" ]; then \ ln -s "$$BASE" mozplugger ; \ fi ;\ tar cf - `for a in $(BIN_FILES); do echo mozplugger/$$a ; done` | gzip -9 >mozplugger/mozplugger-bin.tar.gz ;\ if [ "$$BASE" != "mozplugger" ]; then \ rm mozplugger ; \ fi ;\ ) mozplugger-1.14.5/debug.h0000600000175000001440000000303711722504427014271 0ustar peterusers/***************************************************************************** * * Original author: Fredrik Hübinette * * Current Authors: Louis Bavoil * Peter Leese * * This code is based on and is a branch of plugger written * by Fredrik Hübinette * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * *****************************************************************************/ #ifndef _DEBUG_H_ #define _DEBUG_H_ /***************************************************************************** * Defines *****************************************************************************/ #define DEBUG_FILENAME "mozdebug" void close_debug(void); char * get_debug_path(void); #ifdef __GNUC__ void D(char *fmt, ...) __attribute__((format(printf,1,2))); #else void D(char *fmt, ...); #endif #endif mozplugger-1.14.5/configure0000700000175000001440000051063611722504427014747 0ustar peterusers#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for mozplugger 1.14.5. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 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 # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (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 # 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. as_myself= 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 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="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_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { 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_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error 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 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi 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'` # 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_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # 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; as_fn_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 } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac 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='mkdir -p "$as_dir"' 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'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/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= # Identity of this package. PACKAGE_NAME='mozplugger' PACKAGE_TARNAME='mozplugger' PACKAGE_VERSION='1.14.5' PACKAGE_STRING='mozplugger 1.14.5' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="child.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 PLUGINDIRS LDSHARED XCPPFLAGS XCFLAGS LIBOBJS EGREP GREP CPP XMKMF SET_MAKE LN_S OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC 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_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_x enable_gcov enable_debug enable_always_xembed ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS XMKMF 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= ;; *) 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_fn_error $? "invalid feature name: $ac_useropt" 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_fn_error $? "invalid feature name: $ac_useropt" 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_fn_error $? "invalid package name: $ac_useropt" 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_fn_error $? "invalid package name: $ac_useropt" 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_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac 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_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $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_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" 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_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # 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_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" 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 mozplugger 1.14.5 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/mozplugger] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of mozplugger 1.14.5:";; 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] --enable-gcov enable test coverage with gcov [default=no] --enable-debug enable debug output [default=no] --enable-always-xembed enable build with xembed always enabled [default=no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-x use the X Window System 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 (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory XMKMF Path to xmkmf, Makefile generator for X Window System 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 the package provider. _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 mozplugger configure 1.14.5 generated by GNU Autoconf 2.68 Copyright (C) 2010 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 ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack 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:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack 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:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack 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:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { 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_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack 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:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { 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:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 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 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" 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 eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* 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 $2 (); /* 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_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func 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 mozplugger $as_me 1.14.5, which was generated by GNU Autoconf 2.68. 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) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append 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 as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset 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 $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" 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:${as_lineno-$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= ;; #( *) { eval $ac_var=; 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 $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" 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 $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" 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 $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" 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'; as_fn_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 $as_echo "/* confdefs.h */" > 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 cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _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 # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac 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 /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$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" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } 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. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$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:${as_lineno-$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:${as_lineno-$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:${as_lineno-$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:${as_lineno-$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:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$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. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$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_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## 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 #AC_INIT([mozplugger], [CVS-2012-Feb-26]) ac_config_headers="$ac_config_headers config.h" # Checks for programs. 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:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; 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:${as_lineno-$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:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; 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:${as_lineno-$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:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$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:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; 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:${as_lineno-$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:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; 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:${as_lineno-$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:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; 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:${as_lineno-$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:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; 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:${as_lineno-$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:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$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:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&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:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; 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 if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; 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:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { 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:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; 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:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$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 ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else 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:${as_lineno-$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:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes 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:${as_lineno-$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:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg 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:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : 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:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$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 eval \${ac_cv_prog_make_${ac_make}_set+:} false; 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:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi #AC_PROG_MKDIR_P # Determine the linker flags for mozplugger.so LDSHARED='gcc -shared' PLATFORM="x`uname`" XCFLAGS="-fPIC -Wall -O2" if test "${PLATFORM}" = xIRIX; then XCFLAGS="-fPIC -O2" LDSHARED='ld -shared -n32' fi if test "${PLATFORM}" = xAIX; then XCFLAGS="-fPIC -O2" LDSHARED='ld -G -bexpall' fi if test "${PLATFORM}${CC}" = "xHP-UXgcc"; then XCFLAGS="-fPIC -O2" LDSHARED='ld -b' fi if test "${PLATFORM}${CC}" = "xHP-UXcc"; then XCFLAGS='+DAportable -Ae +z +02' LDSHARED='ld -b +e NP_GetValue +e NP_Initialize +e NP_Shutdown +e NP_GetMIMEDescription' fi if test "${PLATFORM}${CC}" = "xSunOSgcc"; then XCFLAGS="-fPIC -O2" LDSHARED='ld -G' fi if test "${PLATFORM}${CC}" = "xSunOScc"; then XCFLAGS='-Kpic -O' LDSHARED='ln -G' fi if test "${PLATFORM}" = "xOSF1"; then XCFLAGS='-shared' LDSHARED='ld -expect_unresolved "*" -shared -msym -O3' fi #freebsd-aout: # ${MAKE} all XCFLAGS='-fPIC -aout' XLDFLAGS='-shared -aout' XCPPFLAGS= # Checks for X path 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:${as_lineno-$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 ${ac_cv_prog_CPP+:} false; 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i 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:${as_lineno-$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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } 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:${as_lineno-$LINENO}: checking for X" >&5 $as_echo_n "checking for X... " >&6; } # Check whether --with-x was given. if test "${with_x+set}" = set; then : withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : $as_echo_n "(cached) " >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl dylib la dll; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /usr/lib64 | /lib | /lib64) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R7/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R7 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R7/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R7 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # We can compile using X headers with no special include directory. ac_x_includes= else for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.i conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else LIBS=$ac_save_LIBS for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no";; #( *) # Record where we found X for the cache. ac_cv_have_x="have_x=yes\ ac_x_includes='$ac_x_includes'\ ac_x_libraries='$ac_x_libraries'" esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 $as_echo "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 $as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi if test "x$x_includes" != x; then XCPPFLAGS="$XCPPFLAGS -I$x_includes" fi if test "x$x_libraries" != x; then LDFLAGS="$LDFLAGS -L$x_libraries" fi # Work out where plugins should be installed PLUGINDIRS= if test "$libdir" = '${exec_prefix}/lib64'; then PLUGINLIB=lib64 else PLUGINLIB=lib fi #/usr/lib/mozilla/plugins/ #/usr/lib/netscape/plugins #/usr/lib/firefox/plugins #$MOZILLA_HOME/plugins #/usr/lib/chromium/plugins PLUGINDIR=${MOZ_PLUGIN_PATH} as_ac_File=`$as_echo "ac_cv_file_${PLUGINDIR}" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${PLUGINDIR}" >&5 $as_echo_n "checking for ${PLUGINDIR}... " >&6; } if eval \${$as_ac_File+:} false; then : $as_echo_n "(cached) " >&6 else test "$cross_compiling" = yes && as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 if test -r "${PLUGINDIR}"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi eval ac_res=\$$as_ac_File { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_File"\" = x"yes"; then : PLUGINDIRS="${PLUGINDIR} ${PLUGINDIRS}" fi PLUGINDIR=/usr/${PLUGINLIB}/mozilla/plugins as_ac_File=`$as_echo "ac_cv_file_${PLUGINDIR}" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${PLUGINDIR}" >&5 $as_echo_n "checking for ${PLUGINDIR}... " >&6; } if eval \${$as_ac_File+:} false; then : $as_echo_n "(cached) " >&6 else test "$cross_compiling" = yes && as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 if test -r "${PLUGINDIR}"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi eval ac_res=\$$as_ac_File { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_File"\" = x"yes"; then : PLUGINDIRS="${PLUGINDIR} ${PLUGINDIRS}" fi PLUGINDIR=/usr/${PLUGINLIB}/firefox/plugins as_ac_File=`$as_echo "ac_cv_file_${PLUGINDIR}" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${PLUGINDIR}" >&5 $as_echo_n "checking for ${PLUGINDIR}... " >&6; } if eval \${$as_ac_File+:} false; then : $as_echo_n "(cached) " >&6 else test "$cross_compiling" = yes && as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 if test -r "${PLUGINDIR}"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi eval ac_res=\$$as_ac_File { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_File"\" = x"yes"; then : PLUGINDIRS="${PLUGINDIR} ${PLUGINDIRS}" fi # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XDisplayName in -lX11" >&5 $as_echo_n "checking for XDisplayName in -lX11... " >&6; } if ${ac_cv_lib_X11_XDisplayName+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 XDisplayName (); int main () { return XDisplayName (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_X11_XDisplayName=yes else ac_cv_lib_X11_XDisplayName=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_XDisplayName" >&5 $as_echo "$ac_cv_lib_X11_XDisplayName" >&6; } if test "x$ac_cv_lib_X11_XDisplayName" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBX11 1 _ACEOF LIBS="-lX11 $LIBS" fi # Check to see if gcov required... # Check whether --enable-gcov was given. if test "${enable_gcov+set}" = set; then : enableval=$enable_gcov; case "${enableval}" in yes) gcov=true ;; no) gcov=false ;; *) as_fn_error $? "bad value ${enableval} for --enable-gcov" "$LINENO" 5 ;; esac else gcov=false fi if test "x$gcov" = xtrue; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgcov" >&5 $as_echo_n "checking for main in -lgcov... " >&6; } if ${ac_cv_lib_gcov_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgcov $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gcov_main=yes else ac_cv_lib_gcov_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcov_main" >&5 $as_echo "$ac_cv_lib_gcov_main" >&6; } if test "x$ac_cv_lib_gcov_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGCOV 1 _ACEOF LIBS="-lgcov $LIBS" fi XCFLAGS="-g -fprofile-arcs -ftest-coverage -fstack-protector-all -Wall" $as_echo "#define GCOV 1" >>confdefs.h fi #Check to see if debug required... # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; case "${enableval}" in yes) debug=true ;; no) debug=false ;; *) as_fn_error $? "Bad value ${enableval} for --enable-debug" "$LINENO" 5 ;; esac else debug=false fi if test "x$debug" = xtrue; then $as_echo "#define DEBUG 1" >>confdefs.h else $as_echo "#define NODEBUG 1" >>confdefs.h fi #Check to see if Always Xembed... # Check whether --enable-always-xembed was given. if test "${enable_always_xembed+set}" = set; then : enableval=$enable_always_xembed; case "${enableval}" in yes) xembed=true ;; no) xembed=false ;; *) as_fn_error $? "Bad value ${enableval} for --enable-always-xembed" "$LINENO" 5 ;; esac else xembed=false fi if test "x${xembed}" = xtrue; then $as_echo "#define ALWAYS_NEEDS_XEMBED 1" >>confdefs.h fi # Checks for header files. { $as_echo "$as_me:${as_lineno-$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 ${ac_cv_path_GREP+:} false; 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 as_fn_arith $ac_count + 1 && ac_count=$as_val 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_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; 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 as_fn_arith $ac_count + 1 && ac_count=$as_val 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_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h 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` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = 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 inttypes.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" case $ac_cv_c_int16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int16_t $ac_cv_c_int16_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac # Check to see if -lsocket and -lnsl is required (solaris) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } if ${ac_cv_search_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF for ac_lib in '' nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gethostbyname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gethostbyname+:} false; then : break fi done if ${ac_cv_search_gethostbyname+:} false; then : else ac_cv_search_gethostbyname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 $as_echo "$ac_cv_search_gethostbyname" >&6; } ac_res=$ac_cv_search_gethostbyname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } if ${ac_cv_search_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 socket (); int main () { return socket (); ; return 0; } _ACEOF for ac_lib in '' socket; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_socket=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_socket+:} false; then : break fi done if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 $as_echo "$ac_cv_search_socket" >&6; } ac_res=$ac_cv_search_socket if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket -lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = xyes; then : LIBS="-lsocket -lnsl $LIBS" fi fi # Checks for library functions. for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_func in alarm dup2 gethostname memset mkdir putenv rmdir select strcasecmp strchr strcspn strncasecmp strrchr strstr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_config_files="$ac_config_files Makefile" $as_echo "#define XP_UNIX 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define VERSION "${PACKAGE_VERSION}" _ACEOF 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:${as_lineno-$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= ;; #( *) { eval $ac_var=; 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 if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$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= U= 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. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${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:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_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} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_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 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 # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (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 # 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. as_myself= 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 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith 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 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi 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'` # 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 ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac 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 # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { 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_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' 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 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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 mozplugger $as_me 1.14.5, which was generated by GNU Autoconf 2.68. 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" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, 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 Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ mozplugger config.status 1.14.5 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 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' 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=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= 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 ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; 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"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append 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 as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --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_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append 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 _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" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; 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 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= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # 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=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi 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 {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 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_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 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_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 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 >>"\$ac_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 >>"\$ac_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 < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// 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 >"$ac_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_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 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_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " 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_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[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="$ac_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_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append 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:${as_lineno-$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 >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; 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"; as_fn_mkdir_p 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 # _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:${as_lineno-$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 $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$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 "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # 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 || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi