#! /bin/sh

#
# Generates archtecture depended files
#
# $Id: genconfig.in,v 1.1 2008/09/18 11:25:29 taisuke Exp $
#

slim_version=@SLIM_VERSION@

# Standard configured paths
prefix=${prefix:-@prefix@}

exec_prefix=@exec_prefix@
pathfix="cat"

datarootdir=@datarootdir@  # for autoconf 2.60 and later.
slim_datadir=@datadir@/slim

slim_libdir=`echo "$slim_datadir/lib" | $pathfix`
slim_extdir=`echo "$slim_datadir/ext" | $pathfix`

#============================================================
# arch.h
#
cat > arch.h <<EOF
/* Generated by genconfig.  DO NOT EDIT */

#ifndef LMN_ARCH_H
#define LMN_ARCH_H

#define SLIM_DATA_DIR "$slim_datadir"
#define SLIM_LIB_DIR "$slim_libdir"
#define SLIM_EXT_DIR "$slim_extdir"

#if defined __CYGWIN32__ && !defined __CYGWIN__
#  define __CYGWIN__  __CYGWIN32__
#endif

#if defined _WIN32 && !defined __CYGWIN__
#  define DIR_SEPARATOR_CHAR    '\\\\'
#  define DIR_SEPARATOR_STR	    "\\\\"
#  define PATH_SEPARATOR_CHAR    ';'
#  define PATH_SEPARATOR_STR     ";"
#endif
#ifndef DIR_SEPARATOR_CHAR
#  define DIR_SEPARATOR_CHAR    '/'
#  define DIR_SEPARATOR_STR	    "/"
#  define PATH_SEPARATOR_CHAR   ':'
#  define PATH_SEPARATOR_STR    ":"
#endif /* !DIR_SEPARATOR_CHAR */

#if defined  _WIN32 || defined __CYGWIN__
#  define DL_FILE_TYPE          "dll"
#else
#  define DL_FILE_TYPE          "so"
#endif

#endif /* LMN_ARCH_H */
EOF


#============================================================
# ../lib/config.lmn
#
cat > ../lib/config.lmn <<EOF
%%  Generated by genconfig.  DO NOT EDIT

{
module(config).

%% Version
R=config.version :- R="$slim_version".
%% Prefix
R=config.prefix :- R="$prefix".
%% Manual Directory
R=config.mandir :- R="$mandir".
%% System Data Directory
R=config.sysdatadir :- R="$slim_datadir".
%% System Library Directory
R=config.syslibdir :- R="$slim_libdir".
R=config.sysextdir :- R="$slim_extdir".

}.
EOF



# Local variables:
# mode: shell-script
# end:
