]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add --enable-fhs flag to configure
authorTravis Cross <tc@traviscross.com>
Sat, 1 Mar 2014 03:13:13 +0000 (03:13 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 2 Mar 2014 10:38:28 +0000 (10:38 +0000)
When --enable-fhs is passed to configure, we set all paths by default
in a way compliant with FHS, the Filesystem Hierarchy Standard.

  http://www.pathname.com/fhs/

Each path may still be overridden by passing the specific flag for it.

configure.in

index e8681818d5d0277d982bfc94989aee0dd1bf7dff..d871d56903b675c04363d74785b4608f72615105 100644 (file)
@@ -32,11 +32,12 @@ switch_builddir=`pwd`
 AC_SUBST(switch_srcdir)
 AC_SUBST(switch_builddir)
 
-# Where to install the modules
-AC_ARG_WITH([modinstdir],
-       [AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modulesdir="$withval"], [modulesdir="${prefix}/mod"])
-AC_SUBST(modulesdir)
-AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modulesdir}",[where to install the modules to])
+# Whether to follow FHS
+AC_ARG_ENABLE([fhs],
+  [AS_HELP_STRING([--enable-fhs],
+    [Follow the FHS when placing files and directories])],,
+  [enable_fhs="no"])
+AM_CONDITIONAL([ENABLE_FHS],[test "${enable_fhs}" = "yes"])
 
 if test "$localstatedir" = "\${prefix}/var" ; then
     rundir="$prefix/run"
@@ -45,49 +46,85 @@ else
     rundir="$localstatedir/run/freeswitch"
     logdir="$localstatedir/log/freeswitch"
 fi
