Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 301)
+++ CMakeLists.txt	(revision 304)
@@ -48,11 +48,11 @@
 SUBDIRS(freeDiameter)
 
-# Do we build the extensions?
-OPTION(IGNORE_ALL_EXTENSIONS "Ignore the extensions completly?")
-IF(NOT IGNORE_ALL_EXTENSIONS)
-	SUBDIRS(extensions)
-ENDIF(NOT IGNORE_ALL_EXTENSIONS)
+# Extensions (there is no point in freeDiameter without any extension)
+SUBDIRS(extensions)
 
-# The documentation to install
+
+####
+## INSTALL section ##
+
 INSTALL(FILES README LICENSE doc/freediameter.conf.sample
 	DESTINATION doc
Index: INSTALL
===================================================================
--- INSTALL	(revision 300)
+++ INSTALL	(revision 304)
@@ -3,16 +3,22 @@
 
 Building in a separate directory is recommended:
-mkdir build
-cd build
-cmake ../
-make
+# mkdir build
+# cd build
+# cmake ../
+# make
+
+Note: instead of passing options on the command line, you can use a CMake front-end (for example ccmake or cmake-gui)
+or edit the CCmakeCache.txt file directly. If your cmake installation is recent, you can also do:
+# mkdir build
+# cd build
+# cmake ../
+# make edit_cache
+# make
+
 
 You can enable the unary tests by doing:
-cmake -DSKIP_TESTS:BOOL=OFF ../
-make
-make tests
-
-Note: instead of passing options on the command line, you can use a CMake front-end (for example ccmake or cmake-gui)
-or edit the CCmakeCache.txt file directly.
+# cmake -DSKIP_TESTS:BOOL=OFF ../
+# make
+# make tests
 
 Note that there are dependencies on external tools that may not be enforced by the configure script.
Index: INSTALL.Ubuntu
===================================================================
--- INSTALL.Ubuntu	(revision 298)
+++ INSTALL.Ubuntu	(revision 304)
@@ -53,2 +53,4 @@
 # make test
 
+
+
Index: cmake/Modules/CMakeUserUseBison.cmake
===================================================================
--- cmake/Modules/CMakeUserUseBison.cmake	(revision 0)
+++ cmake/Modules/CMakeUserUseBison.cmake	(revision 304)
@@ -26,4 +26,5 @@
    MESSAGE(STATUS "Looking for bison -- ${BISON_EXECUTABLE}")
  ENDIF(BISON_EXECUTABLE)
+ MARK_AS_ADVANCED(BISON_EXECUTABLE)
 ENDIF(NOT BISON_EXECUTABLE)
 
Index: cmake/Modules/CMakeUserUseFlex.cmake
===================================================================
--- cmake/Modules/CMakeUserUseFlex.cmake	(revision 0)
+++ cmake/Modules/CMakeUserUseFlex.cmake	(revision 304)
@@ -16,4 +16,5 @@
     MESSAGE(STATUS "Looking for flex -- ${FLEX_EXECUTABLE}")
   ENDIF(FLEX_EXECUTABLE)
+ MARK_AS_ADVANCED(FLEX_EXECUTABLE)
 ENDIF(NOT FLEX_EXECUTABLE) 
 
Index: cmake/Modules/FindGnuTLS.cmake
===================================================================
--- cmake/Modules/FindGnuTLS.cmake	(revision 284)
+++ cmake/Modules/FindGnuTLS.cmake	(revision 304)
@@ -35,3 +35,3 @@
 # Lastly make it so that the GNUTLS_LIBRARY and GNUTLS_INCLUDE_DIR variables
 # only show up under the advanced options in the gui cmake applications.
-MARK_AS_ADVANCED( GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIRS )
+MARK_AS_ADVANCED( GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR )
Index: cmake/Modules/FindPostgreSQL.cmake
===================================================================
--- cmake/Modules/FindPostgreSQL.cmake	(revision 284)
+++ cmake/Modules/FindPostgreSQL.cmake	(revision 304)
@@ -34,3 +34,3 @@
 # Lastly make it so that the POSTGRESQL_LIBRARY and POSTGRESQL_INCLUDE_DIR variables
 # only show up under the advanced options in the gui cmake applications.
-MARK_AS_ADVANCED( POSTGRESQL_LIBRARIES POSTGRESQL_INCLUDE_DIR )
+MARK_AS_ADVANCED( POSTGRESQL_LIBRARY POSTGRESQL_INCLUDE_DIR )
Index: extensions/CMakeLists.txt
===================================================================
--- extensions/CMakeLists.txt	(revision 283)
+++ extensions/CMakeLists.txt	(revision 304)
@@ -20,4 +20,5 @@
 	MESSAGE(SEND_ERROR "Unable to find gcrypt.h, please install libgcrypt-dev or equivalent")
 Endif ( NOT GCRYPT_INCLUDE_DIR )
+MARK_AS_ADVANCED(GCRYPT_INCLUDE_DIR)
 INCLUDE_DIRECTORIES(${GCRYPT_INCLUDE_DIR})
 
@@ -77,9 +78,4 @@
 # Debug & test extensions
 
-OPTION(BUILD_SAMPLE "Build sample.fdx? (Simple extension to demonstrate extension mechanism, for developpers only)" OFF)
-	IF (BUILD_SAMPLE)
-	   SUBDIRS(_sample)
-	ENDIF (BUILD_SAMPLE)
-
 OPTION(BUILD_DBG_MONITOR "Build dbg_monitor.fdx? (display periodical debug information on the console)" OFF)
 	IF (BUILD_DBG_MONITOR)
@@ -92,9 +88,4 @@
  	ENDIF (BUILD_DBG_RT)
 
-OPTION(BUILD_TEST_ACCT "Build test_acct.fdx? (Receive Accounting-Requests and display the data, but no storage)" OFF)
-	IF (BUILD_TEST_ACCT)
-	   SUBDIRS(test_acct)
-	ENDIF (BUILD_TEST_ACCT)
-
 OPTION(BUILD_TEST_APP "Build test_app.fdx? (Testing application to send dummy message to another peer, for testing purpose only)" OFF)
  	IF (BUILD_TEST_APP)
@@ -102,6 +93,20 @@
  	ENDIF (BUILD_TEST_APP)
 
-OPTION(BUILD_TEST_RT_ANY "Build test_rt_any.fdx? (Routing extension randomly sending message to any peer available, for testing purpose only)" OFF)
- 	IF (BUILD_TEST_RT_ANY)
- 	   SUBDIRS(test_rt_any)
- 	ENDIF (BUILD_TEST_RT_ANY)
+# The following extension have very little use except for specific tests, so we disable them except in Debug configurations.
+IF (CMAKE_BUILD_TYPE MATCHES "Debug")
+	OPTION(BUILD_SAMPLE "Build sample.fdx? (Simple extension to demonstrate extension mechanism, for developpers only)" OFF)
+		IF (BUILD_SAMPLE)
+		   SUBDIRS(_sample)
+		ENDIF (BUILD_SAMPLE)
+
+	OPTION(BUILD_TEST_ACCT "Build test_acct.fdx? (Receive Accounting-Requests and display the data, but no storage)" OFF)
+		IF (BUILD_TEST_ACCT)
+		   SUBDIRS(test_acct)
+		ENDIF (BUILD_TEST_ACCT)
+		
+	OPTION(BUILD_TEST_RT_ANY "Build test_rt_any.fdx? (Routing extension randomly sending message to any peer available, for testing purpose only)" OFF)
+ 		IF (BUILD_TEST_RT_ANY)
+ 		   SUBDIRS(test_rt_any)
+ 		ENDIF (BUILD_TEST_RT_ANY)
+ENDIF (CMAKE_BUILD_TYPE MATCHES "Debug")
+
Index: extensions/_sample/CMakeLists.txt
===================================================================
--- extensions/_sample/CMakeLists.txt	(revision 170)
+++ extensions/_sample/CMakeLists.txt	(revision 304)
@@ -3,9 +3,20 @@
 
 # Overwrite the debug level for the extension code if configured
-OPTION(DEBUG_LEVEL__SAMPLE "Overwrite debug level for the extension _sample if defined" OFF)
+OPTION(DEBUG_LEVEL__SAMPLE "Overwrite debug level for the extension _sample if defined (valid values: FULL, ANNOYING, CALL...)" OFF)
 IF (DEBUG_LEVEL__SAMPLE)
      ADD_DEFINITIONS(-DTRACE_LEVEL=${DEBUG_LEVEL__SAMPLE})
 ENDIF (DEBUG_LEVEL__SAMPLE)
+IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
+  MARK_AS_ADVANCED(DEBUG_LEVEL__SAMPLE)
+ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
 
 # Compile as a module
 FD_ADD_EXTENSION(dbg_sample sample.c fini.c)
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS dbg_sample
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-debug-tools)
Index: extensions/acl_wl/CMakeLists.txt
===================================================================
--- extensions/acl_wl/CMakeLists.txt	(revision 170)
+++ extensions/acl_wl/CMakeLists.txt	(revision 304)
@@ -18,9 +18,21 @@
 
 # Overwrite the debug level for the extension code if configured
-OPTION(DEBUG_LEVEL_ACL_WL "Overwrite debug level for the extension acl_wl if defined" OFF)
+OPTION(DEBUG_LEVEL_ACL_WL "Overwrite debug level for the extension acl_wl if defined (valid values: FULL, ANNOYING, CALL...)" OFF)
 IF (DEBUG_LEVEL_ACL_WL)
      ADD_DEFINITIONS(-DTRACE_LEVEL=${DEBUG_LEVEL_ACL_WL})
 ENDIF (DEBUG_LEVEL_ACL_WL)
+IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
+  MARK_AS_ADVANCED(DEBUG_LEVEL_ACL_WL)
+ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
 
 # Compile as a module
 FD_ADD_EXTENSION(acl_wl ${ACL_WL_SRC})
+
+
+####
+## INSTALL section ##
+
+# We install with the daemon component because it is a base feature.
+INSTALL(TARGETS acl_wl
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-daemon)
Index: extensions/app_acct/CMakeLists.txt
===================================================================
--- extensions/app_acct/CMakeLists.txt	(revision 289)
+++ extensions/app_acct/CMakeLists.txt	(revision 304)
@@ -29,2 +29,11 @@
 FD_ADD_EXTENSION(app_acct ${APP_ACCT_SRC} ${APP_ACCT_SRC_GEN})
 TARGET_LINK_LIBRARIES(app_acct ${POSTGRESQL_LIBRARIES})
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS app_acct
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-accounting-server)
+
Index: extensions/app_radgw/CMakeLists.txt
===================================================================
--- extensions/app_radgw/CMakeLists.txt	(revision 268)
+++ extensions/app_radgw/CMakeLists.txt	(revision 304)
@@ -4,8 +4,11 @@
 
 # Overwrite the debug level for the extension code if configured
-OPTION(DEBUG_LEVEL_APP_RADGW "Overwrite debug level for the extension app_radgw if defined" OFF)
+OPTION(DEBUG_LEVEL_APP_RADGW "Overwrite debug level for the extension app_radgw if defined (valid values: FULL, ANNOYING, CALL...)" OFF)
 IF (DEBUG_LEVEL_APP_RADGW)
      ADD_DEFINITIONS(-DTRACE_LEVEL=${DEBUG_LEVEL_APP_RADGW})
 ENDIF (DEBUG_LEVEL_APP_RADGW)
+IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
+  MARK_AS_ADVANCED(DEBUG_LEVEL_APP_RADGW)
+ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
 
 
@@ -65,4 +68,7 @@
   SET_TARGET_PROPERTIES(${PLGNAME} PROPERTIES SUFFIX ".rgwx" )
   TARGET_LINK_LIBRARIES(${PLGNAME} rgw_common)
+  INSTALL(TARGETS ${PLGNAME}
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-radius-gateway)
 ENDMACRO(RGWX_ADD_PLUGIN)
 
@@ -103,2 +109,12 @@
  	   RGWX_ADD_PLUGIN(echodrop ${RG_COMMON_HEADER} rgwx_echodrop.h rgwx_echodrop.c lex.rgwx_echodrop.c rgwx_echodrop.tab.c rgwx_echodrop.tab.h )
   	ENDIF (BUILD_RGWX_ECHODROP)
+	
+	
+####
+## INSTALL section ##
+
+INSTALL(TARGETS app_radgw
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-radius-gateway)
+
+# Note that all compiled plugins are added by the RGWX_ADD_PLUGIN macro in the component freeDiameter-radius-gateway as well.
Index: extensions/app_radgw/rgw_conf.y
===================================================================
--- extensions/app_radgw/rgw_conf.y	(revision 258)
+++ extensions/app_radgw/rgw_conf.y	(revision 304)
@@ -53,5 +53,4 @@
 #include "rgw_conf.tab.h"	/* bison is not smart enough to define the YYLTYPE before including this code, so... */
 
-#include <sys/stat.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
@@ -97,20 +96,4 @@
 	else
 		fd_log_debug("%s:%d.%d : %s\n", conffile, ploc->first_line, ploc->first_column, s);
-}
-
-/* This function checks a string value is a valid filename */
-static int is_valid_file( char * candidate ) 
-{
-	int ret;
-	struct stat buffer;
-	
-	ret = stat(candidate, &buffer);
-	if (ret != 0) {
-		fd_log_debug("Error on file '%s': %s.\n", candidate, strerror(errno));
-		return 0;
-	}
-
-	/* Ok this candidate is valid */
-	return 1;
 }
 
@@ -161,5 +144,5 @@
 %token <ss>	IP
 
-%type <string>	FILENAME
+%type <string>	FINDFILEEXT
 
 /* simple tokens */
@@ -197,12 +180,28 @@
 				
 /* -------------------------------------- */
-FILENAME:		QSTRING
-			{
-				/* Verify this is a valid file */
-				if (!is_valid_file($1)) {
-					yyerror (&yylloc, conffile, "Error on file name, aborting...");
-					YYERROR;
-				}
-				$$ = $1;
+FINDFILEEXT:		QSTRING
+			{
+				char * fname = $1;
+				FILE * fd;
+				
+				/* First, check if the file exists */
+				fd = fopen(fname, "r");
+				if ((fd == NULL) && (*fname != '/')) {
+					char * bkp = fname;
+					CHECK_MALLOC_DO( fname = malloc( strlen(bkp) + strlen(DEFAULT_EXTENSIONS_PATH) + 2 ),
+						{ yyerror (&yylloc, conffile, "Not enough memory"); YYERROR; } );
+					sprintf(fname, DEFAULT_EXTENSIONS_PATH "/%s", bkp);
+					free(bkp);
+					fd = fopen(fname, "r");
+				}
+				if (fd == NULL) {
+					int ret = errno;
+					TRACE_DEBUG(INFO, "Unable to open file %s for reading: %s\n", fname, strerror(ret));
+					yyerror (&yylloc, conffile, "Error adding plugin"); 
+					YYERROR;
+				}
+				fclose(fd);
+				
+				$$ = fname;
 			}
 			;
@@ -214,5 +213,5 @@
 				free(plgconffile); plgconffile = NULL;
 			}
-			PLG_PREFIX '=' FILENAME plg_attributes ';'
+			PLG_PREFIX '=' FINDFILEEXT plg_attributes ';'
 			{
 				/* Add this extension in the list */
Index: extensions/dbg_monitor/CMakeLists.txt
===================================================================
--- extensions/dbg_monitor/CMakeLists.txt	(revision 120)
+++ extensions/dbg_monitor/CMakeLists.txt	(revision 304)
@@ -2,2 +2,11 @@
 PROJECT("Monitor extension" C)
 FD_ADD_EXTENSION(dbg_monitor dbg_monitor.c)
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS dbg_monitor
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-debug-tools)
+
Index: extensions/dbg_rt/CMakeLists.txt
===================================================================
--- extensions/dbg_rt/CMakeLists.txt	(revision 120)
+++ extensions/dbg_rt/CMakeLists.txt	(revision 304)
@@ -4,2 +4,10 @@
 # Compile as a module
 FD_ADD_EXTENSION(dbg_rt dbg_rt.c)
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS dbg_rt
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-debug-tools)
Index: extensions/dict_eap/CMakeLists.txt
===================================================================
--- extensions/dict_eap/CMakeLists.txt	(revision 10)
+++ extensions/dict_eap/CMakeLists.txt	(revision 304)
@@ -4,2 +4,10 @@
 # Compile as a module
 FD_ADD_EXTENSION(dict_eap dict_eap.c)
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS dict_eap
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-dictionary-RFC4072)
Index: extensions/dict_nasreq/CMakeLists.txt
===================================================================
--- extensions/dict_nasreq/CMakeLists.txt	(revision 10)
+++ extensions/dict_nasreq/CMakeLists.txt	(revision 304)
@@ -4,2 +4,10 @@
 # Compile as a module
 FD_ADD_EXTENSION(dict_nasreq dict_nasreq.c)
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS dict_nasreq
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-dictionary-RFC4005)
Index: extensions/rt_default/CMakeLists.txt
===================================================================
--- extensions/rt_default/CMakeLists.txt	(revision 170)
+++ extensions/rt_default/CMakeLists.txt	(revision 304)
@@ -32,9 +32,22 @@
 
 # Overwrite the debug level for the extension code if configured, example: cmake -DDEBUG_LEVEL_RT_DEFAULT:STATIC=CALL ...
-OPTION(DEBUG_LEVEL_RT_DEFAULT "Overwrite debug level for the extension rt_default if defined" OFF)
+OPTION(DEBUG_LEVEL_RT_DEFAULT "Overwrite debug level for the extension rt_default if defined (valid values: FULL, ANNOYING, CALL...)" OFF)
 IF (DEBUG_LEVEL_RT_DEFAULT)
      ADD_DEFINITIONS(-DTRACE_LEVEL=${DEBUG_LEVEL_RT_DEFAULT})
 ENDIF (DEBUG_LEVEL_RT_DEFAULT)
+IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
+  MARK_AS_ADVANCED(DEBUG_LEVEL_RT_DEFAULT)
+ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
 
 # Compile these files as a freeDiameter extension
 FD_ADD_EXTENSION(rt_default ${RT_DEFAULT_SRC})
+
+
+####
+## INSTALL section ##
+
+# We install with the daemon component because it is a base feature.
+INSTALL(TARGETS rt_default
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-daemon)
+
Index: extensions/test_acct/CMakeLists.txt
===================================================================
--- extensions/test_acct/CMakeLists.txt	(revision 279)
+++ extensions/test_acct/CMakeLists.txt	(revision 304)
@@ -3,2 +3,11 @@
 
 FD_ADD_EXTENSION(test_acct test_acct.c)
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS test_acct
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-debug-tools)
+
Index: extensions/test_app/CMakeLists.txt
===================================================================
--- extensions/test_app/CMakeLists.txt	(revision 235)
+++ extensions/test_app/CMakeLists.txt	(revision 304)
@@ -21,2 +21,11 @@
 # Compile as a module
 FD_ADD_EXTENSION(test_app ${APP_TEST_SRC})
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS test_app
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-debug-tools)
+
Index: extensions/test_rt_any/CMakeLists.txt
===================================================================
--- extensions/test_rt_any/CMakeLists.txt	(revision 120)
+++ extensions/test_rt_any/CMakeLists.txt	(revision 304)
@@ -4,2 +4,10 @@
 # Compile as a module
 FD_ADD_EXTENSION(test_rt_any test_rt_any.c)
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS test_rt_any
+	LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
+	COMPONENT freeDiameter-debug-tools)
Index: freeDiameter/CMakeLists.txt
===================================================================
--- freeDiameter/CMakeLists.txt	(revision 300)
+++ freeDiameter/CMakeLists.txt	(revision 304)
@@ -52,4 +52,5 @@
 	MESSAGE(SEND_ERROR "Unable to find gcrypt.h, please install libgcrypt-dev or equivalent")
 Endif ( NOT GCRYPT_INCLUDE_DIR )
+MARK_AS_ADVANCED(GCRYPT_INCLUDE_DIR)
 INCLUDE_DIRECTORIES(${GCRYPT_INCLUDE_DIR})
 
@@ -64,9 +65,4 @@
 TARGET_LINK_LIBRARIES(freeDiameterd libfreeDiameter ${FD_LIBS})
 
