Fix find header when directly in /usr/include + honour --with-libdir option
authorRemi Collet <fedora@famillecollet.com>
Fri, 10 Jan 2014 13:19:23 +0000 (14:19 +0100)
committerRemi Collet <fedora@famillecollet.com>
Fri, 10 Jan 2014 13:19:23 +0000 (14:19 +0100)
config.m4
php_ircclient.c

index c8940daae46c74abe80513a078bf19a7835619c0..d238bbe098f169209c56e19602d4295d1233e8a8 100644 (file)
--- a/config.m4
+++ b/config.m4
@@ -5,20 +5,25 @@ if test "$PHP_IRCCLIENT" != "no"; then
        AC_PROG_EGREP
        AC_PROG_SED
        
-       AC_MSG_CHECKING([for libircclient/libircclient.h])
+       AC_MSG_CHECKING([for libircclient.h])
        for d in $PHP_IRCCLIENT /usr /usr/local /opt; do
-               if test -f $d/include/libircclient/libircclient.h; then
+               if test -f $d/include/libircclient.h; then
+                       IRCCLIENT_INCDIR=$d/include
+                       IRCCLIENT_LIBDIR=$d/$PHP_LIBDIR
                        AC_MSG_RESULT([found in $d])
-                       IRCCLIENT_DIR=$d
+               elif test -f $d/include/libircclient/libircclient.h; then
+                       AC_MSG_RESULT([found in $d])
+                       IRCCLIENT_INCDIR=$d/include/libircclient
+                       IRCCLIENT_LIBDIR=$d/$PHP_LIBDIR
                        break
                fi
        done
-       if test "x$IRCCLIENT_DIR" = "x"; then
+       if test "x$IRCCLIENT_INCDIR" = "x"; then
                AC_MSG_ERROR([not found])
        fi
-       if test -f "$IRCCLIENT_DIR/include/libircclient/libirc_params.h"; then
-               PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_HIGH=`$EGREP "define LIBIRC_VERSION_HIGH" $IRCCLIENT_DIR/include/libircclient/libirc_params.h | $SED -e 's/[[^0-9\x]]//g'`
-               PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_LOW=`$EGREP "define LIBIRC_VERSION_LOW" $IRCCLIENT_DIR/include/libircclient/libirc_params.h | $SED -e 's/[[^0-9\x]]//g'`
+       if test -f "$IRCCLIENT_INCDIR/libirc_params.h"; then
+               PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_HIGH=`$EGREP "define LIBIRC_VERSION_HIGH" $IRCCLIENT_INCDIR/libirc_params.h | $SED -e 's/[[^0-9\x]]//g'`
+               PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_LOW=`$EGREP "define LIBIRC_VERSION_LOW" $IRCCLIENT_INCDIR/libirc_params.h | $SED -e 's/[[^0-9\x]]//g'`
        else
                PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_HIGH=0
                PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_LOW=0
@@ -26,20 +31,20 @@ if test "$PHP_IRCCLIENT" != "no"; then
        AC_DEFINE_UNQUOTED([PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_HIGH], [$PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_HIGH], [ ])
        AC_DEFINE_UNQUOTED([PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_LOW], [$PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_LOW], [ ])
        
-       PHP_ADD_INCLUDE($IRCCLIENT_DIR/include)
+       PHP_ADD_INCLUDE($IRCCLIENT_INCDIR)
        AC_CHECK_MEMBER([irc_callbacks_t.event_channel_notice], [
                AC_DEFINE(HAVE_LIBIRCCLIENT_EVENT_CHANNEL_NOTICE, 1, [ ])
        ], [], [
-               [#include <libircclient/libircclient.h>]
+               [#include <libircclient.h>]
        ])
        PHP_CHECK_LIBRARY(ircclient, irc_create_session,
        [
-               PHP_ADD_LIBRARY_WITH_PATH(ircclient, $IRCCLIENT_DIR/lib, IRCCLIENT_SHARED_LIBADD)
+               PHP_ADD_LIBRARY_WITH_PATH(ircclient, $IRCCLIENT_LIBDIR, IRCCLIENT_SHARED_LIBADD)
                AC_DEFINE(HAVE_LIBIRCCLIENT,1,[ ])
        ],[
                AC_MSG_ERROR([libircclient not found])
        ],[
-               -L$IRCCLIENT_DIR/lib -lm
+               -L$IRCCLIENT_LIBDIR -lm
        ])
        PHP_SUBST([IRCCLIENT_SHARED_LIBADD])
        PHP_NEW_EXTENSION([ircclient], [php_ircclient.c], [$ext_shared])
index e7134a124be3a5bd415c4f2e348b1f26c737f249..97e28d6a563354e91952306171195a10d8d29b57 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <errno.h>
 #include <ctype.h>
-#include <libircclient/libircclient.h>
+#include <libircclient.h>
 
 PHP_FUNCTION(parse_origin)
 {