+
+default_dbdir="$prefix/db"
+default_grammardir="$prefix/grammar"
+default_htdocsdir="$prefix/htdocs"
+default_logfiledir="$logdir"
+default_modulesdir="$prefix/mod"
+default_pkgconfigdir="$libdir/pkgconfig"
+default_recordingsdir="$prefix/recordings"
+default_runtimedir="$rundir"
+default_scriptdir="$prefix/scripts"
+default_soundsdir="$prefix/sounds"
+default_storagedir="$prefix/storage"
+
+if test "$enable_fhs" = yes; then
+  prefix="/usr"
+  sysconfdir="/etc"
+  localstatedir="/var"
+  default_dbdir="/var/lib/freeswitch/db"
+  default_grammardir="/usr/share/freeswitch/grammar"
+  default_htdocsdir="/usr/share/freeswitch/htdocs"
+  default_logfiledir="/var/log/freeswitch"
+  default_modulesdir="$libdir/freeswitch/mod"
+  default_pkgconfigdir="$libdir/pkgconfig"
+  default_recordingsdir="/var/lib/freeswitch/recordings"
+  default_runtimedir="/var/run/freeswitch"
+  default_scriptdir="/usr/share/freeswitch/scripts"
+  default_soundsdir="/usr/share/freeswitch/sounds"
+  default_storagedir="/var/lib/freeswitch/storage"
+fi
+
+# Where to install the modules
+AC_ARG_WITH([modinstdir],
+       [AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modulesdir="$withval"], [modulesdir="${default_modulesdir}"])
+AC_SUBST(modulesdir)
+AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modulesdir}",[where to install the modules to])
+
 # Where to put pidfile
 AC_ARG_WITH([rundir],
-       [AS_HELP_STRING([--with-rundir=DIR], [Put pidfile into this location (default: $prefix/run)])], [runtimedir="$withval"], [runtimedir="$rundir"])
+       [AS_HELP_STRING([--with-rundir=DIR], [Put pidfile into this location (default: $prefix/run)])], [runtimedir="$withval"], [runtimedir="${default_runtimedir}"])
 AC_SUBST(runtimedir)
 AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],"${runtimedir}",[where to put pidfile to])
 
 AC_ARG_WITH([logfiledir],
-       [AS_HELP_STRING([--with-logfiledir=DIR], [Put logfiles into this location (default: $localstatedir/log)])], [logfiledir="$withval"], [logfiledir="$logdir"])
+       [AS_HELP_STRING([--with-logfiledir=DIR], [Put logfiles into this location (default: $localstatedir/log)])], [logfiledir="$withval"], [logfiledir="${default_logfiledir}"])
 AC_SUBST(logfiledir)
 AC_DEFINE_UNQUOTED([SWITCH_LOG_DIR],"${logfiledir}",[where to put log files])
 
 AC_ARG_WITH([dbdir],
-       [AS_HELP_STRING([--with-dbdir=DIR], [Put database files into this location (default: $prefix/db)])], [dbdir="$withval"], [dbdir="$prefix/db"])
+       [AS_HELP_STRING([--with-dbdir=DIR], [Put database files into this location (default: $prefix/db)])], [dbdir="$withval"], [dbdir="${default_dbdir}"])
 AC_SUBST(dbdir)
 AC_DEFINE_UNQUOTED([SWITCH_DB_DIR],"${dbdir}",[where to put db files])
 
 AC_ARG_WITH([htdocsdir],
-       [AS_HELP_STRING([--with-htdocsdir=DIR], [Put html files into this location (default: $prefix/htdocs)])], [htdocsdir="$withval"], [htdocsdir="$prefix/htdocs"])
+       [AS_HELP_STRING([--with-htdocsdir=DIR], [Put html files into this location (default: $prefix/htdocs)])], [htdocsdir="$withval"], [htdocsdir="${default_htdocsdir}"])
 AC_SUBST(htdocsdir)
 AC_DEFINE_UNQUOTED([SWITCH_HTDOCS_DIR],"${htdocsdir}",[where to put htdocs files])
 
 AC_ARG_WITH([soundsdir],
-       [AS_HELP_STRING([--with-soundsdir=DIR], [Put sound files into this location (default: $prefix/sounds)])], [soundsdir="$withval"], [soundsdir="$prefix/sounds"])
+       [AS_HELP_STRING([--with-soundsdir=DIR], [Put sound files into this location (default: $prefix/sounds)])], [soundsdir="$withval"], [soundsdir="${default_soundsdir}"])
 AC_SUBST(soundsdir)
 AC_DEFINE_UNQUOTED([SWITCH_SOUNDS_DIR],"${soundsdir}",[where to put sounds files])
 
 AC_ARG_WITH([grammardir],
-       [AS_HELP_STRING([--with-grammardir=DIR], [Put grammar files into this location (default: $prefix/grammar)])], [grammardir="$withval"], [grammardir="$prefix/grammar"])
+       [AS_HELP_STRING([--with-grammardir=DIR], [Put grammar files into this location (default: $prefix/grammar)])], [grammardir="$withval"], [grammardir="${default_grammardir}"])
 AC_SUBST(grammardir)
 AC_DEFINE_UNQUOTED([SWITCH_GRAMMAR_DIR],"${grammardir}",[where to put grammar files])
 
 AC_ARG_WITH([scriptdir],
-       [AS_HELP_STRING([--with-scriptdir=DIR], [Put script files into this location (default: $prefix/scripts)])], [scriptdir="$withval"], [scriptdir="$prefix/scripts"])
+       [AS_HELP_STRING([--with-scriptdir=DIR], [Put script files into this location (default: $prefix/scripts)])], [scriptdir="$withval"], [scriptdir="${default_scriptdir}"])
 AC_SUBST(scriptdir)
 AC_DEFINE_UNQUOTED([SWITCH_SCRIPT_DIR],"${scriptdir}",[where to put script files])
 
 AC_ARG_WITH([recordingsdir],
-       [AS_HELP_STRING([--with-recordingsdir=DIR], [Put recordings files into this location (default: $prefix/recordings)])], [recordingsdir="$withval"], [recordingsdir="$prefix/recordings"])
+       [AS_HELP_STRING([--with-recordingsdir=DIR], [Put recordings files into this location (default: $prefix/recordings)])], [recordingsdir="$withval"], [recordingsdir="${default_recordingsdir}"])
 AC_SUBST(recordingsdir)
 AC_DEFINE_UNQUOTED([SWITCH_RECORDINGS_DIR],"${recordingsdir}",[where to put recording files])
 
 AC_ARG_WITH([storagedir],
-       [AS_HELP_STRING([--with-storagedir=DIR], [Put storage files into this location (default: $prefix/storage)])], [storagedir="$withval"], [storagedir="$prefix/storage"])
+       [AS_HELP_STRING([--with-storagedir=DIR], [Put storage files into this location (default: $prefix/storage)])], [storagedir="$withval"], [storagedir="${default_storagedir}"])
 AC_SUBST(storagedir)
 AC_DEFINE_UNQUOTED([SWITCH_STORAGE_DIR],"${storagedir}",[where to put storage files])
 
@@ -113,7 +150,7 @@ AC_ARG_WITH([pkgconfigdir],
         *) pkgconfigdir="${withval}" ;;
         esac
        ],
-       [pkgconfigdir="${libdir}/pkgconfig"]
+       [pkgconfigdir="${default_pkgconfigdir}"]
 )
 AC_SUBST([pkgconfigdir])