-# The daemon is to be installed as part of the freeDiameter-daemon component.
-INSTALL(TARGETS freeDiameterd
-	RUNTIME DESTINATION bin
-	COMPONENT freeDiameter-daemon)
-
 # Save the list of files, if needed
 SET(FD_COMMON_SRC ${FD_COMMON_SRC} PARENT_SCOPE)
@@ -74,6 +70,17 @@
 
 # The unary tests directory
-OPTION(SKIP_TESTS "Skip compilation of the tests?" OFF)
+OPTION(SKIP_TESTS "Skip compilation of the tests?" ON)
 IF ( NOT SKIP_TESTS )
 	SUBDIRS(tests)
 ENDIF ( NOT SKIP_TESTS )
+IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
+  MARK_AS_ADVANCED(SKIP_TESTS)
+ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
+
+
+####
+## INSTALL section ##
+
+INSTALL(TARGETS freeDiameterd
+	RUNTIME DESTINATION bin
+	COMPONENT freeDiameter-daemon)
Index: freeDiameter/config.c
===================================================================
--- freeDiameter/config.c	(revision 258)
+++ freeDiameter/config.c	(revision 304)
@@ -35,4 +35,5 @@
 
 #include "fD.h"
+#include <sys/stat.h>
 
 /* Configuration management */
@@ -51,5 +52,4 @@
 	
 	fd_g_config->cnf_eyec = EYEC_CONFIG;
-	fd_g_config->cnf_file = DEFAULT_CONF_FILE;
 	
 	fd_g_config->cnf_timer_tc = 30;
@@ -145,7 +145,16 @@
 	extern FILE * fddin;
 	
-	TRACE_DEBUG (FULL, "Parsing configuration file: %s", fd_g_config->cnf_file);
+	/* Attempt to find the configuration file */
+	if (!fd_g_config->cnf_file)
+		fd_g_config->cnf_file = FD_DEFAULT_CONF_FILENAME;
 	
 	fddin = fopen(fd_g_config->cnf_file, "r");
+	if ((fddin == NULL) && (*fd_g_config->cnf_file != '/')) {
+		/* We got a relative path, attempt to add the default directory prefix */
+		char * bkp = fd_g_config->cnf_file;
+		CHECK_MALLOC( fd_g_config->cnf_file = malloc(strlen(bkp) + strlen(DEFAULT_CONF_PATH) + 2) ); /* we will not free it, but not important */
+		sprintf( fd_g_config->cnf_file, DEFAULT_CONF_PATH "/%s", bkp );
+		fddin = fopen(fd_g_config->cnf_file, "r");
+	}
 	if (fddin == NULL) {
 		int ret = errno;
@@ -155,4 +164,5 @@
 	
 	/* call yacc parser */
+	TRACE_DEBUG (FULL, "Parsing configuration file: %s", fd_g_config->cnf_file);
 	CHECK_FCT(  fddparse(fd_g_config)  );
 	
Index: freeDiameter/fD.h
===================================================================
--- freeDiameter/fD.h	(revision 285)
+++ freeDiameter/fD.h	(revision 304)
@@ -42,4 +42,8 @@
 #include <freeDiameter/freeDiameter.h>
 
+#ifndef FD_DEFAULT_CONF_FILENAME
+#define FD_DEFAULT_CONF_FILENAME "freeDiameter.conf"
+#endif /* FD_DEFAULT_CONF_FILENAME */
+
 #ifdef DISABLE_SCTP
 #undef IPPROTO_SCTP
Index: freeDiameter/fdd.y
===================================================================
--- freeDiameter/fdd.y	(revision 258)
+++ freeDiameter/fdd.y	(revision 304)
@@ -309,5 +309,50 @@
 loadext:		LOADEXT '=' QSTRING extconf ';'
 			{
-				CHECK_FCT_DO( fd_ext_add( $3, $4 ),
+				char * fname;
+				char * cfname;
+				FILE * fd;
+				
+				/* Try and open the extension file */
+				fname = $3;
+				fd = fopen(fname, "r");
+				if ((fd == NULL) && (*fname != '/')) {
+					char * bkp = fname;
+					CHECK_MALLOC_DO( fname = malloc( strlen(bkp) + strlen(DEFAULT_EXTENSIONS_PATH) + 2 ),
+						{ yyerror (&yylloc, conf, "Not enough memory"); YYERROR; } );
+					sprintf(fname, DEFAULT_EXTENSIONS_PATH "/%s", bkp);
+					free(bkp);
+					fd = fopen(fname, "r");
+				}
+				if (fd == NULL) {
+					int ret = errno;
+					TRACE_DEBUG(INFO, "Unable to open extension file %s for reading: %s\n", fname, strerror(ret));
+					yyerror (&yylloc, conf, "Error adding extension"); 
+					YYERROR;
+				}
+				fclose(fd);
+				
+				/* Try and open the configuration file (optional) */
+				cfname = $4;
+				if (cfname) {
+					fd = fopen(cfname, "r");
+					if ((fd == NULL) && (*cfname != '/')) {
+						char * test;
+						CHECK_MALLOC_DO( test = malloc( strlen(cfname) + strlen(DEFAULT_CONF_PATH) + 2 ),
+							{ yyerror (&yylloc, conf, "Not enough memory"); YYERROR; } );
+						sprintf(test, DEFAULT_CONF_PATH "/%s", cfname);
+						fd = fopen(test, "r");
+						if (fd) {
+							free(cfname);
+							cfname=test;
+						} else {
+							/* This is not an error, we allow an extension to wait for something else than a real conf file. */
+							free(test);
+						}
+					}
+					if (fd)
+						fclose(fd);
+				}
+				
+				CHECK_FCT_DO( fd_ext_add( fname, cfname ),
 					{ yyerror (&yylloc, conf, "Error adding extension"); YYERROR; } );
 			}
Index: freeDiameter/main.c
===================================================================
--- freeDiameter/main.c	(revision 285)
+++ freeDiameter/main.c	(revision 304)
@@ -310,5 +310,5 @@
   		"  -V, --version          Print version and exit\n"
   		"  -c, --config=filename  Read configuration from this file instead of the \n"
-		"                           default location (%s).\n", DEFAULT_CONF_FILE);
+		"                           default location (" DEFAULT_CONF_PATH "/" FD_DEFAULT_CONF_FILENAME ").\n");
  	printf( "\nDebug:\n"
   		"  These options are mostly useful for developers\n"
Index: freeDiameter/tests/CMakeLists.txt
===================================================================
--- freeDiameter/tests/CMakeLists.txt	(revision 288)
+++ freeDiameter/tests/CMakeLists.txt	(revision 304)
@@ -110,2 +110,8 @@
    ADD_TEST(${TEST} ${EXECUTABLE_OUTPUT_PATH}/${TEST})
 ENDFOREACH( TEST )
+
+
+####
+## INSTALL section ##
+
+# we do not install the tests
Index: include/freeDiameter/CMakeLists.txt
===================================================================
--- include/freeDiameter/CMakeLists.txt	(revision 236)
+++ include/freeDiameter/CMakeLists.txt	(revision 304)
@@ -6,6 +6,9 @@
 # Configurable parameters
 
-# Name of the default configuration file
-OPTION(DEFAULT_CONF_FILE "Default path to configuration file?" OFF)
+# The default directory for configuration files
+SET(DEFAULT_CONF_PATH ${CMAKE_INSTALL_PREFIX}/etc/freeDiameter CACHE PATH "Default location of freeDiameter configuration files")
+
+# The default directory for extension files
+SET(DEFAULT_EXTENSIONS_PATH ${CMAKE_INSTALL_PREFIX}/lib/fdx CACHE PATH "Default location of freeDiameter extensions")
 
 # Disable SCTP support completly ?
@@ -14,4 +17,6 @@
 	OPTION(DEBUG_SCTP "Verbose SCTP (for debug)?" OFF)
 	OPTION(SCTP_USE_MAPPED_ADDRESSES "Use v6-mapped v4 addresses in SCTP (workaround some SCTP limitations)?" OFF)
+ELSE (NOT DISABLE_SCTP)
+	MESSAGE(STATUS "Disabled SCTP support.")
 ENDIF (NOT DISABLE_SCTP)
 
@@ -19,4 +24,5 @@
 OPTION(ERRORS_ON_TODO "(development) Generate compilation errors on TODO items ?" OFF)
 
+MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO)
 
 ########################
@@ -90,8 +96,4 @@
 CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
 
-# The default configuration file name
-IF (NOT DEFAULT_CONF_FILE)
-   SET(DEFAULT_CONF_FILE "freeDiameter.conf")
-ENDIF (NOT DEFAULT_CONF_FILE)
 ##########################
 
@@ -99,4 +101,16 @@
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeDiameter-host.h.in ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h)
 
-# Save the FD_LIBS for parent scope
+# Save some variables for the other directories
 SET(FD_LIBS ${FD_LIBS} PARENT_SCOPE)
+SET(DEFAULT_CONF_PATH ${DEFAULT_CONF_PATH} PARENT_SCOPE)
+SET(DEFAULT_EXTENSIONS_PATH ${DEFAULT_EXTENSIONS_PATH} PARENT_SCOPE)
+
+
+####
+## INSTALL section ##
+
+# The headers from this directory are required to develop new extensions for freeDiameter.
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h libfreeDiameter.h freeDiameter.h extension.h
+	DESTINATION include/freeDiameter
+	COMPONENT freeDiameter-dev)
+
Index: include/freeDiameter/freeDiameter-host.h.in
===================================================================
--- include/freeDiameter/freeDiameter-host.h.in	(revision 51)
+++ include/freeDiameter/freeDiameter-host.h.in	(revision 304)
@@ -70,6 +70,6 @@
 #cmakedefine FD_PROJECT_COPYRIGHT "@FD_PROJECT_COPYRIGHT@"
 
-#cmakedefine DEFAULT_CONF_FILE "@DEFAULT_CONF_FILE@"
-
+#cmakedefine DEFAULT_CONF_PATH "@DEFAULT_CONF_PATH@"
+#cmakedefine DEFAULT_EXTENSIONS_PATH "@DEFAULT_EXTENSIONS_PATH@"
 
 #endif /* FD_IS_CONFIG */
Index: include/freeDiameter/libfreeDiameter.h
===================================================================
--- include/freeDiameter/libfreeDiameter.h	(revision 302)
+++ include/freeDiameter/libfreeDiameter.h	(revision 304)
@@ -224,9 +224,18 @@
 }
 #else /* DEBUG */
-/* Do not print thread, function, ... only the message itself in this case. */
-#define TRACE_DEBUG(level,format,args... ) {		\
-	if ( TRACE_BOOL(level) ) {			\
-		fd_log_debug(format "\n", ## args); 	\
-	}						\
+/* Do not print thread, function, ... only the message itself in this case, unless the debug level is set > FULL. */
+#define TRACE_DEBUG(level,format,args... ) {												\
+	if ( TRACE_BOOL(level) ) {													\
+		if (fd_g_debug_lvl > FULL) {												\
+			char __buf[25];													\
+			char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");					\
+			fd_log_debug("\t | tid:%-20s\t%s\tin %s@%s:%d\n"								\
+				  "\t%s|%*s" format "\n",  										\
+						__thn, fd_log_time(NULL, __buf, sizeof(__buf)), __PRETTY_FUNCTION__, __FILE__, __LINE__,\
+						(level < FULL)?"@":" ",level, "", ## args); 						\
+		} else {														\
+			fd_log_debug(format "\n", ## args); 										\
+		}															\
+	}																\
 }
 #endif /* DEBUG */
Index: libfreeDiameter/CMakeLists.txt
===================================================================
--- libfreeDiameter/CMakeLists.txt	(revision 300)
+++ libfreeDiameter/CMakeLists.txt	(revision 304)
@@ -26,10 +26,13 @@
 TARGET_LINK_LIBRARIES(libfreeDiameter ${FD_LIBS})
 
-# The library is to be installed as part of the freeDiameter-common component.
+# Save the list of files for testcases in the daemon's directory
+SET(LFD_SRC ${LFD_SRC} PARENT_SCOPE)
+
+
+####
+## INSTALL section ##
+
 INSTALL(TARGETS libfreeDiameter
 	LIBRARY DESTINATION lib
 	COMPONENT freeDiameter-common)
 
-# Save the list of files for testcases in the daemon's directory
-SET(LFD_SRC ${LFD_SRC} PARENT_SCOPE)
-
